Ask user to adjust color threshold and use those setting for subsequent live image acquisition/analysis
2 views (last 30 days)
I'm Attempting to write a target tracking script. So far it is working great. I am tracking the centroid of an orange object in live video from my computers Webcam. But I Realized that my color thresholding script (which I made and exported from the color threshold app) doesn't always work because the lighting in the room that I am capturing images changes. I would like to be able to ask the user every time the script starts running If the threshold parameters look OK, and if not, be able to adjust the parameters, and automatically export and use the new thresholding code. Right now i have to open the thresholding app, change settings, save a new script, and add that new script to my code manually if i want to utilize my new thresholding settings. My question is, once I Prompt the user to Check if a capture image looks OK, how do I Let the user change the thresholding settings and store those settings for all subsequent captured live images?
Image Analyst on 10 Jun 2022
I don't think you can automate that unless you basically build your own thresholding app where you let the users adjust the thresholds looking at the image and histograms.
If they do that and export a script then it will be called untitled.m. Back in your main app you can have them click a button where you can then use some barely documented functions to find that editor window and save it to createMask.m. As long as your main app calls the function by that name, it will use the newly saved one.
However it might be better to just adjust your color thresholds so that it finds them regardless of lighting changes. Can you attach two or three images that show the widest variety of appearances, such that you think you'd need totally different thresholds for each of them? It could be you're unnecessarily restricting the thresholds, like thresholding on value when you should really only threshold the hue channel to get orange.