#include <frame.h>
The frame class is really just an extended struct. It allocates space for an image of the proper size, but can also do more complicated things like image processing. Color blob detection, saving to file, and displaying an image are just some of the planned features for this class.
Definition at line 56 of file frame.h.
Public Member Functions | |
| Frame () | |
| Constructor. | |
| Frame (struct camParams params) | |
| Constructor. | |
| Frame (int x, int y, int bpp) | |
| Constructor. | |
| ~Frame () | |
| Deconstructor. | |
| void | convertToHSV () |
| Converts a frame to HSV from RGB. | |
| void | convertToRGB () |
| Converts a frame to YUV420P from RGB. | |
| int | saveToFile (char *file, int fileType) |
| Saves an image to file. | |
| void | filterNoise () |
| Filters noise out of a threshholded frame. | |
| void | copy (struct Frame *dest) |
| Copies one frame to another. | |
| threshStats | thresh (int min1, int max1, int min2, int max2, int min3, int max3) |
| Threshholds an image based on RGB or HSV values. | |
| threshStats | thresh (int min1, int max1, int min2, int max2, int min3, int max3, int colorFlag) |
| Threshholds an image based on RGB or HSV values. | |
| growStats | grow (int pixelThresh, int numObjects) |
| Runs the noise reducing grow filter and separates objects. | |
| void | setPixel (int x, int y, int r, int g, int b) |
| Sets the color of a frame pixel. | |
| void | setLine (int x1, int y1, int x2, int y2, int r, int g, int b) |
| Draws a line to the Frame buffer. | |
| void | clear (int r, int g, int b) |
| Fills the frame with the specified color. | |
Public Attributes | |
| unsigned char * | buffer |
| Array to hold pixel values. | |
| unsigned char * | buffer2 |
| Array to hold pixel values for conversions. | |
| int | width |
| Width of frame. | |
| int | height |
| Height of frame. | |
| int | palette |
| Palette type of frame. | |
| float | redMask |
| Percent of red to show (0.0 - 1.0). | |
| float | greenMask |
| Percent of green to show (0.0 - 1.0). | |
| float | blueMask |
| Percent of blue to show (0.0 - 1.0). | |
| int | masked |
| Masking flag. | |
|
|
Constructor. Initializes the frame and makes space for it in RAM. Uses a guess for the buffer size. Definition at line 9 of file frame.cpp. References blueMask, buffer, greenMask, height, masked, redMask, and width. |
|
|
Constructor. Initializes the frame and makes space for it in RAM. Uses captured camera parameters to determine buffer size.
|
|
||||||||||||||||
|
Constructor. Initializes the frame and makes space for it in RAM. Uses supplied parameters to determine buffer size.
Definition at line 34 of file frame.cpp. References blueMask, buffer, greenMask, height, masked, redMask, and width. |
|
|
Deconstructor. Ensures that frame space in RAM is cleared and free to the OS. |
|
||||||||||||||||
|
Fills the frame with the specified color. This method simply iterates through all the pixels in the Frame buffer and colors them to the given color. It uese the setPixel() method.
Definition at line 133 of file frame.cpp. References height, setPixel(), and width. Referenced by Map::render(). |
|
|
Converts a frame to HSV from RGB. This method uses the RGBtoHSV() function to convert each pixel value form the RGB colorspace to the HSV colorspace. Definition at line 51 of file frame.cpp. References buffer, height, and width. Referenced by Tracker::track(). |
|
|
Converts a frame to YUV420P from RGB. This method uses the ccvt_420p_rgb32() function from the ccvt libarary to convert each pixel value form the YUV colorspace to the RGB colorspace. Definition at line 65 of file frame.cpp. References buffer, buffer2, height, and width. Referenced by Camera::capture(). |
|
|
Copies one frame to another. This method simply copies the contents of this frame's buffer into the destination Frame's buffer. Other settings and variables are not passed. Make sure the destination Frame is of the proper type and size!
Definition at line 142 of file frame.cpp. References buffer, height, and width. Referenced by Tracker::track(). |
|
|
Filters noise out of a threshholded frame. This method is needed to filter out the noise that is usually associated with a threshhold operation. In this case, each pixel is checked to see that at least some of the pixels around it are also threshholded. If not, then the pixel in question is removed from the threshhold results. |
|
||||||||||||
|
Runs the noise reducing grow filter and separates objects. This method scans through a threshholded frame and looks for large groupings of pixels. These groups are identified and the centroid of the blob is calculated. The user can specify the number of groups to search for. Only the largest groups will be returned to the user and the rest will be eliminated.
Definition at line 223 of file frame.cpp. References buffer, height, growStats::objects, growStats::size, width, growStats::x, Point2D::x, growStats::y, and Point2D::y. |
|
||||||||||||
|
Saves an image to file. Reads the entire contents of the image buffer and copies it to a file, compressing it as specified by the fileType parameter.
|
|
||||||||||||||||||||||||||||||||
|
Draws a line to the Frame buffer. This method uses a fast, integer based line drawing algorithm to write a line to the Frame buffer.
Definition at line 340 of file frame.cpp. References height, setPixel(), width, Point2D::x, and Point2D::y. Referenced by Map::plotLine(), and Map::render(). |
|
||||||||||||||||||||||||
|
Sets the color of a frame pixel. This method simply calculates the correct offset in the frame array and set the color to the value specified. This should be much faster than using the gui.setPixel()
Definition at line 124 of file frame.cpp. Referenced by clear(), Map::plot(), and setLine(). |
|
||||||||||||||||||||||||||||||||
|
Threshholds an image based on RGB or HSV values. This method scans through the entire frame buffer looking for pixel that satisfy the specified commands. For now the selected pixels are simply overwritten with the color bright green. It should be noted that the first min and max paramaters will roll over if the max is less than the min. This is useful for hue, where the span rolls back over at the color red.
Definition at line 154 of file frame.cpp. References buffer, height, width, threshStats::x, and threshStats::y. |
|
||||||||||||||||||||||||||||
|
Threshholds an image based on RGB or HSV values. This method is the old version of thresh. Please use the newer version which has support for colorFlag. This method will automatically initiate the binary coloring feature of the original thresh() method.
|
|
|
Palette type of frame. (see v4l API) |
1.4.2