How to add slider to figure ? manual thresholding
6 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Jan
2016 年 2 月 7 日
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 件のコメント
Image Analyst
2016 年 2 月 7 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!