% I want to crop the front face of dice and identify the number on it. I tried the following
A=imread('dice.png');figure,imshow(A); title('Original Image');%Convert the Image to binary
B=im2bw(A);%Fill the holes
C=imfill(B,'holes');%Label the connected components
[Label,Total]=bwlabel(C,8);figure,imshow(C); title('Labelled Image');% then I did the following
D=imsubtract(B,C);imshow(D);%
where Background is black, dice is white with black dots. But WHEN BACKGROUND IS NOT PERFECTLY BLACK THEN IT CREATES PROBLEM. CAN YOU PLZ TELL ME HOW REMOVE BACKGROUND AND CROP ONLY DICE PART?
Best Answer