Image Crop
Hello there,
I have an image that's 320 x 240 in size. I draw a rectangle area over the image that needs to be cropped. I get 4 values from the rectangle and they are,
- X = X-axis value from top left of rectangle.
- Y = Y-axis value from top left of rectangle.
- Width = Width of rectangle.
- Height = Height of rectangle.
Now what am doing is,
Rect r(X, Y, Width, Height); Mat orig_Image; Mat cropped_Image = orig_Image(r).clone();
I tried some other approaches also. But what i see is that the cropping is not 100% accurate.
It looks like the Y axis seems to be off by few pixels.
Is there a different approach to cropping?
I am working on a C++ project.
Thanks in advance.
Refer to this link,It uses c :http://kristou.com/2009/08/01/opencv-image-cropping/