Open CASCADE Technology
6.5.4
|
This class is used to convert :
a PseudoColorImage to a ColorImage
a ColorImage to a PseudoColorImage
a PseudoColorImage to a PseudoColorImage with a
different ColorMap.
To convert a PseudoColoImage to a ColorImage we use
the PseudoColoImage ColorMap to compute the Color of each
Image Pixel ( Lookup operation ) , the resulting image
look similar as the original image.
To convert a ColorImage to a PseudoColorImage or
a PseudoColorImage to another PseudoColorImage we use
Dithering.
A dither operation is an inverse lookup operation.For
example if we want to dither a ColorImage to a
PseudoColorImage, for each Pixel in the ColorImage we search
in the PseudoColorImage ColorMap the Entry with the nearest
Color, then we write the ColorMap Entry Index in to the
PseudoColorImage. The result is a PseudoColorImage that when
it is displayed using its own ColorMap it will look as much
like the original ColorImage as possible.
This class provides 2 Dithering method.
DM_NearestColor : this dithering method is the simplest
one ,it just finds the nearest entry in the ColorMap.
This algorithm provide no provision for eliminating unwanted
contours in the dithered image.This algorithm is much
faster on ColorRamp and ColorCube than on Generic
ColorMap.Indeed on ColorRamp and ColorCube ColorMap the
ColorMap Entry Index can be computed by using the ColorMap
BasePixel and ColorDimension.
DM_ErrorDiffusion: In this method the difference ( error )
between the original and the dithered image is distribued
to the oginal image pixels immediatly to the right of and
below the last pixel processed. The ErrorDiffusion method
uses a "floyd-steinberg" error-distribution kernel.This
algorithm is fairly time-consuming, but can greatly reduce
contouring in the dithered image.
#include <Image_Convertor.hxx>
Public Member Functions | |
DEFINE_STANDARD_ALLOC | Image_Convertor () |
Create a Convertor object with the default DitheringMethod ( DM_NearestColor ). | |
void | SetDitheringMethod (const Image_DitheringMethod aMethod) |
Set DitheringMethod. | |
Handle_Image_PseudoColorImage | Convert (const Handle< Image_ColorImage > &aColorImage, const Handle< Aspect_ColorMap > &aColorMap) const |
Dither a ColorImage into a PseudoColorImage using the ColorMap parameter. | |
Handle_Image_PseudoColorImage | Convert (const Handle< Image_PseudoColorImage > &aPseudoColorImage, const Handle< Aspect_ColorMap > &aColorMap) const |
Dither a PseudoColorImage into a PseudoColorImage using the ColorMap parameter. | |
Handle_Image_ColorImage | Convert (const Handle< Image_PseudoColorImage > &aPseudoColorImage) const |
Lookup a PseudoColorImage into a ColorImage using the PseudoColorImage ColorMap. |
Handle_Image_PseudoColorImage Image_Convertor::Convert | ( | const Handle< Image_ColorImage > & | aColorImage, |
const Handle< Aspect_ColorMap > & | aColorMap | ||
) | const |
Handle_Image_PseudoColorImage Image_Convertor::Convert | ( | const Handle< Image_PseudoColorImage > & | aPseudoColorImage, |
const Handle< Aspect_ColorMap > & | aColorMap | ||
) | const |
Handle_Image_ColorImage Image_Convertor::Convert | ( | const Handle< Image_PseudoColorImage > & | aPseudoColorImage | ) | const |