Python in camera mode
Thomas Wagner from Germany  [51 posts]
9 year

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?



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

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.

Anonymous 9 year

thanks for the explanation, that helped.


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