Create an error function

2 ビュー (過去 30 日間)
udi ibgui
udi ibgui 2019 年 11 月 18 日
編集済み: munue 2019 年 11 月 18 日
Hi,
I have 2 matrices of images, with all values 0 and 1. I would like to compare the two, where i would like to get the number of true positives (where both pixels -at the same postion- are equal to 1), true negatives (both pixels equal to 0), false positives ( where image A is equal to 1 but image B is equl to 0) and false negatives (where image A is equal to 0 but image B is equal to 1).
If I try to extract where A==1 and B==1 etc. and compare it, I get an error because the matrices dont agree.
If I just compare A to B I only get where the match/not match but it doesnt tell me if its a true positive etc.
thank you
  2 件のコメント
KSSV
KSSV 2019 年 11 月 18 日
YOu can use :
idx = A == B ;
Apply your formula on matrix idx.
udi ibgui
udi ibgui 2019 年 11 月 18 日
編集済み: udi ibgui 2019 年 11 月 18 日
What do you mean by apply formula?
The above code shows 1 whenever they match and 0 whenever they dont. It doesnt tell me if the match was becasue they were both 1 or both 0

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

採用された回答

munue
munue 2019 年 11 月 18 日
編集済み: munue 2019 年 11 月 18 日
You can try the following:
A=[1 0; 0 1]
B=[1 0 ; 1 0]
TruePositive_idx = find (A==B & A==1)
TrueNegative_idx = find (A==B & A==0)
FalseNegative_idx = find (A~=B & A==1)
FalsePositive_idx = find (A~=B & A==0)

その他の回答 (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