Feature Detector corrupts KeyPoint vector in OpenCV3.0 using MSVC 14: _BIG_ALLOCATION_ALIGNMENT Assertion message
Hi there,
I am using OpenCV 3.0 with the latest Visual C++ (version 14) and Win10. When calling the detect() method of a feature detector, detection works fine but if the KeyPoint vector goes out of scope, the program crashes with the following assertion:
File: c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0
Line: 106
Expression: "(_Ptr_user & (_BIG_ALLOCATION_ALIGNMENT - 1)) == 0" && 0
If I comment out the detector->detect() part the assertion is gone.
I have extracted a small example to demonstrate what happens :
#include "opencv2/imgcodecs.hpp"
#include "opencv2/features2d/features2d.hpp"
#include <conio.h>
#include <iostream>
#include <vector>
using namespace cv;
using namespace std;
int main(void)
{
Mat img(imread("lena.jpg", 1)); //Load grayscale image.
Ptr<FeatureDetector> detector(FastFeatureDetector::create());
vector<KeyPoint> features;
detector->detect(img, features);
cout << features.size() << " features detected. Press return to crash :)" << endl;
getch();
cout << getBuildInformation();
//... and crash
return 0;
}
Here is the output of the above program (I've removed some parts):
3752 features detected. Press return to crash :)
General configuration for OpenCV 3.0.0 =====================================
Version control: 3.0.0
Platform:
Host: Windows 6.1 AMD64
CMake: 2.8.11.2
CMake generator: Visual Studio 12
CMake build tool: C:/PROGRA~2/MSBuild/12.0/Bin/MSBuild.exe
MSVC: 1800
C/C++:
Built as dynamic libs?: YES
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe (ver 18.0.21005.1)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /wd4251 /wd4324 /MP4 /MD /O2 /Ob2 /D NDEBUG /Zi
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /wd4251 /wd4324 /MP4 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /MP4 /MD /O2 /Ob2 /D NDEBUG /Zi
C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /MP4 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:X86 /INCREMENTAL:NO /debug
Linker flags (Debug): /machine:X86 /debug /INCREMENTAL
Precompiled headers: YES
Extra dependencies:
3rdparty dependencies: ippicv
OpenCV modules:
To be built: hal core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d stitching videostab world
Disabled: -
Disabled by dependency: -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 viz
OpenCL:
Version: dynamic
Include path: C:/builds/master_PackSlave-win32-vc12-shared/opencv/3rdparty/include/opencl/1.2 C:/Program Files (x86)/AMD/clAmdFft/include C:/Program Files (x86)/AMD/clAmdBlas/include
Use AMDFFT: YES
Use AMDBLAS: YES
-----------------------------------------------------------------