Ask Your Question

herohuyongtao's profile - activity

2020-11-23 02:45:01 -0600 received badge  Citizen Patrol (source)
2014-09-21 16:01:30 -0600 received badge  Necromancer (source)
2013-06-25 07:08:08 -0600 received badge  Editor (source)
2013-06-25 07:06:22 -0600 commented answer Visual Studio 2012 and RtlFreeHeap error

Please let me know if you can solve this problem. Thanks.

2013-06-25 07:04:17 -0600 received badge  Supporter (source)
2013-06-25 07:03:33 -0600 answered a question Visual Studio 2012 and RtlFreeHeap error

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;

}