Camera Properties not changing
Melissa from United States [2 posts]
I am having some difficulty with camera properties working with Logitech Webcams (I am not sure their exact model) but they work fine with roborealm as long as I go through options and set them to YUY2. However, I have camera properties set as the first line of my program...shouldn't that set the camera? It isn't I am only getting a black screen with a thin line of noise on the bottom.
It is becoming a problem because I am switching between two and I have to do it manually (by going through options). I am calling the camera switch through python and that works great...its just my second camera is the black screen.
any help would be appreciated!
Anonymous from United Kingdom [99 posts]
I have just been working on getting two cameras working in python.
I create two API instances using:
# initialize the API class
RR_port = '-api_port '+str(RR_port_Num)
print "opening API"
#Changed to match my path
temp = 'C:\Program Files\RoboRealm\Roborealm.exe '+RR_port
process = subprocess.Popen(temp)
print "Camera started successfully"
print "No Camera Connected"
print "Check path in Popen statement to make sure it points to your Roborealm executable"
rr = RR_API()
#connect to RoboRealm Make sure that Roboream is open and Running the API server
rr.Connect("localhost",RR_port_Num) #Connect has been modified to take port #
print "API Server is not running!"
Here is the slight mod to Connect:
def Connect(self, hostname,port_num):
Now I also had trouble with the Logitech cameras!
If I call:
rr.SetCamera(camera) #where camera is a string with the name of the camera in it.
That works SOME of the time. The Logitech cameras want to load their own driver, which messes with some of the settings. (IE it alwasy seems to drop back to 320x240 and when I check my roborealm instance, the logitech camera is not listed as selected.
However, if I do an initialization by calling:
camerastring = "<Camera_Properties> \
<camera>Logitech Quickcam Fusion</camera> \
<video_size>640 x 480</video_size>\
print"Failed to find Camera on Robot!"
It works great! You need to clear this initialization by executing your new filters as doing the camera initialization seems to take lots of cycles. You will also want to replace my "Quickcam Fusion" with whatever camera you have.
Hope this helps!
Probably the best way to do this is to keep both cameras active and just switch between the two using a software flag. Switching or starting/stopping cameras is the most risky and slowest procedure in Windows. Risky in the sense that if something is going to go wrong with a camera it will be at startup.
So what I would do is config the current camera, switch to the other using the options dialog and config that too. Then use the Marker module to add the second camera in the pipeline such that unclicking the Run button would show one camera view and pressing the Run button would then run the Marker module which would then show the second. Thus both cameras are running but only one is in view at a time. From here you can then just reference the appropriate image.
This makes some big assumptions in that both cameras are always connected to the machine. If not, can you describe a bit more about the reason why you are switching between the two frequently?