How to use image labeled resulted from Image labeler App (black image) to calculate jaccard Index?
조회 수: 4 (최근 30일)
이전 댓글 표시
I used pixel label from image labeler App and after I finished labeling I used Export to file . Then I opened the file which created called PixelLabeData and I found the labeled image is totally black and the label not shown, I undertsand that I have to use the following code to let label appear
figure;
[i, m] = imread('Label_1.png');
imshow(i,m)
but then I want to use this labeled image in the following equation to calculate jaccrad index, but the image is totally black
A = logical(imread('7001-236.png'));
BW_groundTruth =logical(imread('Label_1.png'));
similarity = jaccard(squeeze(A(:,:,1)), BW_groundTruth)
similarity =
0.0925 because label image is black
so how to fix it?
답변 (1개)
Gayathri
2025년 2월 13일 6:17
The "7001-236.png" image is a RGB image. So rather than using one channel of the image, it is better to convert it to a grayscale image before further processing. And it would not be a good idea to use the "logical" function on this grayscale image as this function would just put '1' in all pixel values greater than 0.
You can find more about the "imbinarize" function in the below link.
We can use the "imbinarize" funtion, which will binarize the image with a suitable threshold. Then these binarized images can be used to calculate the Jaccard Index as shown below.
I1=imread("Label_1.png");
I2=rgb2gray(imread("7001-236.png"));
B1=imbinarize(I1);
B2=imbinarize(I2);
similarity=jaccard(B2,B1)
I know that there is no much increase in the similarity value, but this approach will work fine for finding Jaccard Index.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!