How to use the color thresholder app in a script

2 vues (au cours des 30 derniers jours)
GMabilleau
GMabilleau le 3 Avr 2019
Modifié(e) : GMabilleau le 4 Avr 2019
Hi!
I'm trying to write a script to open an image in the RGB color space with feature of interest in blue. Next, I would like to call in in the script the color thresholder app and then to use it to interactively select this feature in the hsv space and export the binary image, named BW to the workspace.
I'm scripting it as I will have a lot of images to run. However, these images will have different shades of blue and it is not possible to apply the same saturation limits on all images and hence the reason for doing it interactively.
I don't know how to wait for the export of the binary image from the color thresholder app by the user before executing the rest of the script.
I'm using Matlab R2016b.
Any help would be greatly appreciated.
Here is the script that I have written so far:
[FileName,PathName] = uigetfile({'*.jpg';'*.tif';'*.png';'*.*'},'select image file');
image = imread(FileName);
figure; imshow(image);
colorThresholder(image);
BW = bwareaopen(BW,100);
BW = imfill(BW,'holes');
objperim = bwperim(BW);

Réponse acceptée

GMabilleau
GMabilleau le 4 Avr 2019
Modifié(e) : GMabilleau le 4 Avr 2019
Hi!
Finally I found a way to do the job by creating a message box and wait for the user to click "ok" into this message box.
Here is the code if it can help others:
[FileName,PathName] = uigetfile({'*.jpg';'*.tif';'*.png';'*.*'},'select image file');
image = imread(FileName);
figure; imshow(image);
colorThresholder(image);
uiwait(msgbox('This message will pause execution until you click OK'));
colorThresholder close;
BW = bwareaopen(BW,100);
BW = imfill(BW,'holes');
objperim = bwperim(BW);

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Produits


Version

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by