Color classification method and device, electronic equipment and storage medium
By controlling the camera to acquire images of objects, detecting object areas, performing pixel sampling processing, determining the initial color category based on pixel values, and comparing it with a preset color category set, the problem of low efficiency and low accuracy in color classification in existing technologies is solved, and efficient and accurate color classification is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN UNIV
- Filing Date
- 2022-03-07
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies for color-based item classification are inefficient and inaccurate, especially for items with mixed colors, which makes classification difficult and results in low efficiency and accuracy for manual classification.
By controlling the camera to acquire images of objects, detecting object areas, performing pixel sampling processing, determining the initial color category based on pixel values, comparing it with a preset color category set to determine the target color category, calculating similarity values using RGB, HSV, and LAB color spaces, and processing light and dark objects using cameras with different exposure times.
It improves the efficiency and accuracy of color classification by reducing the amount of data to be processed and accurately determining the color category, thus achieving efficient color classification.
Smart Images

Figure CN114677538B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence, and more particularly to a color classification method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the development of technology, there are more and more items, and the colors of these items are becoming increasingly diverse. People's demand for color-sorting of items is growing. For example, waste textiles can be sorted by color so that fibers can be recycled and reused.
[0003] Currently, color classification of items is typically done manually. However, manual classification is inefficient and inaccurate. Furthermore, the presence of mixed colors within the same item (e.g., red and yellow mixed in different proportions) increases the difficulty of color classification, further reducing the efficiency and accuracy of manual classification. Therefore, a new color classification method is urgently needed to improve both efficiency and accuracy. Summary of the Invention
[0004] In view of the above, it is necessary to provide a color method, apparatus, electronic device, and storage medium, which aim to improve the efficiency and accuracy of color classification.
[0005] The color classification method provided by this invention includes:
[0006] Control the first camera to acquire a first image of the items to be classified, and detect the item regions in the first image;
[0007] Perform pixel sampling processing on the object region in the first image to obtain the first pixel set;
[0008] Based on the pixel values of the pixels in the first pixel set, the initial color category of the item to be classified is determined;
[0009] When the initial color category is any color category in the preset color category set, the initial color category is used as the target color category of the item to be classified.
[0010] Optionally, controlling the first camera to acquire a first image of the items to be classified includes:
[0011] When items to be sorted are detected on the conveyor device, the first start-up time of the first camera is determined;
[0012] The first exposure time of the first camera is obtained, and the first camera is controlled to acquire the first image of the item to be classified based on the first start time and the first exposure time.
[0013] Optionally, determining the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set includes:
[0014] Based on the pixel value of each pixel in the first pixel set, determine the color category corresponding to each pixel in the first pixel set;
[0015] The color category distribution data of pixels in the first pixel set are statistically analyzed, and the color category of the item to be classified is determined based on the statistical results.
[0016] Optionally, determining the color category corresponding to each pixel in the first pixel set based on the pixel value of each pixel in the first pixel set includes:
[0017] Obtain the standard value of each color category corresponding to the first camera in each color space;
[0018] Based on the standard value and the pixel value of each pixel, calculate the similarity value between each pixel in the first pixel set and each color category;
[0019] The color category corresponding to each pixel in the first pixel set is determined based on the similarity value.
[0020] Optionally, after setting the initial color category as the target color category for the item to be classified when the initial color category is any color category in the preset color category set, the method further includes:
[0021] Determine the collection device corresponding to the target color category, and calculate the second start-up time of the collection device;
[0022] The collection device is activated based on the second start time, and the collection device is controlled to collect the items to be classified.
[0023] Optionally, after determining the initial color category of the item to be classified based on the pixel values of the pixels in the first set of pixels, the method further includes:
[0024] If the initial color category does not belong to any color category in the preset color category set, then the third startup time of the second camera is determined;
[0025] The second exposure time of the second camera is obtained, and the second camera is controlled to acquire a second image of the item to be classified based on the third start time and the second exposure time.
[0026] Determine the target color category of the item to be classified based on the second image;
[0027] The items to be classified are collected into the collection device corresponding to the target color category.
[0028] Optionally, the color space includes RGB color space, HSV color space, and LAB color space, and the formula for calculating the similarity value is:
[0029]
[0030] Wherein, D(S) i ,L j () represents the similarity value between the i-th pixel and the j-th color category in the first pixel set, dis RGB (S i ,L j The similarity value () represents the similarity between the RGB space value of the i-th pixel in the first pixel set and the standard RGB space value of the j-th color category. HSV (S i ,L j The value () represents the similarity between the pixel value of the i-th pixel in the HSV space and the standard value of the j-th color category in the HSV space. LAB (S i ,L j ) represents the similarity value between the pixel value of the i-th pixel in the LAB space and the standard value of the j-th color category in the LAB space. α1, α2 and α3 are the weights corresponding to the similarity ratios between RGB space and HSV space, HSV space and LAB space, and LAB space and RGB space, respectively.
[0031] To address the above problems, the present invention also provides a color sorting device, the device comprising:
[0032] The detection module is used to control the first camera to acquire a first image of the items to be classified and to detect the item regions in the first image;
[0033] The sampling module is used to perform pixel sampling processing on the object region in the first image to obtain a first set of pixels;
[0034] The identification module is used to determine the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set;
[0035] The classification module is used to use the initial color category as the target color category of the item to be classified when the initial color category is any color category in a preset color category set.
[0036] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:
[0037] At least one processor; and,
[0038] A memory communicatively connected to the at least one processor; wherein,
[0039] The memory stores a color classification program that can be executed by the at least one processor, the color classification program being executed by the at least one processor to enable the at least one processor to perform the above-described color classification method.
[0040] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing a color classification program, which can be executed by one or more processors to implement the aforementioned color classification method.
[0041] Compared to existing technologies, this invention first controls a first camera to acquire a first image of the item to be classified, detecting the item region in the first image; then, pixel sampling processing is performed on the item region in the first image to obtain a first set of pixels; based on the pixel values of the pixels in the first set of pixels, the initial color category of the item to be classified is determined; when the initial color category is any color category in a preset color category set, the initial color category is taken as the target color category of the item to be classified. This invention reduces the amount of data to be processed and improves color classification efficiency through pixel sampling; by first detecting the initial color category of the item to be classified and then comparing the initial color category with a preset color category set to determine the target color category, the accuracy of color classification is improved. Therefore, this invention improves both color classification efficiency and accuracy. Attached Figure Description
[0042] Figure 1 This is a flowchart illustrating a color classification method provided in an embodiment of the present invention;
[0043] Figure 2 This is a schematic diagram of a color classification device provided in an embodiment of the present invention;
[0044] Figure 3 This is a schematic diagram of the structure of an electronic device that implements a color classification method according to an embodiment of the present invention.
[0045] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0046] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0047] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0048] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.
[0049] It should be noted that the descriptions involving "first," "second," etc., in this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0050] This invention provides a color classification method. (Refer to...) Figure 1 The diagram shown is a schematic flowchart of a color classification method provided in an embodiment of the present invention. This method can be executed by an electronic device, which can be implemented in software and / or hardware.
[0051] In this embodiment, the color classification method includes the following steps S1-S4:
[0052] S1. Control the first camera to acquire the first image of the items to be classified, and detect the item area in the first image.
[0053] The item to be classified can be a single item or multiple items (e.g., a batch of waste textiles). The first camera is a low-exposure image acquisition camera, which is more suitable for color recognition of light-colored items.
[0054] In one embodiment of the present invention, the items to be sorted are conveyed by a conveying device, with a certain distance between each two items to be sorted. During the conveying process, images of the items to be sorted are captured, color recognition is performed based on the captured images, and the items to be sorted are sorted into collection devices of the corresponding colors based on the color recognition results.
[0055] The conveying device includes a drive motor, impellers, and a conveyor belt, which can be a chain conveyor or a belt conveyor.
[0056] The process of controlling the first camera to acquire a first image of the items to be classified includes the following steps A11-A12:
[0057] A11. When items to be sorted are detected on the conveying device, the first start time of the first camera is determined;
[0058] In this embodiment, the position of the items to be classified is detected by a laser detection transmitter. The first start time of the first camera is determined based on the detected position, the running speed of the conveyor belt, and the position of the first camera, so that the first camera can capture complete and clear images of the items to be classified.
[0059] To ensure the accuracy of position detection of items to be sorted, laser detection sensors can be installed in a through-beam manner, with the installation height determined based on the height of the conveyor belt and the items to be sorted.
[0060] A12. Obtain the first exposure time of the first camera, and control the first camera to acquire the first image of the item to be classified based on the first start time and the first exposure time.
[0061] In this embodiment, the optimal exposure time of the first camera in the light color recognition scenario was determined in advance through experimental verification, and this time was used as the first exposure time of the first camera. The first exposure time can be between 500ms and 800ms.
[0062] In this embodiment, the object region in the first image is detected by a contour detection method, which includes various detection methods such as the Canny operator, Sobel operator, Rewitt operator, Roberts operator, Robinson operator, Laplace operator, and Log operator.
[0063] S2. Perform pixel sampling processing on the object area in the first image to obtain the first pixel set.
[0064] To accelerate color recognition efficiency, this embodiment performs uniform sampling on the object area in the first image, and then performs color recognition based on the sampled first pixel set, thereby reducing the amount of data to be processed.
[0065] In this embodiment, sampling can be performed according to a preset step size, for example, performing a pixel sampling operation every 10 pixels.
[0066] S3. Determine the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set.
[0067] Determining the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set includes the following steps B11-B12:
[0068] B11. Determine the color category corresponding to each pixel in the first pixel set based on the pixel value of each pixel in the first pixel set;
[0069] The step of determining the color category corresponding to each pixel in the first pixel set based on the pixel value of each pixel in the first pixel set includes the following steps C11-C13:
[0070] C11. Obtain the standard value of each color category corresponding to the first camera in each color space;
[0071] The color space includes RGB color space, HSV color space and LAB color space. The pixel value of each pixel in the first pixel set in each color space can be obtained from the first image.
[0072] In this embodiment, multiple sample images captured by the first camera are analyzed in advance to obtain the standard value of each color category corresponding to the first camera in each color space.
[0073] C12. Based on the standard value and the pixel value of each pixel, calculate the similarity value between each pixel in the first pixel set and each color category;
[0074] The formula for calculating the similarity value is:
[0075]
[0076] Wherein, D(S) i ,L j () represents the similarity value between the i-th pixel and the j-th color category in the first pixel set, dis RGB (S i ,L jThe similarity value () represents the similarity between the RGB space value of the i-th pixel in the first pixel set and the standard RGB space value of the j-th color category. HSV (S i ,L j The value () represents the similarity between the pixel value of the i-th pixel in the HSV space and the standard value of the j-th color category in the HSV space. LAB (S i ,L j ) represents the similarity value between the pixel value of the i-th pixel in the LAB space and the standard value of the j-th color category in the LAB space. α1, α2 and α3 are the weights corresponding to the similarity ratios between RGB space and HSV space, HSV space and LAB space, and LAB space and RGB space, respectively.
[0077] The similarity value can be cosine similarity, Euclidean distance, Manhattan distance, Chebyshev distance, and Hamming distance.
[0078] C13. Determine the color category corresponding to each pixel in the first pixel set based on the similarity value.
[0079] In this embodiment, the color category with the smallest similarity value among multiple similarity values corresponding to each pixel is taken as the color category corresponding to each pixel.
[0080] B12. Statistically analyze the color category distribution data of pixels in the first pixel set, and determine the color category of the item to be classified based on the statistical results.
[0081] In this embodiment, the color category of each pixel in the first pixel set is counted, and the color category of the item to be classified is determined according to the number of pixels corresponding to each color category and the first rule.
[0082] For example, the first rule could include:
[0083] If the proportion of red pixels in the first pixel set is greater than 80%, then the item to be classified is red.
[0084] If the proportion of white + yellow pixels in the first pixel set is greater than 75%, and the proportion of white pixels in the first pixel set is greater than 60%, then the item to be classified is white.
[0085] If the proportion of green + white pixels in the first pixel set is greater than 60%, and the proportion of green pixels in the first pixel set is greater than 40%, then the item to be classified is green.
[0086] ...
[0087] S4. When the initial color category is any color category in the preset color category set, the initial color category is taken as the target color category of the item to be classified.
[0088] In this embodiment, the preset color category set is the light color category.
[0089] After setting the initial color category as the target color category of the item to be classified when the initial color category is any color category in the preset color category set, the method further includes the following steps D11-D12:
[0090] D11. Determine the collection device corresponding to the target color category and calculate the second start-up time of the collection device;
[0091] D12. Start the collection device based on the second start time and control the collection device to collect the items to be classified.
[0092] In this embodiment, each light color category corresponds to a collection device. Each collection device includes a collection bucket, a push rod, a push rod assist mechanism, and a baffle. Each collection device is located at a different position behind the first camera, and every two collection devices are separated by a baffle.
[0093] After determining the collection device corresponding to the target color category, the second start time of the collection device is calculated based on the location of the collection device and the running speed of the conveyor belt, and the collection device is started at the second start time.
[0094] After determining the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set, the method further includes the following steps E11-E14:
[0095] E11. If the initial color category does not belong to any color category in the preset color category set, then determine the third start-up time of the second camera;
[0096] If the initial color category is not a light color, for example, if the initial color category is black or dark blue, then a second camera is used to capture an image of the item to be classified, and the color recognition of the item to be classified is continued based on the image.
[0097] The second camera is a high-exposure image acquisition camera, which is more suitable for color recognition of dark-colored objects.
[0098] The real-time position of the items to be sorted on the conveyor belt is detected by a laser detection sensor. Based on the real-time position, the running speed of the conveyor belt, and the position of the second camera, the third start time of the second camera is determined so that the second camera can capture a complete and clear image of the items to be sorted.
[0099] E12. Obtain the second exposure time of the second camera, and control the second camera to acquire the second image of the item to be classified according to the third start time and the second exposure time;
[0100] The second exposure time can be between 1200ms and 1500ms.
[0101] E13. Determine the target color category of the item to be classified based on the second image;
[0102] This step is similar to the initial color category identification process of the first image described in S1-S3. A second set of pixels is collected from the second image, and the target color category corresponding to the item to be classified is determined according to a second rule. The second rule may be:
[0103] If the proportion of black pixels in the second pixel set is greater than 80%, then the item to be classified is black.
[0104] If the proportion of blue + gray pixels in the second pixel set is greater than 70%, and the proportion of blue pixels in the second pixel set is greater than 50%, then the item to be classified is blue.
[0105] If the proportion of purple + black pixels in the second pixel set is greater than 75%, and the proportion of purple pixels in the second pixel set is greater than 50%, then the item to be classified is purple.
[0106] ...
[0107] E14. Collect the items to be classified into the collection device corresponding to the target color category.
[0108] A collection device is set up after the second camera for each dark color category. The collection device for each light color category can be set up after the second camera or between the first and second cameras.
[0109] As can be seen from the above embodiments, the color classification method proposed in this invention firstly controls a first camera to acquire a first image of the item to be classified, and detects the item region in the first image; performs pixel sampling processing on the item region in the first image to obtain a first pixel set; determines the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set; when the initial color category is any color category in a preset color category set, the initial color category is taken as the target color category of the item to be classified. This invention reduces the amount of data to be processed and improves color classification efficiency through pixel sampling; by first detecting the initial color category of the item to be classified and then comparing the initial color category with a preset color category set to determine the target color category, it improves color classification accuracy. Therefore, this invention improves both color classification efficiency and accuracy.
[0110] like Figure 2 The diagram shown is a schematic diagram of a color classification device provided in an embodiment of the present invention.
[0111] The color classification device 100 of this invention can be installed in an electronic device. Depending on the functions implemented, the color classification device 100 may include a detection module 110, a sampling module 120, a recognition module 130, and a classification module 140. The module described in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and which are stored in the memory of the electronic device.
[0112] In this embodiment, the functions of each module / unit are as follows:
[0113] The detection module 110 is used to control the first camera to acquire a first image of the items to be classified and to detect the item area in the first image.
[0114] The process of controlling the first camera to acquire a first image of the items to be classified includes the following steps A21-A22:
[0115] A21. When items to be sorted are detected on the conveying device, the first start time of the first camera is determined;
[0116] A22. Obtain the first exposure time of the first camera, and control the first camera to acquire the first image of the item to be classified based on the first start time and the first exposure time.
[0117] The sampling module 120 is used to perform pixel sampling processing on the object area in the first image to obtain a first set of pixels.
[0118] The identification module 130 is used to determine the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set.
[0119] Determining the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set includes the following steps B21-B22:
[0120] B21. Determine the color category corresponding to each pixel in the first pixel set based on the pixel value of each pixel in the first pixel set;
[0121] B22. Statistically analyze the color category distribution data of pixels in the first pixel set, and determine the color category of the item to be classified based on the statistical results.
[0122] The step of determining the color category corresponding to each pixel in the first pixel set based on the pixel value of each pixel in the first pixel set includes the following steps C21-C23:
[0123] C21. Obtain the standard value of each color category corresponding to the first camera in each color space;
[0124] C22. Based on the standard value and the pixel value of each pixel, calculate the similarity value between each pixel in the first pixel set and each color category;
[0125] The color space includes RGB color space, HSV color space, and LAB color space. The formula for calculating the similarity value is:
[0126]
[0127] Wherein, D(S) i ,L j () represents the similarity value between the i-th pixel and the j-th color category in the first pixel set, dis RGB (S i ,L j The similarity value () represents the similarity between the RGB space value of the i-th pixel in the first pixel set and the standard RGB space value of the j-th color category. HSV (S i ,L j The value () represents the similarity between the pixel value of the i-th pixel in the HSV space and the standard value of the j-th color category in the HSV space. LAB (S i ,L j) represents the similarity value between the pixel value of the i-th pixel in the LAB space and the standard value of the j-th color category in the LAB space. α1, α2 and α3 are the weights corresponding to the similarity ratios between RGB space and HSV space, HSV space and LAB space, and LAB space and RGB space, respectively.
[0128] C23. Determine the color category corresponding to each pixel in the first pixel set based on the similarity value.
[0129] The classification module 140 is used to take the initial color category as the target color category of the item to be classified when the initial color category is any color category in the preset color category set.
[0130] After setting the initial color category as the target color category of the item to be classified when the initial color category is any color category in the preset color category set, the method further includes the following steps D21-D22:
[0131] D21. Determine the collection device corresponding to the target color category and calculate the second start-up time of the collection device;
[0132] D22. Start the collection device based on the second start time and control the collection device to collect the items to be classified.
[0133] After determining the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set, the method further includes the following steps E21-E24:
[0134] E21. If the initial color category does not belong to any color category in the preset color category set, then determine the third startup time of the second camera;
[0135] E22. Obtain the second exposure time of the second camera, and control the second camera to acquire the second image of the item to be classified according to the third start time and the second exposure time;
[0136] E23. Determine the target color category of the item to be classified based on the second image;
[0137] E24. Collect the items to be classified into the collection device corresponding to the target color category.
[0138] like Figure 3 The diagram shown is a structural schematic of an electronic device that implements a color classification method according to an embodiment of the present invention.
[0139] The electronic device 1 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. The electronic device 1 can be a computer, a single network server, a server group composed of multiple network servers, or a cloud based on cloud computing, which is a type of distributed computing consisting of a super virtual computer composed of a group of loosely coupled computers.
[0140] In this embodiment, the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can be interconnected via a system bus. The memory 11 stores a color classification program 10, which can be executed by the processor 12. Figure 3 Only the electronic device 1 having components 11-13 and color sorting program 10 is shown. Those skilled in the art will understand that... Figure 3 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0141] The memory 11 includes RAM and at least one type of readable storage medium. The RAM provides a cache for the operation of the electronic device 1; the readable storage medium can be a non-volatile storage medium such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the readable storage medium can be an internal storage unit of the electronic device 1, such as the hard disk of the electronic device 1; in other embodiments, the non-volatile storage medium can also be an external storage device of the electronic device 1, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 1. In this embodiment, the readable storage medium of the memory 11 is typically used to store the operating system and various application software installed on the electronic device 1, such as storing the code of the color classification program 10 in one embodiment of the present invention. Furthermore, the memory 11 can also be used to temporarily store various types of data that have been output or will be output.
[0142] In some embodiments, processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. Processor 12 is typically used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication with other devices. In this embodiment, processor 12 is used to run program code stored in memory 11 or process data, such as running color classification program 10.
[0143] The network interface 13 may include a wireless network interface or a wired network interface, which is used to establish a communication connection between the electronic device 1 and the client (not shown in the figure).
[0144] Optionally, the electronic device 1 may further include a user interface, which may include a display, an input unit such as a keyboard, and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual user interface.
[0145] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0146] The color classification program 10 stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When run in the processor 12, it can implement the above-mentioned color classification method.
[0147] Specifically, the processor 12's implementation method for the aforementioned color classification program 10 can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0148] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be non-volatile or otherwise. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0149] The computer-readable storage medium stores a color classification program 10, which can be executed by one or more processors to implement the above-described color classification method.
[0150] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0151] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0152] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0153] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0154] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0155] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0156] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The term "second class" is used to indicate names and does not indicate any specific order.
[0157] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A color classification method, characterized in that, The method includes: Control the first camera to acquire a first image of the items to be classified, and detect the item regions in the first image; Perform pixel sampling processing on the object region in the first image to obtain the first pixel set; Based on the pixel values of the pixels in the first pixel set, the initial color category of the item to be classified is determined; When the initial color category is any color category in the preset color category set, the initial color category is taken as the target color category of the item to be classified. The method further includes, after determining the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set, the following steps: if the initial color category does not belong to any color category in the preset color category set, determining a third start-up time of the second camera; acquiring a second exposure time of the second camera, and controlling the second camera to acquire a second image of the item to be classified according to the third start-up time and the second exposure time; determining a target color category of the item to be classified based on the second image; and collecting the item to be classified into a collection device corresponding to the target color category. The color space includes RGB color space, HSV color space, and LAB color space. The formula for calculating the similarity value is: in, This represents the similarity value between the i-th pixel and the j-th color category in the first set of pixels. This represents the similarity value between the RGB space pixel value of the i-th pixel in the first pixel set and the standard RGB space value of the j-th color category. This represents the similarity value between the pixel value in HSV space of the i-th pixel in the first pixel set and the standard value in HSV space of the j-th color category. This represents the similarity value between the pixel value in the LAB space of the i-th pixel in the first pixel set and the standard value in the LAB space of the j-th color category. , and These represent the weights corresponding to the similarity ratios between RGB and HSV spaces, HSV and LAB spaces, and LAB and RGB spaces, respectively.
2. The color classification method as described in claim 1, characterized in that, The control of the first camera to acquire a first image of the items to be classified includes: When items to be sorted are detected on the conveyor device, the first start-up time of the first camera is determined; The first exposure time of the first camera is obtained, and the first camera is controlled to acquire the first image of the item to be classified based on the first start time and the first exposure time.
3. The color classification method as described in claim 1, characterized in that, Determining the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set includes: Based on the pixel value of each pixel in the first pixel set, determine the color category corresponding to each pixel in the first pixel set; The color category distribution data of pixels in the first pixel set are statistically analyzed, and the color category of the item to be classified is determined based on the statistical results.
4. The color classification method as described in claim 3, characterized in that, The step of determining the color category corresponding to each pixel in the first pixel set based on the pixel value of each pixel in the first pixel set includes: Obtain the standard value of each color category corresponding to the first camera in each color space; Based on the standard value and the pixel value of each pixel, calculate the similarity value between each pixel in the first pixel set and each color category; The color category corresponding to each pixel in the first pixel set is determined based on the similarity value.
5. The color classification method as described in claim 1, characterized in that, After setting the initial color category as the target color category for the item to be classified when the initial color category is any color category in a preset color category set, the method further includes: Determine the collection device corresponding to the target color category, and calculate the second start-up time of the collection device; The collection device is activated based on the second start time, and the collection device is controlled to collect the items to be classified.
6. A color classification device for implementing the color classification method as described in any one of claims 1 to 5, characterized in that, The device includes: The detection module is used to control the first camera to acquire a first image of the items to be classified and to detect the item regions in the first image; The sampling module is used to perform pixel sampling processing on the object region in the first image to obtain a first set of pixels; The identification module is used to determine the initial color category of the item to be classified based on the pixel values of the pixels in the first pixel set; The classification module is used to use the initial color category as the target color category of the item to be classified when the initial color category is any color category in a preset color category set.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a color classification program that can be executed by the at least one processor, the color classification program being executed by the at least one processor to enable the at least one processor to perform the color classification method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a color classification program, which can be executed by one or more processors to implement the color classification method as described in any one of claims 1 to 5.