Hi
I want to separate YCrCb channels , I have written this code that converts from RGB to YCrCb ,
I need help to separate the YCrCb channels and display them
Thanks
#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;
image = imread("3.jpg");
if(! image.data ) // you can use if (image.empty()) here
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
// Create a new matrix to hold the gray image
Mat gray;
// convert RGB image to gray
cvtColor(image, gray, CV_RGB2YCrCb);
namedWindow( "Display window", CV_WINDOW_AUTOSIZE );
imshow( "Display window", image );
namedWindow( "Result window", CV_WINDOW_AUTOSIZE );
imshow( "Result window", gray );
waitKey(0);
return 0;
}
↧