Separation into two analysis regions via a crop circle
Show older comments
Hi everyone,
I need your advice today. I work on acquisitions in 3 dimensions of circular objects. My goal is to analyze the surface condition of these objects via mathematical parameters (Rp,Rv,Rz...).
Today, i've got a problem to analysis these acquisitions. In 3D, my camera acquires my objet but but also the table on which it's placed.If I take this plane into account, all the roughness parameter calculations are wrong !
This is why I would have to : make a circular crop of my object and I analyze via my parameters only the surface of my object. My code is following my message but I find this method approximative and it doesnt work :(.
Thanks in advance for your help.
%Inspired by @Image Analyst
close all;
clear all;
clc;
%Open image
im_in=imread("zmap_14_48_03.png");
[ymax,xmax,zmax]=size(im_in);
figure(1)
imagesc(im_in)
title('Complete image')
%%
% Circular crop
Radius = 0;
while Radius == 0
h = drawcircle('Color','r')
end
angles = linspace(0, 2*pi, 10000);
xcircle= cos(angles) * Radius + h.Center(1);
ycircle = sin(angles) * Radius + h.Center(2);
hold on;
plot(ycircle, xcircle)
% Creation of areas
area1= pi*Radius^2 + h.Center(1)+ h.Center(2) %Creation of a zone 1 composed of all point of my object
area2=im_in-area2 %Creation of a zone 2 composed of all points minus point of the objet
area2=nan;
%%
% Détermination de la ligne moyenne
Moyen1=mean(area1(:,:,:));
Moyen=mean(Moyen1);
%% Rought parameters calculs
%Rp
A=max(im_coupe(:,:,:));
A1=max(A);
Rp=A1-Moyen;
Rp1=max(Rp)
%Rv
B=min(im_coupe(:,:,:));
B1=min(B);
Rv=Moyen-B1;
Rv1=max(Rv)
%Rz
Rz=Rp1-Rv1;
%Rq
int1=0;
for yq1=1:echelley
for xq=1:echellex
int1=int1+im_coupe(:,:,:).^2;
end
end
int11=mean(int1);
Rq1=sqrt((1./(echelley*echellex*int11)));
Rq2=sum(Rq1)/(echelley*echellex);
Rq=sum(Rq2)/echellex;
%Rsk
int2=0;
for yq1=1:echelley
for xq=1:echellex
int2=int2+im_coupe(:,:,:).^3;
end
end
int22=mean(int2)
int222=mean(int22)
Rsk1=(1/Rq^3)*(1/(echelley*echellex*int222));
Rsk2=sum(Rsk1)/(echelley*echellex);
Rsk=sum(Rsk2)/echellex;
%Rku
int3=0;
for yq1=1:echelley
for xq=1:echellex
int3=int3+im_coupe(:,:,:).^4;
end
end
int33=mean(int3)
int333=mean(int33)
Rku1=(1/Rq^4)*(1/(echelley*echellex*int333));
Rku2=sum(Rku1)/(echelley*echellex);
Rku=sum(Rku2)/echellex;
Results=[Rp1;Rv1;Rz;Rq;Rsk;Rku]
Answers (0)
Categories
Find more on Image Preview and Device Configuration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!