Professional Documents
Culture Documents
Fig.5 ball
Detection
VI Image Processing
IX Equation
Image Processing Toolbox
provides a comprehensive set VII Threshold Image
of reference-standard Image thresholding is a
algorithms and workflow Using the formula:
simple, yet effective, way of
apps for image processing, partitioning an image into a
analysis, visualization, and foreground and background.
algorithm development. You Roundness =
This image analysis
can perform image technique is a type
segmentation, image of image segmentation that
enhancement, noise isolates objects by converting
reduction, geometric gray scale images into X Results
transformations, image binary images
registration, and 3D image
processing.
Image Processing Toolbox
apps let you automate
common image processing
workflows. You can
interactively segment image
data, compare image
% C=imcrop(Img,box);
binary label function
XI References %Find the centroid
%Remove components cen=Sdata(ele).Centroid
that is small and tiny ;
[1].
for i=1:total
https://www.mathwork
if(sum(sum(Label==i)) %Display the image
s.com/help/vision/grou
< 500 ) axes('Position',[0 .1 .74 .
nd-truth-labeling.html
Label(Label==i)=0; 8],'xtick',[],'ytick',[])
[2]. XII Appendix end imshow(Img);
https://www.mathwork Source Code: end hold on
s.com/products/image. Img = menu('Ball plot(cen(1,1),cen(1,2),'r
html Detection','Image') %Find the properties of x');%Mark the centroid
[3]. axes('Position',[0 .1 .74 . the image
https://www.mathwork 8],'xtick',[],'ytick',[]); Sdata = Rad=(Sdata(ele).EquivD
s.com/help/images/ima imshow(Img); regionprops(Label,'all'); iameter)/2;
ge-import-and- Rad=strcat('Radius of
export.html %Find the components the
number Ball :',num2str(Rad));
[4]. I=rgb2gray(Img); Un=unique(Label); radius=Rad;
https://angeljohnsy.blo % Converting RGB my_max=0.0;
gspot.com/2013/04/tabl Image to Area=Sdata(ele).Area;
e-tennis-ball-detection- % %Check the Roundness Area=strcat('Area of the
matlab-code.html Gray Scale Image metrics ball:',num2str(Area));
[5]. I=im2double(I); %Roundness=4*PI*Are A=Area;
https://www.mathwork % Converting Gray a/Perimeter.^2 Pmt=Sdata(ele).Perimet
s.com/products/image. scale Image for i=2:numel(Un) er;
html % to Roundness=(4*pi*Sdata Pmt=strcat('Perimeter of
Double type (Un(i)).Area)/Sdata(Un( the ball:',num2str(Pmt));
J = medfilt2(I,[3 3]); i)).Perimeter.^2; p=Pmt;
% Median Filter , my_max=max(my_max, Cen=Sdata(ele).Centroi
Roundness); d;
if(Roundness==my_max Cent=strcat('Centroid:',n
I2 = imadjust(J); ) um2str(Cen(1,1)),',',num
ele=Un(i); 2str(Cen(1,2)));
values end c=Cent;
end
title('Original Image');
choice = menu('Ball %Draw the box around
Detection','threshold') the ball
Ib = I2> 0.9627; box=Sdata(ele).Boundin
gBox;
box(1,1:2)=box(1,1:2)-
%Labelling 15;
[Label,total] = box(1,3:4)=box(1,3)+25
bwlabel(Ib,4); % ;
Indexing segments by
%Crop the image