Glass sorting method, device, equipment and medium
By obtaining the glass image of the target color batch and using the candidate cylindrical model to identify the glass color, the problem of different sorting efficiency and low accuracy in glass production is solved, and efficient and accurate glass sorting is achieved.
Patent Information
- Application Number
- CN202310327431.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2043-03-30
AI Technical Summary
During the glass production process, glasses of different colors exist in the same batch of glass, resulting in low sorting efficiency and accuracy, affecting the yield rate.
By obtaining the glass image of the target color batch, using the candidate cylindrical model of the candidate color batch, the glass color is identified according to the color channel value of the pixel point and sorted.
Improves the efficiency and accuracy of glass sorting to ensure the correct sorting of glass in the same color batch.
Smart Images

Figure CN116329133B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of glass sorting, and in particular to a glass sorting method, device, equipment and medium. Background Art
[0002] With the rapid adoption of electronic products such as mobile phones and tablets, glass is increasingly being used to protect and enhance the aesthetics of these devices. During the glass production process, mixing of glass can result in different colors within the same batch, impacting subsequent processes. This necessitates sorting of glass of different colors, and the efficiency and accuracy of this sorting directly impact the yield of finished glass. Therefore, efficient and accurate sorting of glass of different colors is crucial. Summary of the Invention
[0003] The present invention provides a glass sorting method, device, equipment and medium to improve the efficiency and accuracy of glass sorting.
[0004] In a first aspect, the present invention provides a glass sorting method, comprising:
[0005] Obtaining a target glass image of a glass to be identified in a target color batch, and selecting a target cylinder model of the target color batch from candidate cylinder models of a candidate color batch according to the target color batch; wherein the candidate cylinder model of the candidate color batch is determined based on a sample glass image in the candidate color batch;
[0006] Determine the color channel value of the target color point in the target glass image according to the color channel value of each pixel in the target glass image;
[0007] If the target color point is determined to be located in the target cylindrical model according to the color channel value of the target color point, the color of the glass to be identified is the target color;
[0008] The glass to be identified is sorted according to its color.
[0009] In a second aspect, the present invention further provides a glass sorting device, comprising:
[0010] a target model determination module, configured to obtain a target glass image of the glass to be identified in a target color batch, and select a target cylinder model of the target color batch from candidate cylinder models of candidate color batches according to the target color batch; wherein the candidate cylinder model of the candidate color batch is determined based on a sample glass image in the candidate color batch;
[0011] A target channel value determination module is used to determine the color channel value of the target color point of the target glass image according to the color channel value of each pixel point in the target glass image;
[0012] A color determination module, configured to determine that if the target color point is located in the target cylindrical model according to the color channel value of the target color point, the color of the glass to be identified is the target color;
[0013] The glass sorting module is used to sort the glass to be identified according to its color.
[0014] In a third aspect, an embodiment of the present invention further provides an electronic device, including:
[0015] at least one processor; and
[0016] a memory communicatively coupled to at least one processor; wherein
[0017] The memory stores instructions that can be executed by at least one processor. The instructions are executed by the at least one processor so that the at least one processor can execute the glass sorting method provided by any embodiment of the present invention.
[0018] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium storing computer instructions, which are used to enable a processor to implement the glass sorting method of any embodiment of the present invention when executed.
[0019] The embodiment of the present invention obtains a target glass image of the glass to be identified in the target color batch, and selects a target cylindrical model of the target color batch from the candidate cylindrical models of the candidate color batch according to the target color batch; determines the color channel value of the target color point corresponding to the target color point in the target glass image according to the color channel value of each pixel point in the target glass image; if the target color point is determined to be located in the target cylindrical model according to the color channel value of the target color point, then the color of the glass to be identified is the target color; and sorts the glass to be identified according to the color of the glass to be identified. The technical solution of the embodiment of the present invention identifies the color of the glass to be identified through the target cylindrical model, and thus sorts the glass to be identified according to the color of the glass to be identified, thereby realizing the sorting of glass during the production process and improving the efficiency and accuracy of glass sorting.
[0020] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 This is a flow chart of a glass sorting method provided according to the first embodiment of the present invention;
[0023] Figure 2A This is a flow chart of a glass sorting method provided according to the second embodiment of the present invention;
[0024] Figure 2B is a schematic diagram of a candidate cylinder model in a color channel space provided according to a second embodiment of the present invention;
[0025] Figure 3A This is a flow chart of a glass sorting method provided according to the third embodiment of the present invention;
[0026] Figure 3B 2 is a schematic diagram of the positional relationship between a target color point and a target cylindrical model provided according to the third embodiment of the present invention;
[0027] Figure 4 This is a flow chart of a glass sorting method provided according to a fourth embodiment of the present invention;
[0028] Figure 5 This is a structural diagram of a glass sorting device provided according to a fifth embodiment of the present invention;
[0029] Figure 6 Schematic diagram of an electronic device of a glass sorting device provided according to a sixth embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "target" and "candidate" and the like in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this way are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or apparatus.
[0032] Example 1
[0033] Figure 1 This is a flow chart of a glass sorting method provided in Example 1 of the present invention. This embodiment is applicable to the situation of sorting glass. The method can be performed by a glass sorting device. The glass sorting device can be implemented in the form of hardware and / or software and specifically configured in an electronic device, such as a glass sorting device.
[0034] like Figure 1 As shown, the method includes:
[0035] S101. Obtain a target glass image of a glass to be identified in a target color batch, and select a target cylinder model of the target color batch from candidate cylinder models of a candidate color batch according to the target color batch; wherein the candidate cylinder model of the candidate color batch is determined according to a sample glass image in the candidate color batch.
[0036] In this embodiment, the target color batch may be a batch of glass of the desired color. The glass to be identified may be the glass in the target color batch awaiting color identification. The target glass image may be an image of the glass to be identified. The candidate color batches may be batches of glass of various colors. The candidate cylinder model may be a cylinder model in the color channel space. The target cylinder model may be a cylinder model corresponding to the target color batch in the color channel space. The dimensions of the color channel space may be a red dimension, a green dimension, and a blue dimension. The sample glass image may be an image of glass in the candidate color batch. In one specific embodiment, an industrial camera may be used to photograph the glass to be identified to obtain a target glass image of the glass to be identified.
[0037] S102 : Determine the color channel value of the target color point corresponding to the target glass image according to the color channel value of each pixel point in the target glass image.
[0038] In this embodiment, the target color point may be a point in the color channel space corresponding to the target glass image. The color channel values may include a red channel value, a green channel value, and a blue channel value.
[0039] Optionally, the color channel value of the target color point corresponding to the target glass image is determined based on the color channel value of each pixel point in the target glass image, including: taking the color channel average of each pixel point in a preset area in the target glass image as the color channel value of the target color point corresponding to the target glass image.
[0040] The position and size of the preset area can be independently set by technicians based on actual needs or actual experience, and the present invention does not limit this.
[0041] Specifically, the red channel value, green channel value, and blue channel value of each pixel point in a preset area of the target glass image are obtained; the red channel mean, green channel mean, and blue channel mean of each pixel point in the preset area are determined based on the red channel value, green channel value, and blue channel value of each pixel point in the preset area; and the red channel mean, green channel value, and blue channel value are respectively used as the red channel value, green channel value, and blue channel value of the target color point corresponding to the target glass image.
[0042] It can be understood that by adopting the above technical solution, the color channel average of each pixel point in the preset area in the target glass image is used as the color channel value corresponding to the target color point in the target glass image, thereby improving the accuracy of the color channel value of the target color point.
[0043] S103: If it is determined according to the color channel value of the target color point that the target color point is located in the target cylindrical model, the color of the glass to be identified is the target color.
[0044] Specifically, the spatial positional relationship between the target color point and the target cylindrical model is determined based on the color channel value of the target color point. If the target color point is determined to be located within the target cylindrical model based on the color channel value of the target color point, the color of the glass to be identified is the target color; otherwise, the color of the glass to be identified is another color.
[0045] S104: Sorting the glass to be identified according to its color.
[0046] For example, if the color of the glass to be identified is the target color, the glass to be identified is sorted into area A; if the color of the glass to be identified is other colors, the glass to be identified is sorted into area B.
[0047] The embodiment of the present invention obtains a target glass image of the glass to be identified in the target color batch, and selects the target cylindrical model of the target color batch from the candidate cylindrical models of the candidate color batch according to the target color batch; wherein the candidate cylindrical model of the candidate color batch is determined according to the sample glass image in the candidate color batch; the color channel value of the target color point corresponding to the target glass image is determined according to the color channel value of each pixel point in the target glass image; if the target color point is determined to be located in the target cylindrical model according to the color channel value of the target color point, then the color of the glass to be identified is the target color; and the glass to be identified is sorted according to the color of the glass to be identified. The technical solution of the embodiment of the present invention identifies the color of the glass to be identified by the target cylindrical model, and thus sorts the glass to be identified according to the color of the glass to be identified, thereby realizing the sorting of glass in the production process and improving the efficiency and accuracy of glass sorting.
[0048] Example 2
[0049] FIG2 is a flow chart of a glass sorting method provided in a second embodiment of the present invention. Based on the technical solutions of the above embodiments, the embodiment of the present invention adds an operation of determining candidate cylindrical models.
[0050] Furthermore, the following is added: "For each sample glass image, determine the color channel value of the sample color point corresponding to the sample glass image based on the color channel value of each pixel point in the sample glass image; for each candidate color batch, determine the cylindrical surface and cylindrical length of the candidate color batch, and the cylindrical endpoint corresponding to the cylindrical length based on the color channel value of each sample color point under the candidate color batch; determine the candidate cylinder model of the candidate color batch based on the cylindrical surface and cylindrical length of the candidate color batch, and the cylindrical endpoint corresponding to the cylindrical length" to determine the candidate cylinder model.
[0051] It should be noted that for the parts not described in detail in the embodiments of the present invention, reference can be made to the description of the aforementioned embodiments.
[0052] As shown in FIG2 , the method includes:
[0053] S201 : For each sample glass image, determine the color channel value of a sample color point corresponding to the sample glass image according to the color channel value of each pixel point in the sample glass image.
[0054] In this embodiment, the sample color point may be a point corresponding to the sample glass image in the color channel space.
[0055] In an optional embodiment, the color channel average of each pixel within a predetermined region of the sample glass image is used as the color channel value of the corresponding sample color point in the sample glass image. The position and size of the predetermined region can be determined by a technician based on actual needs or experience, and are not limited in this invention.
[0056] S202 : For each candidate color batch, determine the cylinder surface and cylinder length of the candidate color batch, as well as the cylinder endpoint corresponding to the cylinder length, based on the color channel value of each sample color point of the candidate color batch.
[0057] In this embodiment, the cylindrical surface may be the cylindrical surface of the candidate cylindrical model; the cylindrical length may be the length of the candidate cylindrical model; and the cylindrical end point may be the midpoint of the cylindrical end surface in the candidate cylindrical model.
[0058] Optionally, for each candidate color batch, the cylindrical surface and cylindrical length of the candidate color batch, as well as the cylindrical endpoints corresponding to the cylindrical length, are determined based on the color channel values of each sample color point under the candidate color batch, including: for each candidate color batch, based on the least squares method, determining the central axis of the cylinder of the candidate color batch according to the color channel values of each sample color point under the candidate color batch; for each sample color point, determining the sample perpendicular foot point of the sample color point on the central axis of the cylinder of the candidate color batch, and a first distance between the sample color point and the sample perpendicular foot point; determining the cylindrical radius of the candidate color batch based on the first distance, and determining the cylindrical surface of the candidate color batch based on the cylinder radius and the central axis of the cylinder; determining a second distance between every two sample perpendicular foot points, taking the maximum distance in the second distances as the cylindrical length of the candidate color batch, and taking the two sample perpendicular foot points corresponding to the maximum distance in the second distances as the cylindrical endpoints of the candidate color batch.
[0059] The sample foot point is the foot point of the sample color point on the central axis of the candidate color batch cylinder; the first distance is the distance between the sample color point and the sample foot point; and the second distance is the distance between the two sample foot points.
[0060] Specifically, for each candidate color batch, based on the least squares method, a first difference is determined according to the number of sample color points in the candidate color batch, the red channel value and the blue channel value of each sample color point; a second difference is determined according to the number of sample color points and the blue channel value of each sample color point; the ratio between the first difference and the second difference is used as a first slope; a first intercept is determined according to the number of sample color points, the first slope, the red channel value and the blue channel value of each sample color point; a third difference is determined according to the number of sample color points, the green channel value and the blue channel value of each sample color point; a fourth difference is determined according to the number of sample color points and the blue channel value of each sample color point; the ratio between the third difference and the fourth difference is used as a second slope; and a second intercept is determined according to the number of sample color points, the second slope, the green channel value and the blue channel value of each sample color point. Exemplarily, the first slope, the first intercept, the second slope, and the second intercept can be determined by the following formulas:
[0061]
[0062]
[0063]
[0064]
[0065] Wherein, k1 represents the first slope; k2 represents the second slope; b1 represents the first intercept; b2 represents the second intercept; n represents the number of sample color points; R represents the red channel value; G represents the green channel value; and B represents the blue channel value.
[0066] The central axis of the cylinder of the candidate color batch is determined according to the first slope, the first intercept, the second slope, and the second intercept. For example, the central axis of the cylinder of the candidate color batch can be expressed by the following formula:
[0067]
[0068] In an optional embodiment, a reference red channel value, a reference green channel value, a reference blue channel value, a number of red channel directions, a number of green channel directions, and a number of blue channel directions of the cylinder central axis are determined based on the first slope, the first intercept, the second slope, and the second intercept; and the cylinder central axis of the candidate color batch is determined based on the reference red channel value, the reference green channel value, the reference blue channel value, the number of red channel directions, the number of green channel directions, and the number of blue channel directions of the cylinder central axis. Exemplarily, the cylinder central axis of the candidate color batch can be expressed by the following formula:
[0069]
[0070] Among them, R0 represents the reference red channel value; G0 represents the reference green channel value; B0 represents the reference blue channel value; m represents the number of red channel directions; n represents the number of green channel directions; and p represents the number of blue channel directions.
[0071] Two color points are selected from the central axis of the cylinder of the candidate color batch as the first reference color point and the second reference color point, respectively. For each sample color point, the color channel parameter of the sample color point is determined based on the color channel value of the sample color point, the color channel value of the first reference color point, and the color channel value of the second reference color point. For example, the color channel parameter can be determined using the following formula:
[0072]
[0073] Among them, k i represents the color channel parameter of the i-th sample color point; R1 represents the red channel value of the first reference color point; R2 represents the red channel value of the second reference color point; R i represents the red channel value of the i-th sample color point; G1 represents the green channel value of the first reference color point; G2 represents the green channel value of the second reference color point; G i represents the green channel value of the i-th sample color point; B1 represents the blue channel value of the first reference color point; B2 represents the blue channel value of the second reference color point; B i Indicates the blue channel value of the i-th sample color point.
[0074] Based on the color channel parameters of the sample color point, the color channel value of the first reference color point, and the color channel value of the second reference color point, the color channel value of the sample foot point of the sample color point on the central axis of the candidate color batch cylinder is determined, that is, the sample foot point is uniquely determined. For example, the color channel value of the sample foot point can be determined by the following formula:
[0075]
[0076] Among them, R c_i Represents the red channel value of the sample foot point of the i-th sample color point; G c_i Indicates the green channel value of the sample foot point of the i-th sample color point; B c_i Indicates the blue channel value of the sample foot point of the i-th sample color point.
[0077] Determine a first distance between the sample color point and the sample perpendicular foot point based on the color channel value of the sample color point and the color channel value of the sample perpendicular foot point. Exemplarily, the first distance between the sample color point and the sample perpendicular foot point can be determined by the following formula:
[0078]
[0079] Among them, D i Represents the first distance between the i-th sample color point and its sample perpendicular foot point.
[0080] Based on the first distance between each sample color point and the corresponding sample perpendicular foot point under the candidate color batch, the distance mean and distance variance of each first distance are determined, and the sum of the distance mean and three times the distance variance is used as the cylinder radius of the candidate color batch. For example, the cylinder radius can be determined by the following formula:
[0081] r=D m +3D s ;
[0082] Where r represents the radius of the cylinder; D m represents the distance mean; D s represents the distance variance.
[0083] The cylindrical surface of the candidate color batch is determined based on the cylindrical center axis and the cylindrical radius of the candidate color batch. For example, the cylindrical surface can be determined by the following formula:
[0084]
[0085] Determine the second distance between each pair of perpendicular foot points of the samples, use the maximum distance among the second distances as the cylinder length of the candidate color batch, and use the two sample perpendicular foot points corresponding to the maximum distance among the second distances as the cylinder endpoints of the candidate color batch. For example, the cylinder length can be determined using the following formula:
[0086]
[0087] Where L represents the length of the cylinder; R c_m Indicates the red channel value of the foot point of the mth sample; G c_m Indicates the green channel value of the vertical foot point of the mth sample; B c_m Represents the blue channel value of the foot point of the mth sample; R c_n Indicates the red channel value of the foot point of the nth sample; G c_n Indicates the green channel value of the foot point of the nth sample; B c_n Indicates the blue channel value of the foot point of the nth sample.
[0088] It can be understood that, by adopting the above technical solution, the central axis of the cylinder is determined according to the color channel value of each sample color point; the sample perpendicular foot point of the sample color point on the central axis of the cylinder and the first distance between the sample color point and the sample perpendicular foot point are determined; the cylinder radius is determined according to the first distance, and the cylindrical surface is determined according to the cylinder radius and the central axis of the cylinder; the cylinder length and the cylinder endpoints are determined according to the second distance between every two sample perpendicular foot points, thereby improving the accuracy of the cylindrical surface, cylinder length and cylinder endpoints, thereby improving the accuracy of the candidate cylinder model.
[0089] S203 : Determine a candidate cylinder model of the candidate color batch according to the cylinder surface and cylinder length of the candidate color batch, and the cylinder endpoints corresponding to the cylinder length.
[0090] Specifically, the position of the candidate cylindrical model of the candidate color batch in the color channel space is determined according to the cylinder length and cylinder endpoints of the candidate color batch; the candidate cylindrical model of the candidate color batch is determined according to the cylindrical surface of the candidate color batch and the position of the candidate cylindrical model of the candidate color batch in the color channel space.
[0091] Optional, Figure 2B is a schematic diagram of candidate cylinder models in the color channel space. Figure 2B As shown in Figure 1, the three coordinate axes of the color channel space are the R, G, and B axes. R represents the red channel, G represents the green channel, and B represents the blue channel. Points in the color channel space are sample color points. The candidate cylinder models in the color channel space correspond to different candidate color batches.
[0092] It should be noted that S201, S202 and S203 are only executed once, and are used to pre-determine the candidate cylinder models of the candidate color batch based on the sample glass images in the candidate color batch, so as to directly select the target cylinder model of the target color batch from the candidate cylinder models of the candidate color batch, thereby improving the efficiency of obtaining the target cylinder model of the target color batch, thereby improving the efficiency of identifying the color of the glass to be identified, and improving the efficiency of sorting the glass.
[0093] S204 , obtaining a target glass image of the glass to be identified in the target color batch, and selecting a target cylinder model of the target color batch from the candidate cylinder models of the candidate color batch according to the target color batch.
[0094] S205 , determining the color channel value of the target color point corresponding to the target glass image according to the color channel value of each pixel point in the target glass image.
[0095] S206: If it is determined according to the color channel value of the target color point that the target color point is located in the target cylindrical model, the color of the glass to be identified is the target color.
[0096] S207: Sorting the glass to be identified according to its color.
[0097] In an embodiment of the present invention, for each sample glass image, the color channel value of a sample color point corresponding to the sample glass image is determined based on the color channel value of each pixel point in the sample glass image. For each candidate color batch, the cylindrical surface and cylindrical length of the candidate color batch, as well as the cylinder endpoints corresponding to the cylindrical length, are determined based on the color channel value of each sample color point in the candidate color batch. A candidate cylinder model of the candidate color batch is determined based on the cylindrical surface and cylindrical length of the candidate color batch, as well as the cylinder endpoints corresponding to the cylindrical length. A target glass image of glass to be identified in the target color batch is obtained, and a target cylinder model of the target color batch is selected from the candidate cylinder models of the candidate color batch based on the target color batch. The color channel value of a target color point corresponding to the target color point in the target glass image is determined based on the color channel value of each pixel point in the target glass image. If the target color point is determined to be located in the target cylindrical model based on the color channel value of the target color point, the color of the glass to be identified is the target color. The glass to be identified is sorted based on the color of the glass to be identified. The technical solution of the embodiment of the present invention determines the candidate cylinder models of the candidate color batch based on the sample glass images in the candidate color batch, so as to directly select the target cylinder model of the target color batch from the candidate cylinder models of the candidate color batch, thereby improving the efficiency of obtaining the target cylinder model of the target color batch, thereby improving the efficiency of identifying the color of the glass to be identified and improving the efficiency of glass sorting.
[0098] Example 3
[0099] Figure 3A This is a flow chart of a glass sorting method provided in the third embodiment of the present invention. Based on the technical solutions of the above embodiments, the embodiment of the present invention optimizes and improves the operation of determining the color of the glass to be identified.
[0100] Furthermore, “If the target color point is determined to be located in the target cylindrical model based on the color channel value of the target color point, then the color of the glass to be identified is the target color” is refined to “If the target color point is determined to be located in or on the cylindrical surface of the target cylindrical model based on the color channel value of the target color point, and the target color point is determined to be located in or on the cylindrical end surface of the target cylindrical model, then the color of the glass to be identified is the target color” to improve the operation of determining the color of the glass to be identified.
[0101] It should be noted that for the parts not described in detail in the embodiments of the present invention, reference can be made to the description of the aforementioned embodiments.
[0102] like Figure 3A The method shown comprises:
[0103] S301. Obtain a target glass image of a glass to be identified in a target color batch, and select a target cylinder model of the target color batch from candidate cylinder models of candidate color batches according to the target color batch; wherein the candidate cylinder model of the candidate color batch is determined according to a sample glass image in the candidate color batch.
[0104] S302 : Determine the color channel value of the target color point corresponding to the target glass image according to the color channel value of each pixel point in the target glass image.
[0105] S303. If it is determined based on the color channel value of the target color point that the target color point is located within or on the cylindrical surface of the target cylindrical model, and it is determined that the distance between the target perpendicular point of the target color point and the cylindrical end point of the target cylindrical model is less than or equal to a third distance, then the color of the glass to be identified is the target color; wherein the third distance is the sum of the cylinder length and the cylinder radius.
[0106] In this embodiment, the target foot point can be the foot point of the target color point on the cylinder center axis of the target cylinder model. The target foot point is determined in a similar manner to the sample foot point determination process, which will not be described in detail here.
[0107] For example, the target color point is located inside or on the cylindrical surface of the target cylindrical model, and the following formula can be used:
[0108]
[0109] Among them, R s Indicates the red channel value of the target color point; G s Indicates the green channel value of the target color point; B s Indicates the blue channel value of the target color point.
[0110] For example, the distance between the target foot point of the target color point and the cylinder end point of the target cylinder model is less than or equal to the third distance, which can be determined using the following formula:
[0111]
[0112]
[0113] Among them, R c Indicates the red channel value of the target perpendicular point; G c Indicates the green channel value of the target vertical foot point; Bc Indicates the blue channel value of the target perpendicular point; R c Indicates the red channel value of the target perpendicular point; G c Indicates the green channel value of the target vertical foot point; B c Indicates the blue channel value of the target perpendicular point; R m Represents the red channel value of the cylinder endpoint m; G m Indicates the green channel value of the cylinder endpoint m; B m Represents the blue channel value of the cylinder endpoint m; R n Represents the red channel value of the cylinder endpoint n; G n Indicates the green channel value of the cylinder endpoint n; B n Represents the blue channel value of the cylinder endpoint n; L+r represents the third distance.
[0114] Optional, Figure 3B It is a schematic diagram of the positional relationship between the target color point and the target cylindrical model. The dotted line constitutes the target cylindrical model; points m and n are the cylindrical endpoints of the target cylindrical model; R m Represents the red channel value of the cylinder endpoint m; G m Indicates the green channel value of the cylinder endpoint m; B m Represents the blue channel value of the cylinder endpoint m; R n Represents the red channel value of the cylinder endpoint n; G n Represents the green channel value of the cylinder endpoint n; the solid line mn is the cylinder centerline of the target cylinder model; the length of the line segment mn is the cylinder length; point s is the target color point; R s Represents the red channel value of the target color point s; G s Indicates the green channel value of the target color point s; B s Represents the blue channel value of the target color point s; point c is the target perpendicular point of the target color point s on the cylinder center axis mn; R c Indicates the red channel value of the target vertical foot point c; G c Indicates the green channel value of the target vertical foot point c; B c Indicates the blue channel value of the target perpendicular point c. Figure 3B As shown, if it is determined based on the color channel value of the target color point that the target color point is located within or on the cylindrical surface of the target cylindrical model, and it is determined that the distance between the target perpendicular point of the target color point and the cylindrical end point of the target cylindrical model is less than or equal to the third distance, then the color of the glass to be identified is the target color.
[0115] S304: Sorting the glass to be identified according to its color.
[0116] An embodiment of the present invention obtains a target glass image of glass to be identified in a target color batch, and selects a target cylindrical model of the target color batch from candidate cylindrical models of a candidate color batch based on the target color batch; wherein the candidate cylindrical model of the candidate color batch is determined based on a sample glass image in the candidate color batch; a color channel value corresponding to a target color point in the target glass image is determined based on the color channel value of each pixel point in the target glass image; if the target color point is determined to be located within or on the cylindrical surface of the target cylindrical model based on the color channel value of the target color point, and if the target color point is determined to be located within or on the cylindrical end face of the target cylindrical model, then the color of the glass to be identified is the target color; and the glass to be identified is sorted based on the color of the glass to be identified. The technical solution of the embodiment of the present invention improves the accuracy of identifying the color of the glass to be identified, thereby improving the accuracy of sorting the glass to be identified.
[0117] Example 4
[0118] Figure 4 This is a flow chart of a glass sorting method provided in the fourth embodiment of the present invention. This embodiment of the present invention is additionally optimized based on the technical solutions of the above embodiments.
[0119] Furthermore, the following is added: "If the glass to be identified is sorted incorrectly, the target glass image of the glass to be identified is used as the sample glass image of the glass to be identified, and the target cylindrical model is updated using the sample glass image of the glass to be identified" to implement the update operation of the target cylindrical model.
[0120] It should be noted that for the parts not described in detail in the embodiments of the present invention, reference can be made to the description of the aforementioned embodiments.
[0121] like Figure 4 The method shown comprises:
[0122] S401. Obtain a target glass image of a glass to be identified in a target color batch, and select a target cylinder model of the target color batch from candidate cylinder models of candidate color batches according to the target color batch; wherein the candidate cylinder model of the candidate color batch is determined according to a sample glass image in the candidate color batch.
[0123] S402 : Determine the color channel value of the target color point in the target glass image according to the color channel value of each pixel point in the target glass image.
[0124] S403: If it is determined according to the color channel value of the target color point that the target color point is located in the target cylindrical model, the color of the glass to be identified is the target color.
[0125] S404: Sorting the glass to be identified according to its color.
[0126] S405: If the glass to be identified is sorted incorrectly, the target glass image of the glass to be identified is used as a sample glass image of the glass to be identified, and the sample glass image of the glass to be identified is used to update the target cylinder model.
[0127] Specifically, if the glass to be identified is incorrectly sorted, the target glass image of the glass to be identified is used as the sample glass image of the glass to be identified. The target cylinder model is updated using the sample glass image of the glass to be identified and the sample glass images in the target color batch. Specifically, the color channel value of the sample color point corresponding to the sample glass image is determined based on the color channel value of each pixel in the sample glass image of the glass to be identified. The new cylinder surface and new cylinder length of the target color batch, as well as the new cylinder endpoints corresponding to the new cylinder length, are determined based on the color channel value of each sample color point in the target color batch and the color channel value of the sample color point corresponding to the sample glass image. The new target cylinder model of the target color batch is determined based on the new cylinder surface and new cylinder length of the target color batch, as well as the new cylinder endpoints corresponding to the new cylinder length.
[0128] An embodiment of the present invention obtains a target glass image of a glass to be identified in a target color batch, and selects a target cylinder model of the target color batch from candidate cylinder models of a candidate color batch based on the target color batch; wherein the candidate cylinder model of the candidate color batch is determined based on a sample glass image in the candidate color batch; the color channel value of the target color point corresponding to the target color point in the target glass image is determined based on the color channel value of each pixel point in the target glass image; if the target color point is determined to be located in the target cylinder model based on the color channel value of the target color point, the color of the glass to be identified is the target color; the glass to be identified is sorted based on the color of the glass to be identified; if the glass to be identified is sorted incorrectly, the target glass image of the glass to be identified is used as the sample glass image of the glass to be identified, and the target cylinder model is updated using the sample glass image of the glass to be identified. The technical solution of the embodiment of the present invention is that if the glass to be identified is sorted incorrectly, the target cylinder model is updated based on the target glass image of the glass to be identified, thereby improving the accuracy of the target cylinder model in identifying the glass color, thereby improving the accuracy of glass sorting.
[0129] Example 5
[0130] Figure 5This is a structural diagram of a glass sorting device provided in Example 5 of the present invention. This embodiment is applicable to the situation where a return code abnormality alarm is generated. The glass sorting device can be implemented in the form of hardware and / or software and specifically configured in an electronic device, such as a server.
[0131] like Figure 5 The glass sorting device shown in FIG. 5 comprises a target model determination module 501, a target channel value determination module 502, a color determination module 503 and a glass sorting module 504.
[0132] The target model determination module 501 is configured to obtain a target glass image of the glass to be identified in a target color batch, and select a target cylinder model of the target color batch from candidate cylinder models of candidate color batches according to the target color batch; wherein the candidate cylinder model of the candidate color batch is determined based on a sample glass image in the candidate color batch;
[0133] A target channel value determination module 502 is configured to determine a color channel value corresponding to a target color point in the target glass image according to the color channel value of each pixel in the target glass image;
[0134] A color determination module 503 is configured to determine that the color of the glass to be identified is the target color if it is determined based on the color channel value of the target color point that the target color point is located in the target cylindrical model;
[0135] The glass sorting module 504 is configured to sort the glass to be identified according to its color.
[0136] The embodiment of the present invention obtains a target glass image of the glass to be identified in the target color batch through a target model determination module, and selects a target cylinder model of the target color batch from the candidate cylinder models of the candidate color batch according to the target color batch; determines the color channel value of the target color point corresponding to the target glass image according to the color channel value of each pixel point in the target glass image through a target channel value determination module; determines the color of the glass to be identified as the target color if the target color point is determined to be located in the target cylinder model according to the color channel value of the target color point through a color determination module; and sorts the glass to be identified according to the color of the glass to be identified through a glass sorting module. The technical solution of the embodiment of the present invention identifies the color of the glass to be identified through a target cylinder model, and thus sorts the glass to be identified according to the color of the glass to be identified, thereby realizing the sorting of glass in the production process and improving the efficiency and accuracy of glass sorting.
[0137] Optionally, the device further includes:
[0138] A candidate threshold interval determination module is used to determine the candidate return code type to which the candidate return code belongs, and the business volume threshold interval of the candidate return code type in the candidate time period based on the candidate return code, recording time and channel to which the candidate return code belongs in the historical business log;
[0139] The target threshold interval determination module is configured to select a traffic volume threshold interval of the target return code type in a target time period from traffic volume threshold intervals of the candidate return code types in the candidate time period.
[0140] Optionally, the device further includes:
[0141] A sample channel value determination module is used to determine, for each sample glass image, the color channel value of the sample color point corresponding to the sample glass image according to the color channel value of each pixel point in the sample glass image;
[0142] A cylindrical surface determination module is used to determine, for each candidate color batch, the cylindrical surface and cylindrical length of the candidate color batch, as well as the cylindrical endpoint corresponding to the cylindrical length, based on the color channel value of each sample color point under the candidate color batch;
[0143] The candidate model determination module is used to determine the candidate cylinder model of the candidate color batch according to the cylinder surface and cylinder length of the candidate color batch and the cylinder end points corresponding to the cylinder length.
[0144] Optional cylindrical surface determination module, specifically used for:
[0145] For each candidate color batch, determine the cylinder center axis of the candidate color batch based on the least squares method according to the color channel value of each sample color point under the candidate color batch;
[0146] For each sample color point, determining a sample perpendicular foot point of the sample color point on the central axis of the candidate color batch cylinder, and a first distance between the sample color point and the sample perpendicular foot point;
[0147] Determining a cylindrical radius of the candidate color batch according to the first distance, and determining a cylindrical surface of the candidate color batch according to the cylindrical radius and the central axis of the cylinder;
[0148] Determine the second distance between every two sample perpendicular foot points, use the maximum distance among the second distances as the cylinder length of the candidate color batch, and use the two sample perpendicular foot points corresponding to the maximum distance among the second distances as the cylinder endpoints of the candidate color batch.
[0149] Optionally, the color determination module 503 is specifically configured to:
[0150] If the target color point is determined to be located within or on the cylindrical surface of the target cylindrical model based on the color channel value of the target color point, and the distance between the target color point and the cylindrical endpoint of the target cylindrical model is less than or equal to a third distance, then the color of the glass to be identified is the target color; wherein the third distance is the sum of the cylinder length and the cylinder radius.
[0151] Optionally, the target channel value determination module 502 is specifically configured to:
[0152] Taking the color channel average of each pixel point in a preset area in the target glass image as the color channel value of the target color point corresponding to the target glass image;
[0153] Optionally, the device further includes:
[0154] The model updating module is configured to use the target glass image of the glass to be identified as a sample glass image of the glass to be identified if the glass to be identified is sorted incorrectly, and to update the target cylindrical model using the sample glass image of the glass to be identified.
[0155] The glass sorting device can execute the glass sorting method provided by any embodiment of the present invention, and has functional modules and beneficial effects corresponding to executing each glass sorting method.
[0156] Example 6
[0157] Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0158] like Figure 6As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0159] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0160] The processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any other suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the glass sorting method.
[0161] In some embodiments, the glass sorting method can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the glass sorting method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to execute the glass sorting method in any other suitable manner (e.g., via firmware).
[0162] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0163] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0164] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0165] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0166] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0167] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0168] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.
[0169] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A glass sorting method, characterized in that: The method comprises: Obtaining a target glass image of a glass to be identified in a target color batch, and selecting a target cylinder model of the target color batch from candidate cylinder models of candidate color batches according to the target color batch; wherein the candidate cylinder model of the candidate color batch is determined based on a sample glass image in the candidate color batch; Determining the color channel value of the target color point corresponding to the target glass image according to the color channel value of each pixel point in the target glass image; If it is determined according to the color channel value of the target color point that the target color point is located in the target cylindrical model, then the color of the glass to be identified is the target color; sorting the glass to be identified according to its color; The candidate cylindrical model is determined by: For each sample glass image, determining the color channel value of the sample color point corresponding to the sample glass image according to the color channel value of each pixel point in the sample glass image; For each candidate color batch, determining a first difference value based on the least squares method according to the number of sample color points in the candidate color batch, the red channel value and the blue channel value of each sample color point; determining a second difference value according to the number of the sample color points and the blue channel value of each sample color point; taking the ratio between the first difference and the second difference as a first slope; determining a first intercept according to the number of sample color points, the first slope, and the red channel value and the blue channel value of each sample color point; determining a third difference value according to the number of sample color points, the green channel value and the blue channel value of each sample color point; determining a fourth difference value according to the number of sample color points and a blue channel value of each sample color point; taking the ratio between the third difference and the fourth difference as a second slope; Determine a second intercept according to the number of sample color points, the second slope, and the green channel value and the blue channel value of each sample color point; determining a central axis of the cylinder of the candidate color batch according to the first slope, the first intercept, the second slope, and the second intercept; For each sample color point, determining a sample perpendicular foot point of the sample color point on the central axis of the candidate color batch cylinder, and a first distance between the sample color point and the sample perpendicular foot point; Determining a cylindrical radius of the candidate color batch according to the first distance, and determining a cylindrical surface of the candidate color batch according to the cylindrical radius and the central axis of the cylinder; Determine a second distance between every two perpendicular foot points of the samples, use the maximum distance among the second distances as the cylinder length of the candidate color batch, and use the two perpendicular foot points of the samples corresponding to the maximum distance among the second distances as the cylinder endpoints of the candidate color batch; A candidate cylinder model of the candidate color batch is determined according to the cylinder surface and cylinder length of the candidate color batch, and cylinder endpoints corresponding to the cylinder length.
2. The method according to claim 1, characterized in that If it is determined according to the color channel value of the target color point that the target color point is located in the target cylindrical model, then the color of the glass to be identified is the target color, including: If it is determined based on the color channel value of the target color point that the target color point is located within or on the cylindrical surface of the target cylindrical model, and it is determined that the distance between the target color point and the cylindrical endpoint of the target cylindrical model is less than or equal to a third distance, then the color of the glass to be identified is the target color; wherein the third distance is the sum of the cylinder length and the cylinder radius.
3. The method according to claim 1, characterized in that Determining the color channel value of the target color point corresponding to the target glass image according to the color channel value of each pixel point in the target glass image includes: The color channel averages of the pixels in the preset area of the target glass image are respectively used as the color channel values of the target color points of the target glass image.
4. The method according to any one of claims 1 to 3, characterized in that After sorting the glass to be identified, the method further includes: If the glass to be identified is sorted incorrectly, the target glass image of the glass to be identified is used as a sample glass image of the glass to be identified, and the sample glass image of the glass to be identified is used to update the target cylindrical model.
5. A glass sorting device, characterized in that: include: a target model determination module, configured to obtain a target glass image of the glass to be identified in a target color batch, and select a target cylinder model of the target color batch from candidate cylinder models of candidate color batches according to the target color batch; wherein the candidate cylinder model of the candidate color batch is determined based on a sample glass image in the candidate color batch; a target channel value determination module, configured to determine the color channel value of a target color point corresponding to the target glass image according to the color channel value of each pixel point in the target glass image; a color determination module, configured to determine, if it is determined based on the color channel value of the target color point that the target color point is located in the target cylindrical model, that the color of the glass to be identified is the target color; A glass sorting module, used for sorting the glass to be identified according to its color; The device further comprises: A sample channel value determination module is used to determine, for each sample glass image, the color channel value of the sample color point corresponding to the sample glass image according to the color channel value of each pixel point in the sample glass image; A cylindrical surface determination module is used to determine, for each candidate color batch, the cylindrical surface and cylindrical length of the candidate color batch, as well as the cylindrical endpoint corresponding to the cylindrical length, based on the color channel value of each sample color point under the candidate color batch; a candidate model determination module, configured to determine a candidate cylinder model of the candidate color batch based on the cylinder surface and cylinder length of the candidate color batch, and the cylinder endpoints corresponding to the cylinder length; The cylindrical surface determination module is specifically used to: For each candidate color batch, determining a first difference value based on the least squares method according to the number of sample color points in the candidate color batch, the red channel value and the blue channel value of each sample color point; determining a second difference value according to the number of the sample color points and the blue channel value of each sample color point; taking the ratio between the first difference and the second difference as a first slope; determining a first intercept according to the number of sample color points, the first slope, and the red channel value and the blue channel value of each sample color point; determining a third difference value according to the number of sample color points, the green channel value and the blue channel value of each sample color point; determining a fourth difference value according to the number of sample color points and a blue channel value of each sample color point; taking the ratio between the third difference and the fourth difference as a second slope; Determine a second intercept according to the number of sample color points, the second slope, and the green channel value and the blue channel value of each sample color point; determining a central axis of the cylinder of the candidate color batch according to the first slope, the first intercept, the second slope, and the second intercept; For each sample color point, determining a sample perpendicular foot point of the sample color point on the central axis of the candidate color batch cylinder, and a first distance between the sample color point and the sample perpendicular foot point; Determining a cylindrical radius of the candidate color batch according to the first distance, and determining a cylindrical surface of the candidate color batch according to the cylindrical radius and the central axis of the cylinder; Determine the second distance between every two sample perpendicular foot points, use the maximum distance among the second distances as the cylinder length of the candidate color batch, and use the two sample perpendicular foot points corresponding to the maximum distance among the second distances as the cylinder endpoints of the candidate color batch.
6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the glass sorting method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the glass sorting method according to any one of claims 1 to 4 when executed.
Citation Information
Patent Citations
Image detection method and device, electronic equipment and storage medium
CN111476780A
Black generation to optimize color gamut volume and quality within limits on colorant usage
US20200112652A1