Home
About ISIS
Support
Download

ISIS 3

Documentation
Tutorials
Technical Documents

ISIS 2

Documentation
Tutorials
Technical Documents

Search

USGS

ISIS 3 Application Documentation


rgb2hsv

Printer Friendly View | TOC | Home

Convert RGB to HSV

Overview Parameters Example 1

Description

This program takes in three input images, representing Red, Green, and Blue, then outputs Hue, Saturation, and Value files respectively. It works by creating an RGB pixel from pixels in the Red, Green, and Blue files, converting it to HSV format, then writing the data to the Hue, Saturation, and Value files.

NOTE: The original input file dn range is compressed down to a value between 0.0 and 1.0 When it comes back out through hsv2rgb, it remains in the range of 0.0 to 1.0 We currently do not have the capability to return the dn values to their original value.

HSV Stores colors in terms of hue, saturation, and value. The hue determines the color, which is an angle around the color wheel. The basic colors are: 0 degrees = RED, 60 degrees = YELLOW, 120 degrees = GREEN, 180 degrees = CYAN, 240 degrees = BLUE and 300 degrees = PURPLE.
The saturation is how much grey is in the color (intensity of the color). A saturation value of zero means it's a perfect color, while a saturation value of 1 would cause any color to become pure grey. As an example, the color RGB(255,0,0) is pure so the saturation would be zero. The value is how bright the color is. A value of 0 is always black, and 100 is the color (if not saturated).

In brief,
HUE = COLOR (degrees around the color wheel)
SATURATION = INTENSITY (0-1, 0 being no color/grey)
VALUE = BRIGHTNESS (0 being black)

For more information, see
http://en.wikipedia.org/wiki/Color_spaces

Categories


Related Objects and Documents

Applications


History

Sean Crosby2006-12-22 Original version
Steven Lambright2007-06-20 Added comment explaining what HSV is and what the code is doing
Steven Koechle2007-08-22 Added documentation explaining why running images through rgb2hsv and then running it back through hsv2rgb gives a different result that the original.
Steven Lambright2008-05-13 Removed references to CubeInfo

Parameter Groups

Input Files

Name Description
RED Input file to be converted
GREEN Input file to be converted
BLUE Input file to be converted

Output Files

Name Description
HUE Output cube
SATURATION Output cube
VALUE Output cube

Stretch

Name Description
MODEHistogram parameters

Auto settings

Name Description
RMINPERMinumim percentage
RMAXPERMaximum percentage
GMINPERMinumim percentage
GMAXPERMaximum percentage
BMINPERMinumim percentage
BMAXPERMaximum percentage

Manual settings

Name Description
RMINMinumim pixel value
RMAXMaximum pixel value
GMINMinumim pixel value
GMAXMaximum pixel value
BMINMinumim pixel value
BMAXMaximum pixel value
X

Input Files: RED


Description

This file will be converted from Red to Hue

Type cube
File Mode input
Filter *.cub
Close Window
X

Input Files: GREEN


Description

This file will be converted from Green to Saturation

Type cube
File Mode input
Filter *.cub
Close Window
X

Input Files: BLUE


Description

This file will be converted from Blue to Value

Type cube
File Mode input
Filter *.cub
Close Window
X

Output Files: HUE


Description

The resultant Hue cube

Type cube
File Mode output
Pixel Type real
Filter *.cub
Close Window
X

Output Files: SATURATION


Description

The resultant Saturation cube

Type cube
File Mode output
Pixel Type real
Filter *.cub
Close Window
X

Output Files: VALUE


Description

The resultant Value cube

Type cube
File Mode output
Pixel Type real
Filter *.cub
Close Window
X

Stretch: MODE


Description

This determines which values will be used for minimum and maximum cut-off limits

Type string
Default Automatic
Option List:
Option Brief Description
AutomaticUse default percentagesUse minimum and maximum percentages of 0.5 and 99.5 for each input files' histogram cut-off values.

Exclusions

  • RMIN
  • RMAX
  • GMIN
  • GMAX
  • BMIN
  • BMAX
ManualUse manually defined percentagesThe user defines minimum and maximum pixel values

Exclusions

  • RMINPER
  • RMAXPER
  • GMINPER
  • GMAXPER
  • BMINPER
  • BMAXPER
Close Window
X

Auto settings: RMINPER


Description

Minimum cut-off value for the histogram

Type double
Default 0.5
Minimum 0.0 (inclusive)
Less Than RMAXPER
Close Window
X

Auto settings: RMAXPER


Description

Maximum cut-off value for the histogram

Type double
Default 99.5
Maximum 100.0 (inclusive)
Close Window
X

Auto settings: GMINPER


Description

Minimum cut-off value for the histogram

Type double
Default 0.5
Minimum 0.0 (inclusive)
Less Than GMAXPER
Close Window
X

Auto settings: GMAXPER


Description

Maximum cut-off value for the histogram

Type double
Default 99.5
Maximum 100.0 (inclusive)
Close Window
X

Auto settings: BMINPER


Description

Minimum cut-off value for the histogram

Type double
Default 0.5
Minimum 0.0 (inclusive)
Less Than BMAXPER
Close Window
X

Auto settings: BMAXPER


Description

Maximum cut-off value for the histogram

Type double
Default 99.5
Maximum 100.0 (inclusive)
Close Window
X

Manual settings: RMIN


Description

Minimum cut-off pixel value

Type double
Minimum 0.0 (inclusive)
Less Than RMAX
Close Window
X

Manual settings: RMAX


Description

Maximum cut-off pixel value

Type double
Maximum 255.0 (inclusive)
Close Window
X

Manual settings: GMIN


Description

Minimum cut-off pixel value

Type double
Minimum 0.0 (inclusive)
Less Than GMAX
Close Window
X

Manual settings: GMAX


Description

Maximum cut-off pixel value

Type double
Maximum 255.0 (inclusive)
Close Window
X

Manual settings: BMIN


Description

Minimum cut-off pixel value

Type double
Minimum 0.0 (inclusive)
Less Than RMAX
Close Window
X

Manual settings: BMAX


Description

Maximum cut-off pixel value

Type double
Maximum 255.0 (inclusive)
Close Window

Example 1

Convert RGB image to HSV

Description

This example shows the results of converting RGB images to HSV format.

Command Line

rgb2hsv red=../peaks.cub+5 green=../peaks.cub+4 blue=../peaks.cub+3 hue=../hue.cub saturation=../sat.cub value=../val.cub mode=automatic
Convert Red, Green, and Blue images into their respective Hue, Saturation, and Value images.

GUI Screenshot

RGB2HSV Gui

Example Gui

Screenshot of GUI with parameters filled in to perform a conversion from RGB to HSV using the different bands of peaks.cub.

Input Image

Input Peaks (Bands 3, 4, and 5) image

Input image for rgb2hsv

This is the color input image for the rgb2hsv example.

Output Images

Output image showing results of rgb2hsv.

Output image

Parameter Name: HUE

This is the output image that results from converting Red to Hue.

Output image showing results of rgb2hsv.

Output image

Parameter Name: SATURATION

This is the output image that results from converting Green to Saturation.

Output image showing results of rgb2hsv.

Output image

Parameter Name: VALUE

This is the output image that results from converting Blue to Value.