OpenCV(Python/C++) Combine frames of parts of an object in movement, without using keypoints

asked Oct 21 '18

UNOAlterEgo gravatar image

updated Oct 22 '18

Hello, I'm trying to combine images of parts of an object, not a panorama, from several frames, in order to get one image of the hole object. I tried using the Opencv Stitcher class, for a test with two images of the object, but not enough keypoints were found and an empty image was returned. Here is the code.

import cv2
import numpy as np
import imutils

RESIZE = 200

stitcher = cv2.createStitcher(False)
packageSx = cv2.imread("package1.jpg")
packageDx = cv2.imread("package2.jpg")

result = stitcher.stitch((packageSx,packageDx))

imutils.resize(packageSx, width=RESIZE)
imutils.resize(packageDx, width=RESIZE)

cv2.imwrite("result.jpg", result[1])
cv2.imshow("Result", result[1])
cv2.waitKey(0)
cv2.destroyAllWindows()

This are the test images of the object, a small part of the images overlaps.

image description image description

Can anyone suggest another approach for stitching frames of a specific object in motion, in real time? Thank you!

Preview: (hide)

Comments

is there any chance, you can add some texture to it ? (like it's now, there's probably nothing you can do)

berak gravatar imageberak (Oct 22 '18)edit

No I can't, but I read that is possible to stitch images with optical flow pattern. Do you think is a possible approach? If yes, have you got some references to this approach? Thanks.

UNOAlterEgo gravatar imageUNOAlterEgo (Oct 22 '18)edit

most optical flow systems use blockmatching. and it won't work, if all your cardboard surface looks the same. as long as your surface is that uniform, you're out of luck, i guess.

berak gravatar imageberak (Oct 22 '18)edit