ofDocsdocumentation addons ofxOpenCv ofxCvColorImage

ofxCvColorImage

The ofxCvColorImage represents the data of each pixel as unsigned char values, like the ofxCvGrayscaleImage, but has 3 channels, RGB, to represent color images.


allocatePixels( ... )

void allocatePixels(int w, int h)

allocateTexture( )

void allocateTexture()

clear( )

void clear()

Clears the pixel data of the image. The image must be allocated again with a call to allocate() before it can be used.


contrastStretch( )

void contrastStretch()

This increases the contrast of the image remapping the brightest points in the image to white and the darkest points in the image to black.


convertHsvToRgb( )

void convertHsvToRgb()

Converts the image from values in the Hue Saturation and Value color space (sometimes called Hue Saturation Brightness) to values in the Red Green and Blue color space.


convertRgbToHsv( )

void convertRgbToHsv()

Converts the image from values in the Red Green and Blue color space to values in the Hue Saturation and Value color space (sometimes called Hue Saturation Brightness)

HSV


convertToGrayscalePlanarImage( ... )

void convertToGrayscalePlanarImage(ofxCvGrayscaleImage &grayImage, int whichPlane)

Copies the pixels of the ofxCvColorImage into an ofxCvGrayscale image. You can optionally specify whether you want to use the R G or B channel of the ofxCvColorImage to set the values of the ofxCvGrayscale.


convertToGrayscalePlanarImages( ... )

void convertToGrayscalePlanarImages(ofxCvGrayscaleImage &red, ofxCvGrayscaleImage &green, ofxCvGrayscaleImage &blue)

Copies the different channels of the ofxCvColorImage into 3 different grayscale images using the R G and B channels of the ofxCvColorImage.


convertToRange( ... )

void convertToRange(float min, float max)

Maps the pixels of an image to the min and max range passed in.


colors.setFromPixels(grabber.getPixels());

first = colors; // will leave unaltered
second = colors; // change it
second.convertToRange(100, 140); // super low contrast

Image convert to range


init( )

void init()

ofxCvColorImage( )

ofxCvColorImage()

Constructor.


ofxCvColorImage( ... )

ofxCvColorImage(const ofxCvColorImage &mom)

Copy constructor, which allows you to this:

ofxCvShortImage old;
// allocate old
ofxCvShortImage new(old);

operator+=( ... )

void operator+=(float value)

Adds the pixel data of the right hand side image from the current image:

first += second; // both are ofxCvFloatImage instances

operator-=( ... )

void operator-=(float value)

Subtracts the pixel data of the right hand side image from the current image:

first -= second; // both are ofxCvFloatImage instances

operator=( ... )

void operator=(const ofPixels &_pixels)

Copies the data from an IplImage into the ofxCvColorImage using the = symbol.


operator=( ... )

void operator=(const ofxCvGrayscaleImage &mom)

Copies ofxCvGrayscaleImage to another ofxCvShortImage using the = symbol.

imageOne = imageTwo; // make sure that the dimensions and ROI match






operator=( ... )

void operator=(const ofxCvColorImage &mom)

Copies the data from an ofxCvColorImage into the instance using the = symbol.

colorImage1 = colorImage2; // make sure that the dimensions and ROI match

operator=( ... )

void operator=(const ofxCvFloatImage &mom)

Copies the data from an ofxCvFloatImage into a ofxCvShortImage using the = symbol.

colorImage = floatColorImage; // make sure that the dimensions and ROI match

operator=( ... )

void operator=(const ofxCvShortImage &mom)

Copies the data from a ofxCvShortImage into the ofxCvColorImage using the = symbol.

colorImage = shortColorImage; // make sure that the dimensions and ROI match

operator=( ... )

void operator=(const int *mom)

resize( ... )

void resize(int w, int h)

Resizes the image to the w, h passed in.


scaleIntoMe( ... )

void scaleIntoMe(ofxCvImage &mom, int interpolationMethod)

Scales the image passed in to be the size of the current image,


ofxCvImage first;
first.allocate(640, 480);
ofxCvImage second;
second.allocate(320, 240);

second.scaleIntoMe(first); // first is now 320,240


set( ... )

void set(float value)

Set all the pixels in the image to the float value passed in. This is useful for blanking or filling an image quickly. The values are 0.0 to 1.0.


set( ... )

void set(int valueR, int valueG, int valueB)

Set all the pixels in the image to the float value passed in as a color using 0 to 255 scale for each channel. This is useful for blanking or filling an image quickly.


setFromGrayscalePlanarImages( ... )

void setFromGrayscalePlanarImages(ofxCvGrayscaleImage &red, ofxCvGrayscaleImage &green, ofxCvGrayscaleImage &blue)

This method allows you use multiple ofxCvGrayscaleImage images to create a full color image. Each ofxCvGrayscaleImage represents the data of one channel, r, g, b.


setFromPixels( ... )

void setFromPixels(const unsigned char *_pixels, int w, int h)

Set all the pixels in a ofxCvShortImage from a pointer to an array of unsigned char values, using the w and h parameters to determine the dimensions of the image.


setRoiFromPixels( ... )

void setRoiFromPixels(const unsigned char *_pixels, int w, int h)

Set the Region Of Interest using a pointer to an unsigned char array and a w,h to define the area of the ROI