C++ image processing
I'm implementing a laplacian mask image enhancement in Visual studio. I'm using a simple 3x3 mask of -1 -1 -1; -1 9 -1; -1 -1 -1 on some jpg; Applying the mask is easy. But I'm not sure what's the proper way to scale the output.
The input image has a very uniform histogram(high contrast). After applying the mask for edge enhancement, I ended up with most graylevel clustered slightly to the left of the center. Thus, linearly mapping the pixels back to the [0, 255] range result in an image with poor constrast.
Am I missing something here? What's the better way to remap the pixels?
Or am I suppose to use power-law transformation to spread out the histogram?
PS: power-law transformation is out = c * in^gamma. Is there a built-in function somewhere that can handle the in^gamma exponential(in is int[0-255], gamma is float [0-100])?
Like the pow() function in cmath ?
Still can't make the image to look right. Histogram equalization is the closest I got but it stretches the contrast a bit too much. ie. previously black background becomes grayish.