MATLAB: How to use slider for image processing

Image Processing Toolboxsliderthreshold

Hello guys, I want to ask about slider in GUI. How do I use the slider for increment level value to thresholding grayscale image and then show it in the axes box? I hope you guys understand,please help me.

Best Answer

First set up the min and max properties, like 0 and 255, either in GUIDE or in your code. Then, when you need to use its value, get the slider value from any callback like this:
sliderValue = handles.slider1.Value;
Then use it to binarize an image like
binaryImage = grayImage > sliderValue;
imshow(binaryImage);
or however you want to use it.