Ask Your Question
0

crop in opencv using python

asked 2014-11-08 00:56:47 -0600

Manish gravatar image

updated 2014-11-08 01:00:05 -0600

berak gravatar image

i want to divide an image into four parts in opencv using python as i am knew to it i am not able to do this.please help me out.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-11-08 01:12:01 -0600

berak gravatar image

the images used in python are plain numpy arrays. you can get any subrect with a range operation like:

   imsub = img[ ymin:ymax, xmin:xmax ]

so, for a 640x480 image:

   tl = img[:240, :320]
   tr = img[:240, 320:]
   bl = img[240:, :320]
   br = img[240:, 320:]
edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-11-08 00:56:47 -0600

Seen: 1,368 times

Last updated: Nov 08 '14