Question

I'm trying to display the output of 2 webcams in 2 windows using SimpleCV, but what I get with the following code is a sputtering combination in what appears to be 2 different sized windows, merged into one.

cam = Camera(0)
cam1 = Camera(1)
while True:
    cam.getImage().show() 
    cam1.getImage().show()  

I have performed the same operation successfully with C++/OpenCV, but am hoping to dev using Python/SimpleCV.

The SimpleCV docs on show() which I've found aren't very verbose. Any leads?

Was it helpful?

Solution

Sadly pygame only supports a single window which is the library we use to render the display. You could always use some other type of library to display them separately like GTK.

Another hack is to use the side by side function:

cam = Camera(0)
cam1 = Camera(1)
while True:
    i1 = cam.getImage()
    i2 = cam1.getImage()
    i1.sideBySide(i2).show()

I should mention you could always use two JpegStreamCameras as well:

cam = Camera(0)
cam1 = Camera(1)
js = JPegStreamer()
js1 = JPegStreamer(8081)

while True:
    js.save(cam.getImage())
    js1.save(cam1.getImage())

Then in your web browser go to: localhost:8080 localhost:8081

Each should show a separate camera.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top