java.lang.Object
imagingbook.common.image.PixelPack
imagingbook.common.image.ColorPack
This class defines a "color stack" as a subtype of
PixelPack with exactly 3 components (slices), representing
a color image in a specific color space (default is sRGB65ColorSpace). It allows simple conversion to other
color spaces (see convertFromSrgbTo(ColorSpace)). All conversions are 'destructive', i.e., the affected
color stack is modified. Pixel values are typically in [0,1], depending on the associated color space. A
ColorPack may be created from an existing ColorProcessor whose pixels are assumed to be in sRGB color
space (see ColorPack(ColorProcessor)). To be converted back to a ColorProcessor, the
ColorPack must be in sRGB color space (see convertToSrgb()).- Version:
- 2022/09/10
-
Nested Class Summary
Nested classes/interfaces inherited from class imagingbook.common.image.PixelPack
PixelPack.PixelSlice -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconvertFromSrgbTo(ColorSpace targetColorspace) Converts the pixel values of thisColorPackto the specified color space.voidConverts thisColorPackto sRGB space.Returns the current color space instance of thisColorPack.Returns the 3 color components as an array ofFloatProcessor.Converts thisPixelPackto a newColorProcessorinstance.toColorProcessor(double scale) Converts thisPixelPackto a newColorProcessorinstance.Converts thisPixelPackto a newImageStackwith the same number of slices (seePixelPack.getDepth()).Methods inherited from class imagingbook.common.image.PixelPack
copyFromImageProcessor, copyFromImageProcessor, copyTo, copyToImageProcessor, copyToImageProcessor, get3x3Neighborhood, getData, getDepth, getEmptySlice, getFloatProcessor, getFloatProcessors, getHeight, getOutOfBoundsStrategy, getPix, getPix, getPix, getPix, getSlice, getSlices, getVec, getVec, getWidth, isCompatibleTo, isCompatibleTo, setPix, setPix, setVec, toByteProcessor, toByteProcessor, toFloatProcessor, toFloatProcessor, toShortProcessor, toShortProcessor, zero
-
Constructor Details
-
ColorPack
Constructor.- Parameters:
cp- a color image assumed to be in sRGB
-
-
Method Details
-
getProcessors
Returns the 3 color components as an array ofFloatProcessor.- Returns:
- a
FloatProcessorarray
-
getColorspace
Returns the current color space instance of thisColorPack.- Returns:
- the current color space
-
convertFromSrgbTo
Converts the pixel values of thisColorPackto the specified color space. The color stack must be in sRGB space. An exceptions is thrown if the color stack is not in sRGB color space. Has no effect if the target color space already is sRGB.- Parameters:
targetColorspace- the new color space
-
convertToSrgb
Converts thisColorPackto sRGB space. Has no effect if the color stack is in sRGB color space already. -
toColorProcessor
Description copied from class:PixelPackConverts thisPixelPackto a newColorProcessorinstance. An exception is thrown if the depth of the pack is not equal 3. Component values are rounded, no scale factor is applied.- Overrides:
toColorProcessorin classPixelPack- Returns:
- a new
ColorProcessorinstance
-
toColorProcessor
Description copied from class:PixelPackConverts thisPixelPackto a newColorProcessorinstance. An exception is thrown if the depth of the pack is not equal 3.- Overrides:
toColorProcessorin classPixelPack- Parameters:
scale- scale factor applied to component values (before rounding)- Returns:
- a new
ColorProcessorinstance
-
toImageStack
Description copied from class:PixelPackConverts thisPixelPackto a newImageStackwith the same number of slices (seePixelPack.getDepth()). The stack images are of typeFloatProcessor. The resultingImageStackdoes not share any pixel data with thisPixelPack.- Overrides:
toImageStackin classPixelPack- Returns:
- a new
ImageStackinstance
-