4.3 Color Conversion, Split/Merge

Eden.Yang·2023년 12월 6일
0

Computer VIsion

목록 보기
22/22

Color conversion

#include <opencv2/opencv.hpp>
#include <iostream>

using namespace std;
using namespace cv;

int main() {
	Mat image, image_YUV, dst;
	Mat yuv_channels[3];
	image = imread("lena.png");
	cvtColor(image, image_YUV, COLOR_BGR2YUV);
	split(image_YUV, yuv_channels);
	merge(yuv_channels, 3, dst);
	imshow("input image", image);
	imshow("Y", yuv_channels[0]);
	imshow("U", yuv_channels[1]);
	imshow("V", yuv_channels[2]);
	imshow("YUV image", dst);
	waitKey(0);
	return 0;

}




profile
손끝에서 땅끝으로, 골방에서 열방으로

0개의 댓글