I'm working on a project of computer vision and I need to use two cameras using opencv library. I tried this code but with two webcams from USB port it doesn't work while it works if I use one usb camera and the camera of my pc.
CvCapture* capture[2];
capture[0] = cvCreateCameraCapture(0);
capture[1] = cvCreateCameraCapture(1);
if(!capture[0] && !capture[1])
printf("Webcam error\n");
I'm working on windows 7 on an acer aspire 5742g. Is it a problem of the bus of my computer? The cameras are 2 Philips SPZ2000.
I tried also to work on the pictures taken by the one of them and from the camera on my pc and when I use the code for calibration and rectification found on the book "Learning opencv" of Bradsky I get a bad result. Can somebody help me?
Thank you in advance,
Sara
The typical reason for 2+ USB cameras to not work together (still they might be working fine separately) is that USB bandwidth is insufficient for them both to run simultaneously. There is a bandwidth limit, which is rather low: The maximum throughput of an isochronous pipe (which is usually used for video) is 24MB/s.
More on this issue:
Implications of using many USB web cameras
How many USB cameras can be accessed by one PC
Not able to capture video using 2 webcamera simulteneously
Two webcams on one usb hub - bandwidth issues
Related
i am curious if someone has implemented Yolo or SSD // OpenCV on RPi 4 with Coral Usb Accelerator support.
Currently, i faced some issue running even for the basic examples for coral usb accelerator. Do you have any tips in tackling this idea?
Moreover, i would like to use this setup to detect the road signs from a car's camera. Do you think it would be ok?
What type of issues are you having while running the basic demo?
Also, make sure your model meets the requirements for the tpu:
https://coral.withgoogle.com/docs/edgetpu/models-intro/#compatibility-overview
I would like to know if it is possible to run the OpenCV HOG Detector using a Raspberry Pi in real time using the Raspberry Pi camera.
Unfortunately not, even overclocked to 1000MHz and with 64MB for video it's not enough.
On my old mac with a 2.1 GHz Dual Core Intel CPU and 2GB of ram I could barely get between 8-12 FPS for a 640x480 stream.
I haven't tried OpenCV 3.0 (just 2.4.8) on Raspberry PI so don't have any softcascades test results to share, but it sounds promising.
Another idea I can think of is using LBP cascades. You could start with a HAAR since there's one already for detecting bodies so it would be easy to test, but LBP should be a bit faster. Perhaps you could train a cascade that works really well for a set environment.
Also, if it helps, you can use my little OpenCV wrapper for the PiCamera for tests. It basically returns frames from the Pi Camera module as cv::Mat.
I've had openCV running on a PI, using a USB video grabber, as I am using a CCTV camera. I use Python.
It runs fine (for what I want to do), but you need to limit the resolution.
It's slower than a PC (2ghz dual core) but still works.
I have read that openCV does not recognise some webcams.
Can you suggest some webcams for a basic stereo-vision project using the following?:
openCV 2.2.0
Visual Studio 2010 (C++)
Windows 7 32 bits
Thanks.
I posted a similar question back then.
Good and compatible webcam to do image processing/computer vision?
What kind of camera you are looking for? Any model? State the model and I let you know if it's good enough.
Also, you can find a list of compatible webcams with openCV. It's an old list though. They stopped updating it since 2013, I think. Compatible webcam with openCV
You find that most common brands like Hp, Logitech, etc should work just fine. If you are worried, just state the model you are looking at in the comments. I see if I know if it's compatible with openCV.
EDIT:
To answer your question in the comment, nope, that shouldn't be the case. All cameras can run simultaneously at the same time. Reasons that cameras can't run simultaneously at the same time is usually due to the USB bandwidth. In fact, most cameras pose the same problem.
Some methods to overcome that problem:
1)put a Sleep(ms) in between the lines of your capture line.
2)Use lower resolution which would reduce the bandwidth used by each camera.
3)Use MJPEG format(compressed frames)
I've been researching for a while and found tons of helpful resources on this subject, but I figured I would lay down my specifications here so I can get some recommendations from people experienced in this area. It seems like Beaglebone and Raspberry Pi with a Logitech or Microsoft camera are my best options at this point.
My target speed is 50 fps (20 ms per image) with the processing involved. From what I've looked at, this doesn't seem feasible considering most webcams don't go much past 30 fps. More specifically, I need to take the endpoints of an object (like a sheet of paper) and calculate where the midpoint is. Nothing incredibly fancy. 1080p isn't a requirement, I can most likely go much lower. Python is preferable over C and C++ since I've already done a lot of image processing with Python.
It looks like a lot of the code I'll be needing is mostly open-source already, so I really just need to figure out what controller/camera combo I should be using.
It's still a bit of a toss up between the two however here are my views.
The BBB will use a USB web cam and that will take a certain amount of processing power just to get the image. After that you can then manipulate it with SimpleCV
The RPi has a camera board that they say will only use < 3% of the cpu and the rest can be used for processing your image. Plus you can over-clock the RPi to 1Ghz.
Using the RPi with a basic webcam does not give a very good result, whereas the RPi camera works directly on the CSI bus and is set to do 1080 dpi natively. Plus they now have drivers for the camera that work with SimpleCV too.
IMHO I would say that the RPi B and Camera board would be technically faster that the BBB, but it also depends on what manipulation you plan to do :
Marc
I have some code that I have adapted to run on a headless Rpi using a usb webcam, it is running a bit slow, so my questions are:
If I were to use the GPI pins with a dedicated webcam would that be faster?
Is there any way to speed up my code for Rpi?
Where can I get a Rpi webcam?
My code is here, I struggle to paste inline so its a link
For your question about where to get a Pi camera, a new camera has recently been release. I don't know about speeding up you code, but you might want to overclock your Pi. Good luck,
Like Quentin suggested, a dedicated Camera (in our case, Rpi camera link : http://www.raspberrypi.org/camera) should work much faster than USB webcams as it is known to use GPU for encoding / decoding process instead of using CPU.
(Source : http://www.raspberrypi.org/phpBB3/viewtopic.php?t=55798)
You can try reducing width and height of the frame for better performance in terms of speed.
Also you're using Iplimage* which is no longer supported in new OpenCV versions and replaced by cvMat.
(source: Difference between cvMat, Mat and IpImage)
Hope it helps.