Improving contrast in an image plot - PLplot

125 views Asked by At

I am using PLplot to plot a 2D matrix as a grayscale image. However, since the 2D matrix contains some very high values and since the color scale is linear, most of the image becomes dim and barely visible.

This is how I am plotting the 2D matrix (called z):

plimage((const PLFLT * const *) z, XDIM, YDIM, 1., XDIM, 1., YDIM, 0., 0., 1., XDIM, 1., YDIM);

I guess this should be fixed if the contrast or the color scale is adjusted in some way.

Can someone please help?

I prefer not to use an external library if possible (like OpenCV for example).

1

There are 1 answers

0
shoham On BEST ANSWER

to increase the global contrast of an image you can use histogram equalization(before you plot).

histogram equalization example:

this shows the original and stretched histograms.

histogram equalization example

hope this helps.