├── Chapter01_HelloWorld ├── Chapter01_HelloWorld.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter01_HelloWorld.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter01_HelloWorld.xcscheme │ │ └── xcschememanagement.plist └── Chapter01_HelloWorld │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter01_HelloWorld-Info.plist │ ├── Chapter01_HelloWorld-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ └── main.m ├── Chapter02_DisplayingImage ├── Chapter02_DisplayingImage.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter02_DisplayingImage.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter02_DisplayingImage.xcscheme │ │ └── xcschememanagement.plist └── Chapter02_DisplayingImage │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter02_DisplayingImage-Info.plist │ ├── Chapter02_DisplayingImage-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ ├── lena.png │ └── main.m ├── Chapter03_LinkingOpenCV ├── Chapter03_LinkingOpenCV.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter03_LinkingOpenCV.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter03_LinkingOpenCV.xcscheme │ │ └── xcschememanagement.plist └── Chapter03_LinkingOpenCV │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter03_LinkingOpenCV-Info.plist │ ├── Chapter03_LinkingOpenCV-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ ├── lena.png │ └── main.m ├── Chapter04_DetectingFaces ├── Chapter04_DetectingFaces.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter04_DetectingFaces.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter04_DetectingFaces.xcscheme │ │ └── xcschememanagement.plist └── Chapter04_DetectingFaces │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter04_DetectingFaces-Info.plist │ ├── Chapter04_DetectingFaces-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ ├── haarcascade_frontalface_alt.xml │ ├── haarcascade_frontalface_alt2.xml │ ├── lena.png │ └── main.m ├── Chapter05_PrintingPostcard ├── Chapter05_PrintingPostcard.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter05_PrintingPostcard.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter05_PrintingPostcard.xcscheme │ │ └── xcschememanagement.plist ├── Chapter05_PrintingPostcard │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter05_PrintingPostcard-Info.plist │ ├── Chapter05_PrintingPostcard-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── PostcardPrinter.cpp │ ├── PostcardPrinter.hpp │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── MainStoryboard_iPad.storyboard │ │ └── MainStoryboard_iPhone.storyboard │ ├── lena.jpg │ ├── main.m │ ├── text.png │ └── texture.jpg └── screenshot.png ├── Chapter06_WorkingWithGallery ├── Chapter06_WorkingWithGallery.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter06_WorkingWithGallery.xccheckout │ │ └── xcuserdata │ │ │ ├── alexanderpetrovichev.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── alexanderpetrovichev.xcuserdatad │ │ └── xcschemes │ │ │ ├── Chapter06_WorkingWithGallery.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── alexandershishkov.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── Chapter06_WorkingWithGallery.xcscheme │ │ └── xcschememanagement.plist ├── Chapter06_WorkingWithGallery │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter06_WorkingWithGallery-Info.plist │ ├── Chapter06_WorkingWithGallery-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── PostcardPrinter.cpp │ ├── PostcardPrinter.hpp │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── MainStoryboard_iPad.storyboard │ │ └── MainStoryboard_iPhone.storyboard │ ├── haarcascade_frontalface_alt2.xml │ ├── lena.jpg │ ├── main.m │ ├── text.png │ └── texture.jpg └── screenshot.png ├── Chapter07_ApplyingRetroEffect ├── Chapter07_ApplyingRetroEffect.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter07_ApplyingRetroEffect.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter07_ApplyingRetroEffect.xcscheme │ │ └── xcschememanagement.plist ├── Chapter07_ApplyingRetroEffect │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter07_ApplyingRetroEffect-Info.plist │ ├── Chapter07_ApplyingRetroEffect-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── RetroFilter.cpp │ ├── RetroFilter.hpp │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── MainStoryboard_iPad.storyboard │ │ └── MainStoryboard_iPhone.storyboard │ ├── fuzzyBorder.png │ ├── main.m │ └── scratches.png └── screenshot.png ├── Chapter08_TakingPhotosFromCamera ├── Chapter08_TakingPhotosFromCamera.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter08_TakingPhotosFromCamera.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter08_TakingPhotosFromCamera.xcscheme │ │ └── xcschememanagement.plist └── Chapter08_TakingPhotosFromCamera │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter08_TakingPhotosFromCamera-Info.plist │ ├── Chapter08_TakingPhotosFromCamera-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── RetroFilter.cpp │ ├── RetroFilter.hpp │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ ├── fuzzy_border.png │ ├── main.m │ └── scratches.png ├── Chapter09_CreatingStaticLibrary ├── Chapter09_CreatingStaticLibrary.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter09_CreatingStaticLibrary.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter09_CreatingStaticLibrary.xcscheme │ │ └── xcschememanagement.plist └── Chapter09_CreatingStaticLibrary │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter09_CreatingStaticLibrary-Info.plist │ ├── Chapter09_CreatingStaticLibrary-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ └── main.m ├── Chapter10_CapturingVideo ├── Chapter10_CapturingVideo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter10_CapturingVideo.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter10_CapturingVideo.xcscheme │ │ └── xcschememanagement.plist └── Chapter10_CapturingVideo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter10_CapturingVideo-Info.plist │ ├── Chapter10_CapturingVideo-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ └── main.m ├── Chapter11_AdvancedCameraControl ├── Chapter11_AdvancedCameraControl.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter11_AdvancedCameraControl.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter11_AdvancedCameraControl.xcscheme │ │ └── xcschememanagement.plist └── Chapter11_AdvancedCameraControl │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter11_AdvancedCameraControl-Info.plist │ ├── Chapter11_AdvancedCameraControl-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ └── main.m ├── Chapter12_ProcessingVideo ├── Chapter12_ProcessingVideo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter12_ProcessingVideo.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter12_ProcessingVideo.xcscheme │ │ └── xcschememanagement.plist ├── Chapter12_ProcessingVideo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter12_ProcessingVideo-Info.plist │ ├── Chapter12_ProcessingVideo-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── MainStoryboard_iPad.storyboard │ │ └── MainStoryboard_iPhone.storyboard │ └── main.m └── screenshot.png ├── Chapter13_SavingVideo ├── Chapter13_SavingVideo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter13_SavingVideo.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter13_SavingVideo.xcscheme │ │ └── xcschememanagement.plist └── Chapter13_SavingVideo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter13_SavingVideo-Info.plist │ ├── Chapter13_SavingVideo-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ └── main.m ├── Chapter14_OptimizingWithNEON ├── Chapter14_OptimizingWithNEON.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter14_OptimizingWithNEON.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter14_OptimizingWithNEON.xcscheme │ │ └── xcschememanagement.plist └── Chapter14_OptimizingWithNEON │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter14_OptimizingWithNEON-Info.plist │ ├── Chapter14_OptimizingWithNEON-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ └── main.m ├── Chapter15_DetectingFacialFeatures ├── Chapter15_DetectingFacialFeatures.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── Chapter15_DetectingFacialFeatures.xccheckout │ │ └── xcuserdata │ │ │ └── alexandershishkov.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── Chapter15_DetectingFacialFeatures.xcscheme │ │ └── xcschememanagement.plist ├── Chapter15_DetectingFacialFeatures │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Chapter15_DetectingFacialFeatures-Info.plist │ ├── Chapter15_DetectingFacialFeatures-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── MainStoryboard_iPad.storyboard │ │ └── MainStoryboard_iPhone.storyboard │ └── main.m └── screenshot.png ├── CvEffects ├── CvEffects.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcuserdata │ │ └── alexandershishkov.xcuserdatad │ │ └── xcschemes │ │ ├── CvEffects.xcscheme │ │ └── xcschememanagement.plist └── CvEffects │ ├── CvEffects-Prefix.pch │ ├── FaceAnimator.cpp │ ├── FaceAnimator.hpp │ ├── PostcardPrinter.cpp │ ├── PostcardPrinter.hpp │ ├── Processing.cpp │ ├── Processing.hpp │ ├── Processing_Accelerate.cpp │ ├── Processing_NEON.cpp │ ├── RetroFilter.cpp │ ├── RetroFilter.hpp │ ├── fuzzy_border.png │ ├── glasses.png │ ├── haarcascade_mcs_eyepair_big.xml │ ├── haarcascade_mcs_mouth.xml │ ├── lbpcascade_frontalface.xml │ ├── lena.jpg │ ├── mustache.png │ ├── scratches.png │ ├── text.png │ └── texture.jpg ├── LICENSE.txt └── README.md /Chapter01_HelloWorld/Chapter01_HelloWorld.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld.xcodeproj/project.xcworkspace/xcshareddata/Chapter01_HelloWorld.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 297C9A26-93D6-4486-BFC7-A4BDE3258613 9 | IDESourceControlProjectName 10 | Chapter01_HelloWorld 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter01_HelloWorld/Chapter01_HelloWorld.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter01_HelloWorld/Chapter01_HelloWorld.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter01_HelloWorld.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83E816F01736583E0054AED6 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 1 of the "OpenCV for iOS" book 7 | * 8 | * Getting started with iOS, helps you to set up your development environment 9 | * and run your first "Hello World" iOS application. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow* window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/Chapter01_HelloWorld-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/Chapter01_HelloWorld-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter01_HelloWorld' target in the 'Chapter01_HelloWorld' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter01_HelloWorld/Chapter01_HelloWorld/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter01_HelloWorld/Chapter01_HelloWorld/Default.png -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter01_HelloWorld/Chapter01_HelloWorld/Default@2x.png -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 1 of the "OpenCV for iOS" book 7 | * 8 | * Getting started with iOS, helps you to set up your development environment 9 | * and run your first "Hello World" iOS application. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface ViewController : UIViewController 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/ViewController.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 1 of the "OpenCV for iOS" book 7 | * 8 | * Getting started with iOS, helps you to set up your development environment 9 | * and run your first "Hello World" iOS application. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import "ViewController.h" 16 | 17 | @interface ViewController () 18 | 19 | @end 20 | 21 | @implementation ViewController 22 | 23 | - (void)viewDidLoad 24 | { 25 | [super viewDidLoad]; 26 | 27 | // Console output 28 | NSLog(@"Hello, World!"); 29 | 30 | // Alert window 31 | UIAlertView *alert = [UIAlertView alloc]; 32 | alert = [alert initWithTitle:@"Hey there!" 33 | message:@"Welcome to OpenCV on iOS \ 34 | development community" 35 | delegate:nil 36 | cancelButtonTitle:@"Continue" 37 | otherButtonTitles:nil]; 38 | 39 | [alert show]; 40 | } 41 | 42 | - (void)didReceiveMemoryWarning 43 | { 44 | [super didReceiveMemoryWarning]; 45 | // Dispose of any resources that can be recreated. 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/en.lproj/MainStoryboard_iPad.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/en.lproj/MainStoryboard_iPhone.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Chapter01_HelloWorld/Chapter01_HelloWorld/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 1 of the "OpenCV for iOS" book 7 | * 8 | * Getting started with iOS, helps you to set up your development environment 9 | * and run your first "Hello World" iOS application. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage.xcodeproj/project.xcworkspace/xcshareddata/Chapter02_DisplayingImage.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 79CF8EB5-4641-4F85-BF79-7419E3B23BA5 9 | IDESourceControlProjectName 10 | Chapter02_DisplayingImage 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | D4EEFB5D-ED7C-42B9-B82B-8964CBB02243 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter02_DisplayingImage/Chapter02_DisplayingImage.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | D4EEFB5D-ED7C-42B9-B82B-8964CBB02243 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | D4EEFB5D-ED7C-42B9-B82B-8964CBB02243 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | D4EEFB5D-ED7C-42B9-B82B-8964CBB02243 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter02_DisplayingImage/Chapter02_DisplayingImage.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter02_DisplayingImage.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8360CCEB1736646F00A0F806 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 2 of the "OpenCV for iOS" book 7 | * 8 | * Displaying Image from Resources introduces you to basic GUI concepts on iOS, and covers loading of an 9 | * image from resources and displaying it on the screen. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow* window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/Chapter02_DisplayingImage-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/Chapter02_DisplayingImage-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter02_DisplayingImage' target in the 'Chapter02_DisplayingImage' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter02_DisplayingImage/Chapter02_DisplayingImage/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter02_DisplayingImage/Chapter02_DisplayingImage/Default.png -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter02_DisplayingImage/Chapter02_DisplayingImage/Default@2x.png -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 2 of the "OpenCV for iOS" book 7 | * 8 | * Displaying Image from Resources introduces you to basic GUI concepts on iOS, and covers loading of an 9 | * image from resources and displaying it on the screen. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface ViewController : UIViewController { 18 | UIImage* image; 19 | } 20 | 21 | @property (nonatomic, weak) IBOutlet UIImageView* imageView; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/ViewController.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 2 of the "OpenCV for iOS" book 7 | * 8 | * Displaying Image from Resources introduces you to basic GUI concepts on iOS, and covers loading of an 9 | * image from resources and displaying it on the screen. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import "ViewController.h" 16 | 17 | @interface ViewController () 18 | 19 | @end 20 | 21 | @implementation ViewController 22 | @synthesize imageView; 23 | 24 | - (void)viewDidLoad 25 | { 26 | [super viewDidLoad]; 27 | 28 | // Read the image 29 | image = [UIImage imageNamed:@"lena.png"]; 30 | if (image != nil) 31 | imageView.image = image; 32 | } 33 | 34 | - (void)didReceiveMemoryWarning 35 | { 36 | [super didReceiveMemoryWarning]; 37 | // Dispose of any resources that can be recreated. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/lena.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter02_DisplayingImage/Chapter02_DisplayingImage/lena.png -------------------------------------------------------------------------------- /Chapter02_DisplayingImage/Chapter02_DisplayingImage/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 2 of the "OpenCV for iOS" book 7 | * 8 | * Displaying Image from Resources introduces you to basic GUI concepts on iOS, and covers loading of an 9 | * image from resources and displaying it on the screen. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV.xcodeproj/project.xcworkspace/xcshareddata/Chapter03_LinkingOpenCV.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 20317A42-8C0E-4D61-B041-D2C6911093F1 9 | IDESourceControlProjectName 10 | Chapter03_LinkingOpenCV 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter03_LinkingOpenCV.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8360CD571736684D00A0F806 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 3 of the "OpenCV for iOS" book 7 | * 8 | * Linking OpenCV to iOS Project explains how to link OpenCV library 9 | * and call any function from it. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow* window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter03_LinkingOpenCV' target in the 'Chapter03_LinkingOpenCV' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/Default.png -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/Default@2x.png -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 3 of the "OpenCV for iOS" book 7 | * 8 | * Linking OpenCV to iOS Project explains how to link OpenCV library 9 | * and call any function from it. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface ViewController : UIViewController { 18 | cv::Mat cvImage; 19 | } 20 | 21 | @property (nonatomic, weak) IBOutlet UIImageView* imageView; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/lena.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/lena.png -------------------------------------------------------------------------------- /Chapter03_LinkingOpenCV/Chapter03_LinkingOpenCV/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 3 of the "OpenCV for iOS" book 7 | * 8 | * Linking OpenCV to iOS Project explains how to link OpenCV library 9 | * and call any function from it. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces.xcodeproj/project.xcworkspace/xcshareddata/Chapter04_DetectingFaces.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 6725734C-B1C9-4DB7-A82A-996E58D8D6CF 9 | IDESourceControlProjectName 10 | Chapter04_DetectingFaces 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | DD959849-5B53-4C28-B6DD-072A690DF575 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter04_DetectingFaces/Chapter04_DetectingFaces.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | DD959849-5B53-4C28-B6DD-072A690DF575 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | DD959849-5B53-4C28-B6DD-072A690DF575 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | DD959849-5B53-4C28-B6DD-072A690DF575 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter04_DetectingFaces/Chapter04_DetectingFaces.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter04_DetectingFaces.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8360CD9017366B6100A0F806 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 4 of the "OpenCV for iOS" book 7 | * 8 | * Detecting Faces with Cascade Classifier shows how to detect faces 9 | * using OpenCV. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 4 of the "OpenCV for iOS" book 7 | * 8 | * Detecting Faces with Cascade Classifier shows how to detect faces 9 | * using OpenCV. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import "AppDelegate.h" 16 | 17 | @implementation AppDelegate 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 20 | { 21 | // Override point for customization after application launch. 22 | return YES; 23 | } 24 | 25 | - (void)applicationWillResignActive:(UIApplication *)application 26 | { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 29 | } 30 | 31 | - (void)applicationDidEnterBackground:(UIApplication *)application 32 | { 33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application 38 | { 39 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 40 | } 41 | 42 | - (void)applicationDidBecomeActive:(UIApplication *)application 43 | { 44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 45 | } 46 | 47 | - (void)applicationWillTerminate:(UIApplication *)application 48 | { 49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/Chapter04_DetectingFaces-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/Chapter04_DetectingFaces-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter04_DetectingFaces' target in the 'Chapter04_DetectingFaces' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter04_DetectingFaces/Chapter04_DetectingFaces/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter04_DetectingFaces/Chapter04_DetectingFaces/Default.png -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter04_DetectingFaces/Chapter04_DetectingFaces/Default@2x.png -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 4 of the "OpenCV for iOS" book 7 | * 8 | * Detecting Faces with Cascade Classifier shows how to detect faces 9 | * using OpenCV. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface ViewController : UIViewController { 18 | cv::CascadeClassifier faceDetector; 19 | } 20 | 21 | @property (nonatomic, weak) IBOutlet UIImageView* imageView; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/ViewController.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 4 of the "OpenCV for iOS" book 7 | * 8 | * Detecting Faces with Cascade Classifier shows how to detect faces 9 | * using OpenCV. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import "ViewController.h" 16 | #import "opencv2/highgui/ios.h" 17 | 18 | @interface ViewController () 19 | 20 | @end 21 | 22 | @implementation ViewController 23 | 24 | @synthesize imageView; 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | 30 | // Load cascade classifier from the XML file 31 | NSString* cascadePath = [[NSBundle mainBundle] 32 | pathForResource:@"haarcascade_frontalface_alt" 33 | ofType:@"xml"]; 34 | faceDetector.load([cascadePath UTF8String]); 35 | 36 | //Load image with face 37 | UIImage* image = [UIImage imageNamed:@"lena.png"]; 38 | cv::Mat faceImage; 39 | UIImageToMat(image, faceImage); 40 | 41 | // Convert to grayscale 42 | cv::Mat gray; 43 | cvtColor(faceImage, gray, CV_BGR2GRAY); 44 | 45 | // Detect faces 46 | std::vector faces; 47 | faceDetector.detectMultiScale(gray, faces, 1.1, 48 | 2, 0|CV_HAAR_SCALE_IMAGE, cv::Size(30, 30)); 49 | 50 | // Draw all detected faces 51 | for(unsigned int i = 0; i < faces.size(); i++) 52 | { 53 | const cv::Rect& face = faces[i]; 54 | // Get top-left and bottom-right corner points 55 | cv::Point tl(face.x, face.y); 56 | cv::Point br = tl + cv::Point(face.width, face.height); 57 | 58 | // Draw rectangle around the face 59 | cv::Scalar magenta = cv::Scalar(255, 0, 255); 60 | cv::rectangle(faceImage, tl, br, magenta, 4, 8, 0); 61 | } 62 | 63 | // Show resulting image 64 | imageView.image = MatToUIImage(faceImage); 65 | } 66 | 67 | - (void)didReceiveMemoryWarning 68 | { 69 | [super didReceiveMemoryWarning]; 70 | // Dispose of any resources that can be recreated. 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/lena.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter04_DetectingFaces/Chapter04_DetectingFaces/lena.png -------------------------------------------------------------------------------- /Chapter04_DetectingFaces/Chapter04_DetectingFaces/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 4 of the "OpenCV for iOS" book 7 | * 8 | * Detecting Faces with Cascade Classifier shows how to detect faces 9 | * using OpenCV. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard.xcodeproj/project.xcworkspace/xcshareddata/Chapter05_PrintingPostcard.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | E6D3CA3B-3D2E-4AF6-9CFA-2AA6E44B0177 9 | IDESourceControlProjectName 10 | Chapter05_PrintingPostcard 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter05_PrintingPostcard/Chapter05_PrintingPostcard.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter05_PrintingPostcard/Chapter05_PrintingPostcard.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter05_PrintingPostcard.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83348C2B173E572100C6D4D7 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 5 of the "OpenCV for iOS" book 7 | * 8 | * Printing Postcard demonstrates how a simple photo effect 9 | * can be implemented. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 5 of the "OpenCV for iOS" book 7 | * 8 | * Printing Postcard demonstrates how a simple photo effect 9 | * can be implemented. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import "AppDelegate.h" 16 | 17 | @implementation AppDelegate 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 20 | { 21 | // Override point for customization after application launch. 22 | return YES; 23 | } 24 | 25 | - (void)applicationWillResignActive:(UIApplication *)application 26 | { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 29 | } 30 | 31 | - (void)applicationDidEnterBackground:(UIApplication *)application 32 | { 33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application 38 | { 39 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 40 | } 41 | 42 | - (void)applicationDidBecomeActive:(UIApplication *)application 43 | { 44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 45 | } 46 | 47 | - (void)applicationWillTerminate:(UIApplication *)application 48 | { 49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/Chapter05_PrintingPostcard-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/Chapter05_PrintingPostcard-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter05_PrintingPostcard' target in the 'Chapter05_PrintingPostcard' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/Default.png -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/Default@2x.png -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/PostcardPrinter.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * PostcardPrinter.hpp 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 5 of the "OpenCV for iOS" book 7 | * 8 | * Printing Postcard demonstrates how a simple photo effect 9 | * can be implemented. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | 16 | #pragma once 17 | 18 | #include "opencv2/core/core.hpp" 19 | 20 | class PostcardPrinter 21 | { 22 | public: 23 | struct Parameters 24 | { 25 | cv::Mat face; 26 | cv::Mat texture; 27 | cv::Mat text; 28 | }; 29 | 30 | PostcardPrinter(Parameters& parameters); 31 | virtual ~PostcardPrinter() {} 32 | 33 | void print(cv::Mat& postcard) const; 34 | 35 | protected: 36 | void markup(); 37 | void crumple(cv::Mat& image, const cv::Mat& texture, 38 | const cv::Mat& mask = cv::Mat()) const; 39 | void printFragment(cv::Mat& placeForFragment, 40 | const cv::Mat& fragment) const; 41 | void alphaBlendC3(const cv::Mat& src, cv::Mat& dst, 42 | const cv::Mat& alpha) const; 43 | 44 | Parameters params_; 45 | cv::Rect faceRoi_; 46 | cv::Rect textRoi_; 47 | }; 48 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 5 of the "OpenCV for iOS" book 7 | * 8 | * Printing Postcard demonstrates how a simple photo effect 9 | * can be implemented. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface ViewController : UIViewController 18 | { 19 | } 20 | 21 | @property (nonatomic, weak) IBOutlet UIImageView* imageView; 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/ViewController.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 5 of the "OpenCV for iOS" book 7 | * 8 | * Printing Postcard demonstrates how a simple photo effect 9 | * can be implemented. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import "ViewController.h" 16 | #import "PostcardPrinter.hpp" 17 | #import "opencv2/highgui/ios.h" 18 | 19 | @interface ViewController () 20 | 21 | @end 22 | 23 | @implementation ViewController 24 | 25 | @synthesize imageView; 26 | 27 | - (NSInteger)supportedInterfaceOrientations 28 | { 29 | // Only portrait orientation 30 | return UIInterfaceOrientationMaskPortrait; 31 | } 32 | 33 | - (void)viewDidLoad 34 | { 35 | [super viewDidLoad]; 36 | 37 | PostcardPrinter::Parameters params; 38 | 39 | // Load image with face 40 | UIImage* image = [UIImage imageNamed:@"lena.jpg"]; 41 | UIImageToMat(image, params.face); 42 | 43 | // Load image with texture 44 | image = [UIImage imageNamed:@"texture.jpg"]; 45 | UIImageToMat(image, params.texture); 46 | cvtColor(params.texture, params.texture, CV_RGBA2RGB); 47 | 48 | // Load image with text 49 | image = [UIImage imageNamed:@"text.png"]; 50 | UIImageToMat(image, params.text, true); 51 | 52 | // Create PostcardPrinter class 53 | PostcardPrinter postcardPrinter(params); 54 | 55 | // Print postcard, and measure printing time 56 | cv::Mat postcard; 57 | int64 timeStart = cv::getTickCount(); 58 | postcardPrinter.print(postcard); 59 | int64 timeEnd = cv::getTickCount(); 60 | float durationMs = 61 | 1000.f * float(timeEnd - timeStart) / cv::getTickFrequency(); 62 | NSLog(@"Printing time = %.3fms", durationMs); 63 | 64 | if (!postcard.empty()) 65 | imageView.image = MatToUIImage(postcard); 66 | } 67 | 68 | - (void)didReceiveMemoryWarning 69 | { 70 | [super didReceiveMemoryWarning]; 71 | // Dispose of any resources that can be recreated. 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/lena.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/lena.jpg -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 5th May 2013 5 | ****************************************************************************** 6 | * Chapter 5 of the "OpenCV for iOS" book 7 | * 8 | * Printing Postcard demonstrates how a simple photo effect 9 | * can be implemented. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/text.png -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/texture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter05_PrintingPostcard/Chapter05_PrintingPostcard/texture.jpg -------------------------------------------------------------------------------- /Chapter05_PrintingPostcard/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter05_PrintingPostcard/screenshot.png -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery.xcodeproj/project.xcworkspace/xcshareddata/Chapter06_WorkingWithGallery.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | D8D8A9D9-1AD3-4BFA-BA7F-30F36571B05C 9 | IDESourceControlProjectName 10 | Chapter06_WorkingWithGallery 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery.xcodeproj/project.xcworkspace/xcuserdata/alexanderpetrovichev.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery.xcodeproj/project.xcworkspace/xcuserdata/alexanderpetrovichev.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery.xcodeproj/xcuserdata/alexanderpetrovichev.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter06_WorkingWithGallery.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83348C68173E5C3600C6D4D7 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter06_WorkingWithGallery.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83348C68173E5C3600C6D4D7 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 11th May 2013 5 | ****************************************************************************** 6 | * Chapter 6 of the "OpenCV for iOS" book 7 | * 8 | * Working with Images in Gallery explains how to load and save 9 | * images from/to Gallery. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter06_WorkingWithGallery' target in the 'Chapter06_WorkingWithGallery' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/Default.png -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/Default@2x.png -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/PostcardPrinter.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * PostcardPrinter.hpp 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 11th May 2013 5 | ****************************************************************************** 6 | * Chapter 6 of the "OpenCV for iOS" book 7 | * 8 | * Working with Images in Gallery explains how to load and save 9 | * images from/to Gallery. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #pragma once 16 | 17 | #include "opencv2/core/core.hpp" 18 | 19 | class PostcardPrinter 20 | { 21 | public: 22 | struct Parameters 23 | { 24 | cv::Mat face; 25 | cv::Mat texture; 26 | cv::Mat text; 27 | }; 28 | 29 | PostcardPrinter(Parameters& parameters); 30 | virtual ~PostcardPrinter() {} 31 | 32 | void print(cv::Mat& postcard) const; 33 | void preprocessFace(); 34 | 35 | protected: 36 | void markup(); 37 | void crumple(cv::Mat& image, const cv::Mat& texture, 38 | const cv::Mat& mask = cv::Mat()) const; 39 | void printFragment(cv::Mat& placeForFragment, 40 | const cv::Mat& fragment) const; 41 | void alphaBlendC3(const cv::Mat& src, cv::Mat& dst, 42 | const cv::Mat& alpha) const; 43 | 44 | Parameters params_; 45 | cv::Rect faceRoi_; 46 | cv::Rect textRoi_; 47 | }; 48 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 11th May 2013 5 | ****************************************************************************** 6 | * Chapter 6 of the "OpenCV for iOS" book 7 | * 8 | * Working with Images in Gallery explains how to load and save 9 | * images from/to Gallery. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface ViewController : 18 | UIViewController 21 | { 22 | UIPopoverController* popoverController; 23 | UIImageView* imageView; 24 | UIImage* postcardImage; 25 | cv::CascadeClassifier faceDetector; 26 | } 27 | 28 | @property (nonatomic, strong) IBOutlet UIImageView* imageView; 29 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar; 30 | @property (nonatomic, strong) UIPopoverController* popoverController; 31 | @property (nonatomic, weak) IBOutlet UIBarButtonItem* loadButton; 32 | @property (nonatomic, weak) IBOutlet UIBarButtonItem* saveButton; 33 | 34 | -(IBAction)loadButtonPressed:(id)sender; 35 | -(IBAction)saveButtonPressed:(id)sender; 36 | 37 | - (UIImage*)printPostcard:(UIImage*)image; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/lena.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/lena.jpg -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 11th May 2013 5 | ****************************************************************************** 6 | * Chapter 6 of the "OpenCV for iOS" book 7 | * 8 | * Working with Images in Gallery explains how to load and save 9 | * images from/to Gallery. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/text.png -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/texture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter06_WorkingWithGallery/Chapter06_WorkingWithGallery/texture.jpg -------------------------------------------------------------------------------- /Chapter06_WorkingWithGallery/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter06_WorkingWithGallery/screenshot.png -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect.xcodeproj/project.xcworkspace/xcshareddata/Chapter07_ApplyingRetroEffect.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 66AFA124-F748-46CA-8B76-0EC61AEE50EF 9 | IDESourceControlProjectName 10 | Chapter07_ApplyingRetroEffect 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | D4EEFB5D-ED7C-42B9-B82B-8964CBB02243 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | D4EEFB5D-ED7C-42B9-B82B-8964CBB02243 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | D4EEFB5D-ED7C-42B9-B82B-8964CBB02243 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | D4EEFB5D-ED7C-42B9-B82B-8964CBB02243 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter07_ApplyingRetroEffect.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 831B4DB417438D09004A000D 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 15th May 2013 5 | ****************************************************************************** 6 | * Chapter 7 of the "OpenCV for iOS" book 7 | * 8 | * Applying a retro effect demonstrates another interesting photo 9 | * effect that makes photos look old. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter07_ApplyingRetroEffect' target in the 'Chapter07_ApplyingRetroEffect' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/Default.png -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/Default@2x.png -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/RetroFilter.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * RetroFilter.hpp 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 15th May 2013 5 | ****************************************************************************** 6 | * Chapter 7 of the "OpenCV for iOS" book 7 | * 8 | * Applying a retro effect demonstrates another interesting photo 9 | * effect that makes photos look old. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #pragma once 16 | 17 | #include "opencv2/core/core.hpp" 18 | 19 | void alphaBlendC1(cv::Mat src, cv::Mat dst, cv::Mat alpha); 20 | 21 | class RetroFilter 22 | { 23 | public: 24 | struct Parameters 25 | { 26 | cv::Size frameSize; 27 | cv::Mat fuzzyBorder; 28 | cv::Mat scratches; 29 | }; 30 | 31 | RetroFilter(const Parameters& params); 32 | virtual ~RetroFilter() {}; 33 | void applyToPhoto(const cv::Mat& frame, cv::Mat& retroFrame); 34 | void applyToVideo(const cv::Mat& frame, cv::Mat& retroFrame); 35 | 36 | protected: 37 | Parameters params_; 38 | 39 | cv::RNG rng_; 40 | float multiplier_; 41 | 42 | cv::Mat borderColor_; 43 | cv::Mat scratchColor_; 44 | 45 | std::vector sepiaPlanes_; 46 | cv::Mat sepiaH_; 47 | cv::Mat sepiaS_; 48 | }; 49 | -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 15th May 2013 5 | ****************************************************************************** 6 | * Chapter 7 of the "OpenCV for iOS" book 7 | * 8 | * Applying a retro effect demonstrates another interesting photo 9 | * effect that makes photos look old. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | #import "RetroFilter.hpp" 17 | 18 | @interface ViewController : 19 | UIViewController 22 | { 23 | UIPopoverController* popoverController; 24 | UIImageView* imageView; 25 | UIImage* image; 26 | RetroFilter::Parameters params; 27 | } 28 | 29 | @property (nonatomic, strong) IBOutlet UIImageView* imageView; 30 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar; 31 | @property (nonatomic, strong) UIPopoverController* popoverController; 32 | @property (nonatomic, weak) IBOutlet UIBarButtonItem* loadButton; 33 | @property (nonatomic, weak) IBOutlet UIBarButtonItem* saveButton; 34 | 35 | -(IBAction)loadButtonPressed:(id)sender; 36 | -(IBAction)saveButtonPressed:(id)sender; 37 | 38 | - (UIImage*)applyFilter:(UIImage*)image; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/fuzzyBorder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/fuzzyBorder.png -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 15th May 2013 5 | ****************************************************************************** 6 | * Chapter 7 of the "OpenCV for iOS" book 7 | * 8 | * Applying a retro effect demonstrates another interesting photo 9 | * effect that makes photos look old. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/scratches.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter07_ApplyingRetroEffect/Chapter07_ApplyingRetroEffect/scratches.png -------------------------------------------------------------------------------- /Chapter07_ApplyingRetroEffect/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter07_ApplyingRetroEffect/screenshot.png -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera.xcodeproj/project.xcworkspace/xcshareddata/Chapter08_TakingPhotosFromCamera.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 489A423E-AF09-4D9B-AA25-3B472C24221C 9 | IDESourceControlProjectName 10 | Chapter08_TakingPhotosFromCamera 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter08_TakingPhotosFromCamera.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 830790E51741201E008E3CF5 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 8 of the "OpenCV for iOS" book 7 | * 8 | * Taking Photos From Camera shows how to capture static images 9 | * with camera. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter08_TakingPhotosFromCamera' target in the 'Chapter08_TakingPhotosFromCamera' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/Default.png -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/Default@2x.png -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/RetroFilter.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * RetroFilter.hpp 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 8 of the "OpenCV for iOS" book 7 | * 8 | * Taking Photos From Camera shows how to capture static images 9 | * with camera. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #pragma once 16 | 17 | #include "opencv2/core/core.hpp" 18 | 19 | void alphaBlendC1(cv::Mat src, cv::Mat dst, cv::Mat alpha); 20 | 21 | class RetroFilter 22 | { 23 | public: 24 | struct Parameters 25 | { 26 | cv::Size frameSize; 27 | cv::Mat fuzzyBorder; 28 | cv::Mat scratches; 29 | }; 30 | 31 | RetroFilter(const Parameters& params); 32 | virtual ~RetroFilter() {}; 33 | void applyToPhoto(const cv::Mat& frame, cv::Mat& retroFrame); 34 | void applyToVideo(const cv::Mat& frame, cv::Mat& retroFrame); 35 | 36 | protected: 37 | Parameters params_; 38 | 39 | cv::RNG rng_; 40 | float multiplier_; 41 | 42 | cv::Mat borderColor_; 43 | cv::Mat scratchColor_; 44 | 45 | std::vector sepiaPlanes_; 46 | cv::Mat sepiaH_; 47 | cv::Mat sepiaS_; 48 | }; 49 | -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 8 of the "OpenCV for iOS" book 7 | * 8 | * Taking Photos From Camera shows how to capture static images 9 | * with camera. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | #import 17 | #import "RetroFilter.hpp" 18 | 19 | @interface ViewController : UIViewController 20 | { 21 | CvPhotoCamera* photoCamera; 22 | UIImageView* resultView; 23 | RetroFilter::Parameters params; 24 | } 25 | 26 | @property (nonatomic, strong) CvPhotoCamera* photoCamera; 27 | @property (nonatomic, strong) IBOutlet UIImageView* imageView; 28 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar; 29 | @property (nonatomic, weak) IBOutlet 30 | UIBarButtonItem* takePhotoButton; 31 | @property (nonatomic, weak) IBOutlet 32 | UIBarButtonItem* startCaptureButton; 33 | 34 | -(IBAction)takePhotoButtonPressed:(id)sender; 35 | -(IBAction)startCaptureButtonPressed:(id)sender; 36 | 37 | - (UIImage*)applyEffect:(UIImage*)image; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/fuzzy_border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/fuzzy_border.png -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 8 of the "OpenCV for iOS" book 7 | * 8 | * Taking Photos From Camera shows how to capture static images 9 | * with camera. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/scratches.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter08_TakingPhotosFromCamera/Chapter08_TakingPhotosFromCamera/scratches.png -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary.xcodeproj/project.xcworkspace/xcshareddata/Chapter09_CreatingStaticLibrary.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 6910D6B2-6256-41B0-A232-A9C08F73429A 9 | IDESourceControlProjectName 10 | Chapter09_CreatingStaticLibrary 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter09_CreatingStaticLibrary.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83348C2B173E572100C6D4D7 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 9 of the "OpenCV for iOS" book 7 | * 8 | * Creating Static Library explains how to create 9 | * a Static Library project in Xcode. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary-Prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | #import 3 | #endif 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/Default.png -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/Default@2x.png -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 9 of the "OpenCV for iOS" book 7 | * 8 | * Creating Static Library explains how to create 9 | * a Static Library project in Xcode. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface ViewController : UIViewController 18 | { 19 | } 20 | 21 | @property (nonatomic, weak) IBOutlet UIImageView* imageView; 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/ViewController.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 9 of the "OpenCV for iOS" book 7 | * 8 | * Creating Static Library explains how to create 9 | * a Static Library project in Xcode. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | 16 | #import "ViewController.h" 17 | #import "CvEffects/PostcardPrinter.hpp" 18 | #import "opencv2/highgui/ios.h" 19 | 20 | @interface ViewController () 21 | 22 | @end 23 | 24 | @implementation ViewController 25 | 26 | @synthesize imageView; 27 | 28 | // Macros for time measurements 29 | #if 1 30 | #define TS(name) int64 t_##name = cv::getTickCount() 31 | #define TE(name) printf("TIMER_" #name ": %.2fms\n", \ 32 | 1000.*((cv::getTickCount() - t_##name) / cv::getTickFrequency())) 33 | #else 34 | #define TS(name) 35 | #define TE(name) 36 | #endif 37 | 38 | - (void)viewDidLoad 39 | { 40 | [super viewDidLoad]; 41 | 42 | PostcardPrinter::Parameters params; 43 | 44 | // Load images 45 | UIImage* image = [UIImage imageNamed:@"lena.jpg"]; 46 | UIImageToMat(image, params.face); 47 | 48 | image = [UIImage imageNamed:@"texture.jpg"]; 49 | UIImageToMat(image, params.texture); 50 | cvtColor(params.texture, params.texture, CV_RGBA2RGB); 51 | 52 | image = [UIImage imageNamed:@"text.png"]; 53 | UIImageToMat(image, params.text, true); 54 | 55 | // Create PostcardPrinter class 56 | PostcardPrinter postcardPrinter(params); 57 | 58 | cv::Mat postcard; 59 | TS(PostcardPrinting); 60 | postcardPrinter.print(postcard); 61 | TE(PostcardPrinting); 62 | 63 | if (!postcard.empty()) 64 | imageView.image = MatToUIImage(postcard); 65 | } 66 | 67 | - (NSInteger)supportedInterfaceOrientations 68 | { 69 | // Only portrait orientation 70 | return UIInterfaceOrientationMaskPortrait; 71 | } 72 | 73 | - (void)didReceiveMemoryWarning 74 | { 75 | [super didReceiveMemoryWarning]; 76 | // Dispose of any resources that can be recreated. 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter09_CreatingStaticLibrary/Chapter09_CreatingStaticLibrary/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 9 of the "OpenCV for iOS" book 7 | * 8 | * Creating Static Library explains how to create 9 | * a Static Library project in Xcode. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | 16 | #import 17 | 18 | #import "AppDelegate.h" 19 | 20 | int main(int argc, char *argv[]) 21 | { 22 | @autoreleasepool { 23 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo.xcodeproj/project.xcworkspace/xcshareddata/Chapter10_CapturingVideo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 0E191804-724D-4B7E-BF48-0675AECFB269 9 | IDESourceControlProjectName 10 | Chapter10_CapturingVideo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter10_CapturingVideo/Chapter10_CapturingVideo.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter10_CapturingVideo/Chapter10_CapturingVideo.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter10_CapturingVideo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83FA790D1748FE9000248405 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 10 of the "OpenCV for iOS" book 7 | * 8 | * Capturing Video from Camera shows how to capture video 9 | * stream from camera. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 10 of the "OpenCV for iOS" book 7 | * 8 | * Capturing Video from Camera shows how to capture video 9 | * stream from camera. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import "AppDelegate.h" 16 | 17 | @implementation AppDelegate 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 20 | { 21 | // Override point for customization after application launch. 22 | return YES; 23 | } 24 | 25 | - (void)applicationWillResignActive:(UIApplication *)application 26 | { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 29 | } 30 | 31 | - (void)applicationDidEnterBackground:(UIApplication *)application 32 | { 33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application 38 | { 39 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 40 | } 41 | 42 | - (void)applicationDidBecomeActive:(UIApplication *)application 43 | { 44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 45 | } 46 | 47 | - (void)applicationWillTerminate:(UIApplication *)application 48 | { 49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/Chapter10_CapturingVideo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/Chapter10_CapturingVideo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter10_CapturingVideo' target in the 'Chapter10_CapturingVideo' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter10_CapturingVideo/Chapter10_CapturingVideo/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter10_CapturingVideo/Chapter10_CapturingVideo/Default.png -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter10_CapturingVideo/Chapter10_CapturingVideo/Default@2x.png -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 10 of the "OpenCV for iOS" book 7 | * 8 | * Capturing Video from Camera shows how to capture video 9 | * stream from camera. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | #import 17 | 18 | @interface ViewController : UIViewController 19 | { 20 | CvVideoCamera* videoCamera; 21 | BOOL isCapturing; 22 | } 23 | 24 | @property (nonatomic, strong) CvVideoCamera* videoCamera; 25 | @property (nonatomic, strong) IBOutlet UIImageView* imageView; 26 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar; 27 | @property (nonatomic, weak) IBOutlet 28 | UIBarButtonItem* startCaptureButton; 29 | @property (nonatomic, weak) IBOutlet 30 | UIBarButtonItem* stopCaptureButton; 31 | 32 | -(IBAction)startCaptureButtonPressed:(id)sender; 33 | -(IBAction)stopCaptureButtonPressed:(id)sender; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/ViewController.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 10 of the "OpenCV for iOS" book 7 | * 8 | * Capturing Video from Camera shows how to capture video 9 | * stream from camera. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import "ViewController.h" 16 | 17 | @interface ViewController () 18 | 19 | @end 20 | 21 | @implementation ViewController 22 | 23 | @synthesize imageView; 24 | @synthesize startCaptureButton; 25 | @synthesize toolbar; 26 | @synthesize videoCamera; 27 | 28 | - (void)viewDidLoad 29 | { 30 | [super viewDidLoad]; 31 | 32 | self.videoCamera = [[CvVideoCamera alloc] 33 | initWithParentView:imageView]; 34 | self.videoCamera.delegate = self; 35 | self.videoCamera.defaultAVCaptureDevicePosition = 36 | AVCaptureDevicePositionFront; 37 | self.videoCamera.defaultAVCaptureSessionPreset = 38 | AVCaptureSessionPreset640x480; 39 | self.videoCamera.defaultAVCaptureVideoOrientation = 40 | AVCaptureVideoOrientationPortrait; 41 | self.videoCamera.defaultFPS = 30; 42 | 43 | isCapturing = NO; 44 | } 45 | 46 | - (NSInteger)supportedInterfaceOrientations 47 | { 48 | // Only portrait orientation 49 | return UIInterfaceOrientationMaskPortrait; 50 | } 51 | 52 | -(IBAction)startCaptureButtonPressed:(id)sender 53 | { 54 | [videoCamera start]; 55 | isCapturing = YES; 56 | } 57 | 58 | -(IBAction)stopCaptureButtonPressed:(id)sender 59 | { 60 | [videoCamera stop]; 61 | isCapturing = NO; 62 | } 63 | 64 | - (void)processImage:(cv::Mat&)image 65 | { 66 | // Do some OpenCV processing with the image 67 | } 68 | 69 | - (void)didReceiveMemoryWarning 70 | { 71 | [super didReceiveMemoryWarning]; 72 | // Dispose of any resources that can be recreated. 73 | } 74 | 75 | - (void)viewDidDisappear:(BOOL)animated 76 | { 77 | [super viewDidDisappear:animated]; 78 | if (isCapturing) 79 | { 80 | [videoCamera stop]; 81 | } 82 | } 83 | 84 | - (void)dealloc 85 | { 86 | videoCamera.delegate = nil; 87 | } 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter10_CapturingVideo/Chapter10_CapturingVideo/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 10 of the "OpenCV for iOS" book 7 | * 8 | * Capturing Video from Camera shows how to capture video 9 | * stream from camera. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl.xcodeproj/project.xcworkspace/xcshareddata/Chapter11_AdvancedCameraControl.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 3577CDA6-19EB-4904-B617-2A45A026404F 9 | IDESourceControlProjectName 10 | Chapter11_AdvancedCameraControl 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter11_AdvancedCameraControl.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83FA790D1748FE9000248405 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 11 of the "OpenCV for iOS" book 7 | * 8 | * Control Advanced Camera Settings explains how to control advanced 9 | * camera settings, like exposure, focus and white balance. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter11_AdvancedCameraControl' target in the 'Chapter11_AdvancedCameraControl' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/Default.png -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/Default@2x.png -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 11 of the "OpenCV for iOS" book 7 | * 8 | * Control Advanced Camera Settings explains how to control advanced 9 | * camera settings, like exposure, focus and white balance. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | #import 17 | 18 | @interface ViewController : UIViewController 19 | { 20 | CvVideoCamera* videoCamera; 21 | BOOL isCapturing; 22 | 23 | BOOL isFocusLocked, isExposureLocked, isBalanceLocked; 24 | } 25 | 26 | @property (nonatomic, strong) CvVideoCamera* videoCamera; 27 | @property (nonatomic, strong) IBOutlet UIImageView* imageView; 28 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar; 29 | @property (nonatomic, weak) IBOutlet 30 | UIBarButtonItem* startCaptureButton; 31 | @property (nonatomic, weak) IBOutlet 32 | UIBarButtonItem* stopCaptureButton; 33 | 34 | @property (nonatomic, weak) IBOutlet 35 | UIBarButtonItem* lockFocusButton; 36 | @property (nonatomic, weak) IBOutlet 37 | UIBarButtonItem* lockExposureButton; 38 | @property (nonatomic, weak) IBOutlet 39 | UIBarButtonItem* lockBalanceButton; 40 | @property (nonatomic, weak) IBOutlet 41 | UIBarButtonItem* rotationButton; 42 | 43 | -(IBAction)startCaptureButtonPressed:(id)sender; 44 | -(IBAction)stopCaptureButtonPressed:(id)sender; 45 | 46 | - (IBAction)actionLockFocus:(id)sender; 47 | - (IBAction)actionLockExposure:(id)sender; 48 | - (IBAction)actionLockBalance:(id)sender; 49 | 50 | - (IBAction)rotationButtonPressed:(id)sender; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter11_AdvancedCameraControl/Chapter11_AdvancedCameraControl/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 11 of the "OpenCV for iOS" book 7 | * 8 | * Control Advanced Camera Settings explains how to control advanced 9 | * camera settings, like exposure, focus and white balance. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo.xcodeproj/project.xcworkspace/xcshareddata/Chapter12_ProcessingVideo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 43EB90CC-A3B0-4F04-A1D0-9A3648C31C62 9 | IDESourceControlProjectName 10 | Chapter12_ProcessingVideo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter12_ProcessingVideo/Chapter12_ProcessingVideo.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter12_ProcessingVideo/Chapter12_ProcessingVideo.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter12_ProcessingVideo.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83FA790D1748FE9000248405 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 12 of the "OpenCV for iOS" book 7 | * 8 | * Applying Effects to Live Video shows how to process captured 9 | * video frames on the fly. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/Chapter12_ProcessingVideo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/Chapter12_ProcessingVideo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter12_ProcessingVideo' target in the 'Chapter12_ProcessingVideo' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/Default.png -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/Default@2x.png -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 12 of the "OpenCV for iOS" book 7 | * 8 | * Applying Effects to Live Video shows how to process captured 9 | * video frames on the fly. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | 16 | #import 17 | #import 18 | #import "CvEffects/RetroFilter.hpp" 19 | 20 | @interface ViewController : UIViewController 21 | { 22 | CvVideoCamera* videoCamera; 23 | BOOL isCapturing; 24 | RetroFilter::Parameters params; 25 | cv::Ptr filter; 26 | uint64_t prevTime; 27 | } 28 | 29 | @property (nonatomic, strong) CvVideoCamera* videoCamera; 30 | @property (nonatomic, strong) IBOutlet UIImageView* imageView; 31 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar; 32 | @property (nonatomic, weak) IBOutlet 33 | UIBarButtonItem* startCaptureButton; 34 | @property (nonatomic, weak) IBOutlet 35 | UIBarButtonItem* stopCaptureButton; 36 | 37 | -(IBAction)startCaptureButtonPressed:(id)sender; 38 | -(IBAction)stopCaptureButtonPressed:(id)sender; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/Chapter12_ProcessingVideo/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 12 of the "OpenCV for iOS" book 7 | * 8 | * Applying Effects to Live Video shows how to process captured 9 | * video frames on the fly. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | 16 | #import 17 | 18 | #import "AppDelegate.h" 19 | 20 | int main(int argc, char *argv[]) 21 | { 22 | @autoreleasepool { 23 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Chapter12_ProcessingVideo/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter12_ProcessingVideo/screenshot.png -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo.xcodeproj/project.xcworkspace/xcshareddata/Chapter13_SavingVideo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 1A34E753-907C-4A1B-A27F-B27BA4B0DAB1 9 | IDESourceControlProjectName 10 | Chapter13_SavingVideo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter13_SavingVideo/Chapter13_SavingVideo.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter13_SavingVideo/Chapter13_SavingVideo.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter13_SavingVideo.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83FA790D1748FE9000248405 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 13 of the "OpenCV for iOS" book 7 | * 8 | * Saving Video from Camera explains how to save video stream 9 | * to the device with hardware encoding. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo/Chapter13_SavingVideo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo/Chapter13_SavingVideo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter13_SavingVideo' target in the 'Chapter13_SavingVideo' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter13_SavingVideo/Chapter13_SavingVideo/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter13_SavingVideo/Chapter13_SavingVideo/Default.png -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter13_SavingVideo/Chapter13_SavingVideo/Default@2x.png -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 13 of the "OpenCV for iOS" book 7 | * 8 | * Saving Video from Camera explains how to save video stream 9 | * to the device with hardware encoding. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | #import 17 | #import "CvEffects/RetroFilter.hpp" 18 | 19 | @interface ViewController : UIViewController 20 | { 21 | CvVideoCamera* videoCamera; 22 | BOOL isCapturing; 23 | RetroFilter::Parameters params; 24 | cv::Ptr filter; 25 | } 26 | 27 | @property (nonatomic, strong) CvVideoCamera* videoCamera; 28 | @property (nonatomic, strong) IBOutlet UIImageView* imageView; 29 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar; 30 | @property (nonatomic, weak) IBOutlet 31 | UIBarButtonItem* startCaptureButton; 32 | @property (nonatomic, weak) IBOutlet 33 | UIBarButtonItem* stopCaptureButton; 34 | 35 | -(IBAction)startCaptureButtonPressed:(id)sender; 36 | -(IBAction)stopCaptureButtonPressed:(id)sender; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter13_SavingVideo/Chapter13_SavingVideo/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** 6 | * Chapter 13 of the "OpenCV for iOS" book 7 | * 8 | * Saving Video from Camera explains how to save video stream 9 | * to the device with hardware encoding. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON.xcodeproj/project.xcworkspace/xcshareddata/Chapter14_OptimizingWithNEON.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 179FEDFA-2D22-45FC-A54B-EB712AD6E6D5 9 | IDESourceControlProjectName 10 | Chapter14_OptimizingWithNEON 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter14_OptimizingWithNEON.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83FA790D1748FE9000248405 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 19th May 2013 5 | ****************************************************************************** 6 | * Chapter 14 of the "OpenCV for iOS" book 7 | * 8 | * Optimizing Performance with ARM NEON explains how to use 9 | * SIMD instructions to vectorize you code and improve performance. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter14_OptimizingWithNEON' target in the 'Chapter14_OptimizingWithNEON' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/Default.png -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/Default@2x.png -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 19th May 2013 5 | ****************************************************************************** 6 | * Chapter 14 of the "OpenCV for iOS" book 7 | * 8 | * Optimizing Performance with ARM NEON explains how to use 9 | * SIMD instructions to vectorize you code and improve performance. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | #import 17 | #import "CvEffects/RetroFilter.hpp" 18 | 19 | @interface ViewController : UIViewController 20 | { 21 | CvVideoCamera* videoCamera; 22 | BOOL isCapturing; 23 | RetroFilter::Parameters params; 24 | cv::Ptr filter; 25 | uint64_t prevTime; 26 | } 27 | 28 | @property (nonatomic, strong) CvVideoCamera* videoCamera; 29 | @property (nonatomic, strong) IBOutlet UIImageView* imageView; 30 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar; 31 | @property (nonatomic, weak) IBOutlet 32 | UIBarButtonItem* startCaptureButton; 33 | @property (nonatomic, weak) IBOutlet 34 | UIBarButtonItem* stopCaptureButton; 35 | 36 | -(IBAction)startCaptureButtonPressed:(id)sender; 37 | -(IBAction)stopCaptureButtonPressed:(id)sender; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter14_OptimizingWithNEON/Chapter14_OptimizingWithNEON/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 19th May 2013 5 | ****************************************************************************** 6 | * Chapter 14 of the "OpenCV for iOS" book 7 | * 8 | * Optimizing Performance with ARM NEON explains how to use 9 | * SIMD instructions to vectorize you code and improve performance. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures.xcodeproj/project.xcworkspace/xcshareddata/Chapter15_DetectingFacialFeatures.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | E444E772-6F5F-4BD6-8AD9-BAFF1F81A655 9 | IDESourceControlProjectName 10 | Chapter15_DetectingFacialFeatures 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 14 | ssh://bitbucket.org/kirill_kornyakov/packt.git 15 | 16 | IDESourceControlProjectPath 17 | book/3848_sources/Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/kirill_kornyakov/packt.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | A0B627FE-A569-4C91-83C2-9BE1D651D27C 36 | IDESourceControlWCCName 37 | packt 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures.xcodeproj/project.xcworkspace/xcuserdata/alexandershishkov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Chapter15_DetectingFacialFeatures.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 83FA790D1748FE9000248405 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * AppDelegate.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 19th May 2013 5 | ****************************************************************************** 6 | * Chapter 15 of the "OpenCV for iOS" book 7 | * 8 | * Detecting Facial Features presents a simple facial feature 9 | * detection demo. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (strong, nonatomic) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | OpenCV.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Chapter15_DetectingFacialFeatures' target in the 'Chapter15_DetectingFacialFeatures' project 3 | // 4 | 5 | #ifdef __cplusplus 6 | #import 7 | #endif 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_5_0 12 | #warning "This project uses features only available in iOS SDK 5.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/Default-568h@2x.png -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/Default.png -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/Default@2x.png -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/ViewController.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * ViewController.h 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 19th May 2013 5 | ****************************************************************************** 6 | * Chapter 15 of the "OpenCV for iOS" book 7 | * 8 | * Detecting Facial Features presents a simple facial feature 9 | * detection demo. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import 18 | 19 | #import "CvEffects/RetroFilter.hpp" 20 | #import "CvEffects/FaceAnimator.hpp" 21 | 22 | @interface ViewController : UIViewController 23 | { 24 | CvVideoCamera* videoCamera; 25 | BOOL isCapturing; 26 | 27 | FaceAnimator::Parameters parameters; 28 | cv::Ptr faceAnimator; 29 | } 30 | 31 | @property (nonatomic, strong) CvVideoCamera* videoCamera; 32 | @property (nonatomic, strong) IBOutlet UIImageView *imageView; 33 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar; 34 | @property (nonatomic, weak) IBOutlet 35 | UIBarButtonItem* startCaptureButton; 36 | @property (nonatomic, weak) IBOutlet 37 | UIBarButtonItem* stopCaptureButton; 38 | 39 | -(IBAction)startCaptureButtonPressed:(id)sender; 40 | -(IBAction)stopCaptureButtonPressed:(id)sender; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/Chapter15_DetectingFacialFeatures/main.m: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * main.m 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 19th May 2013 5 | ****************************************************************************** 6 | * Chapter 15 of the "OpenCV for iOS" book 7 | * 8 | * Detecting Facial Features presents a simple facial feature 9 | * detection demo. 10 | * 11 | * Copyright Packt Publishing 2013. 12 | * http://bit.ly/OpenCV_for_iOS_book 13 | *****************************************************************************/ 14 | 15 | #import 16 | 17 | #import "AppDelegate.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter15_DetectingFacialFeatures/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/Chapter15_DetectingFacialFeatures/screenshot.png -------------------------------------------------------------------------------- /CvEffects/CvEffects.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CvEffects/CvEffects.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/CvEffects.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /CvEffects/CvEffects.xcodeproj/xcuserdata/alexandershishkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CvEffects.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 51E204261747A1C3005C39DB 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /CvEffects/CvEffects/CvEffects-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CvEffects' target in the 'CvEffects' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /CvEffects/CvEffects/FaceAnimator.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * FaceAnimator.hpp 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** * 6 | * Copyright Packt Publishing 2013. 7 | * http://bit.ly/OpenCV_for_iOS_book 8 | *****************************************************************************/ 9 | 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | class FaceAnimator 16 | { 17 | public: 18 | struct Parameters 19 | { 20 | cv::Mat glasses; 21 | cv::Mat mustache; 22 | cv::CascadeClassifier faceCascade; 23 | cv::CascadeClassifier eyesCascade; 24 | cv::CascadeClassifier mouthCascade; 25 | }; 26 | 27 | FaceAnimator(Parameters params); 28 | virtual ~FaceAnimator() {}; 29 | 30 | void detectAndAnimateFaces(cv::Mat& frame); 31 | 32 | protected: 33 | Parameters parameters_; 34 | cv::Mat maskOrig_; 35 | cv::Mat maskMust_; 36 | cv::Mat grayFrame_; 37 | 38 | void putImage(cv::Mat& frame, const cv::Mat& image, 39 | const cv::Mat& alpha, cv::Rect face, 40 | cv::Rect facialFeature, float shift); 41 | void PreprocessToGray(cv::Mat& frame); 42 | 43 | // Members needed for optimization with Accelerate Framework 44 | void PreprocessToGray_optimized(cv::Mat& frame); 45 | cv::Mat accBuffer1_; 46 | cv::Mat accBuffer2_; 47 | }; 48 | -------------------------------------------------------------------------------- /CvEffects/CvEffects/PostcardPrinter.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * PostcardPrinter.hpp 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** * 6 | * Copyright Packt Publishing 2013. 7 | * http://bit.ly/OpenCV_for_iOS_book 8 | *****************************************************************************/ 9 | 10 | #pragma once 11 | 12 | #include "opencv2/core/core.hpp" 13 | 14 | class PostcardPrinter 15 | { 16 | public: 17 | struct Parameters 18 | { 19 | cv::Mat face; 20 | cv::Mat texture; 21 | cv::Mat text; 22 | }; 23 | 24 | PostcardPrinter(Parameters& parameters); 25 | virtual ~PostcardPrinter() {} 26 | 27 | void print(cv::Mat& postcard) const; 28 | void preprocessFace(); 29 | 30 | protected: 31 | void markup(); 32 | void crumple(cv::Mat& image, const cv::Mat& texture, 33 | const cv::Mat& mask = cv::Mat()) const; 34 | void printFragment(cv::Mat& placeForFragment, 35 | const cv::Mat& fragment) const; 36 | void alphaBlendC3(const cv::Mat& src, cv::Mat& dst, 37 | const cv::Mat& alpha) const; 38 | 39 | Parameters params_; 40 | cv::Rect faceRoi_; 41 | cv::Rect textRoi_; 42 | }; 43 | -------------------------------------------------------------------------------- /CvEffects/CvEffects/Processing.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Processing.cpp 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** * 6 | * Copyright Packt Publishing 2013. 7 | * http://bit.ly/OpenCV_for_iOS_book 8 | *****************************************************************************/ 9 | 10 | #include "Processing.hpp" 11 | 12 | using namespace cv; 13 | 14 | void alphaBlendC1(const Mat& src, Mat& dst, const Mat& alpha) 15 | { 16 | for (int i = 0; i < src.rows; i++) 17 | for (int j = 0; j < src.cols; j++) 18 | { 19 | uchar alphaVal = alpha.at(i, j); 20 | if (alphaVal != 0) 21 | { 22 | float weight = static_cast(alphaVal) / 255.0f; 23 | dst.at(i, j) = weight * src.at(i, j) + 24 | (1 - weight) * dst.at(i, j); 25 | } 26 | } 27 | } 28 | 29 | void alphaBlendC4(const Mat& src, Mat& dst, const Mat& alpha) 30 | { 31 | for (int i = 0; i < src.rows; i++) 32 | for (int j = 0; j < src.cols; j++) 33 | { 34 | uchar alpha_value = alpha.at(i, j); 35 | if (alpha_value != 0) 36 | { 37 | float weight = float(alpha_value) / 255.f; 38 | dst.at(i, j) = weight * src.at(i, j) + 39 | (1 - weight) * dst.at(i, j); 40 | } 41 | } 42 | } 43 | 44 | void ExtractAlpha(cv::Mat& rgbaSrc, cv::Mat& alpha) 45 | { 46 | std::vector channels; 47 | split(rgbaSrc, channels); 48 | channels[3].copyTo(alpha); 49 | } 50 | -------------------------------------------------------------------------------- /CvEffects/CvEffects/Processing.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Processing.hpp 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** * 6 | * Copyright Packt Publishing 2013. 7 | * http://bit.ly/OpenCV_for_iOS_book 8 | *****************************************************************************/ 9 | 10 | #pragma once 11 | 12 | #include 13 | 14 | void alphaBlendC1(const cv::Mat& src, cv::Mat& dst, 15 | const cv::Mat& alpha); 16 | void alphaBlendC4(const cv::Mat& src, cv::Mat& dst, 17 | const cv::Mat& alpha); 18 | 19 | void ExtractAlpha(cv::Mat& rgbaSrc, cv::Mat& alpha); 20 | 21 | // NEON-optimized functions 22 | void alphaBlendC1_NEON(const cv::Mat& src, cv::Mat& dst, 23 | const cv::Mat& alpha); 24 | void multiply_NEON(cv::Mat& src, float multiplier); 25 | 26 | // Accelerate-optimized functions 27 | int cvtColor_Accelerate(const cv::Mat& src, cv::Mat& dst, 28 | cv::Mat buff1, cv::Mat buff2); 29 | 30 | int equalizeHist_Accelerate(const cv::Mat& src, cv::Mat& dst); 31 | 32 | // Macros for time measurements 33 | #if 1 34 | #define TS(name) int64 t_##name = getTickCount() 35 | #define TE(name) printf("TIMER_" #name ": %.2fms\n", \ 36 | 1000.f * ((getTickCount() - t_##name) / getTickFrequency())) 37 | #else 38 | #define TS(name) 39 | #define TE(name) 40 | #endif 41 | -------------------------------------------------------------------------------- /CvEffects/CvEffects/Processing_Accelerate.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Processing_Accelerate.cpp 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** * 6 | * Copyright Packt Publishing 2013. 7 | * http://bit.ly/OpenCV_for_iOS_book 8 | *****************************************************************************/ 9 | 10 | #include 11 | #include 12 | 13 | using namespace cv; 14 | 15 | int cvtColor_Accelerate(const Mat& src, Mat& dst, 16 | Mat buff1, Mat buff2) 17 | { 18 | vImagePixelCount rows = static_cast(src.rows); 19 | vImagePixelCount cols = static_cast(src.cols); 20 | 21 | vImage_Buffer _src = { src.data, rows, cols, src.step }; 22 | vImage_Buffer _dst = { dst.data, rows, cols, dst.step }; 23 | vImage_Buffer _buff1 = { buff1.data, rows, cols, buff1.step }; 24 | vImage_Buffer _buff2 = { buff2.data, rows, cols, buff2.step }; 25 | 26 | const int16_t matrix[4 * 4] = { 77, 0, 0, 0, 27 | 150, 0, 0, 0, 28 | 29, 0, 0, 0, 29 | 0, 0, 0, 0 }; 30 | int32_t divisor = 256; 31 | 32 | vImage_Error err; 33 | err = vImageMatrixMultiply_ARGB8888(&_src, &_buff1, 34 | matrix, divisor, 35 | NULL, NULL, 0 ); 36 | 37 | err = vImageConvert_ARGB8888toPlanar8(&_buff1, &_dst, 38 | &_buff2, &_buff2, 39 | &_buff2, 0); 40 | return err; 41 | } 42 | 43 | int equalizeHist_Accelerate(const Mat& src, Mat& dst) 44 | { 45 | vImagePixelCount rows = static_cast(src.rows); 46 | vImagePixelCount cols = static_cast(src.cols); 47 | 48 | vImage_Buffer _src = { src.data, rows, cols, src.step }; 49 | vImage_Buffer _dst = { dst.data, rows, cols, dst.step }; 50 | 51 | vImage_Error err; 52 | err = vImageEqualization_Planar8( &_src, &_dst, 0 ); 53 | 54 | return err; 55 | } 56 | -------------------------------------------------------------------------------- /CvEffects/CvEffects/RetroFilter.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * RetroFilter.hpp 3 | ****************************************************************************** 4 | * by Kirill Kornyakov and Alexander Shishkov, 13th May 2013 5 | ****************************************************************************** * 6 | * Copyright Packt Publishing 2013. 7 | * http://bit.ly/OpenCV_for_iOS_book 8 | *****************************************************************************/ 9 | 10 | #pragma once 11 | 12 | #include "opencv2/core/core.hpp" 13 | 14 | class RetroFilter 15 | { 16 | public: 17 | struct Parameters 18 | { 19 | cv::Size frameSize; 20 | cv::Mat fuzzyBorder; 21 | cv::Mat scratches; 22 | }; 23 | 24 | RetroFilter(const Parameters& params); 25 | virtual ~RetroFilter() {}; 26 | void applyToPhoto(const cv::Mat& frame, cv::Mat& retroFrame); 27 | void applyToVideo(const cv::Mat& frame, cv::Mat& retroFrame); 28 | void applyToVideo_optimized(const cv::Mat& frame, 29 | cv::Mat& retroFrame); 30 | 31 | protected: 32 | Parameters params_; 33 | 34 | cv::RNG rng_; 35 | float multiplier_; 36 | 37 | cv::Mat borderColor_; 38 | cv::Mat scratchColor_; 39 | 40 | std::vector sepiaPlanes_; 41 | cv::Mat sepiaH_; 42 | cv::Mat sepiaS_; 43 | }; 44 | -------------------------------------------------------------------------------- /CvEffects/CvEffects/fuzzy_border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/CvEffects/CvEffects/fuzzy_border.png -------------------------------------------------------------------------------- /CvEffects/CvEffects/glasses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/CvEffects/CvEffects/glasses.png -------------------------------------------------------------------------------- /CvEffects/CvEffects/lena.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/CvEffects/CvEffects/lena.jpg -------------------------------------------------------------------------------- /CvEffects/CvEffects/mustache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/CvEffects/CvEffects/mustache.png -------------------------------------------------------------------------------- /CvEffects/CvEffects/scratches.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/CvEffects/CvEffects/scratches.png -------------------------------------------------------------------------------- /CvEffects/CvEffects/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/CvEffects/CvEffects/text.png -------------------------------------------------------------------------------- /CvEffects/CvEffects/texture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencv/opencv_for_ios_book_samples/0b38fb11b63b2c96723906309c644447ba4fa8cc/CvEffects/CvEffects/texture.jpg -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The code is free and can be used for any purpose including commercial purposes. 2 | Packt Publishing and the authors can not be held liable for any use or result of the book's text or code. 3 | Further copyright & license info is found in the book's Copyright page. 4 | The book can be obtained from . --------------------------------------------------------------------------------