CvTranspose gives a different image size?

I'm new to OpenCV and I want to transfer the image in grayscale, but I get the wrong output size.

// img is an unsigned char image
IplImage *img = cvLoadImage("image.jpg"); // where image is of width=668 height=493
int width  = img->width;
int height = img->height;

I want to transfer it:

IplImage *imgT = cvCreateImage(cvSize(height,width),img->depth,img->nChannels);

cvTranspose(img,imgT);

When I check the images, I see that the original image imghas a size of 329324, which is true: 493*668* 1byte, as it is unsigned char. However, it imgThas a size of 331328.

I am not sure where this happened.

EDIT: 1- I am using Windows XP and OpenCV 2.2. 2- When I check the image, I meant when I see the values ​​of the imgT variable. For example, imgT-> width, imgT-> heigt, imgT-> size, etc.

+3
source share
2 answers

, OpenCV 4- . 668 , 4, .

493 (- ), 4. , 4, 496, 496 , 3 , 4- . 496 * 668 331328. , ( , ).

+11

cv: Mat() Mat.t() . /,

-1

All Articles