Read information on segmented out objects


int mira_GetObjDataRegOutput(mrkernel* pmr, int entryInd, const float** ppObjData);


Input: 

  • Runtime environment pointer
  • entryID - zero-based index of an object
  • ppObjData - pointer to a pointer to a table with regression results per object (floating point_


Output: Result (MIRA_OK or error)


Description:

mira_GetObjDataRegOutput provides per-object regression output. The second parameter entryInd is a zero-based object index (0..number of objects found -1). The third parameter ppObjData represents regression values for a given object. The example below illustrates that we declare a pointer to float 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. 

When we wish to access regression information for a given object, we use the mira_GetObjDataRegOutput function. We pass the address of the pObjData to the mira_GetObjDataInt, not the pointer itself. The actual regression value can be accessed using pRegData[v], where v is the zero-based regression variable index.

No memory allocation is needed on the side of user code.


Example:


     int objCount=0;


const int varCount=mira_GetRegVarCount(pmr);


float* pRegData=NULL;


    while( frameInd<frames ) {

       res=mira_ProcessFrame(pmr,ptrf);


       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 */


                if( varCount>0 && mira_GetObjDataRegOutput(pmr,i,&pRegData)==MIRA_OK ) {

                       printf("\t reg:");

                       for(int v=0;v<varCount;v++) {

                           printf(" %3.3f ",pRegData[v]);

                       }

                }


                  } /* end of for loop */

         } /* end of if objects */

    } /* end of frame acquisiion */