Calculating Surface Curvature from Image Data
Hello,
I’m trying to calculate the curvature of each surface point from a morphology picture. However, when using surfature(), I do not get the results I want. A lot of points have a gaussian curvature of 0, which is not plausible for the example I use.
I tried a lot of different methods for calculating and ploting, but never got a good result…
I wrote the following:
% reading in picture
data = imread("Morphology.PNG");
% if not yet, convert to gray image
if size(data, 3) == 3
data = rgb2gray(data);
end
% smoothing image
data = imgaussfilt(data, 4);
% converting to double
data = double(data);
z = data;
% generating 2D arrays for X and Y with size of data-dimensions
[Rows, Cols] = size(data);
[x, y] = meshgrid(1:Cols, 1:Rows);
% calculating gaussian and normal curvature
[K, H] = surfature(x, y, data);
% display surface
figure;
surf(x, y, z, "EdgeColor","none");
title(‘Surface Morphology’);
colorbar;
% ploting the results
figure;
surf(x, y, z, K, "EdgeColor","none");
title(‘3D Surface Gaussian Curvature Map’);
colorbar;
disp(K);Hello,
I’m trying to calculate the curvature of each surface point from a morphology picture. However, when using surfature(), I do not get the results I want. A lot of points have a gaussian curvature of 0, which is not plausible for the example I use.
I tried a lot of different methods for calculating and ploting, but never got a good result…
I wrote the following:
% reading in picture
data = imread("Morphology.PNG");
% if not yet, convert to gray image
if size(data, 3) == 3
data = rgb2gray(data);
end
% smoothing image
data = imgaussfilt(data, 4);
% converting to double
data = double(data);
z = data;
% generating 2D arrays for X and Y with size of data-dimensions
[Rows, Cols] = size(data);
[x, y] = meshgrid(1:Cols, 1:Rows);
% calculating gaussian and normal curvature
[K, H] = surfature(x, y, data);
% display surface
figure;
surf(x, y, z, "EdgeColor","none");
title(‘Surface Morphology’);
colorbar;
% ploting the results
figure;
surf(x, y, z, K, "EdgeColor","none");
title(‘3D Surface Gaussian Curvature Map’);
colorbar;
disp(K); Hello,
I’m trying to calculate the curvature of each surface point from a morphology picture. However, when using surfature(), I do not get the results I want. A lot of points have a gaussian curvature of 0, which is not plausible for the example I use.
I tried a lot of different methods for calculating and ploting, but never got a good result…
I wrote the following:
% reading in picture
data = imread("Morphology.PNG");
% if not yet, convert to gray image
if size(data, 3) == 3
data = rgb2gray(data);
end
% smoothing image
data = imgaussfilt(data, 4);
% converting to double
data = double(data);
z = data;
% generating 2D arrays for X and Y with size of data-dimensions
[Rows, Cols] = size(data);
[x, y] = meshgrid(1:Cols, 1:Rows);
% calculating gaussian and normal curvature
[K, H] = surfature(x, y, data);
% display surface
figure;
surf(x, y, z, "EdgeColor","none");
title(‘Surface Morphology’);
colorbar;
% ploting the results
figure;
surf(x, y, z, K, "EdgeColor","none");
title(‘3D Surface Gaussian Curvature Map’);
colorbar;
disp(K); surfature, surface, curvature, image processing MATLAB Answers — New Questions