├── AROverlayExample.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── Jason.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Jason.xcuserdatad │ └── xcschemes │ ├── AROverlayExample.xcscheme │ └── xcschememanagement.plist └── AROverlayExample ├── Classes ├── AROverlayViewController.h ├── AROverlayViewController.m ├── AppDelegate.h ├── AppDelegate.m ├── CaptureSessionManager.h └── CaptureSessionManager.m ├── Info.plist ├── Prefix.pch ├── en.lproj ├── AROverlayViewController.xib ├── InfoPlist.strings └── MainWindow.xib ├── main.m ├── overlaygraphic.png └── scanbutton.png /AROverlayExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 96C334F91353F36900AD25CA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96C334F81353F36900AD25CA /* UIKit.framework */; }; 11 | 96C334FB1353F36900AD25CA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96C334FA1353F36900AD25CA /* Foundation.framework */; }; 12 | 96C334FD1353F36900AD25CA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96C334FC1353F36900AD25CA /* CoreGraphics.framework */; }; 13 | 96C335031353F36900AD25CA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 96C335011353F36900AD25CA /* InfoPlist.strings */; }; 14 | 96C335061353F36900AD25CA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 96C335051353F36900AD25CA /* main.m */; }; 15 | 96C3350C1353F36900AD25CA /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 96C3350A1353F36900AD25CA /* MainWindow.xib */; }; 16 | 96C3351A1353F60100AD25CA /* AROverlayViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 96C335181353F60100AD25CA /* AROverlayViewController.xib */; }; 17 | 96C335321353FC2600AD25CA /* overlaygraphic.png in Resources */ = {isa = PBXBuildFile; fileRef = 96C335301353FC2600AD25CA /* overlaygraphic.png */; }; 18 | 96C335331353FC2600AD25CA /* scanbutton.png in Resources */ = {isa = PBXBuildFile; fileRef = 96C335311353FC2600AD25CA /* scanbutton.png */; }; 19 | 96C3353B1353FC5000AD25CA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 96C335361353FC5000AD25CA /* AppDelegate.m */; }; 20 | 96C3353C1353FC5000AD25CA /* AROverlayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 96C335381353FC5000AD25CA /* AROverlayViewController.m */; }; 21 | 96C3353D1353FC5000AD25CA /* CaptureSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 96C3353A1353FC5000AD25CA /* CaptureSessionManager.m */; }; 22 | 96C335411353FE1500AD25CA /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96C335401353FE1500AD25CA /* AVFoundation.framework */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 96C334F41353F36900AD25CA /* AROverlayExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AROverlayExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 96C334F81353F36900AD25CA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 28 | 96C334FA1353F36900AD25CA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 29 | 96C334FC1353F36900AD25CA /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 30 | 96C335001353F36900AD25CA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 96C335021353F36900AD25CA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 32 | 96C335051353F36900AD25CA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 33 | 96C3350B1353F36900AD25CA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; 34 | 96C335191353F60100AD25CA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/AROverlayViewController.xib; sourceTree = ""; }; 35 | 96C3352F1353FBFD00AD25CA /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = ""; }; 36 | 96C335301353FC2600AD25CA /* overlaygraphic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = overlaygraphic.png; sourceTree = ""; }; 37 | 96C335311353FC2600AD25CA /* scanbutton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = scanbutton.png; sourceTree = ""; }; 38 | 96C335351353FC5000AD25CA /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Classes/AppDelegate.h; sourceTree = ""; }; 39 | 96C335361353FC5000AD25CA /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Classes/AppDelegate.m; sourceTree = ""; }; 40 | 96C335371353FC5000AD25CA /* AROverlayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AROverlayViewController.h; sourceTree = ""; }; 41 | 96C335381353FC5000AD25CA /* AROverlayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AROverlayViewController.m; sourceTree = ""; }; 42 | 96C335391353FC5000AD25CA /* CaptureSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CaptureSessionManager.h; sourceTree = ""; }; 43 | 96C3353A1353FC5000AD25CA /* CaptureSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CaptureSessionManager.m; sourceTree = ""; }; 44 | 96C335401353FE1500AD25CA /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 96C334F11353F36900AD25CA /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | 96C335411353FE1500AD25CA /* AVFoundation.framework in Frameworks */, 53 | 96C334F91353F36900AD25CA /* UIKit.framework in Frameworks */, 54 | 96C334FB1353F36900AD25CA /* Foundation.framework in Frameworks */, 55 | 96C334FD1353F36900AD25CA /* CoreGraphics.framework in Frameworks */, 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | /* End PBXFrameworksBuildPhase section */ 60 | 61 | /* Begin PBXGroup section */ 62 | 96C334E91353F36900AD25CA = { 63 | isa = PBXGroup; 64 | children = ( 65 | 96C334FE1353F36900AD25CA /* AROverlayExample */, 66 | 96C334F71353F36900AD25CA /* Frameworks */, 67 | 96C334F51353F36900AD25CA /* Products */, 68 | ); 69 | sourceTree = ""; 70 | }; 71 | 96C334F51353F36900AD25CA /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 96C334F41353F36900AD25CA /* AROverlayExample.app */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 96C334F71353F36900AD25CA /* Frameworks */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 96C335401353FE1500AD25CA /* AVFoundation.framework */, 83 | 96C334F81353F36900AD25CA /* UIKit.framework */, 84 | 96C334FA1353F36900AD25CA /* Foundation.framework */, 85 | 96C334FC1353F36900AD25CA /* CoreGraphics.framework */, 86 | ); 87 | name = Frameworks; 88 | sourceTree = ""; 89 | }; 90 | 96C334FE1353F36900AD25CA /* AROverlayExample */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 96C335351353FC5000AD25CA /* AppDelegate.h */, 94 | 96C335361353FC5000AD25CA /* AppDelegate.m */, 95 | 96C335341353FC5000AD25CA /* Classes */, 96 | 96C3353F1353FCF500AD25CA /* XIBs */, 97 | 96C334FF1353F36900AD25CA /* Supporting Files */, 98 | ); 99 | path = AROverlayExample; 100 | sourceTree = ""; 101 | }; 102 | 96C334FF1353F36900AD25CA /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 96C3353E1353FCE400AD25CA /* Images */, 106 | 96C3352F1353FBFD00AD25CA /* Prefix.pch */, 107 | 96C335001353F36900AD25CA /* Info.plist */, 108 | 96C335011353F36900AD25CA /* InfoPlist.strings */, 109 | 96C335051353F36900AD25CA /* main.m */, 110 | ); 111 | name = "Supporting Files"; 112 | sourceTree = ""; 113 | }; 114 | 96C335341353FC5000AD25CA /* Classes */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 96C335371353FC5000AD25CA /* AROverlayViewController.h */, 118 | 96C335381353FC5000AD25CA /* AROverlayViewController.m */, 119 | 96C335391353FC5000AD25CA /* CaptureSessionManager.h */, 120 | 96C3353A1353FC5000AD25CA /* CaptureSessionManager.m */, 121 | ); 122 | path = Classes; 123 | sourceTree = ""; 124 | }; 125 | 96C3353E1353FCE400AD25CA /* Images */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 96C335301353FC2600AD25CA /* overlaygraphic.png */, 129 | 96C335311353FC2600AD25CA /* scanbutton.png */, 130 | ); 131 | name = Images; 132 | sourceTree = ""; 133 | }; 134 | 96C3353F1353FCF500AD25CA /* XIBs */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 96C3350A1353F36900AD25CA /* MainWindow.xib */, 138 | 96C335181353F60100AD25CA /* AROverlayViewController.xib */, 139 | ); 140 | name = XIBs; 141 | sourceTree = ""; 142 | }; 143 | /* End PBXGroup section */ 144 | 145 | /* Begin PBXNativeTarget section */ 146 | 96C334F31353F36900AD25CA /* AROverlayExample */ = { 147 | isa = PBXNativeTarget; 148 | buildConfigurationList = 96C335151353F36900AD25CA /* Build configuration list for PBXNativeTarget "AROverlayExample" */; 149 | buildPhases = ( 150 | 96C334F01353F36900AD25CA /* Sources */, 151 | 96C334F11353F36900AD25CA /* Frameworks */, 152 | 96C334F21353F36900AD25CA /* Resources */, 153 | ); 154 | buildRules = ( 155 | ); 156 | dependencies = ( 157 | ); 158 | name = AROverlayExample; 159 | productName = AROverlayExample; 160 | productReference = 96C334F41353F36900AD25CA /* AROverlayExample.app */; 161 | productType = "com.apple.product-type.application"; 162 | }; 163 | /* End PBXNativeTarget section */ 164 | 165 | /* Begin PBXProject section */ 166 | 96C334EB1353F36900AD25CA /* Project object */ = { 167 | isa = PBXProject; 168 | buildConfigurationList = 96C334EE1353F36900AD25CA /* Build configuration list for PBXProject "AROverlayExample" */; 169 | compatibilityVersion = "Xcode 3.2"; 170 | developmentRegion = English; 171 | hasScannedForEncodings = 0; 172 | knownRegions = ( 173 | en, 174 | ); 175 | mainGroup = 96C334E91353F36900AD25CA; 176 | productRefGroup = 96C334F51353F36900AD25CA /* Products */; 177 | projectDirPath = ""; 178 | projectRoot = ""; 179 | targets = ( 180 | 96C334F31353F36900AD25CA /* AROverlayExample */, 181 | ); 182 | }; 183 | /* End PBXProject section */ 184 | 185 | /* Begin PBXResourcesBuildPhase section */ 186 | 96C334F21353F36900AD25CA /* Resources */ = { 187 | isa = PBXResourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 96C335031353F36900AD25CA /* InfoPlist.strings in Resources */, 191 | 96C3350C1353F36900AD25CA /* MainWindow.xib in Resources */, 192 | 96C3351A1353F60100AD25CA /* AROverlayViewController.xib in Resources */, 193 | 96C335321353FC2600AD25CA /* overlaygraphic.png in Resources */, 194 | 96C335331353FC2600AD25CA /* scanbutton.png in Resources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXSourcesBuildPhase section */ 201 | 96C334F01353F36900AD25CA /* Sources */ = { 202 | isa = PBXSourcesBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | 96C335061353F36900AD25CA /* main.m in Sources */, 206 | 96C3353B1353FC5000AD25CA /* AppDelegate.m in Sources */, 207 | 96C3353C1353FC5000AD25CA /* AROverlayViewController.m in Sources */, 208 | 96C3353D1353FC5000AD25CA /* CaptureSessionManager.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 96C335011353F36900AD25CA /* InfoPlist.strings */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 96C335021353F36900AD25CA /* en */, 219 | ); 220 | name = InfoPlist.strings; 221 | sourceTree = ""; 222 | }; 223 | 96C3350A1353F36900AD25CA /* MainWindow.xib */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 96C3350B1353F36900AD25CA /* en */, 227 | ); 228 | name = MainWindow.xib; 229 | sourceTree = ""; 230 | }; 231 | 96C335181353F60100AD25CA /* AROverlayViewController.xib */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 96C335191353F60100AD25CA /* en */, 235 | ); 236 | name = AROverlayViewController.xib; 237 | sourceTree = ""; 238 | }; 239 | /* End PBXVariantGroup section */ 240 | 241 | /* Begin XCBuildConfiguration section */ 242 | 96C335131353F36900AD25CA /* Debug */ = { 243 | isa = XCBuildConfiguration; 244 | buildSettings = { 245 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 246 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 247 | GCC_C_LANGUAGE_STANDARD = gnu99; 248 | GCC_OPTIMIZATION_LEVEL = 0; 249 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG; 250 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 251 | GCC_VERSION = com.apple.compilers.llvmgcc42; 252 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 253 | GCC_WARN_UNUSED_VARIABLE = YES; 254 | IPHONEOS_DEPLOYMENT_TARGET = 4.2; 255 | SDKROOT = iphoneos; 256 | }; 257 | name = Debug; 258 | }; 259 | 96C335141353F36900AD25CA /* Release */ = { 260 | isa = XCBuildConfiguration; 261 | buildSettings = { 262 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 263 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 264 | GCC_C_LANGUAGE_STANDARD = gnu99; 265 | GCC_VERSION = com.apple.compilers.llvmgcc42; 266 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 267 | GCC_WARN_UNUSED_VARIABLE = YES; 268 | IPHONEOS_DEPLOYMENT_TARGET = 4.2; 269 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 270 | SDKROOT = iphoneos; 271 | }; 272 | name = Release; 273 | }; 274 | 96C335161353F36900AD25CA /* Debug */ = { 275 | isa = XCBuildConfiguration; 276 | buildSettings = { 277 | ALWAYS_SEARCH_USER_PATHS = NO; 278 | COPY_PHASE_STRIP = NO; 279 | GCC_DYNAMIC_NO_PIC = NO; 280 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 281 | GCC_PREFIX_HEADER = AROverlayExample/Prefix.pch; 282 | INFOPLIST_FILE = AROverlayExample/Info.plist; 283 | PRODUCT_NAME = "$(TARGET_NAME)"; 284 | TARGETED_DEVICE_FAMILY = 1; 285 | WRAPPER_EXTENSION = app; 286 | }; 287 | name = Debug; 288 | }; 289 | 96C335171353F36900AD25CA /* Release */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ALWAYS_SEARCH_USER_PATHS = NO; 293 | COPY_PHASE_STRIP = YES; 294 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 295 | GCC_PREFIX_HEADER = AROverlayExample/Prefix.pch; 296 | INFOPLIST_FILE = AROverlayExample/Info.plist; 297 | PRODUCT_NAME = "$(TARGET_NAME)"; 298 | TARGETED_DEVICE_FAMILY = 1; 299 | VALIDATE_PRODUCT = YES; 300 | WRAPPER_EXTENSION = app; 301 | }; 302 | name = Release; 303 | }; 304 | /* End XCBuildConfiguration section */ 305 | 306 | /* Begin XCConfigurationList section */ 307 | 96C334EE1353F36900AD25CA /* Build configuration list for PBXProject "AROverlayExample" */ = { 308 | isa = XCConfigurationList; 309 | buildConfigurations = ( 310 | 96C335131353F36900AD25CA /* Debug */, 311 | 96C335141353F36900AD25CA /* Release */, 312 | ); 313 | defaultConfigurationIsVisible = 0; 314 | defaultConfigurationName = Release; 315 | }; 316 | 96C335151353F36900AD25CA /* Build configuration list for PBXNativeTarget "AROverlayExample" */ = { 317 | isa = XCConfigurationList; 318 | buildConfigurations = ( 319 | 96C335161353F36900AD25CA /* Debug */, 320 | 96C335171353F36900AD25CA /* Release */, 321 | ); 322 | defaultConfigurationIsVisible = 0; 323 | defaultConfigurationName = Release; 324 | }; 325 | /* End XCConfigurationList section */ 326 | }; 327 | rootObject = 96C334EB1353F36900AD25CA /* Project object */; 328 | } 329 | -------------------------------------------------------------------------------- /AROverlayExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AROverlayExample.xcodeproj/xcuserdata/Jason.xcuserdatad/xcschemes/AROverlayExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /AROverlayExample.xcodeproj/xcuserdata/Jason.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AROverlayExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 96C334F31353F36900AD25CA 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /AROverlayExample/Classes/AROverlayViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "CaptureSessionManager.h" 3 | 4 | @interface AROverlayViewController : UIViewController { 5 | 6 | } 7 | 8 | @property (retain) CaptureSessionManager *captureManager; 9 | @property (nonatomic, retain) UILabel *scanningLabel; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /AROverlayExample/Classes/AROverlayViewController.m: -------------------------------------------------------------------------------- 1 | #import "AROverlayViewController.h" 2 | 3 | @implementation AROverlayViewController 4 | 5 | @synthesize captureManager; 6 | @synthesize scanningLabel; 7 | 8 | - (void)viewDidLoad { 9 | 10 | [self setCaptureManager:[[[CaptureSessionManager alloc] init] autorelease]]; 11 | 12 | [[self captureManager] addVideoInput]; 13 | 14 | [[self captureManager] addVideoPreviewLayer]; 15 | CGRect layerRect = [[[self view] layer] bounds]; 16 | [[[self captureManager] previewLayer] setBounds:layerRect]; 17 | [[[self captureManager] previewLayer] setPosition:CGPointMake(CGRectGetMidX(layerRect), 18 | CGRectGetMidY(layerRect))]; 19 | [[[self view] layer] addSublayer:[[self captureManager] previewLayer]]; 20 | 21 | UIImageView *overlayImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"overlaygraphic.png"]]; 22 | [overlayImageView setFrame:CGRectMake(30, 100, 260, 200)]; 23 | [[self view] addSubview:overlayImageView]; 24 | [overlayImageView release]; 25 | 26 | UIButton *overlayButton = [UIButton buttonWithType:UIButtonTypeCustom]; 27 | [overlayButton setImage:[UIImage imageNamed:@"scanbutton.png"] forState:UIControlStateNormal]; 28 | [overlayButton setFrame:CGRectMake(130, 320, 60, 30)]; 29 | [overlayButton addTarget:self action:@selector(scanButtonPressed) forControlEvents:UIControlEventTouchUpInside]; 30 | [[self view] addSubview:overlayButton]; 31 | 32 | UILabel *tempLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 50, 120, 30)]; 33 | [self setScanningLabel:tempLabel]; 34 | [tempLabel release]; 35 | [scanningLabel setBackgroundColor:[UIColor clearColor]]; 36 | [scanningLabel setFont:[UIFont fontWithName:@"Courier" size: 18.0]]; 37 | [scanningLabel setTextColor:[UIColor redColor]]; 38 | [scanningLabel setText:@"Scanning..."]; 39 | [scanningLabel setHidden:YES]; 40 | [[self view] addSubview:scanningLabel]; 41 | 42 | [[captureManager captureSession] startRunning]; 43 | } 44 | 45 | - (void) scanButtonPressed { 46 | [[self scanningLabel] setHidden:NO]; 47 | [self performSelector:@selector(hideLabel:) withObject:[self scanningLabel] afterDelay:2]; 48 | } 49 | 50 | - (void)hideLabel:(UILabel *)label { 51 | [label setHidden:YES]; 52 | } 53 | 54 | - (void)didReceiveMemoryWarning { 55 | [super didReceiveMemoryWarning]; 56 | } 57 | 58 | - (void)dealloc { 59 | [captureManager release], captureManager = nil; 60 | [scanningLabel release], scanningLabel = nil; 61 | [super dealloc]; 62 | } 63 | 64 | @end 65 | 66 | -------------------------------------------------------------------------------- /AROverlayExample/Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class AROverlayViewController; 4 | 5 | @interface AppDelegate : NSObject { 6 | 7 | } 8 | 9 | @property (nonatomic, retain) IBOutlet UIWindow *window; 10 | @property (nonatomic, retain) IBOutlet AROverlayViewController *viewController; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /AROverlayExample/Classes/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AROverlayExample 4 | // 5 | // Created by Jason Job on 11-04-11. 6 | // Copyright 2011 BitCatapult. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "AROverlayViewController.h" 11 | 12 | @implementation AppDelegate 13 | 14 | 15 | @synthesize window; 16 | 17 | @synthesize viewController; 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 20 | { 21 | [[self window] setRootViewController:[self viewController]]; 22 | [[self window] makeKeyAndVisible]; 23 | return YES; 24 | } 25 | 26 | - (void)dealloc 27 | { 28 | [window release], window = nil; 29 | [viewController release], viewController = nil; 30 | [super dealloc]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /AROverlayExample/Classes/CaptureSessionManager.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | 5 | @interface CaptureSessionManager : NSObject { 6 | 7 | } 8 | 9 | @property (retain) AVCaptureVideoPreviewLayer *previewLayer; 10 | @property (retain) AVCaptureSession *captureSession; 11 | 12 | - (void)addVideoPreviewLayer; 13 | - (void)addVideoInput; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /AROverlayExample/Classes/CaptureSessionManager.m: -------------------------------------------------------------------------------- 1 | #import "CaptureSessionManager.h" 2 | 3 | 4 | @implementation CaptureSessionManager 5 | 6 | @synthesize captureSession; 7 | @synthesize previewLayer; 8 | 9 | #pragma mark Capture Session Configuration 10 | 11 | - (id)init { 12 | if ((self = [super init])) { 13 | [self setCaptureSession:[[AVCaptureSession alloc] init]]; 14 | } 15 | return self; 16 | } 17 | 18 | - (void)addVideoPreviewLayer { 19 | [self setPreviewLayer:[[[AVCaptureVideoPreviewLayer alloc] initWithSession:[self captureSession]] autorelease]]; 20 | [[self previewLayer] setVideoGravity:AVLayerVideoGravityResizeAspectFill]; 21 | 22 | } 23 | 24 | - (void)addVideoInput { 25 | AVCaptureDevice *videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; 26 | if (videoDevice) { 27 | NSError *error; 28 | AVCaptureDeviceInput *videoIn = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error]; 29 | if (!error) { 30 | if ([[self captureSession] canAddInput:videoIn]) 31 | [[self captureSession] addInput:videoIn]; 32 | else 33 | NSLog(@"Couldn't add video input"); 34 | } 35 | else 36 | NSLog(@"Couldn't create video input"); 37 | } 38 | else 39 | NSLog(@"Couldn't create video capture device"); 40 | } 41 | 42 | - (void)dealloc { 43 | 44 | [[self captureSession] stopRunning]; 45 | 46 | [previewLayer release], previewLayer = nil; 47 | [captureSession release], captureSession = nil; 48 | 49 | [super dealloc]; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /AROverlayExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.bitcatapult.aroverlayexample 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIStatusBarHidden 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /AROverlayExample/Prefix.pch: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #ifndef __IPHONE_3_0 4 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 5 | #endif 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import 10 | #endif 11 | -------------------------------------------------------------------------------- /AROverlayExample/en.lproj/AROverlayViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1056 5 | 10J567 6 | 1305 7 | 1038.35 8 | 462.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 300 12 | 13 | 14 | YES 15 | IBProxyObject 16 | IBUIView 17 | 18 | 19 | YES 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | YES 24 | 25 | YES 26 | 27 | 28 | 29 | 30 | YES 31 | 32 | IBFilesOwner 33 | IBCocoaTouchFramework 34 | 35 | 36 | IBFirstResponder 37 | IBCocoaTouchFramework 38 | 39 | 40 | 41 | 274 42 | {320, 480} 43 | 44 | 45 | 46 | 47 | 3 48 | MC43NQA 49 | 50 | 2 51 | 52 | 53 | NO 54 | IBCocoaTouchFramework 55 | 56 | 57 | 58 | 59 | YES 60 | 61 | 62 | view 63 | 64 | 65 | 66 | 7 67 | 68 | 69 | 70 | 71 | YES 72 | 73 | 0 74 | 75 | 76 | 77 | 78 | 79 | -1 80 | 81 | 82 | File's Owner 83 | 84 | 85 | -2 86 | 87 | 88 | 89 | 90 | 6 91 | 92 | 93 | 94 | 95 | 96 | 97 | YES 98 | 99 | YES 100 | -1.CustomClassName 101 | -2.CustomClassName 102 | 6.IBEditorWindowLastContentRect 103 | 6.IBPluginDependency 104 | 105 | 106 | YES 107 | AROverlayViewController 108 | UIResponder 109 | {{239, 654}, {320, 480}} 110 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 111 | 112 | 113 | 114 | YES 115 | 116 | 117 | 118 | 119 | 120 | YES 121 | 122 | 123 | 124 | 125 | 7 126 | 127 | 128 | 129 | YES 130 | 131 | AROverlayViewController 132 | UIViewController 133 | 134 | IBProjectSource 135 | ./Classes/AROverlayViewController.h 136 | 137 | 138 | 139 | 140 | 0 141 | IBCocoaTouchFramework 142 | 143 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 144 | 145 | 146 | YES 147 | 3 148 | 300 149 | 150 | 151 | -------------------------------------------------------------------------------- /AROverlayExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /AROverlayExample/en.lproj/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1024 5 | 10J567 6 | 1305 7 | 1038.35 8 | 462.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 300 12 | 13 | 14 | YES 15 | IBUICustomObject 16 | IBUIWindow 17 | IBUIViewController 18 | IBProxyObject 19 | 20 | 21 | YES 22 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 23 | 24 | 25 | YES 26 | 27 | YES 28 | 29 | 30 | 31 | 32 | YES 33 | 34 | IBFilesOwner 35 | IBCocoaTouchFramework 36 | 37 | 38 | IBFirstResponder 39 | IBCocoaTouchFramework 40 | 41 | 42 | IBCocoaTouchFramework 43 | 44 | 45 | AROverlayViewController 46 | 47 | 1 48 | 1 49 | 50 | IBCocoaTouchFramework 51 | NO 52 | 53 | 54 | 55 | 292 56 | {320, 480} 57 | 58 | 59 | 60 | 61 | 1 62 | MSAxIDEAA 63 | 64 | NO 65 | NO 66 | IBCocoaTouchFramework 67 | YES 68 | 69 | 70 | 71 | 72 | YES 73 | 74 | 75 | delegate 76 | 77 | 78 | 79 | 19 80 | 81 | 82 | 83 | viewController 84 | 85 | 86 | 87 | 20 88 | 89 | 90 | 91 | window 92 | 93 | 94 | 95 | 21 96 | 97 | 98 | 99 | 100 | YES 101 | 102 | 0 103 | 104 | 105 | 106 | 107 | 108 | -1 109 | 110 | 111 | File's Owner 112 | 113 | 114 | 3 115 | 116 | 117 | App Delegate 118 | 119 | 120 | -2 121 | 122 | 123 | 124 | 125 | 10 126 | 127 | 128 | AR Overlay View Controller 129 | 130 | 131 | 12 132 | 133 | 134 | 135 | 136 | 137 | 138 | YES 139 | 140 | YES 141 | -1.CustomClassName 142 | -2.CustomClassName 143 | 10.CustomClassName 144 | 10.IBEditorWindowLastContentRect 145 | 10.IBPluginDependency 146 | 12.IBEditorWindowLastContentRect 147 | 12.IBPluginDependency 148 | 3.CustomClassName 149 | 3.IBPluginDependency 150 | 151 | 152 | YES 153 | UIApplication 154 | UIResponder 155 | AROverlayViewController 156 | {{234, 376}, {320, 480}} 157 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 158 | {{525, 346}, {320, 480}} 159 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 160 | AppDelegate 161 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 162 | 163 | 164 | 165 | YES 166 | 167 | 168 | 169 | 170 | 171 | YES 172 | 173 | 174 | 175 | 176 | 21 177 | 178 | 179 | 180 | YES 181 | 182 | AROverlayViewController 183 | UIViewController 184 | 185 | IBProjectSource 186 | ./Classes/AROverlayViewController.h 187 | 188 | 189 | 190 | AppDelegate 191 | NSObject 192 | 193 | YES 194 | 195 | YES 196 | viewController 197 | window 198 | 199 | 200 | YES 201 | AROverlayViewController 202 | UIWindow 203 | 204 | 205 | 206 | YES 207 | 208 | YES 209 | viewController 210 | window 211 | 212 | 213 | YES 214 | 215 | viewController 216 | AROverlayViewController 217 | 218 | 219 | window 220 | UIWindow 221 | 222 | 223 | 224 | 225 | IBProjectSource 226 | ./Classes/AppDelegate.h 227 | 228 | 229 | 230 | 231 | 0 232 | IBCocoaTouchFramework 233 | 234 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 235 | 236 | 237 | 238 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 239 | 240 | 241 | YES 242 | 3 243 | 300 244 | 245 | 246 | -------------------------------------------------------------------------------- /AROverlayExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AROverlayExample 4 | // 5 | // Created by Jason Job on 11-04-11. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /AROverlayExample/overlaygraphic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jj0b/AROverlayExample/6025424805f7390aee73a0bc8ed7015d525f9e22/AROverlayExample/overlaygraphic.png -------------------------------------------------------------------------------- /AROverlayExample/scanbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jj0b/AROverlayExample/6025424805f7390aee73a0bc8ed7015d525f9e22/AROverlayExample/scanbutton.png --------------------------------------------------------------------------------