I read an image(the original image) into an CvMat using cvLoadImage, and assign its data pointer to another CvMat by an intermediate data block, and then show this CvMat using cvShowImage, but only a small region of the original image was displayed, in a window with the same size as the original image.
char* filename = "image\\neuron.tif"; // an 8bits grayscale image
IplImage* iplImage = cvLoadImage(filename);
int width = iplImage->width;
int height = iplImage->height;
cvNamedWindow("Original", CV_WINDOW_AUTOSIZE);
cvShowImage("Original", iplImage); // showed properly
cvWaitKey();
CvMat* header = cvCreateMatHeader(height, width, CV_8UC1);
CvMat* img_mat = cvGetMat(iplImage, header);
unsigned char* img_host = (unsigned char*)malloc(height * width * sizeof(unsigned char));// the intermediate data block, on which I need to apply a cuda operation
img_host = img_mat->data.ptr;
CvMat* blur_mat = cvCreateMat(height, width, CV_8UC1);
blur_mat->data.ptr = img_host;
cvNamedWindow("Blurred", CV_WINDOW_AUTOSIZE);
cvShowImage("Blurred", blur_mat); // the problem described
cvWaitKey();
Actually the problem occured when I try "img_host = img_mat->data.ptr", but I have no idea what's wrong.