You are on page 1of 14

1) Image processing Program of Gauge

%To determine the Gauge

>> %Image Acquisition
>> figure,imshow(I1)

>> %Cropping the image
>> I2=imcrop(I1, [230 160 320 250]);
>> figure, imshow(I2)

>> %Convert into grayscale image
>> I3=rgb2gray(I2);
>> figure,imshow(I3)

>> % To show gray histogram
>> figure,imhist(I3)

>> %Convert into binary image
>> I4=im2bw(I3,73/255);
>> figure,imshow(I4)

>> %To compliment the image
>> I5=imcomplement(I4);
>>figure,imshow(I5),title('Compliment
image');

>> %To fill the hole
>> I6=imfill(I5,'holes');
>> figure,imshow(I6)

>> %To fill the hole
>> I7=bwareaopen(I6,4000);
>> figure,imshow(I7)

>> %Measure the diameter
>> I8=regionprops(I7,'basic');
>> A=[I8.Area];
>> D= sqrt(4*A/pi);

Area =4319
Diameter = 74.1561

2) Image processing Program of Gauge on block
>> %To determine the gauge on block
>> %Image Acquisition

>> %Cropping the image
>> I2=imcrop(I1, [210 180 320 250]);
>> figure, imshow(I2)

>> %Convert into grayscale image
>> I3=rgb2gray(I2);
>> figure,imshow(I3)

>> % To show gray histogram
>> figure,imhist(I3)

>> %Convert into binary image
>> I4=im2bw(I3,80/255);
>> figure,imshow(I4)

>> %To compliment the image
>> I5=imcomplement(I4);
>>figure,imshow(I5)

>> %To fill the hole
>> I6=imfill(I5,'holes');
>> figure,imshow(I6)

>> %To filter the unwanted area
>> I7=bwareaopen(I6,4000);
>> figure,imshow(I7)

>> %Measure the diameter
>> I8=regionprops(I7,'basic');
>> A=[I8.Area];
>> D= sqrt(4*A/pi);

Area =4319
Diameter = 74.1561

3) Image processing Program of 5 cents

>> %To determine the diameter
of 5 cents
>> %Image Acquisition
>> figure,imshow(I1)

>> %Cropping the image
>> I2=imcrop(I1, [180 160 320
250]);
>> figure, imshow(I2)

>> %Convert into grayscale
image
>> I3=rgb2gray(I2);
>> figure,imshow(I3)

>> % To show gray histogram
>> figure,imhist(I3)

>> %Convert into binary image
>> I4=im2bw(I3,73/255);
>> figure,imshow(I4)

>> %find the unwanted noise
I5=imfill(I4,'holes');
>> figure,imshow(I5)

>> %To remove unwanted noise
from image 4
>> I6=I5-I4;
>> figure,imshow(I6)

>> %MOrphological process
>> I7=bwareaopen(I6,100);
>> figure,imshow(I7)

>> %Measure the diameter
>> I8=regionprops(I7,'basic');
>> A=[I8.Area];
>> Dia = sqrt(4*A/pi);

Area = 12171
Diameter = 124.4853

4) Image processing Program of 10 cents
>> %To determine the diameter
of 10 cents
>> %Image Acquisition
>> figure,imshow(I1)

>> %Cropping the image
>> I2=imcrop(I1, [210 100 300
250]);
>> figure, imshow(I2)

>> %Convert into grayscale
image
>> I3=rgb2gray(I2);
>> figure,imshow(I3)

>> % To show gray histogram
>> figure,imhist(I3)

>> %Convert into binary image
>> I4=im2bw(I3,88/255);
>> figure,imshow(I4)

>>%To compliment the image
>> I5=imcomplement(I4);
>> figure,imshow(I5)

>> %To fill the hole
>> I6=imfill(I5,'holes');
>> figure,imshow(I6)

>> %To remove unwanted area
>> I7=bwareaopen(I6,100);
>> figure,imshow(I7

>> %Measure the diameter
>> I8=regionprops(I7,'basic');
>> A=[I8.Area];
>> Dia = sqrt(4*A/pi);

Area = 14391
Diameter = 135.3632

5) Image processing Program of 20 cents
>> %To determine the diameter of 5
cents
>> %Image Acquisition
>> figure,imshow(I1)

>> %Cropping the image
>> I2=imcrop(I1, [150 100 300
250]);
>> figure, imshow(I2)

>> %Convert into grayscale image
>> I3=rgb2gray(I2);
>> figure,imshow(I3)

>> % To show gray histogram
>> figure,imhist(I3)

>> %Convert into binary image
>> I4=im2bw(I3,77/255);
>> figure,imshow(I4)

>> %To compliment the image
>>I5=imcomplement(I4);
>>figure,imshow(I5);

>> %To fill the hole
>> I6=imfill(I5,'holes');
>> figure,imshow(I6)

>> %To remove unwanted area
>> I7=bwareaopen(I6,10000);
>> figure,imshow(I7)

>> %Measure the diameter
>> I8=regionprops(I8,'basic');
>> A=[I8.Area];
>> Dia = sqrt(4*A/pi);

Area = 22394
Diameter = 168.8577

4) Image processing Program of 50 cents
>> %To determine the
diameter of 50 cents
>> %Image Acquisition
>> figure,imshow(I1)

>> %Cropping the image
>> I2=imcrop(I1, [150 70
300 250]);
>> figure, imshow(I2)

>> %Convert into grayscale
image
>> I3=rgb2gray(I2);
>> figure,imshow(I3)

>> % To show gray histogram
>> figure,imhist(I3)

>> %Convert into binary
image
>> I4=im2bw(I3,83/255);
>> figure,imshow(I4)

>> %To compliment the image
>> I5=imcomplement(I4);
>> figure,imshow(I5)

>> %To fill the hole
>> I6=imfill(I5,'holes');
>> figure,imshow(I6)

>> %To remove the unwanted
area
>> I7=bwareaopen(I6,10000);
>> figure,imshow(I7)

>> %Measure the diameter
>> I8=regionprops(I7,'basic');
>> A=[I8.Area];
Area = 30023
Diameter = 195.5159
>> Dia = sqrt(4*A/pi);