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

asked 2018-10-21 17:32:01 -0600

UNOAlterEgo gravatar image

updated 2018-10-21 18:14:18 -0600

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!

edit retag flag offensive close merge delete

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 ( 2018-10-22 06:28:07 -0600 )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 ( 2018-10-22 09:28:56 -0600 )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 ( 2018-10-22 09:32:34 -0600 )edit