Empty bottle perpendicularity detection method and device, computer equipment and storage medium
Through machine vision recognition technology, the image of the bottle mouth and bottle bottom of the empty bottle is obtained to determine whether the bottle mouth and bottle bottom are aligned, which solves the problem of low accuracy and efficiency in the verticality detection of hollow bottles in the existing technology, and achieves higher detection Accuracy and efficiency.
Patent Information
- Application Number
- CN202410664271.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-09-06
AI Technical Summary
The existing verticality detection of empty bottles mainly relies on manual visual inspection, resulting in low detection accuracy and efficiency, and is greatly affected by subjective factors.
Machine vision recognition technology is used to obtain the image of the bottle mouth and bottle bottom of the empty bottle, determine the pixel area, and use the pixel area to determine whether the bottle mouth and bottle bottom are aligned, thereby determining the verticality of the empty bottle.
It improves the accuracy and efficiency of empty bottle verticality detection, making it more reliable and efficient than manual detection.
Smart Images

Figure CN118602991A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of detection technology, and in particular to an empty bottle verticality detection method, device, computer equipment and storage medium. Background Art
[0002] At present, all industries are promoting automated production lines to improve production efficiency. On the empty bottle inspection line, empty bottles often have to pass the corresponding inspection before they can proceed to the filling process. Generally, empty bottles need to undergo a variety of inspection methods, and the inspection of the verticality of empty bottles is one of the parts of the empty bottle inspection. At present, most of the verticality inspections of empty bottles are usually based on manual visual inspections to determine the verticality of the empty bottles. This inspection method often depends on manual subjective judgment and is greatly affected by subjective factors, resulting in relatively low inspection accuracy and relatively low inspection efficiency. Summary of the invention
[0003] In view of this, the present invention provides a method, device, computer equipment and storage medium for detecting the verticality of an empty bottle to solve the problems of low efficiency and low accuracy in the prior art for detecting the verticality of an empty bottle.
[0004] In a first aspect, the present invention provides a method for detecting the verticality of an empty bottle, the method comprising: acquiring a first image and a second image of an empty bottle, wherein the first image is an image of a bottle mouth taken from directly above the empty bottle by a first camera, and the second image is an image of a bottle bottom taken from directly below the empty bottle by a second camera, the first camera is fixedly arranged above an empty bottle detection assembly line, and the second camera is fixedly arranged below the empty bottle detection assembly line; determining a pixel area of the bottle mouth from the first image; determining a pixel area of the bottle bottom from the second image; judging whether the bottle mouth is aligned with the bottle bottom according to the pixel area of the bottle mouth and the pixel area of the bottle bottom; if the bottle mouth is aligned with the bottle bottom, determining that the verticality of the empty bottle meets the requirements.
[0005] Optionally, judging whether the bottle mouth is aligned with the bottle bottom according to the pixel area of the bottle mouth and the pixel area of the bottle bottom includes: acquiring a first position parameter of the first camera and a second position parameter of the second camera; judging whether the bottle mouth is aligned with the bottle bottom according to the first position parameter and the pixel area of the bottle mouth and the second position parameter and the pixel area of the bottle bottom.
[0006] Optionally, judging whether the bottle mouth and the bottle bottom are aligned according to the first position parameter and the pixel area of the bottle mouth, and the second position parameter and the pixel area of the bottle bottom, includes: determining a first pixel coordinate set corresponding to the pixel area of the bottle mouth, and determining a second pixel coordinate set corresponding to the pixel area of the bottle bottom; determining a first center point pixel coordinate corresponding to the pixel area of the bottle mouth based on the first pixel coordinate set, wherein the first center point pixel coordinate is the pixel coordinate of the center point of the bottle mouth on the first image; determining a second center point pixel coordinate corresponding to the pixel area of the bottle bottom based on the second pixel coordinate set, wherein , the second center point pixel coordinates are the pixel coordinates of the center point of the bottle bottom on the second image; according to the first preset coordinate conversion matrix and the first position parameter, the first center pixel coordinates are converted into the first space coordinates of the center point of the bottle mouth; according to the second preset coordinate conversion matrix and the second position parameter, the second center pixel coordinates are converted into the second space coordinates of the center point of the bottle bottom; based on the first space coordinates and the second space coordinates, it is determined whether the center point of the bottle mouth is located directly above the center point of the bottle bottom; if the center point of the bottle mouth is located directly above the center point of the bottle bottom, it is determined that the bottle mouth is aligned with the bottle bottom.
[0007] Optionally, taking the height direction of the empty bottle as the Z axis and the plane to which the bottom of the empty bottle belongs as the XY plane, determining whether the center point of the bottle mouth is located directly above the center point of the bottle bottom includes: comparing the first spatial coordinate and the second spatial coordinate; if the X and Y coordinate values of the first spatial coordinate and the second spatial coordinate are the same, but the Z coordinate values are different, then the center point of the bottle mouth is located directly above the center point of the bottle bottom.
[0008] Optionally, determining whether the center point of the bottle mouth is located directly above the center point of the bottle bottom includes: comparing the first spatial coordinate and the second spatial coordinate; if the absolute value of the difference between the X coordinate value of the first spatial coordinate and the X coordinate value of the second spatial coordinate is less than or equal to a first preset value, and the absolute value of the difference between the Y coordinate value of the first spatial coordinate and the Y coordinate value of the second spatial coordinate is less than or equal to a second preset value, and the Z coordinate values are different, then the center point of the bottle mouth is located directly above the center point of the bottle bottom.
[0009] Optionally, the first camera and the second camera are the same camera, the first camera is located directly above the second camera, and the shooting directions are opposite, and the judging whether the bottle mouth and the bottle bottom are aligned according to the pixel area of the bottle mouth and the pixel area of the bottle bottom includes: determining a first pixel coordinate set corresponding to the pixel area of the bottle mouth, and determining a second pixel coordinate set corresponding to the pixel area of the bottle bottom, wherein the first image and the second image use the same pixel coordinate system; determining a first center point pixel coordinate corresponding to the pixel area of the bottle mouth based on the first pixel coordinate set, wherein the first center point pixel coordinate is the pixel coordinate of the center point of the bottle mouth on the first image; determining a second center point pixel coordinate corresponding to the pixel area of the bottle bottom based on the second pixel coordinate set, wherein the second center point pixel coordinate is the pixel coordinate of the center point of the bottle bottom on the second image; and comparing the first center point pixel coordinate with the second center point pixel coordinate to determine whether the bottle mouth and the bottle bottom are aligned.
[0010] Optionally, comparing the first center point pixel coordinates with the second center point pixel coordinates to determine that the bottle mouth is aligned with the bottle bottom includes: if the first center point pixel coordinates are the same as the second center point pixel coordinates, determining that the bottle mouth is aligned with the bottle bottom.
[0011] In a second aspect, an embodiment of the present invention provides an empty bottle verticality detection device, the device comprising: an acquisition module, used to acquire a first image and a second image of an empty bottle, wherein the first image is an image of a bottle mouth taken from directly above the empty bottle by a first camera, and the second image is an image of a bottle bottom taken from directly below the empty bottle by a second camera, the first camera is fixedly arranged above an empty bottle detection assembly line, and the second camera is fixedly arranged below the empty bottle detection assembly line; a first determination module, used to determine a pixel area of the bottle mouth from the first image; and to determine a pixel area of the bottle bottom from the second image; a judgment module, used to determine whether the bottle mouth is aligned with the bottle bottom according to the pixel area of the bottle mouth and the pixel area of the bottle bottom; and a second determination module, used to determine whether the verticality of the empty bottle meets the requirements if the bottle mouth is aligned with the bottle bottom.
[0012] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the empty bottle verticality detection method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0013] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the empty bottle verticality detection method of the first aspect or any corresponding embodiment thereof.
[0014] According to an embodiment of the present invention, by using machine vision recognition technology, the bottle mouth image and bottle bottom image of the empty bottle are collected, and then the pixel area of the bottle mouth and the pixel area of the bottle bottom in the image are determined respectively, and then the pixel areas of the bottle mouth and the bottle bottom are used to determine whether the bottle mouth and the bottle bottom are aligned, and then determine whether the verticality of the empty bottle meets the requirements. Compared with manual detection methods, the verticality of the empty bottle is detected by machine vision recognition technology, which has higher accuracy and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 is a schematic flow chart of a method for detecting the verticality of an empty bottle according to an embodiment of the present invention;
[0017] Figure 2 is a structural block diagram of an empty bottle verticality detection device according to an embodiment of the present invention;
[0018] Figure 3 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0020] The empty bottle verticality detection method described in the embodiment of the present invention is applicable to an empty bottle detection line, specifically, it can be used on an empty bottle detection device on the empty bottle detection line. The present invention does not specifically limit which filling production line or empty bottle detection device is used, and it is not a protection point of the present invention. It can be applied to an existing empty bottle detection line, and adding a device capable of running the verticality detection method provided by the embodiment of the present invention to it, that is, adding an empty bottle detection device.
[0021] According to an embodiment of the present invention, an embodiment of a method for detecting the verticality of an empty bottle is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0022] In this embodiment, a method for detecting the verticality of an empty bottle is provided. Figure 1 is a flow chart of a method for detecting the verticality of an empty bottle according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0023] Step S101, obtaining a first image and a second image of the empty bottle, wherein the first image is an image of the bottle mouth taken from directly above the empty bottle by a first camera, and the second image is an image of the bottle bottom taken from directly below the empty bottle by a second camera, and the first camera is fixedly arranged above the empty bottle detection assembly line, and the second camera is fixedly arranged below the empty bottle detection assembly line.
[0024] The empty bottle detection device described in the embodiment of the present invention includes at least two cameras, namely a first camera and a second camera, wherein the first camera is arranged at the top, the second camera is arranged at the bottom, and the empty bottle is located between the first camera and the second camera, that is, the empty bottle detection assembly line is located between the two cameras. When the empty bottle moves between the two cameras, it stops, the first camera collects the first image, and the second camera collects the second image, that is, the bottle mouth image and the bottle bottom image of the empty bottle are collected from the top and bottom of the empty bottle, respectively.
[0025] Step S102, determining the pixel area of the bottle mouth from the first image; and determining the pixel area of the bottle bottom from the second image.
[0026] Since the first image includes the bottle mouth, but not only the bottle mouth but also other contents, in the embodiment of the present invention, image recognition technology can be used to extract the pixel features of the bottle mouth from the first image, and then determine the pixel area of the bottle mouth; similarly, the second image includes the bottle bottom, and the pixel features of the bottle bottom are extracted from the second image to determine the pixel area of the bottle bottom.
[0027] Step S103, judging whether the bottle mouth and the bottle bottom are aligned according to the pixel area of the bottle mouth and the pixel area of the bottle bottom.
[0028] After the pixel area of the bottle outlet and the pixel area of the bottle bottom are determined, it can be determined whether the positions of the bottle outlet and the bottle bottom are aligned according to the two pixel areas.
[0029] Specifically, the center points of the two pixel areas may be used to determine whether the two are concentric; if they are concentric, it means that the bottle mouth is aligned with the bottle bottom; otherwise, it is determined that the bottle mouth is not aligned with the bottle bottom.
[0030] Step S104: if the bottle mouth is aligned with the bottle bottom, it is determined that the verticality of the empty bottle meets the requirement.
[0031] In the embodiment of the present invention, the verticality detection is mainly to determine the position of the bottle mouth and the bottle bottom. If the relative position of the bottle bottom and the bottle mouth is offset, the verticality does not meet the requirement, that is, the empty bottle has defects. In the embodiment of the present invention, the verticality requirement can be determined according to the relative position of the bottle mouth and the bottle bottom, and the index can be determined by a specific value.
[0032] According to an embodiment of the present invention, by using machine vision recognition technology, the bottle mouth image and bottle bottom image of the empty bottle are collected, and then the pixel area of the bottle mouth and the pixel area of the bottle bottom in the image are determined respectively, and then the pixel areas of the bottle mouth and the bottle bottom are used to determine whether the bottle mouth and the bottle bottom are aligned, and then determine whether the verticality of the empty bottle meets the requirements. Compared with manual detection methods, the verticality of the empty bottle is detected by machine vision recognition technology, which has higher accuracy and efficiency.
[0033] As an optional implementation, judging whether the bottle mouth and the bottle bottom are aligned based on the pixel area of the bottle mouth and the pixel area of the bottle bottom, includes: obtaining a first position parameter of the first camera and a second position parameter of the second camera; judging whether the bottle mouth and the bottle bottom are aligned based on the first position parameter and the pixel area of the bottle mouth and the second position parameter and the pixel area of the bottle bottom.
[0034] The first position parameter may be an external parameter of the first camera, mainly recording the position of the first camera in the world coordinate system; the second position parameter may be an external parameter of the second camera, recording the position of the second camera in the world coordinate system. The world coordinate system mentioned above is the same. Since the positions of the first camera and the second camera are fixed, the viewing angles of the images taken by the two cameras are relatively fixed, and thus the positions of the bottle mouth and the bottle bottom at the fixed positions in the two images are also relatively fixed. In this way, it is possible to determine whether the bottle mouth and the bottle bottom are aligned based on the first position parameter and the pixel area of the bottle mouth and the second position parameter and the pixel area of the bottle bottom.
[0035] Further, judging whether the bottle mouth and the bottle bottom are aligned according to the first position parameter and the pixel area of the bottle mouth, and the second position parameter and the pixel area of the bottle bottom, includes:
[0036] S1, determining a first pixel coordinate set corresponding to a pixel area of a bottle mouth, and determining a second pixel coordinate set corresponding to a pixel area of a bottle bottom.
[0037] The pixel coordinates in this embodiment refer to the coordinate positions of the pixel points in the image, wherein the first pixel coordinate set refers to the coordinate set of the pixel area of the bottle mouth in the first image, and the second pixel coordinate set refers to the coordinate set of the pixel area of the bottle bottom in the second image. The pixel coordinates of the bottle mouth and the pixel coordinates of the bottle bottom are determined from the image, so that it can be judged whether the bottle mouth and the bottle bottom are aligned according to these pixel coordinates.
[0038] S2, determining the first center point pixel coordinates corresponding to the pixel area of the bottle mouth based on the first pixel coordinate set, wherein the first center point pixel coordinates are the pixel coordinates of the center point of the bottle mouth on the first image.
[0039] S3, determining the second center point pixel coordinates corresponding to the pixel area of the bottle bottom based on the second pixel coordinate set, wherein the second center point pixel coordinates are the pixel coordinates of the center point of the bottle bottom on the second image.
[0040] Specifically, whether the bottle mouth and the bottle bottom are aligned can be judged based on the center point pixel coordinates. Since the bottle mouth is usually round and the bottle bottom is round or rectangular, the first center point can refer to the center of the bottle mouth, and the second center point can be the center of the bottle bottom or the center of the rectangle of the bottle bottom; accordingly, the first center point pixel coordinates refer to the pixel coordinates of the first center point in the first image; the second center point pixel coordinates refer to the pixel coordinates of the second center point in the second image.
[0041] S4, converting the first central pixel coordinates into first spatial coordinates of the center point of the bottle mouth according to the first preset coordinate conversion matrix and the first position parameter.
[0042] The first preset coordinate conversion matrix is a conversion matrix between the world coordinate system and the first image coordinate system, and the conversion matrix can be calculated based on the pre-calibrated multiple sets of center point pixel coordinates and spatial coordinates and the position parameters of the camera. According to the number of parameters in the conversion matrix, a relative number of multiple sets of coordinates are selected, and each set of coordinates includes the coordinates of the center point of the bottle mouth and the corresponding first spatial coordinates. The corresponding parameters in the first preset coordinate conversion matrix are calculated using the pre-calibrated multiple sets of coordinates and position parameters to obtain the first preset coordinate conversion matrix. In this way, after the first center point coordinates are determined, they are converted into the first spatial coordinates.
[0043] In the embodiment of the present invention, the world coordinate system can be vertical to the ground as the Z axis, and the running direction of the empty bottle detection assembly line as the X axis. Of course, other settings are also possible, and the present invention does not make specific limitations.
[0044] S5, converting the second central pixel coordinates into second spatial coordinates of the center point of the bottle bottom according to the second preset coordinate conversion matrix and the second position parameter.
[0045] The second preset coordinate conversion matrix is a conversion matrix between the world coordinate system and the second image coordinate system. The conversion matrix is obtained in the same manner as the first preset coordinate conversion matrix, which is not described in detail here. Since the first spatial coordinate and the second spatial coordinate are the center point coordinates of the mouth of the empty bottle and the center point coordinates of the bottom of the bottle in the same coordinate system, it is possible to determine whether the mouth of the bottle is aligned with the bottom of the bottle based on the two spatial coordinates.
[0046] S6, based on the first space coordinate and the second space coordinate, determine whether the center point of the bottle mouth is located directly above the center point of the bottle bottom.
[0047] S7, if the center point of the bottle mouth is located directly above the center point of the bottle bottom, it is determined that the bottle mouth is aligned with the bottle bottom.
[0048] Since the first spatial coordinate of the center point of the bottle mouth and the second spatial coordinate of the center point of the bottle bottom belong to the same coordinate system, the coordinate value calculation can determine whether the center point of the bottle mouth is directly above the center point of the bottle bottom. If so, it is determined that the bottle mouth is aligned with the bottle bottom.
[0049] Specifically, taking the height direction of the empty bottle as the Z axis and the plane to which the bottom of the empty bottle belongs as the XY plane, judging whether the center point of the bottle mouth is located directly above the center point of the bottle bottom includes: comparing the first spatial coordinate and the second spatial coordinate; if the X and Y coordinate values of the first spatial coordinate and the second spatial coordinate are the same, but the Z coordinate values are different, then the center point of the bottle mouth is located directly above the center point of the bottle bottom.
[0050] According to the embodiment of the present invention, by converting the center point of the bottle mouth and the center point of the bottle bottom into coordinate values in the same coordinate system, whether the bottle mouth and the bottle bottom are aligned is determined by the coordinate values, thereby improving the accuracy of judgment.
[0051] As another optional implementation, determining whether the center point of the bottle mouth is located directly above the center point of the bottle bottom includes: comparing the first spatial coordinate and the second spatial coordinate; if the absolute value of the difference between the X coordinate value of the first spatial coordinate and the X coordinate value of the second spatial coordinate is less than or equal to a first preset value, and the absolute value of the difference between the Y coordinate value of the first spatial coordinate and the Y coordinate value of the second spatial coordinate is less than or equal to a second preset value, and the Z coordinate values are different, then the center point of the bottle mouth is located directly above the center point of the bottle bottom.
[0052] In the case where a certain error range is allowed, in the embodiment of the present invention, a so-called error range between alignments, as well as a first preset value and a second preset value are allowed, that is, within a certain range, it can still be determined that the bottle mouth and the bottle bottom are aligned.
[0053] In another optional implementation manner of the embodiment of the present invention, the first camera and the second camera are the same camera, the first camera is located directly above the second camera, and the shooting directions are opposite, that is, the first camera and the second camera are only different in position and shooting direction, and the image sizes and pixel coordinates captured by the two cameras are the same or corresponding.
[0054] Judging whether the bottle mouth and the bottle bottom are aligned according to the pixel area of the bottle mouth and the pixel area of the bottle bottom includes: determining a first pixel coordinate set corresponding to the pixel area of the bottle mouth, and determining a second pixel coordinate set corresponding to the pixel area of the bottle bottom, wherein the first image and the second image use the same pixel coordinate system; determining a first center point pixel coordinate corresponding to the pixel area of the bottle mouth based on the first pixel coordinate set, wherein the first center point pixel coordinate is the pixel coordinate of the center point of the bottle mouth on the first image; determining a second center point pixel coordinate corresponding to the pixel area of the bottle bottom based on the second pixel coordinate set, wherein the second center point pixel coordinate is the pixel coordinate of the center point of the bottle bottom on the second image; and comparing the first center point pixel coordinate with the second center point pixel coordinate to determine whether the bottle mouth and the bottle bottom are aligned.
[0055] Specifically, comparing the first center point pixel coordinates with the second center point pixel coordinates to determine that the bottle mouth and the bottle bottom are aligned includes: if the first center point pixel coordinates are the same as the second center point pixel coordinates, determining that the bottle mouth and the bottle bottom are aligned.
[0056] Since the pixel coordinate system is a two-dimensional coordinate system, the first image and the second image have the same size and use the same pixel coordinate system. Therefore, if the pixel coordinate values of the center point of the bottle mouth and the center point of the bottle bottom are the same, it is determined that the bottle mouth is aligned with the bottle bottom.
[0057] In the embodiment of the present invention, when the positions of the first camera and the second camera are calibrated as corresponding positions, verticality detection can be achieved only through pixel coordinates. Compared with the previous method, the calculation amount is smaller and the detection efficiency is higher.
[0058] In this embodiment, an empty bottle verticality detection device is also provided, which is used to implement the above embodiments and preferred implementations, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0059] This embodiment provides an empty bottle verticality detection device. Figure 2 As shown, including:
[0060] The acquisition module 201 is used to acquire a first image and a second image of an empty bottle, wherein the first image is an image of the bottle mouth taken from directly above the empty bottle by a first camera, and the second image is an image of the bottle bottom taken from directly below the empty bottle by a second camera, and the first camera is fixedly arranged above the empty bottle detection assembly line, and the second camera is fixedly arranged below the empty bottle detection assembly line;
[0061] The first determination module 202 is used to determine the pixel area of the bottle mouth from the first image; and determine the pixel area of the bottle bottom from the second image;
[0062] A judgment module 203, used to judge whether the bottle mouth and the bottle bottom are aligned according to the pixel area of the bottle mouth and the pixel area of the bottle bottom;
[0063] The second determination module 204 is used to determine whether the verticality of the empty bottle meets the requirement if the bottle mouth is aligned with the bottle bottom.
[0064] Optionally, the judging module includes:
[0065] An acquiring unit, used to acquire a first position parameter of the first camera and a second position parameter of the second camera;
[0066] The judging unit is used to judge whether the bottle mouth and the bottle bottom are aligned according to the first position parameter and the pixel area of the bottle mouth and the second position parameter and the pixel area of the bottle bottom.
[0067] The judging unit comprises:
[0068] A first determining subunit, used to determine a first pixel coordinate set corresponding to a pixel area of the bottle mouth, and to determine a second pixel coordinate set corresponding to a pixel area of the bottle bottom;
[0069] A second determining subunit is used to determine the first center point pixel coordinates corresponding to the pixel area of the bottle mouth based on the first pixel coordinate set, wherein the first center point pixel coordinates are the pixel coordinates of the center point of the bottle mouth on the first image;
[0070] A third determining subunit is used to determine the second center point pixel coordinates corresponding to the pixel area of the bottle bottom based on the second pixel coordinate set, wherein the second center point pixel coordinates are the pixel coordinates of the center point of the bottle bottom on the second image;
[0071] A first conversion subunit, used for converting the first central pixel coordinates into first spatial coordinates of the center point of the bottle mouth according to a first preset coordinate conversion matrix and a first position parameter;
[0072] A second conversion subunit, used for converting the second central pixel coordinates into the second spatial coordinates of the center point of the bottle bottom according to a second preset coordinate conversion matrix and a second position parameter;
[0073] A judging subunit, used for judging whether the center point of the bottle mouth is located directly above the center point of the bottle bottom based on the first space coordinate and the second space coordinate;
[0074] The fourth determining subunit is used to determine that the bottle mouth is aligned with the bottle bottom if the center point of the bottle mouth is located directly above the center point of the bottle bottom.
[0075] Optionally, with the height direction of the empty bottle as the Z axis and the plane to which the bottom of the empty bottle belongs as the XY plane, the judgment subunit is specifically used to compare the first space coordinate and the second space coordinate; if the X and Y coordinate values of the first space coordinate and the second space coordinate are the same, but the Z coordinate values are different, then the center point of the bottle mouth is located directly above the center point of the bottle bottom.
[0076] Optionally, the judgment subunit is specifically used to compare the first space coordinate and the second space coordinate; if the absolute value of the difference between the X coordinate value of the first space coordinate and the X coordinate value of the second space coordinate is less than or equal to a first preset value, and the absolute value of the difference between the Y coordinate value of the first space coordinate and the Y coordinate value of the second space coordinate is less than or equal to a second preset value, and the Z coordinate values are different, then the center point of the bottle mouth is located directly above the center point of the bottle bottom.
[0077] Optionally, the first camera and the second camera are the same camera, the first camera is located directly above the second camera, and the shooting directions are opposite, and the judgment module includes:
[0078] A first determining unit, used to determine a first pixel coordinate set corresponding to a pixel area of the bottle mouth, and to determine a second pixel coordinate set corresponding to a pixel area of the bottle bottom, wherein the first image and the second image use the same pixel coordinate system;
[0079] A second determining unit is used to determine the first center point pixel coordinates corresponding to the pixel area of the bottle mouth based on the first pixel coordinate set, wherein the first center point pixel coordinates are the pixel coordinates of the center point of the bottle mouth on the first image;
[0080] A third determining unit is used to determine the second center point pixel coordinates corresponding to the pixel area of the bottle bottom based on the second pixel coordinate set, wherein the second center point pixel coordinates are the pixel coordinates of the center point of the bottle bottom on the second image;
[0081] The comparison unit is used to compare the pixel coordinates of the first center point with the pixel coordinates of the second center point to determine whether the bottle mouth and the bottle bottom are aligned.
[0082] Optionally, the comparison unit comprises: a comparison subunit, configured to determine that the bottle mouth is aligned with the bottle bottom if the pixel coordinates of the first center point are the same as the pixel coordinates of the second center point.
[0083] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0084] The empty bottle verticality detection device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0085] The embodiment of the present invention also provides a computer device having the above Figure 3 The empty bottle verticality detection device shown.
[0086] See also Figure 3 , Figure 3 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 3 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the image information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 3 A processor 10 is taken as an example.
[0087] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0088] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0089] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0090] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0091] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0092] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0093] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for detecting the verticality of an empty bottle, characterized in that: The method comprises: Acquire a first image and a second image of the empty bottle, wherein the first image is an image of the bottle mouth taken from directly above the empty bottle by a first camera, and the second image is an image of the bottle bottom taken from directly below the empty bottle by a second camera, the first camera is fixedly arranged above the empty bottle detection assembly line, and the second camera is fixedly arranged below the empty bottle detection assembly line; Determine the pixel area of the bottle mouth from the first image; determine the pixel area of the bottle bottom from the second image; Determining whether the bottle mouth is aligned with the bottle bottom according to the pixel area of the bottle mouth and the pixel area of the bottle bottom; If the bottle mouth is aligned with the bottle bottom, it is determined that the verticality of the empty bottle meets the requirement.
2. The method according to claim 1, characterized in that The step of determining whether the bottle mouth is aligned with the bottle bottom according to the pixel area of the bottle mouth and the pixel area of the bottle bottom comprises: Obtaining a first position parameter of the first camera and a second position parameter of the second camera; Whether the bottle mouth is aligned with the bottle bottom is determined according to the first position parameter and the pixel area of the bottle mouth and the second position parameter and the pixel area of the bottle bottom.
3. The method according to claim 2, characterized in that The step of determining whether the bottle mouth and the bottle bottom are aligned according to the first position parameter and the pixel area of the bottle mouth, and the second position parameter and the pixel area of the bottle bottom, comprises: Determine a first pixel coordinate set corresponding to the pixel area of the bottle mouth, and determine a second pixel coordinate set corresponding to the pixel area of the bottle bottom; Determining a first center point pixel coordinate corresponding to the pixel area of the bottle mouth based on the first pixel coordinate set, wherein the first center point pixel coordinate is the pixel coordinate of the center point of the bottle mouth on the first image; Determining the second center point pixel coordinates corresponding to the pixel area of the bottle bottom based on the second pixel coordinate set, wherein the second center point pixel coordinates are the pixel coordinates of the center point of the bottle bottom on the second image; According to a first preset coordinate conversion matrix and the first position parameter, converting the first central pixel coordinate into a first spatial coordinate of the center point of the bottle mouth; According to a second preset coordinate conversion matrix and the second position parameter, converting the second central pixel coordinates into second spatial coordinates of the center point of the bottle bottom; Based on the first spatial coordinate and the second spatial coordinate, determining whether the center point of the bottle mouth is located directly above the center point of the bottle bottom; If the center point of the bottle mouth is located directly above the center point of the bottle bottom, it is determined that the bottle mouth is aligned with the bottle bottom.
4. The method according to claim 3, characterized in that Taking the height direction of the empty bottle as the Z axis and the plane to which the bottom of the empty bottle belongs as the XY plane, the step of determining whether the center point of the bottle mouth is located directly above the center point of the bottle bottom includes: comparing the first spatial coordinate and the second spatial coordinate; If the X and Y coordinate values of the first space coordinate and the second space coordinate are the same, but the Z coordinate values are different, then the center point of the bottle mouth is located directly above the center point of the bottle bottom.
5. The method according to claim 4, characterized in that The determining whether the center point of the bottle mouth is located directly above the center point of the bottle bottom includes: comparing the first spatial coordinate and the second spatial coordinate; If the absolute value of the difference between the X coordinate value of the first space coordinate and the X coordinate value of the second space coordinate is less than or equal to a first preset value, and the absolute value of the difference between the Y coordinate value of the first space coordinate and the Y coordinate value of the second space coordinate is less than or equal to a second preset value, and the Z coordinate values are different, then the center point of the bottle mouth is located directly above the center point of the bottle bottom.
6. The method according to claim 1, characterized in that The first camera and the second camera are the same camera, the first camera is located directly above the second camera, and the shooting directions of the first camera are opposite, and judging whether the bottle mouth is aligned with the bottle bottom according to the pixel area of the bottle mouth and the pixel area of the bottle bottom includes: Determine a first pixel coordinate set corresponding to the pixel area of the bottle mouth, and determine a second pixel coordinate set corresponding to the pixel area of the bottle bottom, wherein the first image and the second image use the same pixel coordinate system; Determining a first center point pixel coordinate corresponding to the pixel area of the bottle mouth based on the first pixel coordinate set, wherein the first center point pixel coordinate is the pixel coordinate of the center point of the bottle mouth on the first image; Determining the second center point pixel coordinates corresponding to the pixel area of the bottle bottom based on the second pixel coordinate set, wherein the second center point pixel coordinates are the pixel coordinates of the center point of the bottle bottom on the second image; The pixel coordinates of the first center point are compared with the pixel coordinates of the second center point to determine whether the bottle mouth is aligned with the bottle bottom.
7. The method according to claim 6, characterized in that The comparing the pixel coordinates of the first center point with the pixel coordinates of the second center point to determine that the bottle mouth is aligned with the bottle bottom includes: If the pixel coordinates of the first center point are the same as the pixel coordinates of the second center point, it is determined that the bottle mouth is aligned with the bottle bottom.
8. An empty bottle verticality detection device, characterized in that: The device comprises: an acquisition module, used to acquire a first image and a second image of an empty bottle, wherein the first image is an image of a bottle mouth taken from directly above the empty bottle by a first camera, and the second image is an image of a bottle bottom taken from directly below the empty bottle by a second camera, the first camera is fixedly arranged above an empty bottle detection assembly line, and the second camera is fixedly arranged below the empty bottle detection assembly line; A first determination module, used to determine the pixel area of the bottle mouth from the first image; and determine the pixel area of the bottle bottom from the second image; A judging module, used for judging whether the bottle mouth is aligned with the bottle bottom according to the pixel area of the bottle mouth and the pixel area of the bottle bottom; The second determination module is used to determine whether the verticality of the empty bottle meets the requirement if the bottle mouth is aligned with the bottle bottom.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the empty bottle verticality detection method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the empty bottle verticality detection method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Algorithm for detecting glass bottle neck damage and bottle bottom dirt
CN102162797A
PCB detection method and device and computer readable storage medium
CN109919919A
Method and system for measuring volume of concave object based on depth camera
CN115564819A
Hole-making perpendicularity measuring method and system, storage medium and measuring equipment
CN117029732A
Dimension detection method and dimension detection system
CN117589063A
Cited By
Glass bottle perpendicularity detection method and detection system based on three cameras
CN119468986A
