Home
携帯端末の画像処理による微小オブジェクトの追跡
Contents
1. 282 self showAlert roi Error 283 res spenttime cv getTickCount time f 284 res speed 0 0 285 return res 286 else 287 cv Mat dst_img frame 2 clone 288 Mat roi img dst img cv Rect roi_x roi y roi w h x y w h 289 290 291 cv cvtColor roi img roi img CV BGR2GRAY 292 threshold roi img roi img 10 255 cv THRESH_BINARY 293 294 cv erode roi img roi img cv Mat cv Point 1 1 2 295 dilate roi img cv Mat cv Point 1 1 2 296 erode img roi cv Mat cv Point 1 1 2 297 dilate roi img cv Mat cv Point 1 1 3 298 299 300 77 CV_RETR_EXTERNAL 301 77 _ _ 42 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 cv vector lt cv vector cv Point gt contours cv Mat contourlmage roi_img size CV 8U cv Scalar 255 cv findContours roi img contours CV RETR EXTERNAL CV CHAIN APPROX NONE std cout lt lt cout
2. 26 000000000 Android O 00000000000000 Speed 2 0 00 000 000000 00000000 000100 000 000 00 0000 0 00000000 000000000000 0000 0000 000 000 D DODO 00000 0 000 00 000 000 0 00 0 0 00000 000000 0 0 00000000000000000000000000000 2 7 iPhoneSG 0 0 0 O DODO 00000000 00000000 0000 00000000 0000 0 0 00000000000000000000000000000000000000 00000000 00000000000000000000000000000000 0 00000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 0000000000000000000000000000000000000 0000 31 0000000000 iPhoneSG 0000000000000 Apple 00 iMac 3 5GHz 12GB 000 3100000000 O 3 1 0000000000000 Xcode 6 0 1 https developer apple com jp xcode downloads OpenCV 2 4 9 http opencv org CocoaPods http cocoapods org Xcode 1 0 00000000000000000000000000000 O MacOSX iPhone 0000 00000 00000 Xcode 0 Apple 0 0000000000000 00000 DD D 5 000000 OpenCV MacOSX O Windows Y
3. 000000000000000000000000000000000000 16810000000 20 0000000000000 D D D 000000000000000000000000000000 60 00000000000000000000000000 00000000 30m0 0 0002000000000000300000000000000000000000 00000000000000000000000000000000000000 00 000000000000000000000000000000000000 00000000000000000000000000000000000000 00000000000000000000000000000000000000 00000000000000000000000000000000000000 201311 00000 100kmh 0000000000000 0000000000000 oppo0000000000000 1000 98 48km hr 2000 93 69km h 400 76 60 0008000000000 00000000 0000000000000 00000000000000000000000000000000000000 HP 2 22 10500 520 000 I YUPITERU 102 600 BUSHNELL VI 20 475 0 00000000000000000000000000000000000000 000 22 DODO DO 0 00 0 00 0 00 0 0000 0 0 00 000 00 00 1510 000 2110000000000
4. 15 16 Override point for customization after application launch 17 UlApplication sharedApplication statusBarOrientation UllnterfaceOrientationLandscapeRight 18 return YES 19 1 20 21 void applicationWillResignActive UlApplication application 22 1 23 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 24 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 25 26 27 void applicationDidEnterBackground UlApplication application 28 29 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 30 your application supports background execution this method is called instead of applicationWillTerminate when the user quits 31 32 33 void applicationWillEnterForeground UlApplication application 34 35 Called as part of the transition from the background to the inactive state here you can
5. Ely Dump 1010 0000 14000 00 0 00000000 00000 00000001 000000 DODO DO 0 00 0 00000 00 0 00 0 0 000 00 000 0 0 0 00000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 0000000000000000000000000000000 23 0000000000000 0 00000 0 00 00000000 000100 0100 1 0000 00 0 000000000000000000000000000000000 1910 000 Apple Store 000 0160 0000000000000 00 00000 0 000000000000000000000000000000000000000 0 0000000000000000000000000000000000000 0 00000000000000000000000000000000000000 000000000000000000000 24 000000000000 00000000 9 00000000000000000000000000000 00000 1 0 1 44 0000000000 16000000000 160000 000000 5 00000000000000 04589 000000000000 0 00000000000000000000000000000000000000 0 0000000000006000 0 00000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 00000000000000000000000 25 0000000000000 Apple Store Easy 11111 00 0 0 0 00 0 00000 00000 0 0 00000000000000000000000000000000000000 0 0000000000000000000000000000000006000 0 000000000000000000000000000000000000000 0 0000000000000000000000000000000000 100km h 0 600 120 0 O 0 500 150kmh0 0 0 4000000000000000 00000000 0 100000000000000000000000000000
6. NSTimelnterval current NSDate date timelntervalSince1970 NSTimelnterval recorded current startTime if recorded gt 2 0 SVProgressHUD showWithStatus Detecting maskType SVProgressHUDMaskTypeGradient isNeededToSave YES self captureManager stopRecording self timer invalidate self timer nil change self recBtn setlmage self recStartlImage forState UlControlStateNormal self fpsControl enabled YES 1 self statusLabel text NSString stringWithFormat 2f recorded written by void showResult Result result NSString title NSString message title NSString stringWithFormat 5 3 0 km h 9e3 0f mph 5 0f ms result speed result speed 0 62137 result spenttime message nil 38 169 self showAlert title 170 171 172 173 pragma mark AVCaptureManagerDeleagte 174 175 void didFinishRecordingToOutputFileAtURL NSURL outputFileURL error NSError 176 if error 177 self showAlert URL_error 178 return 179 180 181 if lisNeededToSave 182 return 183 184 185 186 self saveRecordedFile outputFileURL 187 URL 188 NSString urlString outp
7. 0 0000000000000000000000000000 150 0 000000000003000000000000000 000000000 27 060 000 iPhones iPhoneSG O O O O 56 00000000 240 6 00000 6 iPhones i 300000000 0 0 00 000000 DU iPhonese 0 0 000000000000000000000000000000000000000 0 000000000000000000000000000 0000000000000000000000 1 0000000000000000000000000000 2 0000000000000 00000000000000000000000000000000 iPhoneSG 0 0 0000000 00000000000000000000000000000000 0 0000000000000000000000000000000 iPhoneSG 00000000000000000000000000000000 D uuu iPhonesG 0 Apple Store 0 00000000000 28 UD 1 Apple Apple https developer apple com xcode 2 Smart Tools co 00000 O speedgun https play google com store apps details id kr sira speed amp hl ja 3 Orta Therox Eloy Durn Fabio Pelosin and many others The CocoaPods Dev Team with contributions from many cocoapods
8. 2600 0000 270 20 190 111108121 Do UU 000000 000 0000000 3 2 3 3 O 40 4 1 4 2 Veal CR ET E RT gt gt a gt s RR ac 2 aes aaa 21 2227 ST ATEN ds mia al a eos ds AAA RE E e iPho eSG E o mI 45 Ve en cath Le diae o rie gts 0000 eS ES 3 1 2 0000870058 000000 A ss ate als huk k 82012262 z RRR nda aed S 120fps 240fps0 000 GRE AT EINE Gh ar cda ted ds don ATS mer n Lumia A a e SESS ARA MR 10 10 11 12 13 13 4 3 4 4 O 50 5 1 5 2 5 3 5 4 00A 2 221 3 MM salone o te n acid wr hy A29 DID saa rs o ws Say ead eA RAY Eee 000 Lr AppDe
9. 422 423 else 424 self captureManager resetFormat 425 426 427 dispatch_async dispatch_get_main_queue 4 428 429 if desiredFps gt 60 0 430 self outerlmageView image self outerlmage2 431 432 433 self outerlmageView image self outerlimagel 434 435 436 SVProgressHUD dismiss 437 438 439 1 440 441 442 46 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 ON O Q N A gt n N O O UlSlider Slider sender AVCaptureDevice videoCaptureDevice AVCaptureDevice defaultDeviceWithMediaType AVMediaTypeVideo NSError error nil if videoCaptureDevice lockForConfiguration amp error videoCaptureDevice rampToVideoZoomFactor _slider value UlSlider with Rate 5 0 videoCaptureDevice unlockForConfiguration else NSlog ERROR _PRETTY_FUNCTION__ error end A 3 AVCaptureManager AVCaptureManager h SlowMotionVideoRecorder https github com shu223 SlowMotionVideoRecorder Created by shuichi on 12 17 13 Copyright 2013 Shuichi Tsutsumi rights reserved MIT import lt Founda
10. 363 364 365 0 0 366 pragma mark IBAction 367 368 IBAction recButtonTapped id sender 369 370 REC START 371 if self captureManager isRecording 44 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 change self recBtn setlmage self recStoplmage forState UlControlStateNormal self fpsControl enabled NO timer start startTime NSDate date timelntervalSince1970 self timer NSTimer scheduledTimerWithTimelnterval 0 01 target self selector selector timerHandler userlnfo nil repeats YES self captureManager startRecording REC STOP else IBAction fpsChanged UlSegmentedControl sender Switch FPS CGFloat desiredFps 60 0 switch self fpsControl selectedSegmentindex case 0 default desiredFps break 60 0 case 1 desiredFps 120 0 break 45 407 2 408 desiredFps 240 0 409 410 break 411 412 413 fps desiredFps 414 SVProgressHUD showWithStatus Switching 415 maskType SVProgressHUDMaskTypeGradient 416 417 dispatch queue t queue dispatch get global queue DISPATCH QUEUE PRIORITY DEFAULT 0 418 dispatch async queue 419 420 if desiredFps gt 0 0 4 421 self captureManager switchFormatWithDesiredFPS desiredFps
11. 96 97 98 99 100 pragma mark Public 101 102 void toggleContentsGravity 103 104 if self previewLayer videoGravity isEqualToString AVLayerVideoGravityResizeAspectFill 4 105 106 self previewLayer videoGravity AVLayerVideoGravityResizeAspect 107 108 else 109 self previewLayer videoGravity AVLayerVideoGravityResizeAspectFill 110 111 112 51 113 void resetFormat 114 115 BOOL isRunning self captureSession isRunning 116 117 if isRunning 118 self captureSession stopRunning 119 120 121 AVCaptureDevice videoDevice AVCaptureDevice defaultDeviceWithMediaType AVMediaTypeVideo 122 videoDevice lockForConfiguration nil 123 videoDevice activeFormat self defaultFormat 124 videoDevice activeVideoMaxFrameDuration defaultVideoMaxFrameDuration 125 videoDevice unlockForConfiguration 126 127 if isRunning 128 self captureSession startRunning 1 129 130 131 132 void switchFormatWithDesiredFPS CGFloat desiredFPS 133 4 134 BOOL isRunning self captureSession isRunning 135 136 if isRunning self captureSession stopRunning 137 138 AVCaptureDevice videoDevice AVCaptureDevice defaultDeviceWithMediaType AVMediaTypeVideo 139 AVCaptureDeviceFormat selectedFormat nil 140 17132 t maxWidth 0 141 AVFrameRateRange frameRateRange nil 142 143 for AVCaptureDeviceFormat format in video
12. NSLog Video input creation failed return nil if self captureSession canAddInput videoln NSLog Video input add to session failed return nil self captureSession addlnput videoln save the default format self defaultFormat videoDevice activeFormat defaultVideoMaxFrameDuration videoDevice activeVideoMaxFrameDuration AVCaptureDevice audioDevice AVCaptureDevice defaultDeviceWithMediaType AVMediaTypeAudio AVCaptureDevicelnput audioln AVCaptureDevicelnput devicelnputWithDevice audioDevice error amp error self captureSession addlnput audioln self file Output AVCaptureMovieFileOutput alloc init self captureSession addOutput self file Output 50 86 self previewLayer AVCaptureVideoPreviewLayer alloc initWithSession self captureSession 87 self previewLayer frame previewView bounds 88 self previewLayer contentsGravity kCAGravityResizeAspectFill 89 self previewLayer videoGravity AVLayerVideoGravityResizeAspectFill 90 previewView layer insertSublayer self previewLayer atindex 0 91 self previewLayer connection setVideoOrientation AVCaptureVideoOrientationLandscapeRight 92 self captureSession startRunning 1 93 94 return self 95
13. book mynavi jp support pc opencv2 19 0000 0000 0000 000 0000 000 0000 0000000 00000000000000 00000 0 470 0 10 41 51 2002 20 0000 0000 0000 0000 000000000000000 000 00000 3 1 7 2006 21 0000 000 00000000000000000000000000000 0000000000 20100 000000000000000000 0000 0000000 0 62000 149 2011 30 ON O 0d Q N 2 O 62 OQ Q Q N N O O A 1 Appendix AppDelegate AppDelegate h SlowMotionVideoRecorder Created by shuichi on 12 17 13 Copyright c 2013 Shuichi Tsutsumi All rights reserved MIT import lt UIKit UIKit h gt interface AppDelegate UlResponder UlApplicationDelegate property strong nonatomic UlWindow window end AppDelegate m SlowMotionVideoRecorder Created by shuichi on 12 17 13 Copyright 2013 Shuichi Tsutsumi rights reserved MIT import AppDelegate h implementation AppDelegate 31 13 14 BOOL application UlApplication application didFinishLaunchingWithOptions NSDictionary launchOptions
14. 000000000000000000000000000000000000000 0000000000000 150 0 40 000 100km00 0 60 000000 0 00000000000000000000010000000000000000 000000000000000000000000000000000000000 0 00000000000000000000 200000000000000000 000000000000000000000000000000000000000 52 0000 00 1201251 240 0000 10000000000 0 000000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0000000000000 00000 00000000000 00000000000 100000000000000 000000000000000000000000000000000000000 00000000000 53 00000 0 00000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 0000000000000000000000000000000000000 0 0000000000000000000000000000000000000 000000000000000000000000000000000000000 000000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 0000000000000000000 0000000000000000 0 00000000000000 25 54 DOOM 0 000 5 10 5 20000 5 1 600000000000 24030 iPhoneSG km h iPhoneSG ms Mac km h 81 51489 81 98 71 36027 71 78 68 36037 68 06 109 9092 108 72 100 10054 98 55 91 35052 92 08 93 23429 92 08 71 8064 72
15. 1 O O O 0000000 CocoaPods 0 00 00 CocoaPods 000000000 Ruby 0000000000000 uuu sudo gem install cocoapods pod setup OOOO 0 0000000000 CocoaPods 0 O iPhone 00000000000 OpencVOOOOOOOO 0000000060000 1 Xcode 1 58000000000 2 Xcode lI LI 00 0000 00 0 000 000 0 0 00000 000 000 0000 5 00000000 install 0 0 J 6 Xcode xcworkspace 0000000 N 000000000000000 mig mmi D D 12 0000 050000000000000 32 00000000000 iPhoneSG 00 00 0 Shuichi Tsutsumi OOOO SlowMotionVideoRecorder 9 00000000 sliewMotionVideoRecorder 0000000000 00000000 O 000000000 000000 60 120fs 0 0000000 3015 000000 33 iPhoneSG 000000000 iPhonee O00 20150 100000000000000000 17 100000000000000 O 00000 50 0000000000000 00 iPhones 20140 0 000000000 000000000000000000000000000 iPhones 0000000800000 32 0 00000000000000 410000000 2000000000000 00000 D iPhoness Android 0 0 Xperia 230 0000000000000 000 O 3 2 iPhone6 55 Xperia 73000 0000 00000 iPhone6 iPhone5s Xperia Z3 CPU 1 4GHz 1 3
16. undo many of the changes made on 32 36 37 38 39 40 41 42 43 44 45 46 47 48 N O Q N Lo 2 0 15 16 entering the background void applicationDidBecomeActive UlApplication application 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 void applicationWillTerminate UlApplication application Called when the application is about to terminate Save data if appropriate See also applicationDidEnterBackground end A 2 ViewController ViewController h SlowMotionVideoRecorder Created by shuichi on 12 17 13 Copyright c 2013 Shuichi Tsutsumi All rights reserved MIT import lt UIKit UIKit h gt import lt AVFoundation AVFoundation h gt interface ViewController UlViewController gt AVCaptureVideoDataOutputSampleBufferDelegate gt property strong nonatomic AVCaptureDevicelnput videolnput property strong nonatomic AVCaptureVideoDataOutput 33 17 18 19 20 ON O N GO G N IO N D IO IO IO DD a oc N O O O GQ DAN O ARO N O videoDataOutput property strong nonatom
17. 0 0000000000000000000 00000000000000 1210000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 0 0 00000 00 00000000000000000000000000 000000 1000 000000 000000 00 10000000000000000 0000000000 000000000000 00000000000000000000000002 00000000 0 DO 0 00 000 00 00 0 0 00 0 0 0 000000 000000 0 00000000000000000000000000 2 12 18 44 20 0 000000000000000000000000000000000000 4 7 50 00000 48000000000000000 000000000000000000000000000000000000000 0 000000000000000000000000000000000000000 4 7 000000000 00 00 00 a 8 2 2 2 2 S O 4 8 iPhoneSG 00000 21 00000000000000 490 DODODO 0 000 00000 00 0 00 0 0 0 000 0 000000 000000000000000000000000000000000000000 0000000000000 0 00000000000000000 4 90 000000000 0 000000000000000000010000000 0000000000 4 90 900000000000000 100000000000000000000000000 0 0000000000000000000000 10000000000000 0 0002000000000 300
18. 0 0 000 00000000 2550 0000000000000000 0 0000000000000000000000000000 2550 0000000 0 0000090000000000000000000000000 45000000 po 20000000000 U 4 5 0000000000 4 2 3 OOO 00000000 0 00 00000 000000 00000000 100 00 000000 18 00 0000 00000 000000 00 00000000000000000000000000000000000000 00000000000000000000000000000000000000 00000000000000000000000000000000000000 000000000000000000000 100000000000000000000000000000000 OU 0 00000000000000000000000000000000000000 OU OU OO 200000000000 3000000000000000000 4500 4600000000000 00000000000 20000000000000000000000000000000003 00000000000000000000000010000000000000 0 00000000000000000000000000000000000000 0 00000000000000000000000000000000000000 4 600000000000000000 U 4 6 0000000000 19 424 0000 0 0000000000000000000000000000000000000 43 00000000
19. 000000 60fps 000000 iPhones 000000 1920x1080 0500000000000 00000 1201 240105 1280x720 00 000000000000 00000000 00000000000000000000000000000000000000 50 00000000000000000000 00000000000 60 000000000000000000000000 00000000000000000000000000000 42 000000000 00000 iPhonesG 1000000000000000000000000000 000000000000 6 000000000000 240131 12050 J 200000000000000000000000 Open Va pogo 00000 000000 16 421 0000000000000 12031 iphones 000000000000000000000000000000000 mp4 000000 iPhone 000000 m400000000 0 000000000000000000000000000 U 4 2 000000000 422 0000 0 00000000000000000000000000000000000000 UOUOU0O00000000000000000000000000000000 0 000000000000000000000000000000 4 30 4 4000 2000000000000000000000000000000000 000 0 000 0 0 0000000000000000000000000 0 000000000000000000000000000000 0 0000000000000000000000 000000 000000000 17 U 4 3 00000000 D 4 4 000000 200000000000000000000000000 0 00000 0 0 0000 0 0 0 000 0
20. 0000000000000000000000 Ooo 60 00000000 1201 00 200 240 00 40000000000 0 00000000000000000000000 iPhoneesG 0000000000000000000000 p00000000000000000 60131 120fpsq 24051 100000000 0 00000000000000000000000000000000000000 0 00000000000000000000000000000000 4 10000 4 1 00000000000 60fps 120fps 240fps 29 30 31 59 60 61 119 120 121 km h 137 3 132 8 128 5 135 0 132 8 130 6 133 9 132 8 131 7 0 4140000000060 s000000000000000 10000000 Skmh 000000 10000000 2 3km h 8 OO kmapoo0000000000060pbs000000 0 15 412 0000060 0 0000000000000000000000000000000000000 00000000000000000000000000000000000000 0 000000000000000000000000000000000000601 000000000000000000000000000000000000000 0 0000000000000000000000000000000000 12080 2406 0 000000000 60125 000000000200 400000000 602 00000000 40 0000000000000 00000000000 120125 200000 240 8 00 10000000000 4 1 3 00000 iPhones 0000000 00000000 60125 00000000 86 0 00000000000
21. 000000000000000000000000 iPhone 20140 2 iPhone 53 52 200 Xperia 2 89 U iPhones 0 0000000000000000000 0 00000000000000000000 00000000 iPhone 00000000000 1200000000002 e 120km h 150kmM h 0000000000 0000000000000 0000 0 DO 000 00 00 000 00000 000000 00000000 0 0 0000000000000000000000000000000000000000 2 12 12 20 0 00000000000000000000000000000000000 21 0000000000000000000
22. 00001000 200000000000 0000000000000 490 400000000000000000000 0 00000000000000000000000 1200000000000 0 00000000000000000000000000000000000 0 0000000000000000000000000 E EB CE 0 0 O 0 0 0 0 0 O 44 00000 4 21 430 08000000000000 000000000 00000000000 DODO 00000 0 00000 00000 000000 0000000000000 0 Distance Count Framerate 00000000 LU velocity O km h Distance 0 O O Framerate 000 OO0 CounttGO0O000000000000 Verocity x 3 6 4 1 22 1 8 4 9 00000000c00000000C0100000000c0200000 OO U30000000000 050 00000 iPhoneSG 00 D 0 0000000000000000000000000000 iPhonespg00000 0000 51 000000000000 iPhoneSG 0 0 12075 0 2 0000 00000 00000 0 00 0 0 HU 000 5 100 0 5 1 000000000 24 0 000 00000000 0 0 0 00 0000 00 00 1 00 00 2000000000000 0
23. 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 property nonatomic strong property nonatomic strong property nonatomic strong property nonatomic previewLayer CMTime defaultVideoMaxFrameDuration end strong AVCaptureSession captureSession AVCaptureMovieFileOutput fileOutput AVCaptureDeviceFormat defaultFormat 2 ww wa WH AVCaptureVideoPreviewLayer implementation AVCaptureManager Ullmage Ullmage Mat Mat cv int int int int int int int int int int int int image nil image2 nil src 5702 cnt 0 ball_cnt 0 unditect_cnt 0 ditect_flag 0 direction_x 0 direction y direction_x2 direction_y2 0 0 480 360 47 id initWithPreviewView UlView previewView 48 49 50 51 52 53 self super init if self 4 NSError error 49 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 self captureSession AVCaptureSession alloc init self captureSession sessionPreset AVCaptureSessionPresetIinputPriority AVCaptureDevice videoDevice AVCaptureDevice defaultDeviceWithMediaType AVMediaTypeVideo AVCaptureDevicelnput videoln AVCaptureDevicelnput devicelnputWithDevice videoDevice error amp error if error 4
24. 50 104 21102 102 73 112 17698 113 07 5 2 000000000000 12080 iPhoneSG km h iPhoneSG ms Mac km h 4924 74 88 59 4226 59 74 76 3079 76 93 78 4004 79 10 69 3723 72 94 82 3459 80 23 48 4003 46 41 79 2874 75 89 75 3491 75 89 47 4246 45 66 iPhonesG 0 5 30 5 40 240 6 094 0000 00000000 8 51 00000 00000 00000 1200000 00000000000 12025000 5000000000000000000000 0000000000 000000000 120 000000000000000000000000000000000 240fps 9 0 000000000000000000000000000000000 0 000000000000000000000000 000000 100000000000000000000000000 26 53000000000000 24080 km h ms km h ms 0 94 24804 1 5 51489 12050 5 4 000000000000 km h ms km h ms 1 56 3802 3 94 4924
25. Device formats 144 145 for AVFrameRateRange range in format videoSupportedFrameRateRanges 146 52 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 CMFormatDescriptionRef desc format formatDescription CMVideoDimensions dimensions CMVideoFormatDescriptionGetDimensions desc 11132 1 width dimensions width if range minFrameRate lt desiredFPS amp amp desiredFPS lt range maxFrameRate 88 width gt maxWidth selectedFormat format frameRateRange range maxWidth width selectedFormat 4 videoDevice lockForConfiguration nil NSLog selected format 9 9 selectedFormat videoDevice activeFormat selectedFormat videoDevice activeVideoMinFrameDuration CMTimeMake 1 int32 t desiredFPS videoDevice activeVideoMaxFrameDuration CMTimeMake 1 10132 t desiredFPS videoDevice unlockForConfiguration isRunning self captureSession startRunning void startRecording NSDateFormatter formatter NSDateFormatter alloc init formatter setDateFormat yyyy MM dd HH mm ss NSString dateTimePrefix formatter stringFromDate NSDate date 53 180 181 int fileNamePostfix 0 182 NSArray paths NSSearchPathForDirectoriesInDomains NSDocumentDirectory NSUserDomainMask YES 183 NSString d
26. GHz 2 5GHz 1GB 1GB 3GB 1080p 60fps 1080p 30fps 1080p 30fps 720p 240fps 720p 120fps 720p 120fps 0 00000000 000000000000000 0000 0000 00 iPhones0 24080 0000 00000000000 000000000 5 0000000000 00000 13 040 00000000000000 0 00000000000000000000000000000000000000 0 00000000000000000 1200000000000000000000 50 000 0000 0000 00 00000000 000 iPhoneSG 4 10000 PERE O 0 L RR ARH NOES FA 4 1 iPhoneSG 06000000000 41 0000000 120tps 240fpso 000 120fpsq 240 50 2010000000000000000000 0000 200000000000000000000000000000000000 0 00000000000000000000000000000000000000 14 OO 120fpsq 2400 0000000000000 00 6 0 00000000 iPhones 0 0 0000000000000000 30fps 6012 0 00000000000000000000000000000000000 12080 24 000000000000000 iPhone6 0000000 12001 240 6 0000 00000000000000 00000000 00000 000000 00000 411 00000 0000000000000000
27. Linux 0000000 18 lU Xcode 000 00 Objective C OpenCV I J 0000 0000000000 0 iPhone 00000000000 00000000000 CocoaPods 3 Objective C 00000 OpenCV 00000000000 00000000000000 CocoaPoas rn n Hd D D O D U U Xcode OpenCV CocoaPods 0000000000000 DO DO tut OOOO iPhonegOOOOOOOOOOOO 000000 Apple 0 DO DO 10 3 1 iPhoneSGQ 0 000000000 Cocoa Touch OpenCVOOO00000 1 MacOSX 0 0 0000000000000 2 00000 0 0000000000000000 3 0000000000 iPhone I 000 3 1 1 OpenCV0 000000 OpenCVOOOOOO0U000SXG 000000000000 MacPorts 8 0 0 0 000 Opencv 0 000000000000000000000000000000000 s port info opencv 0 0000000000000000000 0 0000000000000 0 00000000000000000000 11 s sudo port install plgconfig zlib O 0000000000 00 OpencVOOOO 0 00000000000000000 s sudo port install opencv 000 00000000000 3 1 2 CocoaPods 000000 iPhone 00000000000 OpenCV J 00 Objective C
28. ame 2 cnt 2 yelse if cnt 2 0 capture frame 0 if frame 0 empty 40 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 std cout lt lt Frame1Message gt End of sequence 1 std endl break 2 1 clone frame 2 2frame 2 frame 0 showlmage 1 cnt jelse capture gt gt frame 1 if frame 1 empty std cout lt lt Frame2Message gt End of sequence 2 std endl break frame 2 frame 0 clone frame 2 frame 2 frame 1 showlmage 0 cnt float roi_x 0 0 float roi_y 0 0 float roi_w 0 0 float roi_h 0 0 if ball_cnt lt 1 roi_x 1000 0 roi_y 140 0 roi_w 100 0 300 0 else roi x prev dif_x 50 0 roi y prev y 50 0 roi w 100 0 roi h 100 0 41 276 ball_cnt gt 10 88 lt 170 4 277 res speed interval fps 3 6 ball cnt 278 res spenttime cv getTickCount time f 279 return res 280 281 if 0 lt 88 0 lt amp amp roi x lt showlmage cols 88 0 lt roi y 88 0 lt roi h 48 roi y roi_h lt showlmage rows
29. http cocoapods org 4 GSMARENA Gsmarena com gsm phone reviews news opinions votes man uals and more http www gsmarena com 5 Intel and Willow Garage Opencv http opencv org 6 KEINS O https itunes apple com jp app id639458550 7 opencv dev team Opencv 2 4 9 0 documentation http docs opencv org genindex html 8 The MacPorts Project macports http www macports org 9 shuichi0526 2gmail com Slow motion video recorder for ios https github com shu223 SlowMotionVideoRecorder 10 Christian Theobalt Irene Albrecht Jrg Haber Marcus Magnor and Hans Peter Seidel Pitching a baseball tracking high speed motion with multi exposure im ages ACM Transactions on Graphics pp 540 547 4 11 uenoma Easy speedgun https itunes apple com jp app easy speedgun id451039156 29 12 0 000000000000000000000000 00000000 http asaka aba net kisoku html 131000 Hp 2 0 0000 http www mizuno co jp customer pdf 2zm 1050 pdf 1410000 0000 000 0000 00000 000 000 000 0 00000 000000 00000000000 0 62000 149 2011 1510000 0000000000000 Studies in health and sports science O 0 pp 10 24 1999 161 0000 0000 000 0000 0000 000 000000000000 0 00 000000000000000000000000 00000 vol 59 pp 189 201 2014 17 0000000000 0000000000000000 0 10 0 00000 0000 http webrage jp mobile data sp_share html 18 00000000 0penev2p 0000800000 0000000 http
30. ic AVCaptureSession session IBAction setZoom id sender end 77 ViewController mm SlowMotionVideoRecorder Created by shuichi on 12 17 13 Copyright c 2013 Shuichi Tsutsumi All rights reserved MIT import ViewController h import SVProgressHUD h import AVCaptureManager h import lt AssetsLibrary AssetsLibrary h gt import lt ios h gt import lt opencv2 opencv hpp gt interface ViewController lt AVCaptureManagerDelegate gt NSTimelnterval startTime BOOL isNeededToSave property nonatomic strong AVCaptureManager captureManager property nonatomic assign NSTimer timer property nonatomic strong Ullmage recStartlmage property nonatomic strong Ullmage recStoplmage property nonatomic strong Ullmage outerlmagel property nonatomic strong Ullmage outerlmage2 property nonatomic weak IBOutlet UlLabel statusLabel property nonatomic weak IBOutlet UlSegmentedControl fpsControl property nonatomic weak IBOutlet UlButton property nonatomic weak IBOutlet UllmageView outerlmageView 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 nonatomic BOOL enablesVideoStabilizatio
31. iew image self outerlmage1 92 self captureManager switchFormatWithDesiredFPS 60 0 FPS 93 1 94 95 96 void didReceiveMemoryWarning 97 4 98 self showAlert didReceiveMemoryWarning warn 99 super didReceiveMemoryWarning 100 1 101 102 103 36 104 mark Gesture Handler 105 106 void handleDoubleTap UlTapGestureRecognizer 107 108 self captureManager toggleContentsGravity 109 110 111 112 113 Hpragma mark Private 114 115 116 void saveRecordedFile NSURL recordedFile 117 118 SVProgressHUD showWithStatus O saveRecordedFile 119 maskType SVProgressHUDMaskTypeGradient 120 121 dispatch_queue_t queue dispatch_get_global_queue DISPATCH QUEUE PRIORITY DEFAULT 0 122 dispatch async queue 123 ALAssetsLibrary assetLibrary ALAssetsLibrary alloc init 124 assetLibrary writeVideoAtPathToSavedPhotosAlbum recordedFile 125 completionBlock 126 NSURL assetURL NSError error 4 127 dispatch async dispatch get main queue 128 129 SVProgressHUD dismiss 130 131 11 132 133 134 135 136 37 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 pragma mark Timer Handler 5
32. legate u ur grt Ton Shi ges SUS esla w sos 9 EN ce ione Ce 4 AVCaptureManager 24 24 25 25 26 28 Q 0 11 0000 iPhones 0 000000000000000000000 0 00000000000000000000000000000000000000 150kmh 0000000000000000000000000000000000 0000000000000 0 4 000000000000000000000000 000000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0000000 0 0000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 000000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 0000000000000000000000000000000 00000000000000000000000000000000000000 0 00000000000000000000000000000000000000 0 iPhone 00000000000 iPhone6 0000000000 240fps0 000 00000000000 000 iPhone 60000000
33. nWhenAvailable end implementation ViewController CGFloat fps 60 0 CGFloat speed2 0 0 CGFloat prev_x 0 0 CGFloat prev y 0 0 CGFloat dif x 0 0 CGFloat dif_y 0 0 CGFloat kakattajikan 0 0 int lost ball 0 CGFloat min dif x 10 0 BOOL OSX true typedef struct float speed float spenttime Result void showAlert NSString msg UlAlertView alloc initWithTitle msg message nil delegate nil cancelButtonTitle otherButtonTitles nil show void viewDidLoad super viewDidLoad 35 72 self captureManager AVCaptureManager alloc initWithPreviewView self view 73 self captureManager delegate self 74 75 76 Ullmage image 77 image Ullmage imageNamed ShutterButtonStart 78 self recStartimage image imageWithRenderingMode UllmageRenderingModeAlwaysTemplate 79 self recBtn 5 80 forState UIControlStateNormal 81 82 image Ullmage imageNamed ShutterButtonStop 83 self recStoplmage image imageWithRenderingMode UllmageRenderingModeAlwaysTemplate 4 85 self recBtn setTintColor UlColor colorWithRed 245 255 86 green 51 255 87 blue 51 255 88 alpha 1 0 89 self outerlmage1 Ullmage imageNamed outer1 90 self outerlmage2 Ullmage imageNamed outer2 91 self outerlmageV
34. ocumentsDirectory paths objectAtIndex 0 184 NSString filePath nil 185 do 186 filePath NSString stringWithFormat Y i mp4 documentsDirectory dateTimePrefix fileNamePostfix 187 while NSFileManager defaultManager fileExistsAtPath filePath 1 188 189 NSURL fileURL NSURL URLWithString Q file stringByAppendingString filePath 190 self fileOutput startRecordingToOutputFileURL file URL recordingDelegate self 191 192 193 void stopRecording 4 194 195 self fileOutput stopRecording 196 1 197 198 199 200 201 mark AVCaptureFileOutputRecordingDelegate 202 203 void captureOutput AVCaptureFileOutput captureOutput 204 didStartRecordingToOutputFileAtURL NSURL fileURL 205 fromConnections NSArray connections 206 207 _isRecording YES 208 NSLog started 209 54 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 void captureOutput AVCaptureFileOutput captureOutput didFinishRecordingToOutputFileAtURL NSURL outputFileURL end fromConnections NSArray connections error NSError gt error isRecording NO NSLog Q finished NSString urlString outputFileURL absoluteString NSString movieURL urlString substringFromlIndex 8 NSLog movieURL if self delegate re
35. ours size contours size std endl if contours size 0 88 ball_cnt gt 2 prev_x prev min dif x dif x min dif x ball cnt if ball error lt 100 ball error else res spenttime cv getTickCount time f res speed 0 0 return res self showAlert too _many_ball_error res spenttime cv getTickCount time res speed 0 0 return res for int i 0 i lt contours size i size_t count contours i size if count lt 10 count gt 70 continue cv Point2d point cv Moments mom cv moments contours i point x mom m10 mom m00 point y mom m01 mom m00 y if ball_cnt lt 2 43 336 dif_x 337 1 338 dif x prev point x 339 340 prev_x point x 341 prev_y point y 342 343 ball cnt 344 NSLog ball_cnt d 345 346 347 348 lost_ball ball_error 349 350 self showAlert O Finish the ditection 351 res spenttime cv getTickCount time f 352 res speed interval fps 3 6 ball cnt 353 return res 354 jelse 355 self showAlert O Failed to open 356 357 self showAlert finish the loop 358 res spenttime cv getTickCount time f 359 res speed 0 0 360 return res 361 362
36. spondsToSelector Qselector didFinishRecordingToOutputFileAtURL error 4 self delegate didFinishRecordingToOutputFileAtURL outputFileURL error error 55
37. tion Foundation lt import lt AVFoundation AVFoundation h gt 47 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ON O Q N pot 2 O O won protocol AVCaptureManagerDelegate lt NSObject gt void didFinishRecordingToOutputFileAtURL NSURL outputFileURL error NSError error end interface AVCaptureManager NSObject property nonatomic assign id lt AVCaptureManagerDelegate gt delegate property strong nonatomic AVCaptureVideoDataOutput videoDataOutput property nonatomic readonly BOOL isRecording id initWithPreviewView UlView previewView void toggleContentsGravity void void void void end resetFormat switchFormatWithDesiredFPS CGFloat desiredFPS startRecording Ww WH stopRecording AVCaptureManager m SlowMotionVideoRecorder https github com shu223 SlowMotionVideoRecorder Created by shuichi on 12 17 13 Copyright c 2013 Shuichi Tsutsumi rights reserved MIT import AVCaptureManager h import lt AVFoundation AVFoundation h gt import lt ios h gt import lt opencv2 opencv hpp gt interface AVCaptureManager lt AVCaptureFileOutputRecordingDelegate gt 48 17 18 19 20 21 22
38. utFileURL 5 189 NSString movieURL urlString substringFromlIndex 8 190 191 self showResult self BallDitectFromMovie movieURL 192 193 1 194 195 ball_ditect 196 Result BallDitectFromMovie NSString movieURL 197 Result res 198 199 double f 1000 0 cv getTickFrequency 200 int64 time cv getTickCount 201 int ball cnt 20 202 int cnt 20 203 int ball_error 0 39 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 float interval pitch float interval interval pitch 830 1280 SVProgressHUD showWithStatus BallDitectFromMovie maskType SVProgressHUDMaskTypeGradient cv VideoCapture capture if capture open std string movieURL UTF8String Mat frame 3 cv Mat dst img for int 1 0 i lt 50 i capture gt gt dst img while 1 cv Mat showlmage if cnt 0 capture gt gt frame 0 if frame 0 empty std cout lt lt Frame1Message gt End of sequence 0 std endl break capture gt gt frame 1 if frame 1 empty std cout lt lt Frame1Message gt End of sequence 1 std endl break frame 2 frame 0 clone frame 2 frame 2 frame 1 showlmage fr
Download Pdf Manuals
Related Search
Related Contents
Copyright © All rights reserved.
Failed to retrieve file