How do I code to preform binary thresholding on image C? With the threshold values being .25,.63, and .89? And then display the images obtained and label the thresholds used in the plots.

1 次查看(过去 30 天)
a=imread('C:\Users\Nathan Donatell\Pictures\SanDiego.jpg');
g = rgb2gray(a);
b = im2double(g);
c= mat2gray(a);
D1=c .^(1/4);
D2=c .^(1/2);
D3=c .^(2/2);
D4=c .^(3/2);
subplot(2,4,1); imshow(D1); title('1/4');
subplot(2,4,5); imhist(D1, 256*1/4);
subplot(2,4,2); imshow(D2); title('1/2');
subplot(2,4,6); imhist(D2, 256*1/2);
subplot(2,4,3); imshow(D3); title('2/2');
subplot(2,4,7); imhist(D3, 256*2/2);
subplot(2,4,4); imshow(D4); title('3/2');
subplot(2,4,8); imhist(D4, 256*3/2);
  1 个评论
Walter Roberson
Walter Roberson 2018-11-10
What did you find when you searched the MATLAB documentation for information about thresholding?
I have already given you code to show you how to process images and display them and label them: where is your contribution in this?

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2018-11-11
Try this:
bw1a = D1 < 0.25;
bw1b = D1 < 0.63;
bw1c = D1 < 0.89;
bw2a = D2 < 0.25;
bw2b = D2 < 0.63;
bw2c = D2 < 0.89;
Same for D3 and D4. That thresholds your images to create binary images. Then use subplot() and imshow() to plot the 12 images.

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by