Use the image in IPLIMAGE to use CIMAGE (CVVIMAGE) class: CIMAGE CIMG; IPLIMAGE * IMG = ...; CRECT RC (0, 0, IMG-> Width, IMG-> Height); CIMG.COPYOF (IMG) CIMG.DRAWTOHDC (HDC, RC); CVCVTCOLOR function requires input parameters to comply with the definition of converting code (CODE), otherwise error, for example: CVCVTCOLOR (IMG_BGR, IMG_GRAY, CV_BGR2GRAY); where IMG_BGR must be B0, G0, R0, B1, G1, R1 ... arranged, and IMG_GRAY must be a single channel and have the same size and IMG_BGR