How do I resize a binary image?
Show older comments
I tried using imresize but it is not showing the image I sent in. The white pixels are no longer there and I just have a blank black background. Thank you.
Accepted Answer
More Answers (1)
Josep Llobet
on 6 Aug 2021
Hi there,
Values in the resized image change to non-binary. Then, you can simply turn to binarize the image for filter the values and turn to have a binary image:
I_BW = imread("hands1-mask.png");
%class(I_BW) % <- to see the type of image
I_BW_resize = imresize(double(I_BW), 2);
%unique(I_BW_resize) % <- to see the diferent values (-0.1659, -0.1564, -0.1516...)
%size(I_BW_resize)
I_BW_resize = imbinarize(I_BW_resize);
imshowpair(I_BW, I_BW_resize, "montage");
%size(I_BW_resize)
%unique(I_BW_resize) % <- to see the diferent values (1, 0)
With the MATLAB app Image Viewer. Using the button
you can see the pixel values. For call the app you can do as the example:
imtool(I_BW_resize)
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!