# Command Conversion_Color

## Using of command

This command is use for color conversion of source image

## Commands parameters

Function has 3 parameters:

1. Source picture:You can select one of used picture which is use as source picture for color conversion.You can select Picture_0 to Picture_19.
2. Destination picture:You can select one of used picture which is use as destination picture for color conversion.You can select Picture_0 to Picture_19.
3. Conversion code:You can select which type of conversion will be use. You can select:
   1. RGB2GRAY: This option convert source colour image 3 channel RGB to 1 channel grayscale image. RGB[A]->Gray: Y<-0.299*R + 0.587*G + 0.114*B
   2. GRAY2RGB:This option conver source grayscale 1 channel image to 3 channel image. All channel in destination image has same value as in grayscale image. Gray->RGB[A]: R<-Y G<-Y B<-Y A<-0
   3. RGB2XYZ:Option covert source 3 channel RBG image to CIE XYZ format
   4. XYZ2RGB: Option convert CIE XYZ format to 3 channel RGB image
   5. RGB2YCrCb: Option convert 3 channel RGB format to YCrCb JPEG format.
      Y <- 0.299*R + 0.587*G + 0.114*B
      Cr <- (R-Y)*0.713 + delta
      Cb <- (B-Y)*0.564 + delta
   6. YCrCb2RGB: Option convert YCrCb JPEG format to 3 channel RGB format
      R <- Y + 1.403*(Cr - delta)
      G <- Y - 0.344*(Cr - delta) - 0.714*(Cb - delta)
      B <- Y + 1.773*(Cb - delta),
   7. RGB2HSV:Option convert source RGB format to HSV format:
      V <- max(R,G,B)
      S <- (V-min(R,G,B))/V if V≠0, 0 otherwise
      (G - B)*60/S, if V=R
      H <- 180+(B - R)*60/S, if V=G
      240+(R - G)*60/S, if V=B
   8. HSV2RGB: Option convert source HSV format to destination RGB format
   9. RGB2HLS: Option convert source 3 channel RGB image to HLS format:
      Vmax <- max(R,G,B)
      Vmin <- min(R,G,B)
      L <- (Vmax + Vmin)/2
      S <- (Vmax - Vmin)/(Vmax + Vmin) if L < 0.5
      (Vmax - Vmin)/(2 - (Vmax + Vmin)) if L >= 0.5
      (G - B)*60/S, if Vmax=R
      H <- 180+(B - R)*60/S, if Vmax=G
      240+(R - G)*60/S, if Vmax=B
   10. HLS2RGB: Option convert HLS format to RGB format
   11. RGB2Lab:Option convert source RGB format to Lab format
   12. Lab2RGB: Option convert Lab format to RGB format
   13. RGB2Luv:Option conver RGB format to Luv format
   14. Luv2RGB:Option convert Luv format to RGB format
   15. There is also conversion from BGR format to other. Function is same as in RGB format

## Error codes

1. Error code -11:Bad source picture position. This error means error in first parameter. Picture is not in range Picture_0 to Picture_19.
2. Error code -12:Bad destination picture position. This error means error in second parameter. Picture is not in range Picture_0 to Picture_19.
3. Error code -100: OpenCV error. Excplanation of this error is in result window