Why i get this error

8 ビュー (過去 30 日間)
Syeda Noor
Syeda Noor 2020 年 12 月 25 日
コメント済み: Walter Roberson 2020 年 12 月 27 日
Undefined operator '&' for input arguments of type 'matlab.graphics.primitive.Image'. why i am getting this error. i have to multiply 2 binary images pixel by pixel in matlab. groungtruth and output are two binary images. both are same but are segmented with two different techniques.
function r=eval_metrics(output,groundtruth)
TP_image=groundtruth&output;
TP=sum(TP_image(:));% # of hits (True Positive)
FN_image=groundtruth&~output;
  2 件のコメント
Image Analyst
Image Analyst 2020 年 12 月 25 日
編集済み: Image Analyst 2020 年 12 月 25 日
Before the error, put this:
whos output
whos groundtruth
What do you see in the command window? How did you actually get the image that is not a logical array but is actually of type 'matlab.graphics.primitive.Image'?
where we're not sure if you've accepted an answer or not and never attached your image so people can run your code. If so, then why? If not, what's the difference?
Rik
Rik 2020 年 12 月 27 日
Not really the Christmass spirit, to edit away your question. I restored it from the Google cache.

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

採用された回答

Steven Lord
Steven Lord 2020 年 12 月 25 日
編集済み: Steven Lord 2020 年 12 月 25 日
Generally you're going to want to perform arithmetic and/or logical operations on the image data not the image graphics object.
im = imread('eight.tif');
h = imagesc(im);
whos im h
Name Size Bytes Class Attributes h 1x1 8 matlab.graphics.primitive.Image im 242x308 74536 uint8
Arithmetic and logical operations are defined on variables of class uint8 but not on variables of class matlab.graphics.primitive.Image.
im(1, 1) & im(1, 2) % works
ans = logical
1
h(1, 1) & true % does not work
Operator '&' is not supported for operands of type 'matlab.graphics.primitive.Image'.
  13 件のコメント
Syeda Noor
Syeda Noor 2020 年 12 月 27 日
編集済み: Syeda Noor 2020 年 12 月 27 日
Yes from original color image. Image is in round shape
Walter Roberson
Walter Roberson 2020 年 12 月 27 日
You have not posted a sample image.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by