Functions > Reading and Writing Files > Example: Using HLS and HSV Color Systems File Access Functions
  
Example: Using HLS and HSV Color Systems File Access Functions
Use HLS and HSV color systems related functions to read the below image.
dog.bmp
HLS Color System
1. Use READ_HUE to read the hue component of an image.
Click to copy this expression
The hue component is common to both HLS and HSV color systems.
2. Use READ_LIGHT to read the light component of the image, as a part of the HLS color system.
Click to copy this expression
3. Use READ_HLS_SAT to read the saturation component of the image, as a part of the HLS color system.
Click to copy this expression
4. Read the image using READ_HLS.
Click to copy this expression
M1 is a packed image matrix.
5. Join the hue, light and hls_sat matrices to a single matrix and compare it to M1.
Click to copy this expression
Click to copy this expression
The two matrices are identical.
6. Write out M2 to a graphic file.
Click to copy this expression
HSV Color System
1. Use READ_VALUE to read the value component of an image, as a part of the HSV color system.
Click to copy this expression
2. Use READ_HSV_SAT to read the saturation component of the image, as a part of the HSV color system.
Click to copy this expression
3. Read the image using READ_HSV.
Click to copy this expression
M3 is a packed image matrix.
4. Join the hue, hsv_sat and value matrices to a single matrix and compare it to M3.
Click to copy this expression
Click to copy this expression
The two matrices are identical.
5. Write out M4 to a graphic file.
Click to copy this expression
Comparing the Results
Read the two images and compare them.
Click to copy this expression
Although you used two color systems, the two images are identical.