Cut an image into 2 parts based on a line

asked 2018-03-15 09:04:01 -0500

BhanuKiran gravatar image

updated 2018-03-15 11:19:08 -0500


image description

I am looking to split an image into two parts. After doing some math, (x1, y1) of the top point and (x2, y2) of the bottom point are calculate (y1 = 0 and y2 = height of the image).

How can i split the image knowing all the 4 corner points.

edit retag flag offensive close merge delete


what should happen with the overlapping parts ?

berak gravatar imageberak ( 2018-03-15 10:17:52 -0500 )edit

What do u mean by overlapping ? From HoughLinesP function i get two points on the line. I extrapolated the line to get the top point on the image(x1, 0) and bottom point (x2, rows of image).

BhanuKiran gravatar imageBhanuKiran ( 2018-03-15 10:29:52 -0500 )edit

please explain "split"

berak gravatar imageberak ( 2018-03-15 10:36:54 -0500 )edit

I am sorry. Now I am realizing that my question does make any sense. If i cut the image along the line as left image and right image. The number rows are fine but the number of columns in left image/right image will have a some number, either it has to be x1 or x2. I think, i have to do rectangular cut. image[y1:y2, x1:x2]

BhanuKiran gravatar imageBhanuKiran ( 2018-03-15 11:12:27 -0500 )edit