필터 지우기
필터 지우기

Count Grain Number from Input Image

조회 수: 6 (최근 30일)
Parth Desai
Parth Desai 2018년 9월 10일
답변: AMAR P 2018년 10월 10일
Hello,
How can I calculate number of grains from metal image ? Based on grain number I want to find out input image is of which metal. Should I use line and point-sampled intercept length methods for finding number of grains.

답변 (1개)

AMAR P
AMAR P 2018년 10월 10일
hi I hope you have worked out the problem. Here is my take on a problem. Might help others in coming years.
% file:
% Author: AMAR P.
% Version: V1
clc
clearvars;
close all;
MainImg = imread('Temp.bmp');
% Convert to GrayScale Image [To perform histeq]
GrayImg = rgb2gray(MainImg);
% Intensity transformation
GrayImg = histeq(GrayImg);
% Convert to Binary Image
BinImg = im2bw(GrayImg);
%Get Resion props
GrainProps = regionprops('table', BinImg,'Centroid');
% Get No of Grains in the image
NoOfGrains = numel(GrainProps);
%Read All Centers into Array
GrainCenters = GrainProps.Centroid;
% Mark Grains at Center.
figure(1);
imshow(BinImg);
hold on;
text(GrainCenters(:,1), GrainCenters(:,2),'*','Color','r');
hold off
fprintf('\nNo. Of Grains found in the Image = %d\n', NoOfGrains);
_ No. Of Grains found in the Image = 610_

카테고리

Help CenterFile Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기

제품


릴리스

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by