运行OpenCV 4.1.0示例代码,图像缝合得很好,但是,与原始两个图像相比,在同一点上RGB值已更改。为什么会这样呢?有什么解决方案可以保留原始版本吗?
请检查以下屏幕截图,左为原始一幅,右为缝合一幅。相同像素处的RGB值已略有更改。
def main():
args = parser.parse_args()
# read input images
imgs = []
for img_name in args.img:
img = cv.imread(cv.samples.findFile(img_name))
if img is None:
print("can't read image " + img_name)
sys.exit(-1)
imgs.append(img)
stitcher = cv.Stitcher.create(args.mode)
status, pano = stitcher.stitch(imgs)
if status != cv.Stitcher_OK:
print("Can't stitch images, error code = %d" % status)
sys.exit(-1)
cv.imwrite(args.output, pano);
print("stitching completed successfully. %s saved!" % args.output)
print('Done')
if __name__ == '__main__':
print(__doc__)
main()
cv.destroyAllWindows()