- Select Control Points: You can use the "cpselect" function to select control points in both the original and translated images.
- Estimate Affine Transformation: Utilize the "fitgeotform2d" function to estimate the affine transformation matrix. This matrix represents the translation and rotation operations required to align the translated image with the original image.
- Generate Animation Frames: Suppose the translation matrix is [tx, ty] and the rotation angle is theta. Determine the number of frames (f) desired for the animation. Set up a "for" loop that will iterate f times. Within each iteration of the loop, use the "imwrap" function to recover the rotated image. Apply a translation matrix of [tx/f, ty/f] and an angle of theta/f to gradually animate the registration process.
- Display Animation: Each loop iteration will produce an image representing an animation frame. Display these frames sequentially to visualize the gradual registration process.
Animate Registration of the point cloud data sets
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I am lookingt to animate the registration process of point cloud data set that is executed using ICP. This is for demosntration so, if there is a clever way to show the registration process of two point cloud data set it would be great.
I have the same data generated and rotated. It would be great if anyone can help on how to achive the animation of this point cloud registration process. Thanks in advance.
In the below code, looking to animate the registration of point cloud data " After" on " Before". for a like 7-10 seconds clip.
%% 1. Random Data Generation with a gap between two data sets
% Defining random data parameters
points = 200; % Number of data points
bc = 20; % Should be even
% Defining the size and position of the gap
gap_size =30;
gap_position = (points + bc) / 2;
% Generating random data for the left side of the surface
left_side = rand(points + bc, gap_position - gap_size/2);
% Generating random data for the right side of the surface
right_side = rand(points + bc, gap_position - gap_size/2);
% Combining the left and right sides to create the surface with an empty gap
y = [left_side, zeros(points + bc, gap_size), right_side];
%% 2. Data Filtering Refer to the two_surface_data_genertion code for details
k= (1/bc^2)*ones(bc); % convolution operation.
Ysmooth1 = conv2(y,k,'same'); %Applying Filter2
%% 3. Surface Data Extraction
Zdata = zeros(size(Ysmooth1)); % Initialize Zdata matrix
% Surface Data Extraction
for ii = (bc/2):(size(Ysmooth1,1) - bc/2)
for jj = (bc/2):(size(Ysmooth1,2) - bc/2)
Zdata(ii, jj) = Ysmooth1(ii, jj);
end
end
%% 4.Domain data generation
z_data_mean_zero =Zdata- mean(Zdata);
%% 5 Visualization of the Generated Data
figure(1)
Surfaceplot = mesh(Zdata- mean(Zdata));
title('Z data extraction to obtain the surface')
%% 6. Extracting the X,Y and Z data from the mesh plot. They are all 2D
% Mean subtracted data:
generated_x= Surfaceplot.XData;
generated_y = Surfaceplot.YData;
generated_z = Surfaceplot.ZData;
%% 7. Converting X, Y and Z data as a 1D array rows. To do this step, previous step was needed
index = 1;
for row = 1:length(generated_y) %rows
for col = 1:length(generated_x)
x_row_domain_beforeShip(index) = generated_x(col);
y_row_domain_beforeShip(index) = generated_y(row);
z_row_domain_beforeShip(index) = generated_z(row, col);
index = index + 1;
end
end
%Generating the DomainSurface_beforeShip
Before=[ x_row_domain_beforeShip ; y_row_domain_beforeShip ; z_row_domain_beforeShip ];
%% 8. Defining Rotation Matrix to simulate Camera Shift
%Defining the rotation angles
alpha_rot =1*(pi/180); %Rotation angle in radians around X-axis
beta_rot = 1*(pi/180); %Rotation angle in radians around Y-axis
gama_rot=1*(pi/180); %Rotation angle in radians around Z-axis
%Creating rotation matrices
Rx_mis = [ 1 0 0;
0 cos(alpha_rot) -sin(alpha_rot);
0 sin(alpha_rot) cos(alpha_rot)] ;
Ry_mis = [cos(beta_rot) 0 sin(beta_rot);
0 1 0;
-sin(beta_rot) 0 cos(beta_rot) ];
Rz_mis = [cos(gama_rot) -sin(gama_rot) 0;
sin(gama_rot) cos(gama_rot) 0;
0 0 1];
% xos=0;%*length(x_roi);
% zos =20.0%*length(z_roi);
% yos =0.0%*length(y_roi)
% T_trans =[ xos yos zos]
% Trnasformation Matrix
R_trans_ship=Rz_mis*Ry_mis*Rx_mis
%% 9: Generating the second surface to simulate the image with camera shift after Shipping
After =R_trans_ship*DomainSurface_beforeShip;
0 Kommentare
Antworten (1)
Shreeya
am 27 Okt. 2023
Hello
I understand that you want to animate the registration of a point cloud dataset. You can follow the following steps to achieve this:
The above workflow is derived from the link below:
Another approach to animate the registration of a point cloud dataset is by utilizing the registration estimation app in MATLAB. This app provides three default registration trials. The MSER and SURF methods identify and match feature points between the original and distorted images. The app then overlays these matched feature points with a static animation, demonstrating the mapping across the two images. By using the registration estimation app, you can visualize the registration process and observe the transformation of the point cloud dataset.
Refer to the link below for more details:
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Point Cloud Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!