Can someone explain what the percent parameter is for on the min_mas_grey() operator in Halcon?
min_max_gray(Regions, Image : : Percent : Min, Max, Range)
Can someone explain what the percent parameter is for on the min_mas_grey() operator in Halcon?
min_max_gray(Regions, Image : : Percent : Min, Max, Range)
The documentation for this operator can be found here:
https://www.mvtec.com/doc/halcon/2005/en/min_max_gray.html
To elaborate a little on the explanation if you are having trouble following it:
calculates the number of pixels Percent corresponding to the area of the input image. Then it goes inwards on both sides of the histogram by this number of pixels and determines the smallest and the largest gray value
Essentially, if percent is 0 you will obtain min/max as you'd expect however if you give a percentage it will subtract this percentage (as a pixel value) from either side of the histogram and give these values as min and max instead. If percent is 50 that then means min and max are the same and signify the median.
Let's look at a simplified example:
image in an image with 10 pixels who have the following values:
[0, 0, 1, 2, 3, 3, 3, 3, 4, 5]
The histogram would be like this:
0: 2
1: 1
2: 1
3: 4
4: 1
5: 1
If percent is 0 then min = 0 and max = 5.
Percent 10 would mean you take one pixel away at the edges of the histogram, thus min = 0 and max = 4...
percent 20, equals 2 pixels and thus min = 1 max = 3
percent 30, equals 3 pixels thus min = 2, max = 3
percent 50, min=max=3 which is the median