CudaSift icon indicating copy to clipboard operation
CudaSift copied to clipboard

Wrong Sift points coordinates

Open omaraltayyan opened this issue 7 years ago • 5 comments

Hi, thanks a lot for your great work

I am having an issue with the code Whenever i try to read the sift points after extracting them from the image, their x and y coordinates aren't where they should be

So i am simply drawing these points over the image with opencv and displaying them in real-time, and the sift points seem to construct shapes of objects in the image but with a larger​ scale and a big offset

I tried multiplying and dividing the x and y coordinates with the scale attribute of the corresponding sift point but it didn't work

Any idea how this might be solved??

Note: i am running the code on a GT 750m (Kepler w/ cc of 3.0, 4GB DDR3, 12ms to run)

omaraltayyan avatar Jun 11 '17 10:06 omaraltayyan

@Celebrandil can you please take some of your time to answer, sorry to insist but i gotta use this in my school project which is only a few weeks away

omaraltayyan avatar Jul 01 '17 14:07 omaraltayyan

Do you have an image illustrating the problem? SIFT features are often found in the weirdest of places.

Celebrandil avatar Jul 04 '17 09:07 Celebrandil

@Celebrandil here is a video i made to illustrate the problem:

https://youtu.be/ine41zFnmpk

this is the code used for drawing

image.convertTo(image, CV_8UC1);
for (int i = 0; i < imageSiftData.numPts; i++)
{
	SiftPoint siftPoint = imageSiftData.h_data[i];
	Point2f pointToDraw(siftPoint.xpos, siftPoint.ypos);

	cv::circle(image, pointToDraw, 3, Scalar(0, 0, 0), 2);
}

and this is the keypoint detection code:

	image.convertTo(convertedImage, CV_32FC1);
        image = convertedImage;
	CudaImage cudaImage;
	unsigned int imageWidth = image.cols;
	unsigned int imageHeight = image.rows;


	cudaImage.Allocate(imageWidth, imageHeight, iAlignUp(imageWidth, 128), false, NULL, (float*)image.data);
	cudaImage.Download();

	// Extract Sift features from image
	SiftData imageSiftData;
	float initBlur = 1.0f;
	float thresh = 1.0f;
	InitSiftData(imageSiftData, 4096, true, true);

	ExtractSift(imageSiftData, cudaImage, 5, initBlur, thresh, 0.0f, false);

omaraltayyan avatar Jul 06 '17 09:07 omaraltayyan

I fail to see what the problem might be. It indeed looks like as if the coordinates are scaled up by a factor of two.

Celebrandil avatar Jul 09 '17 17:07 Celebrandil

Hi there, this problem have been fixed? Is this the correct way to extract keypoints? Thank you in advance and have a nice day!

P.S. = thank you for your work and sharing!

lgalardini avatar Jun 02 '20 09:06 lgalardini