loading
 
Python in camera mode
Thomas Wagner from Germany  [51 posts]
10 year
STeven,

the attached program works with multiple images from file.

If I switch a camera on, it works with a single sudoku.

Now if I move the camera from one sudoku to the next (and you might be able to simulate this with printouts if you don't have dusokus at hand), the OCR reslts don't update properly in a way that in rr line 34, the script does not execute with error in line 17. I have to reload and run the Python script in line 34 after one sodoku was detected successfully, then resuolts get updated immediately.

In case that one of these python modules experiences an error (e.g. OCR variable missing, which can happen in on eof the live images), what wold happen, does that module not go back to normal operation with the next frame of the live image?

Thanks,

Thomas

(PS: Your Category/Module list is down again, that's why module is EDV-DVR instead of Python 2.x)
program.robo
Steven Gentner from United States  [1446 posts] 10 year
Thomas,

Its always important to test for the presence of a result. The script will fail when no puzzle is visible since the bounding box will be null. If you test the ocrResults using an if statement at the beginning of that script you can exclude it from failing when nothing is present.

Once an error happens the script will NOT reexecute but simply show the last error until a manual command to Reload and Run is performed. This is important otherwise the next image (possibly within milliseconds) would remove the error. The point is that the script should function for all possibilities of the data ... this is like any other program one would write.

In VB we also test that arrays are arrays and that their lengths are good too. That's the best way to avoid errors in any programming even in python.

STeven.
Anonymous 10 year
STeven,

thanks for the explanation, that helped.

Thomas

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