Say we had an image we somehow modified via openCV:
And now we would love to apply to it Gradient Map (like one we can apply via photoshop):
So I wonder how to apply gradient map (rainbow colors) via openCV?
Say we had an image we somehow modified via openCV:
And now we would love to apply to it Gradient Map (like one we can apply via photoshop):
So I wonder how to apply gradient map (rainbow colors) via openCV?
Here is a method to create false/pseudo-color images using Python, conversion to c++ should be very straightforward. Overview:
There are a couple of catches though...
180 / 256.0
from: to:
If this is important to change we can do so by offsetting all the hue elements and wrapping them around 180 (otherwise it will saturate). The code does this by masking the image at this cut off point and then offsetting appropriately. Using an offset of 120, generates your colorscale:
from: to:
and the image processed this way seems to match yours very well (at end).
Your image processed with
offset = 120
:Now exists the openCV function called applyColorMap which makes this process trivial. The following code will do the trick
And this is the result:
Figure 1: Original plane Figure2: Plane after applying colormap