2
$\begingroup$

How can I take the image data of the area around a max?

img = Import["https://i.sstatic.net/YDCGF.png"]
markers = MaxDetect[GaussianFilter[img, 10], Padding -> 1]; 
HighlightImage[img, markers, Method -> {"DiskMarkers", 5}]

image

image with marker

I would like to take the image data of the shape it is within like:

image with border

Update: I made a brute force version using ImageTrim[] and PixelValuePositions[] but this is just using a approximate square around the max detect point

$\endgroup$
3
  • 2
    $\begingroup$ I don’t understand how the boundary of the region is determined. $\endgroup$
    – C. E.
    Commented Feb 27, 2021 at 14:30
  • $\begingroup$ @C.E. It is just a freehand example of the region I would like to detect $\endgroup$
    – Teabelly
    Commented Feb 27, 2021 at 16:35
  • $\begingroup$ If it is not part of the question how to compute it, please provide it so we have an example region to work with in the form that you have it. Otherwise it can easily happen that we write an answer using an example region but then you have a problem applying this to your problem because your region is expressed in a different way. If it is part of the question how to compute the region, please describe how the region is supposed to be computed. $\endgroup$
    – C. E.
    Commented Feb 27, 2021 at 17:01

1 Answer 1

2
+50
$\begingroup$

I am not sure I understand exactly what is required but I'll try something. In the last image all pixels are set to 0 except in the areas of interest (where the pixels of the original image are shown).

img = Import["https://i.sstatic.net/YDCGF.png"]
markers = MaxDetect[GaussianFilter[img, 10], 0.03, Padding -> 1]
comp = ImageMultiply[img, markers]
data = ImageData[comp];

enter image description here

$\endgroup$
1
  • $\begingroup$ Is there a way I can keep track of CompenentMeasurements from picture to picture? For exammple if the next picture there is another spot to the left, the identifier will shift 1,2,3? $\endgroup$
    – Teabelly
    Commented Mar 1, 2021 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.