How to use the color thresholder app in a script

3 Ansichten (letzte 30 Tage)
GMabilleau
GMabilleau am 3 Apr. 2019
Bearbeitet: GMabilleau am 4 Apr. 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);

Akzeptierte Antwort

GMabilleau
GMabilleau am 4 Apr. 2019
Bearbeitet: GMabilleau am 4 Apr. 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);

Weitere Antworten (0)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Produkte


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by