Ask Your Question

Revision history [back]

Like stated by @LBerger, if I apply this to the input image you give:

#include <iostream>

#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;

int main()
{
    Mat image = imread("/home/spu/Desktop/test.png");
    Mat outImage;
    resize(image, outImage,  Size(256,256),INTER_NEAREST);

    imshow("orig", image);
    imshow("resized", outImage);

    waitKey(0);

    return 0;
}

Then this is the output result and it is thus working perfectly fine. What is your configuration?

image description

Like stated by @LBerger, if I apply this to the input image you give:

#include <iostream>

#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;

int main()
{
    Mat image = imread("/home/spu/Desktop/test.png");
    Mat outImage;
    resize(image, outImage,  Size(256,256),INTER_NEAREST);

    imshow("orig", image);
    imshow("resized", outImage);

    waitKey(0);

    return 0;
}

Then this is the output result and it is thus working perfectly fine. What is your configuration?

image description

My guess, you are using OpenCV2.4.x with OpenCV3.0 flags? This code above is on OpenCV3.x ...