Page 4 of 7

Re: Video4Linux2 driver ready!

Posted: Fri Oct 25, 2013 12:25 am
by RpiName
jhfelectric wrote:I used to get the same output. I have noticed that I now have this one (notice the 2 first lines):
and when I run a simple command, I get this

Code: Select all

[email protected] ~ $ dd if=/dev/video0 of=snapshot.jpeg bs=11M count=1
dd: opening `/dev/video0': Interrupted system call[/quote]

That's strange.

The first two lines don't matter. Please run 'sudo rpi-update' in the first place, then run the driver on one terminal with the same command line as before plus the -v 8 and  -f options, and run the application on another terminal. Then switch back to the first terminal once you get the error from the application and report  all the output from the driver.

Re: Video4Linux2 driver ready!

Posted: Fri Oct 25, 2013 5:47 am
by jhfelectric
RpiName wrote: That's strange.

The first two lines don't matter. Please run 'sudo rpi-update' in the first place, then run the driver on one terminal with the same command line as before plus the -v 8 and -f options, and run the application on another terminal. Then switch back to the first terminal once you get the error from the application and report all the output from the driver.
Hi again,
Thx for your advice. rpi-update did the trick !
Julien

Re: Video4Linux2 driver ready!

Posted: Sat Oct 26, 2013 5:46 pm
by bvo
Thanks a lot RpiName!

as you suggested, getting only 64 x 64 tiles from the captured frame in python opencv was related to the version of opencv in the repositories. I compiled version 2.4.5 of opencv , and tada! everything runs nicely! This is realy a milestone for my computer vision project on the raspberry pi. :D

Code: Select all

In [1]: import cv2

In [2]: cv2.__version__
Out[2]: '2.4.5'

In [3]: cap = cv2.VideoCapture(0)

In [4]: success, frame = cap.read()

In [5]: frame.shape
Out[5]: (480, 640, 3)

Re: Video4Linux2 driver ready!

Posted: Sun Oct 27, 2013 3:52 pm
by twj6474
Hello everyone! I 'm working on a project using matlab/simulink with raspberry model B recently. The simulink support package for raspberry pi hardware includes a model called v4l2 video capture which can capture video from a USB camera using V4L2 driver framework. I have tested it with my usb camera Logitech C270 and got a very low framerate video about 5fps under 160x120 resolution. So I abandon the usb camera. Last week I got the raspberry camera module and enabled the camera module by following the instruction. Then I updated Raspicam Video4Linux2 Driver v1.8 built Oct 24 2013. I got this error when I tested again.
**starting the model**
Error:YUYV pixel format is not supported by the device.Pixel formats supported by device:
1. MJPEG
2. JPEG
3. H264
4. YUV420
But the v4l2 video capture in simulink only support defult YUYV pixel format . How can I do? I really need help!

Re: Video4Linux2 driver ready!

Posted: Sun Oct 27, 2013 4:13 pm
by RpiName
twj6474 wrote:Error:YUYV pixel format is not supported by the device.Pixel formats supported by device:
1. MJPEG
2. JPEG
3. H264
4. YUV420
But the v4l2 video capture in simulink only support defult YUYV pixel format . How can I do? I really need help!
For now the simplest solution is to patch the v4l2 capture in simulink to do the conversion from yuv420 to yuyv, although this might slow down the framerate a bit.

Re: Video4Linux2 driver ready!

Posted: Mon Oct 28, 2013 12:09 pm
by twj6474
RpiName wrote:
twj6474 wrote:Error:YUYV pixel format is not supported by the device.Pixel formats supported by device:
1. MJPEG
2. JPEG
3. H264
4. YUV420
But the v4l2 video capture in simulink only support defult YUYV pixel format . How can I do? I really need help!
For now the simplest solution is to patch the v4l2 capture in simulink to do the conversion from yuv420 to yuyv, although this might slow down the framerate a bit.
Thank you very much for your reply! I wish the v4l2 driver for raspberry camera module will support YUYV format or mathwork update the support package soon. Because I don't know how to modify the s-function of the v4l2 video capture model in simulink. By the way, is there anyone who do project use simulink with raspberry? I designed a wifi controlled car which can be controlled by GUI on computer or just by cellphone. I really hope the raspberry camera module can work in simulink, then I can add vision algorithm to my wifi controlled car using computer vision system toolbox.

Re: Video4Linux2 driver ready!

Posted: Wed Oct 30, 2013 3:39 pm
by tiger79
RpiName wrote:
tiger79 wrote: Also when looking at the output stream the framerate is really really low (2-3 fps)...
Since v1.8 the driver also supports MJPEG Video Streaming at high framerates (other than the continous JPEG Still Capture). You may want to try it out.
Thanks for the headsup ! I just read this ;) I'll be having a look at it next week, I'm busy playing with another platform atm :D

Re: Video4Linux2 driver ready!

Posted: Wed Oct 30, 2013 8:15 pm
by zoschfrosch
RpiName wrote:
jhfelectric wrote:I used to get the same output. I have noticed that I now have this one (notice the 2 first lines):
and when I run a simple command, I get this

Code: Select all

[email protected] ~ $ dd if=/dev/video0 of=snapshot.jpeg bs=11M count=1
dd: opening `/dev/video0': Interrupted system call[/quote]

That's strange.

The first two lines don't matter. Please run 'sudo rpi-update' in the first place, then run the driver on one terminal with the same command line as before plus the -v 8 and  -f options, and run the application on another terminal. Then switch back to the first terminal once you get the error from the application and report  all the output from the driver.[/quote]

Hi,
I get the same error, but rpi-update does not solve the problem. Here ist the output of the driver started with -v8 -f:
error: Interrupted system call
mmal: mmal_vc_port_parameter_set: failed to set port parameter 64:0:ENOSYS
<error> [core] open() failed: Function not implemented: Interrupted system call

Re: Video4Linux2 driver ready!

Posted: Thu Oct 31, 2013 7:21 am
by atfxann
Hi again!
Nobody has an idea for my issue?
Trying to get a 640x480 video in C++/Qt/OpenCV on my raspberry with my raspberry cam.
It looks like setting --width and --height when launching the driver doesn't change anything.
But when I configure the VideoCapture in OpenCV it does (CV_CAP_PROP_FRAME_WIDTH, CV_CAP_PROP_FRAME_HEIGHT. With 2592*1944 I get a frame "zoomed out" (i takes too much time to grab a frame, because I have to resize it with cv::resize), and when I set the parameter to 640*480, it looks like the frame is "zoomed in" , and I don't get all the information I need in the picture.
I simply want to grab a 640x480 frame, but totally zoomed out!
Any clues?
Thx for your help.

Re: Video4Linux2 driver ready!

Posted: Sat Nov 09, 2013 6:45 pm
by RpiName
atfxann wrote:With 2592*1944 I get a frame "zoomed out" (i takes too much time to grab a frame, because I have to resize it with cv::resize), and when I set the parameter to 640*480, it looks like the frame is "zoomed in" , and I don't get all the information I need in the picture.
I simply want to grab a 640x480 frame, but totally zoomed out!

Any clues?
Update the driver to the latest version and load it with the "--full-field" option, which enables the Full Field of View for all the video encodings supported by the GPU (yuv420, jpeg (jpeg still capture), mjpeg (jpeg video), h264, rgba, bgra, rgb565)

Re: Video4Linux2 driver ready!

Posted: Sun Nov 10, 2013 12:54 pm
by atfxann
RpiName wrote: Update the driver to the latest version and load it with the "--full-field" option, which enables the Full Field of View for all the video encodings supported by the GPU (yuv420, jpeg (jpeg still capture), mjpeg (jpeg video), h264, rgba, bgra, rgb565)
Thx for the answer! I updated the driver, the -full-field option is now available! But since I updated, the camera will no longer open in OpenCV(c++) :s. I am using a VideoCapture object, using OpenCV 2.4.6. The open(0) function returns false :(

Re: Video4Linux2 driver ready!

Posted: Sun Nov 10, 2013 1:37 pm
by RpiName
atfxann wrote:I am using a VideoCapture object, using OpenCV 2.4.6. The open(0) function returns false :(
Does running 'rpi-update' help? I have OpenCV and VideoCapture working.

Re: Video4Linux2 driver ready!

Posted: Sun Nov 10, 2013 2:06 pm
by atfxann
RpiName wrote:
Does running 'rpi-update' help? I have OpenCV and VideoCapture working.
It does the trick! Thx a lot for your help. And the full-view option works perfectly ;)

Thanks!

Re: Video4Linux2 driver ready!

Posted: Mon Nov 11, 2013 9:57 am
by mindloose
Hi,

I am developing an application with python (2.7)+opencv (2.3.1) using the u4vl driver. The aim is to launch an inspection every time a trigger is received. I have tried using both arduino + firmata library and directly via raspberry's gpio + gpio library and in both cases everything works fine, except from one issue i have just realized (do not know if it is a driver or a pygame.camera issue , sorry if it is not the correct place for placing the question)

I am getting a 3 images delay every time the trigger gets pushed. For example, i am detecting liquid level in a bottle, everytime the bottle passes in front of the camera, the trigger gets pushed and an inspection runs. The issue is that if i pass a bottle with ok level and then another with no liquid at all, it gets 3 triggers ( it is always the same 3 images delay) for the camera to update the correct image.

Here is the code:

Loading the driver, i have tried both with and without --sched--rr option and getting the same result

Code: Select all

uv4l --driver raspicam --auto-video_nr --width 640 --height 480 --vflip yes --hflip yes --encoding jpeg --sched-rr
Loading the script with LD_PRELOAD

Code: Select all

LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so python ardurasp.py
Script

Code: Select all

PORT = '/dev/ttyACM0'
board = pyfirmata.ArduinoMega(PORT)
digital_0 = board.get_pin('d:7:i')
it = pyfirmata.util.Iterator(board)
it.start()

digital_0.enable_reporting()
pygame.camera.init()
cam = pygame.camera.Camera("/dev/video0",(640,480))
cam.start()
while (True):
    try:
           if str(digital_0.read()) == 'True':
                image= cam.get_image()
I have tried as well to do cam.start() and cam.stop() every time the trigger gets TRUE, which is working fine the first time the trigger gets pressed but in the second cycle always get a "Pygame parachute fault"

Any ideas? Thanks!

Re: Video4Linux2 driver ready!

Posted: Mon Nov 11, 2013 11:12 am
by mindloose

Re: Video4Linux2 driver ready!

Posted: Mon Nov 11, 2013 12:17 pm
by selectnone
For folks who want to get the camera module working in Python, I'd recommend taking a look at the PiCamera library - I've found that to be pretty great, and very nicely documented:

http://www.raspberrypi.org/phpBB3/viewt ... 43&t=56478

Re: Video4Linux2 driver ready!

Posted: Sun Nov 24, 2013 11:28 am
by fossington
I had the same problem with the latest uv4l drivers. I would get the interrupt error. Getting the latest firrmware via the rpi-update command fixed the problem.

Re: Video4Linux2 driver ready!

Posted: Mon Nov 25, 2013 6:43 pm
by djscoutmaster
Followed that motion use case / walk through and got a "invalid argument" error anyone seen this?

http://www.raspberrypi.org/phpBB3/viewt ... 28&t=61721

Re: Video4Linux2 driver ready!

Posted: Mon Dec 02, 2013 9:04 pm
by dom
Official V4L2 driver is now out for testing. See:
http://www.raspberrypi.org/phpBB3/viewt ... 43&t=62364

Re: Video4Linux2 driver ready!

Posted: Wed Dec 04, 2013 8:18 pm
by hopfen
Hi,
I have a following problem with RaspiCamera and V4L2 Driver. Just after installation using instructions from page http://www.linux-projects.org/modules/s ... e&artid=14
I tied to use mjpeg-streamer or make a picture using command

Code: Select all

 $ dd if=/dev/video0 of=snapshot.jpeg bs=11M count=1
but my putty console freezes, any other key combination doesn't work and no picture is taken :(
My Pi is updated, upgraded, and rpi-updated.
Below are commands after which I get freeze:

Code: Select all

[email protected] $ uv4l --driver raspicam --auto-video_nr --width 640 --height 480 --encoding jpeg
<notice> [core] Trying driver 'raspicam'
<warning> [core] Driver not found
<notice> [core] Loading external library libraspicam.so
<notice> [core] Trying driver 'raspicam'
<notice> [driver] Raspicam Video4Linux2 Driver v1.9.1 built Nov 16 2013
<notice> [driver] Selected format: 640x480, encoding: jpeg, JPEG Still Capture, max. 30 fps
<notice> [driver] ROI: 0, 0, 1, 1
<warning> [driver] NOTE: you might need to run the driver with a RealTime scheduling (--sched-rr), if you are going to use the (slow) Read I/O interface at high resolutions.
<notice> [core] Device detected!
<notice> [core] Registering device node /dev/video0
[email protected] $ dd if=/dev/video0 of=snapshot.jpeg bs=11M count=1 
Do you have any idea what I should do?
Thanks in advance for help.

Re: Video4Linux2 driver ready!

Posted: Tue Dec 10, 2013 12:55 pm
by hopfen
The problem was solved. Unfortunately the camera was broken due to electrostatic shock.

Re: Video4Linux2 driver ready!

Posted: Wed Dec 11, 2013 11:00 am
by arnevt
Hi There,

i want to take advantage of the full sensor (by capturing in image mode, not video mode), so I ran

uv4l --driver raspicam --auto-video_nr --width 800 --height 600 --encoding jpeg --quality 100 --nopreview --sched-rr --exposure verylong --output-buffers 0

this gives me a /dev/video0, but any image I capture is cut of at line 480 (whichever resolution I use). So that gives me only a 640x480 possibility. Is there no way to get higher res?

Re: Video4Linux2 driver ready!

Posted: Wed Dec 18, 2013 11:20 pm
by leonardolontra
works with pygame. Running uv4l with mjpeg encoding and pygame.

Re: Video4Linux2 driver ready!

Posted: Sun Jan 19, 2014 10:04 am
by paranbada4u
I try take a snapshot as below command.

$ dd if=/dev/video0 of=snapshot.jpeg bs=11M count=1

Let me know, Which directory store the .jpg shapshot?

and video file too ?

Re: Video4Linux2 driver ready!

Posted: Thu Jan 23, 2014 5:06 pm
by memri
twj6474 wrote:Hello everyone! I 'm working on a project using matlab/simulink with raspberry model B recently. The simulink support package for raspberry pi hardware includes a model called v4l2 video capture which can capture video from a USB camera using V4L2 driver framework. I have tested it with my usb camera Logitech C270 and got a very low framerate video about 5fps under 160x120 resolution. So I abandon the usb camera. Last week I got the raspberry camera module and enabled the camera module by following the instruction. Then I updated Raspicam Video4Linux2 Driver v1.8 built Oct 24 2013. I got this error when I tested again.
**starting the model**
Error:YUYV pixel format is not supported by the device.Pixel formats supported by device:
1. MJPEG
2. JPEG
3. H264
4. YUV420
But the v4l2 video capture in simulink only support defult YUYV pixel format . How can I do? I really need help!
Hi, new RPi user here :)
Pretty much want to do what twj6474 said, creating a Simulink block that has the input from the camera module through the CSI port. Without sounding too stupid, how do I enable the camera module on Raspian Wheezy and how do I update the V4L2 driver? And any ideas on how to convert the pixel format?
Thanks in advance for any help!