opencv – How to tell what the size of an image is after removing seams in using OpenCV2 in Python?

opencv – How to tell what the size of an image is after removing seams in using OpenCV2 in Python?

You could use a Python subprocessing call to ImageMagick command line -trim function to remove any black that touches the sides of the image.

See https://imagemagick.org/discourse-server/viewtopic.php?f=4&t=35579

Input:

enter

import subprocess
cmd = convert seams1.png -fuzz 0% -background black -define trim:percent-background=0% -trim +repage result.png
subprocess.check_output(cmd, shell=True, universal_newlines=True)

or

import subprocess
cmd = convert seams1.png -fuzz 0% -background black -define trim:percent-background=0% -trim +repage result.png
subprocess.call(cmd, shell=True)

enter

opencv – How to tell what the size of an image is after removing seams in using OpenCV2 in Python?

Leave a Reply

Your email address will not be published.