How do I separate true positives and true negatives?
<p>Essentially I have a binary image which represents the ground truth and I have a binary image which is taken from the results of an algorithm - now the task was to find the overlapping regions to evaluate the performance of the algorithm, i.e. find the true positives (TPs), true negatives (TNs), false positives (FPs) and false negatives (FNs).</p>

<p>I have correctly found the values for FPs and FNs, however I cannot get my head around how I would separate the TNs and TPs.</p>

<p>The way I calculated the overlaps was by firstly working out the difference between the ground truth image and the algorithm's image:</p>

<pre><code>% Gdilate=ground truth image, img=result of algorithm
ImageComparison = (Gdilate&gt;0)-(img&gt;0); 
</code></pre>

<p>Then simply due to the subtraction I can sum up all the pixels that 0s, 1s and -1s to obtain the TP_TNs, FNs and FPs.</p>

<pre><code>TP_TN = sum(sum(ImageComparison==0))/rows/columns;
FN = sum(sum(ImageComparison==-1))/rows/columns;
FP = sum(sum(ImageComparison==1))/rows/columns;
</code></pre>

<p>Here are the results of <code>imagesc()</code> on the <code>ImageComparison</code> variable:</p>

<p><img src="https://i.stack.imgur.com/Ig3z3.jpg" alt="results of imagesc"></p>

<p>Now I just need to find a way to separate the TPs from the TNs, because they both appear as 0 in the <code>ImageComparison</code> matrix.</p>