|
Forum Index : Microcontroller and PC projects : OV7670 camera with movement detection
| Author | Message | ||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10570 |
The MMX supports the OV7670 camera module but doesn't have enough memory to hold a memory image such that a new image can be compared to the stored one to look for movement. The STM32H743 running the Armmite firmware does (640x480x2 bytes): Watch the demo I'll post the new firmware on the Armmite thread when I have tidied it up. The birdsnest is impossible to tidy up The way the detection works is as follows: An image is captured from the camera in RGB565 and stored in memory . As the next image is read, both it and the stored image are converted to greyscale and the pixels compared. If the difference between the stored pixel and the new one is greater than a user settable parameter (sensitivity in the example program) then a count is incremented. Once the new image is complete the count of differences is returned to Basic and the user can then take an appropriate action. The resetcount parameter controls how often movement will trigger an action - in this case 3 compare cycles. In the demo the action is just to flash a red banner on the screen as I waggle a wire or my finger in front of the camera, but it could store the image to disk or sound an alarm etc. The Basic code is simplicity itself: dim integer resetcount=0 dim integer sensitivity = 7 dim pixels_affected=1000 Camera open Pause 5000 'allow time for AGC to work Camera capture Do a=MOVEMENT(sensitivity) If a > pixels_affected And resetcount=0 Then Box 0,0,MM.HRes,20,,RGB(red),RGB(red) resetcount =3 EndIf If resetcount<>0 Then resetcount=resetcount-1 Loop The time to read in an image and compare it with the stored version is approximately 250mSec |
||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1671 |
Hi Peter, very cool and useful. I'll try when I get my STM32H743 boards. Thanks a lot! Kind regards causality ≠ correlation ≠ coincidence |
||||
| PicFan Senior Member Joined: 18/03/2014 Location: AustriaPosts: 133 |
@matherp SUPER cool, very good job - thank you ! Wolfgang |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |