-2

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)

hern-04
  • 13
  • 1

1 Answers1

1

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   
  • Thank, understood it now with your explanation. How did you learn Halcon? I am learning through the documentation but get stuck on some things sometimes. Is there anything you recommend to learn it? – hern-04 Sep 02 '20 at 19:37
  • if you have installed it locally, the documentation will link to examples, I found these the most helpful. You can also access them through the %HALCONEXAMPLES% environment variable. – SchillerFalke2 Sep 03 '20 at 08:17
  • I have followed that route as well. It helps a lot but I just feel there's stuff missing that is not explained and you have to have to spend to much time to research about that one thing or else things won't make sense, at least that is for me. I'm still keeping at it though, see how far I can go. I actually got a trial license and that's what I've been working with but it's about to expire, do you know if there is a community version of this which will only be used for practice and learning? – hern-04 Sep 04 '20 at 18:45
  • the only thing I am aware of is a campus-license: https://www.mvtec.com/company/on-campus/licenses/ not sure where this is available, but maybe it's worth getting in touch. – SchillerFalke2 Sep 21 '20 at 08:23