Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
926b64ff
Commit
926b64ff
authored
Oct 20, 2014
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3292 from mshabunin:fix-ios-warnings
parents
55f49048
276bed3e
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
123 additions
and
103 deletions
+123
-103
CMakeLists.txt
3rdparty/zlib/CMakeLists.txt
+1
-1
OpenCVCompilerOptions.cmake
cmake/OpenCVCompilerOptions.cmake
+4
-0
OpenCVUtils.cmake
cmake/OpenCVUtils.cmake
+18
-0
parallel.cpp
modules/core/src/parallel.cpp
+1
-1
persistence.cpp
modules/core/src/persistence.cpp
+2
-2
CMakeLists.txt
modules/highgui/CMakeLists.txt
+1
-15
CMakeLists.txt
modules/imgcodecs/CMakeLists.txt
+1
-15
grfmt_tiff.cpp
modules/imgcodecs/src/grfmt_tiff.cpp
+2
-1
ios_conversions.mm
modules/imgcodecs/src/ios_conversions.mm
+3
-0
demosaicing.cpp
modules/imgproc/src/demosaicing.cpp
+2
-1
pyramids.cpp
modules/imgproc/src/pyramids.cpp
+11
-4
haar.cpp
modules/objdetect/src/haar.cpp
+1
-1
matchers.cpp
modules/stitching/src/matchers.cpp
+5
-0
CMakeLists.txt
modules/videoio/CMakeLists.txt
+1
-15
cap_avfoundation.mm
modules/videoio/src/cap_avfoundation.mm
+27
-26
cap_ios_abstract_camera.mm
modules/videoio/src/cap_ios_abstract_camera.mm
+5
-3
cap_ios_video_camera.mm
modules/videoio/src/cap_ios_video_camera.mm
+6
-5
build_framework.py
platforms/ios/build_framework.py
+29
-11
iOS.cmake
platforms/ios/cmake/Modules/Platform/iOS.cmake
+3
-2
No files found.
3rdparty/zlib/CMakeLists.txt
View file @
926b64ff
...
...
@@ -82,7 +82,7 @@ if(UNIX)
endif
()
endif
()
ocv_warnings_disable
(
CMAKE_C_FLAGS -Wattributes -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
)
ocv_warnings_disable
(
CMAKE_C_FLAGS -W
shorten-64-to-32 -W
attributes -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
)
set_target_properties
(
${
ZLIB_LIBRARY
}
PROPERTIES
OUTPUT_NAME
${
ZLIB_LIBRARY
}
...
...
cmake/OpenCVCompilerOptions.cmake
View file @
926b64ff
...
...
@@ -106,6 +106,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option
(
-march=i686
)
endif
()
if
(
APPLE
)
add_extra_compiler_option
(
-Wno-semicolon-before-method-body
)
endif
()
# Other optimizations
if
(
ENABLE_OMIT_FRAME_POINTER
)
add_extra_compiler_option
(
-fomit-frame-pointer
)
...
...
cmake/OpenCVUtils.cmake
View file @
926b64ff
...
...
@@ -242,6 +242,24 @@ macro(ocv_warnings_disable)
endif
(
NOT ENABLE_NOISY_WARNINGS
)
endmacro
()
macro
(
add_apple_compiler_options the_module
)
ocv_check_flag_support
(
OBJCXX
"-fobjc-exceptions"
HAVE_OBJC_EXCEPTIONS
)
if
(
HAVE_OBJC_EXCEPTIONS
)
foreach
(
source
${
OPENCV_MODULE_
${
the_module
}
_SOURCES
}
)
if
(
"
${
source
}
"
MATCHES
"
\\
.mm$"
)
get_source_file_property
(
flags
"
${
source
}
"
COMPILE_FLAGS
)
if
(
flags
)
set
(
flags
"
${
_flags
}
-fobjc-exceptions"
)
else
()
set
(
flags
"-fobjc-exceptions"
)
endif
()
set_source_files_properties
(
"
${
source
}
"
PROPERTIES COMPILE_FLAGS
"
${
flags
}
"
)
endif
()
endforeach
()
endif
()
endmacro
()
# Provides an option that the user can optionally select.
# Can accept condition to control when option is available for user.
# Usage:
...
...
modules/core/src/parallel.cpp
View file @
926b64ff
...
...
@@ -177,7 +177,7 @@ namespace
static
void
block_function
(
void
*
context
,
size_t
index
)
{
ProxyLoopBody
*
ptr_body
=
static_cast
<
ProxyLoopBody
*>
(
context
);
(
*
ptr_body
)(
cv
::
Range
(
index
,
index
+
1
));
(
*
ptr_body
)(
cv
::
Range
(
(
int
)
index
,
(
int
)
index
+
1
));
}
#elif defined HAVE_CONCURRENCY
class
ProxyLoopBody
:
public
ParallelLoopBodyWrapper
...
...
modules/core/src/persistence.cpp
View file @
926b64ff
...
...
@@ -1177,7 +1177,7 @@ force_int:
int
val
,
is_hex
=
d
==
'x'
;
c
=
ptr
[
3
];
ptr
[
3
]
=
'\0'
;
val
=
strtol
(
ptr
+
is_hex
,
&
endptr
,
is_hex
?
8
:
16
);
val
=
(
int
)
strtol
(
ptr
+
is_hex
,
&
endptr
,
is_hex
?
8
:
16
);
ptr
[
3
]
=
c
;
if
(
endptr
==
ptr
+
is_hex
)
buf
[
len
++
]
=
'x'
;
...
...
@@ -2787,7 +2787,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
// find the last occurence of </opencv_storage>
for
(;;)
{
int
line_offset
=
ftell
(
fs
->
file
);
int
line_offset
=
(
int
)
ftell
(
fs
->
file
);
char
*
ptr0
=
icvGets
(
fs
,
xml_buf
,
xml_buf_size
),
*
ptr
;
if
(
!
ptr0
)
break
;
...
...
modules/highgui/CMakeLists.txt
View file @
926b64ff
...
...
@@ -98,21 +98,7 @@ ocv_create_module(${HIGHGUI_LIBRARIES})
macro
(
ocv_highgui_configure_target
)
if
(
APPLE
)
ocv_check_flag_support
(
OBJCXX
"-fobjc-exceptions"
HAVE_OBJC_EXCEPTIONS
)
if
(
HAVE_OBJC_EXCEPTIONS
)
foreach
(
source
${
OPENCV_MODULE_
${
the_module
}
_SOURCES
}
)
if
(
"
${
source
}
"
MATCHES
"
\\
.mm$"
)
get_source_file_property
(
flags
"
${
source
}
"
COMPILE_FLAGS
)
if
(
flags
)
set
(
flags
"
${
_flags
}
-fobjc-exceptions"
)
else
()
set
(
flags
"-fobjc-exceptions"
)
endif
()
set_source_files_properties
(
"
${
source
}
"
PROPERTIES COMPILE_FLAGS
"
${
flags
}
"
)
endif
()
endforeach
()
endif
()
add_apple_compiler_options
(
the_module
)
endif
()
if
(
BUILD_SHARED_LIBS
)
...
...
modules/imgcodecs/CMakeLists.txt
View file @
926b64ff
...
...
@@ -106,21 +106,7 @@ ocv_create_module(${GRFMT_LIBS} ${IMGCODECS_LIBRARIES})
macro
(
ocv_imgcodecs_configure_target
)
if
(
APPLE
)
ocv_check_flag_support
(
OBJCXX
"-fobjc-exceptions"
HAVE_OBJC_EXCEPTIONS
)
if
(
HAVE_OBJC_EXCEPTIONS
)
foreach
(
source
${
OPENCV_MODULE_
${
the_module
}
_SOURCES
}
)
if
(
"
${
source
}
"
MATCHES
"
\\
.mm$"
)
get_source_file_property
(
flags
"
${
source
}
"
COMPILE_FLAGS
)
if
(
flags
)
set
(
flags
"
${
_flags
}
-fobjc-exceptions"
)
else
()
set
(
flags
"-fobjc-exceptions"
)
endif
()
set_source_files_properties
(
"
${
source
}
"
PROPERTIES COMPILE_FLAGS
"
${
flags
}
"
)
endif
()
endforeach
()
endif
()
add_apple_compiler_options
(
the_module
)
endif
()
if
(
BUILD_SHARED_LIBS
)
...
...
modules/imgcodecs/src/grfmt_tiff.cpp
View file @
926b64ff
...
...
@@ -52,10 +52,11 @@
namespace
cv
{
static
const
char
fmtSignTiffII
[]
=
"II
\x2a\x00
"
;
static
const
char
fmtSignTiffMM
[]
=
"MM
\x00\x2a
"
;
#ifdef HAVE_TIFF
static
const
char
fmtSignTiffMM
[]
=
"MM
\x00\x2a
"
;
#include "tiff.h"
#include "tiffio.h"
...
...
modules/imgcodecs/src/ios_conversions.mm
View file @
926b64ff
...
...
@@ -47,6 +47,9 @@
#include "opencv2/core.hpp"
#include "precomp.hpp"
UIImage* MatToUIImage(const cv::Mat& image);
void UIImageToMat(const UIImage* image, cv::Mat& m, bool alphaExist);
UIImage* MatToUIImage(const cv::Mat& image) {
NSData *data = [NSData dataWithBytes:image.data
...
...
modules/imgproc/src/demosaicing.cpp
View file @
926b64ff
...
...
@@ -368,7 +368,8 @@ public:
uint16x8_t
g0
=
vaddq_u16
(
vshrq_n_u16
(
r0
,
8
),
vshrq_n_u16
(
r2
,
8
));
uint16x8_t
g1
=
vandq_u16
(
r1
,
masklo
);
g0
=
vaddq_u16
(
g0
,
vaddq_u16
(
g1
,
vextq_u16
(
g1
,
g1
,
1
)));
g1
=
vshlq_n_u16
(
vextq_u16
(
g1
,
g1
,
1
),
2
);
uint16x8_t
rot
=
vextq_u16
(
g1
,
g1
,
1
);
g1
=
vshlq_n_u16
(
rot
,
2
);
// g0 = b0 b2 b4 ...
// g1 = b1 b3 b5 ...
...
...
modules/imgproc/src/pyramids.cpp
View file @
926b64ff
...
...
@@ -240,14 +240,18 @@ struct PyrDownVec_32s16u
int32x4_t
v_r20
=
vld1q_s32
(
row2
+
x
),
v_r21
=
vld1q_s32
(
row2
+
x
+
4
);
int32x4_t
v_r30
=
vld1q_s32
(
row3
+
x
),
v_r31
=
vld1q_s32
(
row3
+
x
+
4
);
int32x4_t
v_r40
=
vld1q_s32
(
row4
+
x
),
v_r41
=
vld1q_s32
(
row4
+
x
+
4
);
int32x4_t
shifted
;
v_r00
=
vaddq_s32
(
vqaddq_s32
(
v_r00
,
v_r40
),
vqaddq_s32
(
v_r20
,
v_r20
));
v_r10
=
vaddq_s32
(
vqaddq_s32
(
v_r10
,
v_r20
),
v_r30
);
int32x4_t
v_dst0
=
vshrq_n_s32
(
vaddq_s32
(
vqaddq_s32
(
v_r00
,
vshlq_n_s32
(
v_r10
,
2
)),
v_delta
),
8
);
shifted
=
vshlq_n_s32
(
v_r10
,
2
);
int32x4_t
v_dst0
=
vshrq_n_s32
(
vaddq_s32
(
vqaddq_s32
(
v_r00
,
shifted
),
v_delta
),
8
);
v_r01
=
vaddq_s32
(
vqaddq_s32
(
v_r01
,
v_r41
),
vqaddq_s32
(
v_r21
,
v_r21
));
v_r11
=
vaddq_s32
(
vqaddq_s32
(
v_r11
,
v_r21
),
v_r31
);
int32x4_t
v_dst1
=
vshrq_n_s32
(
vaddq_s32
(
vqaddq_s32
(
v_r01
,
vshlq_n_s32
(
v_r11
,
2
)),
v_delta
),
8
);
shifted
=
vshlq_n_s32
(
v_r11
,
2
);
int32x4_t
v_dst1
=
vshrq_n_s32
(
vaddq_s32
(
vqaddq_s32
(
v_r01
,
shifted
),
v_delta
),
8
);
vst1q_u16
(
dst
+
x
,
vcombine_u16
(
vqmovun_s32
(
v_dst0
),
vqmovun_s32
(
v_dst1
)));
}
...
...
@@ -271,14 +275,17 @@ struct PyrDownVec_32s16s
int32x4_t
v_r20
=
vld1q_s32
(
row2
+
x
),
v_r21
=
vld1q_s32
(
row2
+
x
+
4
);
int32x4_t
v_r30
=
vld1q_s32
(
row3
+
x
),
v_r31
=
vld1q_s32
(
row3
+
x
+
4
);
int32x4_t
v_r40
=
vld1q_s32
(
row4
+
x
),
v_r41
=
vld1q_s32
(
row4
+
x
+
4
);
int32x4_t
shifted
;
v_r00
=
vaddq_s32
(
vqaddq_s32
(
v_r00
,
v_r40
),
vqaddq_s32
(
v_r20
,
v_r20
));
v_r10
=
vaddq_s32
(
vqaddq_s32
(
v_r10
,
v_r20
),
v_r30
);
int32x4_t
v_dst0
=
vshrq_n_s32
(
vaddq_s32
(
vqaddq_s32
(
v_r00
,
vshlq_n_s32
(
v_r10
,
2
)),
v_delta
),
8
);
shifted
=
vshlq_n_s32
(
v_r10
,
2
);
int32x4_t
v_dst0
=
vshrq_n_s32
(
vaddq_s32
(
vqaddq_s32
(
v_r00
,
shifted
),
v_delta
),
8
);
v_r01
=
vaddq_s32
(
vqaddq_s32
(
v_r01
,
v_r41
),
vqaddq_s32
(
v_r21
,
v_r21
));
v_r11
=
vaddq_s32
(
vqaddq_s32
(
v_r11
,
v_r21
),
v_r31
);
int32x4_t
v_dst1
=
vshrq_n_s32
(
vaddq_s32
(
vqaddq_s32
(
v_r01
,
vshlq_n_s32
(
v_r11
,
2
)),
v_delta
),
8
);
shifted
=
vshlq_n_s32
(
v_r11
,
2
);
int32x4_t
v_dst1
=
vshrq_n_s32
(
vaddq_s32
(
vqaddq_s32
(
v_r01
,
shifted
),
v_delta
),
8
);
vst1q_s16
(
dst
+
x
,
vcombine_s16
(
vqmovn_s32
(
v_dst0
),
vqmovn_s32
(
v_dst1
)));
}
...
...
modules/objdetect/src/haar.cpp
View file @
926b64ff
...
...
@@ -1979,7 +1979,7 @@ cvLoadHaarClassifierCascade( const char* directory, CvSize orig_window_size )
if
(
!
f
)
CV_Error
(
CV_StsError
,
""
);
fseek
(
f
,
0
,
SEEK_END
);
size
=
ftell
(
f
);
size
=
(
int
)
ftell
(
f
);
fseek
(
f
,
0
,
SEEK_SET
);
size_t
elements_read
=
fread
(
ptr
,
1
,
size
,
f
);
CV_Assert
(
elements_read
==
(
size_t
)(
size
));
...
...
modules/stitching/src/matchers.cpp
View file @
926b64ff
...
...
@@ -350,6 +350,11 @@ SurfFeaturesFinder::SurfFeaturesFinder(double hess_thresh, int num_octaves, int
extractor_
=
sextractor_
;
}
#else
(
void
)
hess_thresh
;
(
void
)
num_octaves
;
(
void
)
num_layers
;
(
void
)
num_octaves_descr
;
(
void
)
num_layers_descr
;
CV_Error
(
Error
::
StsNotImplemented
,
"OpenCV was built without SURF support"
);
#endif
}
...
...
modules/videoio/CMakeLists.txt
View file @
926b64ff
...
...
@@ -189,21 +189,7 @@ ocv_create_module(${VIDEOIO_LIBRARIES})
macro
(
ocv_videoio_configure_target
)
if
(
APPLE
)
ocv_check_flag_support
(
OBJCXX
"-fobjc-exceptions"
HAVE_OBJC_EXCEPTIONS
)
if
(
HAVE_OBJC_EXCEPTIONS
)
foreach
(
source
${
OPENCV_MODULE_
${
the_module
}
_SOURCES
}
)
if
(
"
${
source
}
"
MATCHES
"
\\
.mm$"
)
get_source_file_property
(
flags
"
${
source
}
"
COMPILE_FLAGS
)
if
(
flags
)
set
(
flags
"
${
_flags
}
-fobjc-exceptions"
)
else
()
set
(
flags
"-fobjc-exceptions"
)
endif
()
set_source_files_properties
(
"
${
source
}
"
PROPERTIES COMPILE_FLAGS
"
${
flags
}
"
)
endif
()
endforeach
()
endif
()
add_apple_compiler_options
(
the_module
)
endif
()
if
(
BUILD_SHARED_LIBS
)
...
...
modules/videoio/src/cap_avfoundation.mm
View file @
926b64ff
...
...
@@ -181,7 +181,6 @@ class CvVideoWriter_AVFoundation : public CvVideoWriter{
AVAssetWriterInput* mMovieWriterInput;
AVAssetWriterInputPixelBufferAdaptor* mMovieWriterAdaptor;
unsigned char* imagedata;
NSString* path;
NSString* codec;
NSString* fileType;
...
...
@@ -490,15 +489,15 @@ double CvCaptureCAM::getProperty(int property_id){
CMFormatDescriptionRef format = [[ports objectAtIndex:0] formatDescription];
CGSize s1 = CMVideoFormatDescriptionGetPresentationDimensions(format, YES, YES);
int w
idth=(int)s1.width, height
=(int)s1.height;
int w
=(int)s1.width, h
=(int)s1.height;
[localpool drain];
switch (property_id) {
case CV_CAP_PROP_FRAME_WIDTH:
return w
idth
;
return w;
case CV_CAP_PROP_FRAME_HEIGHT:
return h
eight
;
return h;
case CV_CAP_PROP_IOS_DEVICE_FOCUS:
return mCaptureDevice.focusMode;
...
...
@@ -659,6 +658,8 @@ fromConnection:(AVCaptureConnection *)connection{
// Failed
// connection.videoOrientation = AVCaptureVideoOrientationPortrait;
(void)captureOutput;
(void)connection;
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
...
...
@@ -710,26 +711,26 @@ fromConnection:(AVCaptureConnection *)connection{
memcpy(imagedata, baseaddress, currSize);
if (image == NULL) {
image = cvCreateImageHeader(cvSize(
width,
height), IPL_DEPTH_8U, 4);
image = cvCreateImageHeader(cvSize(
(int)width,(int)
height), IPL_DEPTH_8U, 4);
}
image->width =width;
image->height = height;
image->width =
(int)
width;
image->height =
(int)
height;
image->nChannels = 4;
image->depth = IPL_DEPTH_8U;
image->widthStep = (int)rowBytes;
image->imageData = imagedata;
image->imageSize = currSize;
image->imageSize =
(int)
currSize;
if (bgr_image == NULL) {
bgr_image = cvCreateImageHeader(cvSize(
width,
height), IPL_DEPTH_8U, 3);
bgr_image = cvCreateImageHeader(cvSize(
(int)width,(int)
height), IPL_DEPTH_8U, 3);
}
bgr_image->width =width;
bgr_image->height = height;
bgr_image->width =
(int)
width;
bgr_image->height =
(int)
height;
bgr_image->nChannels = 3;
bgr_image->depth = IPL_DEPTH_8U;
bgr_image->widthStep = (int)rowBytes;
bgr_image->imageData = bgr_imagedata;
bgr_image->imageSize = currSize;
bgr_image->imageSize =
(int)
currSize;
cvCvtColor(image, bgr_image, CV_BGRA2BGR);
...
...
@@ -738,7 +739,7 @@ fromConnection:(AVCaptureConnection *)connection{
// iOS provides hardware accelerated rotation through AVCaptureConnection class
// I can't get it work.
if (bgr_image_r90 == NULL){
bgr_image_r90 = cvCreateImage(cvSize(
height,
width), IPL_DEPTH_8U, 3);
bgr_image_r90 = cvCreateImage(cvSize(
(int)height, (int)
width), IPL_DEPTH_8U, 3);
}
cvTranspose(bgr_image, bgr_image_r90);
cvFlip(bgr_image_r90, NULL, 1);
...
...
@@ -938,29 +939,29 @@ IplImage* CvCaptureFile::retrieveFramePixelBuffer() {
memcpy(imagedata, baseaddress, currSize);
if (image == NULL) {
image = cvCreateImageHeader(cvSize(
width,
height), IPL_DEPTH_8U, 4);
image = cvCreateImageHeader(cvSize(
(int)width,(int)
height), IPL_DEPTH_8U, 4);
}
image->width =width;
image->height = height;
image->width =
(int)
width;
image->height =
(int)
height;
image->nChannels = 4;
image->depth = IPL_DEPTH_8U;
image->widthStep = rowBytes;
image->widthStep =
(int)
rowBytes;
image->imageData = imagedata;
image->imageSize = currSize;
image->imageSize =
(int)
currSize;
if (bgr_image == NULL) {
bgr_image = cvCreateImageHeader(cvSize(
width,
height), IPL_DEPTH_8U, 3);
bgr_image = cvCreateImageHeader(cvSize(
(int)width,(int)
height), IPL_DEPTH_8U, 3);
}
bgr_image->width =width;
bgr_image->height = height;
bgr_image->width =
(int)
width;
bgr_image->height =
(int)
height;
bgr_image->nChannels = 3;
bgr_image->depth = IPL_DEPTH_8U;
bgr_image->widthStep = rowBytes;
bgr_image->widthStep =
(int)
rowBytes;
bgr_image->imageData = bgr_imagedata;
bgr_image->imageSize = currSize;
bgr_image->imageSize =
(int)
currSize;
cvCvtColor(image, bgr_image,CV_BGRA2BGR);
...
...
@@ -1009,7 +1010,7 @@ double CvCaptureFile::getFPS() {
return 30.0; //TODO: Debugging
}
double CvCaptureFile::getProperty(int
property_id
){
double CvCaptureFile::getProperty(int
/*property_id*/
){
/*
if (mCaptureSession == nil) return 0;
...
...
@@ -1050,7 +1051,7 @@ double CvCaptureFile::getProperty(int property_id){
return 1.0; //Debugging
}
bool CvCaptureFile::setProperty(int
property_id, double value
) {
bool CvCaptureFile::setProperty(int
/*property_id*/, double /*value*/
) {
/*
if (mCaptureSession == nil) return false;
...
...
@@ -1261,7 +1262,7 @@ bool CvVideoWriter_AVFoundation::writeFrame(const IplImage* iplimage) {
// writer status check
if (![mMovieWriterInput isReadyForMoreMediaData] || mMovieWriter.status != AVAssetWriterStatusWriting ) {
NSLog(@"[mMovieWriterInput isReadyForMoreMediaData] Not ready for media data or ...");
NSLog(@"mMovieWriter.status: %d. Error: %@", mMovieWriter.status, [mMovieWriter.error localizedDescription]);
NSLog(@"mMovieWriter.status: %d. Error: %@",
(int)
mMovieWriter.status, [mMovieWriter.error localizedDescription]);
[localpool drain];
return false;
}
...
...
modules/videoio/src/cap_ios_abstract_camera.mm
View file @
926b64ff
...
...
@@ -150,6 +150,7 @@
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[super dealloc];
}
...
...
@@ -226,6 +227,7 @@
- (void)deviceOrientationDidChange:(NSNotification*)notification
{
(void)notification;
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
switch (orientation)
...
...
@@ -242,7 +244,7 @@
default:
break;
}
NSLog(@"deviceOrientationDidChange: %d", orientation);
NSLog(@"deviceOrientationDidChange: %d",
(int)
orientation);
[self updateOrientation];
}
...
...
@@ -308,7 +310,7 @@
if ([device position] == desiredPosition) {
[self.captureSession beginConfiguration];
NSError* error;
NSError* error
= nil
;
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
if (!input) {
NSLog(@"error creating input %@", [error localizedDescription]);
...
...
@@ -316,7 +318,7 @@
// support for autofocus
if ([device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
NSError *
error = nil;
error = nil;
if ([device lockForConfiguration:&error]) {
device.focusMode = AVCaptureFocusModeContinuousAutoFocus;
[device unlockForConfiguration];
...
...
modules/videoio/src/cap_ios_video_camera.mm
View file @
926b64ff
...
...
@@ -101,7 +101,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
[super start];
if (self.recordVideo == YES) {
NSError* error;
NSError* error
= nil
;
if ([[NSFileManager defaultManager] fileExistsAtPath:[self videoFileString]]) {
[[NSFileManager defaultManager] removeItemAtPath:[self videoFileString] error:&error];
}
...
...
@@ -424,6 +424,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
{
(void)captureOutput;
(void)connection;
if (self.delegate) {
// convert from Core Media to Core Video
...
...
@@ -462,9 +464,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
}
// delegate image processing to the delegate
cv::Mat image(
height,
width, format_opencv, bufferAddress, bytesPerRow);
cv::Mat image(
(int)height, (int)
width, format_opencv, bufferAddress, bytesPerRow);
cv::Mat* result = NULL;
CGImage* dstImage;
if ([self.delegate respondsToSelector:@selector(processImage:)]) {
...
...
@@ -473,7 +474,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
// check if matrix data pointer or dimensions were changed by the delegate
bool iOSimage = false;
if (height ==
image.rows && width ==
image.cols && format_opencv == image.type() && bufferAddress == image.data && bytesPerRow == image.step) {
if (height ==
(size_t)image.rows && width == (size_t)
image.cols && format_opencv == image.type() && bufferAddress == image.data && bytesPerRow == image.step) {
iOSimage = true;
}
...
...
@@ -591,7 +592,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:[self videoFileURL]]) {
[library writeVideoAtPathToSavedPhotosAlbum:[self videoFileURL]
completionBlock:^(NSURL *assetURL, NSError *error){}];
completionBlock:^(NSURL *assetURL, NSError *error){
(void)assetURL; (void)error;
}];
}
}
...
...
platforms/ios/build_framework.py
View file @
926b64ff
...
...
@@ -25,7 +25,18 @@ The script should handle minor OpenCV updates efficiently
However, opencv2.framework directory is erased and recreated on each run.
"""
import
glob
,
re
,
os
,
os
.
path
,
shutil
,
string
,
sys
import
glob
,
re
,
os
,
os
.
path
,
shutil
,
string
,
sys
,
exceptions
,
subprocess
def
execute
(
cmd
):
try
:
print
>>
sys
.
stderr
,
"Executing:"
,
cmd
retcode
=
subprocess
.
call
(
cmd
,
shell
=
True
)
if
retcode
<
0
:
raise
Exception
(
"Child was terminated by signal:"
,
-
retcode
)
elif
retcode
>
0
:
raise
Exception
(
"Child returned:"
,
retcode
)
except
OSError
as
e
:
raise
Exception
(
"Execution failed:"
,
e
)
def
build_opencv
(
srcroot
,
buildroot
,
target
,
arch
):
"builds OpenCV for device or simulator"
...
...
@@ -48,17 +59,17 @@ def build_opencv(srcroot, buildroot, target, arch):
# if cmake cache exists, just rerun cmake to update OpenCV.xcodeproj if necessary
if
os
.
path
.
isfile
(
os
.
path
.
join
(
builddir
,
"CMakeCache.txt"
)):
os
.
system
(
"cmake
%
s ."
%
(
cmakeargs
,))
execute
(
"cmake
%
s ."
%
(
cmakeargs
,))
else
:
os
.
system
(
"cmake
%
s
%
s"
%
(
cmakeargs
,
srcroot
))
execute
(
"cmake
%
s
%
s"
%
(
cmakeargs
,
srcroot
))
for
wlib
in
[
builddir
+
"/modules/world/UninstalledProducts/libopencv_world.a"
,
builddir
+
"/lib/Release/libopencv_world.a"
]:
if
os
.
path
.
isfile
(
wlib
):
os
.
remove
(
wlib
)
os
.
system
(
"xcodebuild IPHONEOS_DEPLOYMENT_TARGET=6.0 -parallelizeTargets ARCHS=
%
s -jobs 8 -sdk
%
s -configuration Release -target ALL_BUILD"
%
(
arch
,
target
.
lower
()))
os
.
system
(
"xcodebuild IPHONEOS_DEPLOYMENT_TARGET=6.0 ARCHS=
%
s -sdk
%
s -configuration Release -target install install"
%
(
arch
,
target
.
lower
()))
execute
(
"xcodebuild IPHONEOS_DEPLOYMENT_TARGET=6.0 -parallelizeTargets ARCHS=
%
s -jobs 8 -sdk
%
s -configuration Release -target ALL_BUILD"
%
(
arch
,
target
.
lower
()))
execute
(
"xcodebuild IPHONEOS_DEPLOYMENT_TARGET=6.0 ARCHS=
%
s -sdk
%
s -configuration Release -target install install"
%
(
arch
,
target
.
lower
()))
os
.
chdir
(
currdir
)
def
put_framework_together
(
srcroot
,
dstroot
):
...
...
@@ -86,7 +97,7 @@ def put_framework_together(srcroot, dstroot):
# make universal static lib
wlist
=
" "
.
join
([
"../build/"
+
t
+
"/lib/Release/libopencv_world.a"
for
t
in
targetlist
])
os
.
system
(
"lipo -create "
+
wlist
+
" -o "
+
dstdir
+
"/opencv2"
)
execute
(
"lipo -create "
+
wlist
+
" -o "
+
dstdir
+
"/opencv2"
)
# copy Info.plist
shutil
.
copyfile
(
tdir0
+
"/ios/Info.plist"
,
dstdir
+
"/Resources/Info.plist"
)
...
...
@@ -101,10 +112,13 @@ def put_framework_together(srcroot, dstroot):
def
build_framework
(
srcroot
,
dstroot
):
"main function to do all the work"
targets
=
[
"iPhoneOS"
,
"iPhoneOS"
,
"iPhoneOS"
,
"iPhoneSimulator"
,
"iPhoneSimulator"
]
archs
=
[
"armv7"
,
"armv7s"
,
"arm64"
,
"i386"
,
"x86_64"
]
for
i
in
range
(
len
(
targets
)):
build_opencv
(
srcroot
,
os
.
path
.
join
(
dstroot
,
"build"
),
targets
[
i
],
archs
[
i
])
targets
=
[(
"armv7"
,
"iPhoneOS"
),
(
"armv7s"
,
"iPhoneOS"
),
(
"arm64"
,
"iPhoneOS"
),
(
"i386"
,
"iPhoneSimulator"
),
(
"x86_64"
,
"iPhoneSimulator"
)]
for
t
in
targets
:
build_opencv
(
srcroot
,
os
.
path
.
join
(
dstroot
,
"build"
),
t
[
1
],
t
[
0
])
put_framework_together
(
srcroot
,
dstroot
)
...
...
@@ -114,4 +128,8 @@ if __name__ == "__main__":
print
"Usage:
\n\t
./build_framework.py <outputdir>
\n\n
"
sys
.
exit
(
0
)
build_framework
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
sys
.
argv
[
0
]),
"../.."
)),
os
.
path
.
abspath
(
sys
.
argv
[
1
]))
try
:
build_framework
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
sys
.
argv
[
0
]),
"../.."
)),
os
.
path
.
abspath
(
sys
.
argv
[
1
]))
except
Exception
as
e
:
print
>>
sys
.
stderr
,
e
sys
.
exit
(
1
)
platforms/ios/cmake/Modules/Platform/iOS.cmake
View file @
926b64ff
...
...
@@ -39,8 +39,9 @@ set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSI
set
(
CMAKE_CXX_OSX_CURRENT_VERSION_FLAG
"
${
CMAKE_C_OSX_CURRENT_VERSION_FLAG
}
"
)
# Hidden visibilty is required for cxx on iOS
set
(
CMAKE_C_FLAGS
""
)
set
(
CMAKE_CXX_FLAGS
"-stdlib=libc++ -headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden"
)
set
(
no_warn
"-Wno-unused-function -Wno-overloaded-virtual"
)
set
(
CMAKE_C_FLAGS
"
${
no_warn
}
"
)
set
(
CMAKE_CXX_FLAGS
"-stdlib=libc++ -fvisibility=hidden -fvisibility-inlines-hidden
${
no_warn
}
"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"-DNDEBUG -O3 -fomit-frame-pointer -ffast-math"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment