A method, system, electronic device, and storage medium for detecting the morphology of rice seeds
By preprocessing and feature extraction of rice seed particle images and classification with neural network models, the problem of low accuracy and automation of existing rice seed detection methods is solved, and rapid and accurate detection of yellow rice rate, impurity rate, and broken rice rate in rice seeds is achieved.
Patent Information
- Application Number
- CN202211051277.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-31
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2042-08-31
AI Technical Summary
The existing rice seed detection methods are greatly affected by human subjective factors and environmental interference, with poor accuracy and reproducibility, and low degree of automation, making it difficult to meet the quality needs of high-quality rice seeds.
The image pre-processing algorithm is used to filter and enhance the image of rice seed particle images, and then use the image feature extraction algorithm to obtain the information characteristics of rice seeds. Finally, a neural network model is used to classify different types of rice seeds to achieve rapid detection of yellow rice rate, impurity rate, and broken rice rate.
Accurate detection of the yellow rice rate, impurity rate, and broken rice rate in rice seeds is achieved, which improves the accuracy and automation of the detection and reduces human subjective interference.
Smart Images

Figure CN115409987B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of rice seed detection, and particularly to a method, a system, an electronic device and a storage medium for detecting the morphology of rice seed particles. Background Art
[0002] The selection of rice seeds is one of the key links in the precise production of rice. It is a very simple truth that good seeds produce good rice and good rice produces good rice. Good high-quality rice seeds have strong vitality, high germination rate and strong growth potential, and are the first link in building a high-quality rice product industrial chain. From seed soaking, through seedling raising, transplanting, field management until harvesting, the quality of rice seeds has a great relationship with the yield of rice.
[0003] Seed vigor is the sum of all characteristics that determine the activity and performance level of seeds during germination and emergence, and is one of the main indicators reflecting seed quality. Seed vigor is the key to ensuring the success of food production. High-vigor seeds show obvious advantages such as high germination rate, strong plants, strong stress resistance and high yield under field conditions. Low-vigor seeds often have low germination rate and weak growth potential, resulting in reduced yield. The deterioration of seeds will lead to a decline in quality factors such as seed vigor and field establishment ability, thus causing huge economic losses. Similarly, the purity, that is, the impurity content, among the same batch of seeds is also an important factor affecting precise sowing. The presence of impurities will lead to the sparsity of rice seedlings after sowing and also cause a reduction in rice yield. Based on this, it is necessary to detect the quality of rice seeds when selecting rice seeds before sowing. In terms of specific detection targets, the plumpness, yellow rice grains, impurities, moisture content, mildew, protein, fat, aflatoxin, etc. of rice all determine the quality of rice seeds.
[0004] High-vigor rice seeds have advantages such as high germination rate, strong plants, strong stress resistance and high yield. Low-vigor rice seeds often have low germination rate, weak growth potential and low yield. When evaluating the quality of rice seeds, manual visual comparison and identification or simple instrument measurement are often used, and most still stay in the stage of completely manual detection. This method is greatly affected by human subjective factors and environmental interference factors, with poor accuracy and reproducibility, and has the disadvantages of subjectivity, time-consuming and low automation, far from meeting the quality requirements of high-quality rice seeds.
[0005] With the rapid development of information technology, the use of visual measurement and artificial intelligence can solve the problems of backward methods and means for detecting the quality of agricultural products, mainly involving the determination of the broken rice rate, impurity rate, and yellow rice rate of rice, etc., which is an effective solution. There is a phenomenon of grain adhesion in the rice grain images collected by the visual system. For the detection of rice seed purity, the problem of target adhesion needs to be solved first. The segmentation of adhered targets has always been a research difficulty in the field of image processing. For the problem of target adhesion in rice seed images, there are currently two main solutions: one is to avoid adhesion between rice grains by designing special devices; the other is to effectively segment the adhered images by using relevant image segmentation algorithms. In terms of the moisture content, mildew, protein, fat, aflatoxin, etc. in rice seeds, currently, an electronic nose is generally used to detect the mildew situation of rice seeds, and electrical characteristics are used to detect the moisture content; foreign countries have carried out research on instruments for detecting the appearance quality of rice earlier. The product technology level of Japan is at the forefront of the world, and relevant products have been launched. Such as the particle evaluation instrument produced by Satake Corporation in Japan and the rice quality determination instrument produced by Kett Corporation, but the prices of these products are relatively high in China. Domestically, some research units have also carried out the research and development of relevant products. Beijing Dongfu Jiuheng Instrument Technology Co., Ltd. has studied the appearance quality detector for rice seeds, but its adaptability is weak and the recognition accuracy is relatively low. Summary of the Invention
[0006] The present disclosure provides a method, system, electronic device, and storage medium for detecting the morphology of rice seed particles. Based on the acquired image data of rice seed particles, the target rice image is processed by image preprocessing algorithms such as noise filtering and image enhancement, and then the information features of different types of rice seeds are further obtained through image feature extraction algorithms. Finally, different types of rice seeds are classified according to the image features to achieve the rapid detection of the yellow rice rate, impurity rate, broken rice rate, etc. in rice seeds. The present disclosure provides the following technical solutions to solve the above technical problems:
[0007] As an aspect of an embodiment of the present disclosure, a method for detecting the morphology of rice seed particles is provided, including the following steps:
[0008] Obtain an image of rice seed particles;
[0009] Crop the rice seed particle image to obtain a region of interest, and perform gray-scale processing on the region of interest after filtering and enhancement.
[0010] Perform image binarization on the gray-scale processed image to obtain a binary image.
[0011] Segment the adhesion region of the binary image to obtain separate rice seed particle regions, and then mark each rice seed in the rice seed particle image according to the position of the rice seed particle region.
[0012] The color features of each obtained rice seed are acquired, and the color features and the rice seed particle region information are used for recognition by the established neural network model to obtain rice seed detection parameters;
[0013] Among them, the rice seed detection parameters include at least one of the broken rice rate, the yellow rice rate, and the impurity rate.
[0014] Optionally, the specific implementation of segmenting the binary image to obtain separate rice seed particle regions further includes the following steps:
[0015] The pulse-coupled neural network image segmentation method is used to implement the segmentation of the adhesion regions of the binary image.
[0016] Optionally, the pulse-coupled neural network image segmentation method specifically includes the following steps:
[0017] Calculate the region contrast according to the gray value distribution of the defined region in the binary image;
[0018] Use the region contrast as the connection coefficient to configure the pulse-coupled neural network image segmentation method;
[0019] Segment the image according to the configured pulse-coupled neural network image segmentation method within the defined region;
[0020] Change the defined region and loop to execute the above steps until all the adhesion regions in the binary image are segmented into separate rice seed particle regions.
[0021] Optionally, the formula for calculating the region contrast dev(x, y) is as follows:
[0022]
[0023] Among them, maxf ω (x, y) represents the maximum value of the pixel gray values within the ω defined region centered on the pixel P(x, y), and avgf ω (x, y) represents the average value of the pixel gray values within the ω defined region centered on the pixel P(x, y), and minf ω (x, y) represents the minimum value of the pixel gray values within the ω defined region centered on the pixel P(x, y).
[0024] Optionally, the method further includes the following steps:
[0025] Before segmenting the binary image to obtain separate rice seed particle regions, perform morphological filtering or median filtering on the binary image obtained by the image binarization process;
[0026] And / or,
[0027] Filtering and enhancing the region of interest includes the following steps: performing noise reduction filtering on the region of interest image using the bilateral filtering method; performing enhancement on the region of interest image after noise reduction filtering using the histogram method;
[0028] and / or,
[0029] After marking each rice seed, obtain the shape and size of each rice seed.
[0030] Optionally, the established neural network model is a trained pulse coupled neural network model. The pulse coupled neural network model includes a region that can be used to segment the adhesion region of the binary image, and also includes identifying at least one of the broken rice characteristics, yellow rice grain characteristics, and impurity rate according to the shape, size, and color of the rice seed particles.
[0031] Optionally, the obtaining of the impurity rate includes the following steps:
[0032] Obtain the shape, size, and color characteristics of intact rice seeds and the identified rice seed particles;
[0033] Calculate the Mahalanobis distance between the shape, size, and color characteristics of the above two, and then determine the similarity between the two to calculate the impurity rate.
[0034] As another aspect of the embodiments of the present disclosure, a rice seed particle morphology detection system is provided, including:
[0035] An image acquisition module for acquiring rice seed particle images;
[0036] An ROI grayscale module for cropping the rice seed particle image to obtain the region of interest, and performing image grayscale processing after filtering and enhancing the region of interest;
[0037] A binarization module for performing image binarization on the grayscale processed image to obtain a binary image;
[0038] A segmentation and marking module for segmenting the adhesion region of the binary image to obtain separate rice seed particle regions, and then marking each rice seed in the rice seed particle image according to the position of the rice seed particle region;
[0039] A parameter acquisition module for acquiring the color characteristics of each rice seed, and using the established neural network model to identify the color characteristics and rice seed particle region information to obtain rice seed detection parameters;
[0040] Wherein, the rice seed detection parameters include at least one of the broken rice rate, yellow rice rate, and impurity rate.
[0041] As another aspect of the embodiments of the present disclosure, there is provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the above-mentioned rice seed particle morphology detection method is implemented.
[0042] As another aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium, on which a computer program is stored, wherein when the program is executed by a processor, the steps of the above-mentioned rice seed particle morphology detection method are implemented.
[0043] The present disclosure can obtain accurate rice seed detection parameters, that is, at least one of the broken rice rate, yellow rice rate, and impurity rate, by segmenting the binary image to obtain separate rice seed particle regions and then marking each rice seed, and then obtaining the shape and size according to the color characteristics of each rice seed and the marked position information. In addition, the present disclosure uses the region contrast as the connection coefficient to configure the pulse-coupled neural network image segmentation method, which can make the segmentation of the rice seed adhesion region more natural and reduce the loss of the size information of the rice seed particles. Furthermore, introducing color features can simultaneously identify the yellow rice rate and the impurity rate, and can also comprehensively improve the recognition accuracy of the impurity rate in terms of the shape and size and color characteristics of the rice seed particles. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a flowchart of the rice seed particle morphology detection method in Embodiment 1 of the present disclosure;
[0045] Figure 2 It is a flowchart of the pulse-coupled neural network image segmentation method;
[0046] Figure 3 It is a block diagram of the rice seed particle morphology detection system. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0047] Next, the technical solutions in the embodiments of the present disclosure will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.
[0048] Hereinafter, various exemplary embodiments, features, and aspects of the present disclosure will be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements having the same or similar functions. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0049] As used herein, the term "exemplary" means "serving as an example, embodiment, or illustration". Any embodiment described as "exemplary" herein need not be construed as superior or better than other embodiments.
[0050] As used herein, the term "and / or" is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" as used herein means any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set composed of A, B, and C.
[0051] In addition, to better illustrate the present disclosure, numerous specific details are given in the following detailed implementation manners. Those skilled in the art should understand that the present disclosure can be implemented without certain specific details. In some instances, methods, means, elements, and circuits well-known to those skilled in the art are not described in detail in order to highlight the gist of the present disclosure.
[0052] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form combined embodiments without violating the principle logic. Due to space limitations, the present disclosure will not elaborate further.
[0053] In addition, the present disclosure also provides a rice seed grain morphology detection system 100, an electronic device, a computer-readable storage medium, and a program, all of which can be used to implement any one of the rice seed grain morphology detection methods provided by the present disclosure. The corresponding technical solutions and descriptions are referred to the corresponding records in the method part and will not be elaborated further.
[0054] The execution subject of the rice seed grain morphology detection method can be a computer or other devices capable of implementing the rice seed grain morphology detection. For example, the method can be executed by a terminal device, a server, or other processing devices. Among them, the terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementation manners, the rice seed grain morphology detection method can be implemented by a processor calling computer-readable instructions stored in a memory.
[0055] Embodiment 1
[0056] As one aspect of the embodiments of the present disclosure, as Figure 1 shown, a rice seed grain morphology detection method is provided, including the following steps:
[0057] S10. Obtain the rice seed particle image;
[0058] S20. Crop the rice seed particle image to obtain the region of interest, and perform image graying processing after filtering and enhancing the region of interest;
[0059] S30. Perform image binarization processing on the grayed image to obtain a binary image;
[0060] S40. Segment the connected regions of the binary image to obtain separate rice seed particle regions, and then mark each rice seed in the rice seed particle image according to the positions of the rice seed particle regions;
[0061] S50. Obtain the color features of each rice seed, and use the built neural network model to identify the color features and the rice seed particle region information to obtain rice seed detection parameters;
[0062] Among them, the rice seed detection parameters include at least one of the broken rice rate, yellow rice rate, and impurity rate.
[0063] Based on the above configuration, the embodiments of the present disclosure can segment the connected regions of the binary image to obtain separate rice seed particle regions, and then mark each rice seed. Furthermore, accurate rice seed detection parameters, that is, at least one of the broken rice rate, yellow rice rate, and impurity rate, can be obtained according to the color features of each rice seed and the marked position information.
[0064] The following will separately elaborate on each step of the embodiments of the present disclosure in detail.
[0065] S10. Obtain the rice seed particle image;
[0066] Among them, the rice seed particle image can be obtained by an image acquisition device. The image acquisition device includes but is not limited to industrial cameras, ordinary cameras with unoptimized high resolution, etc. Moreover, during the acquisition process, the light source is preferably natural light or a "shadowless light source" with light sources in at least multiple directions. After obtaining the rice seed particle image, it is transmitted to a processing device such as a computer, industrial control computer, server, etc., which has computing functions;
[0067] S20. Crop the rice seed particle image to obtain the region of interest, and perform image graying processing after filtering and enhancing the region of interest;
[0068] Among them, the region of interest (ROI) is to select an image area from the image, and this area is the focus of image analysis. In the embodiments of the present disclosure, the image area of interest is the area with rice seed grains. Preferably, the rice seed grains are placed in a black or gray diffuse reflection background to obtain the image. In this way, the acquisition of the region of interest can be achieved by gray-scale recognition. The ROI_AddImage() function can be used to obtain the image first, and then the ROI area can be defined according to the gray scale, and the mask replication method can be used to copy it to the ROI area.
[0069] S30. Perform image binarization on the grayscale-processed image to obtain a binary image;
[0070] Among them, algorithms such as the Ostu method, the average gray-scale method, or the differential histogram method can be used to implement image binarization, or it can be implemented according to the optimal method among the above methods. Those skilled in the art can also compare the binarization results of different images among the above methods, and then select a suitable binarization algorithm, and it is not necessary to be limited to one or more of them.
[0071] S40. Perform adhesion region segmentation on the binary image to obtain separate rice seed grain regions, and then mark each rice seed in the rice seed grain image according to the position where the rice seed grain region is located;
[0072] Among them, the specific implementation of performing adhesion region segmentation on the binary image to obtain separate rice seed grain regions further includes the following steps:
[0073] The pulse-coupled neural network image segmentation method is used to implement the adhesion region segmentation of the binary image. Among them, the pulse-coupled neural network image segmentation method (PCNN) can be connected to create a highly flexible physiological filter, which models the pulse height, duration, repetition frequency, and inter-neural connections observed in the primate visual cortex. This model can not only meet the filtering requirements of our visual model, but also generate the required connections and pulses to simulate state-dependent modulation and temporal synchronization; the feature extraction and object segmentation characteristics of PCNN come from the pulse frequency of neurons. Neurons with relevant feeding input features (color, intensity, etc.) have similar pulse rates. Connections cause neurons to be closely close, and relevant features have consistent pulses. The connection pattern, weight, and connection coefficient determine the proximity and degree to which the connection input affects the neuron output.
[0074] In a preferred embodiment, as Figure 2 shown, the pulse-coupled neural network image segmentation method specifically includes the following steps:
[0075] S401. Calculate the region contrast according to the gray-scale value distribution of the defined region in the binary image;
[0076] S402. Configure the pulse-coupled neural network image segmentation method with the regional contrast as the connection coefficient;
[0077] S403. Segment the image within the delimited area according to the configured pulse-coupled neural network image segmentation method;
[0078] S404. Change the delimited area and loop to execute steps S401 - S403 until all the adhered areas in the binary image are segmented into separate rice seed particle areas.
[0079] Among them, the formula for calculating the regional contrast dev(x, y) is as follows:
[0080]
[0081] In the above formula, maxf ω (x, y) represents the maximum value of the pixel gray values within the ω delimited area centered on the pixel P(x, y), avgf ω (x, y) represents the average value of the pixel gray values within the ω delimited area centered on the pixel P(x, y), minf ω (x, y) represents the minimum value of the pixel gray values within the ω delimited area centered on the pixel P(x, y). The regional contrast implemented by the above formula can suit the progressive gray characteristics of rice seeds, calculate with the average gray value as the standard, and take into account the gray value difference between the high-light area and the edge area in the middle of the rice seed particles, that is, the maximum gray value and the minimum gray value. Furthermore, configuring the pulse-coupled neural network image segmentation method with it as the connection coefficient can make the segmentation of the adhered areas of rice seeds more natural and reduce the loss of the size information of rice seed particles.
[0082] In some embodiments, the method further includes the following steps:
[0083] Before segmenting the adhered areas of the binary image to obtain separate rice seed particle areas, perform morphological filtering or median filtering on the binary image obtained by binary image processing of the image;
[0084] In some embodiments, filtering and enhancing the region of interest includes the following steps: Denoise and filter the region of interest image using the bilateral filtering method; Enhance the denoised and filtered region of interest image using the histogram method;
[0085] In some embodiments, after marking each rice seed, the shape and size of each rice seed are obtained. Among them, after marking each rice seed, the shape of each rice seed can be calculated by calculating the side length, area, longest distance (i.e., the length of the rice seed, used to determine whether the marking is incorrect or other types of particles that are not rice seeds or there are problems with the rice seeds themselves), and the shortest distance (i.e., the narrowest part at approximately the middle position of the rice seed, mainly used to determine whether it is broken rice).
[0086] S50. Obtain the color characteristics of each rice seed, and use the established neural network model to identify the color characteristics and rice seed particle region information to obtain rice seed detection parameters; wherein, the rice seed detection parameters include at least one of the broken rice rate, yellow rice rate, and impurity rate.
[0087] In some embodiments, the established neural network model is a trained pulse-coupled neural network model. The pulse-coupled neural network model includes an adhesion region that can be used to segment a binary image, and also includes identifying at least one of the broken rice characteristics, yellow rice grain characteristics, and impurity rate according to the shape, size, and color of the rice seed particles.
[0088] In some embodiments, the obtaining of the impurity rate includes the following steps:
[0089] Obtain the shape, size, and color characteristics of intact rice seeds and the identified rice seed particles;
[0090] Calculate the Mahalanobis distance between the shape, size, and color characteristics of the above two, and then determine the similarity between the two to calculate the impurity rate.
[0091] Embodiment 2
[0092] As another aspect of the embodiments of the present disclosure, as Figure 3 shown, a rice seed particle morphology detection system 100 is provided, including:
[0093] An image acquisition module 1 for acquiring a rice seed particle image;
[0094] An ROI grayscale module 2 for cropping the rice seed particle image to obtain a region of interest, and performing image grayscale processing after filtering and enhancing the region of interest;
[0095] A binarization module 3 for performing image binarization processing on the grayscale processed image to obtain a binary image;
[0096] A segmentation and marking module 4 for segmenting the adhesion region of the binary image to obtain separate rice seed particle regions, and then marking each rice seed in the rice seed particle image according to the position of the rice seed particle region;
[0097] The parameter acquisition module 5 acquires the color features of each rice seed, and uses the established neural network model to identify the color features and the rice seed particle region information to obtain rice seed detection parameters;
[0098] Among them, the rice seed detection parameters include at least one of the broken rice rate, the yellow rice rate, and the impurity rate.
[0099] Based on the above configuration, the embodiments of the present disclosure can segment the adhesion regions of the binary image to obtain individual rice seed particle regions, and then mark each rice seed. Furthermore, accurate rice seed detection parameters, that is, at least one of the broken rice rate, the yellow rice rate, and the impurity rate, can be obtained according to the color features of each rice seed and the marked position information.
[0100] Next, each module of the embodiments of the present disclosure will be described in detail.
[0101] The image acquisition module 1 is used to acquire a rice seed particle image;
[0102] Among them, the image acquisition module 1 can adopt an image acquisition device. The image acquisition device includes, but is not limited to, an industrial camera, an unoptimized ordinary camera with high resolution, etc. Moreover, during the acquisition process, the light source is preferably natural light or a "shadowless light source" with light sources in at least multiple directions. After the rice seed particle image is captured, it is transmitted to a processing device such as a computer, an industrial control computer, a server, etc., which has computing functions;
[0103] The ROI grayscale module 2 crops the rice seed particle image to obtain a region of interest, and performs image grayscale processing after filtering and enhancing the region of interest;
[0104] Among them, the ROI grayscale module 2 is used to implement the cropping and grayscale processing of the region of interest (ROI). The region of interest (ROI) is also an image area selected from the image, and this area is the focus of image analysis. In the embodiments of the present disclosure, the image area of interest is the area with rice seeds. Preferably, the rice seeds are placed on a black or gray diffuse background to obtain the image. In this way, the acquisition of the region of interest can be achieved by grayscale recognition. The ROI_AddImage() function can be used to obtain the image first, and then the ROI region can be defined according to the grayscale, and the ROI region can be copied using the mask replication method.
[0105] The binarization module 3 performs image binarization processing on the grayscale processed image to obtain a binary image;
[0106] Among them, the binarization module 3 can implement image binarization processing using algorithms such as the Ostu method, the average gray level method, or the differential histogram method, or implement it according to the optimal method among the above methods. Those skilled in the art can also compare the binarization processing results of different images according to the above methods, and then select a suitable binarization processing algorithm, without being limited to one or more of them.
[0107] The segmentation and marking module 4 divides the binarized image into separate rice seed grain regions by segmenting the adhesion regions, and then marks each rice seed in the rice seed grain image according to the position where the rice seed grain region is located;
[0108] Among them, the specific implementation of the segmentation and marking module 4 dividing the binarized image into separate rice seed grain regions by segmenting the adhesion regions further includes:
[0109] The pulse-coupled neural network image segmentation method is used to implement the segmentation of the adhesion regions of the binarized image. Among them, the pulse-coupled neural network image segmentation method (PCNN) can be connected to create a highly flexible physiological filter, which models the pulse height, duration, repetition frequency, and inter-neural connections observed in the primate visual cortex. This model can not only meet the filtering requirements of our visual model, but also generate the required connections and pulses to simulate state-dependent modulation and temporal synchronization; the feature extraction and object segmentation characteristics of PCNN come from the pulse frequency of neurons, and neurons with related feeding input features (such as color, intensity, etc.) have similar pulse rates. Connections cause neurons to be closely close, and related features have consistent pulses. The connection pattern, weight, and connection coefficient determine the proximity and degree to which the connected input affects the neuron output.
[0110] In a preferred embodiment, as Figure 2 shown, the pulse-coupled neural network image segmentation method in the segmentation and marking module 4 specifically includes: calculating the regional contrast according to the gray value distribution of the defined region in the binarized image; configuring the pulse-coupled neural network image segmentation method with the regional contrast as the connection coefficient; segmenting the image according to the configured pulse-coupled neural network image segmentation method within the defined region; changing the defined region and looping until all the adhesion regions in the binarized image are segmented into separate rice seed grain regions.
[0111] Among them, the formula for calculating the regional contrast dev(x, y) is as follows:
[0112]
[0113] In the above formula, maxf ω (x, y) represents the maximum value of the pixel gray values within the ω defined region centered on the pixel P(x, y), avgfω (x, y) represents the average gray value of the pixels within the ω-defined area centered on the pixel P(x, y), minf ω (x, y) represents the minimum gray value of the pixels within the ω-defined area centered on the pixel P(x, y). The regional contrast implemented by the above formula can suit the progressive gray characteristics of rice seeds. The average gray value is used as the standard for calculation, and considering the gray value difference between the high-light area in the middle and the edge area of the rice seed particles, that is, the difference between the maximum gray value and the minimum gray value, and then using it as a connection coefficient to configure the pulse-coupled neural network image segmentation method can make the segmentation of the rice seed adhesion area more natural and reduce the loss of the size information of the rice seed particles.
[0114] In some embodiments, the binarization module 3 further includes: performing morphological filtering or median filtering on the binarized image obtained by binarizing the image;
[0115] In some embodiments, filtering and enhancing the region of interest includes: performing noise reduction filtering on the region of interest image by using the bilateral filtering method; enhancing the region of interest image after noise reduction filtering by using the histogram method;
[0116] The parameter acquisition module 5 acquires the color characteristics of each rice seed, and uses the built neural network model to identify the color characteristics and the rice seed particle region information to obtain rice seed detection parameters; wherein, the rice seed detection parameters include at least one of the broken rice rate, yellow rice rate, and impurity rate. In this embodiment, it is preferably to include the detection of the broken rice rate, yellow rice rate, and impurity rate at the same time.
[0117] In some embodiments, the shape and size of each rice seed are obtained after marking each rice seed. Among them, after marking each rice seed, the shape of each rice seed can be calculated by calculating the side length, area, the longest distance (that is, the length of the rice seed, used to judge whether the marking is wrong or other types of particles that are not rice seeds or there are problems with the rice seeds themselves) and the shortest distance (that is, the narrowest part at the approximate middle position of the rice seed, mainly used to judge whether it is broken rice).
[0118] In some embodiments, the built neural network model is a trained pulse-coupled neural network model. The pulse-coupled neural network model includes being able to implement the segmentation of the adhesion area of the binarized image, and also includes implementing the recognition of at least one of the broken rice characteristics, yellow rice grain characteristics, and impurity rate according to the shape, size, and color of the rice seed particles.
[0119] In some embodiments, the acquisition of the impurity rate includes: acquiring the shape, size, and color characteristics of the intact rice seeds and the recognized rice seed particles; calculating the Mahalanobis distance between the shape, size, and color characteristics of the above two, and then determining the similarity between the two to calculate the impurity rate.
[0120] Example 3
[0121] As another aspect of the embodiments of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the rice seed granule morphology detection method in Embodiment 1 is implemented.
[0122] Example 4
[0123] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the rice seed granule morphology detection method in Embodiment 1 are implemented.
[0124] Among them, more specifically, the readable storage medium may include, but is not limited to: portable disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories, optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0125] In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps in the rice seed granule morphology detection method in the embodiments.
[0126] Among them, the program code for executing the present invention can be written in any combination of one or more programming languages. The program code can be completely executed on the user device, partially executed on the user device, executed as an independent software package, partially executed on the user device and partially executed on a remote device, or completely executed on a remote device.
[0127] Although the specific implementation manners of the present invention have been described above, those skilled in the art should understand that this is only an example. The protection scope of the present invention is defined by the appended claims. Without departing from the principles and essence of the present invention, those skilled in the art can make various changes or modifications to these implementation manners, but these changes and modifications all fall within the protection scope of the present invention.
Claims
1. A method for detecting the morphology of rice seed grains, characterized in that, it includes the following steps: Obtain an image of rice seed grains; Crop the rice seed grain image to obtain the region of interest, and perform image grayscale processing on the filtered and enhanced region of interest; Perform image binarization processing on the grayscale processed image to obtain a binary image; Segment the adhesion regions of the binary image to obtain separate rice seed grain regions, and then mark each rice seed in the rice seed grain image according to the position where the rice seed grain region is located; wherein, segmenting the adhesion regions of the binary image to obtain separate rice seed grain regions includes: calculating the region contrast according to the gray value distribution of the defined region in the binary image; configuring the pulse coupled neural network image segmentation method with the region contrast as the connection coefficient; segmenting the image according to the configured pulse coupled neural network image segmentation method within the defined region; changing the defined region and looping through the above steps until the adhesion regions in the binary image are segmented into separate rice seed grain regions; Calculate the regional contrast d ev (x,y) is configured with the formula: Among them, max f ω (x, y) represents the maximum value of the pixel gray values within the ω-defined area centered on the pixel P( x, y ) and is the maximum value of the pixel gray values within the ω-defined area centered on the pixel avg f ω (x, y) represents the average value of the pixel gray values within the ω-defined area centered on the pixel P ( x, y ) and minf ω (x, y) represents the minimum value of the pixel gray values within the ω-defined area centered on the pixel P( x, y ) and is the minimum value of the pixel gray values within the ω-defined area centered on the pixel; Obtain the color characteristics of each rice seed, and use the built neural network model to identify the rice seed detection parameters with the color characteristics and the rice seed grain region information; Wherein, the rice seed detection parameters include at least one of the broken rice rate, yellow rice rate, and impurity rate.
2. The method for detecting the morphology of rice seed grains according to claim 1, characterized in that, it further includes the following steps: Before segmenting the adhesion regions of the binary image to obtain separate rice seed grain regions, perform morphological filtering or median filtering on the binary image obtained by image binarization processing.
3. The method for detecting the morphology of rice seed grains according to any one of claims 1 or 2, characterized in that, it further includes the following steps: Filtering and enhancing the region of interest includes the following steps: using the bilateral filtering method to perform noise reduction filtering on the region of interest image; using the histogram method to enhance the region of interest image after noise reduction filtering.
4. The method for detecting the morphology of rice seed grains according to any one of claims 1 or 2, characterized in that, it further includes the following steps: Obtain the shape and size of each rice seed after marking each rice seed.
5. The method for detecting the morphology of rice seed grains according to claim 3, characterized in that, it further includes the following steps: Obtain the shape and size of each rice seed after marking each rice seed.
6. The method for detecting the morphology of rice seed grains according to any one of claims 1 or 2 or 5, characterized in that, The built neural network model is configured as a trained pulse coupled neural network model; the pulse coupled neural network model is used to segment the adhesion regions of the binary image and to identify at least one of the broken rice characteristics, yellow rice grain characteristics, and impurity rate according to the shape, size, and color of the rice seed grains.
7. The method for detecting the morphology of rice seed grains according to claim 3, characterized in that, The established neural network model is configured as a trained pulse-coupled neural network model; the pulse-coupled neural network model is used to segment the adhesion area of the binary image and to identify at least one of the broken rice characteristics, yellow rice grain characteristics, and impurity rate according to the shape, size, and color of the rice seed grains.
8. The method for detecting the morphology of rice seed grains according to claim 4, wherein, The established neural network model is configured as a trained pulse-coupled neural network model; the pulse-coupled neural network model is used to segment the adhesion area of the binary image and to identify at least one of the broken rice characteristics, yellow rice grain characteristics, and impurity rate according to the shape, size, and color of the rice seed grains.
9. The method for detecting the morphology of rice seed grains according to claim 6, wherein, The obtaining of the impurity rate includes the following steps: Obtain the shape, size, and color characteristics of intact rice seeds and the identified rice seed grains; Calculate the Mahalanobis distance between the shape and size and the Mahalanobis distance between the color characteristics, and then determine the similarity between the two to calculate the impurity rate.
10. The method for detecting the morphology of rice seed grains according to any one of claims 7 or 8, wherein, The obtaining of the impurity rate includes the following steps: Obtain the shape, size, and color characteristics of intact rice seeds and the identified rice seed grains; Calculate the Mahalanobis distance between the shape and size and the Mahalanobis distance between the color characteristics, and then determine the similarity between the two to calculate the impurity rate.
11. A system for detecting the morphology of rice seed grains, wherein, comprising: An image acquisition module for acquiring rice seed grain images; An ROI grayscale module for cropping the rice seed grain image to obtain a region of interest and performing image grayscale processing on the filtered and enhanced region of interest; A binarization module for performing image binarization processing on the grayscale processed image to obtain a binary image; A segmentation and marking module for segmenting the adhesion area of the binary image to obtain separate rice seed grain areas, and then marking each rice seed in the rice seed grain image according to the position of the rice seed grain area; wherein, segmenting the adhesion area of the binary image to obtain separate rice seed grain areas includes: calculating the regional contrast according to the gray value distribution of the defined area in the binary image; configuring the pulse-coupled neural network image segmentation method with the regional contrast as the connection coefficient; segmenting the image according to the configured pulse-coupled neural network image segmentation method within the defined area; changing the defined area and looping through the above steps until all the adhesion areas in the binary image are segmented into separate rice seed grain areas; Calculate the regional contrast d ev (x,y) is configured with the formula: Among them, max f ω (x, y) represents the maximum value of the pixel gray values within the ω-defined area centered on the pixel P( x, y ) and avg f ω (x, y) represents the average value of the pixel gray values within the ω-defined area centered on the pixel P( x, y ) and minf ω (x, y) represents the minimum value of the pixel gray values within the ω-defined area centered on the pixel P( x, y ) ; A parameter acquisition module for acquiring the color characteristics of each rice seed and using the established neural network model to identify the color characteristics and the rice seed grain area information to obtain rice seed detection parameters; wherein, the rice seed detection parameters include at least one of the broken rice rate, yellow rice rate, and impurity rate.
12. An electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, When the processor executes the computer program, it implements the rice seed granule morphology detection method according to any one of claims 1 to 10.
13. A computer-readable storage medium, on which a computer program is stored, characterized in that, when the program is executed by a processor, it implements the steps of the rice seed granule morphology detection method according to any one of claims 1 to 10.