Count the no of Black pixels in the image .

4 ビュー (過去 30 日間)
MJ Thangaraj
MJ Thangaraj 2016 年 4 月 23 日
コメント済み: Walter Roberson 2016 年 4 月 23 日
I get the Image after processing using the code below. Now i have to find the black pixels that are cracks
%%Load Image
i=imread('coor.jpg');
imshow(i);
%Image Adjust
adj=imadjust(i,stretchlim(i));
imshow(adj);
%%Convert RGB to Gray
gry=rgb2gray(adj);
imshow(gry,[]);
%%Image segementation by thresholding
level=0.09;
thres=im2bw(gry,level);
imshow(thres);
% Image morphological operation
bw=bwmorph(thres,'clean',20);
imshow(bw);
%%End

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 4 月 23 日
sum(bw(:) == 0)
  2 件のコメント
MJ Thangaraj
MJ Thangaraj 2016 年 4 月 23 日
What if i have to find the WHITE pixels
Walter Roberson
Walter Roberson 2016 年 4 月 23 日
sum(bw(:))
or
nnz(bw)

サインインしてコメントする。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by