opencv | opencv color transform python
APIDefinition我们从OpenCV官网的MiscellaneousImageTransformations[1]上,可查到cv2.cvtColor这个api的定义如下:cvtColorConvertsanimagefromonecolorspacetoanother.C++:voidcvtColor(InputArraysrc,OutputArraydst,intcode,intdstCn=0)Python:cv2.cvtColor(src,code[,dst[,dstCn]])→dstC:voidcvCvtColor(constCvArr*src,CvArr*dst,intcode)Python:cv.CvtColor(src,dst,code)→NoneParameters:src–inputimage:8-bitunsigned,16-bitunsigned(CV_16UC…),orsingle-precisionfloating-point.dst–outputimageofthesamesizeanddepthass...
API Definition我们从 OpenCV官网 的Miscellaneous Image Transformations[1] 上,可查到 cv2.cvtColor 这个api的定义如下:
cvtColorConverts an image from one color space to another.
C++: void cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0 ) Python: cv2.cvtColor(src, code[, dst[, dstCn]]) → dst C: void cvCvtColor(const CvArr* src, CvArr* dst, int code) Python: cv.CvtColor(src, dst, code) → None
Parameters: src – input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC… ), or single-precision floating-point. dst – output image of the same size and depth as src. code – color space conversion code (see the description below). dstCn – number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code.
The function converts an input image from one color space to another. In case of a transformation to-from RGB color space, the order of the channels should be speci...