-
Notifications
You must be signed in to change notification settings - Fork 6
/
hsv.cpp
39 lines (31 loc) · 1.54 KB
/
hsv.cpp
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//#####################################################################################//
//#####################################################################################//
//#####################################################################################//
//# Please include the Github Repositories web URL if you are using this material. #//
//#####################################################################################//
//#####################################################################################//
//#####################################################################################//
#include "opencv2/opencv.hpp"
#include <iostream>
#include "opencv2/cudaarithm.hpp"
#include "opencv2/cudafilters.hpp"
#include "opencv2/cudaimgproc.hpp"
#include "opencv2/cudawarping.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "hsv.h"
using namespace std;
using namespace cv;
void hsvframe::hsv_frame(cuda::GpuMat& src, cuda::GpuMat& dst)
{
cuda::GpuMat hsv_frame, temp;
cuda::GpuMat channels_device[3];
cuda::GpuMat channels_device_dest[3];
cuda::cvtColor(src, hsv_frame, COLOR_BGR2HSV);
cuda::split(hsv_frame, channels_device);
cuda::threshold(channels_device[0], channels_device_dest[0], 0, 100, THRESH_BINARY);
cuda::threshold(channels_device[2], channels_device_dest[1], 210, 255, THRESH_BINARY);
cuda::threshold(channels_device[2], channels_device_dest[2], 200, 255, THRESH_BINARY);
cuda::merge(channels_device_dest, 3, temp);
cuda::cvtColor(temp, dst, COLOR_HSV2BGR);
}