I was trying to stitch images with OpenCV stitcher.
Some of the feed in images have some black areas left by previous processing and they cause some trouble while stitching.
And my code is like this:
import numpy as np
import cv2
import os
import glob
import argparse
parser = argparse.ArgumentParser(description='Stitch several images.')
parser.add_argument("-i","--inputfiles", type = str, help = "the input files", nargs='+')
parser.add_argument("-o","--outputfiles", type = str, help = "the output files")
args = parser.parse_args()
print "input: " + str(args.inputfiles)
print "potential output: " + args.outputfiles
stitcher = cv2.createStitcherScans(True)
arrayOfImage = []
for imageName in args.inputfiles:
arrayOfImage.append(cv2.imread(imageName))
stitchingResult = stitcher.stitch(arrayOfImage)
cv2.imwrite(args.outputfiles,stitchingResult[1])
And I use command
python stitchingImages.py -i 1.png 2.png 3.png 4.png -o result.png
to test it.
The result is Result
I think the problem is the black areas are recognised as strong features. Is there any way to exclude them from the feature detection and blending?
PS: is there any detailed documents for the python version of OpenCV?