Reputation: 1
I need to capture frame from a DSLR camera. I know that i can use Videocapture cap(0); for capture from default webcam. If i connect with usb the camera and run the code, It seems like he cant find the camera. What should i do for capture from the DSLR?
Upvotes: -1
Views: 895
Reputation: 15523
You can use GPhoto2 to talk to most DSLR cameras with Python. It will allow you to capture pictures that you can then load into OpenCV with:
array = np.asarray(camera_data, np.uint8)
image = cv2.imdecode(array, cv2.IMREAD_COLOR)
Upvotes: 0
Reputation: 1124
In general, I have found getting OpenCV to work with anything besides a basic webcam almost impossible. In theory, I think it uses the UVC driver, but I have had almost 0 luck getting it to read. One thing you can try is using VLC and see if you can capture a video stream from your camera with it. If you can you might get lucky and figure which camera or video device the DSLR actually is.
If your DSLR has a development SDK maybe you can capture frame using their interface and then use OpenCV for processing. I do this for a project. I have a 3rd party SDK that I use to find and control the camera and them I move the video data into OpenCV (EmguCV) for processing.
Doug
Upvotes: 0