Hi, fellow engineers,
I’d like to share the progress of my current project with OpenCR.
I started with writing my own bootloader and firmware based on original OpenCR from Eclipse IDE, but thought it might be more useful if this can be used on Arduino IDE.
Lighting up the 2.8" Arduino TFT-LCD was a piece of cake with given example from Arduino.
However, this was my first experience working with any kind of camera so I was a little excited and nervous at the same time.
The OpenCR had very limited available GPIO pin for OV7725 and I wasn’t able to use MCO pins for CMOS clock.
So I decided to accept my coworker’s advice; use PWM from GPIO.
Bitbanging GPIO pin requires interrupt to generate exact frequency so I thought PWM would be a good approach.
Then, I googled for OV7725 examples and referred some of them to figure out how it works along with the datasheet from sparkfun.
Also AL422B datasheet was useful to figure out the read/write timing of FIFO memory.
It took a while to get this point.
The number on left bottom corner is the FPS but the actual value should be doubled, so I was getting around 7~8 FPS with 320x240 image.
Squeezed the size of image for smoother and faster image processing.
At this point, I was getting around 11~12 FPS without using SPI DMA, but when I use the DMA, the FPS bumped up to 15 FPS.
I set blue for detecting color and drew a blue star on a paper.
I used 5x5 pixel block and set the density to about 50% to figure out whether the desired color is dominating the block or not, therefore, if more than 13 pixels are blue, it’ll be detected as an object.
In this picture, I only set a single cell and shows the last object detected with its xy coordinate.
Increased more cells to detect(up to 30), and looks like below.
Later on, I restored original camera image and drew detected cells over it with highlighted cell(in red) that finds the center of the biggest object.
The image processing and object detection algorithm is written without referring other famous library like openCV(as this is my first time handling with camera and image), so it may have some pitfall that I didn’t expect, but I liked it because it only consumes a couple fps.
The FPS in this video is corrected and it shows around 10~11 fps after the processing.
I’ll keep working on it and probably will be able to track detected object with pan-tilt Dynamixel structure soon.
Please feel free to enlighten me to improve this example with your idea.
Once it is completed, I’ll add it with the next OpenCR firmware release.