Classes | Macros | Functions
color_conversion.h File Reference

Contains functions to convert colors between different color spaces. More...

#include <stdlib.h>
#include <stdio.h>
#include <opencv2/core/core.hpp>

Go to the source code of this file.

Classes

struct  rgb_color
 Contains a RGB color. More...
 
struct  hsv_color
 Contains a HSV color. More...
 

Macros

#define MIN3(x, y, z)
 Calculate the minimum of 3 values. More...
 
#define MAX3(x, y, z)
 Calculate the maximum of 3 values. More...
 

Functions

struct hsv_color rgb_to_hsv (struct rgb_color rgb)
 Convert a color from RGB to HSV. More...
 
Scalar bgr_to_cv_hsv (Scalar rgb)
 Convert a color from RGB to HSV. More...
 
Scalar bgr_to_gimp_hsv (Scalar rgb)
 Convert a color from RGB to HSV (Gimp) More...
 
Scalar bgr_to_kcc_hsv (Scalar rgb)
 Convert a color from RGB to HSV (KColorChooser) HSV colors KColorChooser: H: 0..359 S: 0..255 V: 0..255. More...
 

Detailed Description

Contains functions to convert colors between different color spaces.

Definition in file color_conversion.h.

Macro Definition Documentation

#define MAX3 (   x,
  y,
 
)
Value:
((y) >= (z) ? \
((x) >= (y) ? (x) : (y)) \
: \
((x) >= (z) ? (x) : (z)))

Calculate the maximum of 3 values.

Definition at line 68 of file color_conversion.h.

#define MIN3 (   x,
  y,
 
)
Value:
((y) <= (z) ? \
((x) <= (y) ? (x) : (y)) \
: \
((x) <= (z) ? (x) : (z)))

Calculate the minimum of 3 values.

Definition at line 63 of file color_conversion.h.

Function Documentation

Scalar bgr_to_cv_hsv ( Scalar  rgb)

Convert a color from RGB to HSV.

HSV colors OpenCV: H: 0..179 S: 0..255 V: 0..255

Parameters
rgbRGB color, coded as BGR, first blue, then green and the last is red.
Returns
HSV color
Scalar bgr_to_gimp_hsv ( Scalar  rgb)

Convert a color from RGB to HSV (Gimp)

HSV colors Gimp: H: 0..360 S: 0..100 V: 0..100

Parameters
rgbRGB color, coded as BGR, first blue, then green and the last is red.
Returns
HSV color
Scalar bgr_to_kcc_hsv ( Scalar  rgb)

Convert a color from RGB to HSV (KColorChooser) HSV colors KColorChooser: H: 0..359 S: 0..255 V: 0..255.

Parameters
rgbRGB color, coded as BGR, first blue, then green and the last is red.
Returns
HSV color
struct hsv_color rgb_to_hsv ( struct rgb_color  rgb)

Convert a color from RGB to HSV.

Parameters
rgb_colorRGB color
Returns
HSV color