How to combine: image - optical flow - coordinate system (axis2pixels)

1 vue (au cours des 30 derniers jours)
Paul Matteschk
Paul Matteschk le 22 Jan 2022
Modifié(e) : Aishwarya le 6 Oct 2023
hi everyone,
my goal is to calculate windspeed from cloudimages (frames).
I use Lucas Kanade for Flow Estimation.
Unfortunalty iam stucked by plotting my results:
-i want the output diagramm/image/flowfield full frame without white border
-moreover i would like to add axis with the pixel units (tried imref2d)
-and a grid
I am sure there is a way. but who knows him?
% display optical flow
step = 30;
imshow(im_2);
[w,h] = size(optical_flow_u);
u_down = optical_flow_u(1:step:end, 1:step:end);
v_down = optical_flow_v(1:step:end, 1:step:end);
[m,n] = size(im2_level);
[X,Y] = meshgrid(1:n, 1:m);
X_down = X(1:step:end, 1:step:end);
Y_down = Y(1:step:end, 1:step:end);
hold on;
quiver(X_down, Y_down, u_down, v_down, 0.5, 'color',[1 0 0]);

Réponses (1)

Aishwarya
Aishwarya le 6 Oct 2023
Modifié(e) : Aishwarya le 6 Oct 2023
Hi Paul,
As per my understanding you are facing difficulties in changing the plot properties of the flow estimation output.
To address your questions.
Change the property of the figure:
  • Change “Position” property of the figure window according to image size and position of figure required.
f = figure;
f.Position = [10 10 500 500];
To add axis and grid to the plot:
  • “axis on” will add the axis in pixel units. Consider making the following changes in the code:
hold on;
quiver(X_down, Y_down, u_down, v_down, 0.5, 'color',[1 0 0]);
% Add axis and label them
axis on;
xlabel('X (pixels)');
ylabel('Y (pixels)');
% Turn on grid
grid on;
hold off;
Hope this helps!
Regards,
Aishwarya Palli

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by