Blame | Last modification | View Log | Download
/*Copyright (C) 2004 John OrlandoAVRcam: a small real-time image processing engine.This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General PublicLicense as published by the Free Software Foundation; eitherversion 2 of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General PublicLicense along with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USAFor more information on the AVRcam, please contact:john@jrobot.netor go to www.jrobot.net for more details regarding the system.*//*********************************************************Module Name: FrameMgr.cModule Date: 04/10/2004Module Auth: John OrlandoDescription: This modules is responsible for performingboth medium and high level processing on image data.This is performed at both the line level as well asthe frame level. It controls the main flow of thesystem, adhering to all the critical timingrequirements (such as when serial data can be transferred,etc).Revision History:Date Rel Ver. Notes4/10/2004 0.1 Module created6/30/2004 1.0 Initial release for Circuit Cellarcontest.11/15/2004 1.2 Updated processLine() function soit will remove objects less thana specified length/width (reducesshot noise)*********************************************************//* Includes */#include <stdlib.h>#include <string.h>#include <avr/io.h>#include "Executive.h"#include "UIMgr.h"#include "FrameMgr.h"#include "CamInterface.h"#include "UartInterface.h"#include "Utility.h"#include "I2CInterface.h"#include "CamConfig.h"#include "CommonDefs.h"/* Local Structures and Typedefs */enum{ST_FrameMgr_idle,ST_FrameMgr_TrackingFrame,ST_FrameMgr_DumpingFrame};typedef unsigned char FrameMgr_State_t;/* Definitions *//* The most objects that can be tracked at any one time is 8.This number is determined by the number of bytes that can besent out during a frame (one byte per line, 144 lines per frame)with the number of bytes in a tracked object (7) + some wiggleroom :-) ... I guess this could be increased to around 20 ifwe had enough room and cycles to process objects between lines */#define MAX_TRACKED_OBJECTS 8/* This defines the number of bytes that make up a trackedObject_tstructure... */#define SIZE_OF_TRACKED_OBJECT 8/* This define is used to turn off the timer overflow interruptthat is generated when the PCLK overflows TIMER1 */#define DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK 0xFB/* This define is used to determine if a run length is too smallto be concerned with. This helps to reduce the number of falsepositives. */#define MIN_OBJECT_TRACKING_WIDTH 3/* This define is used to determine if an object has enoughheight to be considered worth tracking...it is used to reduceshot noise */#define MIN_OBJECT_TRACKING_HEIGHT 3/* This define is used to indicate how often the filter routinethat removes objects less than MIN_OBJECT_TRACKING_HEIGHT shouldbe executed. It is measured in a number of lines (7 nominally). */#define RUN_OBJECT_FILTER_MASK 0x07/* This enum describes the possible colors that canbe tracked by the system. This can't be represented assimple color names (red, brown, etc) due to the fact thatthe user sets which colors will be associated with whichbits. Remember...after the AND operation of the indexedcolor map values executes, either a single bit indicatingthe color should be set, or no bits indicating that thecolor isn't represented in the color map (notTracked). */enum{notTracked,color1, /* bit 1 color */color2, /* bit 2 color */color3, /* bit 3 color */color4, /* bit 4 color */color5, /* bit 5 color */color6, /* bit 6 color */color7, /* bit 7 color */color8 /* bit 8 color */};typedef unsigned char trackedColor_t;/* This structure defines the info that needs to bemaintained for each trackedObject in the trackingTable */typedef struct{trackedColor_t color;unsigned char lastLineXStart;unsigned char lastLineXFinish;unsigned char x_upperLeft;unsigned char y_upperLeft;unsigned char x_lowerRight;unsigned char y_lowerRight;unsigned char objectValid; /* used to be a fill byte...now it isused to determine if the object is validor not...it gets invalidated if it isdetermined that it is too small, orthat the object is within another object */} trackedObject_t;/* These defines are used to index into each individual element in thetrackedObject_t structure. This seems to be MUCH more efficient thanaccessing the elements in GCC. */#define COLOR_OFFSET 0#define LAST_LINE_X_START_OFFSET 1#define LAST_LINE_X_FINISH_OFFSET 2#define X_UPPER_LEFT_OFFSET 3#define Y_UPPER_LEFT_OFFSET 4#define X_LOWER_RIGHT_OFFSET 5#define Y_LOWER_RIGHT_OFFSET 6#define VALID_OBJECT_OFFSET 7/* Local Variables *//* The trackedObjectTable is used to hold up to eight tracked objectswhile they are being acquired. */static trackedObject_t trackedObjectTable[MAX_TRACKED_OBJECTS];static trackedObject_t *pCurrentTrackedObjectTable = trackedObjectTable;static unsigned char lineCount = 0;static FrameMgr_State_t currentState = ST_FrameMgr_idle;static unsigned char numCurrTrackedObjects = 0;static unsigned char numPrevTrackedObjects = 0;static unsigned char trackedLineCount = 0;/* Local Functions */static void FrameMgr_findConnectedness(void);/* Extern Functions *//* These functions are located in assembly files, and thusmust be externed here so they can be referenced in the source below. */extern void CamIntAsm_waitForNewTrackingFrame(unsigned char *pBuffer, unsigned char *pMemLookup);extern void CamIntAsm_waitForNewDumpFrame(unsigned char *pCurrBuffer, unsigned char *pPrevBuffer);extern void CamIntAsm_acquireTrackingLine(unsigned char *pBuffer, unsigned char *pMemLookup);extern void CamIntAsm_acquireDumpLine(unsigned char *pCurrBuffer, unsigned char *pPrevBuffer);/***********************************************************Function Name: FrameMgr_initFunction Description: This function is responsiblefor initializing the FrameMgr. This includessetting up the various buffers and data needed toprocess each frame of image data.Inputs: noneOutputs: none***********************************************************/void FrameMgr_init(void){memset(trackedObjectTable,0x00,sizeof(trackedObjectTable));}/***********************************************************Function Name: FrameMgr_dispatchEventFunction Description: This function is responsible fortaking an incoming event and performing the neededactions with it as pertains to the FrameMgr.Inputs: event - the generated eventOutputs: none***********************************************************/void FrameMgr_dispatchEvent(unsigned char event){switch(event){case EV_DUMP_FRAME:/* try re-initializing the camera before we start dumping */CamConfig_setCamReg(0x11,0x01); /* reduce the frame rate for dumping*/CamConfig_sendFifoCmds();Utility_delay(1000); /* allow the new frame rate to settle */lineCount = 0;currentState = ST_FrameMgr_DumpingFrame;//CamIntAsm_waitForNewDumpFrame(currentLineBuffer,previousLineBuffer);FrameMgr_acquireLine();break;case EV_ENABLE_TRACKING:currentState = ST_FrameMgr_TrackingFrame;FrameMgr_acquireFrame();break;case EV_ACQUIRE_FRAME_COMPLETE:FrameMgr_processFrame();break;case EV_PROCESS_FRAME_COMPLETE:FrameMgr_acquireFrame();break;case EV_SERIAL_DATA_RECEIVED:if (currentState != ST_FrameMgr_idle){/* we need to go back to processing line data, sinceserial data reception interrupted us....just trash theframe and act like the frame has been processed, whichwill kick off the system to wait for the next line */PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);}break;case EV_DISABLE_TRACKING:/* tracking needs to be turned off */currentState = ST_FrameMgr_idle;break;}}/***********************************************************Function Name: FrameMgr_acquireFrameFunction Description: This function is responsible forbeginning of the acquisition of a new frame of datafrom the camera interface. The acquisition of this linedepends on the current state of the FrameMgr.Inputs: noneOutputs: none***********************************************************/void FrameMgr_acquireFrame(void){if (currentState == ST_FrameMgr_TrackingFrame){trackedLineCount = 0;numPrevTrackedObjects = numCurrTrackedObjects;numCurrTrackedObjects = 0;/* clear out the tracking table, and wait for the new frameto start */memset(trackedObjectTable,0x00,sizeof(trackedObjectTable));//CamIntAsm_waitForNewTrackingFrame(currentLineBuffer,colorMap);WAIT_FOR_VSYNC_HIGH();CamIntAsm_acquireTrackingLine(currentLineBuffer,colorMap);}}/***********************************************************Function Name: FrameMgr_acquireLineFunction Description: This function is responsible foracquiring a line of data from the camera interface.The acquisition of this line depends on the currentstate of the FrameMgr.Inputs: noneOutputs: none***********************************************************/void FrameMgr_acquireLine(void){unsigned char tmpLineCount;/* clearing out the buffers takes too long...we shouldjust overwrite the data here without a problem whenwe start acquiring...at no point do we check fora 0x00 value in the current or previous lineBuffers,so it was a bit excessive :-) *//* check which state we are in and proceed as needed */if (currentState == ST_FrameMgr_DumpingFrame){tmpLineCount = lineCount*2;/* clearing out the line data in dump mode is ok, and actuallyis needed, since it is possible for the first dump line ina frame to come back with the last line captured of thelast capture session...*/memset(currentLineBuffer,0x00,LENGTH_OF_LINE_BUFFER);memset(previousLineBuffer,0x00,LENGTH_OF_LINE_BUFFER);/* wait for another VSYNC so we know which frame to useto start looking for a line to receive */WAIT_FOR_VSYNC_HIGH();WAIT_FOR_VSYNC_LOW();/* look at lineCount to determine how many HREFs we shouldwait before we start sampling */while(tmpLineCount != 0){WAIT_FOR_HREF_HIGH();tmpLineCount--;WAIT_FOR_HREF_LOW();}/* we should now be ready to sample our line...*/CamIntAsm_acquireDumpLine(currentLineBuffer,previousLineBuffer);}else if (currentState == ST_FrameMgr_TrackingFrame){WAIT_FOR_HREF_LOW();CamIntAsm_acquireTrackingLine(currentLineBuffer,colorMap);}}/***********************************************************Function Name: FrameMgr_processLineFunction Description: This function is responsible forparsing the received image line and performing eitherconnected region mapping (if in the Tracking state) orsending out the raw sampled data (if in the Dumpingstate).Inputs: noneOutputs: none***********************************************************/void FrameMgr_processLine(void){unsigned char i;volatile unsigned char dataToSend;unsigned char *pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;#ifdef DEBUG_TRACKED_LINEunsigned char *pSendData;unsigned char asciiBuffer[5];unsigned char pixelCount = 0;#endifif (currentState == ST_FrameMgr_DumpingFrame){/* we want to sit in a tight loop and send the acquired datasitting in current and previous line buffers out the serialport...it is sent out the serial port immediately insteadof going into the UIMgr tx fifo because we can't do anythinguntil its sent out anyway...may as well just get it out now *//* currentLineBuffer is getting "g" previousLineBuffer is getting "b-r" */UartInt_txByte(0x0B); /* send the header byte */UartInt_txByte(lineCount); /* send the line count */for (i=0; i<NUM_PIXELS_IN_A_DUMP_LINE; i+=2){/* when a dump line is sampled, the upper byte can potentiallyhave garbage in it...we don't have time to mask it off as we'resampling, so it is done here before we send it out...we alsocombine the samples together so we really are sending up asample for line N as well as line N+1 */dataToSend = currentLineBuffer[i];dataToSend &= 0x0F;dataToSend <<= 4;dataToSend |= (previousLineBuffer[i] & 0x0F);/* dataToSend should be packed now */UartInt_txByte(dataToSend);/* flip the colors around since we are doing all G on Y and BR on UV */dataToSend = previousLineBuffer[i+1];dataToSend &= 0x0F;dataToSend <<= 4;dataToSend |= (currentLineBuffer[i+1] & 0x0F);/* dataToSend should be packed now */UartInt_txByte(dataToSend);}UartInt_txByte(0x0F); /* send line end *//* once all the data is sent, increment out line count by 2 sincewe really get 2 lines worth of pixels on each pass *//* Update...increment only by 1, but only send 72 double-lines */lineCount++;/* check to see if we have retrieved all of the needed lines */if (lineCount >= 72) /* half 144, since we send two lines at a time */{/* we're done, so send the dump complete?...nope, just changestates and we should be fine */lineCount = 0;currentState = ST_FrameMgr_idle;/* disable the PCLK counting overflow interrupt */TIMSK &= DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK;CamConfig_setCamReg(0x11,0x00); /* reset the frame rate to normal*/CamConfig_sendFifoCmds();}else{/* we have more lines to acquire in this frame, so keep on truckin...*/PUBLISH_FAST_EVENT(FEV_PROCESS_LINE_COMPLETE);}}else if (currentState == ST_FrameMgr_TrackingFrame){#ifdef DEBUG_TRACKED_LINE/* send the received line over serial...this should only senduntil a pixelCount == 176 */pSendData = currentLineBuffer;itoa(trackedLineCount,asciiBuffer,10);UIMgr_txBuffer(asciiBuffer,3);UIMgr_txBuffer(" ",1);while(pixelCount < ACTUAL_NUM_PIXELS_IN_A_LINE){memset(asciiBuffer,0x00,5);itoa(*pSendData++,asciiBuffer,10); /* color is first byte */UIMgr_txBuffer(asciiBuffer,3); /* 3 ascii bytes for data */UIMgr_txBuffer(" ",1);pixelCount += *pSendData; /* run-length is second byte */memset(asciiBuffer,0x00,5);itoa(*pSendData++,asciiBuffer,10);UIMgr_txBuffer(asciiBuffer,3);UIMgr_txBuffer(" ",1);}UIMgr_txBuffer("\n\r",2);trackedLineCount++;if (trackedLineCount == 144){UIMgr_txBuffer(" FC \n\r",8);trackedLineCount = 0;PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);}else{PUBLISH_EVENT(EV_PROCESS_LINE_COMPLETE);}#else/* determine if any of the RLE blocks overlap */FrameMgr_findConnectedness();/* we also want to remove any objects that are less thana minimum height...we already removed portions of therun-length that are less than MIN_PIXEL_WIDTH in thefindConnectedness() routine...doing it here instead ofa function to speed things up...this may end up slowing down theframe rate slightly, and can be removed if this isn't needed *//* run this routine once every 8 lines */if ( (trackedLineCount & RUN_OBJECT_FILTER_MASK) == RUN_OBJECT_FILTER_MASK){for (i=0; i<MAX_TRACKED_OBJECTS; i++){if ( *(pTrackedObjectData + VALID_OBJECT_OFFSET) == TRUE){/* check to see if the object is already inour past...i.e., its last */if ( (*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) -*(pTrackedObjectData + Y_UPPER_LEFT_OFFSET)) < MIN_OBJECT_TRACKING_HEIGHT){/* the object is less than the minimum height...see if it is adjacentto the current line we just processed...if so, leave it here...otherwise,it needs to be invalidated since its too small */if ( trackedLineCount - *(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) > 2){/* invalidate the object */*(pTrackedObjectData + VALID_OBJECT_OFFSET) = FALSE;numCurrTrackedObjects--;}}}pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;}}trackedLineCount++;if (trackedLineCount == ACTUAL_NUM_LINES_IN_A_FRAME){/* an entire frame of tracking data has been acquired, sopublish an event letting the system know this fact */PUBLISH_EVENT(EV_ACQUIRE_FRAME_COMPLETE);/* disable the PCLK counting overflow interrupt */TIMSK &= DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK;trackedLineCount = 0;}else{PUBLISH_FAST_EVENT(FEV_PROCESS_LINE_COMPLETE);}#endif}else{/* ...and here? */}}/***********************************************************Function Name: FrameMgr_processFrameFunction Description: This function is responsible forparsing the completed frame and performing all actionsneeded at this level.Inputs: noneOutputs: none***********************************************************/void FrameMgr_processFrame(void){unsigned char i,k,color;#if DEBUG_FRAME_DATAunsigned char asciiBuffer[5];unsigned char j;#endifunsigned char *pTableData = (unsigned char *)pCurrentTrackedObjectTable;unsigned char tmpUpperLeftX,tmpUpperLeftY,tmpLowerRightX,tmpLowerRightY;#if DEBUG_FRAME_DATA/* we want to send all of the currently tracked table outthe serial port for debugging */for (i=0; i<numCurrTrackedObjects; i++){UIMgr_txBuffer("----------\r\n",12);for (j=0; j<SIZE_OF_TRACKED_OBJECT; j++){memset(asciiBuffer,0x00,5);itoa(*pTableData++,asciiBuffer,10);UIMgr_txBuffer(asciiBuffer,3); /* 3 ascii bytes for data+ 1 space */UIMgr_txBuffer("\r\n",2);}}/* finally, send a new line */UIMgr_txBuffer("\r\n",2);memset(asciiBuffer,0x00,5);itoa(numCurrTrackedObjects,asciiBuffer,10);UIMgr_txBuffer(asciiBuffer,3);UIMgr_txBuffer(" PFC\r\n",5);#else/* we only send tracking packets if there are tracked objects */if (numCurrTrackedObjects > 0){UIMgr_writeTxFifo(0x0A); /* header byte for a tracking packet *//* reset the pointer */pTableData = (unsigned char *)pCurrentTrackedObjectTable;UIMgr_writeTxFifo(numCurrTrackedObjects); /* num of objects tracked */for (i=0; i<MAX_TRACKED_OBJECTS; i++){/* we only want to process objects that have their objectValid flagset to TRUE */if ( *(pTableData + VALID_OBJECT_OFFSET) == TRUE){/* the object is valid...convert the color from bit position to value...remember,each bit in the "color" byte corresponds to a color */k=0;color = *(pTableData + COLOR_OFFSET);if (color == 128) k=0;else if (color == 64) k=1;else if (color == 32) k=2;else if (color == 16) k=3;else if (color == 8) k=4;else if (color == 4) k=5;else if (color == 2) k=6;else if (color == 1) k=7;tmpUpperLeftX = *(pTableData + X_UPPER_LEFT_OFFSET); /* get the upper left X */tmpUpperLeftY = *(pTableData + Y_UPPER_LEFT_OFFSET); /* get the upper left Y */tmpLowerRightX = *(pTableData + X_LOWER_RIGHT_OFFSET); /* get the lower right X */tmpLowerRightY = *(pTableData + Y_LOWER_RIGHT_OFFSET); /* get the lower right Y */UIMgr_writeTxFifo(k); /* send the color first */UIMgr_writeTxFifo(tmpUpperLeftX);UIMgr_writeTxFifo(tmpUpperLeftY);UIMgr_writeTxFifo(tmpLowerRightX);UIMgr_writeTxFifo(tmpLowerRightY);}/* move our pointer up to the beginning of the next object */pTableData += SIZE_OF_TRACKED_OBJECT;}/* all done...send the end of tracking packets char */UIMgr_writeTxFifo(0xFF);}#endif/* the tracked object table will be cleared out right before we startto wait for VSYNC to indicate a new frame...so it doesn't need to bedone now *//* schedule the next action to acquire a new frame */PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);}/***********************************************************Function Name: FrameMgr_findConnectednessFunction Description: This function is responsible forfinding the connectedness between two particular run-length encoded lines of pixel data. It updates thetrackingTable as needed.Inputs: noneOutputs: none***********************************************************/static void FrameMgr_findConnectedness(void){trackedColor_t currColor;unsigned char *pCurrLineColorInfo = currentLineBuffer;unsigned char *pTrackedObjectData;register unsigned char currPixelRunStart=0;register unsigned char currPixelRunFinish=0;register unsigned char lastLineXStart=0;register unsigned char lastLineXFinish=0;register unsigned char runLength=1;unsigned char i;bool_t colorConnected;do{/* grab both the current color and the number of pixelsin the run...remember, pixels start at 1, not 0! */colorConnected = FALSE;currColor = *pCurrLineColorInfo++;currPixelRunStart += runLength;runLength = *pCurrLineColorInfo++;currPixelRunFinish += runLength;/* make sure that the run-length is at least as wide asthe minimum horizontal tracking width, and we care about the color */if ( (currColor != notTracked) && (runLength > MIN_OBJECT_TRACKING_WIDTH) ){/* this run contains a color we care about, soeither it will begin a new tracked object, or itis connected to a currently tracked object...compare it with each object in the trackingtable...we can't just look at the numTrackedObjects becauseit is entirely possible that the first couple of objects couldbe invalid...NOTE: Instead of accessing each element in the trackedObjectTablethrough the 'i' index, and then accessing the fields in each structure,a pointer to each entry is established each time through the loop, followedby accessing the elements through specified offsets. GCC seems to beable to optimize this code much better than simply accessing the elementsof each structure in the array the more normal way...*/pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;for (i=0; i<MAX_TRACKED_OBJECTS; i++){if ( (currColor == *(pTrackedObjectData + COLOR_OFFSET)) &&(*(pTrackedObjectData + VALID_OBJECT_OFFSET) == TRUE) &&(*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) == trackedLineCount - 1) ){/* found a color match and the object is valid...check to see if there isconnectedness */lastLineXStart = *(pTrackedObjectData + LAST_LINE_X_START_OFFSET);lastLineXFinish = *(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET);/* Check for the 5 following types of line connectedness:---------------------| |----------------------------------------------| |------------------------- */if ( ( (currPixelRunStart >= lastLineXStart) &&(currPixelRunStart <= lastLineXFinish) ) ||/* ---------------------| |----------------------------------------| |-------------------OR------------------------------| |---------------------------------------| |--------- */( (currPixelRunFinish >= lastLineXStart) &&(currPixelRunFinish <= lastLineXFinish) ) ||/* -------------------------------| |--------------------------------------------------------------| |-------------------------------OR-------------| |--------------------------------------------| |------------------------------- */( (currPixelRunStart <= lastLineXStart) &&(currPixelRunFinish >= lastLineXFinish) ) ){/* THERE IS CONNECTEDNESS...update the lastLineXStart and lastLineXFinishdata pointed to by pTrackedObjectData */*(pTrackedObjectData + LAST_LINE_X_START_OFFSET) = currPixelRunStart;*(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET) = currPixelRunFinish;/* check if the bounding box needs to be updated */if (*(pTrackedObjectData + X_UPPER_LEFT_OFFSET) > currPixelRunStart){/* need to update the bounding box for the upper left point toenclose this new left-most point...we never have to update theupper left Y point, since each scan line we process moves fromtop to bottom */*(pTrackedObjectData + X_UPPER_LEFT_OFFSET) = currPixelRunStart;}if ( *(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) < currPixelRunFinish){/* need to update the bounding box for the lower right X point toenclose this new right-most point */*(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) = currPixelRunFinish;}/* the lower right 'y' point always gets updated when connectedness is found */*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) = trackedLineCount;/* set a flag indicating that that color run is part of anotherobject and thus doesn't need to be added as a new entry into thetracking table */colorConnected = TRUE;break;}}/* go to the next object */pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;}if (colorConnected == FALSE){/* a new entry needs to be made to the tracking table, since we havea run-length with a color, and it isn't connected to anything...but wecan only do this if there is space left in the trackedObject table */if (numCurrTrackedObjects < MAX_TRACKED_OBJECTS){/* space is available...add the object...but first we need to find aninvalid object in the object tracking table */pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;for (i=0; i<MAX_TRACKED_OBJECTS; i++){if ( *(pTrackedObjectData + VALID_OBJECT_OFFSET) == FALSE) break;/* if we haven't broken above, then the object must have been valid...go ahead and move the pointer to the next object to check it */pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;}/* now that we have a pointer to the tracked object to be updated, update allthe fields */*(pTrackedObjectData + COLOR_OFFSET) = currColor; /* color */*(pTrackedObjectData + LAST_LINE_X_START_OFFSET) = currPixelRunStart; /* lastLineXStart */*(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET) = currPixelRunFinish; /* lastLineXFinish */*(pTrackedObjectData + X_UPPER_LEFT_OFFSET) = currPixelRunStart; /* x_upperLeft */*(pTrackedObjectData + Y_UPPER_LEFT_OFFSET) = trackedLineCount; /* y_upperLeft */*(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) = currPixelRunFinish; /* x_lowerRight */*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) = trackedLineCount; /* y_lowerRight */*(pTrackedObjectData + VALID_OBJECT_OFFSET) = TRUE; /* objectValid flag */numCurrTrackedObjects++;}}/* move the pointer to the beginning of the next tracked object */pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;}} while(currPixelRunFinish < ACTUAL_NUM_PIXELS_IN_A_LINE);}