Aligning surfaces to find height difference
21 次查看(过去 30 天)
显示 更早的评论
Hi
I have 3D data from a CMM of multiple similar surfaces, I'm studying the height difference in these surfaces. What is the most striaght-forward way to align these surfaces so I can then find the difference between them?
(If it is easier to look at these as 2D surfaces I can do this as it is only the height difference I'm currently looking at)
Thanks in advance!
2 个评论
Image Analyst
2023-7-29
What exactly are we supposed to be seeing when you say "these surfaces"?
And if you change (shift or tilt) one surface, then you're no longer looking at the original height differences. Are you sure you want to look at the altered height differences instead?
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
回答(1 个)
Yatharth
2023-8-29
Hi , I understand that you are trying to find the height difference between multiple surfaces obtained via CMM. However aligning them or modifying their position in terms of Z axis might alter your data and you will have incoorect values for height. Instead you can select one of the surfaces as the reference surface. This surface will serve as the baseline for comparison with the other surfaces.
To find the height difference between multiple similar surfaces, you can follow these steps:
1. Define a reference surface
2. Establish corresponding points: Identify corresponding points on the reference surface and each of the other surfaces. These points should represent the same location or feature on each surface. You can use feature matching techniques or manual selection to establish correspondences.
3. Calculate the height difference between the reference surface and the other surfaces
here's an example for the same
% Generate dummy 3D data for three surfaces
surface1 = rand(10, 10); % Reference surface
surface2 = rand(10, 10); % Surface 2
surface3 = rand(10, 10); % Surface 3
% Define corresponding points
% In this example, we assume the surfaces have the same dimensions
[row, col] = size(surface1);
[X, Y] = meshgrid(1:col, 1:row); % Generate grid coordinates
% Calculate height difference
height_diff_2 = surface2 - surface1;
height_diff_3 = surface3 - surface1;
% Visualize the height differences
figure;
subplot(1, 2, 1);
imagesc(height_diff_2);
colorbar;
title('Height Difference - Surface 2');
subplot(1, 2, 2);
imagesc(height_diff_3);
colorbar;
title('Height Difference - Surface 3');
you can use the height_diff_n matrix to analyse your data statistically.
you can learn more about the imagesc and colorbar here.
3 个评论
Yatharth
2023-9-7
Hi, since your data has a separate Z axis you can directly find the difference between the height of the two arrays
Note: Make sure you make both the array size equal and concatenate the smaller one with zeros at the start or at the end
here's the code for your reference.
filename = 'LinerA.xlsx';
sheet = 'Sheet2';
filename2 = 'LinerB.xlsx';
% Specify the columns you want to load (e.g., columns A and B)
columns = 'A:C';
% Load the specified columns as a cell array
data1 = xlsread(filename, sheet, columns);
data2 = xlsread(filename2, sheet, columns);
z1 = data1(:,3);
z2 = data2(:,3);
temp_z = zeros(length(z2) - length(z1) , 1);
z1 = [z1 ; temp_z]
height_diff_2 = z2-z1
% Visualize the height differences
figure;
subplot(1, 2, 1);
imagesc(height_diff_2);
colorbar;
title('Height Difference - Surface 2');
I hope this helps.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!