1
votes

I want to make a function for calculating the sift descriptors that takes two arguments as input, one is the image and second in the vector of certain points in the image. The output would be the rows of 128 dimensional sift descriptors with each row corresponds to a descriptor of certain point in the image. For the calculations of SIFT descriptors, one needs to crop certain patch around the keypoint (say 32 x 32) and do some image processing stuff (histogram of orientations and all). My question here is that how to deal with the corner pixels in the image. for example if i will give pixel location (1,1) as input to the function, then how to crop the patch or how to do the calculation for the descriptor for such location in the image??

1
you can create a border around your image of 32 pixels, mirroring the original image. So even your corners will have a valid 32x32 rectangle around. In OpenCV you'd do it with copyMakeBorder and BORDER_REFLECT_101.Miki
wouldn't it affect the performance of the descriptor??vijay
Yes, of course. That's why you shouldn't compute sift near boundaries.Miki
Basically, as @Miki pointed out, features in image pixels are computed in a r radius neighbourhood. The bigger the r (depends on the feature), the larger the amount of pixels which lose information in the image. As an example, for a r = 5, a 5 pixel band around the boundaries of the image will lose information when computing features. To solve this there are the boundary conditions, you can either reflect, set to 0 or wrap the image outside its limits, but the result will be the same, a loss in information. Thus, don't rely too much in the features near the boundaries.Imanol Luengo
Have a look at this other answer: stackoverflow.com/questions/5715220/…Imanol Luengo

1 Answers

1
votes

As others pointed out in the comments, in image processing, it's a common practice to mirror the image at the boundaries, or sometimes, you can also pad zeros at the boundaries.

If the "vector of certain points" that you're referring to are the "keypoints", then you can use opencv to extract SIFT features, which returns 128 dimensional feature vector for each keypoint.

You do not have to do the computation of SIFT descriptors explicitly yourself, since OPENCV provides methods for that as described in SIFT descriptors