0

given two different images, how can I compute and plot the vector field of the displacement between these two images?

I know matlab has a tool called opticalflow that allows me to do something similary of what i'm asking but it looks like it doesnt work for me.

Is there anything that could help me besides the opticalflow?

Perhaps i'm doing something wrong so i'm gonna post an example of what I'm doing:

fixed = rgb2gray(imread('Fixed_2.jpg'));
moving = rgb2gray(imread('Moved_2.jpg'));
fixed= fixed(:, 100:400);
moving= moving(:, 100:400);
[optimizer, metric] = imregconfig('monomodal');
movingRegistered = imregister(moving, fixed, 'rigid', optimizer, metric);
figure
imshow(movingRegistered);
    opticFlow = opticalFlowHS;
    flow = estimateFlow(opticFlow,fixed);
    flow = estimateFlow(opticFlow,movingRegistered);
  hold on
  plot(flow,'DecimationFactor',[5 5],'ScaleFactor',25)
  hold off

This is my output

Vector field

Many thanks in advance.

Bobafett
  • 23
  • 4
  • So what's wrong with your code? Any warning/error/wrong output? – Sardar Usama Jun 13 '18 at 18:55
  • @SardarUsama nope anything. But what i get from the plot is a bunch of arrows going in all directions. So I came to a conclusion that maybe im doing something wrong. – Bobafett Jun 13 '18 at 19:07
  • @SardarUsama I uploaded the output i get from matlab, I honesly dont understand if what im doing is good ( or at least in the good direction ) or totally wrong. – Bobafett Jun 13 '18 at 19:31
  • @SardarUsama any suggestions? I'm I doing right? Thank you. – Bobafett Jun 14 '18 at 18:25
  • Usually it's the questioner who tells us what the correct output will be. I am not a pro in this field. I can't confirm you if you're not sure. Sorry – Sardar Usama Jun 14 '18 at 18:26

0 Answers0