modified highgui and ts modules and cmakelists for ios cross-compiling, added ios toolchains, added ios build tutorial
This commit is contained in:
@@ -126,6 +126,8 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
if(NOT IOS)
|
||||
|
||||
if(NOT HAVE_QT)
|
||||
if(HAVE_GTK)
|
||||
set(highgui_srcs ${highgui_srcs} src/window_gtk.cpp)
|
||||
@@ -172,6 +174,8 @@ if(UNIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif(NOT IOS)
|
||||
|
||||
foreach(P ${HIGHGUI_INCLUDE_DIRS})
|
||||
include_directories(${P})
|
||||
endforeach()
|
||||
@@ -188,7 +192,7 @@ if(WITH_OPENNI AND HAVE_OPENNI)
|
||||
endif()
|
||||
|
||||
#YV
|
||||
if(APPLE)
|
||||
if(APPLE AND NOT IOS)
|
||||
add_definitions(-DHAVE_QUICKTIME=1)
|
||||
if(NOT OPENCV_BUILD_3RDPARTY_LIBS)
|
||||
add_definitions(-DHAVE_IMAGEIO=1)
|
||||
@@ -205,11 +209,17 @@ if(APPLE)
|
||||
endif()
|
||||
|
||||
if(WITH_QUICKTIME)
|
||||
set(highgui_srcs ${highgui_srcs} src/cap_qt.cpp)
|
||||
else()
|
||||
set(highgui_srcs ${highgui_srcs} src/cap_qtkit.mm)
|
||||
endif()
|
||||
endif(APPLE)
|
||||
set(highgui_srcs ${highgui_srcs} src/cap_qt.cpp)
|
||||
else()
|
||||
set(highgui_srcs ${highgui_srcs} src/cap_qtkit.mm)
|
||||
endif()
|
||||
|
||||
endif(APPLE AND NOT IOS)
|
||||
|
||||
if (IOS)
|
||||
add_definitions(-DHAVE_IMAGEIO=1)
|
||||
set(highgui_srcs ${highgui_srcs} src/cap_avfoundation.mm)
|
||||
endif()
|
||||
|
||||
if(WITH_ANDROID_CAMERA)
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../androidcamera/include")
|
||||
@@ -346,7 +356,7 @@ if( OPENNI_LIBRARY )
|
||||
target_link_libraries(${the_target} ${OPENNI_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
if(APPLE AND NOT IOS)
|
||||
target_link_libraries(${the_target} "-lbz2 -framework Cocoa -framework QuartzCore")
|
||||
if(WITH_CARBON)
|
||||
target_link_libraries(${the_target} "-framework Carbon")
|
||||
@@ -359,6 +369,10 @@ if(APPLE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (IOS)
|
||||
target_link_libraries(${the_target} "-lbz2 -framework QuartzCore -framework CoreFoundation -framework ImageIO -framework CoreGraphics -framework AVFoundation")
|
||||
endif()
|
||||
|
||||
install(TARGETS ${the_target}
|
||||
RUNTIME DESTINATION bin COMPONENT main
|
||||
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
|
||||
@@ -394,7 +408,7 @@ if(BUILD_TESTS)
|
||||
source_group("Include" FILES ${test_hdrs})
|
||||
|
||||
set(the_target "opencv_test_highgui")
|
||||
|
||||
|
||||
add_executable(${the_target} ${test_srcs} ${test_hdrs})
|
||||
|
||||
add_opencv_precompiled_headers(${the_target})
|
||||
|
||||
@@ -289,7 +289,9 @@ enum
|
||||
|
||||
CV_CAP_ANDROID =1000, // Android
|
||||
|
||||
CV_CAP_XIAPI =1100 // XIMEA Camera API
|
||||
CV_CAP_XIAPI =1100, // XIMEA Camera API
|
||||
|
||||
CV_CAP_AVFOUNDATION = 1200 // AVFoundation framework for iOS (OS X Lion will have the same API)
|
||||
};
|
||||
|
||||
/* start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*) */
|
||||
@@ -397,7 +399,14 @@ enum
|
||||
CV_CAP_PROP_XI_AE_MAX_LIMIT = 417, // Maximum limit of exposure in AEAG procedure
|
||||
CV_CAP_PROP_XI_AG_MAX_LIMIT = 418, // Maximum limit of gain in AEAG procedure
|
||||
CV_CAP_PROP_XI_AEAG_LEVEL = 419, // Average intensity of output signal AEAG should achieve(in %)
|
||||
CV_CAP_PROP_XI_TIMEOUT = 420 // Image capture timeout in milliseconds
|
||||
CV_CAP_PROP_XI_TIMEOUT = 420, // Image capture timeout in milliseconds
|
||||
|
||||
// Properties of cameras available through AVFOUNDATION interface
|
||||
CV_CAP_PROP_IOS_DEVICE_FOCUS = 9001,
|
||||
CV_CAP_PROP_IOS_DEVICE_EXPOSURE = 9002,
|
||||
CV_CAP_PROP_IOS_DEVICE_FLASH = 9003,
|
||||
CV_CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
|
||||
CV_CAP_PROP_IOS_DEVICE_TORCH = 9005
|
||||
};
|
||||
|
||||
enum
|
||||
|
||||
@@ -136,6 +136,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
|
||||
#ifdef HAVE_XIMEA
|
||||
CV_CAP_XIAPI,
|
||||
#endif
|
||||
CV_CAP_AVFOUNDATION
|
||||
-1
|
||||
};
|
||||
|
||||
@@ -155,7 +156,8 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
|
||||
defined(HAVE_CAMV4L) || defined (HAVE_CAMV4L2) || defined(HAVE_GSTREAMER) || \
|
||||
defined(HAVE_DC1394_2) || defined(HAVE_DC1394) || defined(HAVE_CMU1394) || \
|
||||
defined(HAVE_GSTREAMER) || defined(HAVE_MIL) || defined(HAVE_QUICKTIME) || \
|
||||
defined(HAVE_UNICAP) || defined(HAVE_PVAPI) || defined(HAVE_OPENNI) || defined(HAVE_ANDROID_NATIVE_CAMERA)
|
||||
defined(HAVE_UNICAP) || defined(HAVE_PVAPI) || defined(HAVE_OPENNI) || defined(HAVE_ANDROID_NATIVE_CAMERA) || \
|
||||
defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
|
||||
// local variable to memorize the captured device
|
||||
CvCapture *capture;
|
||||
#endif
|
||||
@@ -278,6 +280,14 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
|
||||
return capture;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
case CV_CAP_AVFOUNDATION:
|
||||
capture = cvCreateCameraCapture_AVFoundation (index);
|
||||
if (capture)
|
||||
return capture;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,6 +321,11 @@ CV_IMPL CvCapture * cvCreateFileCapture (const char * filename)
|
||||
result = cvCreateFileCapture_QT (filename);
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
if (! result)
|
||||
result = cvCreateFileCapture_AVFoundation (filename);
|
||||
#endif
|
||||
|
||||
if (! result)
|
||||
result = cvCreateFileCapture_Images (filename);
|
||||
|
||||
@@ -339,6 +354,10 @@ CV_IMPL CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc,
|
||||
result = cvCreateVideoWriter_XINE(filename, fourcc, fps, frameSize, is_color);
|
||||
#endif
|
||||
*/
|
||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
if (! result)
|
||||
result = cvCreateVideoWriter_AVFoundation(filename, fourcc, fps, frameSize, is_color);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_QUICKTIME
|
||||
if(!result)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -113,7 +113,11 @@ bool ImageIODecoder::readData( Mat& img )
|
||||
}
|
||||
else if( color == CV_LOAD_IMAGE_COLOR )
|
||||
{
|
||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
#else
|
||||
colorSpace = CGColorSpaceCreateWithName( kCGColorSpaceGenericRGBLinear );
|
||||
#endif
|
||||
bpp = 4; /* CG only has 8 and 32 bit color spaces, so we waste a byte */
|
||||
alphaInfo = kCGImageAlphaNoneSkipLast;
|
||||
}
|
||||
@@ -272,10 +276,20 @@ bool ImageIOEncoder::write( const Mat& img, const vector<int>& params )
|
||||
CGColorSpaceRef colorSpace;
|
||||
uchar* bitmapData = NULL;
|
||||
|
||||
if( bpp == 1 )
|
||||
if( bpp == 1 ) {
|
||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
colorSpace = CGColorSpaceCreateDeviceGray();
|
||||
#else
|
||||
colorSpace = CGColorSpaceCreateWithName( kCGColorSpaceGenericGray );
|
||||
else if( bpp == 4 )
|
||||
#endif
|
||||
}
|
||||
else if( bpp == 4 ) {
|
||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
#else
|
||||
colorSpace = CGColorSpaceCreateWithName( kCGColorSpaceGenericRGBLinear );
|
||||
#endif
|
||||
}
|
||||
if( !colorSpace )
|
||||
return false;
|
||||
|
||||
|
||||
@@ -12,8 +12,19 @@
|
||||
#ifdef HAVE_IMAGEIO
|
||||
|
||||
#include "grfmt_base.hpp"
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
|
||||
#include <MobileCoreServices/MobileCoreServices.h>
|
||||
#include <ImageIO/ImageIO.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
#endif
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
#include "precomp.hpp"
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
@@ -67,7 +68,6 @@ CV_IMPL int cvWaitKey (int maxWait) {return 0;}
|
||||
//*** end IphoneOS Stubs ***/
|
||||
#else
|
||||
|
||||
#include "precomp.hpp"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
Reference in New Issue
Block a user