Color selection channel division method and device, electronic equipment and computer readable storage medium
Automatically calculate nozzle boundary values through image processing technology, solving the problem of fixed channel number limitation in the existing technology, realizing automated and accurate channel division, adapting to the needs of different nozzle numbers, and reducing manual operation costs.
Patent Information
- Application Number
- CN202411339418.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-31
AI Technical Summary
In the prior art, the number of channels divided by color selection channels is a fixed value, and it cannot adapt to channel division of different nozzle numbers, resulting in cumbersome viewing and manual input of boundary values and easy to cause errors.
Through image acquisition, grayscale processing, binary image segmentation, expansion corrosion algorithm, the boundary value of each nozzle is automatically calculated, and the boundary value of channel is automatically identified and monitored, and any number of nozzle channel division is supported.
Reduce the influence of human factors, improve accuracy, save labor costs, realize automated channel division, and adapt to channel needs of different nozzle numbers.
Smart Images

Figure CN119228833A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of color sorting and separation technology, and in particular to a color sorting channel division method, device, electronic equipment and computer-readable storage medium. Background Art
[0002] In the field of sorting, an image scanned by a sensor needs to be divided into corresponding nozzle positions. The existing division method is: place a small black iron sheet tooling at the corresponding positions on the left and right sides of a channel, and then manually check the horizontal pixel number position of the tooling in the image, input the left and right boundary pixel number values into the host computer, and then click on channel division, the algorithm in the FPGA will calculate the image position boundary value corresponding to each nozzle.
[0003] In the prior art, a Chinese patent document with the publication number CN108057645B discloses a camera alignment device for a color sorter and a control method thereof, the device comprising: a correction bar, one end of which has a positioning mark, and also has a line reference line set along the center line, one side of the line reference line has multiple channel division marks, and there is an alignment reference mark between two adjacent channel division marks, and the other side of the line reference line is blank; first and second correction bar clamping devices, the correction bar is connected between the first and second correction bar clamping devices; first and second adjustment devices, respectively fixed on the racks on both sides of the color sorter channel, and respectively connected to the first and second correction bar clamping devices; first and second fixing members, one end of the first and second fixing members is respectively fixed, and the other end is respectively connected to the first and second adjustment devices. The device observes the channel division mark through the camera field of view, and the channel division mark corresponds to the edge position of the channel. However, in the prior art, the number of channels divided by this channel division method is a fixed value, which has great limitations and cannot adapt to the channel division of different nozzle numbers. Summary of the invention
[0004] The purpose of the present invention is to provide a color sorting channel division method, device, electronic device and computer-readable storage medium to solve the problem that the number of channels in the color sorting channel division in the prior art is a fixed value and cannot adapt to channel division with different numbers of nozzles.
[0005] In order to achieve the above object, the present invention provides a color sorting channel division method, comprising the following steps:
[0006] S1, image acquisition: the camera scans the color RGB image f(x,y) of the black tooling at the left and right boundaries of the acquisition channel;
[0007] S2, grayscale processing: converting the collected color RGB image f(x, y) into a grayscale image g(x, y);
[0008] S3, segmenting the binary image: segmenting the grayscale image g(x,y) into a binary image h(x,y) according to a set threshold;
[0009] S4, dilation and erosion: performing dilation algorithm operation and erosion algorithm operation on the binary image h(x, y) to obtain a detection image i(x, y);
[0010] S5, calculate the nozzle boundary value: according to the detection image i (x, y), obtain the left boundary A = x and the right boundary B = x of the channel ′ , calculate the boundary value C corresponding to each nozzle n ,
[0011]
[0012] Wherein, x and x' are the horizontal coordinate positions of the pixels in the image, y is the vertical coordinate position of the pixels in the image, f represents the acquired color image, g represents the converted grayscale image, h represents the converted binary image, i represents the binary image after expansion and corrosion, N is the number of any set nozzles, n is the serial number corresponding to each nozzle, n = 0, 1, 2...N;
[0013] S6. Eliminate the target object: According to the calculated nozzle boundary value C n The nozzle number corresponding to each position pixel is obtained, so as to achieve accurate removal of the target object.
[0014] Furthermore, in the grayscale processing step, the grayscale image Among them, R(x,y) represents the red pixel coordinates, G(x,y) represents the green pixel coordinates, and B(x,y) represents the blue pixel coordinates.
[0015] Furthermore, in the step of segmenting the binary image, the threshold value is set to th1, and the binary image h(x, y) satisfies the following relationship:
[0016] Among them, th1 represents a constant.
[0017] Furthermore, in the expansion and erosion step, the binary image h(x, y) is firstly subjected to the expansion algorithm operation of a 3×3 structural operator, and then subjected to the erosion algorithm operation of a 3×3 structural operator, to obtain the detection image i(x, y).
[0018] Furthermore, in the step of calculating the nozzle boundary value, when the detection image i(x-1, y) = 0 and i(x, y) = 1, the channel left boundary A = x is obtained; when the detection image i(x, y) = 1 and i(x+1, y) = 0, the channel right boundary B = x is obtained. ′ .
[0019] The present invention provides a color sorting channel division device, comprising:
[0020] An image acquisition module, which acquires color RGB images of the black tooling at the left and right boundaries of the channel;
[0021] A grayscale processing module, which grayscale processes the color RGB image and obtains a grayscale image;
[0022] A binary segmentation module, which segments the grayscale image into a binary image according to a set threshold;
[0023] An expansion and corrosion module, which performs expansion and corrosion algorithm operations on the binary image to obtain a detection image;
[0024] A calculation module, which obtains the values of the left boundary and the right boundary of the channel according to the detection image, and calculates the boundary value corresponding to each nozzle;
[0025] The rejection module obtains the nozzle number corresponding to each position pixel according to the boundary value and rejects the target object.
[0026] The present invention provides a color sorting channel division electronic device, comprising a memory and at least one processor, wherein instructions are stored in the memory; at least one of the processors calls the instructions in the memory to enable the long strip fruit and vegetable sorting device to execute a color sorting channel division method as described above.
[0027] The present invention provides a computer-readable storage medium, on which instructions are stored. When the instructions are executed by a processor, a color selection channel division method as described above is implemented.
[0028] Compared with the existing known technology, the technical solution provided by the present invention has the following beneficial effects:
[0029] (1) A color sorting channel division method of the present invention determines the values of the left and right boundaries of the image by performing image processing on the image of the left and right boundaries of the channel, including acquisition, grayscale, binarization, corrosion and expansion and other processing processes. Compared with the prior art, it can replace manual inspection of channel boundary values, automatically monitor the boundary values recognized by tooling, reduce the influence of human factors, improve accuracy, and save labor costs. At the same time, according to the automatically recognized boundary values, the boundary values corresponding to each nozzle can be calculated. The number of nozzles is not limited, and any number of nozzle channels can be divided.
[0030] It will be apparent that elements or features described above in the context of a single embodiment may be used alone or in combination in other embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In the drawings, the sizes and proportions do not represent the sizes and proportions of actual products. The drawings are merely illustrative, and some non-essential elements or features are omitted for clarity.
[0032] Figure 1 It is a flow chart of the color selection channel division method in an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The present invention will be described in detail below with reference to the accompanying drawings. What is described here is only a preferred embodiment of the present invention, and those skilled in the art can think of other ways to implement the present invention based on the preferred embodiment, and other ways also fall within the scope of the present invention.
[0034] Example
[0035] In the field of sorting, an image scanned by a sensor needs to be divided into corresponding nozzle positions, and a channel is divided into corresponding n nozzle pixel positions. The existing method of dividing channels is usually to place a small black iron sheet tooling at the corresponding positions on the left and right sides of a channel, and then manually check the horizontal pixel number position of the tooling in the image, enter the left and right boundary pixel number values into the host computer, and then click on channel division. The algorithm in the FPGA will calculate the image position boundary value corresponding to each nozzle, usually corresponding to 64 nozzles.
[0036] However, the existing method relies on manual inspection and manual input of boundary values, which is cumbersome and prone to errors. It also causes the number of channel divisions to be fixed. Therefore, in order to eliminate the influence of human factors and improve accuracy, Figure 1 This embodiment provides a color selection channel division method, comprising the following steps:
[0037] S1. Image acquisition: The camera scans and acquires the color RGB image f(x, y) of the black tooling at the left and right boundaries of the channel, where x and x' are the horizontal coordinate positions of the pixel in the image, and y is the vertical coordinate position of the pixel in the image.
[0038] S2, grayscale processing: convert the collected color RGB image f(x, y) into a grayscale image g(x, y), where g(x, y) satisfies the following relationship:
[0039] Among them, color images are represented by the three primary colors RGB, with corresponding coordinates, and the pixels at each coordinate position have corresponding RGB values. R(x,y) represents the red pixel coordinates, G(x,y) represents the green pixel coordinates, and B(x,y) represents the blue pixel coordinates.
[0040] S3, segment the binary image: segment the grayscale image g(x,y) into a binary image h(x,y) according to the set threshold th1, where h(x,y) satisfies the following relationship:
[0041] Among them, th1 represents a constant.
[0042] S4, dilation and erosion: perform dilation and erosion algorithms on the binary image h(x, y) to obtain a detection image i(x, y), wherein the binary image h(x, y) is firstly subjected to a dilation algorithm operation of a 3×3 structural operator, and then subjected to an erosion algorithm operation of a 3×3 structural operator to obtain a detection image i(x, y).
[0043] S5. When the detection image i(x-1,y)=0 and i(x,y)=1, the left boundary of the channel A=x is obtained; when the detection image i(x,y)=1 and i(x+1,y)=0, the right boundary of the channel B=x is obtained. ′ ;
[0044] Calculate the nozzle boundary value: According to the detection image i(x,y), the left boundary A=x and the right boundary B=x of the channel are obtained. ′ , calculate the boundary value C corresponding to each nozzle n ,
[0045]
[0046] Wherein, x and x' are the horizontal coordinate positions of the pixels in the image, y is the vertical coordinate position of the pixels in the image, f represents the acquired color image, g represents the converted grayscale image, h represents the converted binary image, i represents the binary image after expansion and corrosion, N is the number of any set nozzles, n is the serial number corresponding to each nozzle, n = 0, 1, 2...N;
[0047] S6. Eliminate the target object: According to the calculated nozzle boundary value C n The nozzle number corresponding to each pixel position is obtained, so as to accurately remove the target object. It should be noted that when removing the target object, the boundary value C n Find the nozzle number n to determine which nozzle is blowing. The target object is the material to be removed after sorting and identification. The purpose of dividing the channel is to determine which nozzle will act to remove the target object.
[0048] The embodiments of the present application are described in conjunction with specific coordinate values as follows:
[0049] If x=50,x'=1000,N=64,then A=50,B=1000,using the formula (Rounding is used) Then the 65 boundary values corresponding to the 64 nozzles are:
[0050] C0=50,C1=64,C2=79,C3=94,C4=109,C5=124,C6=139,C7=154,
[0051] C8=169,C9=184,C 10 =198,C 11 =213,C 12 =228,C 13 =243,C 14 =258,C 15 =273,
[0052] C 16 =287,C 17 =302,C 18 =317,C 19 =332,C 20 =347,C 21 =362,C 22 =376,C 23 =391,
[0053] C 24 =406,C 25 =421,C 26 =436,C 27 =451,C 28 =466,C 29 =480,C 30 =495,C 31 =510,
[0054] C 32 =525,C 33 =540,C 34 =555,C 35 =569,C 36 =584,C 37 =599,C 38 =614,C 3g =629,
[0055] C 40 =644,C 41 =658,C 42 =673,C 43 =688,C 44 =703,C 45 =718,C 46 =733,C 47 =747,
[0056] C 48 =762,C 49=777,C 50 =792,C 51 =807,C 52 =822,C 53 =837,C 54 =851,C 55 =866,
[0057] C 56 =881,C 57 =896,C 58 =911,C 59 =926,C 60 =940,C 61 =955,C 62 =970,C 63 =985,
[0058] C 64 =1000.
[0059] One aspect of the present application provides a color sorting channel division device, comprising:
[0060] An image acquisition module, which acquires color RGB images of the black tooling at the left and right boundaries of the channel;
[0061] A grayscale processing module, which grayscale processes the color RGB image and obtains a grayscale image;
[0062] A binary segmentation module, which segments the grayscale image into a binary image according to a set threshold;
[0063] An expansion and corrosion module, which performs expansion and corrosion algorithm operations on the binary image to obtain a detection image;
[0064] A calculation module, which obtains the values of the left boundary and the right boundary of the channel according to the detection image, and calculates the boundary value corresponding to each nozzle;
[0065] The rejection module obtains the nozzle number corresponding to each position pixel according to the boundary value and rejects the target object.
[0066] Another aspect of the present application provides a color sorting channel division electronic device, comprising a memory and at least one processor, wherein the memory stores instructions; at least one of the processors calls the instructions in the memory to enable the long strip fruit and vegetable sorting device to execute a color sorting channel division method as described above.
[0067] Another aspect of the present application provides a computer-readable storage medium having instructions stored thereon, and when the instructions are executed by a processor, a color selection channel division method as described above is implemented.
[0068] It should be noted that if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0069] The protection scope of the present invention is limited only by the claims. With the help of the teachings of the present invention, those skilled in the art will easily recognize that alternative structures of the structures disclosed in the present invention can be used as feasible alternative embodiments, and the embodiments disclosed in the present invention can be combined to generate new embodiments, which also fall within the scope of the appended claims.
Claims
1. A color selection channel division method, characterized in that: The following steps are involved: S1, image acquisition: the camera scans the color RGB image f(x,y) of the black tooling at the left and right boundaries of the acquisition channel; S2, grayscale processing: converting the collected color RGB image f(x, y) into a grayscale image g(x, y); S3, segmenting the binary image: segmenting the grayscale image g(x,y) into a binary image h(x,y) according to a set threshold; S4, dilation and erosion: performing dilation algorithm operation and erosion algorithm operation on the binary image h(x, y) to obtain a detection image i(x, y); S5, calculate the nozzle boundary value: according to the detection image i (x, y), obtain the left boundary A = x and the right boundary B = x of the channel ′ , calculate the boundary value C corresponding to each nozzle n , Wherein, x and x' are the horizontal coordinate positions of the pixels in the image, y is the vertical coordinate position of the pixels in the image, f represents the acquired color image, g represents the converted grayscale image, h represents the converted binary image, i represents the binary image after expansion and corrosion, N is the number of any set nozzles, n is the serial number corresponding to each nozzle, n = 0, 1, 2...N; S6. Eliminate the target object: According to the calculated nozzle boundary value C n The nozzle number n corresponding to each position pixel is obtained, so as to achieve accurate removal of the target object.
2. A color selection channel division method according to claim 1, characterized in that: In the grayscale processing step, the grayscale image Among them, R(x,y) represents the red pixel coordinates, G(x,y) represents the green pixel coordinates, and B(x,y) represents the blue pixel coordinates.
3. A color selection channel division method according to claim 1, characterized in that: In the step of segmenting the binary image, the threshold value is set to th1, and the binary image h(x, y) satisfies the following relationship: Among them, th1 represents a constant.
4. A color selection channel division method according to claim 1, characterized in that: In the expansion and erosion step, the binary image h(x, y) is firstly operated by the expansion algorithm of the 3×3 structural operator, and then operated by the erosion algorithm of the 3×3 structural operator to obtain the detection image i(x, y).
5. A color selection channel division method according to claim 1, characterized in that: In the step of calculating the nozzle boundary value, when the detection image i(x-1, y) = 0 and i(x, y) = 1, the channel left boundary A = x is obtained; when the detection image i(x, y) = 1 and i(x+1, y) = 0, the channel right boundary B = x is obtained. ′ .
6. A color sorting channel division device, characterized in that: include: An image acquisition module, which acquires color RGB images of the black tooling at the left and right boundaries of the channel; A grayscale processing module, which grayscale processes the color RGB image and obtains a grayscale image; A binary segmentation module, which segments the grayscale image into a binary image according to a set threshold; An expansion and corrosion module, which performs expansion and corrosion algorithm operations on the binary image to obtain a detection image; A calculation module, which obtains the values of the left boundary and the right boundary of the channel according to the detection image, and calculates the boundary value corresponding to each nozzle; The rejection module obtains the nozzle number corresponding to each position pixel according to the boundary value and rejects the target object.
7. An electronic device for color selection channel division, characterized in that: It comprises a memory and at least one processor, wherein the memory stores instructions; at least one of the processors calls the instructions in the memory so that the long strip fruit and vegetable sorting equipment executes a color sorting channel division method as described in any one of claims 1 to 5.
8. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instruction is executed by the processor, a color selection channel division method as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Camera alignment device of color sorting machine and control method of camera alignment device
CN108057645A
