This class extends others, you can call their methods on an instance of ofxCvShortImage too:
The ofxCvShortImage represents the color data of each pixel as unsigned char variables or values between 0 and 255. They are a slightly smaller (i.e. less data heavy) way of representing the data in an image but they also have less precision than ofxCvFloatImage. Usually when you're capturing from a camera or video into OpenCV, you're using ofxCvShortImage. Keep in mind though that most of the image operations in OpenCV expect a grayscale image, which you can construct using the ofxCvGrayscaleImage.
ofxCvShortImage::ofxCvShortImage(const ofxCvShortImage &mom)
void ofxCvShortImage::addWeighted(ofxCvGrayscaleImage &mom, float f)
Copies the pixel data of an ofxCvGrayscaleImage into the pixel data of the ofxCvShortImage.
Clears the pixel data of the image. The image must be allocated again with a call to allocate() before it can be used.
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.
void ofxCvShortImage::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
Marks the image as changed so that the ofTexture can be updated, if the image contains one.
ofShortPixels & ofxCvShortImage::getRoiShortPixelsRef()
Returns the pixel data of the instance as a ofShortPixels reference. This allows you to directly manipulate the pixels of the ofxCvShortImage.
ofShortPixels & ofxCvShortImage::getShortPixelsRef()
Returns the pixel data of the instance as a ofShortPixels instance.
void ofxCvShortImage::operator=(const int *mom)
void ofxCvShortImage::operator=(const ofxCvColorImage &mom)
void ofxCvShortImage::operator=(const ofxCvFloatImage &mom)
void ofxCvShortImage::operator=(const ofxCvGrayscaleImage &mom)
void ofxCvShortImage::operator=(const ofxCvShortImage &mom)
void ofxCvShortImage::operator=(unsigned char *_pixels)
Sets the ofxCvShortImage from the pixels pointer. Be sure that the pixels are the same size and dimensions as the ofxCvShortImage.
void ofxCvShortImage::resize(int w, int h)
Resizes the image to the w, h passed in.
void ofxCvShortImage::scaleIntoMe(ofxCvImage &mom, int interpolationMethod)
void ofxCvShortImage::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. Possible values are 0 to 255.
void ofxCvShortImage::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. The array is assumed to contain color values.
void ofxCvShortImage::setRoiFromPixels(const unsigned char *_pixels, int w, int h)
This allows you to set the ROI on the image from an ofPixels instance. Region of Interest is a rectangular area in an image, to segment object for further processing. Once the ROI is defined, OpenCV functions will operate on the ROI, reducing the number of pixels that the operation will examine.
Last updated 金曜日, 15 9月 2023 21:22:19 UTC - 89b7d17faa77e847b7de814f7dcea89eeca38653