CudaSift
CudaSift copied to clipboard
Why I can't get any match correspondence even with the same images?
Thank you for sharing this implementaion!
Environment
- Platform: Windows 10 64-bit, VS2015 OpenCV3.4.1 CUDA8 1060
Current Behavior:
I have successfully build this repository with no errors. I have tested mainSift.cpp with the same image (limg and rimg are the same picture) many times, none of them get any match correspondence! I never chenge the code of mainSift.cpp.
Here is My output of mainSift.cpp:
Image size = (812,725)
Initializing data...
Device Number: 0
Device name: GeForce GTX 1060
Memory Clock Rate (MHz): 4004
Memory Bus Width (bits): 192
Peak Memory Bandwidth (GB/s): 192.2
SIFT extraction time = 1.99 ms
Incl prefiltering & memcpy = 3.09 ms 2623
SIFT extraction time = 1.82 ms
Incl prefiltering & memcpy = 3.06 ms 2624
MatchSiftData time = 6.16 ms
...
MatchSiftData time = 4.85 ms
Number of original features: 2623 2624
Number of matching features: 0 0 0% 1 3
Expected Behavior:
I expect CUDAsift find the correct correspondence , and show the correspondence between model image and test image.
Besides, the finding homography process is based on both model image's feature and test image's feature. Why there is only siftData1 input to functionFindHomography
and ImproveHomography
in mainSift.cpp?
for (int i = 0; i<500; i++)
MatchSiftData(siftData1, siftData2);
float homography[9];
int numMatches;
FindHomography(siftData1, homography, &numMatches, 10000, 0.00f, 0.80f, 5.0);
int numFit = ImproveHomography(siftData1, homography, 5, 0.00f, 0.80f, 3.0);
I have been troubling in above two problems several days, can you help me for any suggestion? Thank you!
That is weird. Could you upload the image? I cannot verify it. It might be something related to the unusual image size, but that seems like something I should have noticed before then.
By the way, MatchSiftData uses both siftData1 and siftData2. It will create per feature cross-references, which means that FindHomography and ImproveHomography won't need siftData2.
@Celebrandil
I think something is wrong in the procedure of MatchSiftData
of my computer.
I have modified the mainSift.cpp, my test code fragment is shown below:
ExtractSift(siftData1, img1, 5, initBlur, thresh, 0.0f, false, memoryTmp);
ExtractSift(siftData2, img2, 5, initBlur, thresh, 0.0f, false, memoryTmp);
FreeSiftTempMemory(memoryTmp);
MatchSiftData(siftData1, siftData2);
showCorrespondence(siftData1, siftData2, limg_0, rimg_0);
void showCorrespondence(SiftData &siftData1, SiftData &siftData2, cv::Mat limg_0, cv::Mat rimg_0)
{
int numPts = siftData1.numPts;
SiftPoint *sift1 = siftData1.h_data;
SiftPoint *sift2 = siftData2.h_data;
int w = limg_0.size().width;
int h = limg_0.size().height;
cv::resize(rimg_0, rimg_0, cv::Size(w, h));
cv::Mat img_m = cv::Mat::zeros(h , 2*w,CV_8UC3);
limg_0.copyTo(img_m(cv::Rect(0,0,w,h)));
rimg_0.copyTo(img_m(cv::Rect(w,0,w,h)));
std::cout << sift1[1].xpos << ", " << sift1[1].ypos << std::endl;
for (int j = 0; j < numPts; j++)
{
int k = sift1[j].match;
if (sift1[j].match_error < 5)
{
cv::circle(img_m, cv::Point(sift1[j].xpos, sift1[j].ypos),2,cv::Scalar(60, 20, 220),2);
cv::circle(img_m, cv::Point(sift1[j].match_xpos + w, sift1[j].match_ypos), 2, cv::Scalar(173, 216, 230),2);
std::cout << sift1[j].match_xpos << ", " << sift1[j].match_ypos << std::endl;
cv::line(img_m,cv::Point(sift1[j].xpos, sift1[j].ypos),cv::Point(sift1[j].match_xpos + w, sift1[j].match_ypos),cv::Scalar(0,255,0),1);
}
}
cv::namedWindow("Result");
cv::resizeWindow("Result",cv::Size(600,300));
cv::imshow("Result",img_m);
cv::waitKey();
}
The result picture is
Unfortunately, I cannot verify it on my machine with the images from the data/ directory, even with your showCorrespondence function. Weird.
@Celebrandil what's the CUDA version are you use?
Here is my result.
@Celebrandil what's the CUDA version are you use?
Hello yiran-THU, can you send me a copy of my version, I have the same configuration as you, but my failure to compile successfully My email is [email protected]
Here is my result.
Building NVCC (Device) object CMakeFiles/cudasift.dir/Debug/cudasift_generated_cudaImage.cu.obj nvcc fatal : redefinition of argument 'gpu-architecture' CMake Error at cudasift_generated_cudaImage.cu.obj.Debug.cmake:219 (message): Error generating E:/ynh/c2/build/CMakeFiles/cudasift.dir//Debug/cudasift_generated_cudaImage.cu.obj
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: “cmd.exe”
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: “cmd.exe”
Building NVCC (Device) object CMakeFiles/cudasift.dir/Debug/cudasift_generated_cudaImage.cu.obj nvcc fatal : redefinition of argument 'gpu-architecture' CMake Error at cudasift_generated_cudaImage.cu.obj.Debug.cmake:219 (message): Error generating E:/ynh/c2/build/CMakeFiles/cudasift.dir//Debug/cudasift_generated_cudaImage.cu.obj
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: “cmd.exe”
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: “cmd.exe”
Please see my comment here. I used this method today to get everything to successfully compile on Windows 10.
EDIT: The version of Visual Studio doesn't matter. I managed to get everything to work in VS2017. The solution that I ended up with was the method mentioned in my other comment where I modified the architecture value from the code supplied by Celebrandil. I have a GT640 graphics card so I had to use the lowest available architecture value which I believe is 3.0 (even though the website says 2.1 CUDA only supports as low as 3.0 now.)
@yangninghua remove duplicated flag -arch=sm_62 works for me