In order to calculate true positive and false positive and the like, you need to have a reference telling you what each pixel really is. True positive would count the places that you predict that a region is part of a segment and the reference tells you that Yes, the region really is part of a segment. False positive counts the places that you predict that a pixel is part of a segment but the reference tells you that it is not part of the segment. True negative counts the places that you predict that a pixel is not part of a segment, and the reference tells you that indeed the pixel is not part of a segment.

Any kind of segmentation like that almost always has a parameter whose value can be moved through a range of values, and the segmentation regenerated, and the positive/negative counts recalculated. You can generate a data point on a curve for each of the four different combinations for each distinct parameter value you try out, so you can plot those with changes in value.

But you need a reference of what each pixel really is -- you need a "ground truth" to calculate this.

You might wonder why you would bother doing any of this if you already have a reference image. The point is that you would have a number of images with known results that you would use to "train" the routine to get the best overall results. Once you have that, you can apply it to images for which the results are not known, and you would have an idea of how good you should expect the outcome to be based upon how well it did on the known images.

## Best Answer