Pi cam with OpenCV

Moderator: Steve

Pi cam with OpenCV

Postby ratronic » Sun Nov 23, 2014 2:04 pm

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 http://www.linux-projects.org/modules/sections/index.php?op=viewarticle&artid=14 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?
ratronic
 
Posts: 4
Joined: Sun Nov 23, 2014 11:31 am

Re: Pi cam with OpenCV

Postby mikronauts » Tue Nov 25, 2014 7:48 pm

Hi!

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 :)

http://www.mikronauts.com/raspberry-pi/ ... dventures/

Regards,

Bill

p.s.

Welcome to my little forum! I will try to keep the signal to noise ratio high :)
mikronauts
 
Posts: 119
Joined: Tue Sep 16, 2014 6:58 pm

Re: Pi cam with OpenCV

Postby ratronic » Wed Nov 26, 2014 1:33 pm

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.
ratronic
 
Posts: 4
Joined: Sun Nov 23, 2014 11:31 am

Re: Pi cam with OpenCV

Postby mikronauts » Fri Nov 28, 2014 2:33 pm

Sounds interesting!

I'd like to see what you came up with, as would others I am sure.
mikronauts
 
Posts: 119
Joined: Tue Sep 16, 2014 6:58 pm

Re: Pi cam with OpenCV

Postby ratronic » Fri Nov 28, 2014 5:46 pm

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.
Attachments
lgf&lgh.zip
(2.17 KiB) Downloaded 1387 times
Last edited by ratronic on Sat Nov 29, 2014 1:56 pm, edited 1 time in total.
ratronic
 
Posts: 4
Joined: Sun Nov 23, 2014 11:31 am

Re: Pi cam with OpenCV

Postby mikronauts » Sat Nov 29, 2014 11:14 am

Sounds good.

Sorry you are having trouble uploading attachments, I'll figure it out.
mikronauts
 
Posts: 119
Joined: Tue Sep 16, 2014 6:58 pm

Re: Pi cam with OpenCV

Postby ratronic » Sat Nov 29, 2014 1:58 pm

It works!!!!!!!!
ratronic
 
Posts: 4
Joined: Sun Nov 23, 2014 11:31 am

Re: Pi cam with OpenCV

Postby mikronauts » Sun Nov 30, 2014 1:26 pm

Great!

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

ratronic wrote:It works!!!!!!!!
mikronauts
 
Posts: 119
Joined: Tue Sep 16, 2014 6:58 pm


Return to Raspberry Pi Camera

Who is online

Users browsing this forum: No registered users and 1 guest

cron