Can we remove an object completely?
This is perhaps the most interesting application of seam carving. We can make an object completely disappear from an image. Let's consider the following image:

Enclose the region to remove using your mouse:

After you remove the chair on the right, it will look something like this:

It's as if the chair never existed! Before we look at the code, it's important to know that this takes a while to run. So, just wait for a couple of minutes to get an idea of the processing time. You can adjust the input image size accordingly! Let's take a look at the code:
import sys
import cv2
import numpy as np
# Draw rectangle on top of the input image
def draw_rectangle(event, x, y, flags, params):
global x_init, y_init, drawing, top_left_pt, bottom_right_pt, img_orig
# Detecting a mouse click
if event == cv2.EVENT_LBUTTONDOWN:
drawing = True
x_init, y_init = x, y
# Detecting mouse movement
elif event == cv2.EVENT_MOUSEMOVE:...