Forums - Proper usage of "fcvCornerFast9InMasku8" function

7 posts / 0 new
Last post
Proper usage of "fcvCornerFast9InMasku8" function
Shravan_Kumar
Join Date: 1 Mar 12
Posts: 13
Posted: Wed, 2012-03-14 05:05

Hi All,

I am using the "fcvCornerFast9InMasku8" function to take good features in the particular region by masking that pixels as 1 and others as 0. But unfortunately thats not happening. I am giving code below

Will some one help me in this please. 

 

   int count = dataBufWidth*dataBufHeight; // =48000
   uint8_t maskArray[count];

   memset(maskArray, 0, dataBufWidth*dataBufHeight*sizeof(uint8_t));

   for(int i = 0; i < count ; i++ ) { // Randomly selected region
	   if ((i > 15000) && (i < 30000)) {
		   maskArray[i] = (uint8_t)1;
	   } else {
		   maskArray [i] =(uint8_t) 0;
	   }

   }

//   uint8_t *maskArraypointer = (uint8_t)maskArray[count];

   fcvCornerFast9InMasku8  ( (uint8_t*)dataBuf,
		   	   	   	   	   	   dataBufWidth,
		   	   	   	   	   	   dataBufHeight,
		   	   	   	   	   	   0,
		   	   	   	   	   	   state.cornerThreshold,
								7,
								state.corners,
								MAX_CORNERS_TO_DETECT,
								&state.numCorners,
								maskArray,
								dataBufWidth,
								dataBufHeight
    );

Thanks in advance,

Cheers,

Shravan

  • Up0
  • Down0
grk101
Join Date: 26 Oct 11
Posts: 12
Posted: Fri, 2012-03-16 00:31

Hi 

The mask is a bitmask where each bit codes for one pixel. The sample below shows how u can set it up.

Cheers

-Guy 

  • Up0
  • Down0
Shravan_Kumar
Join Date: 1 Mar 12
Posts: 13
Posted: Mon, 2012-03-19 04:48

Hi,

Thanks for your reply. I got your point but still its not working  if I do follow changes. Actually I am trying the fastcorner example itself, by using mask but its not happening. I dint understand why this is happening.

   int count = dataBufWidth*dataBufHeight; // 
   uint8_t maskArray[count/8];
   memset(maskArray, 0, (count/8)*sizeof(uint8_t));

   int rectX,rectY,rectWidth,rectHeight;
   rectX = 200;//dataBufWidth/4;
   rectY = 120;//dataBufHeight/4;
   rectWidth = 400;//dataBufWidth/2;
   rectHeight = 240;//dataBufHeight/2;

   for (int i = 0; i< rectHeight; i++) {

	   int startPoint = dataBufWidth*(rectY + i) + rectX;
	   for(int j = 0; j < rectWidth; j++ ) {
		   int index = startPoint +j;
		   maskArray[index>>3] |=(0x10000000>>(index%8));
	   }
   }



   fcvCornerFast9InMasku8  ( (uint8_t*)dataBuf,
		   	   	  dataBufWidth,
		   	   	  dataBufHeight,
		   	   	  0,
		   	           state.cornerThreshold,
				7,
				state.corners,
				MAX_CORNERS_TO_DETECT,
				&state.numCorners,
				maskArray,
			         dataBufWidth,
			         dataBufHeight
    );
Cheers,
Shravan
  • Up0
  • Down0
grk101
Join Date: 26 Oct 11
Posts: 12
Posted: Tue, 2012-03-20 00:12

Hi, 

What is the exact failure that you are observing ? Would you please describe the input you are prodiving the expected output and the actually incorrect output. Also please note that a bit value of 1 indicates that the pixel is excluded and 0 indicates that it is included. 

Cheers

Guy

  • Up0
  • Down0
Shravan_Kumar
Join Date: 1 Mar 12
Posts: 13
Posted: Wed, 2012-03-21 04:42

Hi,

I understood the concept of mask. I understood that for every pixel value we use one bit and the 1 or 0 value in the bit will consider that to include or exclude. What I am trying is I want to extract features or points from the image in certain region or in rectangle only. Thats what the for loop I have written there. But when I do that I am getting the dots(points) I mean the features or corners in the entire image. I want to get the corners only in particular region or rectangular area. The output what I am getting is the corners in the entire image. The input I am giving is,

   jimgData = env->GetByteArrayElements( img, &isCopy );

   uint8_t*  dataBuf= (uint8_t*)jimgData; 










Cheers,
Shravan


  

 

  • Up0
  • Down0
cyril.bazin@dat...
Join Date: 2 Mar 12
Posts: 11
Posted: Thu, 2012-04-12 02:38

 

Hi,
It seems there is a mistake in this code sample...
You wrote :
maskArray[i>>3] |=(0x10000000>>(i%8));       
(...)
maskArray [i>>3] &=~(0x10000000>>(i%8));     
But don't you mean :
maskArray[i>>3] |=(0x80>>(i%8));       
(...)
maskArray [i>>3] &=~(0x80>>(i%8));     
Or maybe :
maskArray[i>>3] |= (0x80 >> (i & 0x07));       
(...)
maskArray [i>>3] &= ~(0x80 >> (i & 0x07));     
Cheers
Cyril

   

 

  • Up0
  • Down0
grk101
Join Date: 26 Oct 11
Posts: 12
Posted: Thu, 2012-04-12 09:15

Hi Cyril

You are absolutely right. Thanks for the catch :) 

Cheers,

Guy

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.