Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how can i scale an image properly?

I have a 640 x 480 camera feed that i am trying to stretch up to 1280 x 960.

I want double the pixels, so that a 4 x 4 blob of colour becomes 8 x 8, etc.

Using this code:

        cv::Size sizeUp(1280, 1024);
        cv::Mat newSize(cv::Size(sizeUp), CV_8UC1);
        cv::resize(SmallImage,newSize, sizeUp);

just puts the small image in the top left corner of the new Mat, and leaves the rest blank.

Am I going about this the wrong way?

how can i scale an image properly?

I have a 640 x 480 camera feed that i am trying to stretch up to 1280 x 960.

I want double the pixels, so that a 4 x 4 blob of colour becomes 8 x 8, etc.

Using this code:

        cv::Size sizeUp(1280, 1024);
        cv::Mat newSize(cv::Size(sizeUp), CV_8UC1);
        cv::resize(SmallImage,newSize, sizeUp);

just puts the small image in the top left corner of the new Mat, and leaves the rest blank.

Am I going about this the wrong way?