Page 1 of 1

Pi cam with OpenCV

PostPosted: Sun Nov 23, 2014 2:04 pm
by ratronic
Hi Bill - I am not an expert on the subject but I have learned some things about using the Raspberry Pi camera module for use with a Propeller.

In the beginning on the Parallax forums I told you that the Pi camera had noise when using for video. I was getting a video picture but I found out from the version of OpenCV that is downloaded

easily using sudo apt-get is an earlier version which only puts out a 64 x 64 pixel array with the Pi cam. So it looked poor when stretched up to 110 x 80. Now I am using OpenCV 2.4.9 and it puts out whatever pixel size you setup.

I am currently using the uv4l-raspicam driver which can setup settings automatically with a configuration file at bootup.

The nice thing about the driver is it assigns ttyvideo0 to the Pi cam if a USB webcam is not plugged in at powerup. Otherwise it assigns ttyvideo0 to the webcam if plugged in. Maybe you already know about it or have a better one?

Re: Pi cam with OpenCV

PostPosted: Tue Nov 25, 2014 7:48 pm
by mikronauts

Thank you, I will check it out. Great timing on your part, Elf is about to get his Pi Camera (as soon as the camera brackets I ordered arrive, probably Thursday).

I added the link you sent! I'm going to try it ASAP, Elf needs it :) ... dventures/




Welcome to my little forum! I will try to keep the signal to noise ratio high :)

Re: Pi cam with OpenCV

PostPosted: Wed Nov 26, 2014 1:33 pm
by ratronic
Thanks for the welcome Bill. I have been using C++ on the Pi lately for OpenCV and serial comms to the Prop. I have a recent C++ program to do the frame processing and send out the serial object location/area data to the Prop.

It also display's frame rate, a picked variable and a small white square over the detected object on a small 110x80 video window. I also have another program I made with six trackbars and three 320 x 240 video windows I use to

experiment with. I know I'm a beginner to this stuff but if you are interested I can post them. Just don't laugh at my programming! It's just programs I put together from things found on the net.

Re: Pi cam with OpenCV

PostPosted: Fri Nov 28, 2014 2:33 pm
by mikronauts
Sounds interesting!

I'd like to see what you came up with, as would others I am sure.

Re: Pi cam with OpenCV

PostPosted: Fri Nov 28, 2014 5:46 pm
by ratronic
I am still hunting for the best way to track an object. The lgf.cpp currently is set to detect an orange object. It will show 2 windows. 1 for the masked object and 1 for the live video. The

live video window shows a small white square over the detected object and displays the FPS and detected object x screen location. The lgh.cpp I use to play around with and is setup with

trackbars to tweak your detected object colors/levels. I am using Opencv 2.4.9 and the latest wiringPi for serial. These both compile with no warnings finally.

This is the command I use to create the lgf program executable -- g++ -Wall -o lgf lgf.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc -lwiringPi .

I am still having problems getting a stable object area returned. Just a little change in the light causes the area to change.

Edit: files are in zip folder.

Re: Pi cam with OpenCV

PostPosted: Sat Nov 29, 2014 11:14 am
by mikronauts
Sounds good.

Sorry you are having trouble uploading attachments, I'll figure it out.

Re: Pi cam with OpenCV

PostPosted: Sat Nov 29, 2014 1:58 pm
by ratronic
It works!!!!!!!!

Re: Pi cam with OpenCV

PostPosted: Sun Nov 30, 2014 1:26 pm
by mikronauts

Thank you for finding the configuration issue - I really don't like some of the defaults that phpBB uses.

ratronic wrote:It works!!!!!!!!