ptomato / Beams

Open-source laser beam profiling software designed for cheap webcams
MIT License
23 stars 13 forks source link

OpenCV acting up with two webcams #5

Open ptomato opened 9 years ago

ptomato commented 9 years ago

Per @trygentoo:

I can't switch from internal laptop webcam to external which is going to work as beamprofiler. When I go to "Choose camera..." menu there only 2 options OpenCV and Dummy Gauss. Moreover app is stunned if OpenCV chosen after alert "No camera was detected. Did you forget to plug it in?"

Console output:

/usr/lib64/python2.7/site-packages/traits/trait_handlers.py:1599: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  if value in self.values:
/usr/lib64/python2.7/site-packages/chaco/image_data.py:190: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  self._data = newdata
/usr/lib64/python2.7/site-packages/chaco/array_data_source.py:123: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  self._data = newdata
/usr/lib64/python2.7/site-packages/chaco/axis.py:498: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  for tickpos in mapped_tick_positions]))
/usr/lib64/python2.7/site-packages/chaco/axis.py:499: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  self._tick_label_list = tick_list
/usr/lib64/python2.7/site-packages/chaco/axis.py:500: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  self._tick_label_positions = self._tick_positions
Exception occurred in traits notification handler.
Please check the log file for details.
Exception occurred in traits notification handler for object: <beams.MainWindow.MainWindow object at 0x7f7f3f317110>, trait: camera, old value: <beams.Webcam.Webcam object at 0x7f7f3f277290>, new value: <beams.Webcam.Webcam object at 0x7f7f3022e6b0>
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/traits/trait_notifiers.py", line 520, in _dispatch_change_event
    self.dispatch( handler, *args )
  File "/usr/lib64/python2.7/site-packages/traits/trait_notifiers.py", line 615, in dispatch
    handler( *args )
  File "/usr/lib64/python2.7/site-packages/traitsui/ui.py", line 824, in _evaluate_when
    self._do_evaluate_when(at_init=False)
  File "/usr/lib64/python2.7/site-packages/traitsui/ui.py", line 838, in _do_evaluate_when
    self._evaluate_condition(self._visible, 'visible', at_init)
  File "/usr/lib64/python2.7/site-packages/traitsui/ui.py", line 883, in _evaluate_condition
    context = self._get_context( self.context )
  File "/usr/lib64/python2.7/site-packages/traitsui/ui.py", line 804, in _get_context
    context2 = value.trait_get()
  File "/usr/lib64/python2.7/site-packages/traits/has_traits.py", line 1485, in trait_get
    value = getattr( self, name, Missing )
  File "build/bdist.linux-x86_64/egg/beams/Webcam.py", line 62, in _resolution_default
    width = cv.GetCaptureProperty(self._capture, FRAME_WIDTH)
TypeError: Expected CvCapture for argument 'capture'
libv4l2: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl S_FMT
libv4l2: error setting pixformat: Device or resource busy
libv4l1: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl VIDIOCSPICT

I don't currently have access to an external webcam to test this, so help is appreciated.

trygentoo commented 9 years ago

How can I help you?

ptomato commented 9 years ago

That would be great if you could help! First thing is, could you try your beam profiler webcam on another computer with no internal webcam? Just to see if it works when it's the only webcam attached to the computer.

(I'm not sure I actually ever supported two webcams with the OpenCV plugin. If not, then I'll have to figure out how to do that.)

trygentoo commented 9 years ago

Hello,

sorry for large delay. Finally managed to run beams on another comp, the result is the same: about 1 frame per minute and everything is very slow.

On Thu, Sep 3, 2015 at 7:26 PM P. F. Chimento notifications@github.com wrote:

That would be great if you could help! First thing is, could you try your beam profiler webcam on another computer with no internal webcam? Just to see if it works when it's the only webcam attached to the computer.

(I'm not sure I actually ever supported two webcams with the OpenCV plugin. If not, then I'll have to figure out how to do that.)

— Reply to this email directly or view it on GitHub https://github.com/ptomato/Beams/issues/5#issuecomment-137503061.

ptomato commented 9 years ago

This computer only has 1 webcam in total?

Hmm, I don't know what to do next. Is there any chance you could do some experimenting and find out what is happening during the intervals between frames? For example, by adding some print statements in the ProcessingThread.py code.

ptomato commented 8 years ago

I have added some code to allow selecting between two webcams when using OpenCV. Maybe that helps or fixes this?