clementfarabet / lua---camera

A very simple camera interface (frame grabber) for Torch7.
34 stars 18 forks source link

OpenCV init speed up by 10 seconds. #3

Closed bmartini closed 12 years ago

bmartini commented 12 years ago

The OpenCV init function looped on a test for the cameras frame width and height. If the cameras width or height was not the same as those passed in by torch then the init was delayed by 10 seconds.

clementfarabet commented 12 years ago

OK, so before I merge that change, I remember that whoever added this pause in did that for a reason: the goal was to make sure than even the first frame returned by the camera had the right form factor. Is that still the case?

bmartini commented 12 years ago

This is not the case anymore.

The init never resets the image size of the camera. That was commented out by Marco Scoffier with the 834e43ca commit on 2012-04-25.

The comment for that commit was "get opencv camera working on linux if available".

Thus now the OpenCV always returns an image the native size of the camera which has to be resized by torch. It also always waits for 10 sec unless the native size of the camera is exactly the size you have set. I think removing this wait is good unless we return the cvSetCaptureProperty.

marcoscoffier commented 12 years ago

Hey guys, I don't have time to look at this just now. There was a problem with cvSetCaptureProperty on Linux.

marcoscoffier commented 12 years ago

Hey, Just looked thisrequest over. Definitely a bug. Thanks Berin. Should be committed. Also when testing I just added some code which I'll commit after Berin's update to make things work when the system doesn't set capture size to the requested width and height eg. request 1280x640 get 1280x720 (which just happened to me :) )

clementfarabet commented 12 years ago

Cool, so Marco, do you want to go ahead and merge it?