How to add slider to figure ? manual thresholding
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi
I have a an image that I want to add a ui to threshold manually. code below
im = imread('image.png);
for i = 1:rows
for j = 1:cols
if(im(i,j) < threshold)
out(i,j) = 0;
elseif(im(i,j) > threshold)
out(i,j) = 1;
end
end
end
imshow(out);
how do I add a slider that can manually change the threshold in the figure ? help thanks
0 commentaires
Réponses (2)
Jan
le 7 Fév 2016
At first simplyfy your code to the single line - assumed, that you do not want to keep the values of im==threshold:
out = double(im > threshold);
0 commentaires
Image Analyst
le 7 Fév 2016
See how I did it in my interactive thresholding app: http://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image
Basically put down a slider on your GUI. Then in your code, get its value
threshold = get(handles.sldThreshold, 'Value');
Then use that. It would also be nice if you use line() to place a vertical bar over the histogram like I do. This is extremely helpful to the user.
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!