I am new to openmv and confused by seeing the use of thresholds everywhere but I can’t find any documentation on the subject. Can someone please point me to where I can find thresholds explained? I would like to know: what they are used for; why they are used; how to define and use them; and what the parameters are. Apologies if I have missed something obvious.

Hi, yeah, sorry about the lack of documentation… That’s not going to be fixed for a little while.

Um, please see the Tools -Machine Vision -Threshold editor in OpenMV IDE. This will let you pick LAB or grayscale thresholds using OpenMV IDE. That is, if you are doing something involving color tracking.

As for other thresholds on functions, so please understand that when working with computer vision methods you have to tune parameters to get the best results. When you see things like the threshold for find lines it’s used to filter out how many detections you want.

Um, I can answer better if you can ask a more specific question. Please let me know where exactly you need help.

Thank you for that prompt reply. And thank you and all those involved for producing this system and making it freely available, we amateur experimenters are very fortunate to have such clever facilities to use and save us a lot of work if we didn’t have them. Very much appreciated. My project is a die rolling machine to test the fairness of deliberately loaded dice for statistical experiments. I’m giving a talk on some aspects of statistical analysis in November. So I want to use my Openmv Cam M7, just received, to to be able to count the black spots on a white die on a black background. Of course the exact shades of back and white will vary according to the lighting, and the orientation of the die and its location on the image will vary randomly from roll to roll. I will be grateful for any help.

Further to my post just now, I am trying out the “” from the examples which puts a white rectangle round the white die. I need to adapt it to pick out the pips on the die itself. Again I would be grateful for any help in achieving this.

Okay, cool. Yeah, so, please use the histeq() method on the image to stabilize the contrast after turning white balance and autogain off. Then you should see a very contrasty image. After which, open the threshold editor from OpenMV IDE. It’s under tools/machine vision.

Once you so that you’ll be able to drag some sliders for grayscale mode to select the grayscale thresholds to detect the die.

Not that doing what you want is easy and needs to be done in two steps. First you want to find all of the die ROIs. This means the first threshold looks for all the dies in the image against the background. Then once you have those ROIs you then call find blobs again with a new threshold for the pips on the die targeting just the die ROIs. Finally, you only want to count pips which aren’t connected to the edge of the die because that might be the background.

I can write a simple piece of example code for you but it will take a while because I don’t have time right now.

Thanks for that advice, looks good. It’s late here in UK now, I’ll try it out tomorrow. And thanks for our time and trouble in responding to my request, much appreciated.

After a day on this, and following your advice, I am well on the way to solving the problem, again thank you very much for you help.

Let me know if you need anything else. :slight_smile: