mira_GetObjDataInt
Read information on segmented out objects
int mira_GetObjDataInt(mrkernel* pmr, int entryInd, int** ppObjData);
Input:
- Runtime environment pointer
- entryID - zero-based index of an object
- ppObjData - pointer to a pointer to a table with object information
Output: Result (MIRA_OK or error)
Description:
mira_GetObjDataInt returns details on a specific object found. The first parameter is a zero-based object index (0..number of objects found -1). The second parameter represents an object table. The example below illustrates that we declare a pointer to int called pObjData and initialize its value to NULL. In an acquisition loop, after processing a frame, if an object is found, we call mira_GetObjDataInt in a for loop extracting object information. Note, that we pass address of the pObjData to the mira_GetObjDataInt.
The object table:
MIRA_OBJECT_ID 0 Unique object identifier
MIRA_OBJECT_FRAME 1 Frame index for the object centroid
MIRA_OBJECT_POS 2 Position of the object centroid across the belt
MIRA_OBJECT_MINFRAME 3 Bounding box coordinates:
MIRA_OBJECT_MAXFRAME 4
MIRA_OBJECT_MINCOL 5
MIRA_OBJECT_MAXCOL 6
MIRA_OBJECT_SIZE 7 Object size in pixels
MIRA_OBJECT_CLASS 8 Object class index
Example:
int objCount=0;
int* pObjData=NULL; /* pointer to object table data */
while( frameInd<frameCount ) {
mira_ProcessFrame(pmr,pFrame);
objCount=mira_GetObjCount(pmr);
if( objCount>0 ) {
for(int i=0;i<objCount;i++) {
/* we pass address of a pointer to receive object table
allocated by the runtime */
mira_GetObjDataInt(pmr,i,&pObjData);
/* pObjData allows us to access object details */
printf("\n obj%d : %d,d ",
pObjData[MIRA_OBJECT_ID],
pObjData[MIRA_OBJECT_FRAME], /* along the belt */
pObjData[MIRA_OBJECT_POS] ); /* across the belt */
} /* end of for loop */
} /* end of if objects */
} /* end of frame acquisiion */