Pipe fitting contour real-time tracking and deformation analysis method and system based on parallel backlight visual imaging
By constructing a parallel backlight telecentric imaging link and a brightness reference map, the problems of unstable brightness reference and low cross-frame tracking consistency in pipe deformation detection were solved. This enabled the synchronization of high-brightness pixel determination and stable determination of deformation state, improving the continuity and adaptability of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-03-24
AI Technical Summary
Existing online visual inspection and contour tracking methods for pipe deformation suffer from problems such as unstable brightness benchmarks due to the influence of ambient light and surface reflection, low consistency between outer contour extraction and cross-frame tracking, poor adaptability of fixed threshold judgment, and easy fluctuations in judgment across consecutive frames.
By constructing a parallel backlight telecentric imaging link, acquiring a brightness reference image, calculating the high-brightness pixel judgment threshold and generating a judgment region, the acquisition of time-series images of pipe fittings and continuous frame judgment are realized, forming a contour sequence, and calculating the flattening width and curvature parameters.
It achieves benchmarked constraints and traceable recording under imaging conditions, reduces contour fluctuations introduced by ambient light and surface reflection, improves the synchronous determination of threshold and statistical region, and enhances the continuity of contour tracking and the stability of deformation state determination.
Smart Images

Figure CN121724980A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision inspection and industrial online measurement technology, specifically to a method and system for real-time tracking and deformation analysis of pipe contours based on parallel backlight vision imaging. Background Technology
[0002] Common pipe deformation detection solutions include contact gauge measurement, three-dimensional measurement based on laser displacement or structured light, and two-dimensional visual measurement based on ordinary backlight or front light illumination.
[0003] Contact measurement has high requirements for workstation layout and fixture rigidity, and it is difficult to continuously acquire time-series data during deformation at high-speed cycles.
[0004] While three-dimensional measurement can obtain richer spatial information, it has high equipment costs, calibration complexity, and requirements for on-site anti-interference. Furthermore, its stability is highly dependent on environments such as metal reflection, oil stains, and vibration.
[0005] Two-dimensional vision solutions are more commonly used in engineering, but under normal lighting conditions, they are easily affected by changes in ambient light, surface reflection, and texture interference, resulting in unstable outer contour edges.
[0006] During the flattening or closing of pipe fittings, some deformation determinations often rely on the brightness difference of a single frame or a fixed threshold, which can easily lead to inconsistent determinations when there are fluctuations in backlight brightness, drift in exposure parameters, changes in occlusion status, or the presence of local transmission noise.
[0007] In addition, some solutions separate contour extraction, cross-frame tracking, parameter calculation and state determination into independent steps, lacking an input-output closed-loop description based on brightness benchmark, threshold and determination area, time sequence acquisition, contour sequence, geometric parameters and continuous frame determination. This makes the data dependencies between different steps unclear and makes it difficult to achieve stable real-time tracking and deformation analysis under the same engineering conditions.
[0008] therefore Summary of the Invention In view of the above-mentioned problems, the present invention is proposed.
[0009] Therefore, the technical problem solved by this invention is that existing online visual detection and contour tracking methods for pipe deformation suffer from unstable brightness references due to the influence of ambient light and surface reflection, low consistency between outer contour extraction and cross-frame tracking, poor adaptability of fixed threshold judgment and easy fluctuation in continuous frame judgment, and the problem of how to construct brightness references and judgment areas under parallel backlight telecentric imaging conditions, adaptively determine the judgment threshold of high-brightness pixels based on brightness references, and integrate contour sequence, flattening width and curvature parameters with continuous frame judgment rules to achieve real-time tracking of pipe contours and online judgment of deformation state.
[0010] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging, including constructing a parallel backlight telecentric imaging link, acquiring a brightness reference through the parallel backlight telecentric imaging link and constructing a brightness reference map.
[0011] The bright pixel determination threshold is calculated by using the brightness and darkness reference map and a determination region is generated. The bright pixel determination threshold and the determination region are used as inputs to acquire time-series images of the pipe fittings.
[0012] Extract the outer contour of the image and match the output contour sequence across frames. Use the contour sequence as input to calculate the flattening width and curvature parameters, and count the bright pixels in the judgment area. Use the counted bright pixels in the judgment area to determine the deformation state through continuous frame judgment.
[0013] The calculation of the bright pixel determination threshold includes determining the bright pixel determination threshold based on the ratio of the difference between the brightness reference value and the darkness reference value.
[0014] The generation of the determination region includes locating the determination region by using the light and dark boundary of the light and dark reference map.
[0015] The process of acquiring time-series images of pipe fittings includes triggering continuous acquisition at a frame rate and performing cropping on the determined region, comparing the cropping result with a high-brightness pixel threshold, and obtaining the time-series images of pipe fittings.
[0016] As a preferred embodiment of the pipe contour real-time tracking and deformation analysis method based on parallel backlight visual imaging described in this invention, the construction of the parallel backlight telecentric imaging link includes assembling the parallel backlight source, the pipe workstation and the imaging unit in the same optical path direction.
[0017] Align the optical axis of the telecentric lens with the normal direction of the parallel backlight source, and adjust the distance between the imaging unit and the pipe fitting station according to the working distance of the telecentric lens.
[0018] The relative positions of the camera and the telecentric lens are fixed based on the flattened area and boundary extension range of the imaging field of view covering the tube.
[0019] Set the backlight brightness setting, camera exposure parameters, and camera gain parameters as the parameter group to be confirmed, and perform parameter group confirmation in the order of unobstructed background acquisition, occluded acquisition, and parameter locking.
[0020] In an unobstructed state, continuously collect no less than 10 background frames and calculate the background grayscale statistics; in an obstructed state, continuously collect no less than 10 obstructed frames and calculate the obstructed grayscale statistics.
[0021] When the average grayscale value of the background frame falls between 200 and 245 and the average grayscale value of the occluded frame falls between 0 and 50, the current backlight brightness setting, exposure time, and gain are used as the set of parameters to be confirmed after confirmation.
[0022] When the average grayscale value of the background frame does not fall within 200~245 and the average grayscale value of the occluded frame does not fall within 0~50, adjust the backlight brightness setting, exposure time and gain in sequence and repeat the acquisition of the background frame and the acquisition of the occluded frame.
[0023] The confirmed parameter set to be confirmed, along with the acquisition time, camera number, and lens number, is written into the parallel backlight telecentric imaging link parameter record.
[0024] As a preferred embodiment of the pipe contour real-time tracking and deformation analysis method based on parallel backlight visual imaging described in this invention, the step of acquiring the brightness reference and constructing the brightness reference map includes performing brightness reference acquisition under the condition that the backlight brightness setting value, exposure time and gain corresponding to the imaging link parameter recording remain unchanged.
[0025] Multiple background frames are continuously acquired in an unobstructed state. Each frame is recorded in chronological order, and a fusion operation is performed on the background frames to obtain a background baseline image.
[0026] The fusion operation includes averaging the gray values at the same pixel location, continuously acquiring multiple occluded frames under occlusion conditions, recording the occluded frames in chronological order, and performing a fusion operation on the occluded frames to obtain an occlusion reference map.
[0027] The background reference map and the occlusion reference map are combined to form a brightness reference map. The acquisition time, camera number, lens number, backlight brightness setting, exposure time and gain of the imaging link parameters are bound to the brightness reference map and the brightness reference map record is output.
[0028] As a preferred embodiment of the pipe contour real-time tracking and deformation analysis method based on parallel backlight visual imaging described in this invention, the step of determining the high-brightness pixel judgment threshold includes selecting a background statistical region from the background reference image and calculating the grayscale mean of the background statistical region as the brightness reference value.
[0029] Select the occlusion statistical area from the occlusion reference map and calculate the grayscale mean of the occlusion statistical area as the darkness reference value. Calculate the difference ratio between the brightness reference value and the darkness reference value and determine the high-brightness pixel judgment threshold.
[0030] The generation of the determination region includes performing a difference operation on the background reference map and the occlusion reference map in the brightness reference map to obtain a brightness difference map, and extracting the brightness boundary in the brightness difference map.
[0031] The bounding area of the pipe fitting's outer contour is determined by the light-dark boundary, and a set of strip-shaped candidate regions is constructed within the bounding area along the flattening direction.
[0032] Calculate the transmittance sensitivity index for a set of candidate regions in a light-dark difference map. The transmittance sensitivity index includes the cumulative amount of gray-level difference values within the region. The strip-shaped candidate region with the highest transmission sensitivity index is selected as the judgment region. The high-brightness pixel judgment threshold and the judgment region are output together.
[0033] As a preferred embodiment of the pipe contour real-time tracking and deformation analysis method based on parallel backlight visual imaging described in this invention, the extraction of the outer contour of the image includes reading the high-brightness pixel determination threshold and determination area, and registering each frame image together with the corresponding frame number and acquisition time to form a frame record.
[0034] For each frame in the frame recording, grayscale normalization is performed based on a brightness reference map. The grayscale normalization process includes linearly stretching the grayscale of the current frame using a background reference map and an occlusion reference map until the grayscale reference of the current frame matches the brightness reference. Figure 1 To.
[0035] Brightness-dark segmentation is performed on the grayscale-normalized image to obtain a binary image of the pipe fitting entity. Boundary closure and hole filling are then performed on the binary image to obtain a closed entity region.
[0036] Extract the outer boundary point set from the closed solid region and connect them in order to form the outer contour curve.
[0037] The cross-frame matching output contour sequence includes reading the contour frame records of two adjacent frames and calculating the center point coordinates, circumscribed rectangle, and number of contour points of the outer contour curve.
[0038] Matching is performed based on the displacement of the center point coordinates and the overlap of the circumscribed rectangle. Based on the matching results, the outer contour curves of adjacent frames are connected in order of frame number to form a contour sequence.
[0039] As a preferred embodiment of the pipe contour real-time tracking and deformation analysis method based on parallel backlight visual imaging described in this invention, the calculation of flattening width and curvature parameters includes reading the outer contour curve frame by frame through the contour sequence and establishing a scan line set in the flattening direction.
[0040] The scan line set covers the range of the judgment area in the flattening direction. The intersection of each scan line with the outer contour curve is obtained to obtain the intersection point pair of the two side boundaries.
[0041] The boundary spacing pixel value is calculated based on the intersection point pair to form a boundary spacing set. The minimum boundary spacing pixel value in the boundary spacing set is selected as the frame flattening width pixel amount. The flattening width pixel amount is converted according to the pixel to physical scale conversion factor to obtain the flattening width.
[0042] The flattening width and curvature parameters are arranged into a parameter sequence according to the frame number.
[0043] As a preferred embodiment of the pipe fitting contour real-time tracking and deformation analysis method based on parallel backlight visual imaging described in this invention, the method for statistically analyzing bright pixels within the determination area includes reading the determination area for each frame of pipe fitting time-series image and performing cropping on the determination area to obtain a determination sub-image.
[0044] The grayscale value of each pixel is compared with the bright pixel determination threshold. Pixels with grayscale values not less than the bright pixel determination threshold are recorded as bright pixels and collected to form a bright pixel set.
[0045] The number of pixels in the set of highlighted pixels is counted to obtain the highlighted pixel count, and the highlighted pixel count and frame number are written into the counting sequence.
[0046] Perform connected component labeling on the set of highlighted pixels and count the number and area of connected components. Write the number, area, and frame number together into the connected component record.
[0047] Determining the deformation state involves recording the parameter sequence and the count sequence as input for continuous frame determination, setting the continuous frame length and noise tolerance, performing continuous validity judgment on the count of bright pixels within a sliding window, and determining the deformation state based on the judgment result.
[0048] Another objective of this invention is to provide a real-time pipe fitting contour tracking and deformation analysis system based on parallel backlight visual imaging. This system can construct a parallel backlight telecentric imaging link and acquire a brightness reference map. Based on the brightness reference map, it calculates the high-brightness pixel judgment threshold and judgment area, and uses the threshold and judgment area for a closed-loop process of pipe fitting time-series image acquisition and continuous frame judgment. This solves the problems of current online visual detection technology for pipe fitting deformation, such as the lack of imaging reference leading to threshold setting relying on experience, unclear judgment area leading to instability of statistical objects, and lack of cross-frame consistency constraints in contour tracking and deformation state judgment.
[0049] As a preferred embodiment of the pipe fitting contour real-time tracking and deformation analysis system based on parallel backlight visual imaging described in this invention, it includes: a brightness and darkness reference construction module, a threshold region and time sequence acquisition module, and a contour deformation determination module.
[0050] The brightness and darkness reference construction module is used to construct a parallel backlight telecentric imaging link, and to acquire brightness and darkness references and construct brightness and darkness reference maps through the parallel backlight telecentric imaging link.
[0051] The threshold region and time-series acquisition module is used to calculate the bright pixel determination threshold and generate the determination region through the brightness reference map, and to acquire the pipe fitting time-series image by taking the bright pixel determination threshold and the determination region as input.
[0052] The contour deformation determination module is used to extract the outer contour of the image and match and output the contour sequence across frames. The contour sequence is used as input to calculate the flattening width and curvature parameters, and the bright pixels are counted in the determination area. The deformation state is determined by the bright pixels counted in the determination area through continuous frame determination.
[0053] Another object of the present invention is to provide a device for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging.
[0054] Another object of the present invention is to provide a storage medium for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging, wherein a computer program is stored thereon, and when the computer program is executed by a processor, the steps of the method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging are implemented.
[0055] The beneficial effects of this invention are as follows: The real-time tracking and deformation analysis method for pipe contours based on parallel backlight visual imaging provided by this invention achieves benchmark constraints and traceable recording of imaging conditions by constructing a parallel backlight telecentric imaging link and acquiring a brightness reference map; using the reference map as a unified reference for subsequent calculations and judgments achieves the beneficial effect of reducing contour fluctuations introduced by ambient light and surface reflections; calculating the high-brightness pixel judgment threshold from the brightness reference map and generating a judgment region achieves the synchronous determination of the threshold and statistical region; linking the threshold and judgment region for time-series image acquisition and pixel comparison achieves the beneficial effect of reducing the threshold dependence on empirical setting and improving the adaptability to different batch working conditions; by extracting the outer contour and matching it across frames to form a contour sequence, continuous tracking of the contour in the time dimension is achieved; calculating the flattening width and curvature parameters with the contour sequence and combining it with the continuous frame judgment of high-brightness pixels in the judgment region finally achieves the beneficial effect of improving the continuity of deformation state judgment and reducing single-frame noise interference. This invention achieves better results in terms of imaging benchmark consistency, contour tracking continuity, and deformation state judgment stability. Attached Figure Description
[0056] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0057] Figure 1 This is an overall flowchart of a method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging, provided in Embodiment 1 of the present invention. Detailed Implementation
[0058] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0059] Example 1, referring to Figure 1 As an embodiment of the present invention, a method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging is provided, comprising: S1: Construct a parallel backlight telecentric imaging link, acquire brightness reference data and construct a brightness reference map through the parallel backlight telecentric imaging link.
[0060] Assemble the parallel backlight source, the pipe fitting station, and the imaging unit in the same optical path direction. Align the optical axis of the telecentric lens with the normal direction of the parallel backlight source. Adjust the distance between the imaging unit and the pipe fitting station according to the working distance of the telecentric lens. Fix the relative position of the camera and the telecentric lens according to the imaging field of view covering the flattened area and the boundary extension range of the pipe fitting.
[0061] Set the backlight brightness setting, camera exposure parameters, and camera gain parameters as the parameter group to be confirmed, and perform parameter group confirmation in the order of unobstructed background acquisition, occluded acquisition, and parameter locking.
[0062] In an unobstructed state, at least 10 background frames are continuously acquired and the background grayscale statistics are calculated. The background grayscale statistics include the mean grayscale value and the standard deviation of the grayscale value of the background frames.
[0063] Under occlusion conditions, at least 10 occluded frames are continuously collected and occlusion grayscale statistics are calculated. The occlusion grayscale statistics include the average grayscale value of the occluded frames.
[0064] When the average grayscale value of the background frame falls between 200 and 245 and the average grayscale value of the occluded frame falls between 0 and 50, the current backlight brightness setting, exposure time, and gain are used as the set of parameters to be confirmed after confirmation.
[0065] When the average grayscale value of the background frame does not fall within 200~245 and the average grayscale value of the occluded frame does not fall within 0~50, adjust the backlight brightness setting, exposure time and gain in sequence and repeat the acquisition of the background frame and the acquisition of the occluded frame.
[0066] The confirmed parameter set to be confirmed, along with the acquisition time, camera number, and lens number, is written into the parallel backlight telecentric imaging link parameter record.
[0067] Furthermore, under the condition that the backlight brightness setting value, exposure time and gain corresponding to the imaging link parameter recording remain unchanged, brightness reference acquisition is performed.
[0068] Multiple background frames are continuously acquired in an unobstructed state. Each frame is recorded in chronological order, and a fusion operation is performed on the background frames to obtain a background baseline image.
[0069] The fusion operation includes averaging the gray values at the same pixel location.
[0070] A preferred approach for average fusion is:
[0071]
[0072] in, Represents pixel coordinates, Represents the x-coordinate of the pixel coordinates. Represents the y-coordinate of the pixel coordinates. Indicates the first Frame background frame in grayscale value, Indicates the first Frame occlusion in grayscale value, Indicates the number of background frames. Represents the background reference image. Represents the occlusion reference map. This indicates the number of frames that are obscured.
[0073] Multiple occlusion frames are continuously acquired under occlusion conditions. The occlusion frames are recorded in chronological order and fusion operations are performed on the occlusion frames to obtain an occlusion reference map.
[0074] The background reference map and the occlusion reference map are combined to form a brightness reference map. The acquisition time, camera number, lens number, backlight brightness setting, exposure time and gain of the imaging link parameters are bound to the brightness reference map and the brightness reference map record is output.
[0075] S2: Calculate the bright pixel judgment threshold and generate the judgment region through the brightness and darkness reference map. Use the bright pixel judgment threshold and the judgment region as input to acquire the pipe fitting time series image.
[0076] Select a background statistical region from the background reference image and calculate the average gray value of the background statistical region as the brightness reference value.
[0077] Select the occlusion statistical area from the occlusion reference map and calculate the gray mean of the occlusion statistical area as the darkness reference value.
[0078] The difference ratio between the brightness reference value and the darkness reference value is calculated to determine the threshold for judging bright pixels.
[0079] A preferred method for determining the threshold for highlight pixels is:
[0080] in, This indicates the threshold for determining the highlight pixel. Indicates the luminance reference value. Indicates the baseline value for darkness. This represents the difference ratio coefficient.
[0081] The generation of the determination region includes performing a difference operation on the background reference map and the occlusion reference map in the brightness reference map to obtain a brightness difference map, and extracting the brightness boundary in the brightness difference map.
[0082] The bounding range of the pipe's outer contour is determined by the light-dark boundary, and a set of strip-shaped candidate regions is constructed along the flattening direction within the bounding range. The transmission sensitivity index of the set of strip-shaped candidate regions in the light-dark difference map is calculated.
[0083] Transmission sensitivity indicators include the cumulative amount of grayscale difference values within the region.
[0084] The strip-shaped candidate region with the highest transmission sensitivity index is selected as the judgment region, and the high-brightness pixel judgment threshold and the judgment region are output together.
[0085] Furthermore, the high-brightness pixel determination threshold and determination area are read, and each frame image is registered together with the corresponding frame number and acquisition time to form a frame record.
[0086] Perform grayscale normalization processing based on the brightness reference map on each frame of the frame record.
[0087] Gray-level normalization processing includes linearly stretching the gray level of the current frame using a background reference map and an occlusion reference map until the gray level reference and brightness reference of the current frame are reached. Figure 1 To.
[0088] In the image after grayscale normalization, light and dark segmentation is performed to obtain a binary image of the pipe fitting entity. Boundary closure and hole filling are performed on the binary image of the entity to obtain a closed entity region. The outer boundary point set is extracted from the closed entity region and connected in order of point set to form the outer contour curve.
[0089] The cross-frame matching output contour sequence includes reading the contour frame records of two adjacent frames and calculating the center point coordinates, circumscribed rectangle, and number of contour points of the outer contour curve.
[0090] Matching is performed based on the displacement of the center point coordinates and the overlap of the circumscribed rectangle. Based on the matching results, the outer contour curves of adjacent frames are connected in order of frame number to form a contour sequence.
[0091] The matching process includes appending the outer contour curve of the next frame to the end of the contour sequence and updating the contour sequence index when a match is found.
[0092] When a match fails, the corresponding decision region of the same frame is read and the brightness and darkness segmentation and outer contour extraction are re-executed in the neighborhood of the decision region to perform cross-frame matching.
[0093] S3: Extract the outer contour of the image and match the output contour sequence across frames. Use the contour sequence as input to calculate the flattening width and curvature parameters, and count the bright pixels in the judgment area. Use the counted bright pixels in the judgment area to determine the deformation state through continuous frame judgment.
[0094] The outer contour curve is read frame by frame by contour sequence. A set of scan lines is established in the flattening direction. The set of scan lines covers the range of the judgment area in the flattening direction. The intersection of each scan line with the outer contour curve is obtained to obtain the intersection point pair of the two side boundaries.
[0095] The boundary spacing pixel value is calculated based on the intersection point pair to form a boundary spacing set. The minimum boundary spacing pixel value in the boundary spacing set is selected as the frame flattening width pixel amount. The flattening width pixel amount is converted according to the pixel to physical scale conversion coefficient to obtain the flattening width. The flattening width and curvature parameter are combined into a parameter sequence in the order of frame number.
[0096] A preferred method for calculating the flattening width is:
[0097] in, Indicates the first Frame width compression This represents the conversion factor from pixels to physical scale. Indicates the first Frame number The distance between the two side boundaries is obtained after the intersection of the scan line and the contour. Indicates the scan line index. Indicates the total number of scan lines. Indicates the frame number index.
[0098] Furthermore, the determination region is read from each frame of the pipe timing image and cropped to obtain a determination sub-image. The gray value of each pixel is compared with the high-brightness pixel determination threshold. Pixels with gray values not less than the high-brightness pixel determination threshold are recorded as high-brightness pixels and collected to form a high-brightness pixel set.
[0099] The number of pixels in the set of highlighted pixels is counted to obtain the highlighted pixel count, and the highlighted pixel count and frame number are written into the counting sequence.
[0100] Perform connected component labeling on the set of highlighted pixels and count the number and area of connected components. Write the number, area, and frame number together into the connected component record.
[0101] Determining the deformation state involves recording the parameter sequence and the count sequence as input for continuous frame determination, setting the continuous frame length and noise tolerance, performing continuous validity judgment on the count of bright pixels within a sliding window, and determining the deformation state based on the judgment result.
[0102] A preferred approach to performing the consecutive validity judgment is as follows:
[0103] in, Indicates the first A frame is a consecutive frame determination quantity for the window's terminating frame. Indicates the offset index within the window. Indicates the length of consecutive frames. Indicates the first Frame highlight pixel count, Indicates noise tolerance. This is an indicator function; it returns 1 if the condition is true, and 0 otherwise. This indicates a series multiplication operation.
[0104] A preferred approach for determining the deformation state based on the judgment result is: Within the sliding window, a continuous true / false check is performed on the count of bright pixels to obtain the judgment value. ,when When the deformation state is the established state, It maintains the deformation state of the previous frame, and the deformation state is not valid if it is not valid in consecutive frames.
[0105] Example 2 is an embodiment of the present invention, which provides a method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.
[0106] First, an online inspection scenario of a pipe fitting in a continuous pressing and flattening station was selected as the verification object. The station cycle time was 25 frames per second, and the pipe fitting was gradually flattened under the action of the clamping mechanism, accompanied by local transmission changes.
[0107] The test objects were six thin-walled metal pipes of the same specification, which were designated as test pipe A1 to test pipe A6.
[0108] The imaging side uses a parallel backlight source, and the pipe fitting station and imaging unit are assembled along the same optical path direction. The optical axis of the telecentric lens is consistent with the normal direction of the backlight source. The distance between the imaging unit and the pipe fitting station is adjusted according to the working distance of the telecentric lens. The relative position of the camera and the telecentric lens is fixed on the premise of ensuring that the imaging field of view covers the flattened area of the pipe fitting and the boundary extension range, so as to avoid the drift of the contour scale due to the change of the field of view.
[0109] During the imaging parameter confirmation stage, the backlight brightness setting, exposure time, and gain are set as parameters to be confirmed, and the process is executed in the order of unobstructed background acquisition, obstructed acquisition, and parameter locking.
[0110] Specifically, at least 10 background frames are continuously collected in an unobstructed state, and the mean gray level and standard deviation of the gray level of the background frames are calculated in the background statistical area as background gray level statistics. At least 10 occluded frames were continuously collected under occlusion conditions, and the average grayscale value of the occluded frames was calculated in the occlusion statistical area as the occlusion grayscale statistical quantity.
[0111] If the average grayscale value of the background frame is between 200 and 245 and the average grayscale value of the occluded frame is between 0 and 50, then the current backlight brightness setting, exposure time, and gain will be locked as the confirmed parameter group.
[0112] If any statistic does not fall within the range of 200 to 245, adjust the backlight brightness setting, exposure time, and gain in that order, and repeat the background frame acquisition and occlusion frame acquisition until the range requirement is met. The confirmed parameter set, along with the acquisition time, camera number, and lens number, is written into the parallel backlight telecentric imaging link parameter record.
[0113] After locking the parameter recording, keep the backlight brightness setting, exposure time, and gain unchanged, and perform brightness reference acquisition: Multiple background frames are continuously acquired in an unobstructed state and recorded in chronological order. The grayscale values at the same pixel location are averaged and fused to obtain a background baseline image.
[0114] Multiple occlusion frames are continuously acquired under occlusion conditions and recorded in chronological order. The grayscale values at the same pixel location are averaged and fused to obtain the occlusion reference map.
[0115] The background reference map and the occlusion reference map are combined to form a brightness reference map, which is then bound to the imaging link parameter recording field to form a brightness reference map record.
[0116] Subsequently, a brightness reference value is calculated by selecting a background statistical region from the background reference map, and a darkness reference value is calculated by selecting an occlusion statistical region from the occlusion reference map. The threshold for determining bright pixels is determined based on the ratio of the difference between the two.
[0117] Simultaneously, a light-dark difference map is obtained by performing a difference on the light-dark reference map. The light-dark boundary is extracted from the light-dark difference map to determine the range of the outer contour of the pipe. Within the range of the boundary map, a set of strip-shaped candidate regions is constructed along the flattening direction. The cumulative amount of gray-scale difference values within the candidate regions is used as the transmission sensitivity index. The strip-shaped candidate region with the largest transmission sensitivity index is selected as the judgment region.
[0118] During the online acquisition phase, the high-brightness pixel judgment threshold and judgment area are read. A frame number and acquisition time are registered for each frame of the pipe fitting image to form a frame record. Then, linear stretching grayscale normalization processing is performed on the current frame using the background reference map and occlusion reference map to ensure that the grayscale reference of the current frame is aligned with the brightness reference. Figure 1 To.
[0119] Brightness and darkness segmentation is performed in the normalized image to obtain a binary image of the pipe entity. Boundary closure and hole filling are performed to obtain a closed entity region. The outer boundary point set is extracted and connected to form the outer contour curve.
[0120] Read the contour frame records of two adjacent frames, calculate the coordinates of the center point, the bounding rectangle and the number of contour points, perform matching based on the center point displacement and the overlap relationship of the bounding rectangle, and connect the outer contour curves of adjacent frames in order of frame number to form a contour sequence.
[0121] When a match fails, the same frame's judgment region is read, and the outer contour is re-segmented and extracted within its neighborhood before matching again.
[0122] A set of scan lines is established frame by frame based on the contour sequence. The set of scan lines covers the range of the judgment area in the flattening direction. The intersection with the outer contour is used to obtain the set of boundary spacings, and the minimum value is taken to calculate the flattening width. At the same time, a parameter sequence aligned with the frame number is formed.
[0123] The decision sub-image is obtained by cropping within the decision region, the grayscale is compared with the threshold to obtain the set of bright pixels and the count of bright pixels is counted, and the number of connected components and the area of the largest connected component are further recorded.
[0124] The parameter sequence and the counting sequence are used as inputs for continuous frame determination. The continuous validity determination is performed within the sliding window, and the deformation state record is output.
[0125] To provide an objective reference, the flattening width benchmark was obtained by offline re-measurement with measuring instruments and compared with the online calculation results. The experimental data are shown in Table 1.
[0126] Table 1 Experimental Data
[0127] The basic statistics of the imaging link can be used to directly verify whether the closed-loop chain of the present invention, which includes benchmark constraints, threshold and region linkage, and cross-frame consistency, is executable and stable.
[0128] First, the constraint range of the parameter locking stage is satisfied by objective data: the average gray value of the background frame in this invention is stably between 224 and 239, and the average gray value of the occluded frame is between 19 and 41, indicating that under the same imaging link parameter recording, clear light and dark separation can be formed between the unoccluded and occluded images.
[0129] More importantly, the standard deviation of the grayscale of the background frame in this invention is approximately 1.9 to 2.4, which is significantly lower than the 6.9 to 9.1 of the prior art.
[0130] The difference reflects that after adopting the combination of parallel backlight telecentric link assembly + parameter locking + brightness reference fusion, the inter-frame fluctuation of background grayscale is compressed to a smaller range, thus providing a reusable reference coordinate system for subsequent linear stretching normalization.
[0131] In contrast, the existing technology has a large grayscale standard deviation, which means that under the same exposure and gain, the grayscale reference inside and outside the frame is prone to drift, resulting in an increase in the threshold sensitivity of brightness and darkness segmentation.
[0132] Secondly, this invention does not use a fixed threshold, but determines the threshold for judging bright pixels based on the brightness reference.
[0133] In the table, the high-brightness pixel determination threshold of the present invention varies slightly between 183 and 203 depending on the test tube. This variation is consistent with the corresponding background and occlusion reference gray level, thus binding the threshold to the imaging reference.
[0134] The fixed threshold of the existing technology is always 170. When the average gray value of the occlusion reaches 58 to 79, a large number of pixels with gray values not less than the threshold are more likely to appear in the judgment area, resulting in a significantly larger count of bright pixels. However, the bright pixel count of the present invention is kept at a low level of 9 to 22, and together with the number of connected regions and the maximum connected region area, it forms an interpretable statistical chain: when a real transmission slit or local opening appears in the judgment area, the bright pixel count and the maximum connected region area increase synchronously, but the overall increase is not due to background drift.
[0135] This directly reflects the data consistency among the threshold, judgment area, and statistical object, which all originate from the same source.
[0136] Furthermore, cross-frame matching metrics can reflect the availability of contour sequences.
[0137] The cross-frame matching success rate of this invention reaches 98.7% to 99.4%, indicating that under the premise of stable grayscale normalization and contour extraction, the relationship between the center point displacement and the overlap of the circumscribed rectangle has continuous discriminability, so that the contour sequence can be continuously output.
[0138] The current technology has a cross-frame matching success rate of 86.9% to 90.2%, which means that backtracking and re-extraction are required on many frames or there is a risk of sequence breakage. This will further affect the continuity of the flattened width sequence formed by frame-by-frame intersection, boundary spacing set, and minimum value.
[0139] Correspondingly, the objective error of the flattening width is very obvious: the absolute error between the online measurement value of the present invention and the reference gauge is 0.01 to 0.03 mm, while that of the prior art is 0.12 to 0.16 mm.
[0140] The difference does not come from additional hardware, but from the fact that this invention uses the recording of the light and dark reference image, grayscale normalization, stable contour, and contour sequence as the input premise for calculating geometric parameters, so that the minimum boundary spacing in the flattening direction is not affected by grayscale drift and contour jitter amplification.
[0141] Finally, the consistency of deformation state determination reflects the noise suppression effect of continuous frame determination. The consistency of this invention is 99.0% to 99.6%, while that of the prior art is 88.7% to 92.1%. Combined with the difference in bright pixel count, it can be inferred that the prior art is more prone to increased counting noise at a fixed threshold, and the counting sequence within the continuous frame determination window is more prone to fluctuation, thus leading to inconsistencies in state recording.
[0142] This invention limits the statistical objects by using a benchmark threshold and a decision region, and supplements this with connected component recording constraints, so that the continuous frame decision input sequence is closer to the temporal behavior of real transmission changes, and exhibits stability at the state recording level.
[0143] Meanwhile, the single-frame processing latency is similar for both, indicating that the improvement mainly comes from process organization and data link constraints, rather than sacrificing real-time performance for the sake of results.
[0144] In summary, the table comparison shows that the present invention forms a verifiable closed-loop process in terms of imaging benchmark consistency, contour sequence continuity, geometric parameter error control and deformation state determination consistency, and can provide an engineering improvement path for the shortcomings of existing technologies such as missing benchmarks, fixed thresholds and cross-frame instability.
[0145] Example 3, an embodiment of the present invention, provides a real-time tracking and deformation analysis system for pipe contours based on parallel backlight visual imaging, including a brightness and darkness reference construction module, a threshold region and time sequence acquisition module, and a contour deformation determination module.
[0146] The brightness and darkness reference construction module is used to construct a parallel backlight telecentric imaging link, and to acquire brightness and darkness references and construct brightness and darkness reference maps through the parallel backlight telecentric imaging link.
[0147] The threshold region and time-series acquisition module is used to calculate the bright pixel judgment threshold and generate the judgment region through the brightness reference map. The bright pixel judgment threshold and the judgment region are used as input to acquire the time-series image of the pipe fitting.
[0148] The contour deformation determination module is used to extract the outer contour of the image and match the output contour sequence across frames. The contour sequence is used as input to calculate the flattening width and curvature parameters, and the bright pixels are counted in the determination area. The deformation state is determined by the bright pixels counted in the determination area through continuous frame determination.
[0149] This embodiment also provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging as proposed in the above embodiment.
[0150] This embodiment also provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements the method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging as proposed in the above embodiment.
[0151] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0152] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0153] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0154] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0155] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for real-time tracking and deformation analysis of pipe fitting contours based on parallel backlight visual imaging, characterized in that, include: Construct a parallel backlight telecentric imaging link, acquire brightness and darkness references through the parallel backlight telecentric imaging link, and construct a brightness and darkness reference map; The bright pixel determination threshold is calculated by the brightness and darkness reference map and the determination region is generated. The bright pixel determination threshold and the determination region are used as input to acquire the time series image of the pipe fitting. Extract the outer contour of the image and match the output contour sequence across frames. Use the contour sequence as input to calculate the flattening width and curvature parameters, and count the bright pixels in the judgment area. Use the bright pixels counted in the judgment area to determine the deformation state through continuous frame judgment. Calculating the bright pixel determination threshold includes determining the bright pixel determination threshold based on the ratio of the difference between the brightness reference value and the darkness reference value; The generation of the judgment region includes locating the judgment region by means of the light and dark boundary of the light and dark reference map; The process of acquiring time-series images of pipe fittings includes triggering continuous acquisition at a frame rate and performing cropping on the determined region, comparing the cropping result with a high-brightness pixel threshold, and obtaining the time-series images of pipe fittings.
2. The method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging as described in claim 1, characterized in that: The construction of the parallel backlight telecentric imaging link includes The parallel backlight source, the tube fitting station, and the imaging unit are assembled in the same optical path direction; Align the optical axis of the telecentric lens with the normal direction of the parallel backlight source; Adjust the distance between the imaging unit and the pipe fitting station according to the working distance of the telecentric lens; The relative positions of the camera and the telecentric lens are fixed according to the flattened area and boundary extension range of the imaging field of view covering the tube. Set the backlight brightness setting, camera exposure parameters, and camera gain parameters as the parameter group to be confirmed, and perform parameter group confirmation in the order of background unobstructed acquisition, occluded acquisition, and parameter locking. In an unobstructed state, continuously acquire no less than 10 background frames and calculate the background grayscale statistics; Under occlusion conditions, continuously collect no less than 10 occluded frames and calculate the occlusion grayscale statistics; When the average grayscale value of the background frame falls between 200 and 245 and the average grayscale value of the occluded frame falls between 0 and 50, the current backlight brightness setting, exposure time, and gain are used as the set of parameters to be confirmed after confirmation. When the average grayscale value of the background frame does not fall within 200~245 and the average grayscale value of the occluded frame does not fall within 0~50, adjust the backlight brightness setting, exposure time and gain in sequence and repeat the background frame acquisition and occluded frame acquisition. The confirmed parameter set to be confirmed, along with the acquisition time, camera number, and lens number, is written into the parallel backlight telecentric imaging link parameter record.
3. The method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging as described in claim 1 or 2, characterized in that: The process of acquiring a brightness reference and constructing a brightness reference map includes, Under the condition that the backlight brightness setting value, exposure time and gain remain unchanged, the brightness reference acquisition is performed; Multiple background frames are continuously acquired in an unobstructed state. Each frame is recorded in chronological order and a fusion operation is performed on the background frames to obtain a background reference map. The fusion operation includes averaging and fusing the gray values at the same pixel location; Multiple occlusion frames are continuously acquired under occlusion conditions. The occlusion frames are recorded in chronological order and fusion operations are performed on the occlusion frames to obtain an occlusion reference map. The background reference map and the occlusion reference map are combined to form a brightness reference map. The acquisition time, camera number, lens number, backlight brightness setting, exposure time and gain of the imaging link parameters are bound to the brightness reference map and the brightness reference map record is output.
4. The method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging as described in claim 3, characterized in that: The determination of the high-brightness pixel threshold includes, Select a background statistical region from the background reference image and calculate the average gray value of the background statistical region as the brightness reference value; Select the occlusion statistical area from the occlusion reference map and calculate the gray-scale mean of the occlusion statistical area as the darkness reference value; The difference ratio between the brightness reference value and the darkness reference value is calculated to determine the threshold for judging bright pixels; The generation of the determination region includes performing a difference operation on the background reference map and the occlusion reference map in the brightness reference map to obtain a brightness difference map, and extracting the brightness boundary in the brightness difference map; The bounding range of the outer contour of the pipe fitting is determined by the light-dark boundary, and a set of strip-shaped candidate regions is constructed along the flattening direction within the bounding range; Calculate the transmission sensitivity index of the strip candidate region set in the light-dark difference map; Transmission sensitivity indicators include the cumulative amount of grayscale difference values within the region; The strip-shaped candidate region with the highest transmission sensitivity index was selected as the judgment region. The combined output sets the threshold and region for determining the highlight pixels.
5. The method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging as described in claim 1, 2, or 4, characterized in that: The extracted image outer contour includes, Read the high-brightness pixel judgment threshold and judgment area, and register each frame image together with the corresponding frame number and acquisition time to form a frame record; Perform grayscale normalization based on the brightness reference map on each frame of the frame record; Gray-level normalization processing includes linearly stretching the gray level of the current frame using the background reference map and the occlusion reference map until the gray level reference of the current frame is consistent with the brightness reference map. Perform highlight-dark segmentation on the grayscale-normalized image to obtain a binary image of the pipe fitting entity; Perform boundary closure and hole filling on the binary solid image to obtain a closed solid region; Extract the outer boundary point set from the closed solid region and connect them in order to form the outer contour curve; The cross-frame matching output contour sequence includes reading the contour frame records of two adjacent frames and calculating the center point coordinates, circumscribed rectangle and number of contour points of the outer contour curve; Matching is performed based on the displacement of the center point coordinates and the overlap of the circumscribed rectangle. Based on the matching results, the outer contour curves of adjacent frames are connected in order of frame number to form a contour sequence.
6. The method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging as described in claim 5, characterized in that: The calculation of the flattening width and curvature parameters includes, The outer contour curve is read frame by frame using the contour sequence, and a set of scan lines is established in the flattening direction. The range of the scan line set coverage area in the flattening direction; Find the intersection of each scan line with the outer contour curve to obtain the intersection point pairs of the two side boundaries; The boundary spacing pixel values are calculated based on the intersection points to form a boundary spacing set. The minimum boundary spacing pixel value in the boundary spacing set is selected as the frame flattening width pixel amount. The flattening width pixel amount is converted according to the pixel to physical scale conversion factor to obtain the flattening width. The flattening width and curvature parameters are arranged into a parameter sequence according to the frame number.
7. The method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging as described in claim 1, 2, 4 or 6, characterized in that: The highlighted pixels within the determination area include: For each frame of the pipe fitting timing image, the decision region is read and cropped to obtain the decision sub-image; The grayscale value of each pixel is compared with the bright pixel determination threshold. Pixels with grayscale values not less than the bright pixel determination threshold are recorded as bright pixels and collected to form a bright pixel set. The number of pixels in the set of highlighted pixels is counted to obtain the highlighted pixel count, and the highlighted pixel count and frame number are written into the counting sequence; Perform connected component labeling on the set of bright pixels and count the number and area of connected components. Write the number, area and frame number of connected components into the connected component record. Determining the deformation state includes recording the parameter sequence and the count sequence as input for continuous frame determination, setting the continuous frame length and noise tolerance, performing continuous validity judgment on the count of bright pixels within the sliding window, and determining the deformation state based on the judgment result.
8. A system for real-time tracking and deformation analysis of pipe fitting contours based on parallel backlight visual imaging, employing the method for real-time tracking and deformation analysis of pipe fitting contours based on parallel backlight visual imaging as described in any one of claims 1 to 7, characterized in that: Includes a brightness and darkness reference construction module, a threshold region and time series acquisition module, and a contour deformation determination module; The brightness and darkness reference construction module is used to construct a parallel backlight telecentric imaging link, and to acquire brightness and darkness references and construct brightness and darkness reference maps through the parallel backlight telecentric imaging link. The threshold region and time-series acquisition module is used to calculate the bright pixel determination threshold and generate the determination region through the brightness reference map. The bright pixel determination threshold and the determination region are used as inputs to acquire the time-series image of the pipe fitting. The contour deformation determination module is used to extract the outer contour of the image and match and output the contour sequence across frames. The contour sequence is used as input to calculate the flattening width and curvature parameters, and the bright pixels are counted in the determination area. The deformation state is determined by the bright pixels counted in the determination area through continuous frame determination.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for real-time tracking and deformation analysis of pipe contours based on parallel backlight visual imaging as described in any one of claims 1 to 7.