How can I solve error: Arrays have incompatible sizes for this operation?

조회 수: 4 (최근 30일)
yasmin ismail
yasmin ismail 2023년 10월 9일
댓글: yasmin ismail 2023년 10월 9일
I run the matlab code and had an error that Arrays have incompatible sizes for this operation. I want a solution to it which again can apply to different images...
The operation that I used is :
A = logical(imread('7001-236.png'));
BW_groundTruth =logical(imread('Label7001-236.png'));
similarity = jaccard(A, BW_groundTruth)
Arrays have incompatible sizes for this operation.
Error in jaccard (line 126)
if any(size(A) ~= size(B))
Error in GT_jac_index (line 9)
similarity = jaccard(A, BW_groundTruth)
I tried to apply the following code to fix it but not workiking
image2=imread('Label7001-236.png');
newIm = imresize(image2, [309, 310]);
imwrite(newIm,"Label7001-236.png")
still have same error, how to fix it?
  댓글 수: 8
Stephen23
Stephen23 2023년 10월 9일
편집: Stephen23 2023년 10월 9일
Note that SQUEEZE does absolutely nothing there, you can safely get rid of it:
similarity = jaccard(A(:,:,1), BW_groundTruth)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by