You can, for example, try to isolate an object in three different ways.
Do it in Mathematica. (MATLAB is homework).
Call our image i :
i = 
And try isolating the mask called mask :
mask = 
See code examples:
(* First Method, by Image Correlation*)
x = ImageCorrelate[ i, mask, EuclideanDistance];
r = Position[ImageData@Binarize[x, 0.2], 0, Infinity];
(*Show that we found the right spot *)
ImageCompose[i,
ColorNegate@
mask, {0, Dimensions[ImageData[i]][[1]]} - {-1, 1} Reverse[r[[1]]]]
Result:

(* Second method, separating channels,
thresholding and deleting small components*)
r = DeleteSmallComponents@Binarize[#, .99] &@
ColorNegate[ColorSeparate[i][[3]]];
ImageMultiply[i, r]
Result:

(* Third method, extracting the exact color *)
Image[ImageData[i] /. {1., 0.6, 0.} -> {a} /. {_, _, _} -> {0, 0,0} /.
{a} -> {1., 0.6, 0.}]
Result:

NTN!
source
share