Detection method, device, system, equipment, medium and product
Through the image processing-based method, three-dimensional image detection and differential curve technology are used to solve the problem of low gap detection accuracy in the prior art, and higher detection accuracy and effective detection of irregular gaps are achieved.
Patent Information
- Application Number
- CN202510338985.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2045-03-21
AI Technical Summary
When detecting product gap sizes, manual detection efficiency is low and the accuracy is difficult to ensure, and the detection accuracy of the automation equipment for irregular gaps is low.
By using the size detection method based on image processing, the three-dimensional detection image is obtained, the cross-sectional fitting curve is determined, and the differential process is performed to obtain the differential curve of the depth differential value, and the position of the side wall of the gap is determined based on the differential curve, thereby calculating the width dimension of the gap.
The accuracy of gap size detection is improved, the position changes of the gap side wall can be more accurately identified, and the detection ability of irregular gaps is enhanced.
Smart Images

Figure CN119860714A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of dimension detection technology, and in particular to a detection method, device, system, equipment, medium and product. Background Art
[0002] In the manufacturing process of various products, the gap size of the product is an important indicator for judging product quality. If the gap of the product is too large, it may affect the stability of assembly and the reliability of quality. For example, if the gap between the battery shell and the battery top cover is too large, the laser may pass through the gap and irradiate the inside of the battery during welding, which may damage the battery and reduce the quality of the battery.
[0003] Regarding the gaps in the products, in some embodiments, manual detection methods are used for measurement, but the detection efficiency of manual detection is low and the accuracy is difficult to guarantee; in some implementations, automated equipment is used for contact detection, but its detection accuracy is low for irregular gaps in the products. Summary of the invention
[0004] The present application aims to solve at least one of the technical problems in the background technology. To this end, one purpose of the present application is to provide a detection method, device, system, equipment, medium and product to improve the detection accuracy of the size of the target gap.
[0005] The embodiment of the first aspect of the present application provides a size detection method based on image processing. The size detection method includes acquiring a three-dimensional detection image, the three-dimensional detection image contains depth information corresponding to the target gap and the first component and the second component adjacent to the target gap; based on the three-dimensional detection image, determining a cross-sectional fitting curve perpendicular to the extension direction of the target gap and passing through a preset detection point; the cross-sectional fitting curve is used to characterize the cross-sectional shape of the target gap; performing differential processing on the cross-sectional fitting curve to obtain a differential curve for characterizing the depth differential value corresponding to each pixel point; based on the differential curve, determining a first position and a second position that respectively characterize the positions of two opposite side walls of the target gap; and determining the width size of the target gap according to the position information of the first position and the second position in a preset coordinate system.
[0006] In the technical solution of the embodiment of the present application, the cross-section fitting curve is differentiated and the changing trend of the cross-section fitting curve is converted into a differential curve of the depth differential value. The differential curve can clearly show the rate of depth change at each pixel point, which helps to accurately identify the position change of the gap side wall. The characteristics of the depth differential value are used to determine the positions of the two relative side walls of the target gap, thereby determining the width dimension between the two side walls and improving the accuracy of size detection.
[0007] In some embodiments, the differential curve includes a first waveform and a second waveform that are adjacent and correspond to two opposite side walls of the target gap, respectively; the first position is located within a pixel range corresponding to a half-wave of the first waveform adjacent to the second waveform; and the second position is located within a pixel range corresponding to a half-wave of the second waveform adjacent to the first waveform. By setting the first position and the second position within the pixel range corresponding to two mutually adjacent half-waves, the two positions focus on the waveform half-wave area, corresponding to the side wall of the target gap that is closer to the downstream area, which can effectively utilize the depth information of the three-dimensional detection image, obtain more accurate position positioning, and improve the gap width measurement accuracy.
[0008] In some embodiments, based on the differential curve, determining the first position and the second position that respectively characterize the positions of the two opposite side walls of the target gap includes: performing a first filtering step on the differential curve to obtain a first filtering curve, the first filtering step including filtering out a portion of the waveform in the differential curve whose depth differential value exceeds a first preset threshold range; and determining the first position and the second position based on the first filtering curve. By performing the first filtering process on the differential curve and filtering out a portion of the waveform that exceeds the first preset threshold range, the interference caused by the protrusions on the two side wall surfaces of the target gap can be removed, and the noise and abnormal fluctuations that cause erroneous judgments when searching for the side wall position can be minimized, thereby improving the accuracy of the target gap detection width size.
[0009] In some embodiments, the first filtering step includes: obtaining a first preset threshold range; the first preset threshold range includes an upper limit value and a lower limit value; in response to the depth differential value of the pixel point in the differential curve being greater than the upper limit value of the first preset threshold range, replacing the depth differential value of the pixel point with the upper limit value of the first preset threshold range; in response to the depth differential value of the pixel point in the differential curve being less than the lower limit value of the first preset threshold range, replacing the depth differential value of the pixel point with the lower limit value of the first preset threshold range; fitting the depth differential value of each pixel point to obtain a first filtering curve. By setting the first preset threshold range of upper and lower limits and filtering the depth differential value that exceeds the range, the influence of noise and abnormal values in the differential curve can be further reduced. This helps to better determine the first position and the second position, and further improve the accuracy of the target gap detection width size.
[0010] In some embodiments, obtaining the first preset threshold range includes: determining a first filter line, the first filter line is parallel to the coordinate axis representing the pixel position in the differential curve, and the first filter line intersects with the first waveform or the second waveform; in response to the pixel distance between the two intersection points where the first filter line intersects with the first waveform or the second waveform being the first preset width, and the depth differential value corresponding to the first filter line being greater than 0, determining the depth differential value corresponding to the first filter line as the upper limit value of the first preset threshold range; and / or in response to the pixel distance between the two intersection points where the first filter line intersects with the first waveform or the second waveform being the second preset width, and the depth differential value corresponding to the first filter line being less than 0, determining the depth differential value corresponding to the first filter line as the lower limit value of the first preset threshold range. For the first waveform and the second waveform in different directions, using the first filter line to respectively determine the filtering range of the first waveform and the second waveform can respectively reduce the interference caused by the protrusions on the two side wall surfaces of the target gap, which helps to better determine the first position and the second position, and further improve the accuracy of the target gap detection width size.
[0011] In some embodiments, obtaining the first preset threshold range includes: performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve to obtain a differential transformation curve; determining a second filter line, the second filter line is parallel to the coordinate axis representing the pixel point position in the differential transformation curve, and the second filter line intersects with the first waveform and the second waveform at the same time; in response to the smaller of the pixel distance between the two intersection points where the second filter line intersects with the first waveform and the pixel distance between the two intersection points where the second filter line intersects with the second waveform being the third preset width, determining the depth differential value corresponding to the second filter line as the upper limit value of the first preset threshold range; and determining the lower limit value of the first preset threshold range as 0. By performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve so that the first waveform and the second waveform are located on the same side, the first preset threshold range can be determined by setting the upper limit value of the first preset threshold range, which helps to improve the efficiency of differential curve processing.
[0012] In some embodiments, based on the first filtering curve, determining the first position and the second position includes: determining the pixel point where the depth differential value of the first waveform adjacent to the half-wave of the second waveform is equal to the upper limit or lower limit of the first preset threshold range as the first position; determining the pixel point where the depth differential value of the second waveform adjacent to the half-wave of the first waveform is equal to the upper limit or lower limit of the first preset threshold range as the second position. The interference of noise and abnormal values has been removed through the first filtering step, so that the first filtering curve can more realistically reflect the depth change of the target gap, and determining the first position and the second position as the upper limit or lower limit of the first preset threshold range respectively can shorten the time for determining the first position and the second position on the first filtering curve, thereby improving the detection efficiency.
[0013] In some embodiments, based on the first filter curve, determining the first position and the second position further includes: performing a second filtering step on the first filter curve to obtain a second filter curve, the second filtering step including filtering out a portion of the waveform whose depth differential value falls within a second preset threshold range in the first filter curve; and determining the first position and the second position based on the second filter curve. By performing a second filtering process on the first filter curve and filtering out a portion of the waveform that falls within the second preset threshold range, the bottom area of the first waveform and the second waveform can be removed, and the possibility of taking points at the intersection area between the first component and the second component and the target gap, and the possibility of taking points at the intersection area between the side and bottom of the target gap, can be reduced as much as possible, thereby improving the accuracy of the target gap detection width size.
[0014] In some embodiments, the second filtering step includes: obtaining a second preset threshold range; the upper limit value of the second preset threshold range is greater than 0 and less than the upper limit value of the first preset threshold range, and the lower limit value of the second preset threshold range is less than 0 and greater than the lower limit value of the first preset threshold range; in response to the depth differential value corresponding to the pixel point in the first filtering curve falling into the second preset threshold range, the depth differential value corresponding to the pixel point is replaced with a null value; the curve after filtering the first filtering curve is determined as the second filtering curve. For the first waveform and the second waveform in different directions, the upper limit value and the lower limit value of the second preset threshold range are used, and the falling part is processed, which mainly eliminates the interference caused by structural changes at the junction of the first component and the target gap, the junction of the side and bottom of the target gap, and the junction of the second component and the target gap, so as to improve the accuracy of the target gap detection width size.
[0015] In some embodiments, obtaining the second preset threshold range includes: determining a third filter line, the third filter line is parallel to the coordinate axis representing the pixel position in the differential curve, and the third filter line intersects with the first waveform or the second waveform; in response to the pixel distance between the two intersections where the third filter line intersects with the first waveform or the second waveform being the fourth preset width, and the depth differential value corresponding to the third filter line being greater than 0, determining the depth differential value corresponding to the third filter line as the upper limit value of the second preset threshold range; and / or in response to the pixel distance between the two intersections where the third filter line intersects with the first waveform or the second waveform being the fifth preset width, and the depth differential value corresponding to the third filter line being less than 0, determining the depth differential value corresponding to the third filter line as the lower limit value of the second preset threshold range. For the first waveform and the second waveform in different directions, using the third filter line to respectively determine the filtering range of the first waveform and the second waveform can respectively reduce the interference caused by the structure at the junction of the side of the target gap and the first component and the second component, which helps to better determine the first position and the second position, and further improve the accuracy of the target gap detection width size.
[0016] In some embodiments, the second filtering step also includes: performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve to obtain a differential transformation curve; obtaining a second preset threshold range; the upper limit value of the second preset threshold range is greater than 0 and less than the upper limit value of the first preset threshold range, and the lower limit value of the second preset threshold range is 0; in response to the depth differential value corresponding to the pixel point in the first filter curve falling into the second preset threshold range, the depth differential value corresponding to the pixel point is replaced with a null value; and the curve after filtering the first filter curve is determined as the second filter curve. By performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve so that the first waveform and the second waveform are located on the same side, and then filtering the absolute value transformed first filter curve in the second filtering step, it helps to improve the detection accuracy and the efficiency of the differential curve processing.
[0017] In some embodiments, obtaining the second preset threshold range includes: determining a fourth filter line, the fourth filter line is parallel to the coordinate axis representing the pixel position in the differential transformation curve, and the fourth filter line intersects with the first waveform and the second waveform at the same time; in response to the pixel distance between the two intersection points where the fourth filter line intersects with the first waveform and the pixel distance between the two intersection points where the fourth filter line intersects with the second waveform being the sixth preset width, determining the depth differential value corresponding to the fourth filter line as the upper limit value of the second preset threshold range; and determining the lower limit value of the second preset threshold range as 0. After the depth differential value corresponding to each pixel point in the differential curve is transformed into an absolute value so that the first waveform and the second waveform are located on the same side, the second preset threshold range can be determined by setting the upper limit value of the second preset threshold range, which helps to improve the efficiency of differential curve processing.
[0018] In some embodiments, based on the second filter curve, determining the first position and the second position includes: determining the middle position of the pixel points in the area where the depth differential value of the first waveform in the second filter curve is greater than 0 and less than or equal to the upper limit value of the first preset threshold range in the half-wave of the second waveform adjacent to the second waveform as the first position; the depth differential value corresponding to the pixel points in the first waveform is greater than or equal to 0; determining the middle position of the pixel points in the area where the depth differential value of the second waveform in the second filter curve is less than 0 and greater than or equal to the lower limit value of the first preset threshold range as the second position. By determining the first position by the middle position of the pixel points corresponding to the half-wave of the first waveform in the second filter curve close to the second waveform, and determining the second position by the middle position of the pixel points corresponding to the half-wave of the second waveform in the second filter curve close to the first waveform, the value error during filtering can be further reduced, and the detection accuracy of the target gap can be improved.
[0019] In some embodiments, the dimension detection method further includes: determining the top surface position of the first component and the top surface position of the second component based on the cross-sectional fitting curve; and determining the height difference between the first component and the second component based on the top surface position of the first component and the top surface position of the second component. By detecting the height difference between the first component and the second component, it is possible to more comprehensively obtain whether the positioning of the first component and the second component is qualified, improve the detection effect, and save time.
[0020] In some embodiments, the size detection method further includes: obtaining a data set consisting of the width of the target gap corresponding to a plurality of preset detection points sequentially arranged at intervals along the extension direction of the target gap; in response to the continuous appearance of N values greater than a preset width threshold in the data set, determining that the width of the target gap is unqualified. By using continuous preset detection points to detect the gap situation for the target gap to determine the eligibility of the width of the target gap, compared with using an average value algorithm for each preset detection point, it can more realistically reflect the specific gap situation in the target gap and improve the accuracy of target gap detection.
[0021] The second aspect of the present application provides a battery pre-welding detection method, wherein the first component is a battery shell, the second component is a battery top cover, and the target gap is the gap between the battery shell and the battery top cover; the battery pre-welding detection method includes: using the above-mentioned size detection method to determine the width of the gap between the battery shell and the battery top cover. By detecting the gap width of the battery before welding the battery top cover and the battery shell, the accuracy of the size detection can be improved, which is conducive to improving the quality of subsequent welding, thereby improving the battery quality and production efficiency.
[0022] An embodiment of the third aspect of the present application provides a size detection device based on image processing, the size detection device comprising: a first acquisition module, used to acquire a three-dimensional detection image, the three-dimensional detection image containing depth information corresponding to a target gap and a first component and a second component adjacent to the target gap, respectively; a first processing module, used to determine, based on the three-dimensional detection image, a cross-sectional fitting curve that is perpendicular to the extension direction of the target gap and passes through a preset detection point; the cross-sectional fitting curve is used to characterize the cross-sectional shape of the target gap; a second processing module, used to perform differential processing on the cross-sectional fitting curve to obtain a differential curve for characterizing the depth differential value corresponding to each pixel point; a third processing module, used to determine, based on the differential curve, a first position and a second position that respectively characterize the positions of two opposite side walls of the target gap; and a fourth processing module, used to determine the width size of the target gap based on the position information of the first position and the second position in a preset coordinate system.
[0023] The fourth aspect of the present application provides a pre-welding dimension detection system, which includes a clamping device, an image acquisition device, and a control device. The clamping device is used to clamp the first component and the second component to be welded to a set position so that a target gap is formed between the first component and the second component; the image acquisition device is configured to obtain a three-dimensional detection image of the position of the target gap; the control device is configured to receive the three-dimensional detection image and execute the above-mentioned dimension detection method. Through the mutual cooperation of the control device, the clamping device, and the image acquisition device, the detection of the target gap is achieved. On the one hand, compared with manual detection, it is more efficient, has more detection points, and more accurate detection results; on the other hand, it can help prepare for the next process flow according to the detection results.
[0024] An embodiment of the fifth aspect of the present application provides a computing device, which includes at least one processor; and at least one memory communicatively connected to the at least one processor, the at least one memory storing instructions, which, when executed individually or collectively by the at least one processor, enable the computing device to execute the above-mentioned size detection method.
[0025] An embodiment of the sixth aspect of the present application provides a computer-readable storage medium storing instructions, which, when executed individually or collectively by one or more processors of a computing device, enable the computing device to perform the above-mentioned size detection method.
[0026] An embodiment of the seventh aspect of the present application provides a computer program product, comprising instructions, which, when executed individually or collectively by one or more processors of a computing device, enable the computing device to perform the above-mentioned size detection method.
[0027] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application.
[0029] Figure 1 A schematic flow chart of a size detection method provided in some embodiments of the present application; Figure 2 Schematic diagram of cross-sectional fitting curves and differential curves provided for some embodiments of the present application; Figure 3A schematic diagram of a cross-sectional fitting curve provided for some embodiments of the present application; Figure 4 A schematic diagram of a first filtering curve provided in some embodiments of the present application; Figure 5 A schematic diagram of a first filtering curve after absolute value transformation provided in some embodiments of the present application; Figure 6 A schematic diagram of a second filtering curve provided in some embodiments of the present application; Figure 7 A schematic diagram of a second filtering curve after absolute value transformation provided in some embodiments of the present application; Figure 8 A structural block diagram of a size detection device provided in some embodiments of the present application; Fig. 9 A control logic block diagram of a size detection system provided in some embodiments of the present application; Fig.10 A schematic diagram of the structure of a size detection system provided in some embodiments of the present application; Fig.11 A schematic diagram of the algorithm flow in the size detection system provided in some embodiments of the present application.
[0030] Description of reference numerals: 100, dimension detection method; 200, dimension detection system; 210, clamping device; 220, image acquisition device; 221, image acquisition unit; 222, driving unit; 230, control device; 300, dimension detection device; 310, first acquisition module; 320, first processing module; 330, second processing module; 340, third processing module; 350, fourth processing module. DETAILED DESCRIPTION
[0031] The following embodiments of the technical solution of the present application are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.
[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0033] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0034] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0035] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0036] In the description of the embodiments of the present application, the term "multiple" refers to more than two (including two). Similarly, "multiple groups" refers to more than two groups (including two groups), and "multiple pieces" refers to more than two pieces (including two pieces).
[0037] In the description of the embodiments of the present application, the technical terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the embodiments of the present application and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the embodiments of the present application.
[0038] In the description of the embodiments of the present application, unless otherwise clearly specified and limited, technical terms such as "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal connection of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.
[0039] At present, from the perspective of market development, the application of rechargeable batteries is becoming more and more extensive. Rechargeable batteries are not only used in energy storage power systems such as hydropower, thermal power, wind power and solar power stations, but also widely used in various electronic devices, such as electric bicycles, electric motorcycles, electric vehicles and other electric vehicles, as well as military equipment and aerospace and other fields. With the continuous expansion of the application field of rechargeable batteries, the market demand is also constantly expanding.
[0040] The battery cell includes a battery cover and a battery shell. The battery cover is located on the top of the battery cell and is provided with key components such as a liquid injection hole, a safety valve, and electrode terminals. The battery shell is used to accommodate the internal components of the battery cell. The sealing and stability between the battery cover and the battery shell play a key role in battery performance and safety. For example, the battery cover and the battery shell are laser welded, and a high-energy-density laser beam is used to partially melt the connection between the battery cover and the battery shell to achieve a firm connection and improve the sealing performance.
[0041] Therefore, when welding the gap between the battery top cover and the battery shell, it is necessary to detect the gap size to prevent the laser from passing through the gap and irradiating the inside of the battery during the welding process due to the gap being too large, thereby causing damage to the battery and increasing the production cost of the battery.
[0042] In some embodiments, after the battery top cover and the battery shell are assembled, the gap between the battery top cover and the battery shell is inspected manually. The efficiency of manual inspection is low and the accuracy is difficult to guarantee, which reduces production efficiency. In some embodiments, automated equipment is used for contact detection. The automated equipment can only measure the size of the gap edge, and the detection accuracy of irregular gaps is low. It cannot effectively screen out batteries with unqualified gaps, which may cause damage to the battery during welding.
[0043] In order to solve the above problems, the present application provides a size detection method based on image processing, which includes: acquiring a three-dimensional detection image, determining a cross-sectional fitting curve perpendicular to the extension direction of the target gap and passing through a preset detection point based on the three-dimensional detection image, performing differential processing on the cross-sectional fitting curve to obtain a differential curve for characterizing the depth differential value corresponding to each pixel point, determining a first position and a second position respectively characterizing the positions of two opposite side walls of the target gap based on the differential curve, and determining the width dimension of the target gap according to the position information of the first position and the second position in a preset coordinate system. By performing differential processing on the cross-sectional fitting curve, the change trend of the cross-sectional fitting curve is converted into a differential curve of the depth differential value. The differential curve can clearly show the rate of depth change at each pixel point, which helps to accurately identify the position change of the gap side wall, and use the characteristics of the depth differential value to determine the position of the two opposite side walls of the target gap, thereby determining the width dimension between the two side walls, thereby improving the accuracy of size detection.
[0044] The image processing-based dimension detection method disclosed in the embodiment of the present application can be applied to any component that requires gap detection, including but not limited to the detection of gap size between components in industrial production processes such as mechanical parts manufacturing and electronic product assembly in the industrial manufacturing field; the detection of gap size between aerospace components in the aerospace field; the detection of gap size between automobile components in the automobile manufacturing field; and the detection of gap size before welding of battery top cover and battery shell in the new energy field.
[0045] The battery cells detected by the size detection method of the present application are used as power supply for electrical devices, and the electrical devices may be, but are not limited to, mobile phones, tablets, laptops, electric toys, electric tools, battery cars, electric cars, ships, spacecraft, etc. Among them, electric toys may include fixed or mobile electric toys, such as game consoles, electric car toys, electric ship toys, and electric airplane toys, etc., and spacecraft may include airplanes, rockets, space shuttles, and spacecraft, etc. Battery cells may also be used as power supply for energy storage devices, and the energy storage devices may be, but are not limited to, energy storage containers, energy storage cabinets, energy storage power stations, energy storage battery packs, or portable energy storage systems, etc.
[0046] Combination Figures 1 to 3 As shown, the embodiment of the present application provides a size detection method based on image processing, and the size detection method 100 includes: Step S110, obtaining a three-dimensional detection image, wherein the three-dimensional detection image includes depth information corresponding to a target gap and a first component and a second component adjacent to the target gap; Step S120: Based on the three-dimensional detection image, determine a cross-sectional fitting curve that is perpendicular to the extension direction of the target gap and passes through a preset detection point; the cross-sectional fitting curve is used to characterize the cross-sectional shape of the target gap; Step S130, performing differentiation processing on the cross-section fitting curve to obtain a differential curve for characterizing the depth differential value corresponding to each pixel point; Step S140, determining a first position and a second position respectively representing positions of two opposite side walls of the target gap based on the differential curve; Step S150: determining a width of the target gap according to position information of the first position and the second position in a preset coordinate system.
[0047] The present application is applicable to the detection of gaps between any components. For example, after the first component and the second component are assembled, there is a gap between the first component and the second component. The gap is the target gap. The length and depth of the target gap are related to the structural shapes of the first component and the second component, and the specific parameters are not limited.
[0048] For target gap detection, it is necessary to determine a preset detection point. The preset detection point is a detection point on the surface of the first component or the second component on the target gap. The preset detection point can be a point evenly set along the extension direction of the target gap, or it can be a single point with a specific mark. The preset detection point is used to characterize the width dimension of the target gap that needs to be detected passing through the preset detection point.
[0049] In some embodiments, a preset detection point may be determined first, and a three-dimensional detection image including the preset detection point may be obtained based on the preset detection point; in some embodiments, multiple three-dimensional detection images may be obtained along the extension direction of the target gap, and the preset detection point to be detected may be determined based on the obtained three-dimensional detection images. For example, multiple preset detection points may be stored in the size detection system. The specific order of steps may be determined according to the actual situation.
[0050] In step S110, a three-dimensional detection image including the target gap is obtained. Any three-dimensional detection device that can obtain a three-dimensional detection image meets the requirements of this application, such as a CCD (Charge Coupled Device, semiconductor photosensitive element) three-dimensional camera, a laser triangulation three-dimensional camera, a structured light three-dimensional camera, and a binocular stereoscopic vision three-dimensional camera, etc. For ease of understanding, a three-dimensional coordinate system is established for auxiliary explanation. In the three-dimensional coordinate system, the X axis is the horizontal axis, which is parallel to the extension direction of the target gap; the Y axis is the horizontal axis, which is perpendicular to the extension direction of the target gap; and the Z axis is the vertical axis, which indicates the depth of the target gap.
[0051] In some embodiments, the three-dimensional detection image obtained by using the three-dimensional detection device may include a plane map, for example, an XY plane, the plane where the plane map is located is parallel to the extension direction of the target gap, and the plane map includes the grayscale information of the first component, the second component and the target gap. The grayscale information refers to the grayscale value of each pixel in the image, which is used to represent the brightness of the pixel. For example, when acquiring a three-dimensional detection image, the grayscale information can help identify the contours and boundaries of the target gap and adjacent components. Due to the different surface characteristics of the first component, the second component and the target gap, and the different distances relative to the detection device, different grayscale values will be presented on the grayscale image, so that the approximate position and range of the target gap can be preliminarily determined by analyzing the grayscale information.
[0052] In some embodiments, the three-dimensional detection image obtained by the three-dimensional detection device may also include a depth map, for example, a depth map of the YZ plane, where the plane of the depth map is perpendicular to the extension direction of the target gap. The depth map includes depth information corresponding to the first component and the second component respectively, and the depth information is grayscale information containing different depths of the first component and the second component and the depth of the target gap, and the depth information can be used to determine the width of the target gap and the depth of the target gap.
[0053] It should be noted that the target gap in the plan view may be provided with multiple preset detection points, each preset detection point has a corresponding depth map, and multiple preset points in the plan view that need to be detected are set as the target detection area. In order to facilitate the rapid determination of the target detection area, a caliper and a locator can be used to determine the target detection area. The position of the locator can be used as the center point of the target detection area or as the position of the caliper. In practical applications, multiple locators can be set. Optionally, the position of the locator moves with the position of the caliper.
[0054] The interval of the calipers and the number of calipers can be determined according to the preset detection interval and detection number. The detection interval can be determined according to the conversion rate and the line interval. Optionally, calipers in three directions of X, Y, and Z are set, and the conversion rate can include X conversion rate, Y conversion rate, and Z conversion rate. The caliper in the X direction determines the size of the target gap extension direction, the caliper in the Y direction determines the size of the target gap width direction, and the caliper in the Z direction determines the size of the target gap depth direction.
[0055] In step S120, a depth map including preset detection points is selected according to the acquired three-dimensional image, and the width of the depth map at least covers the target gap and the contact area between the adjacent first component and the second component and the target gap.
[0056] In some embodiments, the process of obtaining the preset detection point through the user interface of the size detection system may include: setting a drop-down menu in the user interface, and determining the preset detection point according to the user's selection operation on the drop-down menu. For example, when the user selects the preset detection point A in the drop-down menu, the preset detection point A is obtained; when the user selects the preset detection point B in the drop-down menu, the preset detection point B is obtained. The method of obtaining the preset detection point is not limited to the above description and can be set according to actual conditions.
[0057] By processing the depth information in the depth map, a cross-sectional fitting curve C is obtained. The cross-sectional fitting curve C includes curves of multiple surfaces including the top surface of the first component, the side and bottom surfaces of the target gap, and the top surface of the second component, reflecting the cross-sectional shape of the target gap.
[0058] In some embodiments, the process of determining the cross-sectional fitting curve C according to the depth information may include: obtaining a detection mode through a user interface, and using the obtained detection mode to process the depth information in the target detection area. The detection mode may include an all-line mode and an average line mode. The above-mentioned method of obtaining the detection mode through the user interface may refer to the method of obtaining the preset detection points.
[0059] The all-line mode removes part of the depth information and processes the remaining depth information to obtain the cross-sectional fitting curve C; the removed part of the depth information may be special information, such as a gap width of 0, a maximum value, a minimum value, etc., or may be removed in proportion.
[0060] The average line mode divides the target gap into multiple small areas along the extension direction, for example, in units of pixel blocks, and averages the depth values in each small area, using the obtained average value to represent the depth information of the small area.
[0061] There is no limitation on the specific fitting tools and fitting methods, which can be determined according to the preset tools and methods of the size detection system, such as Python, Matlab, etc., and fitting methods such as polynomial fitting method or spline interpolation method, etc.
[0062] In step S130, in the coordinate system of the YZ plane, the obtained cross-section fitting curve C can be scattered into a series of discrete points, each point corresponding to a depth value and a coordinate value, and a numerical differential method, such as a central difference method, a forward difference, etc., is used to calculate the depth differential value of each discrete point. The depth differential value of each pixel point is plotted, and the horizontal coordinate of the differential curve is the position of the pixel point, and the vertical coordinate is the depth differential value. The differential curve can reflect the rate of depth change at each pixel point of the cross-section fitting curve C. Compared with the original cross-section fitting curve C, the differential curve can more intuitively and prominently present the characteristics of depth change.
[0063] In some embodiments, the differential curve may be smoothed, such as by using Gaussian filtering or moving average filtering, to eliminate mutation points caused by noise.
[0064] In step S140, the differential curve of the depth differential value corresponding to each pixel point is analyzed. The two opposite side walls of the target gap correspond to two waveforms respectively. The depth changes at the two opposite side walls of the target gap are more drastic, which is manifested as a larger differential value on the differential curve.
[0065] In some embodiments, two extreme points of waveforms corresponding to two opposite side walls of the target gap can be selected, and the extreme points of the two waveforms represent the maximum part of the change of the two opposite side walls of the target gap, and the extreme points of the two waveforms are the first position and the second position of the relative side walls.
[0066] In some embodiments, a threshold may be set and used to filter mutation points caused by noise. The threshold points on the two waveforms corresponding to the two opposite side walls of the target gap are the first position and the second position of the opposite side walls.
[0067] In step S150, the first position and the second position on the differential curve correspond to the corresponding positions on the cross-section fitting curve C respectively. It should be noted that the horizontal distance between the first position and the second position on the differential curve is the width dimension of the target gap on the cross-section fitting curve C.
[0068] Obtain the distance between the first position and the second position on the differential curve in a preset coordinate system. Since the first position and the second position both belong to the YZ plane, the X-axis coordinates of the first position and the second position are the same, for example, the first position coordinates (x, y1, z1), and the second position coordinates (x, y2, z2).
[0069] In some embodiments, the coordinates of the first position and the second position are obtained by a size detection system, and the horizontal interval between the first position and the second position is obtained by the coordinate difference. In some embodiments, the number of pixels between the first position and the second position is obtained by a size detection system, thereby obtaining the horizontal interval between the first position and the second position.
[0070] By differentiating the cross-section fitting curve C, the changing trend of the cross-section fitting curve C is converted into a differential curve of the depth differential value. The differential curve can clearly show the rate of depth change at each pixel point, which helps to accurately identify the position change of the gap side wall. The characteristics of the depth differential value are used to determine the positions of the two relative side walls of the target gap, thereby determining the width dimension between the two side walls and improving the accuracy of size detection.
[0071] According to some embodiments of the present application, the differential curve includes a first waveform and a second waveform that are adjacent to each other and correspond to two opposite side walls of the target gap, respectively; the first position is located within the pixel range corresponding to the half-wave of the first waveform adjacent to the second waveform; and the second position is located within the pixel range corresponding to the half-wave of the second waveform adjacent to the first waveform.
[0072] The cross-sectional fitting curve C is differentiated to obtain a differential curve. Since the depth changes drastically at the two opposite side walls of the target gap, the rapid change in depth causes the differential value to fluctuate greatly, forming an obvious waveform. Therefore, the adjacent first waveform and second waveform in the differential curve correspond to the two opposite side walls of the target gap, respectively.
[0073] For example, when entering the target gap from the top surface of the first component, the depth value changes rapidly, and the differential value increases to form the rising edge of the waveform; after continuing to go deeper into the target gap to a certain extent, the depth change tends to be stable, and the differential value decreases to form the falling edge of the waveform, thus forming a complete waveform corresponding to the side wall of a target gap. Similarly, from the bottom of the target gap to the top surface of the second component, the depth value will also change rapidly, forming another complete waveform, corresponding to the side wall of another target gap.
[0074] The first waveform and the second waveform are both complete waveforms consisting of a rising edge and a falling edge, corresponding to the two side walls of the target gap respectively. The half wave of the first waveform close to the second waveform and the half wave of the second waveform close to the first waveform both refer to the half waveform close to the junction of the two waveforms, and the two adjacent half waves are close to the stable area between the two waveforms.
[0075] By setting the first position and the second position within the pixel range corresponding to two adjacent half-waves, the two positions focus on the waveform half-wave area, corresponding to the side wall closer to the downstream area in the target gap, which can effectively utilize the depth information of the three-dimensional detection image, obtain more accurate position positioning, and improve the gap width measurement accuracy.
[0076] Combination Figure 3 and Figure 4 As shown, according to some embodiments of the present application, step S140 includes: Step S141, performing a first filtering step on the differential curve to obtain a first filtered curve, wherein the first filtering step includes filtering out a portion of the waveform in the differential curve whose depth differential value exceeds a first preset threshold range; Step S142: Determine the first position and the second position based on the first filtering curve.
[0077] The adjacent first waveform and second waveform in the differential curve correspond to the rate of change of the two opposite side walls of the target gap in the depth direction. Due to noise interference, errors in the image acquisition device, or uneven surface of the side wall of the target gap, the differential curve may have some abnormal fluctuations, and the depth differential value corresponding to the fluctuation may exceed the normal range. By setting the first preset threshold range, these abnormal partial waveforms can be filtered out.
[0078] In step S141, a first filtering process is performed on the obtained differential curve. By setting a first preset threshold range L1 in the size detection system, part of the waveform exceeding the first preset threshold range L1 is filtered, and the differential curve after filtering is the first filtering curve Y1.
[0079] For example, a filtering threshold is set in the size detection system, and the part of the waveform in the differential curve that is higher than the filtering threshold is directly filtered out. For example, a filtering ratio is set according to the height of the waveform in the size detection system, and the top of the waveform is filtered according to the ratio, such as 10%, 20%, etc.
[0080] In step S142, the first position and the second position are determined based on the first filtering curve Y1 obtained after filtering. Exemplarily, the first position is located within the pixel range corresponding to the half-wave of the first waveform adjacent to the second waveform after filtering; exemplary, the second position is located within the pixel range corresponding to the half-wave of the second waveform adjacent to the first waveform after filtering.
[0081] By performing a first filtering process on the differential curve and filtering out part of the waveform that exceeds the first preset threshold range L1, the interference caused by the protrusions on the two side wall surfaces of the target gap can be removed, and the noise and abnormal fluctuations that lead to erroneous judgments when searching for the side wall position can be reduced as much as possible, thereby improving the accuracy of the target gap detection width size.
[0082] Combination Figure 3 and Figure 4 As shown, according to some embodiments of the present application, the first filtering step includes: Step S210, obtaining a first preset threshold range L1; the first preset threshold range L1 includes an upper limit value and a lower limit value; Step S220, in response to the depth differential value of the pixel point in the differential curve being greater than the upper limit value of the first preset threshold range, replacing the depth differential value of the pixel point with the upper limit value of the first preset threshold range L1; Step S230, in response to the depth differential value of the pixel point in the differential curve being less than the lower limit value of the first preset threshold range L1, replacing the depth differential value of the pixel point with the lower limit value of the first preset threshold range L1; Step S240: Fit the depth differential value of each pixel point to obtain a first filtering curve Y1.
[0083] In step S141, the first filtering step is performed on the differential curve to filter out the waveform of the part of the differential curve where the depth differential value exceeds L1. The first filtering step may also include: In step S210, an upper limit and a lower limit of the first preset threshold range L1 are set, and a portion of the depth differential value exceeding the upper limit and a portion below the lower limit in the differential curve are filtered out.
[0084] In some embodiments, the upper limit value is set in the first waveform or the second waveform, and the lower limit value is correspondingly set in the other waveform. The upper limit value and the lower limit value can be determined according to the requirements, for example, the upper limit value and the lower limit value are determined according to the preset depth differential threshold; for example, the upper limit value and the lower limit value are determined according to the filtering ratio of the waveform height, etc.
[0085] In step S220, when the depth differential value of a pixel point in the differential curve is greater than the upper limit value of the first preset threshold range L1, the depth differential value of the pixel point is replaced by the upper limit value. The pixel point whose depth differential value is too high due to noise, interference or other abnormal factors is adjusted to the maximum acceptable value within the threshold range.
[0086] In step S230, when the depth differential value of a pixel point in the differential curve is less than the lower limit of the first preset threshold range L1, it is replaced by the lower limit. Similarly, the pixel point whose depth differential value is too low due to abnormal factors will be adjusted to the acceptable minimum range.
[0087] In step S240, after the depth differential values of all pixels are processed according to the upper limit and the lower limit, the curve originally exceeding the upper limit is fitted into a horizontal line, and the curve originally below the lower limit is fitted into a horizontal line, thereby obtaining a first filtering curve Y1.
[0088] By setting the first preset threshold range L1 of the upper and lower limits and filtering the depth differential values beyond the range, the influence of noise and abnormal values in the differential curve can be further reduced, which helps to better determine the first position and the second position and further improve the accuracy of the target gap detection width size.
[0089] Combination Figure 3 and Figure 4 As shown, according to some embodiments of the present application, step S210 includes: Step S211A, determining a first filter line, the first filter line is parallel to a coordinate axis representing a pixel point position in the differential curve, and the first filter line intersects the first waveform and the second waveform; Step S212A, in response to the pixel distance between two intersection points where the first filter line intersects the first waveform or the second waveform being the first preset width a1, and the depth differential value corresponding to the first filter line being greater than 0, determining the depth differential value corresponding to the first filter line as the upper limit value of the first preset threshold range L1; and / or Step S213A, in response to the pixel distance between two intersection points where the first filter line intersects the first waveform or the second waveform being the second preset width a2, and the depth differential value corresponding to the first filter line being less than 0, the depth differential value corresponding to the first filter line is determined as the lower limit value of the first preset threshold range L1.
[0090] In step S210 , it is necessary to determine the upper limit and the lower limit of the first preset threshold range L1 .
[0091] It should be noted that the cross-sectional fitting curve C includes curves of multiple surfaces including the top surface of the first component, the side and bottom surfaces of the target gap, and the top surface of the second component, reflecting the cross-sectional shape of the target gap. In the cross-sectional fitting curve C, the curve from the top surface of the first component to the bottom surface of the target gap is a descending curve, and the curve from the bottom surface of the target gap to the top surface of the second component is an ascending curve. Therefore, the cross-sectional fitting curve C is differentiated from one end to the other end, and the first waveform and the second waveform corresponding to the two side walls of the target gap should be distributed on both sides of the coordinate axis representing the pixel position. It can be understood that the peaks of the first waveform and the second waveform face different directions.
[0092] In step S211A, a first filter line is determined. The purpose of the first filter line is to select a suitable position on the differential curve to obtain a depth differential value for determining a first preset threshold range L1.
[0093] In some embodiments, the first filter line is parallel to the coordinate axis representing the pixel position in the differential curve, and the location where the first filter line intersects the first waveform is set as the upper limit value. In some embodiments, the location where the first filter line intersects the second waveform is set as the upper limit value; for ease of description, the first waveform has a peak facing upward and the second waveform has a peak facing downward. That is, the location where the first filter line intersects the first waveform is set as the upper limit value.
[0094] In step S212A, the pixel distance between the two intersection points of the first filter line and the first waveform is the first preset width a1, and the first preset width a1 represents the width of the side wall corresponding to the first waveform in the Y-axis direction. The larger the first preset width, the worse the verticality of the corresponding side wall. The first filter line can be determined according to the first preset width a1. The depth differential value corresponding to the first filter line on the first waveform is greater than 0, and the depth differential value corresponding to the first filter line is determined as the upper limit value of the first preset threshold range L1; the method for determining the first preset width a1 is not limited, for example, the width threshold, the waveform width ratio, etc.
[0095] In step S213A, the pixel distance between the two intersection points of the first filter line and the second waveform is the second preset width, and the second preset width represents the width of the size occupied by the side wall corresponding to the second waveform in the Y-axis direction. The larger the second preset width, the worse the verticality of the corresponding side wall. The first filter line can be determined according to the second preset width a2. The depth differential value corresponding to the first filter line on the second waveform is less than 0, and the depth differential value corresponding to the first filter line is determined as the lower limit value of the first preset threshold range L1; the method for determining the second preset width a2 is not limited, for example, the width threshold, the waveform width ratio, etc.
[0096] For the first waveform and the second waveform in different directions, the first filter line is used to respectively determine the filtering range of the first waveform and the second waveform, which can respectively reduce the interference caused by the protrusions on the two side wall surfaces of the target gap, help to better determine the first position and the second position, and further improve the accuracy of the target gap detection width size.
[0097] Combination Figure 3 and Figure 5 As shown, according to some embodiments of the present application, step S210 includes: Step S211B, performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve to obtain a differential transformation curve; Step S212B, determining a second filter line, the second filter line is parallel to the coordinate axis representing the pixel position in the differential transformation curve, and the second filter line intersects the first waveform and the second waveform at the same time; Step S213B, in response to the smaller of the pixel distance between the two intersection points where the second filter line intersects the first waveform and the pixel distance between the two intersection points where the second filter line intersects the second waveform being the third preset width a3, determining the depth differential value corresponding to the second filter line as the upper limit value of the first preset threshold range L1; and Step S214B: determine the lower limit value of the first preset threshold range L1 to be 0.
[0098] In step S210 , it is necessary to determine the upper limit and the lower limit of the first preset threshold range L1 .
[0099] It should be noted that the cross-sectional fitting curve C is differentiated from one end to the other end, and the first waveform and the second waveform corresponding to the two side walls of the target gap should be distributed on both sides of the coordinate axis representing the pixel position, which can be understood as the peaks of the first waveform and the second waveform facing different directions. In order to facilitate the analysis of the waveform, the waveform can be transformed into an absolute value.
[0100] In step S211B, the depth differential value corresponding to each pixel point in the differential curve is transformed into an absolute value so that the peaks of the first waveform and the second waveform are both facing upward, thereby obtaining a differential transformation curve.
[0101] In step S212B, a second filter line is determined, and the purpose of the second filter line is to select a suitable position on the differential curve to obtain a depth differential value for determining the first preset threshold range L1. The first waveform and the second waveform are located on the same side, and the second filter line intersects with the first waveform and the second waveform at the same time. The second filter line is parallel to the coordinate axis representing the pixel position in the differential transformation curve.
[0102] In step S213B, the pixel distance between the two intersections where the second filter line intersects with the first waveform is a width, and the pixel distance between the two intersections where the second filter line intersects with the second waveform is a width, so that the second filter line can be determined according to the third preset width a3. For example, the pixel distance between the two intersections where the second filter line intersects with the first waveform is equal to the third preset width a3, then the pixel distance between the two intersections where the second filter line intersects with the second waveform should be greater than or equal to the third preset width a3; for example, the pixel distance between the two intersections where the second filter line intersects with the second waveform is equal to the third preset width a3; then the pixel distance between the two intersections where the second filter line intersects with the first waveform should be greater than or equal to the third preset width a3. Setting the smaller one as the third preset width a3 can improve the filtering accuracy, and determine the depth differential value corresponding to the second filter line as the upper limit value of the first preset threshold range L1.
[0103] In step S214B, the lower limit value of the first preset threshold range L1 is determined to be 0. That is, the first preset threshold range L1 should be between 0 and the depth differential value corresponding to the second filter line.
[0104] By performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve, the first waveform and the second waveform are located on the same side. The first preset threshold range L1 can be determined by setting the upper limit value of the first preset threshold range L1, which helps to improve the efficiency of differential curve processing.
[0105] like Figure 4 As shown, according to some embodiments of the present application, step S412 includes: Step S310, determining a pixel point in a half wave of the first waveform adjacent to the second waveform where the depth differential value is equal to the upper limit or lower limit of the first preset threshold range L1 as a first position; Step S320: Determine a pixel point in the half wave of the second waveform adjacent to the first waveform where the depth differential value is equal to the upper limit or lower limit of the first preset threshold range L1 as the second position.
[0106] After performing the first filtering step on the differential curve to obtain the first filtering curve Y1, it is necessary to determine the first position on the first waveform and the second position on the second waveform based on the first filtering curve Y1. The specific execution steps are as follows: In some embodiments, the first waveform and the second waveform should be distributed on both sides of the coordinate axis representing the pixel position, that is, the peaks of the first waveform and the second waveform face different directions. For the sake of convenience, the peak of the first waveform faces upwards and the peak of the second waveform faces downwards as an example.
[0107] In step S310, the first position is the one in which the depth differential value of the half-wave of the first waveform adjacent to the second waveform is equal to the upper limit value of the first preset threshold range L1; it should be noted that after filtering in the first filtering step, the depth differential value of the pixel point in the original differential curve that is greater than the upper limit value of the first preset threshold range L1 is replaced by the upper limit value of the first preset threshold range L1. Therefore, the differential curve corresponding to the upper limit value of the first preset threshold range L1 should be a coordinate axis straight line parallel to the pixel point position, and the first position can be any point on the straight line, or it can be taken as the endpoint B1 of the straight line close to the second waveform.
[0108] In step S320, the second position is the one in which the depth differential value of the half-wave of the second waveform adjacent to the first waveform is equal to the lower limit of the first preset threshold range L1; similarly, the depth differential value of the pixel point in the original differential curve that is greater than the lower limit of the first preset threshold range L1 is replaced by the lower limit of the first preset threshold range L1. Therefore, the differential curve corresponding to the lower limit of the first preset threshold range L1 should be a straight line on the coordinate axis parallel to the pixel point position. The first position can be any point on the straight line, or it can be the endpoint B2 of the straight line close to the first waveform.
[0109] In some embodiments, the differential transformation curve is obtained by performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve, so that the first waveform and the second waveform are located on the same side.
[0110] In step S310, the depth differential value of the half wave of the first waveform adjacent to the second waveform is equal to the upper limit of the first preset threshold range L1 as the first position. The specific method of determining the first position has been given in the above embodiments and will not be repeated here.
[0111] In step S320, the depth differential value of the second waveform in the half wave adjacent to the first waveform is equal to the upper limit of the first preset threshold range L1 as the second position. The specific method of determining the second position has been given in the above embodiments and will not be repeated here.
[0112] The interference of noise and outliers has been removed through the first filtering step, so that the first filtering curve Y1 can more truly reflect the depth change of the target gap, and the first position and the second position are respectively determined as the upper limit or lower limit of the first preset threshold range L1, which can shorten the time for determining the first position and the second position on the first filtering curve Y1 and improve the detection efficiency.
[0113] Combination Figure 3 and Figure 6 As shown, according to some embodiments of the present application, step S412 further includes: S410, performing a second filtering step on the first filtering curve Y1 to obtain a second filtering curve Y2, wherein the second filtering step includes filtering out a portion of the waveform of the depth differential value in the first filtering curve Y1 that falls within a second preset threshold range L2; S420 , determining a first position and a second position based on the second filtering curve Y2 .
[0114] After the first filtering step, part of the peak curves of the first waveform and part of the peak curves of the second waveform are mainly removed, and the interference caused by the unevenness of the two side wall surfaces corresponding to the target gap or foreign body protrusions is mainly removed; further considering that the junction area may affect the detection accuracy, such as the junction area between the first component and the second component and the target gap, and the junction area between the side and bottom of the target gap, etc., the bottom inflection point of the first waveform and the second waveform corresponds to the junction area of the target gap. In order to further improve the detection accuracy of the target gap, the second filtering step is performed after the first filtering step.
[0115] In step S410, after obtaining the first filter curve Y1, the first filter curve Y1 is subjected to a second filter process. By setting a second preset threshold range L2 in the size detection system, part of the waveform whose depth differential value in the first filter curve Y1 falls within the second preset threshold range L2 is filtered, and the differential curve after filtering is the second filter curve Y2.
[0116] Exemplarily, in the size detection system, a filtering threshold is set according to the height of the waveform, and the part of the waveform of the first filter curve Y1 that is lower than the filtering threshold is directly filtered out. Exemplarily, in the size detection system, a filtering ratio is set according to the height of the waveform, and the bottom of the waveform is filtered according to the ratio, such as 10%, 20%, etc.
[0117] In step S420, the first position and the second position are determined based on the first filtering curve Y1 obtained after filtering. Exemplarily, the first position is located within the pixel range corresponding to the half-wave of the first waveform adjacent to the second waveform after filtering; exemplary, the second position is located within the pixel range corresponding to the half-wave of the second waveform adjacent to the first waveform after filtering.
[0118] By performing a second filtering process on the first filtering curve Y1 and filtering out part of the waveform that falls within the second preset threshold range L2, the bottom area of the first waveform and the second waveform can be removed, thereby minimizing the possibility of taking points in the intersection area between the first component and the second component and the target gap, and the possibility of taking points in the intersection area between the side and bottom of the target gap, thereby improving the accuracy of the target gap detection width size.
[0119] Combination Figure 3 and Figure 6 As shown, according to some embodiments of the present application, the second filtering step includes: S510, obtaining a second preset threshold range L2; the upper limit value of the second preset threshold range L2 is greater than 0 and less than the upper limit value of the first preset threshold range L1, and the lower limit value of the second preset threshold range L2 is less than 0 and greater than the lower limit value of the first preset threshold range L1; S520, in response to the depth differential value corresponding to the pixel point in the first filtering curve Y1 falling into the second preset threshold range L2, the depth differential value corresponding to the pixel point is replaced with a null value; S530 , determining the curve obtained by filtering out the first filtering curve Y1 as the second filtering curve Y2 .
[0120] It should be noted that the first waveform and the second waveform corresponding to the two side walls of the target gap should be distributed on both sides of the coordinate axis representing the pixel position, which can be understood as the peaks of the first waveform and the second waveform facing different directions. In step S140, the second filtering step is performed on the first filtering curve Y1, and the second filtering step is used to filter out the part of the waveform whose depth differential value in the first filtering curve Y1 falls into the second preset threshold range L2. The execution of the second filtering step can also include: In step S510 , the upper limit and the lower limit of the second preset threshold range L2 are set, and the portion of the depth differential value in the first filtering curve Y1 that falls within the upper limit and the lower limit of the second preset threshold range L2 is filtered out.
[0121] In some embodiments, the peak of the first waveform faces upward, the peak of the second waveform faces downward, the upper limit value of the second preset threshold range L2 is set in the first waveform, and the upper limit value of the second preset threshold range L2 is greater than 0 and less than the upper limit value of the first preset threshold range L1. The lower limit value of the second preset threshold range L2 is set in the second waveform, and the lower limit value of the second preset threshold range L2 is less than 0 and greater than the lower limit value of the first preset threshold range L1. The upper limit value and the lower limit value of the second preset threshold range L2 can be determined according to the needs, for example, the upper limit value and the lower limit value are determined according to the preset depth differential threshold value; for example, the upper limit value and the lower limit value are determined according to the filtering ratio of the waveform height, etc.
[0122] In step S520, when the depth differential value of a pixel point in the first filter curve Y1 is less than the upper limit value of the second preset threshold range L2, the depth differential value corresponding to the pixel point is replaced with a null value. When the depth differential value of a pixel point in the first filter curve Y1 is greater than the lower limit value of the second preset threshold range L2, the depth differential value corresponding to the pixel point is replaced with a null value.
[0123] In step S530, the depth differential values of all pixels in the first filter curve Y1 are processed according to the upper limit and the lower limit of the second preset threshold range L2 to obtain the second filter curve Y2.
[0124] For the first waveform and the second waveform in different directions, the upper limit and lower limit of the second preset threshold range L2 are used, and the parts that fall within are processed, which is mainly to eliminate the interference caused by structural changes at the junction of the first component and the target gap, the junction of the side and bottom of the target gap, and the junction of the second component and the target gap, thereby improving the accuracy of the target gap detection width size.
[0125] Combination Figure 3 and Figure 6 As shown, according to some embodiments of the present application, step S510 includes: Step S511, determining a third filter line, where the third filter line is parallel to a coordinate axis representing a pixel point position in the differential curve, and the third filter line intersects the first waveform or the second waveform; Step S512, in response to the pixel distance between two intersection points where the third filter line intersects the first waveform or the second waveform being a fourth preset width a4, and the depth differential value corresponding to the third filter line being greater than 0, determining the depth differential value corresponding to the third filter line as an upper limit value of the second preset threshold range L2; and / or Step S513, in response to the pixel distance between the two intersection points where the third filter line intersects the first waveform or the second waveform being the fifth preset width a5, and the depth differential value corresponding to the third filter line being less than 0, the depth differential value corresponding to the third filter line is determined as the lower limit value of the second preset threshold range L2.
[0126] In step S510, it is necessary to determine the upper limit value and the lower limit value of the second preset threshold range L2.
[0127] In step S511, a third filter line is determined. The purpose of the third filter line is to select a suitable position on the first filter curve Y1 to obtain a depth differential value for determining the second preset threshold range L2. The third filter line is parallel to the coordinate axis representing the pixel position in the differential curve.
[0128] In some embodiments, the location where the third filter line intersects the first waveform is set as the upper limit value, and in some embodiments, the location where the third filter line intersects the second waveform is set as the upper limit value; for ease of description, the first waveform has a peak facing upward and the second waveform has a peak facing downward. That is, the location where the third filter line intersects the first waveform is set as the upper limit value of the second preset threshold range L2.
[0129] In step S512, the pixel distance between the two intersection points of the third filter line and the first waveform is the fourth preset width a4, and the fourth preset width a4 represents the width of the side wall corresponding to the first waveform in the Y-axis direction. The larger the fourth preset width a4 is, the worse the verticality of the corresponding side wall is. According to the fourth preset width a4, the third filter line can be determined. The depth differential value corresponding to the third filter line on the first waveform is greater than 0, and the depth differential value corresponding to the third filter line is determined as the upper limit value of the second preset threshold range L2; the method for determining the fourth preset width a4 is not limited, for example, the width threshold, the waveform width ratio, etc.
[0130] In step S513, the pixel distance between the two intersection points of the third filter line and the second waveform is the fifth preset width a5, and the fifth preset width a5 represents the width of the side wall corresponding to the second waveform in the Y-axis direction. The larger the fifth preset width a5 is, the worse the verticality of the corresponding side wall is. According to the fifth preset width a5, the third filter line can be determined. The depth differential value corresponding to the third filter line on the second waveform is less than 0, and the depth differential value corresponding to the third filter line is determined as the lower limit value of the second preset threshold range L2; the method for determining the fifth preset width a5 is not limited, for example, the width threshold, the waveform width ratio, etc.
[0131] For the first waveform and the second waveform in different directions, the filtering range of the first waveform and the second waveform is determined respectively using the third filtering line, which can reduce the interference caused by the structure at the junction of the side of the target gap and the first component and the second component, respectively, and help to better determine the first position and the second position, and further improve the accuracy of the target gap detection width size.
[0132] Combination Figure 3 and Figure 7 As shown, according to some embodiments of the present application, the second filtering step further includes: S610, performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve to obtain a differential transformation curve; S620, obtaining a second preset threshold range L2; the upper limit value of the second preset threshold range L2 is greater than 0 and less than the upper limit value of the first preset threshold range L1, and the lower limit value of the second preset threshold range L2 is 0; S630, in response to the depth differential value corresponding to the pixel point in the first filtering curve Y1 falling into the second preset threshold range L2, replacing the depth differential value corresponding to the pixel point with a null value; S640: Determine the curve obtained by filtering out the first filtering curve Y1 as the second filtering curve Y2.
[0133] It should be noted that the first waveform and the second waveform corresponding to the two side walls of the target gap should be distributed on both sides of the coordinate axis representing the pixel position, which can be understood as the peaks of the first waveform and the second waveform facing different directions. In order to facilitate the analysis of the waveform, the waveform can be transformed into an absolute value. The second filtering step can also include: In step S610, the depth differential value corresponding to each pixel point in the differential curve is transformed into an absolute value so that the peaks of the first waveform and the second waveform are both facing upward, thereby obtaining a differential transformation curve.
[0134] In step S620, the upper limit and lower limit of the second preset threshold range L2 are set, and the portion of the depth differential value in the first filter curve Y1 that falls within the upper limit and lower limit of the second preset threshold range L2 is filtered out. The upper limit of the second preset threshold range L2 can be determined according to demand, for example, the upper limit and lower limit are determined according to the preset depth differential threshold; for example, the upper limit and lower limit are determined according to the filtering ratio of the waveform height, and so on. It should be noted that the upper limit of the second preset threshold range L2 should be greater than 0 and less than the upper limit of the first preset threshold range L1. The lower limit of the second preset threshold range L2 can be set to 0.
[0135] In step S630 , when the depth differential value of a pixel point in the first filtering curve Y1 is less than the upper limit of the second preset threshold range L2 , the depth differential value corresponding to the pixel point is replaced with a null value.
[0136] In step S640 , the depth differential values of all pixels in the first filter curve Y1 are processed according to the upper limit and the lower limit of the second preset threshold range L2 to obtain a second filter curve Y2 .
[0137] By performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve, so that the first waveform and the second waveform are located on the same side, and then filtering the absolute value transformed first filter curve Y1 in the second filtering step, it helps to improve the detection accuracy and the efficiency of the differential curve processing.
[0138] Combination Figure 3 and Figure 7 As shown, according to some embodiments of the present application, step 620 also includes: Step 621, determining a fourth filter line, the fourth filter line is parallel to the coordinate axis representing the pixel position in the differential transformation curve, and the fourth filter line intersects the first waveform and the second waveform at the same time; Step 622: in response to the larger of the pixel distance between the two intersection points where the fourth filter line intersects the first waveform and the pixel distance between the two intersection points where the fourth filter line intersects the second waveform being the sixth preset width a6, determining the depth differential value corresponding to the fourth filter line as the upper limit value of the second preset threshold range L2; and Step 623: determine the lower limit value of the second preset threshold range L2 as 0.
[0139] In step S620, it is necessary to determine the upper limit and lower limit of the second preset threshold range L2. The specific determination operation of the upper limit and lower limit is as follows: In step S621, a fourth filter line is determined, and the purpose of the fourth filter line is to select a suitable position on the differential curve to obtain a depth differential value for determining the second preset threshold range L2. The first waveform and the second waveform are located on the same side, and the fourth filter line intersects with the first waveform and the second waveform at the same time. The fourth filter line is parallel to the coordinate axis representing the pixel position in the differential transformation curve.
[0140] In step S622, the pixel distance between the two intersection points of the fourth filter line and the first waveform is one width, and the pixel distance between the two intersection points of the fourth filter line and the second waveform is one width, so the fourth filter line can be determined according to the sixth preset width a6.
[0141] Exemplarily, if the pixel distance between the two intersections of the fourth filter line and the first waveform is equal to the sixth preset width, then the pixel distance between the two intersections of the fourth filter line and the second waveform should be less than or equal to the sixth preset width; Exemplarily, if the pixel distance between the two intersections of the fourth filter line and the second waveform is equal to the sixth preset width; then the pixel distance between the two intersections of the fourth filter line and the first waveform should be less than or equal to the sixth preset width. Determining the depth differential value corresponding to the fourth filter line as the upper limit of the second preset threshold range L2 can improve the filtering accuracy.
[0142] In step S623, the lower limit value of the second preset threshold range L2 is determined to be 0. That is, the first preset threshold range L1 should be between 0 and the depth differential value corresponding to the fourth filter line.
[0143] After the depth differential value corresponding to each pixel point in the differential curve is transformed into an absolute value so that the first waveform and the second waveform are located on the same side, the second preset threshold range L2 can be determined by setting the upper limit value of the second preset threshold range L2, which helps to improve the efficiency of differential curve processing.
[0144] According to some embodiments of the present application, step S420 includes: Step S710, determining the middle position of the pixel point in the area where the depth differential value of the first waveform in the second filtering curve Y2 is greater than 0 and less than or equal to the upper limit value of the first preset threshold range L1 in the half wave of the second waveform as the first position; the depth differential value corresponding to the pixel point in the first waveform is greater than or equal to 0; Step S720: determine the middle position of the pixel points in the area where the depth differential value of the second waveform in the second filtering curve Y2 is less than 0 and greater than or equal to the lower limit value of the first preset threshold range L1 in the half wave of the first waveform as the second position.
[0145] After performing the second filtering step on the first filtering curve Y1 to obtain the second filtering curve Y2, it is necessary to determine the first position on the first waveform and the second position on the second waveform based on the second filtering curve Y2. The specific execution steps are as follows: In step S710, the depth differential value corresponding to the pixel point in the first waveform is greater than or equal to 0, the top of the first waveform in the second filter curve Y2 is the upper limit value of the first preset threshold range L1, and the bottom of the first waveform in the second filter curve Y2 is the upper limit value of the second preset threshold range L2, and the middle position of the pixel point in the area between the upper limit value of the first preset threshold range L1 and the upper limit value of the second preset threshold range L2 is determined as the first position; for example, there are 100 pixel points in the area between the upper limit value of the first preset threshold range L1 and the upper limit value of the second preset threshold range L2, and the value of the horizontal coordinate corresponding to the middle position of the 100 pixel points is found on the first waveform to correspond to the point, which is the first position.
[0146] In step S720, the depth differential value corresponding to the pixel point in the second waveform is less than or equal to 0. Similarly, the middle position of the pixel point in the area between the lower limit value of the first preset threshold range L1 and the lower limit value of the second preset threshold range L2 is determined as the second position.
[0147] By determining the first position by the middle position of the pixel point corresponding to the half wave in the first waveform close to the second waveform on the second filtering curve Y2, and determining the second position by the middle position of the pixel point corresponding to the half wave in the second waveform close to the first waveform on the second filtering curve Y2, the value error during filtering can be further reduced and the detection accuracy of the target gap can be improved.
[0148] According to some embodiments of the present application, the size detection method 100 further includes: Step S160, determining the top surface position of the first component and the top surface position of the second component based on the cross-section fitting curve C; Step S170 : determining a height difference between the first component and the second component based on the top surface position of the first component and the top surface position of the second component.
[0149] In some embodiments, the size detection method can also be used to detect the height difference between the first component and the second component after the first component and the second component are assembled to determine whether the outer dimensions of the first component and the second component are qualified. For example, the first component can be a battery housing, and the second component can be a battery top cover.
[0150] After the cross-sectional fitting curve C is determined in step S120, the cross-sectional fitting curve C includes curves of multiple surfaces including the top surface of the first component, the side and bottom surfaces of the target gap, and the top surface of the second component, reflecting the cross-sectional shape of the target gap.
[0151] While performing the differentiation process on the cross-section fitting curve C in step S130, step S160 may also be performed. In step S160 , the top surface position of the first component and the top surface position of the second component are determined according to the cross-sectional fitting curve C.
[0152] Then, step S170 is performed to determine the height difference between the first component and the second component based on the difference in the top surface position of the first component and the top surface position of the second component on the plane, which can be directly measured using the positioner and caliper in the size detection. The height difference is used to determine whether the shape and size of the first component and the second component are qualified.
[0153] In some embodiments, the dimension detection method 100 for the battery shell and the battery top cover before welding can also be used to detect the height difference between the first component, the second component and the battery welding pressure strip, and determine whether the installation and fixing position of the battery pressure strip is appropriate.
[0154] By detecting the height difference between the first component and the second component, it is possible to more comprehensively determine whether the positioning of the first component and the second component is qualified, thereby improving the detection effect and saving time.
[0155] According to some embodiments of the present application, the size detection method 100 further includes: Step S180, obtaining a data set consisting of the widths of the target gap corresponding to a plurality of preset detection points sequentially spaced along the extension direction of the target gap; Step S190: In response to N values in the data group being continuously greater than a preset width threshold, it is determined that the width of the target gap is unqualified.
[0156] A single preset detection point can only detect the gap width at the current position, and its detection result is accidental. In order to further improve the accuracy of the target gap, multiple positions can be detected continuously. The specific steps are as follows: In step S180, multiple preset detection points are set in sequence in the extension direction of the target gap. For example, the extension length of the target gap is 200 mm, and the interval between two adjacent preset detection points is 0.1 mm. Then, more than 2000 preset detection points can be set in the extension direction of the target gap, and the width data of the target gap corresponding to the multiple preset detection points are obtained respectively to obtain a data group of the target gap.
[0157] In step S190, the results of the detection of multiple preset detection points are processed, and a preset width threshold and a maximum continuous number of unqualified preset detection points N are set in the size detection system; if the gap width detected by a single preset detection point exceeds the preset width threshold, the gap size passing through the preset detection point position is determined to be unqualified; illustratively, the extension length of the target gap is 200mm, divided into 20 small areas, each small area has a length of 10mm, and the interval between two adjacent multiple preset detection points is 0.1mm, then the number of preset detection points in each small area is 100, and the maximum continuous number of unqualified preset detection points is set to 5. If the gap width detected by 5 consecutive adjacent preset detection points in a small area exceeds the set qualified gap width threshold, the gap width of the small area is determined to be unqualified, and if the gap width detected by only 4 consecutive adjacent preset detection points in a small area exceeds the set qualified gap width threshold, the gap width of the small area is determined to be qualified. The width of the target gap can be determined to be unqualified.
[0158] In some embodiments, the situation of the entire target gap is judged according to the situation of each small area. For example, if more than a preset number of small areas are unqualified, the target gap width size is judged to be unqualified. The determination process of the target gap width is not limited to the above description and can be selected according to the actual situation. The unqualified target gap width here means that it does not meet the specific installation or welding size requirements. For example, the detection of the target gap width is performed before welding. The judgment as unqualified here means that it does not meet the welding size requirements, and the position of the first component or the second component needs to be adjusted or repositioned to meet the requirements of the subsequent welding process.
[0159] It should be noted that after each preset detection point obtains the width of the corresponding target gap, the next preset detection point is processed. It is also possible to first set multiple preset detection points in sequence along the extension direction of the target gap, and then process multiple preset detection points simultaneously. The specific processing method is not limited.
[0160] By using continuous preset detection points to detect the target gap, the width of the target gap can be judged to be acceptable. Compared with using the average value algorithm for each preset detection point, it can more realistically reflect the specific gap situation in the target gap and improve the accuracy of target gap detection.
[0161] According to some embodiments of the present application, a battery pre-welding detection method is provided, wherein the first component is a battery shell, the second component is a battery top cover, and the target gap is the gap between the battery shell and the battery top cover; the battery pre-welding detection method comprises: using the above-mentioned size detection method to determine the width of the gap between the battery shell and the battery top cover.
[0162] In step S110, a three-dimensional detection image including the gap between the battery shell and the battery top cover is acquired using a three-dimensional camera.
[0163] In some embodiments, a three-dimensional detection image obtained using a three-dimensional detection device may include a plan view, wherein the plane of the plan view is parallel to the extension direction of the target gap, and the plan view includes grayscale information of the battery case, the battery top cover and the target gap. The grayscale information refers to the grayscale value of each pixel in the image. Due to the different surface characteristics of the battery case, the battery top cover and the target gap, and the different distances relative to the detection device, different grayscale values will appear on the plan view, so that the approximate position and range of the target gap can be preliminarily determined by analyzing the grayscale information.
[0164] In some embodiments, the three-dimensional detection image obtained by the three-dimensional detection device may also include a depth map, and the plane of the depth map is perpendicular to the extension direction of the target gap. The depth map includes depth information corresponding to the battery shell and the battery top cover respectively. The depth information is grayscale information containing different depths of the battery shell, the battery top cover and the target gap. The depth information can be used to determine the width and depth of the target gap.
[0165] It should be noted that the depth map can be a single image of a single detection point in the target gap, or it can be multiple images acquired at intervals along the extension direction of the target gap. For example, an image acquisition position is set every 0.1mm for each gap between the battery shell and the battery top cover, and each image acquisition position corresponds to a preset detection point. The extension direction of the battery gap is 200mm, and 2000 image acquisition positions can be set accordingly, which can correspond to 2000 preset detection points.
[0166] In step S120, a depth map containing preset detection points is selected based on the acquired three-dimensional image, and the width of the depth map at least covers the target gap and the adjacent battery shell, the contact area between the battery top cover and the target gap. By processing the depth information in the depth map, a cross-sectional fitting curve C is obtained, and the cross-sectional fitting curve C includes curves of multiple surfaces including the upper surface of the battery shell, the side and bottom surfaces of the target gap, and the upper surface of the battery top cover, reflecting the cross-sectional shape of the target gap.
[0167] In step S130, the cross-sectional fitting curve C is differentiated to obtain a differential curve for characterizing the depth differential value corresponding to each pixel point.
[0168] In step S140, the differential curve of the depth differential value corresponding to each pixel point is analyzed. The two opposite side walls of the target gap correspond to two waveforms respectively. The depth changes at the two opposite side walls of the target gap are more drastic, which is manifested as a larger differential value on the differential curve.
[0169] In step S150, the first position and the second position on the differential curve correspond to the corresponding positions on the cross-section fitting curve C respectively. It should be noted that the horizontal distance between the first position and the second position on the differential curve is the width dimension of the target gap on the cross-section fitting curve C.
[0170] By detecting the gap width of the battery before welding the battery top cover and the battery shell, the accuracy of size detection can be improved, which is conducive to improving the quality of subsequent welding, thereby improving battery quality and reducing production costs and production efficiency.
[0171] like Figure 8 As shown, according to some embodiments of the present application, a size detection device 300 based on image processing is provided, and the size detection device 300 includes: a first acquisition module 310, a first processing module 320, a second processing module 330, a third processing module 340 and a fourth processing module 350, the first acquisition module 310 is used to acquire a three-dimensional detection image, and the three-dimensional detection image contains depth information corresponding to the target gap and the first component and the second component adjacent to the target gap; the first processing module 320 is used to determine, based on the three-dimensional detection image, a cross-sectional fitting curve that is perpendicular to the extension direction of the target gap and passes through a preset detection point; the cross-sectional fitting curve is used to characterize the cross-sectional shape of the target gap; the second processing module 330 is used to perform differential processing on the cross-sectional fitting curve to obtain a differential curve for characterizing the depth differential value corresponding to each pixel point; the third processing module 340 is used to determine, based on the differential curve, a first position and a second position that respectively characterize the positions of two opposite side walls of the target gap; and the fourth processing module 350 is used to determine the width size of the target gap according to the position information of the first position and the second position in a preset coordinate system.
[0172] Combination Fig. 9 and Fig.10 As shown, according to some embodiments of the present application, a pre-welding dimension detection system 200 is provided, and the dimension detection system 200 includes a clamping device 210, an image acquisition device 220 and a control device 230. The clamping device 210 is used to clamp the first component and the second component to be welded to a set position so that a target gap is formed between the first component and the second component; the image acquisition device 220 is configured to obtain a three-dimensional detection image of the position where the target gap is located; the control device 230 is configured to receive the three-dimensional detection image and execute the above-mentioned dimension detection method.
[0173] The clamping device 210 is used to clamp and fix the first component and the second component, and transfer the first component and the second component to a set position. The set position can be a gap collection position or a welding position.
[0174] In some embodiments, the control device 230 is communicatively connected to the image acquisition device 220 and the clamping device 210 respectively.
[0175] The control device 230 controls the clamping device 210 to clamp the first component and the second component to be welded to a set position so that a target gap is formed between the first component and the second component, and then controls the image acquisition device 220 to acquire a three-dimensional detection image of the position where the target gap is located.
[0176] In some embodiments, the image acquisition device 220 includes an image acquisition unit 221 and a driving unit 222, and the image acquisition unit 221 and the driving unit 222 are respectively communicated with the control device 230; the driving unit 222 is used to drive the image acquisition unit 221 to move along the extension direction of the target gap under the control of the control device 230; the image acquisition unit 221 is used to perform image acquisition under the control of the control device 230.
[0177] In some embodiments, the image acquisition device 220 includes two image acquisition units 221, the two image acquisition units 221 are arranged opposite to each other, and the driving unit 222 drives the two image acquisition units 221 to move at the same time, so that the image acquisition device 220 can realize the image acquisition of two gaps at the same time. In practical applications, the control device 230 may include a PLC (Programmable Logic Controller) and a host computer, wherein the PLC may send control instructions to the clamping device 210 and the image acquisition device 220 respectively, control the clamping device 210 to adjust the position of the first component or the second component, and control the image acquisition device 220 to perform image acquisition; the host computer may obtain a three-dimensional detection image from the image acquisition device 220, and then obtain a cross-sectional fitting curve C according to the three-dimensional detection image, and perform differential processing on the cross-sectional fitting curve C to obtain a differential curve for characterizing the depth differential value corresponding to each pixel point; based on the differential curve, determine the first position and the second position respectively characterizing the positions of the two opposite side walls of the target gap, thereby determining the width size of the target gap. In addition, the host computer can display a user interface, through which various detection parameters can be obtained, for example, detection interval, detection quantity, detection mode, etc. The PLC and the host computer can cache the relevant data in the image acquisition process, and delete the cached data after the image acquisition is completed.
[0178] like Fig.11As shown, the image acquisition device 220 can perform image acquisition according to the following process. For the sake of convenience, taking the size detection system 200 detecting the width of the battery gap as an example, the battery gap has a first long side, a second long side, a first short side and a second short side.
[0179] The PLC command is monitored at a preset time interval, and the command can indicate the target gap to be collected; after monitoring the command, the image acquisition device 220 replies to the PLC that the trigger process has been received, reads the command, and determines whether it is a long edge signal; if it is a long edge signal, the long edge image acquisition parameter is called for image acquisition; if it is a short edge signal, the short edge image acquisition parameter is called for image acquisition; wait for the encoder to trigger the camera to return the image, and after the camera acquires the corresponding image, the image is imported into the algorithm, and the data of each point is obtained and cached in the code according to the algorithm logic and point requirements set in advance, and the image is saved. Then the acquisition of another edge is performed to determine whether it is the second short edge process. If so, all four edges are shot, all data are integrated, the algorithm result is obtained and the data table is saved. At the same time, the PLC triggers the result sending process, sends the required data to the PLC, and deletes the data cache of the barcode. If not, cache the single-edge data, wait for all edges to be acquired, perform data aggregation, and end this process.
[0180] Through the cooperation between the control device 230, the clamping device 210 and the image acquisition device 220, the target gap can be detected. On the one hand, compared with manual detection, it is more efficient, has more detection points, and more accurate detection results; on the other hand, it can help prepare for the next process flow based on the detection results.
[0181] According to some embodiments of the present application, the embodiments of the present application also provide a computing device, which includes at least one processor; and at least one memory communicatively connected to the at least one processor, the at least one memory storing instructions, which, when executed individually or collectively by the at least one processor, enable the computing device to perform the above-mentioned size detection method.
[0182] In one embodiment, the processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment may be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods and steps disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0183] In one embodiment, the memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus random access memory (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0184] According to some embodiments of the present application, an embodiment of the present application provides a computer-readable storage medium storing instructions, which, when executed individually or collectively by one or more processors of a computing device, enable the computing device to perform the above-mentioned size detection method.
[0185] According to some embodiments of the present application, an embodiment of the present application provides a computer program product, including instructions, which, when executed individually or collectively by one or more processors of a computing device, enable the computing device to perform the above-mentioned size detection method.
[0186] It should be understood that, although the steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indications of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0187] In some embodiments, another battery pre-welding detection method is provided, which specifically includes the following steps: Step S810: Acquire a three-dimensional detection image, wherein the three-dimensional detection image includes depth information corresponding to the target gap and the battery casing and the battery top cover adjacent to the target gap.
[0188] Step S820: Based on the three-dimensional detection image, determine a cross-sectional fitting curve that is perpendicular to the extension direction of the target gap and passes through a preset detection point; the cross-sectional fitting curve is used to characterize the cross-sectional shape of the target gap.
[0189] Step S830: Differentiate the cross-sectional fitting curve to obtain a differential curve for characterizing the depth differential value corresponding to each pixel point; the differential curve includes a first waveform and a second waveform that are adjacent and correspond to two opposite side walls of the target gap, respectively.
[0190] Step S840: The differential curve performs a first filtering step to obtain a first filtered curve. The first filtering step includes filtering out a portion of the waveform in the differential curve whose depth differential value exceeds a first preset threshold range.
[0191] Step S850: Perform a second filtering step on the first filtering curve to obtain a second filtering curve, wherein the second filtering step includes filtering out a portion of the waveform of the first filtering curve whose depth differential value falls within a second preset threshold range.
[0192] Step S860: Determine the first position and the second position based on the second filtering curve.
[0193] Step S870: determine the width of the target gap according to the position information of the first position and the second position in the preset coordinate system.
[0194] Step S880: Obtain a data set consisting of the widths of the target gap corresponding to a plurality of preset detection points sequentially spaced along the extension direction of the target gap.
[0195] Step S890: In response to N values in the data group being continuously greater than a preset width threshold, it is determined that the width of the target gap is unqualified.
[0196] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application, and they should all be included in the scope of the claims and specification of the present application. In particular, as long as there is no structural conflict, the various technical features mentioned in the various embodiments can be combined in any way. The present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions that fall within the scope of the claims.
Claims
1. A size detection method based on image processing, characterized in that: The size detection method comprises: Acquire a three-dimensional detection image, wherein the three-dimensional detection image includes depth information corresponding to a target gap and a first component and a second component adjacent to the target gap; Based on the three-dimensional detection image, determine a cross-sectional fitting curve that is perpendicular to the extension direction of the target gap and passes through a preset detection point; the cross-sectional fitting curve is used to characterize the cross-sectional shape of the target gap; Performing differentiation processing on the cross-section fitting curve to obtain a differential curve for characterizing the depth differential value corresponding to each pixel point; Based on the differential curve, determining a first position and a second position respectively representing positions of two opposite side walls of the target gap; and The width of the target gap is determined according to position information of the first position and the second position in a preset coordinate system.
2. The size detection method according to claim 1, characterized in that: The differential curve includes a first waveform and a second waveform which are adjacent and correspond to two opposite side walls of the target gap respectively; The first position is located within a pixel range corresponding to a half wave of the first waveform adjacent to the second waveform; the second position is located within a pixel range corresponding to a half wave of the second waveform adjacent to the first waveform.
3. The size detection method according to claim 2, characterized in that: Determining the first position and the second position, respectively representing the positions of two opposite side walls of the target gap based on the differential curve, comprises: Performing a first filtering step on the differential curve to obtain a first filtered curve, wherein the first filtering step includes filtering out a portion of the waveform of the differential curve whose depth differential value exceeds a first preset threshold range; Based on the first filtering curve, the first position and the second position are determined.
4. The size detection method according to claim 3, characterized in that: The first filtering step comprises: Acquire the first preset threshold range; the first preset threshold range includes an upper limit value and a lower limit value; In response to a depth differential value of a pixel point in the differential curve being greater than an upper limit value of the first preset threshold range, replacing the depth differential value of the pixel point with an upper limit value of the first preset threshold range; In response to a depth differential value of a pixel point in the differential curve being less than a lower limit value of the first preset threshold range, replacing the depth differential value of the pixel point with the lower limit value of the first preset threshold range; The first filtering curve is obtained by fitting the depth differential value of each pixel point.
5. The size detection method according to claim 4, characterized in that: The obtaining of the first preset threshold range includes: Determine a first filter line, where the first filter line is parallel to a coordinate axis representing a pixel point position in the differential curve, and the first filter line intersects the first waveform or the second waveform; In response to the pixel distance between two intersection points where the first filter line intersects the first waveform or the second waveform being a first preset width, and the depth differential value corresponding to the first filter line being greater than 0, determining the depth differential value corresponding to the first filter line as an upper limit value of the first preset threshold range; and / or In response to the pixel distance between two intersection points where the first filter line intersects the first waveform or the second waveform being a second preset width, and the depth differential value corresponding to the first filter line being less than 0, the depth differential value corresponding to the first filter line is determined as the lower limit value of the first preset threshold range.
6. The size detection method according to claim 4, characterized in that: The obtaining of the first preset threshold range includes: Performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve to obtain a differential transformation curve; Determine a second filter line, where the second filter line is parallel to a coordinate axis representing pixel positions in the differential transformation curve, and the second filter line intersects the first waveform and the second waveform at the same time; In response to the smaller of a pixel distance between two intersection points where the second filter line intersects the first waveform and a pixel distance between two intersection points where the second filter line intersects the second waveform being a third preset width, determining the depth differential value corresponding to the second filter line as an upper limit value of the first preset threshold range; and The lower limit value of the first preset threshold range is determined to be 0.
7. The size detection method according to any one of claims 3 to 6, characterized in that: Based on the first filtering curve, determining the first position and the second position includes: Determine a pixel point in a half wave of the first waveform adjacent to the second waveform where the depth differential value is equal to the upper limit or the lower limit of the first preset threshold range as the first position; A pixel point in the half wave of the second waveform adjacent to the first waveform where the depth differential value is equal to the upper limit or lower limit of the first preset threshold range is determined as the second position.
8. The size detection method according to any one of claims 3 to 5, characterized in that: Based on the first filtering curve, determining the first position and the second position further includes: Performing a second filtering step on the first filtering curve to obtain a second filtering curve, wherein the second filtering step includes filtering out a portion of the waveform of the depth differential value in the first filtering curve that falls within a second preset threshold range; Based on the second filtering curve, the first position and the second position are determined.
9. The size detection method according to claim 8, characterized in that: The second filtering step comprises: Obtain a second preset threshold range; the upper limit value of the second preset threshold range is greater than 0 and less than the upper limit value of the first preset threshold range, and the lower limit value of the second preset threshold range is less than 0 and greater than the lower limit value of the first preset threshold range; In response to a depth differential value corresponding to a pixel point in the first filtering curve falling within the second preset threshold range, replacing the depth differential value corresponding to the pixel point with a null value; A curve obtained by filtering out the first filtering curve is determined as the second filtering curve.
10. The size detection method according to claim 9, characterized in that: The obtaining of the second preset threshold range includes: Determine a third filter line, wherein the third filter line is parallel to a coordinate axis representing a pixel point position in the differential curve, and the third filter line intersects the first waveform or the second waveform; In response to the pixel distance between two intersection points where the third filter line intersects the first waveform or the second waveform being a fourth preset width, and the depth differential value corresponding to the third filter line being greater than 0, determining the depth differential value corresponding to the third filter line as an upper limit value of the second preset threshold range; and / or In response to the pixel distance between two intersection points where the third filter line intersects the first waveform or the second waveform being a fifth preset width, and the depth differential value corresponding to the third filter line being less than 0, the depth differential value corresponding to the third filter line is determined as the lower limit value of the second preset threshold range.
11. The size detection method according to claim 8, characterized in that: The second filtering step further comprises: Performing an absolute value transformation on the depth differential value corresponding to each pixel point in the differential curve to obtain a differential transformation curve; Obtain a second preset threshold range; the upper limit value of the second preset threshold range is greater than 0 and less than the upper limit value of the first preset threshold range, and the lower limit value of the second preset threshold range is 0; In response to a depth differential value corresponding to a pixel point in the first filtering curve falling within the second preset threshold range, replacing the depth differential value corresponding to the pixel point with a null value; A curve obtained by filtering out the first filtering curve is determined as the second filtering curve.
12. The size detection method according to claim 11, characterized in that: The obtaining of the second preset threshold range includes: Determine a fourth filter line, wherein the fourth filter line is parallel to a coordinate axis representing a pixel point position in the differential transformation curve, and the fourth filter line intersects the first waveform and the second waveform at the same time; In response to the larger of a pixel distance between two intersection points where the fourth filter line intersects the first waveform and a pixel distance between two intersection points where the fourth filter line intersects the second waveform being a sixth preset width, determining the depth differential value corresponding to the fourth filter line as an upper limit value of the second preset threshold range; and The lower limit value of the second preset threshold range is determined to be 0.
13. The size detection method according to claim 8, characterized in that: Based on the second filtering curve, determining the first position and the second position includes: The middle position of a pixel point in an area where the depth differential value of the first waveform in the second filtering curve is greater than 0 and less than or equal to the upper limit value of the first preset threshold range is determined as the first position; the depth differential value corresponding to the pixel point in the first waveform is greater than or equal to 0; The middle position of the pixel points in the area where the depth differential value of the second waveform in the second filtering curve is less than 0 and greater than or equal to the lower limit value of the first preset threshold range in the half wave of the first waveform is determined as the second position.
14. The size detection method according to any one of claims 1 to 6, characterized in that: The size detection method further comprises: determining a top surface position of the first component and a top surface position of the second component based on the cross-section fitting curve; A height difference between the first component and the second component is determined based on a top surface position of the first component and a top surface position of the second component.
15. The size detection method according to any one of claims 1 to 6, characterized in that: The size detection method further comprises: Acquire a data set consisting of the width of the target gap corresponding to a plurality of preset detection points sequentially arranged at intervals along the extension direction of the target gap; In response to N values in the data group being continuously greater than a preset width threshold, it is determined that the width of the target gap is unqualified.
16. A battery pre-welding detection method, characterized in that: The first component is a battery housing, the second component is a battery top cover, and the target gap is a gap between the battery housing and the battery top cover; The battery pre-welding detection method comprises: The size detection method according to any one of claims 1 to 15 is used to determine the width of the gap between the battery housing and the battery top cover.
17. A size detection device based on image processing, characterized in that: The size detection device comprises: A first acquisition module is used to acquire a three-dimensional detection image, wherein the three-dimensional detection image includes depth information corresponding to a target gap and a first component and a second component adjacent to the target gap; A first processing module, configured to determine, based on the three-dimensional detection image, a cross-sectional fitting curve that is perpendicular to the extension direction of the target gap and passes through a preset detection point; the cross-sectional fitting curve is used to characterize the cross-sectional shape of the target gap; A second processing module is used to perform differentiation processing on the cross-section fitting curve to obtain a differential curve for representing the depth differential value corresponding to each pixel point; A third processing module, configured to determine, based on the differential curve, a first position and a second position respectively representing positions of two opposite side walls of the target gap; and The fourth processing module is used to determine the width of the target gap according to the position information of the first position and the second position in a preset coordinate system.
18. A pre-welding dimension detection system, characterized in that: include: A clamping device, used for clamping a first component and a second component to be welded to a set position so that a target gap is formed between the first component and the second component; An image acquisition device is configured to obtain a three-dimensional detection image of the location of the target gap; A control device is configured to receive the three-dimensional detection image and execute the size detection method described in any one of claims 1-15.
19. A computing device, characterized in that include: at least one processor; as well as At least one memory is communicatively connected to the at least one processor, the at least one memory stores instructions, and when the instructions are executed by the at least one processor individually or collectively, the computing device executes the size detection method according to any one of claims 1 to 15.
20. A computer-readable storage medium, characterized in that: Instructions are stored, which, when executed individually or collectively by one or more processors of a computing device, enable the computing device to perform the size detection method according to any one of claims 1 to 15.
21. A computer program product, characterized in that The invention comprises instructions, which, when executed individually or collectively by one or more processors of a computing device, cause the computing device to perform the size detection method according to any one of claims 1 to 15.
Citation Information
Patent Citations
Weld appearance shape based on line laser scanning and surface defect detection method
CN104697467A
Geometric size measuring method and device for slit inside free-form surface
CN106705847A
Visual detection method and system for welding seam contour
CN111738985A
Quality control data analysis method
CN113504239A
Vehicle body door slot detection method based on edge detection
CN115187552A