OpenCV cropped image distorted
I am trying to read an image and crop a rectangular region from it using OpenCV. However the cropped image I'm getting seems to be out of proportion and not the same size as the original. Is there something wrong with my code? Or am I doing something stupid like unintentionally zooming in on the window.
#include "opencv2/opencv.hpp"
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
using namespace cv;
using namespace std;
int main()
{
// Read in an image 1
Mat Cloud1 = imread("/home/user1/Pictures/cloud1.jpeg");
Rect rect(250,250,150,150); //some random values
Mat Template = Cloud1(rect);
namedWindow("FIGURE 1", CV_WINDOW_AUTOSIZE);
namedWindow("FIGURE 2", CV_WINDOW_AUTOSIZE);
imshow("FIGURE 1", Cloud1);
imshow("FIGURE 2", Template);
waitKey(0);
return 0;
}
could you try