openFrameworks-RaspberryPi / openFrameworks

This repo has migrated into the openFramworks core! Please go to http://github.com/openFrameworks/openFrameworks for the latest!
http://github.com/openFrameworks/openFrameworks
Other
104 stars 11 forks source link

VideoGrabber crash on bright lights (white pixels) #125

Closed igiso closed 11 years ago

igiso commented 11 years ago

Videograbber whenever the web-cam points to bright lights crashes

here is the log:

pi@raspberrypi ~/openFrameworks/examples/video/videoGrabberExample/bin $ gdb videoGrabberExample GNU gdb (GDB) 7.4.1-debian Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-linux-gnueabihf". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /home/pi/openFrameworks/examples/video/videoGrabberExample/bin/videoGrabberExample...done. (gdb) r Starting program: /home/pi/openFrameworks/examples/video/videoGrabberExample/bin/videoGrabberExample [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1". [New Thread 0xb53fb2b0 (LWP 2101)] [New Thread 0xb4bfb2b0 (LWP 2102)] [New Thread 0xb43fb2b0 (LWP 2103)] [New Thread 0xb3bfb2b0 (LWP 2104)] [ofAppEGLWindow::setupRPiNativeWindow:notice] screenRect.width==720, screenRect.height=480 [ofAppEGLWindow::setupRPiNativeWindow:notice] windowRect.width==720, windowRect.height=480 [ofAppEGLWindow::createSurface:notice] Setting up EGL Display [ofAppEGLWindow::createSurface:notice] EGL Display correctly set. [ofAppEGLWindow::createSurface:notice] No current render selected. [ofAppEGLWindow::createSurface:notice] Default Renderer detected. [ofAppEGLWindow::createSurface:notice] Surface created correctly [ofAppEGLWindow::createSurface:notice] API Binded correctly [ofAppEGLWindow::createSurface:notice] -----EGL----- [ofAppEGLWindow::createSurface:notice] EGL_VERSION_MAJOR = 1 [ofAppEGLWindow::createSurface:notice] EGL_VERSION_MINOR = 4 [ofAppEGLWindow::createSurface:notice] EGL_CLIENT_APIS = OpenGL_ES OpenVG [ofAppEGLWindow::createSurface:notice] EGL_VENDOR = Broadcom [ofAppEGLWindow::createSurface:notice] EGL_VERSION = 1.4 [ofAppEGLWindow::createSurface:notice] EGL_EXTENSIONS = EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_vg_parent_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_lock_surface [ofAppEGLWindow::createSurface:notice] GL_RENDERER = VideoCore IV HW [ofAppEGLWindow::createSurface:notice] GL_VERSION = OpenGL ES-CM 1.1 [ofAppEGLWindow::createSurface:notice] GL_VENDOR = Broadcom [ofAppEGLWindow::createSurface:notice] ------------- [ofAppEGLWindow::setupPeripherals:notice] Peripheral setup complete. [ofAppEGLWindow:notice] setupUDev() : Created udev object. [ofAppEGLWindow:notice] setupMouse() : Unabled to find mouse. [ofAppEGLWindow:error] setupMouse() : did not open mouse. [ofAppEGLWindow:notice] setupKeyboard() : keyboard_fd= 9 devicePath=/dev/input/by-path/platform-bcm2708_usb-usb-0:1.2:1.0-event-kbd [ofAppEGLWindow:notice] setupKeyboard() : keyboard device name = SIGMACH1P USB Keykoard [New Thread 0xb33fb2b0 (LWP 2105)] [ofAppEGLWindow::setupPeripherals:notice] Native event setup complete. [ofAppEGLWindow::setupOpenGL:notice] Peripheral setup complete. [ofAppEGLWindow::runAppViaInfiniteLoop:notice] Entering infinite loop. [notice] Probing devices with udev... [notice] Found device 046d:0929, getting capabilities... [notice] Detected v4l2 device: Camera [notice] Driver: spca561, version: 198155 [notice] Capabilities: 0x85000001 [warning] ofGstUtils: selected device doesn't exist, selecting device 0 [notice] video/x-raw-yuv 352 x 288 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-yuv 320 x 240 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-yuv 176 x 144 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-yuv 160 x 120 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-yuv 352 x 288 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-yuv 320 x 240 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-yuv 176 x 144 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-yuv 160 x 120 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-rgb 352 x 288 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-rgb 320 x 240 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-rgb 176 x 144 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-rgb 160 x 120 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-rgb 352 x 288 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-rgb 320 x 240 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-rgb 176 x 144 framerates: [notice] from 0/1 to 100/1 [notice] video/x-raw-rgb 160 x 120 framerates: [notice] from 0/1 to 100/1 [notice] ofGstUtils: selected device: Camera [notice] ofGstUtils: selected format: 160x120 video/x-raw-yuv framerate: 100/1 [notice] gstreamer pipeline: v4l2src name=video_source device=/dev/video0 ! video/x-raw-yuv,width=160,height=120,framerate=100/1 ! ffmpegcolorspace ! appsink name=ofappsink caps="video/x-raw-rgb, depth=24, bpp=24, endianness=4321, red_mask=0xff0000, green_mask=0x00ff00, blue_mask=0x0000ff, alpha_mask=0x000000ff, width=160, height=120" [New Thread 0xb085f2b0 (LWP 2106)] [ofAppEGLWindow::runAppViaInfiniteLoop:notice] ofNotifySetup() complete. [New Thread 0xb005f2b0 (LWP 2107)] [Thread 0xb005f2b0 (LWP 2107) exited]

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb085f2b0 (LWP 2106)] 0xb6ccd734 in gst_mini_object_copy () from /usr/lib/arm-linux-gnueabihf/libgstreamer-0.10.so.0 (gdb)

If i Try to run the example again immediately after a crash

The program doesn't start and it gives the following error:

GNU gdb (GDB) 7.4.1-debian Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-linux-gnueabihf". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /home/pi/openFrameworks/examples/video/videoGrabberExample/bin/videoGrabberExample...done. (gdb)

You need to reboot R-PI to be able to run the videoGrabberExample again.

so this might be an indication of a memory leak?

I have absolutely no understanding of the videoGrabber class... any pointers on why this error occurs will be greatly appreciated

NOTE:

The same crash occurs if the app runs for a long period of time (like 2-3 hours)

I think the error comes from /usr/lib/arm-linux-gnueabihf/libgstreamer-0.10.so.0

jvcleave commented 11 years ago

my guess is that maybe your webcam is shutting itself off to protect the sensor?

jvcleave commented 11 years ago

or maybe it is changing it's shutter speed to adjust for the light and getting out of sync with the gstreamer pipeline.

are you able to try other webcams or try the same app on a desktop machine?

arturoc commented 11 years ago

this is the weirdest crash ever :) are you sure that the camera is not disconnecting due to a bad cable or something like that when you move it?

igiso commented 11 years ago

:) really weird indeed ...definitely not a loose cable.. definitely the webcam is not just shutting down.. it's solid a crash..

I tried two other webcams : one is this http://www.amazon.co.uk/Official-Microsoft-Xbox-Vision-Webcam/dp/B0054UMR8O/ref=sr_1_8?ie=UTF8&qid=1359938468&sr=8-8

and the other one is this:

http://www.amazon.co.uk/Logitech-960-000354-Webcam-C300-1-3MP/dp/B002CNN0MS/ref=pd_sim_sbs_ce_5

The above two work, don't crash on the lights but they are VERY unresponsive, not suitable for an opencv project.

This webcam: http://www.amazon.co.uk/Labtec-WebCam-961307-0914/dp/B0013DEVX0/ref=sr_1_1?s=computers&ie=UTF8&qid=1359938742&sr=1-1 ..is amazing. it works perfectly.. REALLY FAST 60+fps ...but when it's too bright (daylight behind me) or lamp.. etc.. it crashes..

seriously.. it crashes with bright lights..

I've noticed that it uses different drivers than the other two (gstreamer pipeline: v4l2src)

...and the crash only occurs on the Pi (but to be honest I wasn't able to test this particular webcam on a different machine) (it's very old and my mac is not compatible with it..)

I also have a PSeye @jvcleave you have manage to connect this on the pi right???

Do you remember the packages that you had installed to make it work?..

Last time I checked it didn't work.. but I am going to try again tomorrow... What webcams do you guys use on the pi and what framerate do you get?

Edit: Here is why I don't think it is a webcam disconnection issue. First of all if I run the example without a webcam I just get a black box. When I connect the webcam and run it.. I can leave it working for hours... I can drop the webcam move it around .. not a problem.

THE MOMENT I POINT IT TO SOME BRIGHT LIGHTS it crashes.

Ps: after each crash I need to restart the pi to be able to run the project again.

jvcleave commented 11 years ago

Here my project I was using for the PS3Eye - it doesn't do much differently than what ofVideoGrabber does but the gstreamer pipeline is a bit more exposed to allow me to tweak it

You will have to use a powered USB hub http://www.jvcref.com/files/PI/tests/dev_ps3EyeGrabber.zip

I have had issues where the app has crashed and I have had to reboot the PI but I think this is just the PI/USB behavior. Sometimes unplugging the USB hub/Camera from the PI does just as well

Arturo has some debugging GST tips around here https://github.com/openFrameworks-RaspberryPi/openFrameworks/issues/21#issuecomment-10881978 if you want to dig further with your camera

igiso commented 11 years ago

wow awesome Thanks for the pseye Example J!

It's a working beauty @ 60fps! and adores lights!

I think Iam going to use this one... Finally I can focus on things that matter!

By the way anyone knows why some cameras are responsive and others arent?

kalwalt commented 11 years ago

Anyone has tried oF and raspberrypi with a HD camera? for example a Logitech c920?

danzeeeman commented 11 years ago

@igiso it depends on what is and isn't supported in the linux, you can check the list of supported devices here