mzs
Posts: 6
Joined: Mon Feb 10, 2014 9:06 pm

Re: Video4Linux2 driver ready!

Mon Feb 10, 2014 9:12 pm

Am I the only one who finds it a little bit creepy that there is no source code for something that has access to the camera module, installs via the network (so the pi is networked). My one rule of security is if you did not read/write and compile the source code yourself then your computer is owned by whoever did (You are just the chump providing them with free electricity).

murat_belge
Posts: 27
Joined: Fri Feb 14, 2014 6:18 pm

Re: Video4Linux2 driver ready!

Wed Feb 19, 2014 8:44 pm

The latest release of the Raspbian Wheezy image has V4L2 drivers for the Camera Board. This means that you can use V4L2 Video Capture block to capture images from the Raspberry Pi Camera Board. To enable this, first upgrade your Raspbian:

sudo apt-get update
sudo apt-get dist-upgrade
sudo rpi-update
sudo reboot

After reboot, execute the following command to load the V4L2 driver for the Raspberry Pi Camera:

sudo modprobe bcm2835-v4l2

After this step, you should see a /dev/video0 device (check by "ls -al /dev/vid*") that corresponds to the Camera Board. Now use the V4L2 Video Capture Block to capture images from this video device.

pumpkinpi
Posts: 131
Joined: Fri Apr 18, 2014 7:11 pm

Re: Video4Linux2 driver ready!

Fri Apr 18, 2014 7:25 pm

RpiName wrote:
sudo LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv61/libuv4lext.so python camTest.py
It's "armv6l", not "armv61", in the path.

LD_PRELOAD pointing to the extension library is necessary with python/pygame

You can make LD_PRELOAD permanent by doing "export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so" one time per ssh session or by adding the above line in ~/.bashrc once for all, or by adding the path in one of the configuration files of ld (man ld)
Thanks RpiName for this work. I have a RPi working with motion quite well and am pleased with it so far. I only have one issue related to the above comment.

When I boot my Pi, the motion daemon does not start properly. So I have to SSH into the devise, stop motion with the command:
sudo /etc/init.d/motion stop
and then restart it with the command:
sudo LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so motion -c /etc/motion/motion.conf

After that, it works great. I would love it so that I can have the daemon start up on boot up. I tried monkeying around by putting that LD_PRELOAD command into the /etc/init.d/motion file, but it does not work. I was just guessing.

I also tried the suggestion above (putting it into ~/.bashrc) and I either did not do it correctly or it would not work. My suspicion is that by putting it into ~/.bashrc it does not start the daemon as root and thus it does not work.

Any advice is greatly appreciated.

pumpkinpi

RpiName
Posts: 662
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Fri Apr 18, 2014 8:58 pm

pumpkinpi wrote:LD_PRELOAD pointing to the extension library is necessary with python/pygame

You can make LD_PRELOAD permanent by doing "export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so" one time per ssh session or by adding the above line in ~/.bashrc once for all, or by adding the path in one of the configuration files of ld (man ld)
I would love it so that I can have the daemon start up on boot up.
Any advice is greatly appreciated.
Put "LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so" in /etc/environment

Code: Select all

$ cat /etc/environment 
LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so

pumpkinpi
Posts: 131
Joined: Fri Apr 18, 2014 7:11 pm

Re: Video4Linux2 driver ready!

Fri Apr 18, 2014 10:16 pm

RpiName wrote:Put "LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so" in /etc/environment
Thanks for the reply...

Curiously, it is there already. No dice. This is what I see on boot with the command:

Code: Select all

tail -f /var/log/syslog
Apr 18 18:13:30 pisecure motion: [1] #011"brightness", default 50, current 50
Apr 18 18:13:30 pisecure motion: [1] found control 0x00980901, "contrast", range -100,100
Apr 18 18:13:30 pisecure motion: [1] #011"contrast", default 0, current 0
Apr 18 18:13:30 pisecure motion: [1] found control 0x00980902, "saturation", range -100,100
Apr 18 18:13:30 pisecure motion: [1] #011"saturation", default 0, current 0
Apr 18 18:13:30 pisecure motion: [1] found control 0x08000000, "shutter speed", range 0,65535
Apr 18 18:13:30 pisecure motion: [1] #011"shutter speed", default 0, current 0
Apr 18 18:13:30 pisecure motion: [1] found control 0x08000001, "zoom factor", range 1,8
Apr 18 18:13:30 pisecure motion: [1] #011"zoom factor", default 0, current 1
Apr 18 18:13:30 pisecure motion: [1] ioctl (VIDIOCGCAP): Invalid argument
Apr 18 18:13:40 pisecure motion: [1] Retrying until successful connection with camera
Apr 18 18:13:40 pisecure motion: [1] cap.driver: "raspicam"
Apr 18 18:13:40 pisecure motion: [1] cap.card: "Camera Board OV5647"
Apr 18 18:13:40 pisecure motion: [1] cap.bus_info: "CSI"
Apr 18 18:13:40 pisecure motion: [1] cap.capabilities=0x01000001
Apr 18 18:13:40 pisecure motion: [1] - VIDEO_CAPTURE
Apr 18 18:13:40 pisecure motion: [1] - READWRITE
Apr 18 18:13:40 pisecure motion: [1] Test palette YU12 (640x480)
Apr 18 18:13:40 pisecure motion: [1] Using palette YU12 (640x480) bytesperlines 960 sizeimage 460800 colorspace 00000000
Apr 18 18:13:40 pisecure motion: [1] found control 0x00980900, "brightness", range 0,100
Apr 18 18:13:40 pisecure motion: [1] #011"brightness", default 50, current 50
Apr 18 18:13:40 pisecure motion: [1] found control 0x00980901, "contrast", range -100,100
Apr 18 18:13:40 pisecure motion: [1] #011"contrast", default 0, current 0
Apr 18 18:13:40 pisecure motion: [1] found control 0x00980902, "saturation", range -100,100
Apr 18 18:13:40 pisecure motion: [1] #011"saturation", default 0, current 0
Apr 18 18:13:40 pisecure motion: [1] found control 0x08000000, "shutter speed", range 0,65535
Apr 18 18:13:40 pisecure motion: [1] #011"shutter speed", default 0, current 0
Apr 18 18:13:40 pisecure motion: [1] found control 0x08000001, "zoom factor", range 1,8
Apr 18 18:13:40 pisecure motion: [1] #011"zoom factor", default 0, current 1
Apr 18 18:13:40 pisecure motion: [1] ioctl (VIDIOCGCAP): Invalid argument
Apr 18 18:13:50 pisecure motion: [1] Retrying until successful connection with camera
Apr 18 18:13:50 pisecure motion: [1] cap.driver: "raspicam"
Apr 18 18:13:50 pisecure motion: [1] cap.card: "Camera Board OV5647"
Apr 18 18:13:50 pisecure motion: [1] cap.bus_info: "CSI"
Apr 18 18:13:50 pisecure motion: [1] cap.capabilities=0x01000001
Apr 18 18:13:50 pisecure motion: [1] - VIDEO_CAPTURE
Apr 18 18:13:50 pisecure motion: [1] - READWRITE

RpiName
Posts: 662
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Fri Apr 18, 2014 10:27 pm

pumpkinpi wrote: Curiously, it is there already. No dice
Strange. It's likely the problem is not LD_PRELOAD being not set.. Anyway, as a quick workaround you can add this line in /etc/rc.local :

Code: Select all

service motion stop && LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so motion -c /etc/motion/motion.conf
reboot.

pumpkinpi
Posts: 131
Joined: Fri Apr 18, 2014 7:11 pm

Re: Video4Linux2 driver ready!

Fri Apr 18, 2014 11:07 pm

That fix worked. Thanks a million!

pumpkinpi

Talha
Posts: 4
Joined: Mon Apr 21, 2014 9:01 pm

Re: Video4Linux2 driver ready!

Mon Apr 21, 2014 9:07 pm

Thank you RPiName for writing this driver.

I can only get about 6 frames per second without any computer vision. I am using yuv420 and opencv with python.

I have spent about 40 hours trying to get the csi camera to work on python-opencv.
Please tell me if it is impossible for me to get a higher framerate. if that is the case what would be the best move for me?

I need urgent help as I need this for my term project.


Thank you,
Talha

Talha
Posts: 4
Joined: Mon Apr 21, 2014 9:01 pm

Re: Video4Linux2 driver ready!

Wed Apr 30, 2014 9:56 pm

RpiName wrote:Hello,
to your knowledge, a Video4Linux2 driver for the CSI Camera Board is available here:

http://www.linux-projects.org/modules/n ... toryid=150

Thank you RPiName for writing this driver.

I can only get about 6 frames per second without any computer vision. I am using yuv420 and opencv with python.

I have spent about 40 hours trying to get the csi camera to work on python-opencv.
Please tell me if it is impossible for me to get a higher framerate. if that is the case what would be the best move for me?

I need urgent help as I need this for my term project.


Thank you,
Talha

pumpkinpi
Posts: 131
Joined: Fri Apr 18, 2014 7:11 pm

Re: Video4Linux2 driver ready!

Sun May 04, 2014 1:42 am

I am trying to start and stop this driver with the root crontab and the following two commands (basically to run it during the day).

Code: Select all

50 7 * * * LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so motion -c /etc/motion/motion.conf
30 15 * * * /etc/init.d/motion stop
It does not seem to be stopping and I was wondering if anybody knows why?

Thanks,
pumpkinpi

RaspberryDoe
Posts: 3
Joined: Fri Apr 25, 2014 10:21 pm

Re: Video4Linux2 driver ready!

Sun May 04, 2014 6:44 am

I don't have /usr/lib/uv4l directory. How do I get it on my Pi. When I try sudo apt-get install uv4l I get a response of 'Unable to locate package uv4l'

I'm trying to compile the OpenCv test example given elsewhere in this thread. But can not until I get that lib. But I can not figure out how to do so. Sorry,

Dale Eason

RpiName
Posts: 662
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Sat May 10, 2014 1:53 pm

Talha wrote: I can only get about 6 frames per second without any computer vision. I am using yuv420 and opencv with python.

Please tell me if it is impossible for me to get a higher framerate.
There is a UV4L raspicam driver update adding support for more native colorspaces: bgr24,rgb24,nv12,yvu420. You should achieve an higher framerate now with opencv.

RpiName
Posts: 662
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Mon Jun 02, 2014 1:07 pm

The UV4L driver will support text over video soon. This is the announcement:

http://www.linux-projects.org/modules/n ... toryid=161

RpiName
Posts: 662
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Thu Jun 05, 2014 6:11 pm

The UV4L Driver for the RaspberryPi Camera Module supports text over video:
http://www.linux-projects.org/modules/n ... toryid=162

This is a demo:
http://linux-projects.org/downloads/exa ... l_demo.mkv

RpiName
Posts: 662
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Mon Jun 30, 2014 12:36 pm

According to this announcement, the UV4L driver will be supporting Real-time Object Detection:

http://www.linux-projects.org/modules/n ... toryid=163

magnatag
Posts: 33
Joined: Tue Mar 04, 2014 8:39 pm

Re: Video4Linux2 driver ready!

Mon Jun 30, 2014 8:49 pm

Hi Luca,

Would it be possible to add a White Vertical Line in the center of the video with your new overlay feature?

Thanks!

RpiName
Posts: 662
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Mon Jun 30, 2014 9:27 pm

magnatag wrote: Would it be possible to add a White Vertical Line in the center of the video with your new overlay feature?
it's certainly possible if useful for many people

RpiName
Posts: 662
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Sun Jul 06, 2014 6:32 pm

From the news at the UV4L homepage, the Object Detection/Tracking feature is now ready. Furthermore, future extensions of UV4L will include Real-time, Video Live Streaming through HTTP/MJPEG Server and HTML5/H264 (Websocket).

moritzmhmk
Posts: 7
Joined: Mon Feb 17, 2014 7:37 pm

Re: Video4Linux2 driver ready!

Wed Jul 09, 2014 11:11 am

Awesome news - but is there a way to receive the face positions or similar data?

I have been struggling with OpenCV face detection (also planing recognition) for a couple of days now and (using the official 4vl driver) I cant get more then about 2FPS already using lbp instead of haar and having set resolutions down to 320x240 :?
I did first use python (which i prefer) and then tried using c++ but only raising the FPS about 0.3 by doing so...

PS I have it up and running on my old netbook with good FPS - so the code shouldn't be the problem (I did also try a couple of examples allways getting the same awfull FPS)

PPS using uv4l driver opencv will just crash :(

previ
Posts: 8
Joined: Fri Jul 11, 2014 10:31 pm

Re: Video4Linux2 driver ready!

Fri Jul 11, 2014 10:40 pm

RpiName wrote: There is a UV4L raspicam driver update adding support for more native colorspaces: bgr24,rgb24,nv12,yvu420. You should achieve an higher framerate now with opencv.
Hello, I am using opencv (via simplecv) with UV4L, everything was working fine until a couple of weeks ago, I updated the drivers and now the red and blue colors are swapped.
I tryed to use different encoding at driver startup, from YUV420, BGR24 to RGB24 with no luck, red is still swapped with blue.

Any hints?

RpiName
Posts: 662
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Sat Jul 12, 2014 9:56 am

previ wrote:I updated the drivers and now the red and blue colors are swapped.
Any hints?
Update UV4L again.

previ
Posts: 8
Joined: Fri Jul 11, 2014 10:31 pm

Re: Video4Linux2 driver ready!

Mon Jul 14, 2014 8:09 pm

Driver updated, now it works, thanks!

RpiName
Posts: 662
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Tue Sep 23, 2014 11:22 pm

According to the UV4L homepage, new functionalities have been added for the core and the raspicam driver: native HTTP streaming server plug-in, new dynamic controls: video denoise, still denoise, jpeg quality, rotation, blue,red gain ,text annotation (static as opposite to the old text overlay), sensor mode selection.

kipe
Posts: 1
Joined: Thu Sep 25, 2014 7:23 pm

Re: Video4Linux2 driver ready!

Thu Sep 25, 2014 7:27 pm

I managed to fix the issue with starting motion as daemon.
Just insert the following line to "/etc/init.d/motion" at line 57: "export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so"

The file should look something like this afterwards:

Code: Select all

        chown motion:motion /var/run/motion
        export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so

        log_daemon_msg "Starting $DESC" "$NAME"
Tested to work on latest Raspbian.

KaiK
Posts: 2
Joined: Tue Dec 23, 2014 4:48 pm

Re: Video4Linux2 driver ready!

Tue Dec 23, 2014 5:18 pm

Hi guys,

I am not lucky let motion run with uv4l and RaspiCam as daemon.

I installed u4vl with

Code: Select all

$ sudo apt-get install uv4l uv4l-raspicam
Additionally I installed the extras to startup the drivers automatically:

Code: Select all

$ sudo apt-get install uv4l-raspicam-extras
My RaspiCam is mounted well as /dev/video0 during startup.

I can start and run motion succesfully with

Code: Select all

$ sudo LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so motion
but when I try to startup motion as daemon (changing the corresponding values in /etc/default/motion and /etc/motion/motion.conf and executing $ sudo service motion start motion only brings up a grey picture with indication "unable to open video device". I get the same grey image, when starting motion manually without doing the LD_PRELOAD.

I tried to integrate the export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so at the beginning as well as in line 57 of /etc/init.d/motion without any success.
I checked, if that value is in /etc/environment, which is the case...

Any ideas what else I can try? I just want to start motion automatically with the Pi.

Regards
Kai

Return to “Camera board”

Who is online

Users browsing this forum: pundit and 7 guests