bugGNU Octave - Bugs: bug #43897, image-acquisition freezes when...

 
 

bug #43897: image-acquisition freezes when trying getsnapshot(obj);

Submitter:  None
Submitted:  Sat 27 Dec 2014 06:36:22 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Need Info Assigned to:  andy1978
Originator Name:  Greg Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.2
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 24 Dec 2015 04:31:53 PM UTC, comment #15: 

I'm closing this because there was no reply for more than 6 months. Feel free to reply if you have more informations or something which could help me.

Andreas Weber <andy1978>
Group Member
Sat 04 Apr 2015 01:58:39 AM UTC, comment #14: 

@Greg, thank you for your reply. So do you still think this is a problem with the image-acquisition package? Or could this be a problem between your C200 and the driver?

Andreas Weber <andy1978>
Group Member
Thu 02 Apr 2015 08:10:37 PM UTC, comment #13: 

@Andreas: sorry, I have totally forgotten about the whole thing. I found that the problem is not related to running streamer first, the problem lies with the set resolution of the image-acquisition. Acquiring a picture of 640x480 in size, never works. While setting it to 320x240 works with no questions asked.

Greg <mog123>
Thu 02 Apr 2015 05:46:45 PM UTC, comment #12: 

Ping, @Greg: Can you please provide the requested logfile and v4l2-compliance output?

Andreas Weber <andy1978>
Group Member
Mon 29 Dec 2014 10:44:12 AM UTC, comment #11: 

Could you also run (after a reboot of your BBB)


v4l2-compliance -d /dev/video0 -s


and attach the output?

Andreas Weber <andy1978>
Group Member
Sun 28 Dec 2014 06:00:51 PM UTC, comment #10: 

Greg, I'm sorry to bother you again but it looks like the logfile is overwritten between open/close calls so your logfile only contains calls from the last successful octave session. Could you run the octave script, close octave (with CTRL+C as you previously did) and rename the log to octave_first.log, then run streamer, rename log to streamer.log, run octave again, rename log to octave_second.log.

Thank you.

Btw: If you could test your camera on another GNU/Linux machine with image-acquisition this would help to encircle this bug.

Andreas Weber <andy1978>
Group Member
Sun 28 Dec 2014 03:20:45 PM UTC, comment #9: 

Sorry for the long reply. As said earlier, first time didn't work, after using streamer, it did work. Both files included.

(file #32723, file #32724)

Greg <mog123>
Sun 28 Dec 2014 09:51:34 AM UTC, comment #8: 

Okay, I reopen this report. Can you please enable logging (rm previous logfiles before) with


$ export LIBV4L2_LOG_FILENAME=libv4l2_debug.log


Then run this in Octave:


pkg unload all
pkg load image-acquisition
obj = videoinput("v4l2", __test__device__);
set (obj, "VideoFormat", "RGB3")
start (obj, 1)
img = getsnapshot (obj);
imwrite (img, "out.jpg");
stop (obj)


Then run streamer with -b 1 (only one buffer as the script above does) and the run the Octave script above a second one. As I read from the description the first run fails, streamer succeeds and the second try in Octave also succeeds. Please attach the generated libv4l2_debug.log

Andreas Weber <andy1978>
Group Member
Sat 27 Dec 2014 11:15:42 PM UTC, comment #7: 

I'd just like to say, that the error still stands. After turning off the system for ~hour and trying to rerun what I've done earlier still freezes octave. The workaround I've found is first grabbing an image and saving it via streemer, after that everything works in octave.

Greg <mog123>
Sat 27 Dec 2014 09:07:21 PM UTC, comment #6: 

The result of getsnapshot depends on the selected VideoFormat. Please see "help getsnapshot". If it's YUYV for example, you'll get a struct which has to be converted to RGB first. (This is intended and not a bug in image-acquisition)

I'll close this bugreport as fixed now.

Andreas Weber <andy1978>
Group Member
Sat 27 Dec 2014 09:03:04 PM UTC, comment #5: 

installing image-acquisition 0.2.1 solved the issue. I have succesfully read out an image. However if you don't do:

set(obj, "VideoFormat", "RGB3");


you will receive an error:


image(getsnapshot(obj));
error: invalid value for array property "cdata"
error: called from:
error:   /usr/share/octave/3.8.1/m/image/image.m at line 179, column 5
error:   /usr/share/octave/3.8.1/m/image/image.m at line 116, column 10


But thanks to your help my issue was resolved. Thank you Andreas

Greg <mog123>
Sat 27 Dec 2014 08:45:20 PM UTC, comment #4: 

The "result == -1 (Resource temporarily unavailable)" in your log is almost always a USB bus error. Usual faults are either not enough USB bandwidth, power or a buggy driver. Do you see something with "dmesg"?

I think you could also use mplayer to test. Do you see a live image with

mplayer tv:// -tv driver=v4l2:device=/dev/video0


Can you also try image-acquisition 0.2.1? It isn't officially released yet but you'll find it here: https://sourceforge.net/p/octave/package-releases/126/
Just download the tar.gz and install (don't unpack it) it within Octave via "pkg install image-acquisition-0.2.1.tar.gz"

Andreas Weber <andy1978>
Group Member
Sat 27 Dec 2014 08:36:24 PM UTC, comment #3: 

I have confirmed the webcam working with streamer

streamer -c /dev/video0 -b 16 -o outfile.jpeg


gave me a nice jpeg image I could then view.

Please excuse that this post is in such a short time interval from the last one.

Greg <mog123>
Sat 27 Dec 2014 08:28:49 PM UTC, comment #2: 

Thank You for your quick response!

The files have been uploaded with my report according to the wiki. Please look at files #32721:

http://savannah.gnu.org/bugs/download.php?file_id=32721

and #32722:

http://savannah.gnu.org/bugs/download.php?file_id=32722


My kernel is 3.8.13-bone63

Here is the output of v4l2-ctl:

ubuntu@arm:~$ v4l2-ctl -w --list-devices
UVC Camera (046d:0802) (usb-musb-hdrc.1.auto-1):
        /dev/video0

ubuntu@arm:~$ v4l2-ctl -w -D
Driver Info (using libv4l2):
        Driver name   : uvcvideo
        Card type     : UVC Camera (046d:0802)
        Bus info      : usb-musb-hdrc.1.auto-1
        Driver version: 3.8.13
        Capabilities  : 0x85000001
                Video Capture
                Read/Write
                Streaming
                Device Capabilities
        Device Caps   : 0x05000001
                Video Capture
                Read/Write
                Streaming
ubuntu@arm:~$ v4l2-ctl -w -L
                     brightness (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast (int)    : min=0 max=255 step=1 default=32 value=32
                     saturation (int)    : min=0 max=255 step=1 default=38 value=38
 white_balance_temperature_auto (bool)   : default=1 value=1
                           gain (int)    : min=0 max=255 step=1 default=0 value=0
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
                                0: Disabled
                                1: 50 Hz
                                2: 60 Hz
      white_balance_temperature (int)    : min=0 max=10000 step=10 default=4000 value=4000 flags=inactive
                      sharpness (int)    : min=0 max=255 step=1 default=20 value=20
         backlight_compensation (int)    : min=0 max=1 step=1 default=1 value=1
                  exposure_auto (menu)   : min=0 max=3 default=3 value=3
                                1: Manual Mode
                                3: Aperture Priority Mode
              exposure_absolute (int)    : min=1 max=10000 step=1 default=166 value=166 flags=inactive
         exposure_auto_priority (bool)   : default=0 value=1
ubuntu@arm:~$ v4l2-ctl -w -n
ioctl: VIDIOC_ENUMINPUT
        Input       : 0
        Name        : Camera 1
        Type        : 0x00000002
        Audioset    : 0x00000000
        Tuner       : 0x00000000
        Standard    : 0x0000000000000000 ()
        Status      : 0x00000000 (ok)
        Capabilities: 0x00000000 (not defined)
ubuntu@arm:~$ v4l2-ctl -w --list-formats
ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUV 4:2:2 (YUYV)

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : MJPEG

        Index       : 2
        Type        : Video Capture
        Pixel Format: 'RGB3' (emulated)
        Name        : RGB3

        Index       : 3
        Type        : Video Capture
        Pixel Format: 'BGR3' (emulated)
        Name        : BGR3

        Index       : 4
        Type        : Video Capture
        Pixel Format: 'YU12' (emulated)
        Name        : YU12

        Index       : 5
        Type        : Video Capture
        Pixel Format: 'YV12' (emulated)
        Name        : YV12


I don't have another pc to test these, and my ubuntu VM which I tried to config runs so slow its unusable. also, ffmpeg was removed for Ubuntu 14.04 and for the last 1 hour I've tried installing it from different tutorials with no luck. Isn't there a more out-of-the-box method to test video recording?

Greg <mog123>
Sat 27 Dec 2014 07:22:38 PM UTC, comment #1: 

Thank you for your bug report.
Which kernel are you using and do you see entries in the kernel logs (via dmesg). I've seen kernel oops for __vb2_queue_cancel the last days (unfortunately kerneloops.org/ is down atm)

You mention a logfile, have you create a logfile as described here http://wiki.octave.org/Image_acquisition_package#Reporting_bugs ?
Can you attach the output of v4l2-ctl and libv4l2_debug.log as described on the wiki?

Are you able to capture a video, for example with "ffmpeg -f v4l2 -r 25 -s 640x480 -i /dev/video0 out.avi"

Can you run your script with your C200 on a standard GNU/Linux machine?

Andreas Weber <andy1978>
Group Member
Sat 27 Dec 2014 06:36:22 PM UTC, original submission:  

Image acquisition freezes when trying getsnapshot(obj).
Example:

octave:4> test @videoinput/getsnapshot
^C^C^C^C^CPress Control-C again to abort.
^Cpanic: Interrupt -- stopping myself...


Doesn't work with test functions as well as simple functions like: img=getsnapshot(obj); preview(obj); etc.

the log file keeps on growing, and after 368 lines just keeps repeating the error:

request == VIDIOC_DQBUF
  timestamp 0.000000
result == -1 (Resource temporarily unavailable)



Setup:
- BeagleBone Black (connected via SSH/Putty), with or without additional 5V/2A power supply behaves the same.
- Logitech C200 camera (functional on windows).
- Ubuntu 14.04
- Octave 3.8.2
- image-acquisition 0.1.2


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #32723:  libv4l2_debug.log added by mog123 (2KiB - application/octet-stream)
file #32724:  terminal.txt added by mog123 (2KiB - text/plain)
file #32721:  libv4l2_debug.log added by None (14KiB - application/octet-stream)
file #32722:  terminal output.txt added by None (2KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mog123 (Posted a comment)
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-12-24 andy1978 Open/ClosedOpen Closed
    2014-12-28 mog123 Attached File- Added libv4l2_debug.log, #32723
        Attached File- Added terminal.txt, #32724
    2014-12-28 andy1978 StatusFixed Need Info
        Open/ClosedClosed Open
    2014-12-27 andy1978 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2014-12-27 andy1978 StatusNone Need Info
        Assigned toNone andy1978
    2014-12-27 None Attached File- Added libv4l2_debug.log, #32721
        Attached File- Added terminal output.txt, #32722

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code