Calculate optical flow between two pictures

7 visualizaciones (últimos 30 días)
Patrick
Patrick el 14 de Dic. de 2014
Comentada: Patrick el 14 de Dic. de 2014
Hi,
I tried to calculate the optical flow between two pictures with the matlab built-in function:
I1 = rgb2gray(imread('Test4.jpg'));
I2 = rgb2gray(imread('Test4e.jpg'));
opticalFlow = vision.OpticalFlow('ReferenceFrameSource', 'Input port')
step(opticalFlow, I1, I2)
But I get the error:
Error using vision.OpticalFlow/validateInputsImpl (line 846)
Expected input I data type to be floating-point.
I am not sure what this means. I can't see the code of this. Any ideas on what I am doing wrong?
Thanks

Respuesta aceptada

Guillaume
Guillaume el 14 de Dic. de 2014
Your I1 and I2 are of type uint8. Convert them to double:
I1 = im2double(rgb2gray(imread('Test4.jpg')));
I2 = im2double(rgb2gray(imread('Test4e.jpg')));
  1 comentario
Patrick
Patrick el 14 de Dic. de 2014
Thanks a lot. I actually thought I tried this and it didn't work but it seems like I made another mistake doing this.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by