Regarding the error message "The data should normally be NULL"
I have compiled OpenCV 3.0.0 for python on Windows.
When I tried to run the code bellow I got this error message: "The data should normally be NULL!"
import numpy as np
import cv2
img1 = cv2.imread('C:\\Users\\soboh\\Documents\\pcb.jpg',0) # queryImage
img2 = cv2.imread('C:\\Users\\soboh\\Documents\\pcb.jpg',0) # trainImage
sift = cv2.xfeatures2d.SURF_create()
kp1, des1 = sift.detectAndCompute(img1,None)
kp2, des2 = sift.detectAndCompute(img2,None)
FLANN_INDEX_KDTREE = 0
index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)
search_params = dict(checks=50) # or pass empty dictionary
flann = cv2.FlannBasedMatcher(index_params,search_params)
matches = flann.knnMatch(des1,des2,k=2)
The error happens when calling the function flann.knnMatch(). The full error message is:
"cv2.error: cv2.cpp:161: error: (-215) The data should normally be NULL! in function allocate"
So I have opened the file cv2.cpp and looked at line 161 and found these lines of code:
"
if( data != 0 )
{
CV_Error(Error::StsAssert, "The data should normally be NULL!");
// probably this is safe to do in such extreme case
return stdAllocator->allocate(dims0, sizes, type, data, step, flags, usageFlags);
}
"
so I have put the line that starts with "CV_Error" in a comment and compiled again the OpenCV and tried to run the same code and everything worked fine, but I am not sure that what I did is ok!!! Any help?
imho, this is a valid issue
behaviour can be reproduced e.g. from the plane_tracker.py sample
Does anyone know if this has been fixed in OpenCV 3.1.0_x and if so, what is the minor version number?
@fmw42, please do not post answers, if you have a question or comment.
Sorry! I am a novice to OpenCV and this forum.