-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathofxCvColorImageAlpha.h
144 lines (108 loc) · 6.72 KB
/
ofxCvColorImageAlpha.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
* ofxCvColorImageAlpha.h
* by stefanix, zach, n3m3da
*
* This is essentially an IPL_DEPTH_8U with 4 channels.
* Pixel values are typically from 0-255 for each channel.
*
*/
#ifndef OFX_CV_COLOR_IMAGE_ALPHA_H
#define OFX_CV_COLOR_IMAGE_ALPHA_H
#include "ofxCvImage.h"
class ofxCvColorImageAlpha : public ofxCvImage {
public:
using ofxCvImage::setFromPixels;
ofxCvColorImageAlpha();
ofxCvColorImageAlpha( const ofxCvColorImageAlpha& mom );
// virtual void allocate( int w, int h ); //in base class
virtual void clear();
//virtual float getWidth(); //in base class
//virtual float getHeight(); //in base class
// virtual void setUseTexture( bool bUse ); //in base class
// virtual ofTexture& getTextureReference(); //in base class
// ROI - region of interest
//
// virtual void setROI( int x, int y, int w, int h ); //in base class
// virtual void setROI( ofRectangle& rect ); //in base class
// virtual ofRectangle getROI(); //in base class
// virtual void resetROI(); //in base class
// virtual ofRectangle getIntersectionROI( ofRectangle& rec1,
// ofRectangle& rec2 ); // inbase class
// Set Pixel Data
//
virtual void set( float value );
virtual void set( int valueR, int valueG, int valueB);
virtual void operator -= ( float value );
virtual void operator += ( float value );
virtual void setFromPixels( const unsigned char * _pixels, int w, int h );
virtual void setRoiFromPixels( const unsigned char * _pixels, int w, int h );
virtual void setFromGrayscalePlanarImages( ofxCvGrayscaleImage& red, ofxCvGrayscaleImage& green, ofxCvGrayscaleImage& blue );
virtual void operator = ( unsigned char* _pixels );
virtual void operator = ( const ofxCvGrayscaleImage& mom );
virtual void operator = ( const ofxCvColorImage& mom );
virtual void operator = ( const ofxCvFloatImage& mom );
virtual void operator = ( const ofxCvShortImage& mom );
virtual void operator = ( const ofxCvColorImageAlpha& mom );
virtual void operator = ( const IplImage* mom );
// virtual void operator -= ( ofxCvImage& mom ); //in base class
// virtual void operator += ( ofxCvImage& mom ); //in base class
using ofxCvImage::operator+=; //force inheritance
using ofxCvImage::operator-=; //force inheritance
// virtual void operator *= ( ofxCvImage& mom ); //in base class
// virtual void operator &= ( ofxCvImage& mom ); //in base class
// Get Pixel Data
//
//virtual unsigned char* getPixels(); //in base class
//virtual ofPixelsRef getPixelsRef(); //in base class
//virtual unsigned char* getRoiPixels(); //in base class
// virtual IplImage* getCvImage(); //in base class
virtual void convertToGrayscalePlanarImages( ofxCvGrayscaleImage& red, ofxCvGrayscaleImage& green, ofxCvGrayscaleImage& blue );
virtual void convertToGrayscalePlanarImage (ofxCvGrayscaleImage& grayImage, int whichPlane);
// virtual IplImage* getCvImage(); //in base class
// Draw Image
//
//virtual void draw( float x, float y ); //in base class
//virtual void draw( float x, float y, float w, float h ); //in base class
//virtual void drawROI( float x, float y ); //in base class
//virtual void drawROI( float x, float y, float w, float h ); //in base class
//virtual void setAnchorPercent( float xPct, float yPct ); //in base class
//virtual void setAnchorPoint( int x, int y ); //in base class
//virtual void resetAnchor(); //in base class
// Image Filter Operations
//
virtual void contrastStretch(); // not yet implemented for this type
virtual void convertToRange( float min, float max );
// virtual void erode( ); //in base class
// virtual void dilate( ); //in base class
// virtual void blur( int value=3 ); //in base class
// virtual void blurGaussian( int value=3 ); //in base class
// virtual void invert(); //in base class
// Image Transformation Operations
//
virtual void resize( int w, int h );
virtual void scaleIntoMe( ofxCvImage& mom, int interpolationMethod = CV_INTER_NN);
virtual void convertRgbToHsv();
// virtual void mirror( bool bFlipVertically, bool bFlipHorizontally ); //in base class
// virtual void translate( float x, float y ); //in base class
// virtual void rotate( float angle, float centerX, float centerY ); //in base class
// virtual void scale( float scaleX, float sclaeY ); //in base class
// virtual void transform( float angle, float centerX, float centerY,
// float scaleX, float scaleY,
// float moveX, float moveY ); //in base class
// virtual void undistort( float radialDistX, float radialDistY,
// float tangentDistX, float tangentDistY,
// float focalX, float focalY,
// float centerX, float centerY ); //in base class
// virtual void remap( IplImage* mapX, IplImage* mapY ); //in base class
// virtual void warpPerspective( ofPoint& A, ofPoint& B,
// ofPoint& C, ofPoint& D ); //in base class
// virtual void warpIntoMe( ofxCvImage& mom,
// ofPoint src[4], ofPoint dst[4] ); //in base class
// Other Image Operations
//
// virtual int countNonZeroInRegion( int x, int y, int w, int h ); //in base class
protected:
void init();
IplImage* cvGrayscaleImage; // internal helper grayscale, allocated on demand
};
#endif