Ask user to adjust color threshold and use those setting for subsequent live image acquisition/analysis
Show older comments
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?
Answers (1)
Image Analyst
on 10 Jun 2022
0 votes
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.
7 Comments
Cesar Arevalo
on 11 Dec 2023
I have a similar problem and that's why I want to adjust the threshold setting (HSV) for each image and somehow automate it. I have 72 images to process. Please see the images in the link below.
Using the known A4 surface I try to determine the tyre contact area.
Could you please give me some advise in the setting of the threshold? or should I use another color space? How would you set the thresholds?
Thanks
Image Analyst
on 11 Dec 2023
@Cesar Arevalo we can't get in. Attach 3 or 4 of the images with the paperclip icon. Start a new discussion thread. I'm pretty sure it would be best to use a fixed threshold.
Cesar Arevalo
on 11 Dec 2023
Image Analyst
on 11 Dec 2023
Is that a duplicate question? Why would you want to discuss this in two separate threads? Pick one and go with it. If it's this one, attach them here. Let's make the discussions self contained. Make it easy for us to help you, not hard.
Cesar Arevalo
on 11 Dec 2023
@Image Analyst Sorry. I understood from your 1st answer that I should post a new question...
Attached the images
Many thanks
Image Analyst
on 11 Dec 2023
Oh, right. You should. This is @Scott Kaiser's question, so let's not bug him with lots of emails about activity in his thread that he doesn't care about.. Did you also attach the images there in your question?
Cesar Arevalo
on 12 Dec 2023
Edited: Cesar Arevalo
on 12 Dec 2023
Categories
Find more on Image Preview and Device Configuration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!