class methods
Extends
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::ofxCvShortImage(const ofxCvShortImage &mom)
Copy constructor, which allows you to this:
ofxCvShortImage old;
// allocate old
ofxCvShortImage new(old);
addWeighted(...)
void ofxCvShortImage::addWeighted(ofxCvGrayscaleImage &mom, float f)
Copies the pixel data of an ofxCvGrayscaleImage into the pixel data of the ofxCvShortImage.
clear()
void ofxCvShortImage::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 ofxCvShortImage::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.
convertToRange(...)
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
flagImageChanged()
void ofxCvShortImage::flagImageChanged()
Marks the image as changed so that the ofTexture can be updated, if the image contains one.
getRoiShortPixelsRef()
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.
getShortPixelsRef()
ofShortPixels & ofxCvShortImage::getShortPixelsRef()
Returns the pixel data of the instance as a ofShortPixels instance.
operator=(...)
void ofxCvShortImage::operator=(const ofxCvColorImage &mom)
Copies a ofxCvColorImage into a ofxCvShortImage using the = symbol.
grayImage = colorImage; // make sure that the dimensions and ROI match
operator=(...)
void ofxCvShortImage::operator=(const ofxCvFloatImage &mom)
opies a ofxCvFloatImage into a ofxCvShortImage using the = symbol.
grayImage = floatColorImage; // make sure that the dimensions and ROI match
operator=(...)
void ofxCvShortImage::operator=(const ofxCvGrayscaleImage &mom)
Copies ofxCvGrayscaleImage to the ofxCvShortImage using the = symbol.
imageOne = imageTwo; // make sure that the dimensions and ROI match
operator=(...)
void ofxCvShortImage::operator=(const ofxCvShortImage &mom)
Copies a ofxCvShortImage into a ofxCvShortImage using the = symbol.
grayImage = shortColorImage; // make sure that the dimensions and ROI match
operator=(...)
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.
scaleIntoMe(...)
void ofxCvShortImage::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 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.
setFromPixels(...)
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.
setRoiFromPixels(...)
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 토요일, 17 8월 2024 20:45:49 UTC - 99bfb4fd7929e233b87b05758efc36f91505592e
If you have any doubt about the usage of this module you can ask in the forum.
If you want to contribute better documentation or start documenting this section you can do so here
If you find anything wrong with this docs you can report any error by opening an issue