Ask Your Question

Need video stabilization advice

asked 2012-12-04 07:58:10 -0500

Mikhail Tabunov gravatar image

Hi! I am trying to implement a video stabilization algorithm (it will be used for static scenes and short movies, not more than 10 seconds, not long videos), and need your advice.

So, i have first frame (firstFrame) and many others (nextFrame), which should be transformed by transfrormPerspective method. Here is the code, which performs transformation of nextFrame:

match = firstFrame.findKeypointMatch(nextFrame, 1000, 0.06)[0]
rotMatrix = match.getHomography()
out = nextFrame.transformPerspective(rotMatrix)

But it seems, that something wrong. The video does not seem stable, and such way of transformation one frame to another does not work. Maybe you can advice me, what i am doing wrong?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2012-12-04 09:11:14 -0500

kscottz gravatar image

I think there might be an error in warp perspective, but I need to go back and check. Here is an example of it being used with raw OpenCV. I will file a ticket to take a look at the warp perspective code. Please realize that feature points don't always yield a correct perspective transform. A lot of times people will use some sort of statistical approach like RANSAC to find a subset of keypoint correspondences that work well. Could you please post a bit more code and maybe discuss how your algorithm is going to work?

edit flag offensive delete link more

answered 2012-12-04 10:20:09 -0500

Mikhail Tabunov gravatar image

Hi! Here is example of my test case:

class PerspectiveSmoother:
  def __init__(self, buf):
    self.imageBuffer = buf

  def smoothToImg(self, source, target):
    match = target.findKeypointMatch(source, 1000, 0.06)[0]
    rotMatrix = match.getHomography()
    return target.transformPerspective(rotMatrix)

  def performSmooth(self):
    out = []
    first = self.imageBuffer.getFirst()
    second = self.imageBuffer.getFromIndex(10)

    out = self.smoothToImg(first, second)'01.jpg')'02.jpg')'03.jpg')

01.jpg - source 02.jpg - warped target 03.jpg - origin of target

edit flag offensive delete link more


sorry, i can not publish link or images here

Mikhail Tabunov gravatar imageMikhail Tabunov ( 2012-12-04 10:20:51 -0500 )edit

also, i don't think that error is somewhere in simplecv code, most likely it is in my code

Mikhail Tabunov gravatar imageMikhail Tabunov ( 2012-12-04 10:31:21 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-12-04 07:58:10 -0500

Seen: 271 times

Last updated: Dec 04 '12