Is it physically possible to have the iphone camera detect motion? If so, How do you do it?
Th开发者_开发问答anks!
You mean technically :) ? Physically it already does (in the sense of taping motion).
Technically you could use the interfaces defined in AVFoundation.framework
, create bitmaps from selected frames and compare them. Usually you would make the images monochromatic (or turn them into binary images, it depends on your actual project), and compare the pixels. If a particular amount of connected pixels has changed, there must have been motion.
You would convert the images color space to gray-scale to have a better performance when comparing. It depends again on your project how many shades of gray you need. The picky part is the comparing algorithm for sure. A naive method would be just to count the changed (connected) pixels (making the image gray-scale can save you a lot of false positives). You could also do a Binary Search
精彩评论