The invention relates to the technical field of image recognition, and provides an intelligent food detection method and
system based on image recognition, and the method comprises the steps: collecting a
corn kernel image, and constructing a distance transformation diagram; all local maximum value points in the distance transformation diagram are screened out, a
centroid height threshold value and a concave point height threshold value are set,
mathematical morphology processing is carried out on the distance transformation diagram according to the
centroid height threshold value and the concave point height threshold value, and
centroid pixel points and concave points are obtained; determining adjacent centroids of the pits, and establishing a rigid mark graph according to the remaining pits and the positions of the adjacent centroids of the pits;
image segmentation is carried out according to the rigid mark graph and the distance transformation graph, a segmentation
label graph is obtained, areas corresponding to the corn kernels in the segmentation
label graph are extracted, detection of the corn kernels is completed according to contour features of the areas corresponding to the corn kernels, and the corn kernels are divided into different quality types. According to the invention, the accuracy of
corn kernel identification can be improved.