1 | initial version |
The problem still exists to use OpenCV 2.4.4 when compiled under x64+Debug+vc11. For example, if you want to call the following function, it will cause RtlFreeHeap error when it returns.
vector<float> get_color_histogram_of_image(Mat img)
{
vector<float> result;
/// Separate the image in 3 places ( B, G and R )
vector<Mat> bgr_planes;
split( img, bgr_planes );
/// Establish the number of bins
int histSize = 8;
/// Set the ranges ( for B,G,R) )
float range[] = { 0, 256 } ; //0~255 the upper boundary is exclusive
const float * histRange = { range };
bool uniform = true;
bool accumulate = false;
Mat b_hist, g_hist, r_hist;
/// Compute the histograms:
calcHist( &bgr_planes[0], 1, 0, Mat(), b_hist, 1, &histSize, &histRange, uniform, accumulate );
calcHist( &bgr_planes[1], 1, 0, Mat(), g_hist, 1, &histSize, &histRange, uniform, accumulate );
calcHist( &bgr_planes[2], 1, 0, Mat(), r_hist, 1, &histSize, &histRange, uniform, accumulate );
/// stored in result
for (int i=0; i<histSize; i++)
result.push_back(r_hist.at<float>(i, 0));
for (int i=0; i<histSize; i++)
result.push_back(g_hist.at<float>(i, 0));
for (int i=0; i<histSize; i++)
result.push_back(b_hist.at<float>(i, 0));
// release
//delete [2]histRange;
return result;
}
2 | No.2 Revision |
The problem still exists to use OpenCV 2.4.4 when compiled under x64+Debug+vc11. (though no problem under x64+Release+vc11). For example, if you want to call the following function, it will cause RtlFreeHeap error when it returns.
vector<float> get_color_histogram_of_image(Mat img)
{
vector<float> result;
/// Separate the image in 3 places ( B, G and R )
vector<Mat> bgr_planes;
split( img, bgr_planes );
/// Establish the number of bins
int histSize = 8;
/// Set the ranges ( for B,G,R) )
float range[] = { 0, 256 } ; //0~255 the upper boundary is exclusive
const float * histRange = { range };
bool uniform = true;
bool accumulate = false;
Mat b_hist, g_hist, r_hist;
/// Compute the histograms:
calcHist( &bgr_planes[0], 1, 0, Mat(), b_hist, 1, &histSize, &histRange, uniform, accumulate );
calcHist( &bgr_planes[1], 1, 0, Mat(), g_hist, 1, &histSize, &histRange, uniform, accumulate );
calcHist( &bgr_planes[2], 1, 0, Mat(), r_hist, 1, &histSize, &histRange, uniform, accumulate );
/// stored in result
for (int i=0; i<histSize; i++)
result.push_back(r_hist.at<float>(i, 0));
for (int i=0; i<histSize; i++)
result.push_back(g_hist.at<float>(i, 0));
for (int i=0; i<histSize; i++)
result.push_back(b_hist.at<float>(i, 0));
// release
//delete [2]histRange;
return result;
}