Changing Sensitivity of 'Imbinarize' using a slider
Show older comments
Hey guys,
I´m binarizing Images using Matlab and try to figure out the right sensitivity value for each image. Therefore a slider would be quite useful.
How could this be done?
Here is my code so far.
clf()
I= imread('Bild_1.jpg'); %input
I=I(:,:,1); %Selecting a colour
I = imbinarize(I,'adaptive','ForegroundPolarity','dark','Sensitivity',sens); %turn grayscale image in binary image
%sens is my variable
imshow(I);
fig = uifigure();
fig.Position([3,4]) = [400,75];
sld = uislider(fig,'Position',[50,50,300,50],'Value',1,'Limits',[0,1],...
'ValueChangedFcn', @(sld,event)changeSensitivityFcn(sld,event));
function changeSensitivityFcn(sld, event)
sens=sld.Value
drawnow()
end
I hope you can help me.
Greetings
Here is a related question i asked about the sliders
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic 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!