i am working at a color deconvolution using Ruifrok and Johnston's method (as described here).
To get a custom stain, I need to realize a vector with mean RGB values of a region in a given image. So far I worked with the mean RGB value of multiple locators using a locator pane and auto-create, but I am wondering if there is a function I didn't see to let the user select a whole region and calculate the mean RGB value for that chosen region.
I hope anybody can give me a hint.
Edit:
I am adding an excerpt of my code to concretise my problem.
Manipulate[Column@{Show[z], u = ImageValue[z, Mean[pts]]},
{{pts, {{1, 1}}}, Locator, LocatorAutoCreate -> True}]
As you can see I am calculating the mean value of 6 locator image values.
Instead I want to achieve a calculation of a whole area. For example the user sets 4 Locators and the area between them is used for this calculation. Or is there an implemented function in Mathematica?
Edit 2:
Manipulate[Column@{Show[z, Graphics[{EdgeForm[Thick], Opacity[0, White],
pol = Polygon[pts]}]], u = ImageValue[z, Mean[pts]]}, {{pts, {{1, 1}}},
Locator, LocatorAutoCreate -> True}]
I continued my work and had the idea of using "ImageMeasurement" combined with masking but unfortunately I cannot use a transparent white polygon acting as the mask to convolve
{Button["Measure", ImageMeasurements[z, "Mean", Masking -> pol]]},