OpenCV-based kitchen garbage automatic bag breaking and classified collection system
Through the automatic kitchen waste breaking bag classification and collection system based on OpenCV-based vision module and control module, the existing devices are solved, and the automation of kitchen waste and the high safety breaking bag classification are realized, which improves the convenience of residents' classification and disposal and the utilization rate of garbage resource.
Patent Information
- Application Number
- CN202510413982.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-07-04
AI Technical Summary
The existing kitchen waste sorting devices have problems such as complex operation, unhygienic, poor safety, high cost, and difficulty in adapting to plastic bags of different specifications, resulting in low enthusiasm for classification and difficulty in maintenance and management.
The automatic kitchen waste breaking bag classification and collection system is adopted based on OpenCV vision module and control module, and the image processing is performed using the Raspberry Pi Linux platform and USB camera. Combined with I2C communication and hardware control, it realizes automatic adjustment, breaking bags and classification of plastic bags, including oil and water separation, overflow monitoring and remote monitoring functions.
It has realized the automation, high safety and strong adaptability of kitchen waste, improved the convenience and enthusiasm of residents to distribute classified waste, reduced maintenance and management costs, and improved the utilization rate of garbage resource.
Smart Images

Figure CN120246477A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of kitchen waste treatment devices, specifically an automatic bag-breaking and classification collection system for kitchen waste based on OpenCV. Background Art
[0002] In the context of waste sorting, many residents can separate and collect kitchen waste in bags at home. However, the last step of putting it in the bin dampens the enthusiasm of many residents. The reason is that at present, when residents dispose of kitchen waste, they mostly separate the plastic bags and kitchen waste manually. That is, they first pour the kitchen waste from the bag into the kitchen waste bin, and then throw the plastic bag into another bin. This process not only easily gets the hands dirty but also often causes problems such as a lot of dripping and a strong smell around the recycling point. The process is relatively troublesome and unhygienic.
[0003] For this reason, special bag-breaking devices have emerged on the market. At present, there are not many bag-breaking solutions. The two most common ones are as follows: One is the "bag-breaking magic tool", which is essentially a serrated blade fixed on the trash can. It is easy to make and has a low cost. However, when breaking the bag, it still relies on manual operation, and the blade is exposed, resulting in poor safety and unattractiveness. The other is the "automatic bag-breaking dispenser". Its working principle is to directly throw the garbage onto a round hole, and the mechanical claw clamps the handle of the plastic bag exposed on the surface, and then the knife inside the round hole pierces the bag. This device can achieve bag-breaking and classification. However, its claw has only one moving dimension and can only move left and right, and cannot move up and down. Therefore, the clamping position is fixed. The types and sizes of plastic bags for packing kitchen waste are diverse. The capacity and volume of plastic bags vary, and the widths are different; the handles are of the vest type or drawstring type, and the lengths are different. For various reasons, the bottom position of the plastic bag is not fixed during placement. When the plastic bag is small in volume or soft in material, the claw often cannot clamp it, and it cannot break the bag of any specification of plastic bag. Moreover, when separating the plastic bag, the plastic bag is dragged into another bucket, which causes the rest of the device to be stained with garbage exudate, increasing the maintenance and management cost, and its price is expensive, making it difficult to promote.
[0004] In this context, there is an urgent need to study a device that uses technologies such as artificial intelligence and automation to assist the last link of kitchen waste sorting and placement, and realizes contactless placement and automatic bag-breaking and classification collection. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to overcome the above-mentioned technical defects and provide an automatic bag-breaking and classification collection system for kitchen waste based on OpenCV.
[0006] To solve the above technical problems, the technical solution provided by the present invention is an automatic bag-breaking and classification collection system for kitchen waste based on OpenCV: including a frame, on which a bag-breaking mechanism, an oil-water separation device, a processing and control device, a kitchen waste collection box, and a plastic bag collection box are provided. The processing and control device includes a vision module and a control module.
[0007] The vision module is used to judge the position of the plastic bag and identify the bag-breaking situation. It is written in Python language and runs on the Raspberry Pi Linux platform. The Raspberry Pi collects images through a USB-connected camera, processes and judges the images, and communicates with the control module through I2C communication to control the bag-breaking mechanism to adjust the plastic bag to a specified position and perform bag-breaking and classification. Among them, image processing and judgment are based on opencv.
[0008] The control module receives instructions from the vision module through I2C communication, controls the hardware, and thus completes the bag-breaking and classification collection work. The hardware includes a stepper motor, a servo motor, and a sensor.
[0009] Further, the control module uses a MEGA2560 development board as the main controller.
[0010] The advantages of the present invention compared with the prior art are as follows: The present invention can realize functions such as size judgment, position detection and automatic adjustment of garbage, automatic bag-breaking separation and bag-breaking state recognition, overflow monitoring and oil-water separation, intelligent weighing, and remote monitoring. It has simple operation, high safety, good aesthetics, is applicable to various existing garbage bags, and can solve problems such as complex and unhygienic traditional classification and placement processes, inconvenient use, low enthusiasm of the masses for classification, and troublesome maintenance and management. It is beneficial to improve the convenience and enthusiasm of residents for classifying and placing kitchen waste, is beneficial to the subsequent treatment of garbage, improves the resource utilization rate of kitchen waste, and reduces the impact of kitchen waste on the living environment. Description of the Drawings
[0011] Figure 1 is a structural schematic diagram of the automatic bag-breaking and classification collection system for kitchen waste based on OpenCV of the present invention Figure 1 。
[0012] Figure 2 is a structural schematic diagram of the automatic bag-breaking and classification collection system for kitchen waste based on OpenCV of the present invention Figure 2 。
[0013] Figure 3 is a system framework diagram of the automatic bag-breaking and classification collection system for kitchen waste based on OpenCV of the present invention.
[0014] Figure 4 is an image processing flow chart of the automatic bag-breaking and classification collection system for kitchen waste based on OpenCV of the present invention.
[0015] Figure 5 It is the bag-breaking flow chart of the automatic bag-breaking and classification collection system for kitchen waste based on OpenCV of the present invention.
[0016] Figure 6 It is the schematic diagram of oil-water separation of the automatic bag-breaking and classification collection system for kitchen waste based on OpenCV of the present invention.
[0017] Figure 7 It is the remote monitoring interface of the automatic bag-breaking and classification collection system for kitchen waste based on OpenCV of the present invention.
[0018] Figure 8 It is the flow chart of the weighing algorithm of the automatic bag-breaking and classification collection system for kitchen waste based on OpenCV of the present invention.
[0019] As shown in the figure:
[0020] 1. Frame, 2. Bag-breaking mechanism, 3. Oil-water separation equipment, 4. Processing and control equipment, 5. Kitchen waste collection box, 6. Plastic bag collection box. Specific implementation manners
[0021] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Usually, the components of the embodiments of the present invention described and illustrated herein can be arranged and designed in various different configurations.
[0022] Example 1, in combination with the attached Figure 1-8 , an automatic bag-breaking and classification collection system for kitchen waste based on OpenCV, including a frame 1, on which a bag-breaking mechanism 2, an oil-water separation equipment 3, a processing and control equipment 4, a kitchen waste collection box 5, and a plastic bag collection box 6 are provided, and the processing and control equipment 4 includes a vision module and a control module;
[0023] The visual module is used to judge the position of the plastic bag and identify the bag-breaking condition. It is written in Python and runs on the Raspberry Pi Linux platform. The Raspberry Pi connects to the camera through USB to collect images, process and judge the images, and communicates with the control module through I2C to control the bag-breaking mechanism 2 to adjust the plastic bag to the specified position and perform bag-breaking classification. Among them, image processing and judgment are based on OpenCV. On the premise that the background is arranged as white, use OpenCV to pull the video stream from the camera, set the image resolution to 1280x720, read the images frame by frame, and convert the original BGR color image to a grayscale image; perform binaryzation processing on the grayscale image, set the areas with darker colors to white and the rest to black to separate the target object from the background for subsequent contour analysis of the image; perform morphological transformation operations to eliminate holes and noise in the binaryzation image and enhance the connectivity of the object contours; detect the edge contours in the image through contour detection, traverse and calculate the contour areas, and filter out the contours with too small areas according to the set threshold to find the edges of the object; perform polygon approximation. If the approximated polygon has 4 vertices and a shape similar to that of a plastic bag, it can be determined that the object is the target object, draw a rectangular frame to mark the target object, and finally use the numpy library to traverse the target object contour to calculate the coordinates of the leftmost point, rightmost point, and bottommost point of the plastic bag contour and save them to provide a data basis for subsequent detection of the position and identification of the bag-breaking condition;
[0024] In the images collected by the bag-breaking system, the elements are relatively single. The plastic bag occupies most of the picture, and the shapes of plastic bags of different specifications have small differences. The width increases from top to bottom. Therefore, these characteristics are cleverly utilized in the algorithm for visually detecting the position and size of the plastic bag and identifying the bag-breaking condition. The target object (plastic bag) has been marked in the previous image processing, and the coordinates of the relevant points of the plastic bag contour have been obtained;
[0025] By calculating the difference between left_most[X] and right_most[X] and the value of bottom_most[Y], the relative width and relative length of the plastic bag can be obtained, and then used to judge the size of the plastic bag:
[0026] Calculate the relative size:
[0027] Rel_Size = left_most[X] - right_most[X];
[0028] Calculate the actual size:
[0029] Actual_Size = Rel_Size / Res_W * Ref_W
[0030] (Res_W is the resolution width and Ref_W is the image reference width);
[0031] Calculate the midpoint of left_most[X] and right_most[X] to determine the horizontal position, and bottom_most[Y] to determine the vertical position:
[0032] Determine the horizontal position:
[0033] Lev_Location = (left_most[X] + right_most[X]) * Ref_W / Res_W * 2;
[0034] Determine the vertical position:
[0035] Ver_Location = bottom_most[Y] / Res_H * Ref_H (Res_H is the resolution height and Ref_H is the image reference height);
[0036] Identify whether the food waste in the plastic bag is separated by judging the change in the relative size value and the change in shape at different time points:
[0037] Bag-breaking condition judgment:
[0038] Time_1: Wide_1 = left_most[X] - right_most[X]
[0039] Shape_1 = (bottom_most[Y] - top_mid_most[Y]) / Wide_1
[0040] Time_2: Wide_2 = left_most[X] - right_most[X]
[0041] Shape_2 = (bottom_most[Y] - top_mid_most[Y]) / Wide_2
[0042] Wide = Wide_1 - Wide_2
[0043] Judge: If ((Wide / Wide_1 > Tsd_1) or (Shape_2 / Shape_1 > Tsd_1)):
[0044] return True (Bag-breaking completed)
[0045] Else:
[0046] return False (Bag-breaking failed)
[0047] (Tsd_1 and Tsd_2 are thresholds, 30% < Tsd_1 < 70%; 1 < Tsd_1 < 2);
[0048] The control module receives instructions from the vision module through I2C communication, controls the hardware, and thus completes the work of bag-breaking classification and collection. The hardware includes a stepper motor, a servo motor, and sensors.
[0049] The control module uses a MEGA2560 development board as the main controller. It has more than fifty I / O ports, which are fully sufficient to control three stepper motors, two servo motors, a robotic arm, and multiple sensors. It exchanges data with the Raspberry Pi through I2C communication. The specific functions are realized as follows:
[0050] (1) Mobile control structure: The moving device uses a stepper motor as the power and combines with a slide rail to achieve precise movement in the horizontal and vertical directions.
[0051] (2) Design of the overflow monitoring function: The ultrasonic sensor monitors the distance from the surface of the food waste in the food waste bin to the bin mouth, thereby inferring the remaining capacity of the food waste bin, and sending the remaining capacity information to the Raspberry Pi through I2C communication. If the remaining capacity is lower than the limit value, relevant alarm messages will be pushed.
[0052] (3) Design of the remote monitoring function: The Raspberry Pi connects to the wireless network, receives control instructions sent by the blinker client through tcp communication, and then forwards the received instructions to the main control unit of the control module to achieve remote control
[0053] (4) Design of the intelligent weighing function: A high-precision strain gauge pressure sensor and a 24-bit A / D converter module HX711 are used. The initial weight data at startup is designed to be zero. When the weight changes, it accumulates continuously, and the data is sent to the client through the Raspberry Pi.
[0054] In this specific embodiment, the implementation of the oil-water separation function is first to separate the solid and liquid substances in the food waste through a filter screen, and then pump the filtered oil-water mixture to the oil-water separation device through a small water pump. The oil-water separation device adopts a non-powered design. According to the characteristic of different oil and water densities, through a clever structure, the oil and water can be separated only by relying on the weight of the liquid.
[0055] In this specific embodiment:
[0056] Image Processing Implementation Method: The implementation of the vision module is based on the OpenCV image processing library and is written in Python. First, the video stream is obtained from the camera through cv2.VideoCapture(), and the image resolution is set to 1280x720. The original BGR color image is converted to a grayscale image through cv2.cvtColor(), and cv2.threshold() is used for binarization processing. The output binary image is compared with the actual image. Since the background is set to white and there are few objects in the picture, the approximate shape of the target object (plastic bag) can be easily separated. Then, cv2.morphologyEx() is used for morphological transformation to eliminate holes and noise in the binary image. At this time, the plastic bag in the image is separated more completely. Then, cv2.findContours() is used to detect the edge contours in the image, and the contour area is calculated. Contours with too small an area are filtered out, and finally the edges of the target object are determined. Through cv2.approxPolyDP() polygon approximation, it is determined whether the shape of the target object is similar to that of a plastic bag. If the conditions are met, cv2.drawContours() is used to draw a rectangular box to mark the target object, and the coordinates of the leftmost point, rightmost point, bottommost point, and topmost point are saved. These coordinate data can be used for subsequent plastic bag size judgment and broken bag status recognition. The visual judgment of position and recognition of broken bag status are written in Python and run on the Raspberry Pi Linux platform. The camera is connected to the Raspberry Pi through USB. The collected images are processed and judged by the Raspberry Pi. Finally, the Raspberry Pi communicates with the processing unit of the control module through I2C communication to control the plastic bag to be adjusted to the specified position and perform bag breaking.
[0057] Automatic Bag Breaking and Automatic Separation Implementation Method: The control module is based on the MEGA2560 development board and receives instructions from the vision module through I2C communication to perform a series of controls on hardware such as stepper motors, servos, and sensors to carry out bag breaking, classification, and collection work. When the system is triggered, the vision module works, and the stepper motor is controlled to move horizontally and vertically to adjust the plastic bag to a fixed position. After the position is determined, the robotic arm with multi-angle blades is controlled to move horizontally and vertically to cut the plastic bag. Then, the motor controls the plastic bag to shake rapidly up and down to make the things inside the plastic bag fall off as much as possible. After the bag breaking operation is completed, the broken bag status is recognized through vision. If the bag breaking meets the standard, the separation operation is performed. The motor moves the plastic bag horizontally to move the plastic bag above the plastic bag collection box, and the hook is controlled to perform the dropping action. Finally, the plastic bag is separated.
[0058] Remote monitoring implementation method: Remote monitoring is achieved by connecting the Raspberry Pi to the blinker platform. The connection is based on MQTT communication. Instructions are sent through the blinker client. After receiving the instructions, the Raspberry Pi converts them to the control module. At the same time, the control module also sends relevant sensor data to the blinker platform through the Raspberry Pi.
[0059] Overflow monitoring implementation method: Overflow monitoring is achieved by setting up an ultrasonic ranging module above the kitchen waste bin. Using the HC-SR04 ultrasonic ranging module, its working principle is to calculate the distance by the time difference between transmitting ultrasonic waves and receiving reflections. The ultrasonic ranging module monitors the height of the garbage in the bin in real time, thereby inferring the remaining capacity of the kitchen waste bin.
[0060] Intelligent weighing implementation method: Weighing uses a high-precision strain gauge pressure sensor and a 24-bit A / D converter module HX711. HX711 is a 24-bit A / D converter chip designed for high-precision weighing sensors. Compared with other chips of the same type, this chip integrates peripheral circuits required by other chips of the same type, including a voltage-stabilized power supply and an on-chip clock oscillator. It has the advantages of high integration, fast response speed, and strong anti-interference. Set the power-on initialization weight data to zero. When the weight changes, it is continuously accumulated and the data is reported to the cloud in real time as dynamic monitoring data. When the data suddenly changes from non-zero to zero, it is judged that the garbage has been transported, and the last accumulated data is recorded and uploaded to the cloud as weight analysis data.
[0061] Through this solution, when residents dispose of kitchen waste, they only need to hang the bag on the equipment, collect images through the camera in real time, identify and determine the size and position of the plastic bag, and then control the motor to adjust the plastic bag in the up, down, left and right dimensions to the corresponding fixed position, providing the same conditions for each bag breaking. At the same time, it also uses visual identification to determine whether the bag breaking meets the standards. If it is determined that it does not meet the standards, the bag will be broken again, thereby avoiding the occurrence of bag breaking failures as much as possible.
[0062] Computer vision technology is used to classify kitchen waste, so as to achieve fast and accurate detection and identification of kitchen waste; combined with Internet of Things technology, sensor data collection and remote data transmission are realized to improve the intelligence and convenience of the system; automatic control technology is used to realize automatic processing of kitchen waste, reducing labor costs and environmental impact; single-chip control technology is used to control and monitor the entire system to ensure the stability and security of the system. In short, computer vision, Internet of Things, and automation technologies are used to solve the practical problems of kitchen waste classification, and multiple functions are integrated to further improve the effect of kitchen waste classification from multiple dimensions. It is placed in residential communities, and its specifications are not much different from conventional trash cans. The installation and use methods are simple. It is produced with general devices and modules, which is low in cost and easy to maintain.
[0063] In the description of the embodiments of the present invention, it should be noted that if terms such as "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are used to indicate the orientation or positional relationship, it is based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the product of the invention is usually placed during use. This is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present invention. In addition, terms such as "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0064] In addition, if terms such as "horizontal", "vertical", "hanging" are used, it does not mean that the component is required to be absolutely horizontal or hanging, but can be slightly inclined. For example, "horizontal" only means that its direction is more horizontal relative to "vertical", and does not mean that the structure must be completely horizontal, but can be slightly inclined.
[0065] In the description of the embodiments of the present invention, "a plurality of" represents at least two.
[0066] In the description of the embodiments of the present invention, it should also be noted that unless otherwise clearly specified and limited, if terms such as "set", "installed", "connected", "connected" are used, they should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0067] The above describes the present invention and its embodiments. This description is not restrictive. What is shown in the drawings is only one of the embodiments of the present invention, and the actual structure is not limited thereto. Generally speaking, if those of ordinary skill in the art are inspired by it and, without departing from the gist of the present invention, design similar structural forms and embodiments to this technical solution without creative efforts, they should all fall within the protection scope of the present invention.
Claims
1. The automatic bag-breaking and classification collection system for kitchen waste based on OpenCV is characterized in that: It includes a frame (1), on which a plastic bag breaking mechanism (2), an oil-water separation device (3), a processing control device (4), a kitchen waste collection bin (5), and a plastic bag collection bin (6) are provided. The processing control device (4) includes a vision module and a control module; The vision module is used to judge the position of the plastic bag and identify the plastic bag breaking condition. It is written in Python language and runs on the Raspberry Pi Linux platform. The Raspberry Pi collects images through a USB-connected camera, processes and judges the images, and communicates with the control module through I2C communication to control the plastic bag breaking mechanism (2) to adjust the plastic bag to a specified position and perform plastic bag breaking and classification. Among them, image processing and judgment are based on opencv; The control module receives instructions from the vision module through I2C communication, controls the hardware, and thus completes the work of plastic bag breaking, classification, and collection. The hardware includes a stepper motor, a servo motor, and a sensor.
2. The automatic bag-breaking and classification collection system for kitchen waste based on OpenCV according to claim 1, characterized in that: The control module uses a MEGA2560 development board as the main controller.
Citation Information
Patent Citations
Intelligent garbage classification system and method based on machine vision
CN111619992A
Visual algorithm detection method based on breaking knife bag breaking and double-shaft winding garbage bag recycling
CN115508360A
Kitchen garbage bag breaking device and bag breaking method
CN116902432A
Dry-wet separation integrated device and method for automatically breaking and removing bags of community wet garbage
CN118753684A
Kitchen garbage collection, sorting and bag breaking integrated device and treatment method
CN119525249A