Learn Opencv Representative To Convert Rgb To Greyness / Other Colouring Cloth Spaces

void cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0 )
Parameters:
  • src – input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision floating-point.
  • dst – output icon of the same size in addition to depth equally src.
  • code – color infinite conversion code (see the description below).
  • dstCn – publish of channels inward the finish image; if the parameter is 0, the publish of the channels is derived automatically from src in addition to code .
Note that the default color format inward OpenCV is oft referred to equally RGB precisely it is genuinely BGR (the bytes are reversed).

The conventional ranges for R, G, in addition to B channel values are:
  • 0 to 255 for CV_8U images
  • 0 to 65535 for CV_16U images
  • 0 to 1 for CV_32F images


RGB  output icon of the same size in addition to depth equally  Learn OpenCV instance to convert RGB to grayness / other color spaces GRAY ( CV_BGR2GRAY, CV_RGB2GRAY, CV_GRAY2BGR, CV_GRAY2RGB )
RGB  output icon of the same size in addition to depth equally  Learn OpenCV instance to convert RGB to grayness / other color spaces YCrCb JPEG (or YCC) ( CV_BGR2YCrCb,CV_RGB2YCrCb,CV_YCrCb2BGR,CV_YCrCb2RGB )
RGB  output icon of the same size in addition to depth equally  Learn OpenCV instance to convert RGB to grayness / other color spaces HSV ( CV_BGR2HSV, CV_RGB2HSV, CV_HSV2BGR, CV_HSV2RGB )
RGB  output icon of the same size in addition to depth equally  Learn OpenCV instance to convert RGB to grayness / other color spaces HLS ( CV_BGR2HLS, CV_RGB2HLS, CV_HLS2BGR, CV_HLS2RGB )
RGB  output icon of the same size in addition to depth equally  Learn OpenCV instance to convert RGB to grayness / other color spaces CIE L*a*b* ( CV_BGR2Lab, CV_RGB2Lab, CV_Lab2BGR, CV_Lab2RGB )
RGB  output icon of the same size in addition to depth equally  Learn OpenCV instance to convert RGB to grayness / other color spaces CIE L*u*v* ( CV_BGR2Luv, CV_RGB2Luv, CV_Luv2BGR, CV_Luv2RGB )
Bayer  output icon of the same size in addition to depth equally  Learn OpenCV instance to convert RGB to grayness / other color spaces RGB ( CV_BayerBG2BGR, CV_BayerGB2BGR, CV_BayerRG2BGR, CV_BayerGR2BGR, CV_BayerBG2RGB, CV_BayerGB2RGB, CV_BayerRG2RGB, CV_BayerGR2RGB )
RGB  output icon of the same size in addition to depth equally  Learn OpenCV instance to convert RGB to grayness / other color spaces CIE XYZ.Rec 709 amongst D65 white betoken ( CV_BGR2XYZ, CV_RGB2XYZ, CV_XYZ2BGR, CV_XYZ2RGB )

Steps:

  1. Load an image 
  2. Convert to grayness scale
  3. Show result

Functions:

Example:

-------------
#include "opencv2/core/core.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "iostream"  using namespace cv; using namespace std;  int main( ) {         Mat image;        icon = imread("lena.jpg", CV_LOAD_IMAGE_COLOR);           if(! image.data )                                     {               cout <<  "Could non opened upward or notice the image" << std::endl ;               supply -1;        }         // Create a novel matrix to concur the grayness icon        Mat gray;         // convert RGB icon to grayness        cvtColor(image, gray, CV_BGR2GRAY);         namedWindow( "Display window", CV_WINDOW_AUTOSIZE );          imshow( "Display window", icon );                          namedWindow( "Result window", CV_WINDOW_AUTOSIZE );           imshow( "Result window", grayness );         waitKey(0);                                                  supply 0; }
-------------


Sources:

Comments

Popular posts from this blog

Accueil Technologie Ct 1.2 - Frauder Une Ou Des Hypothèses Rasé Matérialiser À Une Croix Ou À Un Irradiant Démarquage

Accueil Technologie Ct 1.1 - Imaginer, Synthétiser, Formaliser Et Engorger Une Procédure, Un Protocole.

Accueil Technologie Satisfecit Exonérer Ma Spontanément ?