Facing some issues in debugging ASIFT algorithm in C++ on Visual Studio 2019 - c++

Hope you are well and safe. I found an implementation of ASIFT in C++ online(http://www.mattsheckells.com/opencv-asift-c-implementation/). But for some reason, i am getting errors during runtime. I have tried and tested the same on 32 bit version with an older opencv(2.4.9), it is running fine however its slow. Now I want to test it on new opencv versions (3x,4x) but till now no success. I am using VS 2019 and compiling opencv using cmake in windows. For Opencv 3.x to access sift libraries, i am using opencv_contrib of the same version and compiling together. But there are no conclusive results. I hope you can guide me on this. I can let you know how i set things up in further edits.
The exact step where the debugging fails and error have been posted here.
//cv::xfeatures2d::SiftFeatureDetector detector;
Ptr<cv::xfeatures2d::SiftFeatureDetector> detector = makePtr<cv::xfeatures2d::SiftFeatureDetector>();
//Ptr<cv::xfeatures2d::SiftFeatureDetector> detector = cv::xfeatures2d::SiftFeatureDetector::create();
//detector.detect(timg, kps, mask);
detector->detect(timg, kps, mask);---- the program stops debugging error due to a memory error
"Unhandled exception at 0x00007FFDEC899709 in Project1_asift.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000E5A319DDB8."
and i get this printed on the console:
"OpenCV(3.4.2) Error: The function/feature is not implemented () in cv::Feature2D::detectAndCompute, file c:\build\3_4_winpack-build-win64-vc15\opencv\modules\features2d\src\feature2d.cpp, line 154"
Hope to get a positive response.

Related

Trying to switch MSVC for Intel compiler and getting LNK1243 errors

Background
I'm trying to replace the compiler of a static library currently built in VS2015 with the Intel compiler (Version 17.0.1.143 Build 20161005). After correcting whatever compile errors there were I started receiving a link time error error LNK1243: invalid or corrupt file: COMDAT section 0x2E6 associated with following section 0x0. The exact section (0x2E6 shown) depends on if I have precompiled headers turned on or off, but the error remains the same.
What I've researched:
Googling the error leads to a plethora of results (a total of about 7, with about 3 actually pertaining to the linking error). One was a linking error in LLVM, another is a Microsoft site that links to the VS2008 documentation that links to a page that describes the linking error. The third is a link to fixes in the Intel Parallel Studio XE 2016 that should have all been included in the version I'm using.
The Intel site says that it fixes
/Qipo results in linker error: fatal error LNK1243: invalid or corrupt file: COMDAT section 0x30FE associated with following section 0x0
and the Microsoft site describes the error as
The linker has detected a corrupt .obj file. A section must be associated with another section that precedes it.
I turned up the compiler output to diagnostic, but did not see anything helpful there.
Question
What is can cause this error (and how can the causes be fixed)? Alternatively, what should I be looking for in the *.obj files to glean a better understanding of what's going on?

memcpy.asm not found error

I am working in Optix Using Visual studio 2013 platform, I have been working over month , suddenly I got this error, "memcpy.asm not found".
I found this file in Visual studio folder but it says "The source file is different from when the module was built"
Look carefully at the error, often this comes up as a secondary message because the debugger is trying to load "memcpy.asm" in order to show you debugging information because a memcpy failed, not because your program is actually missing "memcpy.asm"
Heres someone with a similar issue, in short - check the stack trace to see where the issue originated in your code, probably with trying to copy memory to an uninitialized pointer or something.

Panda3D and load_model c++

I am new to panda3d and am trying the hello world.
I have gotten the program to run with just:
PandaFramework framework;
framework.open_framework(argc, argv);
WindowFramework *window = framework.open_window();
framework.main_loop();
framework.close_framework();
return 0;
however, if I add in :
NodePath environt = window->load_model(framework.get_models(), "panda-model");
environt.reparent_to(window->get_render());
environt.set_scale(0.25, 0.25, 0.25);
environt.set_pos(-8, 42, 0);
before the main_loop(), it won't compile. I have the panda-model.egg.pz in every folder of my c++ project but every time my program breaks on :
environt.reparent_to(window->get_render());
The excat message is: Unhandled exception at 0x0152a317 in Irr.exe: 0xC00001A5: An invalid exception handler routine has been detected.
It compiles fine the only wraning being that it can't find the pdb files but that doesn't matter.
Any ideas?
Btw, im using MSVC++ 2010 and panda3d 1.7.2
The only error I can find is : First-chance exception at 0x00bfa317 in Irr.exe: 0xC0000005: Access violation reading location 0x737265db.
Unhandled exception at 0x00bfa317 in Irr.exe: 0xC00001A5: An invalid exception handler routine has been detected.
The program '[8476] Irr.exe: Native' has exited with code 0 (0x0).
which I'm pretty sure is still rather vague. I'm sorry but its all I can find. I'd be happy to describe it more though if necessary.
Microsoft Visual C++ 2010 is not supported by current versions of Panda3D. You will need to use 2008 or compile the Panda3D SDK from source against MSVC 2010. (This is not as straightforward as it sounds, as you will also need to compile some of the thirdparty packages to be compatible with 2010. However, it is possible.)
If you insist on using 2010 instead of 2008, this forum post may be helpful:
https://www.panda3d.org/forums/viewtopic.php?t=12663

Having trouble with OpenCV Vector usage and MATLAB

I am trying to use a feature detector in OpenCV in MATLAB. For that, I am creating a MEX file that calls certain other functions in other CPP files. These functions implement the necessary routine to call the OpenCV feature detector.
Everything is well till creating the MEX file. It can even run normal OpenCV routines from MATLAB.
But, When I am simply using the feature detector, it is giving me an error - VECTOR ITERATORS INCOMPATIBLE.
Please find the necessary information below -
File 1 - FeatureDetectorMEX.cpp -> This file contains the MEX function that calls the feature detector from FeatureDetetor.cpp
File 2 - FeatureDetector.cpp -> This file contains the feature detector FAST. Then it calls the feature extractor BRIEF to get some feature descriptors for keypoints. Here is the code -
Keypoints sourceKp;
Descriptors sourceDesc;
cv::FastFeatureDetector *detector = new cv::FastFeatureDetector(50);
cv::BriefDescriptorExtractor *extractor = new cv::BriefDescriptorExtractor();
//The following line generates the error
detector->detect(img.clone(),sourceKp);
if(!sourceKp.empty())
{
extractor->compute(img.clone(),sourceKp,sourceDesc);
}
Here, img is the image data structure of type cv::Mat. Keypoints is a vector - std::vector Keypoints. Descriptors is also cv::Mat.
FastFeatureDetector is the class that implements the FAST feature detector. BriefDescriptorExtractor is the class implementing Brief.
Here is the details of the error -
Debug Assertion Failed!
Program: C:\Program Files\MATLAB\R2010b\bin\win64\MATLAB.exe
File: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\Vector
Line: 238
Expression: vector iterators incompatible
Here are a few more information: My system is 64 bit. I am running MATLAB R2010b, and VC 2010 ultimate edition. All codes and dlls are in 64 bit. The program does not throw any errors if run from VC console. But, throws error if run from MATLAB.
My question: Has anyone faced this kind of problem with any of the feature detector programs in OpenCV? If yes, kindly help me with this.
Never mind. I have found the solution. By default, the MEX compiler has the SECURE_SCL as 0 in mexopts.bat. Keep it that way. Take the OpenCV release codes (or recompile debug using SECURE_SCL = 0). I actually went through the posts related to this. But, most of them tell you to set the flag = 1, which does not suppress the errors.
The Computer Vision System Toolbox now includes a support package for interfacing with OpenCV.

Access violation reading location 0xcccccccc

I am trying to run the squares.cpp example in the openCV 2.2. The code compiles and builds without errors in Visual Studio 2008. However when I run the executable (i.e., during run time) I am getting a error stating
Unhandled exception at 0x004ac363 in OpenCVRectangle.exe: 0xC0000005: Access violation reading location 0xcccccccc.
This occurs at the definition:
vector<vector<Point> > squares;
in the main function
Can somebody help, why this occurs?
I figured out that the value 0xcccccc usually is an uninitialized or bad variable, but do not understand why I get this exception at this line.
The full example code can be found at http://pastebin.com/MTaXVcQz
Your code runs fine on Mac OS X with OpenCV 2.3.0, but OpenCV is known to present different behaviors in different Operating Systems.
First, check if your code has this problem in both Release and Debug versions.
Upgrade to OpenCV 2.3.1 on Windows and see if the problem goes away.
namedWindow in the code you linked to is a function which doesn't look defined in this scope. It might be that it's trying to interpret as a variable which has not been defined, rather than a function. I would say it's missing some sort of library perhaps? It's difficult to say without further context, but vector<vector<Point> > squares; should not be a violation.
Press Ctrl + Alt + E in VS, enable all exceptions checking, run it in debug mode and see the place where the exception is rised. This should be enough for understanding.