This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How can I get the orbPattern in VLIB_computeRBRIEF of VLIB_3.2?

Hi,

I have some problem to use the 'VLIB_ORB_computeRBRIEF' in VLIB 3.2.

In the example code(vlib_ORB_computeRBRIEF_d.c) there is a 'orbPatten' at line #101 ~ #104.

           

    for( i = 0; i < CORB_NUM_ORIENTATIONS; i++ ) {
                const RotationMatrix    rMat = getRotationMatrix(i);

                for( j = 0; j < CORB_NUM_PATTERNS; j++ ) {
                    const VLIB_D64    x1 = (VLIB_D64) prm[tpi].orbPattern[j * 4];
                    const VLIB_D64    y1 = (VLIB_D64) prm[tpi].orbPattern[j * 4 + 1];
                    const VLIB_D64    x2 = (VLIB_D64) prm[tpi].orbPattern[j * 4 + 2];
                    const VLIB_D64    y2 = (VLIB_D64) prm[tpi].orbPattern[j * 4 + 3];

                    const int32_t    x1p = ROUND_DOUBLE(rMat.val[0][0] * x1 + rMat.val[0][1] * y1);
                    const int32_t    y1p = ROUND_DOUBLE(rMat.val[1][0] * x1 + rMat.val[1][1] * y1);
                    const int32_t    x2p = ROUND_DOUBLE(rMat.val[0][0] * x2 + rMat.val[0][1] * y2);
                    const int32_t    y2p = ROUND_DOUBLE(rMat.val[1][0] * x2 + rMat.val[1][1] * y2);
                    const int32_t    nstep = (int)prm[tpi].imageWidth;
                    int32_t          center;

                    center  = (int32_t)(x1p + prm[tpi].imageWidth * y1p);

                    relative_patterns[i * CORB_NUM_PATTERNS * 2 + j * 2] =
                        4 * (center - CORB_PATCH_KERNEL_HALF_WIDTH - CORB_PATCH_KERNEL_HALF_WIDTH * nstep - 1 - nstep);


                    center  = (int32_t)(x2p + prm[tpi].imageWidth * y2p);

                    relative_patterns[i * CORB_NUM_PATTERNS * 2 + j * 2 + 1] =
                        4 * (center - CORB_PATCH_KERNEL_HALF_WIDTH - CORB_PATCH_KERNEL_HALF_WIDTH * nstep - 1 - nstep);
                }
            }

I thought  the orbPattern is a array in the user-guide documentation, ex] orbPattern[16] = { 15, 15, 15, ~ };

However, in the example file the index ' j ' goes to lager than 16, in fact goes to CORB_NUM_PATTERNS(#defined as 256 in vlib_orb.h).

Since the size of orbPattern[16] is '16', I can't put the value when ' j ' is lager than 16.

In short, my questions are

1. What is the orbPattern in the example file(vlib_ORB_computeRBRIEF_d.c, #101 ~ #104) ?

2. Is it equal to the orbPattern[16] = { 15, 15, 15, 15 ~  } ?

3. If it is equal the orbPattern[16], how can I get the value of orbPattern[17 ~  ] ?

4. or should I change the CORB_NUM_PATTERNS to 16( size of orbPattern) ?

Also, in the 'vlib_orb.h' there is a description of orbPattern31.

(int8_t                *orbPattern31; /*!< User-populated pointer to precomputed orbPattern31 array (found in VLIB_orb_idat.c file) */)

Does 'orbPattern31' differ from orbPattern[16] = { 15, 15, 15, ~ } ?

If it differ from orbPattern[16], how can I get the orbPattern31?

I can't find the file ' VLIB_orb_idat.c'.

Thank you !

Regards,

Tahk. 

  • Hi,

    Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com).

    We will get back to you shortly on the above query.

    Regards,
    Sivaraj K
  • Hi Tahk,

    i have the same problems and questions. Did you found something on that?

    For some strange reason the pattern generation worked for me with the code you posted from vlib_ORB_computeRBRIEF_d.c when i used the orbPattern[16]...
    I get no segmentation fault or something and  VLIB_ORB_computeRBrief() does not fail too. I found this problem and know i think i am not computing the right descriptors.

    Did you try it?

    I saw the functions

    void generateRotatedPatterns(CORBPatterns *patterns, const signed char *orbPattern31);
    void generateRelativePattern(CORBPatterns *patterns);
    void initPatterns(const int width, CORBPatterns *patterns, const signed char *orbPattern31);

    in VLIB_orb_utilities.h which seem to generate some patterns, but there is no useful documentation and they seem to need the orbPattern31 too.

    Does any one know how to use them for pattern generation?

    Regards,
    Tim

  • 1. What is the orbPattern in the example file(vlib_ORB_computeRBRIEF_d.c, #101 ~ #104) ?
    >This is from extern int8_t orbPattern31[]; in the VLIB_ORB_computeRBRIEF_idat.c. This static symbol is currently compiled into the common library that is included with VLIB. Your program can follow the model of the VLIB_ORB_computeRBRIEF_d.c. The size of this internal symbol that is expected to work with this API is 256*4 bytes.

    2. Is it equal to the orbPattern[16] = { 15, 15, 15, 15 ~ } ?
    >No it is not the same.

    3. If it is equal the orbPattern[16], how can I get the value of orbPattern[17 ~ ] ?
    >Not equal.

    4. or should I change the CORB_NUM_PATTERNS to 16( size of orbPattern) ?
    >No

    Also, in the 'vlib_orb.h' there is a description of orbPattern31.

    (int8_t *orbPattern31; /*!< User-populated pointer to precomputed orbPattern31 array (found in VLIB_orb_idat.c file) */)

    Does 'orbPattern31' differ from orbPattern[16] = { 15, 15, 15, ~ } ?
    >Yes, as mentioned above as part of my answer to #1.

    If it differ from orbPattern[16], how can I get the orbPattern31?
    >Answered in #1 above
  • Thanks, this is working for me.

    But now is the question what pattern should i use for VLIB_ORB_computeOrientation() ?
    orbPattern[16] like in the example VLIB_ORB_computeOrientation_d.c or should i use the extern orbPattern31[] for this function too?

    Best Regards
    Tim

  • Yes, the orbPattern[16] like in the example VLIB_ORB_computeOrientation_d.c.  it is unfortunate that the name is similar.  Hopefully we can clarify this in a future release.

  • Hi All,

    orbPattern[16] used in "VLIB_ORB_computeOrientation" API is the pattern used in moment calculation. Angle/Orientation will be atan(moment_y/monent_x).

    Value of this array is 

    uint8_t     orbPattern31[16] = { 15, 15, 15, 15, 14, 14, 14, 13, 13, 12, 11, 10, 9, 8, 6, 3 }. 

    Most likely this value will be fixed, as per literature. Its usages is like below

    for( y=1; y <= CORB_HALF_PATCH_SIZE; y++ ) {
    uint32_t linesum_p = 0, linesum_n = 0;

    for( x = -orbPattern[y]; x <= orbPattern[y]; x++ ) {
    uint8_t vplus = *(valptr + x + y * stride);
    uint8_t vminus = *(valptr + x - y * stride);
    linesum_p += vplus;
    linesum_n += vminus;
    _m10 += x * (vplus + vminus);
    }

    _m01 += y * (linesum_p - linesum_n);
    }

    /* for y=0 */
    for( x = -CORB_HALF_PATCH_SIZE; x <= CORB_HALF_PATCH_SIZE; x++ ) {
    uint8_t vplus = *(valptr + x);
    _m10 += x * (vplus);
    }

    *m01 = _m01; // moment_y
    *m10 = _m10; //moment_x

    Now the orbpattern[256][4] used in the API "VLIB_ORB_computeRBrief" are the real locations to be used in preparation of 256 bit descriptor.

    orbpattern[256][4] , here 256 represents locations for which one-one bit information of descriptor will be prepared. '4' represent {x0,y0,x1,y1} two x,y locations for one bit of descriptor generation.

    We agree that, being the name same in these API, might have created some confusion. Hope everything is clarified now.

    Regards

    Deepak Poddar