Image processing methods for e-commerce scenarios based on machine learning

By constructing a polar coordinate system and pixel resampling, combined with enhancement and skeletonization processing, the problem of incomplete positioning of the connection between bottle caps and tamper-evident safety rings in e-commerce product images was solved, achieving accurate and intuitive annotation and visualization, and improving the efficiency and consistency of quality inspection and after-sales evidence collection.

CN122090458APending Publication Date: 2026-05-26SHANGHAI SHIJIE TECHNOLOGY GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI SHIJIE TECHNOLOGY GROUP CO LTD
Filing Date
2026-02-14
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing technologies struggle to stably and accurately locate and intuitively label the connection between bottle caps and tamper-evident safety rings in e-commerce product images, resulting in incomplete positioning, inconsistent labeling ranges, or unintuitive results. This affects the efficiency and consistency of judgments in quality inspection and after-sales dispute scenarios.

Method used

A machine learning-based approach is used to construct a polar coordinate system for pixel resampling of local images to obtain an annular unfolded image. Through enhancement and skeletonization processing, the number of neighborhood skeleton pixels is determined, and the candidate bridge enhancement images are binary labeled to construct the residual bridge calibration region, finally generating the updated output image.

Benefits of technology

It achieves a complete and accurate representation of the connection between the bottle cap and the tamper-evident safety ring, improving the accuracy and consistency of the connection area positioning results. This makes the calibration results intuitive, uniform, and easy to identify in the output image, making it suitable for in-warehouse quality inspection and after-sales evidence collection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122090458A_ABST
    Figure CN122090458A_ABST
Patent Text Reader

Abstract

This invention discloses a machine learning-based image processing method for e-commerce scenarios, relating to the field of image processing technology. The method includes: constructing a polar coordinate system based on the original image of the e-commerce product, and performing pixel resampling on a local image of the e-commerce product based on the polar coordinate system to obtain an expanded annular image; obtaining candidate bridge enhancement images based on the expanded annular image; determining the number of neighboring skeleton pixels based on the candidate bridge enhancement images, and performing binary labeling on the skeleton images corresponding to the candidate bridge enhancement images to obtain a residual bridge topology image; obtaining a point set based on the residual bridge topology image, and constructing a residual bridge calibration region based on the point set. This invention improves the accuracy of the connection region localization results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an image processing method for e-commerce scenarios based on machine learning. Background Technology

[0002] As e-commerce platforms continue to expand the online circulation of bottled goods such as beverages, condiments, and daily chemicals, the demand for image-based retention and rapid verification of the appearance of goods is becoming increasingly prominent in various processes such as in-warehouse sampling, incoming quality inspection, outgoing verification, and after-sales dispute handling. Among these, the tamper-evident safety ring under the bottle cap and the connection between it and the bottle cap are common areas of focus for verification.

[0003] In practical applications, images are typically acquired by industrial cameras or mobile cameras in warehouse environments. Shooting angles, perspective, occlusion, and surface reflections can cause the structure around the bottle opening to appear as a ring-shaped distribution around the center of the bottle opening in the image. The connecting parts are scattered and small along the circumference, making it difficult to observe and represent them as a whole from a single perspective. Therefore, related methods often require first extracting a local image containing the bottle cap and tamper-evident ring from the original image, and then organizing and expanding the local image around the center of the bottle opening to convert the originally ring-shaped information into a strip-shaped image that is easy to analyze, thereby supporting subsequent area positioning and labeling output. The core technical problem that existing technologies need to solve is how to stably and accurately locate and intuitively label the slender structure that still maintains the connection between the bottle cap and the tamper-evident ring in e-commerce product images, so that the labeling results can be directly used for quality inspection verification and after-sales evidence collection.

[0004] Existing technologies typically rely on direct observation of local areas or simple edge extraction, local enhancement, and region cropping in the original image when dealing with this problem. However, because the connecting parts are scattered along the circumference and are significantly affected by shooting angles and occlusions in different directions, and because the slender connecting structures are easily mixed with textures, reflections, and noise in the image, the above processing methods are prone to defects such as incomplete positioning, inconsistent annotation ranges, or unintuitive results. It is difficult to achieve the overall expression of the connecting parts, subsequent region construction, and visual labeling of the output image under the same process, thus affecting the efficiency and consistency of judgment in warehouse sampling and after-sales dispute scenarios. Summary of the Invention

[0005] The purpose of this invention is to address the shortcomings of existing technologies, such as incomplete positioning, inconsistent annotation ranges, or unintuitive results, and to propose a machine learning-based image processing method for e-commerce scenarios.

[0006] To address the problems existing in the prior art, the present invention adopts the following technical solution: Image processing methods for e-commerce scenarios based on machine learning include: A polar coordinate system is constructed based on the original images of e-commerce products, and pixel resampling is performed on local images of e-commerce products based on the polar coordinate system to obtain the annular unfolded image. Based on the annular unfolded image, candidate bridge enhancement images are obtained; The number of neighborhood skeleton pixels is determined based on the candidate bridge enhancement image, and the skeleton image corresponding to the candidate bridge enhancement image is binary labeled to obtain the residual bridge topology image. A point set is obtained based on the topological image of the broken bridge, and a calibration region for the broken bridge is constructed based on the point set; Determine the target pixel coordinates of the calibration area of ​​the damaged bridge, and generate an updated output image based on the target pixel coordinates.

[0007] Preferably, the specific steps for constructing a polar coordinate system are as follows: Obtain the original images of e-commerce products; Extract a partial image from the original image, including the bottle cap and the tamper-evident safety ring; Determine the center coordinates of the bottle opening in a local image; A polar coordinate system is constructed on the local image based on the center coordinates of the bottle opening.

[0008] Preferably, the specific steps for obtaining the annular unfolded image are as follows: In the polar coordinate system, determine the polar radius parameter and polar angle parameter of each pixel in the local image; Map the polar coordinate radius parameter to vertical coordinates; Map the polar coordinate angle parameters to horizontal coordinates; Construct a target pixel coordinate system based on vertical and horizontal coordinates; Based on the target pixel coordinate system, pixel resampling is performed on the local image to obtain the annular unfolded image.

[0009] Preferably, the specific steps for obtaining the candidate bridge enhancement image are as follows: In the unfolded image of the annulus, determine the first and second values ​​of the vertical coordinates; A narrowband image is constructed based on the first and second values; The narrowband image is subjected to differential processing to obtain a differential image; The absolute value of the difference image is taken to obtain the candidate bridge enhancement image.

[0010] Preferably, the specific steps for determining the number of neighboring skeleton pixels are as follows: The candidate bridge enhancement images are normalized to obtain normalized images; The normalized image is thinned to obtain the skeleton image; Determine the set of neighboring pixels of the skeleton pixels in the skeleton image; Based on the set of neighboring pixels, determine the number of neighboring skeleton pixels for each skeleton pixel.

[0011] Preferably, the specific steps for obtaining the topological image of the broken bridge are as follows: The skeleton image is divided into connected components to obtain the skeleton curve; Based on the number of neighboring skeleton pixels, skeleton pixels on the same skeleton curve are compared to obtain beaded skeleton pixels. Skeleton pixels in the skeleton image that are connected to bead-shaped skeleton pixels and are continuously distributed in the vertical direction are defined as residual bridge skeleton pixels; Based on the skeleton pixels of the broken bridge, the skeleton image is binary-labeled to obtain the topological image of the broken bridge.

[0012] Preferably, the point set obtained based on the topological image of the remaining bridge includes: The topological image of the broken bridge is divided into connected regions to obtain multiple connected regions. Obtain the radius and angle mapping relationships of the unfolded annular image; Based on the center coordinates of the bottle opening, the radius mapping relationship, and the angle mapping relationship, the original image coordinates corresponding to each residual bridge skeleton pixel in the connected region are determined; The original image coordinates corresponding to the residual bridge skeleton pixels in the connected region are aggregated to obtain a point set.

[0013] Preferably, the residual bridge calibration area is constructed based on a point set, including: Determine the minimum, maximum, minimum, and maximum values ​​of the horizontal and vertical coordinates of the point set. Based on the minimum and maximum horizontal coordinates, minimum and maximum vertical coordinates of the point set, a calibration area for the damaged bridge is constructed.

[0014] Preferably, determining the target pixel coordinates of the bridge scaffolding area includes: Construct the output image based on the original image; In the output image, determine the coordinates of the target pixels belonging to the calibration area of ​​the broken bridge.

[0015] Preferably, generating the updated output image based on the target pixel coordinates includes: Set the marker color vector for the output image; Set the blending coefficients for the output image; The first intermediate pixel value is obtained by multiplying the blending coefficient and the pixel value of the target pixel coordinates. Subtract the mixing coefficient from 1 to obtain the remaining coefficient; Multiply the remaining coefficients and the marked color vector to obtain the second intermediate pixel value; The updated pixel value is obtained by adding the first intermediate pixel value and the second intermediate pixel value. An updated output image is generated based on the updated pixel values.

[0016] Compared with the prior art, the beneficial effects of the present invention are: 1. This invention transforms the ring-shaped connecting areas around the bottle opening in e-commerce products into a linearly expandable ring image. This allows the bottle cap and tamper-evident safety ring connection parts, which were originally scattered in different locations and greatly affected by shooting angles and occlusions, to be fully presented in a unified spatial representation. Furthermore, it gradually enhances, refines, and extracts the connection paths, thereby stably restoring the continuous distribution of the connection structure in the overall space. This avoids the problem of information loss or expression breaks caused by inconsistent perspectives when analyzing directly in the original image.

[0017] 2. This invention performs skeletonization, connectivity partitioning, and neighborhood relationship analysis on the enhanced connection region, and filters and determines the set of pixels that truly reflect the connection between the bottle cap and the tamper-evident safety ring. Furthermore, it maps this set back to the original image space to construct a calibration region. This ensures that the calibration result is based on the overall continuity of the connection structure and can accurately cover its actual distribution range in the original image. This overcomes the problem of unstable and inconsistent calibration range caused by relying only on local edges or local brightness changes in the prior art, and improves the accuracy and consistency of the connection region positioning results.

[0018] 3. When generating the output image, this invention displays the calibrated area by color overlay while maintaining the continuity and recognizability of the original image content. This allows the connected area to be presented in the output image in an intuitive, unified, and easily identifiable manner. It can be directly used in business scenarios such as warehouse quality inspection, verification, and after-sales evidence collection, and can also be retained and transmitted as visual evidence. Attached Figure Description

[0019] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings: Figure 1 This is a flowchart illustrating a machine learning-based image processing method for e-commerce scenarios, as provided in an embodiment of the present invention. Detailed Implementation

[0020] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0021] This embodiment provides a machine learning-based image processing method for e-commerce scenarios. See [link / reference]. Figure 1 Specifically, including: S1. Construct a polar coordinate system based on the original image of the e-commerce product, and perform pixel resampling on the local image of the e-commerce product based on the polar coordinate system to obtain the annular unfolded image. In an embodiment of the present invention, the specific steps for constructing a polar coordinate system are as follows: Obtain the original images of e-commerce products; The original image of an e-commerce product refers to the overall image data of the product acquired through a shooting device and stored in digital form. This image truly reflects the appearance and spatial distribution of the product at the time of shooting.

[0022] The e-commerce products to be processed are photographed by an image acquisition device. The image acquisition device can be an industrial camera fixed in the warehouse environment or a mobile terminal camera used for product photography. During the shooting process, the e-commerce products are placed within the imaging range of the image acquisition device. The imaging component of the image acquisition device converts the optical information of the product surface into electrical signals. Then, the image processing unit inside the image acquisition device converts the electrical signals into digital image data and stores them, thereby forming the original image of the e-commerce products.

[0023] Extract a partial image from the original image, including the bottle cap and the tamper-evident safety ring; A local image refers to an image region containing the bottle cap and tamper-evident safety ring that is cropped from the original image. This region spatially covers the bottle mouth structure and the tamper-evident connection below it, and is used for subsequent analysis and processing of the bottle cap-related structure.

[0024] The original images of e-commerce products are read and analyzed to determine the overall outline and structural distribution of the products. The location range of the upper part of the bottle is determined in the original image, and the area where the bottle opening is located is further located within this range. Then, the image content is cropped upward and downward with the area where the bottle opening is located as the center, so that the cropped image area covers both the bottle cap and the tamper-evident safety ring located below the bottle cap. This separates the local image from the original image for subsequent processing. The local image retains the relative spatial relationship between the bottle cap and the tamper-evident safety ring in the original image.

[0025] Determine the center coordinates of the bottle opening in a local image; The center coordinates of the bottle opening refer to the pixel coordinates in a local image that represent the geometric center of the circular or near-circular structure of the bottle opening. These coordinates are used to uniformly describe the relative positional relationships of points around the bottle opening.

[0026] The captured local image containing the bottle cap and tamper-evident safety ring is converted to grayscale, reducing the complexity of image data processing. Then, a Gaussian filter is applied to the grayscale image to filter out random noise and improve the clarity of the circular structure edge of the bottle opening. Next, an edge detection algorithm is used to extract edges from the filtered grayscale image, identifying the edge pixels of the circular structure corresponding to the bottle opening in the local image. All identified bottle opening edge pixels are aggregated to obtain a set of bottle opening edge pixels. A circle fitting algorithm is then used to geometrically fit this set of bottle opening edge pixels, calculating the x-coordinate and y-coordinate of the pixel corresponding to the geometric center of the fitted circle. The pixel coordinates formed by these x-coordinate and y-coordinate are the center coordinates of the bottle opening in the local image.

[0027] A polar coordinate system is constructed on the local image based on the center coordinates of the bottle opening.

[0028] Polar coordinates refers to a coordinate representation method that uses the center coordinates of the bottle opening as the reference origin. Under this coordinate representation method, any position in a local image can be described by the distance to the center of the bottle opening and the direction around the center of the bottle opening, which facilitates the unified representation and processing of image information distributed in a ring around the bottle opening.

[0029] The center coordinates of the bottle opening in the determined local image are set as the origin of the polar coordinate system. The horizontal rightward direction of the local image is taken as the positive polar axis of the polar coordinate system. The pixel scale of the local image is used as the length measurement benchmark of the polar coordinate system. For each pixel in the local image, the straight-line distance from the pixel to the origin is calculated as the polar radius parameter, and the angle between the line connecting the pixel to the origin and the positive polar axis is calculated as the polar angle parameter. The polar radius parameter and the polar angle parameter together constitute the polar coordinate representation of all pixels in the local image. This completes the construction of the polar coordinate system based on the center coordinates of the bottle opening on the local image, so that any pixel in the local image can be uniquely described by the corresponding polar radius parameter and polar angle parameter. This enables the unified representation and subsequent processing of image information distributed in a ring around the bottle opening in polar coordinate form.

[0030] In an embodiment of the present invention, the specific steps for obtaining the unfolded image of the annulus are as follows: In the polar coordinate system, determine the polar radius parameter and polar angle parameter of each pixel in the local image; The polar coordinate radius parameter refers to the parameter used in polar coordinate representation, which uses the center of the bottle opening as the reference origin, to describe the distance between a pixel in a local image and the center of the bottle opening. This parameter reflects the positional relationship of the pixel relative to the center of the bottle opening in the radial direction. The polar coordinate angle parameter refers to the parameter used in polar coordinate representation to describe the position of the pixel relative to a predetermined reference direction around the center of the bottle opening. This parameter reflects the positional relationship of the pixel in the circumferential direction around the center of the bottle opening. By combining the polar coordinate radius parameter and the polar coordinate angle parameter, the spatial position of any pixel in the local image relative to the center of the bottle opening can be uniquely determined.

[0031] First, the pixel coordinates of each pixel in the local image are read, and the coordinates of the determined bottle neck center are used as the reference origin of the polar coordinate system. Then, for each pixel in the local image, the displacement of the pixel relative to the bottle neck center in the horizontal and vertical directions is calculated. Based on the displacement, the straight-line distance from the pixel to the bottle neck center is determined, and this straight-line distance is used as the polar coordinate radius parameter corresponding to the pixel. At the same time, according to the relative directional relationship between the pixel and the bottle neck center, the directional position of the pixel around the bottle neck center is determined, and the directional position is represented as a polar coordinate angle parameter. Thus, each pixel in the local image obtains a set of polar coordinate radius parameters and polar coordinate angle parameters to describe the spatial position of the pixel relative to the bottle neck center.

[0032] Map the polar coordinate radius parameter to vertical coordinates; Read the polar coordinate radius parameter corresponding to each pixel in the local image, summarize the polar coordinate radius parameters of all pixels and find the minimum and maximum values ​​of the polar coordinate radius parameters, establish a linear mapping relationship from the polar coordinate radius parameter to the vertical coordinate, so that the minimum value of the polar coordinate radius parameter corresponds to the starting value of the vertical coordinate, and the maximum value of the polar coordinate radius parameter corresponds to the ending value of the vertical coordinate. For any pixel, substitute the polar coordinate radius parameter of the pixel into the linear mapping relationship to calculate the vertical coordinate of the pixel, thereby obtaining a unique corresponding vertical coordinate for each pixel in the local image, and ensuring that the magnitude relationship of the polar coordinate radius parameters of any two pixels remains consistent in the vertical coordinate.

[0033] Map the polar coordinate angle parameters to horizontal coordinates; The polar coordinate angle parameters corresponding to each pixel in the local image are read. The polar coordinate angle parameters of all pixels are summarized, and the minimum and maximum values ​​of the polar coordinate angle parameters are obtained. A linear mapping relationship between the polar coordinate angle parameters and the horizontal coordinates is established, so that the minimum value of the polar coordinate angle parameter corresponds to the starting value of the horizontal coordinate, and the maximum value of the polar coordinate angle parameter corresponds to the ending value of the horizontal coordinate. For any pixel, the polar coordinate angle parameter of the pixel is substituted into the linear mapping relationship to calculate the horizontal coordinate of the pixel. In this way, each pixel in the local image obtains a unique corresponding horizontal coordinate, and the magnitude relationship of the polar coordinate angle parameters of any two pixels remains consistent in the horizontal coordinate.

[0034] The vertical coordinates refer to the pixel coordinate components converted from the polar coordinate radius parameter, which are used to represent the unfolded position of the pixel along the radial direction of the bottle opening; the horizontal coordinates refer to the pixel coordinate components converted from the polar coordinate angle parameter, which are used to represent the unfolded position of the pixel along the circumferential direction of the bottle opening.

[0035] Construct a target pixel coordinate system based on vertical and horizontal coordinates; The target pixel coordinate system refers to a two-dimensional pixel coordinate system established based on vertical and horizontal coordinates. This coordinate system is used to reorganize the spatial distribution of pixels in a local image.

[0036] The polar radius parameter corresponding to each pixel in the local image is read, and the value rules of the vertical coordinate axis are established in the target image plane. The vertical coordinate is used to represent the distance of the pixel from the center of the bottle opening. Then, the size relationship of the polar radius parameter is used as the basis for the arrangement of pixels in the vertical direction. For any two pixels, when the polar radius parameter is smaller, the corresponding vertical coordinate is closer to the starting position of the vertical coordinate axis, and when the polar radius parameter is larger, the corresponding vertical coordinate is farther away from the starting position of the vertical coordinate axis. Thus, a vertical coordinate value is assigned to each pixel. The vertical coordinate value corresponds one-to-one with the polar radius parameter of the pixel, and the relative size relationship of the polar radius parameter is kept consistent in the order of the vertical coordinate.

[0037] Based on the target pixel coordinate system, pixel resampling is performed on the local image to obtain the annular unfolded image.

[0038] Pixel resampling refers to the process of remapping and arranging pixel values ​​in a local image according to the target pixel coordinate system, so that the image content that was originally distributed in a ring around the bottle opening is unfolded into regularly arranged image data under the new coordinate system.

[0039] A ring-shaped unfolded image refers to an image format used to express the image content distributed around the bottle mouth area. In spatial terms, this image corresponds to the ring structure where the bottle mouth and the tamper-evident safety ring below it are located. The image information that was originally distributed in a continuous ring around the bottle mouth is represented in a strip form, so that the various positions of the bottle mouth in the circumferential direction are arranged sequentially in the image, while retaining the hierarchical relationship in the radial direction of the bottle mouth. This intuitively reflects the overall appearance of the bottle cap and tamper-evident safety ring in the circumferential and radial directions, making it easier to observe and analyze the small structures and spatial relationships in this area in a unified manner.

[0040] The pixel matrix of the local image is read, and the constructed target pixel coordinate system is also read. The target pixel coordinate system uses the horizontal coordinate as the horizontal component and the vertical coordinate as the vertical component. Then, each target pixel coordinate point is traversed sequentially in the target pixel coordinate system, and the corresponding horizontal and vertical coordinate values ​​are determined for each target pixel coordinate point. Then, the corresponding position of the target pixel coordinate point in the local image is deduced based on the horizontal and vertical coordinate values, and the corresponding position is represented in the form of pixel coordinates of the local image. Then, a set of pixels for value acquisition is determined around the corresponding position in the local image, and the pixel values ​​are weighted and summed according to the relative distance relationship between the corresponding position and each pixel in the pixel set to obtain the pixel value of the corresponding position. Finally, the obtained pixel value is assigned to the target pixel coordinate point, thereby completing the pixel assignment of all target pixel coordinate points in the target pixel coordinate system and forming the annular unfolded image.

[0041] It should be noted that the purpose of obtaining the unfolded image of the ring is to reorganize the connection area between the bottle cap and the tamper-evident ring, which was originally distributed in a ring around the bottle opening, into a continuous strip structure in the image space. This allows the circumferential distribution of the connection parts to be presented linearly and completely. In the original local image, the connection area between the bottle cap and the tamper-evident ring is scattered along the circumference, and the connection status at different positions is affected by the shooting angle, perspective, and occlusion, making it difficult to observe uniformly from the same perspective. The unfolded image of the ring allows the slender connection residue areas distributed along the circumference of the bottle opening to be arranged sequentially on the same plane, making the extension direction, continuity, and distribution position of the connection parts clearer. This more realistically reflects the actual state of the connection parts not being completely separated after the bottle cap is opened, providing a clear and stable image basis for subsequent analysis and judgment of the overall state of the connection area.

[0042] S2. Based on the annular unfolded image, obtain the candidate bridge enhancement image; In an embodiment of the present invention, the specific steps for obtaining the candidate bridge enhancement image are as follows: In the unfolded image of the annulus, determine the first and second values ​​of the vertical coordinates; The first and second values ​​of the vertical coordinates refer to the upper and lower boundary positions of the target analysis area between the bottle cap and the tamper-evident safety ring in the vertical direction in the unfolded image of the ring. These two values ​​together determine the radial range that needs to be analyzed in detail.

[0043] The image of the ring unfolded is read and its vertical coordinate range is obtained. The image is traversed row by row along the vertical direction, and the pixel values ​​of each row are statistically analyzed to obtain the pixel distribution information of that row. Based on this, the row position range of the bottle cap area and the row position range of the tamper-evident safety ring area in the vertical direction are determined. Then, the vertical coordinate interval for analyzing the connection part is determined between the lower boundary row position of the bottle cap area and the upper boundary row position of the tamper-evident safety ring area. The vertical coordinate corresponding to the starting row position of the interval is determined as the first value, and the vertical coordinate corresponding to the ending row position of the interval is determined as the second value. Thus, the first value and the second value together define the narrow band area in the ring unfolded image for subsequent processing.

[0044] A narrowband image is constructed based on the first and second values; Narrowband images refer to images selected from the unfolded image of the ring to reflect the specific connection area between the bottle cap and the tamper-evident ring. This image corresponds to a continuous area in the radial direction of the bottle opening in space, and is used to focus on presenting the structural state between the lower edge of the bottle cap and the upper edge of the tamper-evident ring, thereby reducing the interference of irrelevant areas on subsequent analysis.

[0045] The annular unfolded image is read and its pixel matrix is ​​obtained. Using the vertical coordinates in the annular unfolded image as row indices and the horizontal coordinates as column indices, the first and second values ​​of the vertical coordinates determined in the previous steps are obtained. Then, all pixel positions in the annular unfolded image are traversed point by point. When the vertical coordinates corresponding to the pixel position are between the first and second values, the pixel value at that position is directly assigned to the corresponding narrowband image. When the vertical coordinates corresponding to the pixel position are not between the first and second values, the pixel value at that position in the narrowband image is set to 0. This ensures that the narrowband image retains only the pixel information within the range of the first and second values ​​in the vertical direction and fully inherits the pixel arrangement order of the annular unfolded image in the horizontal direction, ultimately obtaining a narrowband image containing only the pixel information of the target vertical range.

[0046] The narrowband image is subjected to differential processing to obtain a differential image; A difference image is an image obtained by calculating the changes in pixel values ​​of adjacent pixels in the vertical direction in a narrow-band image, and is used to reflect the changes in brightness along the radial direction.

[0047] The process reads a narrowband image and obtains its pixel matrix. Pixels in the narrowband image are indexed according to horizontal and vertical coordinates. Then, while keeping the horizontal coordinates unchanged, the process iterates row by row along the vertical direction. For any column of pixels corresponding to any horizontal coordinate in the narrowband image, the pixel values ​​of the previous and next rows adjacent to the current vertical coordinate in that column are obtained, and the difference between the two is calculated to obtain the difference pixel value at the current vertical coordinate. The difference pixel value is assigned to the difference image pixel position corresponding to the current horizontal and vertical coordinates. This process completes the difference calculation for all pixels in the narrowband image and forms a difference image. The pixel matrix of the difference image is consistent with the pixel matrix of the narrowband image in the order of horizontal and vertical coordinates.

[0048] The absolute value of the difference image is taken to obtain the candidate bridge enhancement image.

[0049] Candidate bridge enhancement image refers to an image formed by highlighting the slender image structure that shows the connection between the bottle cap and the tamper-evident ring, based on the connection area reflected in the narrow-band image. This image visually presents the continuous structure extending radially within the connection area more clearly, and is used to reflect the state presented in the image when the connection part is not completely separated after the bottle cap is opened.

[0050] The process reads the difference image and obtains its pixel matrix. It iterates through each pixel position in the difference image, reads the difference pixel value at that position, and determines the sign of the difference pixel value. If the difference pixel value is non-negative, it is used as the output pixel value; if the difference pixel value is negative, it is the inverse of the difference pixel value and used as the output pixel value. Then, the output pixel value is written into the output image pixel matrix corresponding to that pixel position. This completes the point-by-point absolute value processing of all pixel positions in the difference image and forms a candidate bridging enhancement image.

[0051] S3. Determine the number of neighborhood skeleton pixels based on the candidate bridge enhancement image, and perform binary labeling on the skeleton image corresponding to the candidate bridge enhancement image to obtain the residual bridge topology image. In an embodiment of the present invention, the specific steps for determining the number of neighboring skeleton pixels are as follows: The candidate bridge enhancement images are normalized to obtain normalized images; Normalization refers to adjusting the overall range of pixel values ​​in the candidate bridge enhancement image to make the values ​​of each pixel in the image fall within a uniform numerical range, thereby eliminating the influence of differences in pixel value amplitude at different locations on subsequent processing.

[0052] Read the candidate bridge enhancement image and obtain its pixel matrix. Traverse all pixel positions in the pixel matrix to record the pixel value at each position. Determine the minimum and maximum values ​​of the pixel values ​​based on the recorded set of pixel values, and calculate the difference between the maximum and minimum values ​​as the pixel value range. Then, perform a linear transformation on the pixel value at each position, subtract the minimum value from the pixel value, and perform normalization calculation using the pixel value range as the divisor. This makes the transformed pixel value numerically correspond to the position of the pixel in the candidate bridge enhancement image relative to the overall pixel value range. Finally, write the transformed pixel value at each position into the output pixel matrix corresponding to that position, thereby completing the normalization process for all pixels and obtaining the normalized image.

[0053] The normalized image is thinned to obtain the skeleton image; A skeleton image is an image format used to express the overall orientation of a continuous structure in a connected region. This image reflects the spatial distribution of the connection between the bottle cap and the tamper-evident ring through the arrangement of pixels. In this image, the connecting region is no longer presented as a blocky area with a certain width, but as a thin line of pixels. This makes the extension direction, continuity, and branching of the connecting structure clearer, thus intuitively showing the spatial continuity of the connecting parts after the bottle cap is opened. This provides a basic expression for subsequent analysis of the morphology and connectivity of the connecting structure.

[0054] The normalized image is read and its pixel matrix is ​​obtained. The pixel values ​​in the pixel matrix are used as the basic data to represent the distribution of connected regions. Then, the normalized image is traversed pixel by pixel in the image space. Based on the spatial connectivity between pixels, a set of pixels forming a continuous region is identified. While maintaining the overall connectivity of the continuous region, edge pixels of the continuous region are gradually removed, causing the continuous region to gradually shrink in the width direction. At the same time, it is continuously judged whether the removed pixel set still maintains the original connectivity. When removing pixels at any position of the continuous region would cause a change in the connectivity, the removal of pixels at that position is stopped. Thus, the continuous region in the normalized image, which originally had a certain width, is shrunk into a linear structure represented by a single pixel width in the image, and finally a skeleton image is formed to represent the center direction of the connected region.

[0055] Determine the set of neighboring pixels of the skeleton pixels in the skeleton image; Skeleton pixels refer to the pixels in a skeleton image that represent the center position of the connecting structure; neighborhood pixel set refers to a group of pixels in the image space that are adjacent to a skeleton pixel, used to describe the spatial relationship around the skeleton pixel.

[0056] Read the skeleton image and obtain its pixel matrix. Traverse all pixel positions in the skeleton image and identify the pixel values ​​as the pixel coordinates of the skeleton pixels. For any skeleton pixel coordinate, determine the pixel coordinates that are adjacent to the skeleton pixel in the horizontal, vertical and diagonal directions in the pixel coordinate plane of the skeleton image. Combine the pixels corresponding to these adjacent pixel coordinates with the skeleton pixel to form the neighborhood pixel set of the skeleton pixel. Then repeat the above adjacent pixel determination process for each skeleton pixel in the skeleton image, so as to obtain the neighborhood pixel set of each skeleton pixel in the skeleton image.

[0057] Based on the set of neighboring pixels, determine the number of neighboring skeleton pixels for each skeleton pixel.

[0058] The number of skeleton pixels in a neighborhood refers to the number of pixels that belong to the skeleton pixels in the neighborhood pixel set. This number is used to reflect the connectivity and structural density of the skeleton pixels in the local area.

[0059] Read the skeleton image and obtain its pixel matrix. Obtain the neighborhood pixel set established for each skeleton pixel in the previous steps. For any skeleton pixel, extract the pixel coordinates of each pixel in its corresponding neighborhood pixel set one by one, and read the pixel value corresponding to the pixel coordinates in the skeleton image. Establish a count variable for statistics and initialize the count variable to zero. When the read pixel value represents a skeleton pixel, increment the count variable once. When the read pixel value represents a non-skeleton pixel, keep the count variable unchanged until the traversal and statistics of all pixel coordinates in the neighborhood pixel set are completed. Determine the value of the count variable at the end of the traversal as the number of neighboring skeleton pixels of the skeleton pixel. Then repeat the above statistical process for each skeleton pixel in the skeleton image.

[0060] In an embodiment of the present invention, the specific steps for obtaining the topological image of the broken bridge are as follows: The skeleton image is divided into connected components to obtain the skeleton curve; Skeleton curves refer to continuous linear structures composed of interconnected skeleton pixels in a skeleton image, used to represent the overall extension path of the connection between the bottle cap and the tamper-evident safety ring in the image.

[0061] The skeleton image is read and its pixel matrix is ​​obtained. All pixel positions in the skeleton image are traversed and the pixel values ​​are identified as the pixel coordinates of the skeleton pixels. For any skeleton pixel that has not yet been processed, other skeleton pixels that are spatially adjacent to it are searched in the skeleton image, and the adjacent skeleton pixels are added to the same pixel set. Then, starting from the newly added skeleton pixel, the search for adjacent skeleton pixels is continued, and the above adjacent search and aggregation process is repeated until there are no new adjacent skeleton pixels that can be added to the current pixel set, thus forming a pixel set composed of interconnected skeleton pixels. This pixel set is determined as a skeleton curve. Then, skeleton pixels that have not yet been aggregated are selected in the skeleton image, and the above connected aggregation process is repeated, until all skeleton pixels in the skeleton image are divided into the corresponding pixel sets, thus obtaining a partitioning result composed of multiple skeleton curves. Each skeleton curve corresponds to a continuous connected structure in the skeleton image.

[0062] Based on the number of neighboring skeleton pixels, skeleton pixels on the same skeleton curve are compared to obtain beaded skeleton pixels. Beaded skeleton pixels refer to pixels in the skeleton image corresponding to the connection area that represent the node-like distribution of local positions on the connection structure. In spatial terms, these pixels correspond to the positions where local material aggregation or morphological changes occur in the connection part, and are used to reflect the node state of the connection structure along the extension direction.

[0063] The process involves reading the partitioning results of the skeleton curves and obtaining the set of skeleton pixel coordinates corresponding to each skeleton curve. It also involves reading the number of neighboring skeleton pixels for each skeleton pixel and establishing a one-to-one correspondence between skeleton pixel coordinates and the number of neighboring skeleton pixels. For any given skeleton curve, the skeleton pixels are sequentially organized along its connected path to form a sequence of skeleton pixels arranged according to their adjacency. Then, for each skeleton pixel in the sequence, the number of neighboring skeleton pixels is obtained, along with the number of neighboring skeleton pixels corresponding to the preceding and following skeleton pixels in the sequence. The number of neighboring skeleton pixels of the current skeleton pixel is compared with the number of neighboring skeleton pixels of the preceding and following skeleton pixels. When the number of neighboring skeleton pixels of the current skeleton pixel is greater than both the number of neighboring skeleton pixels of the preceding and following skeleton pixels, the current skeleton pixel is identified as a beaded skeleton pixel. After traversing the skeleton curve, the set of beaded skeleton pixels corresponding to that skeleton curve is output. This comparison process is repeated for the remaining skeleton curves to obtain the beaded skeleton pixels corresponding to all skeleton curves.

[0064] Skeleton pixels in the skeleton image that are connected to bead-shaped skeleton pixels and are continuously distributed in the vertical direction are defined as residual bridge skeleton pixels; The residual bridge skeleton pixels refer to a group of pixels in the skeleton image that maintain a continuous relationship with the bead skeleton pixels and extend along the radial direction of the bottle mouth. This group of pixels corresponds in space to the slender connection structure that still exists between the bottle cap and the tamper-evident safety ring, and is used to express the continuous state of the connection part that has not been completely separated after the breakage.

[0065] Read the skeleton image and obtain its pixel matrix. Read the pixel coordinate set of beaded skeleton pixels. For any beaded skeleton pixel, take it as the starting pixel in the skeleton image and search for adjacent skeleton pixels along the skeleton pixels connected to it to form a connected skeleton pixel set. Then, calculate the vertical coordinate value of each skeleton pixel in the connected skeleton pixel set. Skeleton pixels with the same horizontal coordinate and numerically adjacent vertical coordinates are grouped into the same vertical continuous segment. For the vertical continuous segment containing beaded skeleton pixels, extract all skeleton pixels in the continuous segment and determine them as residual bridge skeleton pixels. Then, repeat the above connected search and vertical continuous segment determination process for the remaining beaded skeleton pixels. Summarize the residual bridge skeleton pixels corresponding to each beaded skeleton pixel to obtain the set of residual bridge skeleton pixels in the skeleton image.

[0066] It should be noted that the skeleton pixels connected to the bead-shaped skeleton pixels and continuously distributed vertically in the skeleton image are identified as residual bridge skeleton pixels because after the connection between the bottle cap and the tamper-evident ring breaks, the remaining connection structure usually appears in space as a slender shape extending radially along the bottle opening. The bead-shaped skeleton pixels correspond to the location where the material or shape of the connection structure changes intensively. This location does not exist in isolation, but rather as part of the entire connection structure, maintaining a continuous relationship with the connection area in the vertical direction. Therefore, using only the bead-shaped skeleton pixels as the basis for connection judgment is insufficient to fully reflect the actual connection state. It is necessary to further include the skeleton pixels connected to them and continuously distributed vertically in the representation scope, so as to express the still continuous connection path between the bottle cap and the tamper-evident ring in a holistic way, making the identified residual bridge skeleton pixels more accurately correspond to the actual distribution of the connection structure.

[0067] Based on the skeleton pixels of the broken bridge, the skeleton image is binary-labeled to obtain the topological image of the broken bridge.

[0068] The residual bridge topology image refers to the image form formed after uniformly identifying the residual bridge skeleton pixels in the skeleton image. This image reflects the distribution of the path where the bottle cap and the tamper-evident safety ring still maintain a connection, and is used to intuitively represent the continuous relationship and distribution position of the connection structure in the overall space.

[0069] Read the skeleton image and obtain its pixel matrix. Read the set of pixel coordinates of the broken bridge skeleton pixels determined in the previous steps. Then, build an output pixel matrix with the same size on the pixel matrix corresponding to the skeleton image. Initialize all pixel positions in the output pixel matrix so that each pixel position is in an unmarked state. Then, traverse the set of pixel coordinates of the broken bridge skeleton pixels. For each pixel coordinate in the set, mark the position corresponding to the pixel coordinate in the output pixel matrix as a pixel value representing the broken bridge state. For the remaining pixel positions that do not belong to the set of broken bridge skeleton pixel coordinates, keep them unmarked until the marking process of all broken bridge skeleton pixels is completed. Thus, a binary distribution image consisting only of broken bridge skeleton pixel positions is formed in the output pixel matrix. This binary distribution image is used to represent the spatial path where there is still a connection between the bottle cap and the tamper-evident safety ring, that is, the broken bridge topology image is obtained.

[0070] S4. Obtain a point set based on the topological image of the broken bridge, and construct the calibration region of the broken bridge based on the point set; In an embodiment of the present invention, a point set is obtained based on the topological image of the remaining bridge, including: The topological image of the broken bridge is divided into connected regions to obtain multiple connected regions. A connected region refers to a region in a broken bridge topology image that consists of adjacent broken bridge pixels that maintain a continuous relationship. Each connected region corresponds to an independent connection path.

[0071] The process involves reading the residual bridge topology image and obtaining its binary pixel matrix. It then iterates through all pixel positions in the image and identifies pixel values ​​as the pixel coordinates of the residual bridge pixels. For any residual bridge pixel not yet assigned to a region, it is used as the starting pixel. The process searches for spatially adjacent residual bridge pixels in the image and adds these adjacent pixels to the same pixel set. This process is repeated, starting with the newly added pixel and continuing to search for and add its adjacent pixels to the pixel set. This search and set-up process is repeated until no new adjacent residual bridge pixels can be added to the current pixel set, thus forming a connected region composed of interconnected residual bridge pixels. A unique region number is assigned to this connected region. Then, residual bridge pixels not yet assigned to any region number are selected in the image, and the connected search and set-up process is repeated until all residual bridge pixels in the image are assigned to their corresponding connected regions, resulting in multiple connected region divisions. Each connected region corresponds to an independent connection path in the image.

[0072] Obtain the radius and angle mapping relationships of the unfolded annular image; The radius mapping relationship refers to the correspondence rule between the vertical coordinates in the unfolded image of the ring and the distance from the center of the bottle mouth to the corresponding pixel position. It is used to describe the correspondence between the pixel in the unfolded image in the radial direction and the spatial position of the original image. The angle mapping relationship refers to the correspondence rule between the horizontal coordinates in the unfolded image of the ring and the distribution orientation of the pixel around the center of the bottle mouth. It is used to describe the correspondence between the pixel in the unfolded image in the circumferential direction and the spatial position of the original image.

[0073] The system reads the coordinate correspondence information used to generate the annular unfolded image and obtains the horizontal and vertical coordinates of each pixel position in the annular unfolded image. It also reads the polar coordinate radius and polar coordinate angle parameters determined for each pixel in the local image during the construction of the annular unfolded image, and establishes a one-to-one correspondence between the vertical coordinates and polar coordinate radius parameters of the annular unfolded image, as well as a one-to-one correspondence between the horizontal coordinates and polar coordinate angle parameters of the annular unfolded image. Subsequently, the correspondence between the vertical coordinates and polar coordinate radius parameters is organized into a radius mapping relationship, so that any vertical coordinate can be associated with its corresponding polar coordinate radius parameter. Similarly, the correspondence between the horizontal coordinates and polar coordinate angle parameters is organized into an angle mapping relationship, so that any horizontal coordinate can be associated with its corresponding polar coordinate angle parameter. This yields the radius mapping relationship and angle mapping relationship used to restore the coordinates of the annular unfolded image to the spatial position of the local image.

[0074] Based on the center coordinates of the bottle opening, the radius mapping relationship, and the angle mapping relationship, the original image coordinates corresponding to each residual bridge skeleton pixel in the connected region are determined; Original image coordinates refer to the coordinate information used to represent the spatial position of pixels in the original image. These coordinates reflect the actual position of the pixels in the captured image.

[0075] The center coordinates of the bottle opening are read and used as the reference point in the original image coordinate system. The connected component segmentation results are read, and the pixel coordinates of the residual bridge skeleton pixels contained in each connected component in the residual bridge topology image are obtained. For any residual bridge skeleton pixel in any connected component, the horizontal and vertical coordinates of the residual bridge skeleton pixel are extracted. Based on the vertical coordinates, the corresponding polar coordinate radius parameter is determined through a radius mapping relationship, and based on the horizontal coordinates, the corresponding polar coordinate angle parameter is determined through an angle mapping relationship. Then, the horizontal coordinates of the bottle opening center coordinates are used as the reference horizontal coordinates, and the vertical coordinates of the bottle opening center coordinates are used as the reference vertical coordinates. According to the polar coordinate to rectangular coordinate conversion relationship, the polar coordinates are... The radius parameter and polar coordinate angle parameter are converted into coordinate increments in the original image. The horizontal coordinate increment is equal to the polar coordinate radius parameter multiplied by the cosine of the polar coordinate angle parameter, and the vertical coordinate increment is equal to the polar coordinate radius parameter multiplied by the sine of the polar coordinate angle parameter. Then, the horizontal coordinate increment is added to the reference horizontal coordinate to obtain the original image horizontal coordinate corresponding to the broken bridge skeleton pixel. The vertical coordinate increment is added to the reference vertical coordinate to obtain the original image vertical coordinate corresponding to the broken bridge skeleton pixel. Thus, the original image coordinates corresponding to the broken bridge skeleton pixel are obtained. Finally, the above conversion and addition process is repeated for all broken bridge skeleton pixels in the connected region, so that each broken bridge skeleton pixel in the connected region obtains the corresponding original image coordinates.

[0076] The original image coordinates corresponding to the residual bridge skeleton pixels in the connected region are aggregated to obtain a point set.

[0077] A point set refers to a set of coordinates formed by summarizing the pixel coordinates of the residual bridge skeleton pixels belonging to the same connected region in the original image. It is used to centrally represent the spatial distribution range of a single connected path in the original image.

[0078] The process involves reading the partitioning results of connected regions and obtaining the set of residual bridge skeleton pixels contained in each connected region. The original image coordinates determined for each residual bridge skeleton pixel in the connected region in the preceding steps are then read, and a one-to-one correspondence between the residual bridge skeleton pixels and the original image coordinates is established. Then, for any connected region, the original image coordinates corresponding to all residual bridge skeleton pixels within that region are extracted one by one and sequentially written into the same coordinate container, ensuring that the coordinate container contains all the original image coordinates corresponding to that connected region. After writing, this coordinate container is defined as the point set corresponding to that connected region. This coordinate writing process is repeated for the remaining connected regions to obtain multiple point sets, each corresponding to the spatial coordinate distribution of a connected region in the original image.

[0079] In an embodiment of the present invention, constructing a residual bridge calibration region based on a point set includes: Determine the minimum, maximum, minimum, and maximum values ​​of the horizontal and vertical coordinates of the point set. The minimum horizontal coordinate refers to the coordinate value closest to the starting position in the horizontal direction among all pixel coordinates in the point set, used to define the left boundary of the connection structure in the horizontal direction. The maximum horizontal coordinate refers to the coordinate value closest to the ending position in the horizontal direction among all pixel coordinates in the point set, used to define the right boundary of the connection structure in the horizontal direction. The minimum vertical coordinate refers to the coordinate value closest to the starting position in the vertical direction among all pixel coordinates in the point set, used to define the upper boundary of the connection structure in the vertical direction. The maximum vertical coordinate refers to the coordinate value closest to the ending position in the vertical direction among all pixel coordinates in the point set, used to define the lower boundary of the connection structure in the vertical direction.

[0080] Obtain all original image pixel coordinates contained in the point set. For each pixel coordinate in the point set, extract its horizontal and vertical coordinate values. Then, using the horizontal coordinate values ​​as comparison objects, iterate through all pixel coordinates in the point set and compare them pairwise. The coordinate value closest to the starting position in the horizontal direction is determined as the minimum horizontal coordinate value, and the coordinate value closest to the ending position in the horizontal direction is determined as the maximum horizontal coordinate value. At the same time, using the vertical coordinate values ​​as comparison objects, iterate through all pixel coordinates in the point set and compare them pairwise. The coordinate value closest to the starting position in the vertical direction is determined as the minimum vertical coordinate value, and the coordinate value closest to the ending position in the vertical direction is determined as the maximum vertical coordinate value. This completes the determination of the range of pixel coordinate values ​​in the point set in the horizontal and vertical directions.

[0081] Based on the minimum and maximum horizontal coordinates, minimum and maximum vertical coordinates of the point set, a calibration area for the damaged bridge is constructed.

[0082] The "remaining bridge" marking area refers to the image area in e-commerce product images used to cover the still-connected relationship between the bottle cap and the tamper-evident safety ring. In terms of spatial meaning, this area corresponds to the actual distribution range of the connecting structure in the product appearance. Through this area, the position and area occupied by the connecting part in the original image can be represented as a whole, so that the image content related to the bottle cap not being completely separated after opening can be expressed in a concentrated manner, which is convenient for intuitive display and subsequent processing of the connecting area.

[0083] The minimum and maximum horizontal coordinates are used as the horizontal boundary coordinates of the residual bridge calibration area, and the minimum and maximum vertical coordinates are used as the vertical boundary coordinates of the residual bridge calibration area. Then, based on the horizontal and vertical boundary coordinates, a closed rectangular region is determined in the original image coordinate plane, so that the rectangular region completely covers the entire range of pixel coordinate values ​​of the point set in both the horizontal and vertical directions. This forms the residual bridge calibration area, which represents the overall distribution range of the connection structure in the original image. This residual bridge calibration area serves as the spatial basis for subsequent labeling processing of the original image.

[0084] S5. Determine the target pixel coordinates of the calibration area of ​​the damaged bridge, and generate an updated output image based on the target pixel coordinates.

[0085] In an embodiment of the present invention, determining the target pixel coordinates of the residual bridge calibration area includes: Construct the output image based on the original image; The output image refers to the image format generated based on the original image to present the processing results. This image maintains the same spatial structure as the original image and is used to carry the result information after marking or displaying a specific area.

[0086] Read the original image and obtain its pixel matrix and corresponding pixel coordinate range. Construct an output image pixel matrix that has the same number of pixel rows and columns as the original image. Assign values ​​to each pixel of the output image pixel matrix so that the pixel value at each pixel coordinate position in the output image is taken from the pixel value at the same pixel coordinate position in the original image. This ensures that the output image and the original image are consistent in spatial arrangement, pixel coordinate correspondence, and pixel value distribution, thus completing the construction of the output image.

[0087] In the output image, determine the coordinates of the target pixels belonging to the calibration area of ​​the broken bridge.

[0088] The target pixel coordinates refer to the pixel positions located within the calibration area of ​​the broken bridge in the output image. These pixel positions are used to indicate the specific spatial range of the connecting area in the output image, so that the connecting parts can be accurately located and represented in the output image.

[0089] The boundary information of the bridge calibration area in the output image coordinate plane is obtained. The boundary information includes the minimum and maximum horizontal coordinates, the minimum and maximum vertical coordinates. Then, the pixel coordinate range of the output image is traversed. For any pixel coordinate, its horizontal and vertical coordinate values ​​are extracted. It is determined whether the horizontal coordinate value is between the minimum and maximum horizontal coordinates and whether the vertical coordinate value is between the minimum and maximum vertical coordinates. When both of the above conditions are met, the pixel coordinate is determined as the target pixel coordinate and added to the target pixel coordinate set. This process is repeated until all pixel coordinates of the output image are judged and collected, thereby obtaining all target pixel coordinates belonging to the bridge calibration area in the output image.

[0090] In an embodiment of the present invention, generating an updated output image based on the target pixel coordinates includes: Set the marker color vector for the output image; A calibrated color vector refers to a set of color component values ​​used to represent the color displayed in the calibrated area in the output image. These color components collectively determine the visual color effect of the calibrated area in the image.

[0091] The color representation of the output image is read and its pixel values ​​are determined to be composed of multiple color components. The distribution of pixel color component values ​​in the unmarked area of ​​the output image is obtained and a statistical result of the distribution is established. Based on the statistical result, a combination of color components that are numerically distinguishable from the distribution of color component values ​​in the unmarked area is selected as the marker color vector. The marker color vector is represented in a vector form consistent with the number of pixel color components in the output image, so that the marker color vector can be used as the color input when updating pixels in the output image. This completes the setting of the marker color vector and ensures that the marked area has a distinguishable display effect from the unmarked area in the output image.

[0092] Set the blending coefficients for the output image; The blending coefficient is a numerical value used to control the ratio of the original pixel value and the marker color in the output image, and is used to reflect the display intensity of the marker color at the corresponding pixel position.

[0093] The system reads the output image and obtains the target pixel coordinate set corresponding to the bridge calibration area. Simultaneously, it obtains the reference pixel coordinate set that is spatially adjacent to the target pixel coordinate set but does not belong to the bridge calibration area. Pixel values ​​are extracted from the target pixel coordinate set and the reference pixel coordinate set, respectively, and data samples are constructed to describe the brightness and color distribution of the two types of pixels. The data samples are input into a mixing coefficient prediction model that has been pre-trained using a large number of e-commerce product images. Based on the difference in pixel distribution between the target area and the surrounding area in the sample, the prediction model outputs a mixing coefficient to balance the display ratio of the original pixels and the marked color. This mixing coefficient ensures that the target area has a clear and distinguishable display effect in the output image while maintaining visual continuity with the surrounding area. This completes the adaptive setting of the output image mixing coefficient, and the setting process can be automatically adjusted according to the actual display situation of different product images.

[0094] The steps for pre-training a mixing coefficient prediction model using a large number of e-commerce product images include: collecting e-commerce product image samples covering different product categories, different shooting environments, and different bottle cap states; labeling the pixel range corresponding to the area where the bottle cap and the tamper-evident safety ring are connected in the image samples, and simultaneously labeling the pixel range of the adjacent non-connected areas; based on the above labeling results, extracting the pixel value distribution of the target area and the pixel value distribution of the reference area from each image; using the difference in pixel distribution between the two types of areas and the optimal display ratio confirmed by humans as the input data and supervision labels for the training samples; then training the mixing coefficient prediction model using supervised learning, enabling the model to learn the reasonable mixing ratio relationship between the target area and the surrounding area under changes in pixel distribution; continuously adjusting the internal parameters of the model during training to reduce the deviation between the mixing coefficient output by the model and the supervision labels, until the model can stably output mixing coefficient results consistent with human judgment on the validation samples; finally, using the trained model as the mixing coefficient prediction model, which is used to automatically predict the mixing coefficient based on pixel distribution in subsequent actual e-commerce product image processing.

[0095] It should be noted that the use of machine learning is reflected in the determination process of the mixing coefficients. That is, the mixing coefficients are not directly obtained through human experience or fixed calculation rules, but are automatically output by a prediction model that has been trained in advance using a large number of e-commerce product images. During the training phase, this model learns the relationship between the target region and its neighboring regions in terms of pixel distribution and the corresponding reasonable display ratio, forming a mapping ability between pixel distribution state and mixing coefficients. In the practical application phase, when a new e-commerce product image is input, the pixel data corresponding to the target pixel set and the reference pixel set are input into the model to obtain the mixing coefficients. This allows the mixing coefficients to adapt to the actual display of different product images, thus demonstrating the machine learning application process of obtaining parameters through data training and making inferences on new samples.

[0096] The first intermediate pixel value is obtained by multiplying the blending coefficient and the pixel value of the target pixel coordinates. The first intermediate pixel value refers to the intermediate result formed by the original pixel value of the target pixel under the action of the mixing coefficient, which is used to retain part of the display information of the original image at that pixel position.

[0097] Subtract the mixing coefficient from 1 to obtain the remaining coefficient; The residual coefficient refers to the proportional value that complements the mixing coefficient, and is used to represent the proportion of the marker color in the pixel update process.

[0098] Multiply the remaining coefficients and the marked color vector to obtain the second intermediate pixel value; The second intermediate pixel value refers to the intermediate result formed by the marker color vector under the action of the residual coefficients, which is used to reflect the display contribution of the marker color at the pixel position.

[0099] The updated pixel value is obtained by adding the first intermediate pixel value and the second intermediate pixel value. Updating pixel values ​​refers to the pixel value obtained by merging the first intermediate pixel value and the second intermediate pixel value. This value comprehensively reflects the superposition effect of the original image content and the marker color.

[0100] The process involves reading the pixel matrix of the output image, reading the determined set of target pixel coordinates, reading the blending coefficients and using them as scaling factors for pixel values, iterating through each target pixel coordinate in the target pixel coordinate set, extracting the original pixel value at that target pixel coordinate from the output image pixel matrix, multiplying the blending coefficients by the original pixel value component by color component to obtain the first intermediate pixel value, and recording the first intermediate pixel value in the temporary storage location corresponding to the target pixel coordinate, determining the residual coefficient by subtracting the blending coefficients, and recording the residual coefficient as a scaling factor for calculating the color contribution, then reading the labeled color vector and using it as the input color component vector, multiplying the residual coefficients by the labeled color vector component by color component to obtain the second intermediate pixel value, and recording the second intermediate pixel value in the temporary storage location corresponding to the target pixel coordinate, then adding the first intermediate pixel value and the second intermediate pixel value component by color component to obtain the updated pixel value, and writing the updated pixel value into the position corresponding to the target pixel coordinate in the output image pixel matrix, thus completing the update of the pixel value at the target pixel coordinate.

[0101] Based on the objective laws of optical imaging and color superposition, the color presented by a single pixel in an image can be understood as the result of the combined effect of multiple optical components at that location. When it is necessary to introduce a marker color to indicate a specific area while maintaining the continuity of the original image content, this process can be abstracted as a linear superposition process of two color signals at the same spatial location. The original pixel value corresponds to the original imaging light intensity component, the marker color vector corresponds to the additional display light intensity component, the mixing coefficient is used to describe the retention ratio of the original imaging light intensity at that pixel location, and the residual coefficient obtained by subtracting the mixing coefficient is used to describe the proportion of the additional display light intensity at that pixel location. By scaling the original pixel value and the marker color vector according to their respective proportions and superimposing them at the same pixel location, a comprehensive color value that simultaneously contains the original imaging information and the marker display information can be obtained. This comprehensive color value numerically corresponds to the updated pixel brightness and color distribution, and can continuously reflect the combined effect of the two optical contributions.

[0102] An updated output image is generated based on the updated pixel values.

[0103] The updated output image refers to the image formed by replacing the corresponding target pixel position with the updated pixel value. This image is used to visually present the annotation results of the bridge remnant calibration area in e-commerce product images.

[0104] The process reads the pixel matrix of the output image and obtains the target pixel coordinate set. It reads the updated pixel value calculated for each target pixel coordinate and establishes a one-to-one correspondence between the target pixel coordinate and the updated pixel value. Then, it iterates through each target pixel coordinate in the target pixel coordinate set, locates the pixel position corresponding to the target pixel coordinate in the pixel matrix of the output image, and writes the updated pixel value corresponding to the target pixel coordinate into the pixel position to replace the original pixel value at that pixel position. At the same time, it keeps the original pixel value unchanged for the remaining pixel positions that do not belong to the target pixel coordinate set until the pixel writing operation for all target pixel coordinates is completed, thereby obtaining the output image with the updated pixel matrix. The image data corresponding to the pixel matrix is ​​then output as the updated output image, which is used to present the marking results of the bridge calibration area in the original image of the e-commerce product.

[0105] The updated output image is used to visually present the locations where the connection between the bottle cap and the tamper-evident safety ring still exists in e-commerce product display, quality inspection, and after-sales scenarios. By visually marking the relevant areas without changing the overall appearance information of the product, platform operators, warehouse quality inspectors, or after-sales auditors can quickly identify whether the product has been opened or has an abnormal connection without the need for professional image analysis knowledge. At the same time, the updated output image can also serve as the image basis for subsequent manual review, quality inspection record retention, and dispute resolution, improving the efficiency and consistency of product status determination in e-commerce scenarios.

[0106] The above are merely preferred embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A machine learning-based image processing method for e-commerce scenarios, characterized in that, Includes the following steps: A polar coordinate system is constructed based on the original images of e-commerce products, and pixel resampling is performed on local images of e-commerce products based on the polar coordinate system to obtain the annular unfolded image. Based on the annular unfolded image, candidate bridge enhancement images are obtained; The number of neighborhood skeleton pixels is determined based on the candidate bridge enhancement image, and the skeleton image corresponding to the candidate bridge enhancement image is binary labeled to obtain the residual bridge topology image. A point set is obtained based on the topological image of the broken bridge, and a calibration region for the broken bridge is constructed based on the point set; Determine the target pixel coordinates of the calibration area of ​​the damaged bridge, and generate an updated output image based on the target pixel coordinates.

2. The machine learning-based image processing method for e-commerce scenarios according to claim 1, characterized in that, The specific steps for constructing a polar coordinate system are as follows: Obtain the original images of e-commerce products; Extract a partial image from the original image, including the bottle cap and the tamper-evident safety ring; Determine the center coordinates of the bottle opening in a local image; A polar coordinate system is constructed on the local image based on the center coordinates of the bottle opening.

3. The e-commerce scene image processing method based on machine learning according to claim 2, characterized in that, The specific steps to obtain the annular unfolded image are as follows: In the polar coordinate system, determine the polar radius parameter and polar angle parameter of each pixel in the local image; Map the polar coordinate radius parameter to vertical coordinates; Map the polar coordinate angle parameters to horizontal coordinates; Construct a target pixel coordinate system based on vertical and horizontal coordinates; Based on the target pixel coordinate system, pixel resampling is performed on the local image to obtain the annular unfolded image.

4. The machine learning-based image processing method for e-commerce scenarios according to claim 3, characterized in that, The specific steps to obtain the candidate bridge enhancement image are as follows: In the unfolded image of the annulus, determine the first and second values ​​of the vertical coordinates; A narrowband image is constructed based on the first and second values; The narrowband image is subjected to differential processing to obtain a differential image; The absolute value of the difference image is taken to obtain the candidate bridge enhancement image.

5. The e-commerce scene image processing method based on machine learning according to claim 1, characterized in that, The specific steps for determining the number of neighboring skeleton pixels are as follows: The candidate bridge enhancement images are normalized to obtain normalized images; The normalized image is thinned to obtain the skeleton image; Determine the set of neighboring pixels of the skeleton pixels in the skeleton image; Based on the set of neighboring pixels, determine the number of neighboring skeleton pixels for each skeleton pixel.

6. The machine learning-based image processing method for e-commerce scenarios according to claim 5, characterized in that, The specific steps to obtain the topological image of the broken bridge are as follows: The skeleton image is divided into connected components to obtain the skeleton curve; Based on the number of neighboring skeleton pixels, skeleton pixels on the same skeleton curve are compared to obtain beaded skeleton pixels. Skeleton pixels in the skeleton image that are connected to bead-shaped skeleton pixels and are continuously distributed in the vertical direction are defined as residual bridge skeleton pixels; Based on the skeleton pixels of the broken bridge, the skeleton image is binary-labeled to obtain the topological image of the broken bridge.

7. The e-commerce scene image processing method based on machine learning according to claim 2, characterized in that, The point set obtained based on the topological image of the broken bridge includes: The topological image of the broken bridge is divided into connected regions to obtain multiple connected regions. Obtain the radius and angle mapping relationships of the unfolded annular image; Based on the center coordinates of the bottle opening, the radius mapping relationship, and the angle mapping relationship, the original image coordinates corresponding to each residual bridge skeleton pixel in the connected region are determined; The original image coordinates corresponding to the residual bridge skeleton pixels in the connected region are aggregated to obtain a point set.

8. The e-commerce scene image processing method based on machine learning according to claim 1, characterized in that, The residual bridge calibration area is constructed based on the point set, including: Determine the minimum, maximum, minimum, and maximum values ​​of the horizontal and vertical coordinates of the point set. Based on the minimum and maximum horizontal coordinates, minimum and maximum vertical coordinates of the point set, a calibration area for the damaged bridge is constructed.

9. The e-commerce scene image processing method based on machine learning according to claim 1, characterized in that, Determine the target pixel coordinates of the bridge scaffolding area, including: Construct the output image based on the original image; In the output image, determine the coordinates of the target pixels belonging to the calibration area of ​​the broken bridge.

10. The e-commerce scene image processing method based on machine learning according to claim 1, characterized in that, The updated output image is generated based on the target pixel coordinates, including: Set the marker color vector for the output image; Set the blending coefficients for the output image; The first intermediate pixel value is obtained by multiplying the blending coefficient and the pixel value of the target pixel coordinates. Subtract the mixing coefficient from 1 to obtain the remaining coefficient; Multiply the remaining coefficients and the marked color vector to obtain the second intermediate pixel value; The updated pixel value is obtained by adding the first intermediate pixel value and the second intermediate pixel value. An updated output image is generated based on the updated pixel values.