Fire extinguishing gas cylinder appearance defect detection method based on video image
Patent Information
- Application Number
- CN202611202491.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-10
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2046-08-10
AI Technical Summary
[0005]为了解决现有技术中镜面游走高光干扰导致的检测准确性不足的问题,本发明提供基于视频图像的消防气灭瓶组外观缺陷检测方法
本发明将传统单帧加全局阈值的检测范式转变为多帧时序稳健积累范式,依托瓶体自转与亚像元配准,对同一物理点重组灰度时序,经反向截尾有序统计积累在数据层面剔除游走高光,获得去高光反照率与饱和置信图,再以双侧自适应恒虚警门限同时检出正负向缺陷,并结合连通域约束与置信加权实现合格、缺陷、待复检三级判级。在镜面高光持续干扰、背景渐变及焊缝丝印杂波的真实产线工况下稳定维持虚警水平,降低误废率与漏检率,提升了在线质检的检出准确度与分拣可靠性。
Smart Images

Figure CN122714469B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of appearance inspection, and in particular to a method for detecting appearance defects of fire-fighting gas extinguishing cylinder groups based on video images. Background Art
[0002] On the actual production line of fire-fighting gas extinguishing cylinders, the surface of the cylinder body is mostly made of high-reflectivity mirror or semi-mirror material, and the station illumination will form a bright high-light band on the arc-shaped cylinder surface; as the cylinder body rotates, the high-light band moves continuously on the cylinder surface, and the area swept by it often reaches full scale and is fully saturated in a single frame image. Under such real working conditions, if the conventional method of single-frame acquisition plus global threshold is still used, the surface texture where the high-light band reaches will be submerged by strong light, and real defects such as scratches and missing spray located in the high-light area cannot be distinguished in this frame and thus are missed; at the same time, the full-scale bright spots of the moving high-light are very easy to be regarded as high-albedo defects and trigger rejection, so that cylinders that should be qualified are mistakenly scrapped. As a result, the detection performance of the same production line under different cylinder bodies and different rotation angles is sometimes tight and sometimes loose, and missed defect detection and mistaken scrapping of qualified products occur alternately, leading to obvious fluctuations in the production line yield and sorting accuracy in actual operation, which is difficult to meet the standards stably. Therefore, how to stably and accurately detect cylinder surface defects under the on-site condition of continuous interference from mirror-surface moving high-light has become an urgent problem to be solved in the practical application of such inspection devices.
[0003] In the prior art, there are already visual inspection and grading schemes for product surface defects. The Chinese patent application publication No. CN121998977A discloses a visual inspection and grading evaluation method for product bulge defects, which generates a saturation mask for a single-frame image to exclude saturated high-light pixels, then extracts the low-frequency illumination component through fast box mean, calculates a ratio residual image, constructs a bright and dark region segmentation model based on the gray median and the median absolute deviation, and realizes defect grading through connected domain analysis and weighted scoring of morphological weight and gray difference index.
[0004] However, the above scheme only relies on single-frame acquisition, and directly masks and rejects the high-light area, so that real defects submerged by high-light cannot be recovered because the pixels are excluded, which will cause large-area information loss and missed detection under the working condition that the mirror-surface moving high-light continuously sweeps the cylinder surface. It can be seen that the above prior art either only performs single-frame rejection on high-light and loses defect information, or lacks time-sequence suppression means and positive and negative bidirectional discrimination capability for moving high-light, and none of them can stably and accurately detect defects under the inspection working condition of revolving cylinder surface with continuous interference from mirror-surface moving high-light. Summary of the Invention
[0005] In order to solve the problem of insufficient inspection accuracy caused by the interference of mirror-surface moving high-light in the prior art, the present invention provides a method for detecting appearance defects of fire-fighting gas extinguishing cylinder groups based on video images.
[0006] This invention provides a method for detecting appearance defects in fire extinguisher cylinder assemblies based on video images, employing the following technical solution: Step S1: The area array image sensor continuously acquires multiple frames of surface images during the bottle's rotation. Based on the circumferential rotation angles given by the encoder for each frame, a coordinate system for the unfolded surface of the bottle is established and sub-pixel registration and alignment are performed point by point. The images are then reassembled into a grayscale time-series observation sequence for the same physical surface point. Step S2: Arrange the multi-frame observations of each surface point in ascending order, discard the high-end wandering specular values, and take the truncated mean value from the low end to the middle as the robust surface albedo estimate for that point. Then, determine the specular field value frame by frame and count the number of valid frames to generate a robust albedo unfolding map and a saturation frequency confidence map reflecting the reliability of the albedo. The method for taking the truncated mean value from the low end to the middle is as follows: In the multi-frame observations after ascending order, discard the frames at the high end of the sorting with a fixed truncation ratio, and then take the mean value of the frames whose sorting number does not exceed half of the total number of frames in the remaining frames. Step S3: For the robust albedo unfolded graph, a protective zone and a reference ring are arranged around the point to be inspected using local ordered statistics constant false alarm detection. The upper and lower thresholds are constructed from the ordered statistics within the reference ring. Albedo values higher than the upper threshold are judged as positive defect candidates, and those lower than the lower threshold are judged as negative defect candidates. Step S4: Apply spatial connectivity constraints to defect candidates to eliminate false defects, combine the saturation frequency confidence map to give confidence weighted scores to the connected regions, and output three levels of judgment: qualified, defective, and pending re-inspection, and back-map back to the physical coordinates of the bottle.
[0007] This invention relies on multiple frames of images continuously acquired during the bottle's rotation. By using an encoder to establish a coordinate system for the bottle's surface at the circumferential rotation angle, and by registering sub-pixel values point-by-point on the same physical surface, it reassembles observations scattered across different frames and rotation angles into a grayscale temporal sequence for the same surface point. This allows subsequent discrimination to be based on the statistical accumulation of multiple observations of the same point, rather than relying on the accidental imaging of a single frame. Furthermore, by utilizing the rule that wandering specular highlights only appear briefly as a few high-end outliers at any surface point, and through robust accumulation of ascending-order sorting, discarding high-end values, and taking the truncated mean from low-end to median values, full-scale specular highlights are removed from albedo estimation at the data level. This prevents wandering bright spots from being mistakenly identified as high albedo defects and triggering further data processing. The device eliminates defects without missing real defects in the highlight area due to strong light obscuring the texture. At the same time, it records the reliability of each observation point using a saturation frequency confidence map. Furthermore, it constructs a dual-sided threshold that adapts to the local background through local ordered statistical constant false alarm detection. It can maintain a stable false alarm level and capture both positive and negative defects even in cluttered edges and gradually changing backgrounds such as weld seams and screen printing. Finally, it combines connected component constraints and confidence weighted scoring to output three levels of judgment: qualified, defective, and pending re-inspection, and back-maps them back to the bottle coordinates. This type of device significantly reduces the false rejection rate and missed detection rate under real working conditions with continuous interference from mirror-walking highlights. It overcomes the fundamental defects of existing devices, such as inconsistent detection performance and difficulty in achieving stable yield and sorting accuracy under different bottle types and different turning angles.
[0008] Preferably, before establishing the bottle surface unfolding coordinate system, the process further includes extracting the bottle outline and silkscreen anchor points: using the Canny operator to coarsely locate the two nearly vertical outline edges of the bottle on the left and right sides, and then using the gray-scale gradient centroid method to refine the sub-pixel along the edge normal direction to obtain two outline curves, and using the midline of the two outlines as the projection of the bottle rotation axis onto the image plane; using normalized cross-correlation template matching to locate the overall area of the silkscreen mark, and then using Shi-Tomasi corner detection to extract feature points as anchor points within this area, the fixed unfolding coordinates of each anchor point on the bottle surface are determined by the offline calibration of the first piece, and its circumferential observation angle in each frame is the sum of the fixed circumferential angle and the circumferential rotation angle of the anchor point.
[0009] This invention first uses Canny coarse positioning combined with grayscale gradient centroid method to refine the left and right contours of the bottle body by sub-pixel extraction and takes the midline as the rotation axis projection. Then, it uses normalized cross-correlation to locate the screen printing area and uses Shi-Tomasi corner points to extract fixed anchor points calibrated by the first piece. This gives multi-frame registration a high-precision geometric reference and a traceable circumferential phase reference. Even when the bottle body has slight vibrations or encoder phase drift as it passes through the station on the roller conveyor, it can still accurately align each frame to the same physical surface point, avoiding temporal sequence ambiguity and false defects caused by registration misalignment. Furthermore, it treats regular printed patterns such as screen printing as positioning anchor points rather than defects, suppressing the risk of false detection of screen printing edges from the source and providing a reliable premise for subsequent robust accumulation.
[0010] Preferably, the point-by-point sub-pixel registration and alignment includes: establishing a camera coordinate system; a bottle reference coordinate system with the rotation axis as the coordinate axis and an unfolded coordinate system with the circumferential angle and axial height as coordinates; for any surface point in the unfolded coordinate system, first apply the bottle rotation according to the circumferential angle of the frame to obtain its three-dimensional coordinates in the reference coordinate system, then map it to the camera coordinate system through extrinsic parameter transformation, and finally project it to the image plane from the camera intrinsic parameters according to the pinhole imaging model to obtain floating-point pixel coordinates, and only perform mapping on surface points where the angle between the surface normal and the line of sight meets the visibility condition; at the floating-point pixel coordinates, perform bilinear interpolation sampling on the grayscale of the original image after distortion correction and fill it into the corresponding unit of the unfolded image.
[0011] By sequentially projecting any surface point of the unfolded image onto the floating-point coordinates of the image plane through rotation, external parameters, and pinhole intrinsic parameters, and performing mapping only on points that meet the visibility conditions of the angle between the surface normal and the line of sight, and performing bilinear interpolation sampling after distortion correction, compared with the processing method of planar approximate unfolding or simple column rearrangement, it can truly restore the imaging geometry of the surface of revolution, avoid the false textures introduced by the invisible or severely distorted grazing area on the side edge of the bottle, and keep the grayscale of the unfolded image faithful and consistent at the sub-pixel scale, thereby ensuring the grayscale comparability of the same physical point across multiple frames, laying the geometric and radiometric foundation for the accuracy of temporal truncation accumulation.
[0012] Preferably, when discarding high-end wandering specular highlights, the proportion of discarded high-end frames is not less than the sum of the frame duty cycle and safety margin of the specular highlight at a single surface point, ensuring that the number of discarded samples is not less than the number of specular field values at that surface point; wherein, the frame duty cycle is determined by the proportion of the circumferential width of the specular band to the observable rotation angle; the circumferential width of the specular band is determined by extracting continuous pixel regions with grayscale values exceeding a set multiple of the full-scale grayscale value from a single frame image acquired from a standard specular bottle under the same illumination conditions; the observable rotation angle is the area array image sensor capable of capturing images during the bottle's rotation. The angle range of the captured surface point is determined; the safety margin is a preset constant; and each captured frame is resampled at equal angles according to the encoder's angle, so that the angle intervals corresponding to each frame are consistent and the angle ratio is equal to the frame ratio; when the determined proportion of high-end frames to be discarded is lower than or equal to the fixed truncation ratio, the fixed truncation ratio is used as the actual discard ratio; when the determined ratio is higher than the fixed truncation ratio, the determined ratio is used as the actual discard ratio, and the calculation range of the truncation mean is correspondingly extended to the low-end to mid-range of no more than half of the total number of frames.
[0013] This invention provides a quantifiable lower bound criterion for the truncation ratio, namely, the proportion of discarded high-end frames is not less than the sum of the frame duty cycle and safety margin of specular specular highlights at a single point, ensuring that the number of discarded samples is always no less than the number of specular field values at that point. Compared with the crude approach of fixing the truncation ratio based on experience, this scheme can adaptively determine the truncation intensity according to the actual proportion of the circumferential width of the specular band to the observable corner, ensuring that the truncation mean is not broken down by wandering specular highlights even under adverse conditions such as long specular dwell time or large bottle surface curvature, and that effective samples are not lost due to excessive truncation, thus maintaining the robustness of albedo estimation under variable field conditions.
[0014] Preferably, the highlight field value is determined frame by frame using the following two parallel conditions, and a frame is marked as a highlight field value if either of them is met: the first is the absolute saturation condition, that is, the grayscale of the frame reaches full scale. The first condition is a set multiple or higher; the second is a robust outlier condition, which means that the gray level of the frame exceeds the median of all observations of the surface point. outlier multiple Median absolute deviation after scaling by multiple scaling factors The sum of the scaling coefficients makes the median absolute deviation a consistent estimate on a Gaussian scale; and the ratio of the number of valid frames that are not marked as hyperspectral values to the total number of frames is used as the albedo confidence of that point.
[0015] The method identifies highlight field values frame by frame using two parallel conditions: absolute saturation and robust outliers. It can capture saturated frames that have reached full scale, and also identify abnormal bright frames that are not yet saturated but deviate significantly from their own observation distribution by using the median and the absolute deviation of the median after scaling. Compared with the method of judging highlights by a single fixed grayscale threshold, it has stronger adaptability to bottle surfaces with different reflectivity and exposure levels, and is less likely to miss weakly saturated highlights. Furthermore, it quantifies the albedo confidence of each surface point by the proportion of effective frames, providing a point-by-point data quality metric for subsequent confidence-weighted scoring and re-examination triage.
[0016] Preferably, in step S2, when the number of valid frames for a certain surface point is lower than the minimum number of valid frames required to support robust truncated estimation... If the albedo of a surface point is deemed unreliable, it is marked as an information missing point on the saturation frequency confidence map, so that the point is directed to the re-examination channel in subsequent grading instead of being directly rejected.
[0017] In response to the extreme case where some surface points are obscured by high light for a long time and thus have too few effective observations, this invention sets a minimum effective frame threshold. When the number of effective frames is insufficient to support robust truncated estimation, the albedo judgment is no longer forcibly given. Instead, the point is marked as missing information and directed to the re-examination channel. Compared with the practice of outputting a judgment regardless of whether the data is sufficient, this avoids rashly rejecting or mistakenly releasing data when the evidence is insufficient. It allows unreliable areas of data quality to be manually reviewed, which reduces the false rejection and missed detection caused by missing information and gives the device's judgment results a clear credibility boundary.
[0018] Preferably, constructing the upper and lower thresholds in step S3 includes: […]. The pixel values are sorted in ascending order, and the above scaling factor is used. Multiply by ascending order An ordered statistic constitutes an upper threshold. The following scaling factors Multiply by ascending order The lower threshold is formed by a set of ordered statistics. The local background level is characterized by the pixel value distribution within the reference ring band; upper threshold. In ascending order Using an ordered statistic as a background benchmark, the lower threshold... In ascending order An ordered statistic serves as the background baseline; the scaling factor... A constant greater than 1, the subscale factor A constant less than 1; and The initial value is based on the scaling factor and the set false alarm probability in the constant false alarm detection theory. Number of reference units and ordered statistical serial numbers , The analytical relationship between them is determined by calculation; and the upper limit sequence number Greater than the lower threshold number .
[0019] After sorting the pixel values in ascending order within the reference ring, the ordered statistics of the higher and lower serial numbers are taken and multiplied by the corresponding scaling factors to construct the upper and lower thresholds. This allows the detection threshold to adaptively float with the local background level around the point to be inspected. Compared with the limitation of a global single threshold which cannot take into account the background of different regions, it can simultaneously set an upper threshold higher than the background and a lower threshold lower than the background near the edges of clutter such as the gradual illumination of the bottle body and the weld seam and screen printing. This allows for the one-time differentiation of positive defects such as foreign objects and bright spots with high albedo and negative defects such as scratches and missed sprays with low albedo. This significantly expands the types of detectable defects and improves the fit of the threshold to the local background.
[0020] Preferred, scaling factor With scale factor The final value is determined through the following offline calibration steps: Step T1: Obtain surface images of no less than 200 known qualified bottle group samples, and process them according to steps S1 to S2 to obtain robust albedo unfolded images of each sample. Step T2, with and As the initial value for the search, all possible combinations of scaling factors are enumerated within a range of ±20% of the initial value with a step size of 0.01. Step T3: For each combination, count the number of samples above the upper threshold in all calibrated samples. The percentage of background pixels is used as the actual false alarm rate, and those below the lower threshold are statistically analyzed. The percentage of background pixels is used as the actual false alarm rate on the lower side. Step T4: Select the actual false alarm rate and the set upper target false alarm rate. Minimize the absolute value of the difference between the actual lower-side false alarm rate and the set lower-side target false alarm rate. The combination of scaling factors with the smallest absolute value of the difference is used as... and The final value; where the false alarm rate of the upper target is set. And set the false alarm rate for lower targets The range of values is to .
[0021] Preferably, the confidence-weighted scoring method is as follows: Spatial connectivity analysis is performed on positive and negative defect candidates respectively, and isolated noise points and point-like dust pseudo-defects are eliminated based on the connectivity area, aspect ratio, and gray-level gradient morphology; For each retained connected region, the ratio of the absolute value of the difference between the albedo of each point in the region and its trigger threshold to the threshold is averaged over the region to obtain the mean value of the normalized overthreshold margin of the region, and the confidence of the albedo of each point in the region is averaged over the region to obtain the mean value of the effective frame ratio of the region, and the product of the two is taken as the confidence-weighted score of the connected region; wherein, when the trigger threshold or the ordered statistic used to construct the trigger threshold is 0, a preset lower limit constant is used to replace the 0 value as the denominator of the ratio.
[0022] This invention first performs connected component analysis on defect candidates using connected area, aspect ratio, and grayscale gradient morphology to eliminate pseudo-defects such as isolated noise and point-like dust. Then, it multiplies the mean of the normalized over-threshold margin of the region with the mean of the effective frame ratio of the region to obtain a confidence-weighted score. Compared with the method of judging defects solely based on whether a single point exceeds the limit, this scheme integrates the significance of the defect with the credibility of the data supporting the judgment into a unified score. This allows regions with high intensity but reliable evidence to receive high scores, while regions with large margins but caused by specular residue or sparse observations are automatically given lower scores. This effectively suppresses misjudgments caused by occasional noise and unreliable observations, and improves the robustness and interpretability of defect judgment.
[0023] Preferably, in step S4, the three-level classification is performed at the regional level according to the following rules: if the average proportion of effective frames in the region is... Below the credibility threshold If it is positive, it is marked as pending re-examination; otherwise, if the confidence weighted score is positive, it is marked as pending re-examination. Not lower than the high judgment threshold If the form is compliant, it is marked as a defect; if the score is below the low judgment threshold... The area between the high and low judgment thresholds is marked as pending re-inspection, and the rest is marked as background. The high judgment threshold is greater than the low judgment threshold. At the bottle group level, if any defective area exists, the bottle group is judged as defective and rejected. If there is no defective area but there is an area pending re-inspection, it is judged as pending re-inspection and transferred to manual inspection. Otherwise, it is judged as qualified.
[0024] The present invention has the following technical effects: This invention transforms the traditional single-frame detection paradigm with a global threshold into a multi-frame time-series robust accumulation paradigm. Relying on bottle rotation and sub-pixel registration, it reconstructs the grayscale time sequence of the same physical point. Through reverse truncated ordered statistical accumulation, wandering specular highlights are removed at the data level, yielding de-specified albedo and a saturation confidence map. A dual-sided adaptive constant false alarm threshold is then used to simultaneously detect both positive and negative defects. Furthermore, connected component constraints and confidence weighting are combined to achieve a three-level classification: qualified, defective, and pending re-inspection. Under real production line conditions involving continuous specular highlight interference, background gradation, and weld seam printing noise, it stably maintains a low false alarm level, reducing the false rejection rate and missed detection rate, and improving the detection accuracy and sorting reliability of online quality inspection. Attached Figure Description
[0025] Figure 1 This is a flowchart of the method for detecting appearance defects in fire extinguishing cylinder assemblies based on video images, according to the present invention.
[0026] Figure 2 This is a schematic diagram of the imaging object and main interfering factors for online detection of surface defects on bottles according to the present invention. Detailed Implementation
[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0028] In this invention, the video image-based method for detecting appearance defects in fire extinguisher cylinders is deployed in the finished product grading station at the end of the filling production line. Its hardware is structured into four layers: acquisition, processing, communication, and execution. At the acquisition layer, a CMOS area array image sensor is deployed. In this embodiment, the resolution is 2448×2048, but in practical applications, it can be configured within the range of 1.3 million to 12 million pixels depending on the bottle diameter and the smallest defect size to be inspected. The frame rate is set to 100 frames per second in this embodiment, but can be adjusted within the range of 60 to 200 frames per second to ensure that a sufficient number of frames are acquired within the observable turning angle of the station as the bottle passes through. This is complemented by a fixed-angle strip LED white light source, installed at a fixed pitch angle above the bottle, which is the source of the high-gloss band on the curved top surface; and a roller conveyor rotation fixture, which drives the bottle to randomly rotate around its own axis of rotation during its passage through the station. An incremental photoelectric encoder is coaxially mounted on the shaft of the rotating fixture. It outputs two orthogonal pulses, A and B. In this embodiment, the number of lines per revolution is 2500, which can be configured in the range of 1024 to 5000 lines. After four-fold frequency decoding, the angular resolution reaches 10000 counts per revolution. This is used to provide the bottle rotation angle at the exposure time for subsequent registration, thereby avoiding the cumulative drift of pure image estimation of the rotation angle.
[0029] At the processing layer, the system runs on an embedded vision processing unit. This unit is built on a multi-core ARM Cortex-A architecture main processor with a clock speed of 1.5 GHz in this embodiment. It is configured with an FPGA or GPU as a parallel computing coprocessor, handling intensive computations such as cylindrical back projection and point-by-point ordered statistical accumulation, and supports single-precision floating-point operations. At the communication layer, the area array image sensor sends multiple frames of grayscale video to the processing unit via a GigEVision or CameraLink interface. Orthogonal pulses from the encoder are input to the processing unit via an orthogonal counting interface. The final classification result is transmitted downstream via an industrial fieldbus. This embodiment uses an EtherCAT bus, but CAN bus or Modbus-RTU can be used in other embodiments. At the execution layer, a downstream sorting execution mechanism is set up. In this embodiment, it consists of a pneumatic pusher and a flow divider. Responding to the classification label output by the processing unit, it performs qualified release, defective rejection, or transfer to manual re-inspection of the bottle group.
[0030] like Figure 2As shown, this serves as the visual anchor point for the processing object and acquisition scene of this invention. The figure illustrates a detection scene where a curved bottle is placed on a roller conveyor and rotates with it, while an area array image sensor images its surface from above. Four types of defects to be inspected—scratches, dents, missed sprays, and pitting—are marked with lines outside the figure on the bottle surface. Four main interference factors—wandering specular highlight bands, original fish-scale texture of the circumferential weld, silkscreen printing, and gradually varying lighting gradients—are indicated by schematic symbols.
[0031] This invention discloses a method for detecting appearance defects in fire extinguishing cylinder assemblies based on video images, referring to... Figure 1 This includes the following steps: Step S1: Establish an unfolded coordinate system for the multiple surface images acquired as the bottle rotates, and register and align them point by point to reassemble them into a time-series observation sequence.
[0032] This step receives the raw data from the acquisition layer. The area array image sensor continuously acquires data as the bottle passes through the workstation and rotates with the roller conveyor. The video is a frame-by-frame grayscale video, where each pixel value is the quantized result of the integrated charge of the corresponding pixel's photodiode; simultaneously, the encoder... The exposure time of each frame gives the circumferential rotation angle of the bottle relative to the reference frame. Since the bottle is a surface of revolution with random rotation angles, the same physical surface point falls at different pixel positions in different frames. Without prior registration, it is impossible to organize multiple frames of observations into a temporal sequence for the same surface point that can be accumulated and processed later. Therefore, the core of this step is to establish a unfolded coordinate system for the bottle surface, so that the same physical surface point falls at the same unfolded coordinates in all frames, achieving sub-pixel level alignment.
[0033] First, the bottle outline and silkscreen anchor points are extracted. Considering the high contrast between the bottle and the background, the Canny operator is used to coarsely locate the two nearly vertical outline edges of the bottle on the left and right sides. Then, sub-pixel refinement is performed along the edge normal direction using the gray-scale gradient centroid method to obtain two outline curves with sub-pixel precision. The midline of the two outlines is the projection of the bottle's rotation axis onto the image plane, and the lateral distance between the two outlines is the apparent diameter of the bottle. Further, normalized cross-correlation template matching is used to locate the overall area of the silkscreen markings. Then, within this area, Shi-Tomasi corner detection is used to extract several stable feature points as anchor points. The fixed unfolded coordinates of each anchor point on the bottle surface are... The initial offline calibration determines the value once, and thereafter, as the bottle rotates, its value is determined in the second... The circumferential observation angle of the frame is .
[0034] Then, a cylindrical projection model is established and back projection is performed. This step establishes the camera coordinate system, with the rotation axis as... The bottle's reference coordinate system is defined by the axis, and the circumferential angle is defined by the axis. Axial height An coordinate system is developed on the surface of the bottle, with coordinates denoted as . The pose parameters to be determined include the radius of gyration. , by rotation matrix With translation vector Commonly represented extrinsic parameters. For any surface point in the expanded coordinate system, first, according to the first... (The sentence is incomplete and requires more context to be translated accurately). Frame rotation Applying rotation to the bottle, we obtain its position in the bottle's reference coordinate system. , and The three-dimensional coordinates are jointly determined; then mapped to the camera coordinate system via extrinsic parameter transformation; finally, according to the well-known computer vision model of pinhole imaging, the coordinates are determined by the camera intrinsic parameters. , , , Projected onto the image plane, the point on the surface is obtained at the [missing information]. The floating-point pixel coordinates of the frame are used, where lens distortion is corrected before imaging, and mapping is performed only on surface points where the angle between the surface normal and the viewing angle satisfies the visibility condition. Based on this, for each frame and each unfolded coordinate, the grayscale of the original image is bilinearly interpolated at that floating-point pixel coordinate and filled into the corresponding cell of the unfolded map, thus completing the cylindrical back-projection from the original image to the surface unfolded map. After this processing, the same physical surface point falls into the same position in the unfolded maps of all frames. Coordinates, along the frame number direction, each surface point obtains a length of The grayscale time observation sequence.
[0035] Next, we determine the pose calculation and registration accuracy criteria. (Internal parameters) , , , The distortion coefficients were calibrated offline using the Zhang checkerboard method; the radius of gyration... With external references , The parameters are obtained by minimizing the reprojection residual of the corresponding points using the contour sampling points and silkscreen anchor points through the Levonburg-Marquardt iteration, while also considering the alignment error between the contour projection and the measured contour. During calibration, a standard reference bottle is placed, and multiple frames are continuously acquired along with the encoder's known rotation angle. After extracting the contour and anchor points of each frame, the above parameters are solved. The registration accuracy is then verified using independent corresponding points. The root mean square reprojection residual of the corresponding points after calibration is required to not exceed the number of pixels corresponding to half the smallest defect size to be inspected, i.e., not exceeding half a unfolded pixel. If this is not met, resampling and recalibration are performed. The circumferential and axial sampling intervals of the unfolded image are set according to half the smallest defect size to be inspected on the bottle shoulder to ensure that the defect remains distinguishable after registration. The number of accumulated frames is... In this embodiment, 12 is selected, and it can be configured in the range of 8 to 16: its lower limit must ensure that while the specular highlight band sweeps through any point to be inspected in the sequence, at least a few frames of that point are not hit by the highlight, and its upper limit is limited by the observable turning angle range and rhythm of the bottle passing through the station in one go.
[0036] Specifically, when the encoder loses synchronization or pulses during acquisition, causing the angle increment of adjacent frames to exceed the reasonable range corresponding to the rated speed of the roller conveyor, or when the aforementioned root mean square reprojection residual exceeds half a unfolded pixel, the system determines that the current registration is unreliable and executes the following protection logic: discarding the current batch of observation sequences for the bottle, issuing a command to the roller conveyor to re-pass the bottle, and not outputting any classification label downstream until the re-registration is successful. During the execution of the protection logic, the station maintains a safe state of only acquiring data and not classifying it, until the registration accuracy criterion is met, after which it automatically resumes normal operation, thereby avoiding the contamination of subsequent accumulation by misaligned unfolded sequences.
[0037] After this step, the multi-frame observations that were originally scattered at different pixel positions in each frame are reorganized into a surface unfolding sequence that is aligned point by point to the same physical surface point and sub-pixel. Each surface point obtains a set of gray-scale time-series data equivalent to the aligned observation string along the frame number direction, which lays the registration foundation for the subsequent separation of the fixed position component and the wandering position component on the time axis.
[0038] Step S2: Apply ordered statistical robust accumulation to the multi-frame grayscale observations of each surface point to suppress wandering specular highlights and enhance fixed defects while generating saturated confidence information.
[0039] This step receives the aligned unfolded map sequence output from step S1. For each surface point, its value is taken along the time axis. In the physical landscape, real defects, due to their fixed positions, contribute a stable grayscale shift to that point in each frame. Scratches and dents show positive shifts, while missed sprays and pits show negative shifts. Specular highlights, however, move with the bottle's rotation, causing a sudden jump to full scale only in a few frames when the bottle rotates to a specific angle. For that point, these are large-amplitude, small-scale, and non-overlapping pulse-type positive outliers. While simply summing or averaging this time series is optimal for dealing with random noise, it is severely contaminated by pulse-type highlights. Therefore, this step employs ordered statistical robust accumulation, with its truncation direction set opposite to conventional radar processing.
[0040] Specifically, for each surface point After sorting the observations in ascending order, the high-end suspected highlight values are discarded, and the truncated mean value from the low-end to the middle range is used as the robust surface albedo estimate for that point. The truncated mean from the low-end to the mid-end range refers to the following: in multi-frame observations after ascending sorting, frames at the high end of the sorting are discarded with a fixed truncation ratio, and then the mean of the remaining frames whose sorting number does not exceed half of the total number of frames is taken. The truncation direction here is a key modification that distinguishes this scheme from conventional radar moving target display links: radar by default suppresses fixed-position targets and retains wandering targets, while in this scheme, fixed-position targets are precisely the real defects that need to be enhanced for detection, and wandering targets are precisely the specular highlights that need to be removed. Therefore, this step reverses the truncation direction, removing high-end wandering outliers while retaining low-end stable responses. To ensure that the truncated estimation is not broken down by outliers, the proportion of high-end frames discarded must be no less than the frame duty cycle of specular highlights on a single surface point. With safety margin The sum of, among which The circumferential width of the highlight band is determined by the proportion of the observable corner. The circumferential width of the highlight band is obtained by acquiring a single frame image of a standard mirror bottle under the same lighting conditions and extracting grayscale values exceeding full scale. of times ( The area is defined as a continuous pixel region of 0.95; the observable rotation angle is the range of rotation angles that the area array image sensor can capture of the surface point during the bottle's rotation; safety margin. The value is an empirical engineering constant between 0.05 and 0.15; in this embodiment, it is 0.1. Each acquired frame is resampled at an equal angle based on the encoder's rotation angle, ensuring that the rotation angle intervals for each frame are consistent, thus guaranteeing that the angle percentage equals the frame percentage. Based on this, the proportion of high-end frames to be discarded is determined to be 0.2 to 0.3. This proportion is the minimum discard ratio required to fully remove all highlight values. The calculation range for the truncated mean is: for the sorted... Frame observation, taking sequence numbers from 1 to... The mean is calculated from samples in the low-end to mid-range (i.e., the range from low to mid), covering approximately 50% of the frames. The minimum discard ratio for high-end frames is 0.2 to 0.3. In practice, the actual 50% of samples retained up to the mid-range are included within the remaining 70% to 80% of samples after removing specular outliers. After sorting, 20% to 30% of the high-end frames are discarded to ensure robustness. From the remaining samples, only 50% of the low-end to mid-range are used for the mean calculation to eliminate uncertainties other than low-end noise. When the determined proportion of high-end frames to be discarded is lower than or equal to the fixed truncation ratio, the fixed truncation ratio is used as the actual discard ratio. When the determined proportion is higher than the fixed truncation ratio, the determined proportion is used as the actual discard ratio, and the calculation range of the truncated mean is correspondingly expanded to the low-end to mid-range, which is no more than half the total number of frames. This lower limit for the truncation ratio originates from the breakdown point principle of robust statistics: only when the number of discarded samples is no less than the number of outliers will the estimator not be dominated by extreme values.
[0041] Furthermore, the truncated mean discards high-end frames by fixed rank, and it does not distinguish how many frames at each point are occupied by specular highlights. Therefore, this step also independently determines the specular field value for each frame observation of each surface point to generate information that can distinguish the saturation level of each point. The determination uses two parallel conditions: satisfying one of them marks the frame as a specular field value; the other is an absolute saturation condition, that is, when the grayscale of a frame reaches full scale. of It is valid when the multiple is 1 or more, among which A value of 0.95 corresponds to the saturation threshold during 8-bit quantization. The first is approximately 242 gray levels; the second is the robust outlier condition, which is that when the gray level of a frame exceeds this point... Median of observations and Median absolute deviation after double scale The sum of these values holds true, where the scaling coefficient is taken as the statistically known 1.4826, making the median absolute deviation a consistent estimate of the Gaussian scale, and the outlier multiple. Take 3. Based on this, calculate the value of each point. Frames that are judged as specular highlights And the number of valid frames not hit by specular highlights and the total number of frames. The ratio is used as the confidence level of the albedo at that point. When the number of valid frames is insufficient If the albedo is insufficient to support a robust truncated estimate, then the albedo at that point is deemed unreliable. Taking 3, equivalently using the confidence threshold equal and The ratio is used as the dividing line. The credibility of each point is determined by... The resulting graph is the saturation frequency confidence graph, which marks the regions that are almost always obscured by highlights and whose albedo is unreliable throughout all observation frames.
[0042] Specifically, when the number of effective frames for a certain surface point is less than In other words, if a point is consistently hit by wandering specular light throughout all observation frames, and its surface texture information is essentially lost in the full-well saturation dead zone of a single imaging session, the system does not forcibly assign an albedo determination to that point. Instead, it marks it as an information-deficient point on the saturation frequency confidence map, directing it to the re-examination channel in subsequent judgments instead of directly rejecting it. This protection logic is specifically designed to address the irrecoverable information situation caused by hard saturation of the image sensor, avoiding arbitrary conclusions in inherently undeterminable areas.
[0043] After this step, wandering specular pulses are moved to the higher end of the temporal sequence and discarded entirely, effectively suppressing the full-scale spurious response caused by continuous specular light on the albedo map. Simultaneously, the stable grayscale shift of fixed-position defects accumulates and becomes relatively prominent in the retained lower-end frames, effectively achieving a non-coherently accumulated signal-to-noise ratio gain. This step outputs two results: one is a robust albedo unfolded map with specular removal. The other path is the saturation frequency confidence graph. .
[0044] The robust albedo unfolded map reconstructed in this step now possesses a separable bimodal structure for the foreground and background in its grayscale histogram, thus restoring the global threshold segmentation premise that was previously disrupted by full-scale spurious spikes. However, the bottle surface still retains the original texture of the circumferential weld seam, silkscreen edges, and gradually varying lighting gradients caused by batch color differences in spraying and illumination color temperature drift. These constitute a spatially non-uniform background, and the global single threshold will still be ineffective against such cluttered edges and gradient backgrounds. Therefore, this solution goes beyond simply restoring the global threshold premise; it further replaces the decision-making process in subsequent steps.
[0045] Step S3: Construct a two-sided adaptive threshold for the robust albedo map based on the local reference background to distinguish between defect candidates with positive and negative deviations.
[0046] To ensure the decision can adapt to the non-uniform background still present in the albedo map output from step S2, this step replaces the fixed global threshold with locally adaptive ordered statistical constant false alarm rate (CFAR) detection. Furthermore, considering the coexistence of positive and negative deviations from defects, the conventional single-sided threshold of the radar is modified to a double-sided threshold. The input to this step is the robust albedo map from step S2. For each point to be inspected, a two-dimensional spatial window is arranged according to the CFAR detection structure: a guard band is set immediately adjacent to the point to be inspected to eliminate the contamination of background estimation by energy leakage from the defect itself; a reference ring band is set outside the guard band, and the pixels within the ring band are used to estimate the local background level at that point.
[0047] In terms of threshold construction, the reference ring band will be used as the reference ring band. The pixel values are sorted in ascending order, and the highest sequence number is taken. With low-end serial number Two ordered statistics at the point are used as a benchmark: with an upper scale factor greater than 1. Multiply by ascending order An ordered statistic Constitutes an upper threshold With a subscale factor less than 1 Multiply by ascending order An ordered statistic Constitute the lower threshold The local background level is characterized by the pixel value distribution within the reference ring band, with an upper threshold. In ascending order Using an ordered statistic as a background benchmark, the lower threshold... In ascending order An ordered statistic serves as the background baseline; the scaling factor... A constant greater than 1, the subscale factor A constant less than 1; and The initial value is based on the scaling factor and the set false alarm probability in the constant false alarm detection theory. Number of reference units and ordered statistical serial numbers , The analytical relationship between them is calculated and determined. During the judgment, those inspected points with albedo higher than the upper threshold are judged as positive defect candidates, corresponding to high-albedo defects such as scratches and dents; those below the lower threshold are judged as negative defect candidates, corresponding to low-albedo defects such as missed sprays and pitting; those between the two thresholds are judged as background. The grayscale offset signs and typical amplitude ranges for various defects on the robust albedo map are as follows: scratches are positive, typically 15 to 60 gray levels higher than the local background; dents are mainly positive with a highlight edge, approximately 10 to 50 gray levels; missed sprays are positive depending on the exposed substrate or negative depending on the matte finish, with an absolute offset of approximately 20 to 80 gray levels; pitting is negative, approximately 10 to 40 gray levels. The above ranges are used to set... , The initial value is obtained and converges during calibration.
[0048] The reason for choosing ordered statistics within the reference ring instead of simply averaging the cells is that weld texture and screen printing edges constitute clutter edges on the albedo map. If cell averaging is used, a few high-response reference cells will contaminate the mean, leading to a proliferation of false alarms at the edges. Ordered statistics, by sorting and eliminating a small number of anomalous cells in the reference ring, can maintain a stable background estimate even against the non-uniform background of clutter edges and multiple defects. In constant false alarm rate (CFAR) detection theory, the scaling factor and the set false alarm probability... Number of reference units There is a definite analytical relationship between the ordered statistical sequence numbers. The engineering significance of this relationship lies in defining a decision threshold that automatically scales proportionally with the local background level. This ensures that regardless of how the overall brightness of a certain section of the bottle shifts due to batch color differences or illumination drift, the threshold is always scaled based on the ordered statistics of the reference ring at that location. This clamps the false alarm rate near the set value, unlike a globally fixed threshold which is too lenient in one area and too strict in another between bright and dark areas. Considering that the background fluctuations of the albedo map do not strictly follow an ideal exponential distribution, this scheme does not directly apply the analytical relationship to the values, but instead uses it as... , The initial value is used as a reference, and the final value is determined through the following offline calibration steps.
[0049] Scale factor With scale factor The final value is determined through the following offline calibration steps: Step T1: Obtain surface images of no less than 200 known qualified bottle group samples, and process them according to steps S1 to S2 to obtain robust albedo unfolded images of each sample. Step T2, calculated using the analytical relation from step S3. and As the initial value for the search, all possible combinations of scaling factors are enumerated within a range of ±20% of the initial value with a step size of 0.01. Step T3: For each combination, count the number of samples above the upper threshold in all calibrated samples. The percentage of background pixels is used as the actual false alarm rate, and those below the lower threshold are statistically analyzed. The percentage of background pixels is used as the actual false alarm rate on the lower side. Step T4: Select the actual false alarm rate and the set upper target false alarm rate. Minimize the absolute value of the difference between the actual lower-side false alarm rate and the set lower-side target false alarm rate. The combination of scaling factors with the smallest absolute value of the difference is used as... and The final value; where the false alarm rate of the upper target is set. And set the false alarm rate for lower targets All to .
[0050] In the project Take numbers 16 to 32, and specify the door-to-door access limit. Take contract Lower threshold number Take contract .
[0051] Through field testing and verification using a batch of calibration samples containing all defect types, including scratches, pits, missed sprays, and pinholes, the aforementioned bilateral decision-making method can stably trigger beyond the threshold for both positive high-albedo defects and negative low-albedo defects, covering all defect types listed in the background technology and compensating for the inherent limitation of single-sided thresholds, which can only detect one sign deviation. After this step, the fixed global threshold is replaced by a bilateral threshold that adaptively scales with the local background, ensuring that the decision-making method maintains a stable false alarm level even in cluttered edges and gradient backgrounds such as weld seams and silkscreen printing. This step outputs binary candidate maps that distinguish between positive and negative defects, as well as the detection margin of each candidate point relative to its trigger threshold.
[0052] Step S4: Apply spatial connectivity constraints and saturation confidence weights to the defect candidates and output the three-level classification results accordingly.
[0053] Step S4 receives the candidate binary map and detection margin from step S3, and the saturation frequency confidence map from step S2. It then performs spatial constraints and confidence fusion on the previous point-by-point decision results to form the final classification. Although point-by-point decision distinguishes between positive and negative deviations, the results may still include pseudo-defects such as isolated noise points and point-like dust particles, and it does not take into account the reliability of the albedo of each candidate point itself. Directly disqualifying based on this would introduce erroneous disqualifications. Therefore, this step first performs spatial connectivity constraints, and then performs saturation confidence weighted scoring.
[0054] First, spatial connectivity analysis is performed on both positive and negative candidate points, based on the connectivity area. The aspect ratio and grayscale gradient morphology are used to eliminate isolated noise points and point-like dust pseudo-defects, retaining connected regions with typical morphologies such as scratches, dents, and missed sprays, thus fulfilling the requirement of using spatial connectivity information to constrain the decision. Furthermore, two region-level metrics are calculated for each connected region and a composite score is generated: one is the mean of the region-normalized over-threshold margin. The albedo of each point in the region and its trigger threshold The ratio of the absolute value of the difference to the threshold is averaged over the region, representing the relative intensity of the deviation from the background in that region. Calculate the ratio for each pixel. ,in This is the albedo of the pixel. The trigger threshold (upper threshold) corresponding to this pixel. or lower threshold );when At that time, using a preset lower limit constant Replace 0 with the denominator, that is , One empirical value of one gray level is used to ensure that the ratio can still be calculated in low grayscale areas such as dark silkscreen, black background, or areas with severe ink leakage; the second is the average proportion of effective frames in the region. The reliability of albedo at each point within the region The average value over the region is used to characterize the overall reliability of the albedo in that region; confidence-weighted score. The product of the two factors is used to give high scores to areas with high intensity and high credibility, while areas where the main subject is obscured by highlights and lacks information, even with a large margin, are suppressed in score due to low credibility.
[0055] Based on this, a three-level judgment is performed. At the regional level, if the proportion of effective frames in the region... Below the credibility threshold If the area is obscured by highlights and albedo information is essentially missing, then regardless of the margin, it should be marked as pending re-inspection and not directly rejected; otherwise, if the confidence-weighted score is used... Not lower than the high judgment threshold If the form is compliant, it is marked as a defect; otherwise, if the score is below the low judgment threshold... With high judgment threshold Between these points, samples representing weak response boundaries are marked as samples to be re-examined; the rest are considered background.
[0056] At the bottle group level, if any defective area exists, the bottle group is judged as defective and rejected; if there is no defective area but there is an area to be re-inspected, the bottle group is judged as needing re-inspection and transferred to manual inspection; otherwise, it is judged as qualified.
[0057] The above thresholds are determined by calibration samples. A batch of known qualified and known defective bottles are taken, and scores for the two types of samples are plotted. Based on the empirical distribution, the engineering confidence threshold is taken. The value is 0.3, which is a high threshold. The scores of qualified samples were taken from the approximately 99.9th percentile, which is a low threshold for judgment. By taking approximately the 99th percentile, a compromise is reached between the false negative rate and the false negative rate.
[0058] Specifically, when the industrial fieldbus issues a classification tag to the downstream sorting actuator and fails to receive an action acknowledgment from the actuator within the rated response time limit (i.e., the execution response timeout is determined), the system executes the following protection logic: The classification status of the bottle group is set to "pending re-inspection," and its defect coordinates are temporarily stored. Simultaneously, an instruction to stop releasing subsequent bottle groups is issued to the workstation. During the execution of the protection logic, the roller conveyor maintains a safe state of suspended feeding until the actuator's acknowledgment returns to normal, automatically resuming operation. This prevents defective bottle groups that should be rejected from mistakenly entering the qualified flow due to execution failure. Finally, this step maps the defective connected region in the surface unfolded coordinate system back to the physical coordinates of the bottle body, outputting three types of tags: qualified, defective, and pending re-inspection, along with the defect coordinates. These are then sent to the downstream sorting actuator via the industrial fieldbus to complete the finished product classification.
[0059] In another embodiment of the present invention, the execution methods of steps S1 and S2 are the same as those in the core embodiment described above, except for the decision mechanism in step three. It should be noted that when the area to be inspected is located in the curvature transition zone between the bottle shoulder and the bottle body, or adjacent to the circumferential weld, the reference ring is very likely to cross the clutter edge of abrupt changes in background statistical characteristics, causing the ordered statistical background estimate of the entire ring to be mixed into heterogeneous regions and distorted. Therefore, this embodiment no longer uniformly uses a single ordered statistical quantity to construct a threshold for the complete reference ring. Instead, it divides the reference ring along the circumferential direction into a leading sub-ring and a lagging sub-ring. Pixels within each sub-ring are arranged in ascending order, and their ordered statistical quantities are taken to obtain two local background estimates. Subsequently, the larger and smaller logic from constant false alarm rate (CFAR) detection is introduced. When constructing the upper threshold, the larger of the two local background estimates is taken as the benchmark; when constructing the lower threshold, the smaller of the two is taken as the benchmark. In this way, when one side of the reference ring falls into a high-response heterogeneous region such as a weld or screen printing, a larger logic threshold is used to suppress false alarms at the edge by using the higher background value on one side, while a smaller logic threshold is used to prevent the lower threshold from being raised by the heterogeneous high response, thus maintaining sensitivity to negative defects. This embodiment is more suitable for the transition region of the bottle shoulder with dense welds and sharp curvature changes. Under such conditions of strong clutter edges, compared with the core embodiment's method of uniformly using ordered statistics across the entire ring, it can further reduce the generation of false alarms at the edge without sacrificing the ability to detect both positive and negative defects.
[0060] In another implementation, it is also possible to avoid cleaning all bottles after each station visit. Instead of accumulating all data at once after frame acquisition, the system now recursively updates the ordered statistics of each surface point as frames arrive. That is, after each received frame and the registration unfolded graph, the observation set of the relevant surface points is inserted and rearranged, and this process continues until the cumulative number of valid frames reaches a certain threshold. A preliminary albedo estimate can then be provided, and the final estimate is output after the sequence is filled. This implementation, which changes batch processing to online recursion, has a latency advantage in scenarios with extremely tight production line cycles and the requirement to collect data and determine levels simultaneously to shorten station dwell time.
[0061] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A method for detecting appearance defects in fire extinguishing cylinder assemblies based on video images, characterized in that, include: Step S1: The area array image sensor continuously acquires multiple frames of surface images during the bottle's rotation. Based on the circumferential rotation angles given by the encoder for each frame, a coordinate system for the unfolded surface of the bottle is established and sub-pixel registration and alignment are performed point by point. The images are then reassembled into a grayscale time-series observation sequence for the same physical surface point. Step S2: Arrange the multi-frame observations of each surface point in ascending order, discard the high-end wandering specular values, and take the truncated mean value from the low end to the middle as the robust surface albedo estimate for that point. Then, determine the specular field value frame by frame and count the number of valid frames to generate a robust albedo unfolding map and a saturation frequency confidence map reflecting the reliability of the albedo. The method for taking the truncated mean value from the low end to the middle is as follows: In the multi-frame observations after ascending order, discard the frames at the high end of the sorting with a fixed truncation ratio, and then take the mean value of the frames whose sorting number does not exceed half of the total number of frames in the remaining frames. Step S3: For the robust albedo unfolded graph, a protective zone and a reference ring are arranged around the point to be inspected using local ordered statistics constant false alarm detection. The upper and lower thresholds are constructed from the ordered statistics within the reference ring. Albedo values higher than the upper threshold are judged as positive defect candidates, and those lower than the lower threshold are judged as negative defect candidates. Step S4: Apply spatial connectivity constraints to defect candidates to eliminate false defects, combine the saturation frequency confidence map to give confidence weighted scores to the connected regions, and output three levels of judgment: qualified, defective, and pending re-inspection, and back-map back to the physical coordinates of the bottle.
2. The method for detecting appearance defects of fire extinguishing cylinder assemblies based on video images according to claim 1, characterized in that, Before establishing the bottle surface unfolding coordinate system, the process also includes extracting the bottle outline and silkscreen anchor points: the Canny operator is used to coarsely locate the two nearly vertical outline edges on the left and right sides of the bottle, and then the gray-scale gradient centroid method is used to refine the sub-pixel along the edge normal direction to obtain two outline curves. The midline of the two outlines is used as the projection of the bottle rotation axis onto the image plane. The silkscreen mark is located in the whole area by normalized cross-correlation template matching, and then the feature points are extracted in this area by Shi-Tomasi corner detection as anchor points. The fixed unfolding coordinates of each anchor point on the bottle surface are determined by the offline calibration of the first piece, and its circumferential observation angle in each frame is the sum of the fixed circumferential angle and the circumferential rotation angle of the anchor point.
3. The method for detecting appearance defects of fire extinguishing cylinder assemblies based on video images according to claim 2, characterized in that, The point-to-point sub-pixel registration and alignment includes: establishing a camera coordinate system; a bottle reference coordinate system with the rotation axis as the coordinate axis and an unfolded coordinate system with the circumferential angle and axial height as coordinates; for any surface point in the unfolded coordinate system, first apply the bottle rotation according to the circumferential angle of the frame to obtain its three-dimensional coordinates in the reference coordinate system, then map it to the camera coordinate system through extrinsic parameter transformation, and finally project it to the image plane from the camera intrinsic parameters according to the pinhole imaging model to obtain floating-point pixel coordinates, and only perform mapping on surface points where the angle between the surface normal and the line of sight meets the visibility condition; at the floating-point pixel coordinates, perform bilinear interpolation sampling on the grayscale of the original image after distortion correction and fill it into the corresponding cell of the unfolded image.
4. The method for detecting appearance defects of fire extinguishing cylinder assemblies based on video images according to claim 1, characterized in that, When discarding high-end wandering specular highlights, the proportion of high-end frames discarded is no less than the sum of the frame duty cycle and safety margin of the specular highlight at a single surface point, ensuring that the number of discarded samples is no less than the number of specular field values at that surface point. The frame duty cycle is determined by the ratio of the circumferential width of the specular band to the observable rotation angle. The circumferential width of the specular band is determined by extracting continuous pixel regions with grayscale values exceeding a set multiple of the full-scale grayscale value from a single-frame image of a standard specular bottle under the same illumination conditions. The observable rotation angle is the area array image sensor capable of capturing images during the bottle's rotation. The rotation angle range of the surface point; the safety margin is a preset constant; and each acquisition frame is resampled at equal angles according to the encoder's rotation angle, so that the rotation angle intervals corresponding to each frame are consistent and the angle ratio is equal to the frame ratio; when the determined proportion of high-end frames to be discarded is lower than or equal to the fixed truncation ratio, the fixed truncation ratio is used as the actual discard ratio; when the determined ratio is higher than the fixed truncation ratio, the determined ratio is used as the actual discard ratio, and the calculation range of the truncation mean is extended accordingly to the low-end to mid-range of no more than half of the total number of frames.
5. The method for detecting appearance defects of fire extinguishing cylinder assemblies based on video images according to claim 1, characterized in that, The highlight field value is determined frame by frame using the following two parallel conditions. A frame is marked as having a highlight field value if either of the following conditions is met: The first condition is absolute saturation, that is, the grayscale of the frame reaches full scale. The first condition is a set multiple or higher; the second is a robust outlier condition, which means that the gray level of the frame exceeds the median of all observations of the surface point. outlier multiple Median absolute deviation after scaling by multiple scaling factors The sum of the scaling coefficients makes the median absolute deviation a consistent estimate on a Gaussian scale; and the ratio of the number of valid frames that are not marked as hyperspectral values to the total number of frames is used as the albedo confidence of that point.
6. The method for detecting appearance defects of fire extinguishing cylinder assemblies based on video images according to claim 5, characterized in that, In step S2, when the number of valid frames for a certain surface point is lower than the minimum number of valid frames required for robust truncated estimation... If the albedo of a surface point is deemed unreliable, it is marked as an information missing point on the saturation frequency confidence map, so that the point is directed to the re-examination channel in subsequent grading instead of being directly rejected.
7. The method for detecting appearance defects of fire extinguishing cylinder assemblies based on video images according to claim 1, characterized in that, Step S3, constructing the upper and lower thresholds, includes: […]. The pixel values are sorted in ascending order, and the above scaling factor is used. Multiply by ascending order An ordered statistic constitutes an upper threshold. The following scaling factors Multiply by ascending order The lower threshold is formed by a set of ordered statistics. The local background level is characterized by the pixel value distribution within the reference ring band; upper threshold. In ascending order Using an ordered statistic as a background benchmark, the lower threshold... In ascending order An ordered statistic serves as the background baseline; the scaling factor... A constant greater than 1, the subscale factor A constant less than 1; and The initial value is based on the scaling factor and the set false alarm probability in the constant false alarm detection theory. Number of reference units and ordered statistical serial numbers , The analytical relationship between them is determined by calculation; and the upper limit sequence number Greater than the lower threshold number .
8. The method for detecting appearance defects of fire extinguishing cylinder assemblies based on video images according to claim 7, characterized in that, Scale factor With scale factor The final value is determined through the following offline calibration steps: Step T1: Obtain surface images of no less than 200 known qualified bottle group samples, and process them according to steps S1 to S2 to obtain robust albedo unfolded images of each sample. Step T2, with and As the initial value for the search, all possible combinations of scaling factors are enumerated within a range of ±20% of the initial value with a step size of 0.
01. Step T3: For each combination, count the number of samples above the upper threshold in all calibrated samples. The percentage of background pixels is used as the actual false alarm rate, and those below the lower threshold are statistically analyzed. The percentage of background pixels is used as the actual false alarm rate on the lower side. Step T4: Select the actual false alarm rate and the set upper target false alarm rate. Minimize the absolute value of the difference between the actual lower-side false alarm rate and the set lower-side target false alarm rate. The combination of scaling factors with the smallest absolute value of the difference is used as... and The final value; where the false alarm rate of the upper target is set. And set the false alarm rate for lower targets The range of values is to .
9. The method for detecting appearance defects of fire extinguishing cylinder assemblies based on video images according to claim 1, characterized in that, The confidence-weighted scoring method is as follows: spatial connectivity analysis is performed on positive and negative defect candidates respectively, and isolated noise points and point-like dust pseudo-defects are eliminated based on connectivity area, aspect ratio and gray-level gradient morphology. For each retained connected region, the ratio of the absolute value of the difference between the albedo of each point in the region and its trigger threshold to that threshold is averaged over the region to obtain the mean normalized overthreshold margin of the region. The albedo confidence of each point in the region is averaged over the region to obtain the mean effective frame ratio of the region. The product of the two is taken as the confidence-weighted score of the connected region. When the trigger threshold or the ordered statistic used to construct the trigger threshold is 0, a preset lower limit constant is used to replace 0 as the denominator of the ratio.
10. The method for detecting appearance defects of fire extinguishing cylinder assemblies based on video images according to claim 9, characterized in that, In step S4, the three-level classification is performed at the regional level according to the following rules: if the average proportion of effective frames in the region is... Below the credibility threshold If it is positive, it is marked as pending re-examination; otherwise, if the confidence weighted score is positive, it is marked as pending re-examination. Not lower than the high judgment threshold If the form is compliant, it is marked as a defect; if the score is below the low judgment threshold... The area between the high and low judgment thresholds is marked as pending re-inspection, and the rest is marked as background. The high judgment threshold is greater than the low judgment threshold. At the bottle group level, if any defective area exists, the bottle group is judged as defective and rejected. If there is no defective area but there is an area pending re-inspection, it is judged as pending re-inspection and transferred to manual inspection. Otherwise, it is judged as qualified.
Citation Information
Patent Citations
Visual inspection and grading evaluation method for product bulge defects
CN121998977A
Dot trace filtering technique based on connected domain area measurement of binary image
CN109375185A
Gas cylinder inner surface defect detection method
CN120510138A