Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QCoreApplication>
- #include "opencv2/core/core.hpp"
- #include "opencv2/highgui/highgui.hpp"
- #include "opencv2/imgproc/imgproc.hpp"
- using namespace cv;
- using namespace std;
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- auto image = imread("/home/skirtek/Pulpit/photo.jpeg");
- vector<Mat> splitted;
- Mat hsv;
- Mat emptyImage = Mat::zeros(Size(image.cols, image.rows), CV_8UC1);
- cvtColor(image, hsv, CV_RGB2HSV);
- split(hsv, splitted);
- imshow("HSV FULL", hsv);
- vector<Mat> channels;
- channels = {splitted[0],emptyImage,emptyImage};
- Mat hue;
- merge(channels, hue);
- imshow("Hue", hue);
- channels.clear();
- channels = {emptyImage,splitted[1],emptyImage};
- Mat saturation;
- merge(channels, saturation);
- imshow("Saturation", saturation);
- channels.clear();
- channels = {emptyImage,emptyImage,splitted[2]};
- Mat value;
- merge(channels, value);
- imshow("Value", value);
- channels.clear();
- channels = {splitted[0],splitted[1],splitted[2]};
- Mat originalImage;
- merge(channels, originalImage);
- imshow("OriginaIlmage",originalImage);
- waitKey(0);
- destroyAllWindows();
- return a.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement