-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhsv.cpp
More file actions
25 lines (20 loc) · 706 Bytes
/
hsv.cpp
File metadata and controls
25 lines (20 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "hsv.h"
#include "opencv2/opencv.hpp"
#include <iostream>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace std;
using namespace cv;
void hsv_frame(Mat& src, Mat& dst)
{
Mat hsv_frame, temp;
Mat channels_device[3];
Mat channels_device_dest[3];
cvtColor(src, hsv_frame, COLOR_BGR2HSV);
split(hsv_frame, channels_device);
threshold(channels_device[0], channels_device_dest[0], 0, 100, THRESH_BINARY);
threshold(channels_device[2], channels_device_dest[1], 210, 255, THRESH_BINARY);
threshold(channels_device[2], channels_device_dest[2], 200, 255, THRESH_BINARY);
merge(channels_device_dest, 3, temp);
cvtColor(temp, dst, COLOR_HSV2BGR);
}