CMUcam4 Arduino Interface Library
For Firmware Versions 1.00 - 1.03
Application Programmable Interface Online Documentation
|
The CMUcam4 class implements a generic C++ interface library for the CMUcam4. More...
#include <CMUcam4.h>
Public Member Functions | |
CMUcam4 () | |
Initialize the CMUcam4 object to use the default Serial port. | |
CMUcam4 (int port) | |
Initialize the CMUcam4 object to use the port Serial port. | |
int | getPixel (CMUcam4_image_data_t *pointer, int row, int column) |
Gets a pixel (0 or 1) from a binary bitmap data structure. | |
int | setPixel (CMUcam4_image_data_t *pointer, int row, int column, int value) |
Sets a pixel (0 or 1) in a binary bitmap data structure. | |
int | andPixels (CMUcam4_image_data_t *destination, CMUcam4_image_data_t *source0, CMUcam4_image_data_t *source1) |
Logically AND's two binary bitmaps together - useful for image manipulation. | |
int | orPixels (CMUcam4_image_data_t *destination, CMUcam4_image_data_t *source0, CMUcam4_image_data_t *source1) |
Logically OR's two binary bitmaps together - useful for image manipulation. | |
int | xorPixels (CMUcam4_image_data_t *destination, CMUcam4_image_data_t *source0, CMUcam4_image_data_t *source1) |
Logically XOR's two binary bitmaps together - useful for image manipulation. | |
int | notPixels (CMUcam4_image_data_t *destination) |
Logically NOT's a binary bitmap - useful for image manipulation. | |
int | isReadOnly (CMUcam4_directory_entry_t *pointer) |
Returns if a directory entry is read-only (0 or 1). | |
int | isHidden (CMUcam4_directory_entry_t *pointer) |
Returns if a directory entry is hidden (0 or 1). | |
int | isSystem (CMUcam4_directory_entry_t *pointer) |
Returns if a directory entry is system (0 or 1). | |
int | isVolumeID (CMUcam4_directory_entry_t *pointer) |
Returns if a directory entry is the volume ID (0 or 1). | |
int | isDirectory (CMUcam4_directory_entry_t *pointer) |
Returns if a directory entry is a directory (0 or 1). | |
int | isArchive (CMUcam4_directory_entry_t *pointer) |
Returns if a directory entry is ready to archive (0 or 1). | |
int | begin () |
Activates the interface library. | |
int | end () |
Deactivates the interface library. | |
int | getVersion () |
Gets the CMUcam4's firmware version number. | |
int | resetSystem () |
Resets the CMUcam4 device. | |
int | sleepDeeply () |
Causes the CMUcam4 to sleep deeply. | |
int | sleepLightly () |
Causes the CMUcam4 to sleep lightly. | |
int | cameraBrightness (int brightness) |
Change the camera brightness setting - useful for low brightness situations. | |
int | cameraContrast (int contrast) |
Change the camera contrast setting - useful for low contrast situations. | |
int | cameraRegisterRead (int reg) |
Read a camera register value. | |
int | cameraRegisterWrite (int reg, int value, int mask) |
Write a camera register value. | |
int | autoGainControl (int active) |
Turns the camera automatic gain control off or on. | |
int | autoWhiteBalance (int active) |
Turns the camera automatic white balance off or on. | |
int | horizontalMirror (int active) |
Horizontally mirror the camera module image. | |
int | verticalFlip (int active) |
Vertically flip the camera module image. | |
int | blackAndWhiteMode (int active) |
Cause the camera to output a black and white image. | |
int | negativeMode (int active) |
Cause the camera to output a negative image. | |
int | getButtonState () |
Returns the user button state on the CMUcam4. | |
long | getButtonDuration () |
Returns the user button duration in the current state on the CMUcam4 in milliseconds. | |
int | getButtonPressed () |
Returns if the user button was pressed. | |
int | getButtonReleased () |
Returns if the user button was released. | |
int | panInput () |
Gets the digital state of the pan pin on the CMUcam4. | |
int | panOutput (int direction, int output) |
Sets the digital state of the pan pin on the CMUcam4. | |
int | tiltInput () |
Gets the digital state of the tilt pin on the CMUcam4. | |
int | tiltOutput (int direction, int output) |
Sets the digital state of the tilt pin on the CMUcam4. | |
int | getInputs () |
Gets the digital states of the pan and tilt pins on the CMUcam4. | |
int | setOutputs (int directions, int outputs) |
Sets the digital states of the pan and tilt pins on the CMUcam4. | |
int | LEDOff () |
Disables the auxiliary LED on the CMUcam4. | |
int | LEDOn (long frequency) |
Enables the auxiliary LED on the CMUcam4. | |
int | getServoPosition (int servo) |
Gets the pan or tilt servo pulse length in microseconds. | |
int | setServoPosition (int servo, int active, int pulseLength) |
Sets the pan or tilt servo pulse length in microseconds. | |
int | automaticPan (int active, int reverse) |
Setup automatic pan control. | |
int | automaticTilt (int active, int reverse) |
Setup automatic tilt control. | |
int | autoPanParameters (int proportionalGain, int derivativeGain) |
Setup automatic pan control gain values. | |
int | autoTiltParameters (int proportionalGain, int derivativeGain) |
Setup automatic tilt control gain values. | |
int | monitorOff () |
Turn the television monitor signal off. | |
int | monitorOn () |
Turn the television monitor signal on. | |
int | monitorFreeze (int active) |
Freeze the television monitor signal. | |
int | monitorSignal (int active) |
Change the television monitor signal. | |
int | getTrackingParameters (CMUcam4_tracking_parameters_t *pointer) |
Populates a CMUcam4_tracking_parameters_t data structure with the current color tracking threshold parameters in use by the CMUcam4. | |
int | getTrackingWindow (CMUcam4_tracking_window_t *pointer) |
Populates a CMUcam4_tracking_window_t data structure with the current color tracking window parameters in use by the CMUcam4. | |
int | setTrackingParameters () |
Reset the color tracking threshold parameters to track all possible colors. | |
int | setTrackingParameters (int redMin, int redMax, int greenMin, int greenMax, int blueMin, int blueMax) |
Set the color tracking threshold parameters to track a range of colors. | |
int | setTrackingWindow () |
Reset the color tracking window parameters to track all possible pixels. | |
int | setTrackingWindow (int topLeftX, int topLeftY, int bottomRightX, int bottomRightY) |
Set the color tracking window parameters to track a range of pixels. | |
int | idleCamera () |
Causes the CMUcam4 to enter idle mode and do nothing. | |
int | trackColor () |
Causes the CMUcam4 to enter stream mode and begin sending type T data packets. | |
int | trackColor (int redMin, int redMax, int greenMin, int greenMax, int blueMin, int blueMax) |
Causes the CMUcam4 to enter stream mode and begin sending type T data packets. | |
int | trackWindow (int redRange, int greenRange, int blueRange) |
Causes the CMUcam4 to enter stream mode and begin sending type T data packets. | |
int | getHistogram (int channel, int bins) |
Causes the CMUcam4 to enter stream mode and begin sending type H data packets. | |
int | getMean () |
Causes the CMUcam4 to enter stream mode and begin sending type S data packets. | |
int | getTypeFDataPacket (CMUcam4_image_data_t *pointer) |
Waits for a type F data packet to appear in the data stream from the CMUcam4 and stores that type F data packet in a CMUcam4_image_data_t data strucutre. | |
int | getTypeHDataPacket (CMUcam4_histogram_data_1_t *pointer) |
Waits for a type H-1 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_1_t data structure. | |
int | getTypeHDataPacket (CMUcam4_histogram_data_2_t *pointer) |
Waits for a type H-2 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_2_t data structure. | |
int | getTypeHDataPacket (CMUcam4_histogram_data_4_t *pointer) |
Waits for a type H-4 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_4_t data structure. | |
int | getTypeHDataPacket (CMUcam4_histogram_data_8_t *pointer) |
Waits for a type H-8 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_8_t data structure. | |
int | getTypeHDataPacket (CMUcam4_histogram_data_16_t *pointer) |
Waits for a type H-16 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_16_t data structure. | |
int | getTypeHDataPacket (CMUcam4_histogram_data_32_t *pointer) |
Waits for a type H-32 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_32_t data structure. | |
int | getTypeHDataPacket (CMUcam4_histogram_data_64_t *pointer) |
Waits for a type H-64 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_64_t data structure. | |
int | getTypeSDataPacket (CMUcam4_statistics_data_t *pointer) |
Waits for a type S data packet to appear in the data stream from the CMUcam4 and stores that type S data packet in a CMUcam4_statistics_data_t data structure. | |
int | getTypeTDataPacket (CMUcam4_tracking_data_t *pointer) |
Waits for a type T data packet to appear in the data stream from the CMUcam4 and stores that type T data packet in a CMUcam4_tracking_data_t data strucutre. | |
int | pollMode (int active) |
Turn poll mode off or on. | |
int | lineMode (int active) |
Turn line mode off or on. | |
int | switchingMode (int active) |
Turn switching mode off or on. | |
int | testMode (int active) |
Turn test mode off or on. | |
int | colorTracking (int active) |
Turn color tracking off or on. | |
int | histogramTracking (int active) |
Turn histogram tracking off or on. | |
int | invertedFilter (int active) |
Turn the inverted filter off or on. | |
int | noiseFilter (int threshold) |
Turn the noise filter off or on. | |
int | changeAttributes (const char *fileOrDirectoryPathName, const char *attributes) |
Change a file's or directory's attributes on the disk. | |
int | changeDirectory (const char *directoryPathAndName) |
Change the working directory. | |
int | diskInformation (CMUcam4_disk_information_t *pointer) |
Get information about the disk's geometry. | |
int | diskSpace (CMUcam4_disk_space_t *pointer) |
Get information about the disk's free and used sector space. | |
int | formatDisk () |
Deletes all files and directories on the disk. | |
long | listDirectory (CMUcam4_directory_entry_t *pointer, size_t size, unsigned long offset) |
Reads all or part of the entries in the working directory to a buffer. | |
int | makeDirectory (const char *directoryPathAndName) |
Makes a new directory on the disk. | |
int | moveEntry (const char *oldEntryPathAndName, const char *newEntryPathAndName) |
Moves a file or directory on the disk. | |
int | printLine (const char *filePathAndName, const char *textToAppend) |
Prints a line of text to a file. | |
long | filePrint (const char *filePathAndName, uint8_t *buffer, size_t size, unsigned long offset) |
Reads all or part of a file to a buffer. | |
int | removeEntry (const char *fileOrDirectoryPathAndName) |
Deletes a file or empty directory on the disk. | |
int | unmountDisk () |
Unmounts the micro secure digital card. | |
int | dumpBitmap () |
Saves an 80x60 binary bitmap to the disk in BMP file format. | |
int | dumpFrame (int horizontalResolution, int verticalResolution) |
Saves an 640:320:160:80x480:240:120:60 image to the disk in BMP file format. | |
int | sendBitmap (CMUcam4_image_data_t *pointer) |
Receive an 80x60 binary bitmap from the CMUcam4. | |
int | sendFrame (int horizontalResolution, int verticalResolution, uint16_t *buffer, size_t horizonalSize, size_t horizontalOffset, size_t verticalSize, size_t verticalOffset) |
Receive an 640:320:160:80x480:240:120:60 image from the CMUcam4. |
The CMUcam4 class implements a generic C++ interface library for the CMUcam4.
This interface library provides a wrapper function for all native CMUcam4 functions. Addtionally, this interface library has built in utility functions for manipulating data structures and low level camera settings.
CMUcam4 | ( | int | port | ) |
Initialize the CMUcam4 object to use the port
Serial port.
[in] | port | The port. |
Definition at line 34 of file CMUcam4.cpp.
int getPixel | ( | CMUcam4_image_data_t * | pointer, |
int | row, | ||
int | column | ||
) |
Gets a pixel (0 or 1) from a binary bitmap data structure.
[in] | pointer | A pointer to the binary bitmap data structure. |
[in] | row | The pixel row. Must be between 0 and 59. |
[in] | column | The pixel column. Must be between 0 and 79. |
Definition at line 46 of file CMUcam4.cpp.
int setPixel | ( | CMUcam4_image_data_t * | pointer, |
int | row, | ||
int | column, | ||
int | value | ||
) |
Sets a pixel (0 or 1) in a binary bitmap data structure.
[out] | pointer | A pointer to the binary bitmap data structure. |
[in] | row | The pixel row. Must be between 0 and 59. |
[in] | column | The pixel column. Must be between 0 and 79. |
[in] | value | The pixel value (0 or 1). |
Definition at line 60 of file CMUcam4.cpp.
int andPixels | ( | CMUcam4_image_data_t * | destination, |
CMUcam4_image_data_t * | source0, | ||
CMUcam4_image_data_t * | source1 | ||
) |
Logically AND's two binary bitmaps together - useful for image manipulation.
[out] | destination | A pointer to a binary bitmap data structure. |
[in] | source0 | A pointer to a binary bitmap data structure. |
[in] | source1 | A pointer to a binary bitmap data structure. |
Definition at line 81 of file CMUcam4.cpp.
int orPixels | ( | CMUcam4_image_data_t * | destination, |
CMUcam4_image_data_t * | source0, | ||
CMUcam4_image_data_t * | source1 | ||
) |
Logically OR's two binary bitmaps together - useful for image manipulation.
[out] | destination | A pointer to a binary bitmap data structure. |
[in] | source0 | A pointer to a binary bitmap data structure. |
[in] | source1 | A pointer to a binary bitmap data structure. |
Definition at line 101 of file CMUcam4.cpp.
int xorPixels | ( | CMUcam4_image_data_t * | destination, |
CMUcam4_image_data_t * | source0, | ||
CMUcam4_image_data_t * | source1 | ||
) |
Logically XOR's two binary bitmaps together - useful for image manipulation.
[out] | destination | A pointer to a binary bitmap data structure. |
[in] | source0 | A pointer to a binary bitmap data structure. |
[in] | source1 | A pointer to a binary bitmap data structure. |
Definition at line 121 of file CMUcam4.cpp.
int notPixels | ( | CMUcam4_image_data_t * | destination | ) |
Logically NOT's a binary bitmap - useful for image manipulation.
[in,out] | destination | A pointer to a binary bitmap data structure. |
Definition at line 141 of file CMUcam4.cpp.
int isReadOnly | ( | CMUcam4_directory_entry_t * | pointer | ) |
Returns if a directory entry is read-only (0 or 1).
[in] | pointer | A pointer to a directory entry data structure. |
pointer
is NULL. Definition at line 159 of file CMUcam4.cpp.
int isHidden | ( | CMUcam4_directory_entry_t * | pointer | ) |
Returns if a directory entry is hidden (0 or 1).
[in] | pointer | A pointer to a directory entry data structure. |
pointer
is NULL. Definition at line 172 of file CMUcam4.cpp.
int isSystem | ( | CMUcam4_directory_entry_t * | pointer | ) |
Returns if a directory entry is system (0 or 1).
[in] | pointer | A pointer to a directory entry data structure. |
pointer
is NULL. Definition at line 185 of file CMUcam4.cpp.
int isVolumeID | ( | CMUcam4_directory_entry_t * | pointer | ) |
Returns if a directory entry is the volume ID (0 or 1).
This function is included for completeness only. The CMUcam4's listDirectory function does not list the volume ID located in the root directory.
[in] | pointer | A pointer to a directory entry data structure. |
pointer
is NULL. Definition at line 198 of file CMUcam4.cpp.
int isDirectory | ( | CMUcam4_directory_entry_t * | pointer | ) |
Returns if a directory entry is a directory (0 or 1).
[in] | pointer | A pointer to a directory entry data structure. |
pointer
is NULL. Definition at line 211 of file CMUcam4.cpp.
int isArchive | ( | CMUcam4_directory_entry_t * | pointer | ) |
Returns if a directory entry is ready to archive (0 or 1).
[in] | pointer | A pointer to a directory entry data structure. |
pointer
is NULL. Definition at line 224 of file CMUcam4.cpp.
int begin | ( | ) |
Activates the interface library.
Definition at line 241 of file CMUcam4.cpp.
int end | ( | ) |
Deactivates the interface library.
Definition at line 364 of file CMUcam4.cpp.
int getVersion | ( | ) |
Gets the CMUcam4's firmware version number.
Definition at line 381 of file CMUcam4.cpp.
int resetSystem | ( | ) |
Resets the CMUcam4 device.
Definition at line 386 of file CMUcam4.cpp.
int sleepDeeply | ( | ) |
Causes the CMUcam4 to sleep deeply.
This disables servo outputs.
Definition at line 391 of file CMUcam4.cpp.
int sleepLightly | ( | ) |
Causes the CMUcam4 to sleep lightly.
This does not disable servo outputs.
Definition at line 396 of file CMUcam4.cpp.
int cameraBrightness | ( | int | brightness | ) |
Change the camera brightness setting - useful for low brightness situations.
[in] | brightness | Between -127 and 127. The default is 0. |
Definition at line 405 of file CMUcam4.cpp.
int cameraContrast | ( | int | contrast | ) |
Change the camera contrast setting - useful for low contrast situations.
[in] | contrast | Between -31 and 31. The default is 0. |
Definition at line 413 of file CMUcam4.cpp.
int cameraRegisterRead | ( | int | reg | ) |
Read a camera register value.
[in] | reg | The register address. Between 0 and 255. |
Definition at line 421 of file CMUcam4.cpp.
int cameraRegisterWrite | ( | int | reg, |
int | value, | ||
int | mask | ||
) |
Write a camera register value.
[in] | reg | The register address. Between 0 and 255. |
[in] | value | The value to write. Between 0 and 255. |
[in] | mask | The mask of bit positions to write to. Between 0 and 255. |
Definition at line 429 of file CMUcam4.cpp.
int autoGainControl | ( | int | active | ) |
Turns the camera automatic gain control off or on.
[in] | active | 0 for off and 1 for on. |
Definition at line 441 of file CMUcam4.cpp.
int autoWhiteBalance | ( | int | active | ) |
Turns the camera automatic white balance off or on.
[in] | active | 0 for off and 1 for on. |
Definition at line 449 of file CMUcam4.cpp.
int horizontalMirror | ( | int | active | ) |
Horizontally mirror the camera module image.
[in] | active | 0 for normal mode and 1 for horizontally mirrored mode. |
Definition at line 461 of file CMUcam4.cpp.
int verticalFlip | ( | int | active | ) |
Vertically flip the camera module image.
[in] | active | 0 for normal mode and 1 for vertically flipped mode. |
Definition at line 469 of file CMUcam4.cpp.
int blackAndWhiteMode | ( | int | active | ) |
Cause the camera to output a black and white image.
[in] | active | 0 for normal mode and 1 for black and white mode. |
Definition at line 481 of file CMUcam4.cpp.
int negativeMode | ( | int | active | ) |
Cause the camera to output a negative image.
[in] | active | 0 for normal mode and 1 for negative mode. |
Definition at line 489 of file CMUcam4.cpp.
int getButtonState | ( | ) |
Returns the user button state on the CMUcam4.
0 for released. 1 for pressed.
Definition at line 501 of file CMUcam4.cpp.
long getButtonDuration | ( | ) |
Returns the user button duration in the current state on the CMUcam4 in milliseconds.
Between 0 and 65,535 milliseconds.
Definition at line 506 of file CMUcam4.cpp.
int getButtonPressed | ( | ) |
Returns if the user button was pressed.
0 for no and 1 for yes.
Definition at line 527 of file CMUcam4.cpp.
int getButtonReleased | ( | ) |
Returns if the user button was released.
0 for no and 1 for yes.
Definition at line 532 of file CMUcam4.cpp.
int panInput | ( | ) |
Gets the digital state of the pan pin on the CMUcam4.
Definition at line 537 of file CMUcam4.cpp.
int panOutput | ( | int | direction, |
int | output | ||
) |
Sets the digital state of the pan pin on the CMUcam4.
[in] | direction | The boolean direction state. 0 for input. 1 for output. |
[in] | output | The boolean output state. 0 for low. 1 for high. |
Definition at line 542 of file CMUcam4.cpp.
int tiltInput | ( | ) |
Gets the digital state of the tilt pin on the CMUcam4.
Definition at line 550 of file CMUcam4.cpp.
int tiltOutput | ( | int | direction, |
int | output | ||
) |
Sets the digital state of the tilt pin on the CMUcam4.
[in] | direction | The boolean direction state. 0 for input. 1 for output. |
[in] | output | The boolean output state. 0 for low. 1 for high. |
Definition at line 555 of file CMUcam4.cpp.
int getInputs | ( | ) |
Gets the digital states of the pan and tilt pins on the CMUcam4.
The pan pin is bit 0. The tilt pin is bit 1.
Definition at line 563 of file CMUcam4.cpp.
int setOutputs | ( | int | directions, |
int | outputs | ||
) |
Sets the digital states of the pan and tilt pins on the CMUcam4.
The pan pin is bit 0. The tilt pin is bit 1.
[in] | directions | The boolean direction states. 0 for input. 1 for output. |
[in] | outputs | The boolean output states. 0 for low. 1 for high. |
Definition at line 568 of file CMUcam4.cpp.
int LEDOff | ( | ) |
Disables the auxiliary LED on the CMUcam4.
Definition at line 576 of file CMUcam4.cpp.
int LEDOn | ( | long | frequency | ) |
Enables the auxiliary LED on the CMUcam4.
[in] | frequency | The frequency to blink the auxiliary to at. Between 0 Hz and 10,000,000 Hz. -1 to turn off. |
Definition at line 581 of file CMUcam4.cpp.
int getServoPosition | ( | int | servo | ) |
Gets the pan or tilt servo pulse length in microseconds.
Between 750 to 2,250 us - 0 when the servo is disabled.
[in] | servo | The servo number. 0 for pan and 1 for tilt. |
Definition at line 593 of file CMUcam4.cpp.
int setServoPosition | ( | int | servo, |
int | active, | ||
int | pulseLength | ||
) |
Sets the pan or tilt servo pulse length in microseconds.
Between 750 to 2,250 us.
[in] | servo | The servo number. 0 for pan and 1 for tilt. |
[in] | active | The servo state. 0 for disabled and 1 for enabled. |
[in] | pulseLength | The servo pulse length in microseconds. |
Definition at line 601 of file CMUcam4.cpp.
int automaticPan | ( | int | active, |
int | reverse | ||
) |
Setup automatic pan control.
[in] | active | The function state. 0 for disabled and 1 for enabled. |
[in] | reverse | 0 for not reversed and 1 for reversed. |
Definition at line 609 of file CMUcam4.cpp.
int automaticTilt | ( | int | active, |
int | reverse | ||
) |
Setup automatic tilt control.
[in] | active | The function state. 0 for disabled and 1 for enabled. |
[in] | reverse | 0 for not reversed and 1 for reversed. |
Definition at line 617 of file CMUcam4.cpp.
int autoPanParameters | ( | int | proportionalGain, |
int | derivativeGain | ||
) |
Setup automatic pan control gain values.
[in] | proportionalGain | PD loop P gain. Between 0 (disable) and 1000. |
[in] | derivativeGain | PD loop D gain. Between 0 (disable) and 1000. |
Definition at line 625 of file CMUcam4.cpp.
int autoTiltParameters | ( | int | proportionalGain, |
int | derivativeGain | ||
) |
Setup automatic tilt control gain values.
[in] | proportionalGain | PD loop P gain. Between 0 (disable) and 1000. |
[in] | derivativeGain | PD loop D gain. Between 0 (disable) and 1000. |
Definition at line 633 of file CMUcam4.cpp.
int monitorOff | ( | ) |
Turn the television monitor signal off.
Definition at line 645 of file CMUcam4.cpp.
int monitorOn | ( | ) |
Turn the television monitor signal on.
Definition at line 650 of file CMUcam4.cpp.
int monitorFreeze | ( | int | active | ) |
Freeze the television monitor signal.
[in] | active | 0 to unfreeze and 1 to freeze. |
Definition at line 655 of file CMUcam4.cpp.
int monitorSignal | ( | int | active | ) |
Change the television monitor signal.
[in] | active | 0 for NTSC and 1 for PAL. |
Definition at line 663 of file CMUcam4.cpp.
int getTrackingParameters | ( | CMUcam4_tracking_parameters_t * | pointer | ) |
Populates a CMUcam4_tracking_parameters_t data structure with the current color tracking threshold parameters in use by the CMUcam4.
[out] | pointer | A pointer to a CMUcam4_tracking_parameters_t data structure. |
Definition at line 675 of file CMUcam4.cpp.
int getTrackingWindow | ( | CMUcam4_tracking_window_t * | pointer | ) |
Populates a CMUcam4_tracking_window_t data structure with the current color tracking window parameters in use by the CMUcam4.
[out] | pointer | A pointer to a CMUcam4_tracking_window_t data structure. |
Definition at line 707 of file CMUcam4.cpp.
int setTrackingParameters | ( | ) |
Reset the color tracking threshold parameters to track all possible colors.
Definition at line 737 of file CMUcam4.cpp.
int setTrackingParameters | ( | int | redMin, |
int | redMax, | ||
int | greenMin, | ||
int | greenMax, | ||
int | blueMin, | ||
int | blueMax | ||
) |
Set the color tracking threshold parameters to track a range of colors.
A pixel's red, green, and blue components must fall between the redMin
, redMax
, greenMin
, greenMax
, blueMin
, and blueMax
thresholds for the pixel to be tracked.
[in] | redMin | The minimum red threshold - between 0 to 255. |
[in] | redMax | The maximum red threshold - between 0 to 255. |
[in] | greenMin | The minimum green threshold - between 0 to 255. |
[in] | greenMax | The maximum green threshold - between 0 to 255. |
[in] | blueMin | The minimum blue threshold - between 0 to 255. |
[in] | blueMax | The maximum blue threshold - between 0 to 255. |
Definition at line 742 of file CMUcam4.cpp.
int setTrackingWindow | ( | ) |
Reset the color tracking window parameters to track all possible pixels.
Definition at line 754 of file CMUcam4.cpp.
int setTrackingWindow | ( | int | topLeftX, |
int | topLeftY, | ||
int | bottomRightX, | ||
int | bottomRightY | ||
) |
Set the color tracking window parameters to track a range of pixels.
A pixel's horizontal position and vertical position must fall between the topLeftX
, topLeftY
, bottomRightX
, and bottomRightY
positions for the pixel to be tracked.
[in] | topLeftX | Top left X position (X1) - between 0 and 159. |
[in] | topLeftY | Top left Y position (Y1) - between 0 and 119. |
[in] | bottomRightX | Bottom right X position (X2) - between X1 and 159. |
[in] | bottomRightY | Bottom right Y position (Y2) - between Y2 and 119. |
Definition at line 759 of file CMUcam4.cpp.
int idleCamera | ( | ) |
Causes the CMUcam4 to enter idle mode and do nothing.
The CMUcam4 will automatically exit streaming mode if any function other than the getType_DataPackets functions is called.
Definition at line 770 of file CMUcam4.cpp.
int trackColor | ( | ) |
Causes the CMUcam4 to enter stream mode and begin sending type T data packets.
Only the getType_DataPackets functions may be called after calling this function to get packets. The CMUcam4 will automatically exit streaming mode if any function other than the getType_DataPackets functions is called. This function doesn't change the color tracking settings when called.
Definition at line 804 of file CMUcam4.cpp.
int trackColor | ( | int | redMin, |
int | redMax, | ||
int | greenMin, | ||
int | greenMax, | ||
int | blueMin, | ||
int | blueMax | ||
) |
Causes the CMUcam4 to enter stream mode and begin sending type T data packets.
Only the getType_DataPackets functions may be called after calling this function to get packets. The CMUcam4 will automatically exit streaming mode if any function other than the getType_DataPackets functions is called. This function does change the color tracking settings when called.
[in] | redMin | The minimum red threshold - between 0 to 255. |
[in] | redMax | The maximum red threshold - between 0 to 255. |
[in] | greenMin | The minimum green threshold - between 0 to 255. |
[in] | greenMax | The maximum green threshold - between 0 to 255. |
[in] | blueMin | The minimum blue threshold - between 0 to 255. |
[in] | blueMax | The maximum blue threshold - between 0 to 255. |
Definition at line 809 of file CMUcam4.cpp.
int trackWindow | ( | int | redRange, |
int | greenRange, | ||
int | blueRange | ||
) |
Causes the CMUcam4 to enter stream mode and begin sending type T data packets.
Only the getType_DataPackets functions may be called after calling this function to get packets. The CMUcam4 will automatically exit streaming mode if any function other than the getType_DataPackets functions is called. This function automatically changes the color tracking settings when called.
[in] | redRange | The red average from the center of the color tracking window plus and minus the redRange is used to set the redMax and redMin values for the color tracking threshold parameters. |
[in] | greenRange | The green average from the center of the color tracking window plus and minus the greenRange is used to set the greenMax and greenMin values for the color tracking threshold parameters. |
[in] | blueRange | The blue average from the center of the color tracking window plus and minus the blueRange is used to set the blueMax and blueMin values for the color tracking threshold parameters. |
Definition at line 821 of file CMUcam4.cpp.
int getHistogram | ( | int | channel, |
int | bins | ||
) |
Causes the CMUcam4 to enter stream mode and begin sending type H data packets.
Only the getType_DataPackets functions may be called after calling this function to get packets. The CMUcam4 will automatically exit streaming mode if any function other than the getType_DataPackets functions is called. The red and blue channels can have up to 32 bins. The green channel can have up to 64 bins.
[in] | channel | The color channel of the histogram to send: 0 = Red Channel, 1 = Green Channel, 2 = Blue Channel. |
[in] | bins | The number of bins of the histogram channel to send: 0=1 bin, 1=2 bins, 2=4 bins, 3=8 bins, 4=16 bins, 5=32 bins, 6=64 bins. |
Definition at line 830 of file CMUcam4.cpp.
int getMean | ( | ) |
Causes the CMUcam4 to enter stream mode and begin sending type S data packets.
Only the getType_DataPackets functions may be called after calling this function to get packets. The CMUcam4 will automatically exit streaming mode if any function other than the getType_DataPackets functions is called.
Definition at line 839 of file CMUcam4.cpp.
int getTypeFDataPacket | ( | CMUcam4_image_data_t * | pointer | ) |
Waits for a type F data packet to appear in the data stream from the CMUcam4 and stores that type F data packet in a CMUcam4_image_data_t data strucutre.
A stream of type F data packets must be started first for this function not to fail and timeout waiting for a type F data packet.
[out] | pointer | A pointer to a CMUcam4_image_data_t data structure to store the received type F data packet to. |
Definition at line 844 of file CMUcam4.cpp.
int getTypeHDataPacket | ( | CMUcam4_histogram_data_1_t * | pointer | ) |
Waits for a type H-1 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_1_t data structure.
A stream of type H-1 data packets must be started first for this function not to fail and timeout waiting for a type H-1 data packet.
[out] | pointer | A pointer to a CMUcam4_histogram_data_1_t data structure to store the received type H-1 data packet to. |
Definition at line 874 of file CMUcam4.cpp.
int getTypeHDataPacket | ( | CMUcam4_histogram_data_2_t * | pointer | ) |
Waits for a type H-2 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_2_t data structure.
A stream of type H-2 data packets must be started first for this function not to fail and timeout waiting for a type H-2 data packet.
[out] | pointer | A pointer to a CMUcam4_histogram_data_2_t data structure to store the received type H-2 data packet to. |
Definition at line 906 of file CMUcam4.cpp.
int getTypeHDataPacket | ( | CMUcam4_histogram_data_4_t * | pointer | ) |
Waits for a type H-4 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_4_t data structure.
A stream of type H-4 data packets must be started first for this function not to fail and timeout waiting for a type H-4 data packet.
[out] | pointer | A pointer to a CMUcam4_histogram_data_4_t data structure to store the received type H-4 data packet to. |
Definition at line 938 of file CMUcam4.cpp.
int getTypeHDataPacket | ( | CMUcam4_histogram_data_8_t * | pointer | ) |
Waits for a type H-8 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_8_t data structure.
A stream of type H-8 data packets must be started first for this function not to fail and timeout waiting for a type H-8 data packet.
[out] | pointer | A pointer to a CMUcam4_histogram_data_8_t data structure to store the received type H-8 data packet to. |
Definition at line 970 of file CMUcam4.cpp.
int getTypeHDataPacket | ( | CMUcam4_histogram_data_16_t * | pointer | ) |
Waits for a type H-16 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_16_t data structure.
A stream of type H-16 data packets must be started first for this function not to fail and timeout waiting for a type H-16 data packet.
[out] | pointer | A pointer to a CMUcam4_histogram_data_16_t data structure to store the received type H-16 data packet to. |
Definition at line 1002 of file CMUcam4.cpp.
int getTypeHDataPacket | ( | CMUcam4_histogram_data_32_t * | pointer | ) |
Waits for a type H-32 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_32_t data structure.
A stream of type H-32 data packets must be started first for this function not to fail and timeout waiting for a type H-32 data packet.
[out] | pointer | A pointer to a CMUcam4_histogram_data_32_t data structure to store the received type H-32 data packet to. |
Definition at line 1034 of file CMUcam4.cpp.
int getTypeHDataPacket | ( | CMUcam4_histogram_data_64_t * | pointer | ) |
Waits for a type H-64 data packet to appear in the data stream from the CMUcam4 and stores that type H data packet in a CMUcam4_histogram_data_64_t data structure.
A stream of type H-64 data packets must be started first for this function not to fail and timeout waiting for a type H-64 data packet.
[out] | pointer | A pointer to a CMUcam4_histogram_data_64_t data structure to store the received type H-64 data packet to. |
Definition at line 1066 of file CMUcam4.cpp.
int getTypeSDataPacket | ( | CMUcam4_statistics_data_t * | pointer | ) |
Waits for a type S data packet to appear in the data stream from the CMUcam4 and stores that type S data packet in a CMUcam4_statistics_data_t data structure.
A stream of type S data packets must be started first for this function not to fail and timeout waiting for a type S data packet.
[out] | pointer | A pointer to a CMUcam4_statistics_data_t data structure to store the received type S data packet to. |
Definition at line 1098 of file CMUcam4.cpp.
int getTypeTDataPacket | ( | CMUcam4_tracking_data_t * | pointer | ) |
Waits for a type T data packet to appear in the data stream from the CMUcam4 and stores that type T data packet in a CMUcam4_tracking_data_t data strucutre.
A stream of type T data packets must be started first for this function not to fail and timeout waiting for a type T data packet.
[out] | pointer | A pointer to a CMUcam4_tracking_data_t data structure to store the received type T data packet to. |
Definition at line 1129 of file CMUcam4.cpp.
int pollMode | ( | int | active | ) |
Turn poll mode off or on.
Poll mode causes the CMUcam4 to send one and only one type F, H, S, or T packet after calling CMUcam4::trackColor(), CMUcam4::trackWindow(), CMUcam4::getHistogram(), or CMUcam4::getMean() instead of a stream of packets that the CMUcam4 would normally send.
[in] | active | 0 for off and 1 for on. |
Definition at line 1156 of file CMUcam4.cpp.
int lineMode | ( | int | active | ) |
Turn line mode off or on.
Line mode causes the CMUcam4 to send type F data packets after sending type H, S, or T data packets.
[in] | active | 0 for off and 1 for on. |
Definition at line 1164 of file CMUcam4.cpp.
int switchingMode | ( | int | active | ) |
Turn switching mode off or on.
Switching mode causes the CMUcam4 to send type S data packets after sending type T data packets and vice versa.
[in] | active | 0 for off and 1 for on. |
Definition at line 1172 of file CMUcam4.cpp.
int testMode | ( | int | active | ) |
Turn test mode off or on.
Test mode causes the CMUcam4 to process an image of color bars instead of processing the normal image.
[in] | active | 0 for off and 1 for on. |
Definition at line 1180 of file CMUcam4.cpp.
int colorTracking | ( | int | active | ) |
Turn color tracking off or on.
If off, then the CMUcam4 operates in RGB mode. In RGB mode R maps to the red channel, G maps to the green channel, and B maps to the blue channel.
If on, then the CMUcam4 operates in YUV mode. In YUV mode Y maps to the green channel, U maps to the blue channel, and V maps to the red channel.
[in] | active | 0 for off and 1 for on. |
Definition at line 1188 of file CMUcam4.cpp.
int histogramTracking | ( | int | active | ) |
Turn histogram tracking off or on.
If off, then the CMUcam4 calculates the histogram and image statisitcs on all tracked and untracked pixels inside of the color tracking window.
If on, then the CMUcam4 calculates the histogram and image statisitcs on all tracked pixels inside of the color tracking window.
[in] | active | 0 for off and 1 for on. |
Definition at line 1196 of file CMUcam4.cpp.
int invertedFilter | ( | int | active | ) |
Turn the inverted filter off or on.
If off, then the CMUcam4 tracks all pixels that fall inside of the color tracking bounds.
If on, then the CMUcam4 tracks all pixels that fall outside of the color tracking bounds.
[in] | active | 0 for off and 1 for on. |
Definition at line 1204 of file CMUcam4.cpp.
int noiseFilter | ( | int | threshold | ) |
Turn the noise filter off or on.
[in] | threshold | 0 for off and 1 or more for on. |
Definition at line 1212 of file CMUcam4.cpp.
int changeAttributes | ( | const char * | fileOrDirectoryPathName, |
const char * | attributes | ||
) |
Change a file's or directory's attributes on the disk.
[in] | fileOrDirectoryPathName | The file or directory to change. |
[in] | attributes | The new attribute string. E.g. "RHSA" or "_". |
Definition at line 1224 of file CMUcam4.cpp.
int changeDirectory | ( | const char * | directoryPathAndName | ) |
Change the working directory.
[in] | directoryPathAndName | The directory to change to. |
Definition at line 1239 of file CMUcam4.cpp.
int diskInformation | ( | CMUcam4_disk_information_t * | pointer | ) |
Get information about the disk's geometry.
[out] | pointer | A pointer to a CMUcam4_disk_information_t structure to be filled with information about the disk's geometry. |
Definition at line 1253 of file CMUcam4.cpp.
int diskSpace | ( | CMUcam4_disk_space_t * | pointer | ) |
Get information about the disk's free and used sector space.
[out] | pointer | A pointer to a CMUcam4_disk_space_t structure to be filled with information about the disk's free and used sector space. |
Definition at line 1293 of file CMUcam4.cpp.
int formatDisk | ( | ) |
Deletes all files and directories on the disk.
Definition at line 1323 of file CMUcam4.cpp.
long listDirectory | ( | CMUcam4_directory_entry_t * | pointer, |
size_t | size, | ||
unsigned long | offset | ||
) |
Reads all or part of the entries in the working directory to a buffer.
[out] | pointer | The array to store directory entry information to. |
[in] | size | The size of the CMUcam4_directory_entry_t array. |
[in] | offset | The number of entries to skip before storing. |
Definition at line 1328 of file CMUcam4.cpp.
int makeDirectory | ( | const char * | directoryPathAndName | ) |
Makes a new directory on the disk.
[in] | directoryPathAndName | The new directory to make. |
Definition at line 1388 of file CMUcam4.cpp.
int moveEntry | ( | const char * | oldEntryPathAndName, |
const char * | newEntryPathAndName | ||
) |
Moves a file or directory on the disk.
[in] | oldEntryPathAndName | The source entry to move. |
[in] | newEntryPathAndName | The destination of the entry to move. |
Definition at line 1402 of file CMUcam4.cpp.
int printLine | ( | const char * | filePathAndName, |
const char * | textToAppend | ||
) |
Prints a line of text to a file.
[in] | filePathAndName | The file to append to. |
[in] | textToAppend | The string to append to the file. |
Definition at line 1417 of file CMUcam4.cpp.
long filePrint | ( | const char * | filePathAndName, |
uint8_t * | buffer, | ||
size_t | size, | ||
unsigned long | offset | ||
) |
Reads all or part of a file to a buffer.
[in] | filePathAndName | The file to read. |
[out] | buffer | The buffer to store all or part of the file to. |
[in] | size | The size of the buffer in bytes. |
[in] | offset | The offset in the file to start to read from in bytes. |
Definition at line 1431 of file CMUcam4.cpp.
int removeEntry | ( | const char * | fileOrDirectoryPathAndName | ) |
Deletes a file or empty directory on the disk.
[in] | fileOrDirectoryPathAndName | The file or directory to delete. |
Definition at line 1470 of file CMUcam4.cpp.
int unmountDisk | ( | ) |
Unmounts the micro secure digital card.
Other file system functions automatically mount the disk by default. This function must be called to explictly unmount the disk before removal.
Definition at line 1484 of file CMUcam4.cpp.
int dumpBitmap | ( | ) |
Saves an 80x60 binary bitmap to the disk in BMP file format.
The saved binary bitmap is the 160x120 segmented color tracking image down-sampled to 80x60.
Definition at line 1493 of file CMUcam4.cpp.
int dumpFrame | ( | int | horizontalResolution, |
int | verticalResolution | ||
) |
Saves an 640:320:160:80x480:240:120:60 image to the disk in BMP file format.
Use this function to get feedback about what the CMUcam4 sees.
[in] | horizontalResolution | The horizontal resolution to save the image with: 0=640 pixels, 1=320 pixels, 2=160 pixels, 3=80 pixels. |
[in] | verticalResolution | The vertical resolution to save the image with: 0=480 pixels, 1=240 pixels, 2=160 pixels, 3=60 pixels. |
Definition at line 1498 of file CMUcam4.cpp.
int sendBitmap | ( | CMUcam4_image_data_t * | pointer | ) |
Receive an 80x60 binary bitmap from the CMUcam4.
The sent binary bitmap is the 160x120 segmented color tracking image down-sampled to 80x60.
[out] | pointer | The address of where to put the received binary bitmap. |
Definition at line 1507 of file CMUcam4.cpp.
int sendFrame | ( | int | horizontalResolution, |
int | verticalResolution, | ||
uint16_t * | buffer, | ||
size_t | horizonalSize, | ||
size_t | horizontalOffset, | ||
size_t | verticalSize, | ||
size_t | verticalOffset | ||
) |
Receive an 640:320:160:80x480:240:120:60 image from the CMUcam4.
Use this function to get feedback about what the CMUcam4 sees.
[in] | horizontalResolution | The horizontal resolution to send the image in: 0=640 pixels, 1=320 pixels, 2=160 pixels, 3=80 pixels. |
[in] | verticalResolution | The vertical resolution to send the image in: 0=480 pixels, 1=240 pixels, 2=160 pixels, 3=60 pixels. |
[out] | buffer | The address of where to put the received RGB565 bitmap. |
[in] | horizonalSize | The horizontal size of the array in 16-bit words. |
[in] | horizontalOffset | A horizontal pixel offset within the image to start to store image data from. The horizontalOffset plus the array horizonalSize must be less than or equal the selected horizontal resolution. |
[in] | verticalSize | The vertical size of the array. |
[in] | verticalOffset | A vertical pixel offset within the image to start to store image data from. The verticalOffset plus the array verticalSize must be less than or equal the selected vertical resolution. |
Definition at line 1537 of file CMUcam4.cpp.