de.unihalle.informatik.MiToBo.color.conversion
Class RGBToHSXConverter

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.MiToBo.core.operator.MTBOperator
          extended by de.unihalle.informatik.MiToBo.color.conversion.RGBToHSXConverter
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, de.unihalle.informatik.Alida.operator.events.ALDOperatorExecutionProgressEventListener, EventListener

@ALDAOperator(genericExecutionMode=ALL,
              level=APPLICATION)
public class RGBToHSXConverter
extends MTBOperator

Converts an image of type MTBImageRGB ( RGB color space ) into an image with HSX( hue saturation intensity/brightness/value ) color space.

The type of the resulting image is MTBImageByte MTBImageByte or MTBImageFloat MTBImageFloat . In the later case all three channels have values in the range 0..1, otherwise in the range 0..255.

There are three ways to convert an rgb-image.

  1. RGB to HSI introduced by Sonka
  2. RGB to HSB, pure Java Implementation
  3. RGB to HSV, adapted from http://www.easyrgb.com

Author:
Tim Langhammer, Halle/Saale,

Nested Class Summary
static class RGBToHSXConverter.ColorChannel
          Supported Color Channels.
static class RGBToHSXConverter.Mode
          The way of converting an image from rgb to hsi.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
static float BYTE_TO_DEGREE
          Constants to convert from [0-255] to [0-359] and vice versa.
static float DEGREE_TO_BYTE
           
static float HUE_UNDEFINED
           
static float SATURATION_UNDEFINED
          To cope with undefined saturation/hue-values, we use the following scheme.
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
 
Constructor Summary
RGBToHSXConverter()
          Default constructor.
RGBToHSXConverter(MTBImageRGB image)
          Constructor.
 
Method Summary
 MTBImage getHueMTBImg()
          Get the hue channel image.
 MTBImageRGB getInputMTBImgRGB()
          Returns the input image, null if not set.
 MTBImage getResultMTBImage()
          Returns the converted image, null if not available.
 MTBImage getSatMTBImg()
          Get the saturation channel image.
 MTBImage getXMTBImg()
          Get the value channel image.
static boolean isHueUndefined(float saturation)
          Return true if the hue channel is undefined which is true is saturation is zero or undefined which in turn is encoded as zero.
static boolean isHueUndefined(int saturation)
          Return true if the hue channel is undefined which is true is saturation is zero or undefined which in turn is encoded as zero.
static boolean isSaturationUndefined(float xValue)
          Return true if the saturation channel is undefined which is true if the x channel is zero.
static boolean isSaturationUndefined(int xValue)
          Return true if the saturation channel is undefined which is true if the x channel is zero.
protected  void operate()
          Creates a MTBImage with three channels, the same size as the original one and converts each rgb pixel to a hsx pixel, where x stands for Inentsity or Brightness or Value depending on the mode set.
 void setHueMTBImg(MTBImage hueChannelImage)
          Set the hue channel image.
 void setInputMTBImgRGB(MTBImageRGB inputImage)
          Set the input image.
 void setSatMTBImg(MTBImage saturationChannelImage)
          Set the saturation channel image.
 void setXMTBImg(MTBImage valueChannelImage)
          Set the value channel image.
 
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator
readResolve
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
addOperatorExecutionProgressEventListener, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getHidingMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, runOp, runOp, runOp, setConstructionMode, setHidingMode, setName, setParameter, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BYTE_TO_DEGREE

public static final float BYTE_TO_DEGREE
Constants to convert from [0-255] to [0-359] and vice versa.

See Also:
Constant Field Values

DEGREE_TO_BYTE

public static final float DEGREE_TO_BYTE
See Also:
Constant Field Values

SATURATION_UNDEFINED

public static final float SATURATION_UNDEFINED
To cope with undefined saturation/hue-values, we use the following scheme. If x component equals zero then saturation and hue are undefined. We set them to UNDEFINED defined as zero. If saturation is zero, then hue is undefined (and set to UNDEFINED defined as zero).

See Also:
Constant Field Values

HUE_UNDEFINED

public static final float HUE_UNDEFINED
See Also:
Constant Field Values
Constructor Detail

RGBToHSXConverter

public RGBToHSXConverter()
                  throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Default constructor.

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

RGBToHSXConverter

public RGBToHSXConverter(MTBImageRGB image)
                  throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor.

Parameters:
image - The input image.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

getResultMTBImage

public MTBImage getResultMTBImage()
Returns the converted image, null if not available.

Returns:
The result image or null if not set.

getInputMTBImgRGB

public MTBImageRGB getInputMTBImgRGB()
Returns the input image, null if not set.

Returns:
The input image or null if not set.

setInputMTBImgRGB

public void setInputMTBImgRGB(MTBImageRGB inputImage)
Set the input image.

Parameters:
inputImage - The input image.

getHueMTBImg

public MTBImage getHueMTBImg()
Get the hue channel image.

Returns:
The image which contains the hue channel informations of * * type MTBImage.

getSatMTBImg

public MTBImage getSatMTBImg()
Get the saturation channel image.

Returns:
The image which contains the saturation channel informations of type MTBImage.

getXMTBImg

public MTBImage getXMTBImg()
Get the value channel image.

Returns:
The image which contains the value channel informations of * * type MTBImage.

setHueMTBImg

public void setHueMTBImg(MTBImage hueChannelImage)
Set the hue channel image.

Parameters:
hueChannelImage - The image which contains the hue channel informations of type MTBImage.

setSatMTBImg

public void setSatMTBImg(MTBImage saturationChannelImage)
Set the saturation channel image.

Parameters:
saturationChannelImage - The image which contains the saturation channel informations of * * type MTBImage.

setXMTBImg

public void setXMTBImg(MTBImage valueChannelImage)
Set the value channel image.

Parameters:
valueChannelImage - The image which contains the value channel informations of type MTBImage.

operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                       de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Creates a MTBImage with three channels, the same size as the original one and converts each rgb pixel to a hsx pixel, where x stands for Inentsity or Brightness or Value depending on the mode set.

Specified by:
operate in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

isHueUndefined

public static final boolean isHueUndefined(float saturation)
Return true if the hue channel is undefined which is true is saturation is zero or undefined which in turn is encoded as zero.

Parameters:
saturation -
Returns:

isSaturationUndefined

public static final boolean isSaturationUndefined(float xValue)
Return true if the saturation channel is undefined which is true if the x channel is zero.

Parameters:
xValue -
Returns:

isHueUndefined

public static final boolean isHueUndefined(int saturation)
Return true if the hue channel is undefined which is true is saturation is zero or undefined which in turn is encoded as zero.

Parameters:
saturation -
Returns:

isSaturationUndefined

public static final boolean isSaturationUndefined(int xValue)
Return true if the saturation channel is undefined which is true if the x channel is zero.

Parameters:
xValue -
Returns:


Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.