Question

I want to use two cameras for my raspberry pi. So I want to know camera index number of each cameras. So what is the way to find the camera index no in raspbian OS?(The index numbers use to make camera object in Simple CV)

Was it helpful?

Solution

From what I can tell, referencing the book Practical Computer Vision with Simple CV...

On Linux, all peripheral devices have a file created for them in the /dev directory. For cameras, the file names start with video and end with the camera ID, such as /dev/video0 and /dev/video1 . The number at the end equals the camera ID.

And as far as telling which camera number goes to which device (also from the book)...

from SimpleCV import Camera

# First attached camera
cam0 = Camera(0)

# Second attached camera
cam1 = Camera(1)

# Show a picture from the first camera
img0 = cam0.getImage()
img0.drawText("I am Camera ID 0")
img0.show()

# Show a picture from the first camera
img1 = cam1.getImage()
img1.drawText("I am Camera ID 1")
img1.show()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top