loading
 
Stop video stream!!!
Khaled  [8 posts]
16 year
Hi,

Is there a way in XML to stop the video stream to RR without turning off the camera?

Thanks...
Anonymous 16 year
If you are using a regular webcam see the

http://www.roborealm.com/help/API.php
Enable/Disable Processing

section of the API. The XML API run command is what you are looking for.

If you are using a module to acquire the image (SRV1, DLInk, etc.) you will need to add a conditional around your entire code based on a variable and set that variable via the API to disable/enable the processing but allow the image to update.

STeven.
Anonymous 16 year
Hi again,

I tried to use the Run comand but no good result!!!
I'm trying to grab a frame, stop the video stream in RR, set the grabed image in RR, make some processing on the image, save the image and then enable the video stream again and so on....

Here is the code that I'm using:

rr.GetImage("", pixels, width, height)
rr.execute("<run>off</run>")
rr.setImage("", pixels, pwidth, pheight)

'processing the image

rr.saveImage("", "RoboRealm\temp\zzz.jpg")
rr.execute("<run>on</run>")      

The problem with this is that the video stream keeps appearing in RR and it is not possible to process the grabed frame!!!

How this problem can be solved???

Thanks.
Anonymous 16 year
The easiest way is to do it all in RR. Simply setup RR to process the image in whatever way you need, then use the write_images module to write the image to disk. Then from your API simply use the run/no run to execute that script.

When you switch of the processing the frame grabbing will continue in preview only mode. If you want to continue down your method you should be switching the camera off using

    rr.setCamera("off");

but I'd not worry about switching RR on or off as you will really decrease the execution speed by doing that. The API is fast but the internal processing of RR is much faster if the script is embedded into RR.

Note that when the camera is switched off the image in RR is the last one grabbed ... so no need to send that image back to RR.

Keep in mind that you can be continuously processing the image and just use the image grabbing API to get the currently processed image to then save using the API. There isn't really a need to switch the processing or camera on/off.

Another way is to use a variable to "trigger" a frame write. Thus the api would do something like:

rr.setVariable("grab_image", "1");

against the loaded script below. The script will do what you need (process for green as an example) and then set the variable to "0" which will then cause the next RR iteration to avoid saving over the last image.

STeven.
program.robo

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index