I have a MATLAB code on the script and I have turned into a guide, I have some problem ?? is it possible to help me ??

1 次查看(过去 30 天)
clear all;
close all
clc
grayImage = imread('img1.jpg');
[rows columns numberOfColorBands] = size(grayImage);
if numberOfColorBands > 1
grayImage = rgb2gray(grayImage);
end
I3=double(grayImage)/255;
subplot(3, 3, 1);
imshow(grayImage, []);
title('Original Grayscale Image');
set(gcf, 'Position', get(0,'Screensize'));
set(gcf,'name','Demo by ImageAnalyst','numbertitle','off')
[pixelCount grayLevels] = imhist(grayImage);
subplot(3, 3, 2);
bar(pixelCount);
title('Histogram of original image');
xlim([0 grayLevels(end)]);
binaryImage = grayImage < 150;
subplot(3, 3, 3);
imshow(binaryImage, []);
title('Binary Image');
binaryImage = imclearborder(binaryImage);
subplot(3, 3, 4);
imshow(binaryImage, []);
title('Border cleared');
I2=~binaryImage;
se=strel('disk',3);
I2=imerode(I2,se);
subplot(3,3,5),imshow(I2);
%bw = im2bw(grayImage); % conversion dans une image binaire - fonction im2bw
II = im2double(I2);
Label = bwlabel(II);
E = regionprops(Label,'Area');
[pasbesoin,idx] = sort([E.Area],'descend');
Lbw= Label==idx(2);
figure,imshow(Lbw)
imgf=Lbw.*I3;
figure,imshow(imgf);i;
  1 个评论
John D'Errico
John D'Errico 2018-3-14
Please stop spamming the site with this same question. You asked it here. Now stop adding it as an answer (while still a question) to every question you can find.

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by