Gear teeth dimension identification
29 views (last 30 days)
Show older comments
Sankaramuthu
on 3 Oct 2024
Commented: Sankaramuthu
on 29 Nov 2024 at 4:33
Hi, I am doing the project where i need to measure the Gear Teeth dimension like (Teeth width ,thickness, pitch error, PCD) acquired images from Machine vision system.I tried with Simulink script. But the results are not correct.Request you to share your views and coding on how to estimate the gear teeth dimension.
7 Comments
DGM
on 27 Nov 2024 at 9:12
For the record, I agree with @Image Analyst here. It looks like the subject is a molded plastic part with mold flash. A telecentric lens would mean that we're not trying to look diagonally through narrow sections near the edge of a translucent part. Besides being better for any quantitative analysis, it should improve subject contrast.
Accepted Answer
Jacob Mathew
on 26 Nov 2024 at 11:21
Hey Sankaramuthu,
There is an exmple on Boundary Tracing on Images which can be used to find and plot the boundary of the gear from the image. You can launch the example using the following command:
openExample('images/TraceBoundariesOfObjectsInImagesExample')
You can adjust the above to suit the gear’s image as follows:
gear = imread("gear.bmp"); % loading the image
% Binarising the image
% We first convert the 3 Dimensional RGB image into Grayscale
% We then smoothen the image using gaussian filter to get better boundary
% We then binarize the image
gear_BW = imbinarize( ...
imgaussfilt( ...
rgb2gray(gear),3 ...
));
% Remove any small pixels in the image before boundary
cleanedBinaryImage = bwareaopen(gear_BW, 100);
imshow(cleanedBinaryImage);
% Create boundary
boundaries = bwboundaries(gear_BW);
figure;
hold on;
% the first one is the outline of the image file
for i = 2:length(boundaries)
b = boundaries{i};
plot(b(:,2),b(:,1),'r')
end
hold off;
% the second one is the inner boundary of the gear
% the third one is the teethed boundary of the gear
gearBoundary = boundaries{3};
gearCentroid = mean(gearBoundary);
distances = sqrt((gearBoundary(:,2) - gearCentroid(1)).^2 + (gearBoundary(:,1) - gearCentroid(2)).^2);
plot(distances) % we can see the peaks which correspond to the teeth of the gear
% we find the minimum height to find a peak in the graph
[peaks, locs] = findpeaks(distances,'MinPeakProminence', 20);
% One peak is cut out since the graph doesn't wrap around
numTeeth = length(peaks)+1;
% average distance between teeth
averageDistance = mean(diff(locs));
fprintf('Number of teeth: %d\n', numTeeth);
fprintf('Average distance between teeth: %.2f pixels\n', averageDistance);
>>
Number of teeth: 24
Average distance between teeth: 604.41 pixels
You can extend the above code to further analyse other parameters of the gear.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!