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

2 次查看(过去 30 天)
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]);

回答(1 个)

Aishwarya
Aishwarya 2023-10-6
编辑:Aishwarya 2023-10-6
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

类别

Help CenterFile Exchange 中查找有关 Filter Analysis 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by