c++opencv

What is the difference between opencv function cvcvtcolor and cvtcolor


I am new to c++ coding . can you tell me what is the difference between opencv function cvcvtcolor and cvtcolor ?

Thank you


Solution

  • cvCvtColor inputs and outputs parameters are cvArray reference image aka IplImage

    Syntax: cvCvtColor(CvArr *src, CvArr *dst, int code)

    While cvtColor on the other hand is using InputArray images aka Mat

    Syntax: cvtColor(InputArray src, OutputArray dst, int code)

    Notice that cvArray's IplImage is a reference address to the image, While InputArray's Mat is the actual image.

    As a practical test i have tried both with int code = CV_BGR2HSV, Surprisingly the output was too different, Both tested at same environment Neon-light White Balance.

    cvCvtColor on OpenCV 3.4.3

    cvCvtColor(inputIplImage, outputIplImage, CV_BGR2HSV);

    enter image description here

    cvCvtColor on OpenCV 4.4.0

    cvtColor(inputMat, outputMat, CV_BGR2HSV);

    enter image description here

    Finally you have to know that cvCvtColor Not exist anymore in OpenCV 4.4.0 as IplImage is deprecated and we have to use Mat instead, So I guess you will have to use cvtColor or Stick to the previous version of OpenCV 3.4.3