Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Sift points coordinates #20

Open
omaraltayyan opened this issue Jun 11, 2017 · 5 comments
Open

Wrong Sift points coordinates #20

omaraltayyan opened this issue Jun 11, 2017 · 5 comments

Comments

@omaraltayyan
Copy link

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
Copy link
Author

@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

@Celebrandil
Copy link
Owner

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

@omaraltayyan
Copy link
Author

omaraltayyan commented Jul 6, 2017

@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);

@Celebrandil
Copy link
Owner

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.

@lgalardini
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants