Raspberry Pi, Pi Camera, OpenCV 3.1.0, MRL

 
As a proof of concept I wanted to see how the Raspberry Pi Zero would hold up to be used to control the Pi camera for the eye of my InMoov along with the head and eye servos
 
I have OpenCV 3.1.0 compiled on the latest Jessie OS build on the Pi Zero with the latest MRL build (v 1.0.1852) also running on the Zero
 
I'm seeing around 7 to10 fps at 320x240 with the PyramidDown filter
 
The cpu on the Zero gets maxed out. I somehow expected that though :)
 
Hi Mats, thanks for the guidance on the MRL startup parameters :)
 
Video: https://youtu.be/CzX0mbc6jd4
 
 
GroG's picture

Hi Acapulco Rolf, Thanks for

Hi Acapulco Rolf,

Thanks for posting - appreciate the video.. 
As they say a picture is worth 1000 words - so Video is worth 30 fps X time = words  :)

I'm glad your getting a video feed, but why is there ~20 mrl instances with different pids ?
We can begin looking into optimizing speed, but I would start by getting resources back (like memory) - which means killing 19 zombies to begin with..

Cheers,
GroG

kyle.clinton's picture

Great video

I hope that you also post the steps that you went through.  Also have you tried to bring in video from a USB camera? I think there must be something that is required to get the USB camera to be recognized that is keeping me from working right now...

 

 

 

 

Acapulco Rolf's picture

OpenCV

Hi Kyle,
 
For information, I'm using a Raspberry Pi camera module attached to the Pi
 
For the challenges that you're facing compiling OpenCV on the Raspberry Pi, follow these steps:
 
These are the steps that I followed to get OpenCV 3.1.0 compiled and installed on the Pi:
 
Follow the instructions here to the letter, choose the article that fits your use case:
 
http://www.pyimagesearch.com/2015/10/26/how-to-install-opencv-3-on-raspbian-jessie/
http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/
http://www.pyimagesearch.com/2015/02/23/install-opencv-and-python-on-your-raspberry-pi-2-and-b/
 
Work your way through each step to the letter
Now, when you get to the step where you run cmake, examine the outcomes of the cmake command
 
I ran the following on the cmake log file to check for fatal errors
 
cat /home/pi/opencv-3.1.0/build/CMakeFiles/CMakeError.log | grep fatal
 
If you do not have any cmake errors then run the make command as per the intructions 
 
Once you've got OpenCV built and then installed, then work the example that is linked
in the same article to confirm that you have a successful build
 
Posts that I used to troubleshoot and resolve specific cmake errors that I encountered are linked below
They may or may not be relavent in your case, but sharing here for reference
 
http://raspberrypi.stackexchange.com/questions/42283/cant-compile-opencv-3-1-on-raspberry-pi-missing-videoio-h-videodev-h
 
https://github.com/opencv/opencv/issues/6262
 
 
In terms of getting a usb web cam working, take a look here then check in with the guys in the thread:
 
http://myrobotlab.org/content/raspi-2-opencv-howto-solved
 
 
Hope this helps
Acapulco Rolf's picture

Raspberry Pi 3, MyRobotLab, OpenCV 3.1.0, USB webcams

 

Hi Kyle

By way of a demonstration, I've attached three cameras to my Raspberry Pi (3)

 
The cameras are:
1.Raspberry Pi Camera
2.Logitech C920 webcam (USB)
3.Logitech 4000 Pro webcam (USB)
 
The three cameras all show video output in the MyRobotLab OpenCV video widget as expected
 
Video: 
https://youtube.com/quIUg1QYjqk
 
Which USB web camera do you have?
Check here for your web cam's compatibility with the Raspberry Pi
 
http://elinux.org/RPi_USB_Webcams
 
Hope this helps

 

kyle.clinton's picture

Thanks for the update

Rolf,

I will take another look to make sure I have opencv loaded properly. Then I will go through the tutorial. I have the MS LifeCam HD 3000 and it is on the list.

Thanks Again!

Acapulco Rolf's picture

MS LifeCam HD 3000, OpenCV 3.x MRL OpenCV video widget

Hi Kyle, yes that particular usb webcam appears to have been confirmed to work with the Pi according to the wikipage

For a usb webcam-Pi setup, use these Python/OpenCV tutorial and demos to prove your installation and setup before you tackle MRL

It's a three part series. Well worth walking through it end to end:

1

http://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-pytho...

2

http://www.pyimagesearch.com/2015/12/28/increasing-raspberry-pi-fps-with...

3

http://www.pyimagesearch.com/2016/01/04/unifying-picamera-and-cv2-videoc...

 

Chime back in when you've had a chance to do some tests :)

 

kyle.clinton's picture

OpenCV 3.1.0, PI 3, MS LiveCam HD 3000, but not in MRL

So I followed the step by step tutorial on installing OpenCV 3.1.0 on the PI.  Which was awesome, good detail and seems to all worky.  I then am able to see my USB cam on the PI and installed fswebcam or something like that and was able to take a photo with the cam. Woohoo!  

Next, I am sure I jumped a bunch of steps and tries opening MRL and connecting OpenCV from a little Python script... and No Worky.  Then I decided to reboot, open up cv again and ran the following from command line:

$ source ~/.profile
$ workon cv
$ python
>>> import cv2
>>> cv2.__version__
'3.1.0'
>>>
 
this all seemed good.
I then stayed on the cv virtual environment and started MRL:
 
$ java --jar myrobotlab.jar
 
then ran my script again.
 
Still no video in the openCV tab???
 
I sent a No Worky but I am not sure there is really an issue with MRL.
 
A little more guidance would be great!
 
THANKS!
 
Kyle
 
 
Acapulco Rolf's picture

libunicap2

Hi Kyle

I have a hunch

If you've followed all steps with succesful outcomes, the one final step is this:

From the command shell on the Pi run the following:

sudo apt-get install libunicap2

That's the step you need if you've not already installed that component

After some experiment, I've found that without that component the MRL OpenCV video widget will not show video output

Mats mentioned in an earlier post that Kwatters advised that this is a prerequisite

 

kyle.clinton's picture

sudo apt-get install libunicap2 is all we need

So I worked with Kwatters a bit on this and the opencv inside MRL was just fine it just need that libunicap2 so. I am not sure if it just works because I am using USB and other stuff is needed for pi camera.

Thanks!

Acapulco Rolf's picture

MRL, concurrent Java JVM instances reported by htop

Hi Grog
 
Yes, it seems odd regarding the multiple concurrent java/jvm processes running
 
I have something to share on that, just taking a few screen captures first
 
I'll post my findings shortly :)
GroG's picture

killall java Will clear

killall java
Will clear everything..
Don't know how your shutting down
... But Runtime.shutdown() will work too

Acapulco Rolf's picture

Hoop showing multiple concurrent processes/threads

Hi Grog

This post shows the author of htop explaining the reason htop shows the multiple threads

http://stackoverflow.com/questions/11017597/htop-showing-multiple-java-p...

Advice followed :)

GroG's picture

Ahhh thanks... Learn

Ahhh thanks... Learn something new everyday..
I'm old school and thought it was top... Never heard of htop until now :)