Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

unxnut's suggestions is probably the right way to go at this, but I found a quick hack that gets me mostly what I want:

To stretch an image so the topmost few pixels are clipped:

  • cvErode srcImage n times --> erodedImg // this will remove all the highest localized peaks
  • cvMinMaxLoc erodedImg // this will get the maximum value
  • Scale srcImg * (255.0 / maxValue) // this will set the maximum value of the eroded image to 255 and clip all higher values

removing low peaks works the same, but was not needed in my case