Product size detection method and system, terminal equipment and storage medium
By combining a main camera and an auxiliary camera, the detection method achieves efficient and accurate measurement of the product's three-dimensional dimensions, solving the problems of low efficiency and large errors in traditional methods and improving the level of intelligence in detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-03-17
AI Technical Summary
Traditional three-dimensional dimensional data measurement methods are inefficient and have large errors, making it difficult to meet the needs of modern industrial automation inspection and identification.
The detection method combines a main camera and an auxiliary camera. The main camera captures a top-down image vertically, while the auxiliary camera captures a 3D contour image at an angle. The final planar dimensions of the product are obtained through grayscale conversion, edge detection, and scaling factor fusion.
It improves the efficiency and accuracy of product 3D dimension measurement, reduces manual measurement workload and human error, and enhances the level of intelligence.
Smart Images

Figure CN121677579A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of product measurement technology, and in particular to a product size detection method, system, terminal equipment, and storage medium. Background Technology
[0002] The length, width, and height dimensions are the three most basic and crucial data for a product. These dimensions determine whether the product can be stored in a specific space and even whether it meets its most basic operational requirements. Measuring these three dimensions is a vital part of product inspection, but we cannot quickly obtain accurate 3D dimension data from a product in person. Traditional measurement methods typically involve manually measuring each dimension one by one and then recording the data. This is not only inefficient but also makes it difficult to guarantee accuracy. Traditional tape measures are used to measure the three dimensions sequentially, which is extremely inefficient and lacks precision, severely hindering technological development in related fields. With the rapid development of modern information technology and the gradual transformation of traditional industries, automated and intelligent product inspection and identification have become possible and have a broad application market. Summary of the Invention
[0003] This application provides a product dimension inspection method, system, terminal equipment, and storage medium, which solves the problems of low inspection efficiency and large error in traditional three-dimensional dimension data measurement methods.
[0004] In a first aspect, this application provides a product size detection method, which is implemented by a detection table, a main camera, and an auxiliary camera; the detection table is used to place the product to be detected; the light from the main camera is perpendicular to the detection table and is used to capture a top view image of the product to be detected; the light from the auxiliary camera is at a certain angle to the detection table and is used to capture the shadow and three-dimensional contour image of the product to be detected. The product size detection method includes: Acquire the top-view image captured by the main camera and the shadow and three-dimensional contour images captured by the auxiliary camera; The top-view plane dimensions of the inspected product are determined based on the top-view image, and the height and tilt plane dimensions of the inspected product are determined based on the shadow and three-dimensional contour image. The planar dimensions of the top-view perspective and the planar dimensions of the tilted perspective are weighted and fused using a predetermined scaling factor to obtain the final planar dimensions of the product being inspected.
[0005] Further, determining the planar dimensions of the inspected product based on the top-view image includes: The top view image is processed by grayscale and binarization, and edge detection is performed using the improved Canny operator to determine the edge box of the detected product. The top-view pixel size of the product being inspected is determined based on the edge box of the product being inspected. Using a pre-determined scale between the actual product size and the pixel size, the top-view pixel size is converted into the top-view planar size of the product being inspected.
[0006] Further, determining the height and tilt angle plane dimensions of the inspected product based on the shadow and three-dimensional contour image includes: Determine the mapping relationship between the three-dimensional spatial coordinates based on the detection platform and the planar coordinates based on the images acquired by the auxiliary camera; Based on the shadow and three-dimensional contour image and the mapping relationship, the shadow width and tilt angle plane size of the inspected product are determined; According to the shadow width Δ w The elevation angle γ of the auxiliary camera determines the height Δ of the product being inspected. h Δ h =Δ w / tanγ.
[0007] Further, determining the shadow width and tilt angle plane size of the detected product based on the shadow and three-dimensional contour image and the mapping relationship includes: The shadow and three-dimensional contour images are processed by grayscale and binarization, and the shadow and the detected product are separated by color component similarity calculation. Edge detection is performed using the improved Canny operator to determine the bounding boxes of shadows and the bounding boxes of the detected product. Based on the edge box of the shadow and the edge box of the inspected product, determine the shadow width and tilt view plane size of the inspected product.
[0008] Further, the shadow-based bounding box and the bounding box of the inspected product determine the shadow width and tilted viewing angle plane dimensions of the inspected product, including: The tilt angle pixel size of the shadow is determined based on the edge box of the shadow, and the tilt angle pixel size of the inspected product is determined based on the edge box of the inspected product. The mapping relationship is used to convert the tilted viewpoint pixel size of the shadow into the shadow width of the detected product; The mapping relationship is used to convert the tilt angle pixel size of the product being detected into the tilt angle plane size of the product being detected.
[0009] Furthermore, before fusing the top-view plane dimension and the tilt-view plane dimension using a predetermined scaling factor to obtain the final plane dimension of the product being inspected, the method further includes: Images of the sample are acquired using the main camera and the auxiliary camera, respectively, to determine the top-view plane size and the tilt-view plane size of the sample; The corresponding scaling factor is determined based on the difference between the plane size of the sample from the top view and the plane size from the tilt view and the actual plane size of the sample.
[0010] Furthermore, after fusing the top-view plane dimensions and the tilt-view plane dimensions using a predetermined scaling factor to obtain the final plane dimensions of the product being inspected, the process further includes: If the difference between the final planar dimensions and the actual planar dimensions of the product being tested is greater than a preset threshold, the light angle of the auxiliary camera and the scaling factor are adjusted. Repeat the detection until the difference between the detected plane size and the actual plane size is less than or equal to the preset threshold, and use the adjusted scaling factor as the new scaling factor.
[0011] Secondly, this application provides a product size detection system, including a detection table, a main camera, an auxiliary camera, and a detection analysis system, wherein the detection analysis system is used to implement the product size detection method described above.
[0012] Thirdly, this application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the product size detection method described above.
[0013] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the product size detection method described above.
[0014] The above-mentioned technical solution of this application has the following advantages: The product size detection method provided in the first aspect of this application acquires a top-view image captured by the main camera and shadow and three-dimensional contour images captured by the auxiliary camera. Based on the top-view image, the top-view planar size of the product under test is determined. Based on the shadow and three-dimensional contour images, the height and tilt planar size of the product under test are determined. The top-view planar size and the tilt planar size are weighted and fused using a pre-determined scaling factor to obtain the final planar size of the product under test. This method can improve the efficiency and speed of product three-dimensional size measurement, reduce the workload of manual measurement and human error and arbitrariness, and comprehensively improve the intelligence and accuracy of product three-dimensional size measurement.
[0015] It is understood that the beneficial effects of the second, third and fourth aspects mentioned above can be found in the relevant descriptions in the first aspect above, and will not be repeated here. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0017] Figure 1 A flowchart illustrating the product size inspection method provided in this application; Figure 2 A schematic diagram of the testing platform, main camera, and auxiliary camera provided in this application; Figure 3 A schematic diagram of the three-dimensional spatial coordinate system based on the detection platform provided in this application; Figure 4 A schematic diagram of the Y-axis direction front and side auxiliary camera imaging model provided in this application; Figure 5 A schematic diagram of a planar coordinate system based on images acquired by an auxiliary camera, provided for this application; Figure 6 A schematic diagram of the structure of the terminal device provided in this application. Detailed Implementation
[0018] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of this application with unnecessary detail.
[0019] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0020] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0021] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized. "A plurality" means "two or more."
[0022] The specific embodiments of this application will be described in further detail below with reference to the accompanying drawings and examples. The following examples are used to illustrate this application, but are not intended to limit the scope of this application.
[0023] This application provides a product size detection method, which is implemented by a detection platform, a main camera, and an auxiliary camera. The detection platform is used to place the product to be detected. The light from the main camera is perpendicular to the detection platform and is used to capture a top view image of the product to be detected. The light from the auxiliary camera is at a certain angle to the detection platform and is used to capture the shadow and three-dimensional contour image of the product to be detected.
[0024] like Figure 1 As shown, the product size detection method includes: acquiring a top-view image captured by the main camera and a shadow and three-dimensional contour image captured by the auxiliary camera; determining the top-view plane size of the product to be detected based on the top-view image, and determining the height and tilt plane size of the product to be detected based on the shadow and three-dimensional contour image; and weighting and fusing the top-view plane size and the tilt plane size using a predetermined scaling factor to obtain the final plane size of the product to be detected.
[0025] This application embodiment addresses the specific needs and characteristics of user product size detection. Under a relatively fixed detection environment, it employs main and auxiliary cameras to capture product images. The main camera uses orthographic photography to acquire images of the product, while the auxiliary camera uses oblique photography. Keyframe images are automatically captured in real-time from the main and auxiliary cameras, and the product's planar dimensions and height are detected respectively. The planar dimensions are represented by the length and width for products that are nearly rectangular, by the center and diameter for products that are nearly circular, and by the area for completely irregular shapes.
[0026] Build as Figure 2The testing platform shown depicts a product placed within the scale lines. The main and auxiliary cameras automatically capture images and transmit them to the testing and analysis system. For assembly line platforms, an infrared proximity switch is added. When a product approaches, the switch is automatically triggered, driving the camera to take a picture and transmit it to the testing and analysis system, avoiding interference and misjudgments caused by the movement of products on the assembly line.
[0027] After obtaining the planar dimensions from the top-view and oblique-view perspectives, multiply each by its corresponding scaling factor and then sum them to obtain the final planar dimensions of the product being inspected. The sum of the scaling factors for the top-view and oblique-view planar dimensions is 1. The detected height and final planar dimensions constitute the three-dimensional dimensions of the product being inspected.
[0028] In some embodiments, determining the top-view planar dimensions of the product under inspection based on the top-view image includes: performing grayscale and binarization processing on the top-view image, and using the Canny improved operator to perform edge detection to determine the bounding box of the product under inspection; determining the top-view pixel dimensions of the product under inspection based on the bounding box of the product under inspection; and converting the top-view pixel dimensions into the top-view planar dimensions of the product under inspection using a pre-determined scale between the actual product size and the pixel size.
[0029] In some embodiments, determining the height and tilt angle plane dimensions of the product under inspection based on the shadow and three-dimensional contour image includes: determining the mapping relationship between the three-dimensional spatial coordinates based on the inspection platform and the planar coordinates based on the image acquired by the auxiliary camera; determining the shadow width and tilt angle plane dimensions of the product under inspection based on the shadow and three-dimensional contour image and the mapping relationship; and determining the shadow width Δ based on the shadow width Δ. w The elevation angle γ of the auxiliary camera determines the height Δ of the product being inspected. h Δ h =Δ w / tanγ.
[0030] In some embodiments, determining the shadow width and tilted view plane size of the detected product based on the shadow and three-dimensional contour image and the mapping relationship includes: performing grayscale and binarization processing on the shadow and three-dimensional contour image; calculating and separating the shadow and the detected product using color component similarity; performing edge detection using the Canny improved operator to determine the edge box of the shadow and the edge box of the detected product; and determining the shadow width and tilted view plane size of the detected product based on the edge box of the shadow and the edge box of the detected product.
[0031] In some embodiments, determining the shadow width and tilted view plane size of the detected product based on the shadow edgebox and the edgebox of the detected product includes: determining the tilted view pixel size of the shadow based on the shadow edgebox, and determining the tilted view pixel size of the detected product based on the edgebox of the detected product; converting the tilted view pixel size of the shadow into the shadow width of the detected product using the mapping relationship; and converting the tilted view pixel size of the detected product into the tilted view plane size of the detected product using the mapping relationship.
[0032] In some embodiments, before fusing the top-view plane size and the tilt-view plane size using a predetermined scaling factor to obtain the final plane size of the product being inspected, the method further includes: acquiring images of the sample using the main camera and the auxiliary camera respectively, determining the top-view plane size and the tilt-view plane size of the sample; and determining the corresponding scaling factor based on the difference between the top-view plane size and the tilt-view plane size of the sample and the actual plane size of the sample. The smaller the difference between these two plane sizes and the actual plane size, the larger the corresponding scaling factor.
[0033] In some embodiments, after fusing the top-view plane size and the tilt-view plane size using a predetermined scaling factor to obtain the final plane size of the product being inspected, the method further includes: if the difference between the final plane size and the actual plane size of the product being inspected is greater than a preset threshold, adjusting the light angle of the auxiliary camera and the scaling factor; re-inspecting until the difference between the detected plane size and the actual plane size is less than or equal to the preset threshold, and using the adjusted scaling factor as the new scaling factor. Specifically, the light angle of the auxiliary camera, the scaling factor corresponding to the top-view plane size, and the scaling factor corresponding to the tilt-view plane size can be adjusted respectively, and the plane size of the product can be re-inspected until the difference between the detected plane size and the actual plane size is less than or equal to the preset threshold. When inspecting other products subsequently, the adjusted auxiliary camera and scaling factor can be used for inspection.
[0034] After the photos automatically captured by the main and auxiliary cameras are transmitted to the detection and analysis system, the main and auxiliary product image size detection subsystems work simultaneously to detect, analyze, and calculate the product size, automatically presenting the results on both the PC web terminal and the mobile terminal. The algorithm principle and process of the main camera image detection and analysis are as follows: Original image input → Image grayscale processing → Image binarization processing → Canny improved operator edge detection → Product edge delineation and correction → Calculation of median pixel distance at product edges → Product edge size conversion → Output of product boundary size. For completely irregular product images, superpixel multi-scale initial segmentation can be performed based on SLIC, and different color regions of the product can be delineated, and the area of each region can be calculated or statistically analyzed separately.
[0035] Detection and analysis of auxiliary camera images: based on, for example Figures 3 to 5 Based on the spatial location and relationships, the mapping relationship between the product target's coordinates on the 3D inspection stage and its coordinates on the 2D image plane is obtained as follows: in: W The width of the image, H The height of the image. h 2 is the height at which the camera is placed. β ,2 α , γ These refer to the camera's horizontal viewing angle, vertical viewing angle, and pitch angle. Based on the positional relationship between the three-dimensional spatial coordinates of the inspection platform and the image plane coordinates, combined with the calculation of the similarity of the product's shadow color components, the shadow area is defined, and the size of the shadow projection is calculated and 3D transformed to ultimately obtain the product's height (or thickness). Simultaneously, based on the product's height, the distance between the product's center and the main camera can be calculated. Based on the change in this distance and the measured change in product size, a relationship model is derived between the two to correct for the actual product size and improve the accuracy of product size detection.
[0036] This application also provides a product size detection system, which includes a detection platform, a main camera, an auxiliary camera, and a detection analysis system. The detection analysis system is used to implement the product size detection method described above.
[0037] This application addresses the shortcomings of single- and dual-lens camera inspection technologies in comprehensively detecting product dimensions and defects. In a fixed inspection environment, it employs a dual-camera acquisition mode ("main camera + auxiliary camera"), combined with image size detection and analysis algorithms, to achieve real-time and accurate detection of product planar dimensions (including rectangular, circular, and irregular shapes) and height dimensions. The core system consists of three parts: an inspection platform, an inspection analysis system, and an inspection platform calibration system. Inspection results can be simultaneously presented on a PC web terminal and a mobile device.
[0038] I. Testing Station Setup Core function: To provide a stable and standardized environment for product placement and image acquisition, ensuring that the camera shooting angle is fixed and free from interference, and providing accurate original images for subsequent size calculations.
[0039] Testing platform: Equipped with calibration scale to assist in product positioning, ensuring that the product's position relative to the camera is consistent during each test, thus reducing positioning errors.
[0040] Main camera: It takes pictures in a normal shooting mode (perpendicular to the inspection table surface), and its core function is to collect images of the product's planar contours, providing basic data for the calculation of planar dimensions.
[0041] Auxiliary camera: It takes pictures using an oblique photography method (at a certain angle with the inspection table). Its main purpose is to collect images related to the product's shadow and three-dimensional contour, providing data for the calculation of height (thickness) dimensions.
[0042] Infrared proximity switch (dedicated to assembly line scenarios): When a product on the assembly line approaches the detection area, it automatically triggers the camera to take a picture, avoiding image blurring or false shots caused by product movement, and is suitable for dynamic production scenarios.
[0043] Working logic: Place the product within the scale lines on the table (no manual placement is required in assembly line scenarios), and the main and auxiliary cameras will automatically capture images simultaneously. After capturing the images, the image data will be directly transmitted to the detection and analysis system.
[0044] II. Detection and Analysis System Core function: Receives image data from the main and auxiliary cameras, processes it separately using dedicated algorithms, calculates the product's planar dimensions (length, width, diameter, area) and height, and finally outputs visualized inspection results.
[0045] 1. Main camera image detection and analysis (planar dimension calculation) Core algorithm flow: Original image input → Image grayscale processing (converts color image to black and white grayscale image, simplifies image data volume, reduces color interference, and focuses on contour features) → Image binarization processing (converts grayscale image to black and white binary image, highlights the contrast between product contour and background, and makes edges clearer) → Canny improved operator edge detection (optimizes traditional Canny operator, improves noise resistance, accurately identifies product edge contours, and avoids edge blurring caused by ambient light and product surface reflection) → Product edge framing and correction (automatically selects edge areas according to product shape and corrects contour deformation caused by slight shooting angle offset) → Calculation of median pixel distance of product edge (statistically calculates the median pixel distance of edge contours, reducing the error impact of individual abnormal pixels) → Product edge size conversion (converts pixel units to actual physical units through multi-parameter factor fitting correction, eliminating errors caused by device factors such as camera resolution and shooting distance) → Output product boundary dimensions.
[0046] Examples of product inspection of different shapes (1) Near rectangular products (such as packaging boxes and flat products) Detection logic: The core output dimension is "length + width", which is suitable for products with outlines that are close to rectangles / squares.
[0047] Example 1 Pixel unit data: Length H_size=1655, Width V_size=1141 (edge pixel spacing calculated by the algorithm); Actual dimensions: Length 29cm, Width 19.7cm (physical units converted after fitting correction, which can be directly used for production quality inspection).
[0048] Example 2: Output only pixel unit data (length 1442, width 1102), the actual size can be quickly converted using the same fitting correction formula.
[0049] (2) Near-circular products (such as bottle caps, round parts) Detection logic: Simultaneously output "rectangular frame size + circular frame size", with diameter as the core output dimension, to adapt to products with a near-circular outline.
[0050] Example Pixel unit data: Rectangular frame (length 372, width 358), circular frame diameter D_size=363; By analyzing the RGB color component distribution and pixel integral projection, the accuracy of the edges is further verified, avoiding the misjudgment of shadows or impurities as product edges.
[0051] (3) Completely irregular products (without a fixed outline, such as irregularly shaped parts or custom components) Detection logic: The basic output is "length + width" (maximum bounding rectangle size), and advanced support is "area statistics by region" (adapted to products with multiple color regions).
[0052] The SLIC superpixel multi-scale initial segmentation algorithm is used (to segment the image into multiple consecutive superpixel blocks, accurately separate the product from the background, and identify different color areas on the product surface).
[0053] 2. Auxiliary camera image detection and analysis (height / thickness dimension calculation) Core principle: Product images are acquired through oblique photography. The product height is calculated by utilizing the mapping relationship between the coordinates of the 3D inspection platform and the coordinates of the 2D image plane, combined with product shadow analysis. Height calculation logic: The product shadow is separated from the product body using a color component similarity algorithm. The shadow width (in pixels) is measured and then converted to the actual height using a coordinate mapping formula. Simultaneously, the planar dimensions are corrected using the distance change between the product center and the main camera, further improving detection accuracy.
[0054] III. Calibration System for Testing Platform Core function: To solve the problem of dimensional error caused by the shift in the detection environment after long-term use of the detection table (such as table surface wear and camera displacement) or after movement and adjustment, and to ensure the long-term stable detection accuracy of the system.
[0055] Triggering scenarios: When the testing station has been used for more than six months, has been moved, or when the testing results show continuous deviations, calibration needs to be initiated.
[0056] Operation process: Input the "actual measured dimensions" of the new product to be tested (such as length, width, and height measured with standard measuring tools). The system will automatically compare the image pixel data of the product with the actual dimensions, re-optimize the fitting correction formula, and complete the automatic correction.
[0057] Core value: Avoiding the decline in detection accuracy due to equipment aging and environmental changes, extending system lifespan, and reducing maintenance costs.
[0058] The product size detection method and system provided in this application acquires a top-view image captured by the main camera and shadow and three-dimensional contour images captured by the auxiliary camera. Based on the top-view image, the top-view planar dimensions of the product under test are determined. Based on the shadow and three-dimensional contour images, the height and tilt planar dimensions of the product under test are determined. The top-view planar dimensions and the tilt planar dimensions are weighted and fused using a pre-determined scaling factor to obtain the final planar dimensions of the product under test. This method can improve the efficiency and speed of product three-dimensional size measurement, reduce the workload of manual measurement and human error and arbitrariness, and comprehensively improve the intelligence and accuracy of product three-dimensional size measurement.
[0059] This application also provides a terminal device, such as... Figure 6 As shown, it includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the product size detection method provided in the first aspect.
[0060] In applications, terminal devices may include, but are not limited to, processors and memory. Figure 6 This is merely an example of a terminal device and does not constitute a limitation on the terminal device. It may include more or fewer components than illustrated, or a combination of certain components, or different components, such as input / output devices, network access devices, etc. Input / output devices may include cameras, audio capture / playback devices, displays, etc. Network access devices may include network modules for wireless network communication with external devices.
[0061] In applications, the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0062] In applications, the memory may be an internal storage unit of the terminal device in some embodiments, such as the hard drive or RAM of the terminal device. In other embodiments, the memory may be an external storage device of the terminal device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. The memory may also include both internal and external storage units of the terminal device. The memory is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of computer programs. The memory can also be used to temporarily store data that has been output or will be output.
[0063] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the steps in the above-described method embodiments.
[0064] This application implements all or part of the processes in the methods of the above embodiments, which can be accomplished by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, such as a USB flash drive, a portable hard drive, a magnetic disk, or an optical disk.
[0065] Those skilled in the art will recognize that the device and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0066] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interface, or the device may be indirectly coupled or communicated, and may be electrical, mechanical, or other forms.
[0067] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A product size detection method characterized by, The detection is realized by detecting a table top, a main camera and an auxiliary camera; the table top is used for placing a product to be detected; the light of the main camera is perpendicular to the table top and is used for collecting an overhead image of the product to be detected; the light of the auxiliary camera is at a certain angle with the table top and is used for collecting a shadow and a three-dimensional contour image of the product to be detected; The product size detection method comprises: collecting the overhead image collected by the main camera and the shadow and the three-dimensional contour image collected by the auxiliary camera; determining an overhead perspective plane size of the product to be detected based on the overhead image and determining a height and an inclined perspective plane size of the product to be detected based on the shadow and the three-dimensional contour image; weighting and fusing the overhead perspective plane size and the inclined perspective plane size by using a pre-determined scale factor to obtain a final plane size of the product to be detected.
2. The product size detection method according to claim 1, wherein The determination of the overhead perspective plane size of the product to be detected based on the overhead image comprises: carrying out gray-scale and binary processing on the overhead image and using a Canny improved operator to carry out edge detection to determine an edge frame of the product to be detected; determining an overhead perspective pixel size of the product to be detected based on the edge frame of the product to be detected; using a pre-determined scale between an actual size of the product and a pixel size to convert the overhead perspective pixel size into the overhead perspective plane size of the product to be detected.
3. The product size detection method according to claim 1, wherein The determination of the height and the inclined perspective plane size of the product to be detected based on the shadow and the three-dimensional contour image comprises: determining a mapping relationship between a three-dimensional space coordinate based on the table top and a plane coordinate based on the image collected by the auxiliary camera; determining a shadow width and an inclined perspective plane size of the product to be detected based on the shadow and the three-dimensional contour image and the mapping relationship; According to the shadow width Δ w The elevation angle γ of the auxiliary camera determines the height Δ of the product being inspected. h Δ h =Δ w / tanγ.
4. The product size detection method according to claim 3, wherein The determination of the shadow width and the inclined perspective plane size of the product to be detected based on the shadow and the three-dimensional contour image and the mapping relationship comprises: carrying out gray-scale and binary processing on the shadow and the three-dimensional contour image and using a color component similarity to separate the shadow and the product to be detected; using a Canny improved operator to carry out edge detection to determine an edge frame of the shadow and an edge frame of the product to be detected; determining the shadow width and the inclined perspective plane size of the product to be detected based on the edge frame of the shadow and the edge frame of the product to be detected.
5. The product size detection method according to claim 4, wherein The determination of the shadow width and the inclined perspective plane size of the product to be detected based on the edge frame of the shadow and the edge frame of the product to be detected comprises: determining an inclined perspective pixel size of the shadow based on the edge frame of the shadow and determining an inclined perspective pixel size of the product to be detected based on the edge frame of the product to be detected; using the mapping relationship to convert the inclined perspective pixel size of the shadow into the shadow width of the product to be detected; using the mapping relationship to convert the inclined perspective pixel size of the product to be detected into the inclined perspective plane size of the product to be detected.
6. The product size detection method of claim 1, wherein, Before the weighting and fusing of the overhead perspective plane size and the inclined perspective plane size by using the pre-determined scale factor to obtain the final plane size of the product to be detected, the method further comprises: respectively using the main camera and the auxiliary camera to collect images of the sample, determine the top-view perspective plane size and the inclined-view perspective plane size of the sample; determine a corresponding scale factor according to the difference between the top-view perspective plane size and the inclined-view perspective plane size of the sample and the actual plane size of the sample.
7. The product size detection method of claim 1, wherein After the step of using the predetermined scale factor to fuse the top-view perspective plane size and the inclined-view perspective plane size to obtain the final plane size of the detected product, the method further comprises: if the difference between the final plane size of the detected product and the actual plane size is greater than a preset threshold, adjusting the light angle of the auxiliary camera and the scale factor; re-detecting until the difference between the detected plane size and the actual plane size is less than or equal to the preset threshold, and taking the adjusted scale factor as a new scale factor.
8. A product size detection system characterized by, The product size detection device comprises a detection table, a main camera, an auxiliary camera and a detection analysis system, and the detection analysis system is configured to implement the product size detection method according to any one of claims 1 to 7.
9. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The product size detection device comprises a detection table, a main camera, an auxiliary camera and a detection analysis system, and the detection analysis system is configured to implement the product size detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The product size detection device comprises a detection table, a main camera, an auxiliary camera and a detection analysis system, and the detection analysis system is configured to implement the product size detection method according to any one of claims 1 to 7.