I am trying to use memcpy to copy Mat’s data member data to a one dimensional array and the following code is ok when the data type is unsigned char, but why can’t it be a double type? The error is Segmentation fault, how do I pass the double type?
thanks in advance!
cv::Mat gray;
cv::cvtColor(RGBimage, gray, cv::COLOR_BGR2GRAY);
gray.convertTo(gray, CV_64FC1, 1.0 / 255.0, 0.0); // gray is 720*1280 size image
double src[777600]; // 720*1280=777600
memcpy(src, (double *)gray.data, 777600U*sizeof(double)); // error: Segmentation fault