A fresh flower image segmentation method based on finite element method
Through the image segmentation process of the finite element method, the problems of large computational complexity and insufficient precision in the existing technology are solved, high-precision flower image segmentation and automatic classification are achieved, and the classification accuracy is improved.
Patent Information
- Application Number
- CN202310206230.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-06
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2043-03-06
AI Technical Summary
Existing technologies for flower image segmentation have high computational complexity and poor curve optimization effects. The finite difference method is not precise enough and it is difficult to accurately segment complex geometric areas.
An image segmentation process based on the finite element method is adopted, including optical scheme design, image preprocessing, finite element space definition, level set method for solving partial differential equations, grayscale histogram feature extraction and SVM classification, combined with AI model to achieve automated classification.
The computational precision and classification accuracy of image segmentation are improved, the accuracy of flower opening and flower damage detection is enhanced, and efficient automated sorting is achieved.
Smart Images

Figure CN116310331B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, in particular to a flower image segmentation method based on a finite element method, and applies the technology to flower classification. Background Art
[0002] With the rise in flower consumption, more and more flowers are entering households, making the flower industry a rapidly growing sector with enormous potential. Before leaving the factory, flowers are graded based on root stem length and openness, often using modern technology instead of manual labor.
[0003] Existing flower classification methods include image preprocessing, image segmentation, feature extraction, and classifier classification. Image segmentation is key to flower sorting. To determine the degree of openness and color of flowers and petals, it is necessary to segment a region into distinct regions based on image features such as edges, grayscale, and color. Traditional image segmentation methods include thresholding, edge-based segmentation, and region-based segmentation. However, these methods suffer from high computational complexity and poor curve optimization performance.
[0004] Existing methods also include the fuzzy C-means method and the partial differential equation method. The core issue of the partial differential equation method is solving partial differential equations. The finite difference method is often chosen for its simplicity, but it suffers from issues such as insufficient precision. The finite difference method is the primary tool for solving partial differential equations in image processing, but its accuracy is limited and requires high geometrical regions. Summary of the Invention
[0005] In view of the shortcomings of the existing methods, the technical solution adopted by the present invention is: a flower image segmentation method based on the finite element method comprises the following steps:
[0006] Step 1: Customize the optical solution and capture flower images. Capturing high-quality flower images requires a high-quality optical solution. The selection of background light source, lens depth of field, and camera in the optical solution requires continuous experimentation to find the optimal combination.
[0007] Furthermore, in order to improve the accuracy of actual detection, the defect levels of damaged flowers are subdivided and a flower openness differentiation function is given. The morphology of flower images includes: flower openness and flower damage.
[0008] Step 2: pre-process the collected flower images;
[0009] Furthermore, preprocessing includes: image grayscale, geometric transformation and image enhancement.
[0010] Step 3: Segment the pre-processed image using the finite element method;
[0011] Further, specifically including:
[0012] Step 31: Assume that the original image I(x,y) is of size M*N pixels and the domain of I(x,y) is Ω;
[0013] Step 32: Define the finite element space V h , let the finite element space V h satisfy:
[0014]
[0015] Among them, p j (t) is a function related to t, λ j (x,y) is the area coordinate of the triangle mesh node;
[0016] Step 33: Using the level set method, for the CV model in the partial differential equation image processing, solve the level set function u by the finite element method;
[0017] Furthermore, the level set function satisfies:
[0018]
[0019] Among them, μ represents the full value of the curve length, v represents the area weight of the area included in the curve, and a1 and a2 represent the energy parameters of the areas inside and outside the curve respectively;
[0020]
[0021] Furthermore, using the variational method, we process equation (2) and obtain the equation satisfied by the level set function:
[0022]
[0023] The iterative equation obtained by using the backward Euler method to discretize time is:
[0024]
[0025] in, Δt is the time step;
[0026] Convert equation (8) into matrix form, let H = M*N, A' be an H*H matrix, B be an H*1 matrix, and F be an H*1 matrix. Then the matrix form of the discrete problem is:
[0027] A'*B=F (9)
[0028] Among them, the element A in the i-th row and j-th column of the matrix A' is i,j , the element B in the jth row of matrix B j , the element F in the jth row of the matrix F j The specific expressions are:
[0029]
[0030] The problem is thus transformed into:
[0031] B=A' -1 F.
[0032] Step 34: Obtain the segmented image I cv =c1H(u(x,y))+c2(1-H(u(x,y)));
[0033] Step 4: Use the traditional grayscale histogram method to extract features from the segmented image;
[0034] Step 5: Classify the extracted features using the SVM method;
[0035] Step 6: Separate the warehouses based on the classification results to achieve flower classification.
[0036] Beneficial effects of the present invention:
[0037] 1. For the CV model in partial differential equation image processing, the finite element method is used to solve the level set function, which better describes the grayscale changes in the point neighborhood. The boundary information can be better segmented with high calculation accuracy, and can approximate the boundaries of geometrically complex regions, thereby improving the accuracy of classification.
[0038] 2. Since the finite element method is a commonly used engineering analysis tool, using the finite element method for numerical solution can effectively improve the efficiency of finite element pre-processing;
[0039] 3. Partial differential equations are an important component of mathematical analysis and a complex tool for image processing. Their essence is to transform discrete, chaotic, and disorganized digital images into continuous mathematical models through technical means. Reasoning within this continuous framework makes it easier for us to understand physical reality and provides intuition for proposing new models.
[0040] 4. 2D image acquisition combined with AI classification model is used to complete the sorting of flower opening degree and flower damage degree respectively. Compared with the finite difference method, the accuracy of flower opening degree and flower grandchildren are significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a flow chart of the flower image segmentation method based on the finite element method of the present invention;
[0042] Figure 2 is an image acquisition hardware diagram of the present invention;
[0043] Figure 3 This is a schematic diagram of the flower opening degree of the present invention;
[0044] Figure 4 is a schematic diagram of a flower defect of the present invention;
[0045] Figure 5 It is the triangle mesh node graph of the present invention. DETAILED DESCRIPTION
[0046] The present invention will be further described below in conjunction with the accompanying drawings and embodiments. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore only shows the components related to the present invention.
[0047] like Figure 1 As shown, a flower image segmentation method based on the finite element method includes the following steps:
[0048] Step 1: Collect flower images;
[0049] like Figure 2 For the flower image acquisition system, in order to meet the inspection requirements, a color camera with a field of view of 300mm and 0.12mm, a backlight source of 300mm*300mm, a lens depth of field of more than 20mm, and an industrial computer model of 6700-16G-4T are selected.
[0050] Flower sorting involves distinguishing petal openness, effectively identifying the degree of flower openness with an accuracy rate of 85%. Due to the need for sufficient space for actual evaluation, a 90% accuracy rate was required during actual testing, placing high demands on classification algorithms and image segmentation. Flower damage classification is also included, effectively identifying defects such as damaged flowers.
[0051] like Figure 3 The degree of flower opening is divided into 6 levels. If the standard is simplified, only whether the flowers are open or not is distinguished. Figure 3 The upper half of the picture shows three types of open subdivisions. Figure 3 The lower half of the picture shows the three subdivisions that are not open.
[0052] like Figure 4 Regarding the problem of flower damage, Figure 4 The upper half of the picture shows flowers without obvious defects. Figure 4 The lower half of the picture shows petal rot, discoloration and wrinkling defects respectively.
[0053] The basic idea of the partial differential equation method in image segmentation is to transform the segmentation problem into an energy functional minimization problem, that is, to obtain the image segmentation processing result by finding the numerical solution of the partial differential equation.
[0054] When solving partial differential equations, the required closed curve is implicitly expressed as a partial differential equation in the form of a zero level set function, and the time-varying level set function is used to represent the constantly changing curve, thereby converting the solution of the partial differential equation into a level set equation for solving the curve evolution.
[0055] When solving the level set equation, the finite element method with higher accuracy is used.
[0056] Step 2: pre-process the collected flower images;
[0057] The preprocessing process includes: image grayscale, geometric transformation and image enhancement, the purpose of which is to eliminate irrelevant information in the image, restore useful real information, enhance the detectability of relevant information, and simplify the data to the maximum extent, thereby improving the reliability of feature extraction, image segmentation, matching and recognition.
[0058] Step 3: Segment the pre-processed image using the finite element method;
[0059] Specifically include:
[0060] Suppose the original image I(x,y) is of size M*N pixels and the domain of I(x,y) is Ω;
[0061] Define the finite element space V h :
[0062] like Figure 5 is the grid node graph, and the triangular mesh subdivision of the image is denoted as Τ h ;v| τ ∈P1(T), Where v is represented on the triangular mesh τ, P1(T) represents a first-order polynomial on T;
[0063] Assuming that the coordinates of the three grid nodes are A1(x1,y1), A2(x2,y2), and A3(x3,y3), the basis functions are the corresponding area coordinates, denoted as λ1, λ2, and λ3, corresponding to the vertices A1(x1,y1), A2(x2,y2), and A3(x3,y3), respectively.
[0064] Let the finite element space V h satisfy:
[0065]
[0066] Among them, p j (t) is a function related to t.
[0067] Then any element of the finite element space can be expressed as
[0068] For the CV equation, the level set algorithm is used to obtain the level set equation by finding the level set function u that satisfies
[0069]
[0070] Where μ represents the full value of the curve length, v represents the area weight of the region contained by the curve, a1 and a2 represent the energy parameters of the region inside and outside the curve respectively, and I(x,y) is the original image;
[0071]
[0072]
[0073]
[0074]
[0075] The segmented image is:
[0076] I cv =c1H(u(x,y))+c2(1-H(u(x,y)))
[0077] Using the variational method, the original equation (2) becomes:
[0078]
[0079] Using the backward Euler method, the iterative equation is:
[0080]
[0081] in, Δt is the time step;
[0082] Convert equation (8) into matrix form:
[0083] Assume H = M * N, A' is an H * H matrix, B is an H * 1 matrix, and F is an H * 1 matrix. The matrix form of the discrete problem is:
[0084] A'*B=F (9)
[0085] Among them, the element A in the i-th row and j-th column of the matrix A' is i,j , the element B in the jth row of matrix B j , the element F in the jth row of the matrix F j The specific expressions are:
[0086]
[0087] The problem is thus transformed into:
[0088] B=A' -1 F.
[0089] Step 4: Use the traditional grayscale histogram method to extract features from the segmented image;
[0090] Step 5: Input the extracted feature values into the SVM algorithm for classification;
[0091] Step 6: Use PLC control technology to realize the automatic classification of flowers. During the PLC setting process, plan 2 warehouses.
[0092] Table 1: PLC warehouse
[0093] Warehouse No. Openness Flower loss 1 1 0 2 1 1
[0094] Among them, the number 1 corresponding to the openness indicates that the flowers are open, the number 1 corresponding to the flower damage indicates normal, and the number 0 corresponding to the flower damage indicates flower damage.
[0095] Based on the results of image segmentation, 2D image acquisition was combined with an AI classification model to complete the sorting of flower openness orders and flower damage orders respectively. The test results are as follows. According to the data, the finite element method effectively improved the final classification accuracy of the product compared with the finite difference method.
[0096] Table 2: Comparison of sorting accuracy under different numerical methods
[0097]
[0098] With the above-described preferred embodiments of the present invention as inspiration, and with reference to the above description, relevant personnel are fully capable of making various changes and modifications without departing from the technical scope of this invention. The technical scope of this invention is not limited to the contents of the specification and must be determined according to the scope of the claims.
Claims
1. A flower image segmentation method based on finite element method, characterized in that: The following steps are involved: Step 1: Customize the optical solution and capture flower images; Step 2: pre-process the collected flower images; Step 3: Segment the pre-processed image using the finite element method; Step 3: Specific include: Step 31: Set the original image , the size is M N Pixels, The domain is ; Step 32: Define the finite element space , let the finite element space satisfy: (1) in, Yes and t Related functions, is the area coordinate of the triangular mesh node; Triangular meshing of the image; Step 33: Using the level set method, for the CV model in the partial differential equation image processing, solve the level set function u by the finite element method; Step 34: Get the segmented image ; Level set function satisfy: (2) in, represents the full value of the curve length, Indicates the area weight of the region contained by the curve, Respectively represent the energy parameters of the inner and outer regions of the curve; (3) (4) (5) (6) in, is the original image; Using the variational method, the equation satisfied by the level set function is obtained as follows: (7) Using the backward Euler method, the iterative equation is: (8) in, , , is the time step; Convert equation (8) into matrix form, let H = M N , A 'for H H matrix, B for H 1 matrix, F for H 1 matrix, then the matrix form of the discrete problem is: A ’ B = F (9) Among them, the matrix A 'Middle i Row, No. j Column element ,matrix B Middle j row of dollars ,matrix F Middle j row of dollars The specific expressions are: (10) The problem is thus transformed into: ; Step 4: Use the traditional grayscale histogram method to extract features from the segmented image; Step 5: Classify the extracted features using the SVM method; Step 6: Separate the warehouses based on the classification results to achieve flower classification.
2. The flower image segmentation method based on the finite element method according to claim 1, wherein The forms of flower images include: flower openness and flower damage.
3. The flower image segmentation method based on the finite element method according to claim 1, wherein Preprocessing includes: Image grayscale, geometric transformation and image enhancement.
Citation Information
Patent Citations
Device and method for detecting shadow in image
CN101833749A
Image multi-target self-adaptation dividing method and image multi-target self-adaptation dividing system based on wavelet variation module
CN102542567A