-
Notifications
You must be signed in to change notification settings - Fork 1
/
cxCv.h
56 lines (47 loc) · 1.09 KB
/
cxCv.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// cxCv.h
// TypeMotion
//
// Created by Joseph Chow on 2/1/14.
//
//
#ifndef TypeMotion_cxCv_h
#define TypeMotion_cxCv_h
/**
All our includes go here.
*/
#include "cinder/ImageIo.h"
#include "CinderOpenCV.h"
#include "cinder/Surface.h"
#include "cinder/gl/Texture.h"
#include "Helpers.h"
#include "cinder/Color.h"
#include "cinder/Capture.h"
/**
Common functionality that could be used
across all classes ought to go here.
These should all be static functions or variables.
*/
namespace cxCv{
/**
Color used for debugging stuff.
Default is yellow
*/
static ci::Color debugColor = ci::Color(1,1,0);
/**
Changes a cv::Mat to a grayscale image
if necessary.
*/
static cv::Mat toGray(cv::Mat img){
cv::Mat thresh;
if(img.channels() == 1) {
thresh = img.clone();
} else if(img.channels() == 3) {
cv::cvtColor(img, thresh, CV_RGB2GRAY);
} else if(img.channels() == 4) {
cv::cvtColor(img, thresh, CV_RGBA2GRAY);
}
return thresh;
}
};
#endif