Ask Your Question
0

cutting an image?

asked 2013-11-20 02:49:57 -0600

suday gravatar image

How to cut an image into 2 halves?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-11-20 03:00:42 -0600

You can do that by using the region of interest parameter.

Some sample code:

Mat original_image, first_half, second_half;
original_image = imread(location, 1);
Rect roi_first = Rect(0,0,original_image.cols/2, original_image.rows);
Rect roi_second = Rect(original_image.cols/2,0,original_image.cols/2, original_image.rows);
first_half = original_image( roi_first );
second_half = original_image( roi_second );
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-11-20 02:49:57 -0600

Seen: 1,035 times

Last updated: Nov 20 '13