Effacer les filtres
Effacer les filtres

Converting an image using radial profile

7 vues (au cours des 30 derniers jours)
Minseo Jeong
Minseo Jeong le 21 Fév 2022
I want to obtain radial profiles of image (a) at 1 degree intervals from the center of circle. And then I want to arrange profiles by angle like image (c). The x-axis and y-axis of image (c) are angle and distance from the center of circle respectively. How should I do this?

Réponses (1)

Simon Chan
Simon Chan le 21 Fév 2022
I don't have your original image and hence just crop a region as a demo.
You may change the variables according to your requirements:
Beware theta_start < theta_end and rho_start < rho_end.
Npoint is the number of points on each profile.
clear; clc;
rawdata = imread('imageA.jpg');
[Nu,Nx,Nc] = size(rawdata);
im = imbinarize(rawdata);
s0 = regionprops(im(:,:,1),'Centroid');
theta_start = -80; % theta_start < theta_end
theta_end = 0;
theta = (theta_start:1:theta_end)*pi/180;
Nprofile = length(theta);
rho_start = 20; % rho_start < rho_end
rho_end = 100;
[x_start,y_start] = pol2cart(theta,repelem(rho_start,1,Nprofile));
xs = x_start + s0.Centroid(1);
ys = y_start + s0.Centroid(2);
[x_end,y_end] = pol2cart(theta,repelem(rho_end,1,Nprofile));
xe = x_end + s0.Centroid(1);
ye = y_end + s0.Centroid(2);
Npoint = 80; % Number of points on each profile
profile = zeros(Npoint,Nc,Nprofile);
for k = 1:Nprofile
profile(:,:,k) = improfile(rawdata,[xs(k) xe(k)],[ys(k) ye(k)],Npoint);
end
display_profile = permute(flipud(profile), [1 3 2]);
figure(1)
subplot(1,2,1)
imshow(rawdata);
hold on
title('Image with profile start and end points');
plot(xs,ys,'b.');
plot(xe,ye,'r.');
subplot(1,2,2)
imshow(display_profile);
title('Extracted profiles');

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by