Image detection method and device, electronic equipment and storage medium

By acquiring and filtering isolated pixels to determine item boundary information, the high cost and low efficiency caused by manual review are solved, realizing automated review of product images and improving detection accuracy and efficiency.

CN122156076APending Publication Date: 2026-06-05BEIJING QIYI CENTURY SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING QIYI CENTURY SCI & TECH CO LTD
Filing Date
2026-02-02
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing technologies, product image review relies on manual operation, which leads to high costs, low efficiency, and susceptibility to subjective factors, resulting in misjudgments or omissions.

Method used

By acquiring the image pixel data of the item image, filtering out isolated pixels, determining the item boundary information, and judging whether the item boundary information matches the valid display area, automated review is achieved.

Benefits of technology

It automates image review, improves efficiency, reduces labor costs, and enhances detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122156076A_ABST
    Figure CN122156076A_ABST
Patent Text Reader

Abstract

The present application relates to an image detection method, device, electronic equipment and storage medium, wherein the image detection method comprises: obtaining image pixel data corresponding to an article image of a target article; determining article boundary information of the target article in the image pixel data, wherein the article boundary information is determined after filtering isolated pixels around the target article in the image pixel data; determining whether the article image matches an effective display area of an article promotion position according to the article boundary information; and if the article image matches the effective display area of the article promotion position, determining that the image detection is passed. The present application embodiment can realize automatic image auditing, does not need manual comparison with picture specifications for auditing one by one, improves image auditing efficiency, reduces manual cost, and improves detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image review, and more particularly to an image detection method, apparatus, electronic device, and storage medium. Background Technology

[0002] In the e-commerce and content distribution sectors, the standardization of product display images directly impacts user experience and platform operational efficiency. Currently, major platforms typically have established strict technical specifications for product images uploaded by merchants, covering multiple dimensions such as image size, the proportion of the product safety zone, background transparency, and file format.

[0003] However, in current technology, the review of the aforementioned standards mainly relies on manual operation. Merchants or reviewers need to use professional image processing software (such as Photoshop) to open and compare each image one by one. This manual review method not only consumes a lot of human resources, resulting in high review costs, but also suffers from technical defects such as inefficiency and susceptibility to subjective factors, leading to misjudgments or omissions.

[0004] Therefore, the industry urgently needs a technical solution that can automatically detect the compliance of product images in order to automate and intelligentize the review process and improve the accuracy and efficiency of the review. Summary of the Invention

[0005] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, this application provides an image detection method, apparatus, electronic device and storage medium.

[0006] In a first aspect, this application provides an image detection method, including: Obtain the image pixel data corresponding to the image of the target item; The object boundary information of the target object is determined from the image pixel data. The object boundary information is determined after filtering out isolated pixels around the target object in the image pixel data. Based on the item boundary information, determine whether the item image matches the effective display area of ​​the item promotion position; If the item image matches the valid display area of ​​the item promotion position, the image detection is deemed successful.

[0007] Optionally, determining the object boundary information of the target object from the image pixel data includes: Determine the non-transparent area corresponding to the target item in the image pixel data; Determine the area of ​​the connected components of multiple groups of non-transparent pixels in the non-transparent region; Filter out non-transparent pixel groups whose connected component area is less than a preset threshold; The object boundary information of the target object is determined based on the remaining non-transparent pixel group in the non-transparent region.

[0008] Optionally, determining the non-transparent region corresponding to the target item in the image pixel data includes: For each pixel in the image pixel data, read the Alpha channel value of that pixel; The non-transparent area corresponding to the target item is determined in the image pixel data based on the alpha channel values ​​of multiple pixels.

[0009] Optionally, determining the area of ​​the connected components of multiple groups of non-transparent pixels in the non-transparent region includes: Perform connected component analysis on each non-transparent pixel in the non-transparent region to obtain multiple non-transparent pixel groups; The number of non-transparent pixels contained in each of the non-transparent pixel groups is obtained as the area of ​​the connected region of the non-transparent pixel group.

[0010] Optionally, determining the object boundary information of the target object based on the remaining non-transparent pixel group in the non-transparent region includes: Determine the minimum x-coordinate, maximum x-coordinate, minimum y-coordinate, and maximum y-coordinate of the remaining non-transparent pixel group in the non-transparent region; The minimum bounding rectangle of the target item is determined based on the minimum x-coordinate, the maximum x-coordinate, the minimum y-coordinate, and the maximum y-coordinate. The object boundary information of the target object is determined based on the minimum bounding rectangle.

[0011] Optionally, after determining the non-transparent region corresponding to the target item in the image pixel data, the method further includes: Obtain the Alpha channel values ​​of multiple pixels located outside the object boundary information in the image pixel data; Determine the number of transparent pixels whose alpha channel value corresponds to the alpha channel value of the transparent pixel; If the number of transparent pixels accounts for more than a preset threshold of all pixels in the image pixel data, the image of the item is determined to be a transparent background image, and the step of determining the area of ​​the connected components of multiple non-transparent pixel groups in the non-transparent region is executed.

[0012] Optionally, determining whether the item image matches the valid display area of ​​the item promotion position based on the item boundary information includes: Determine whether the item image is located within the valid display area of ​​the item promotion position based on the item boundary information; If the item image is located within the effective display area of ​​the item promotion position, determine whether the margin ratio between the item image and the effective display area of ​​the item promotion position is greater than a preset margin ratio threshold based on the item boundary information. If the margin ratio between the item image and the effective display area of ​​the item promotion position is greater than a preset margin ratio threshold, it is determined that the item image matches the effective display area of ​​the item promotion position.

[0013] Secondly, this application provides an image detection apparatus, comprising: The acquisition module is used to acquire the image pixel data corresponding to the image of the target item; The first determining module is used to determine the object boundary information of the target object in the image pixel data, wherein the object boundary information is determined after filtering isolated pixels around the target object in the image pixel data; The second determining module is used to determine whether the item image matches the effective display area of ​​the item promotion position based on the item boundary information. The third determining module is used to determine that the image detection has passed if the item image matches the effective display area of ​​the item promotion position.

[0014] Optionally, the first determining module includes: The first determining unit is configured to determine the non-transparent area corresponding to the target item in the image pixel data; The second determining unit is used to determine the area of ​​the connected domain of multiple non-transparent pixel groups in the non-transparent region; The filtering unit is used to filter out non-transparent pixel groups whose connected region area is less than a preset threshold. The third determining unit is used to determine the object boundary information of the target object based on the remaining non-transparent pixel group in the non-transparent region.

[0015] Optionally, the first determining unit includes: The reading subunit is used to read the Alpha channel value of each pixel in the image pixel data; The first determining subunit is used to determine the non-transparent area corresponding to the target item in the image pixel data based on the Alpha channel values ​​of multiple pixels.

[0016] Optionally, the second determining unit includes: An analysis subunit is used to perform connected component analysis on each non-transparent pixel in the non-transparent region to obtain multiple non-transparent pixel groups; A sub-unit is used to obtain the number of non-transparent pixels contained in each of the non-transparent pixel groups, so as to serve as the area of ​​the connected region of the non-transparent pixel group.

[0017] Optionally, the third determining unit includes: The second determining subunit is used to determine the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate, and maximum vertical coordinate of the remaining non-transparent pixel group in the non-transparent region; The third determining subunit is used to determine the minimum bounding rectangle of the target item based on the minimum abscissa, the maximum abscissa, the minimum ordinate, and the maximum ordinate. The fourth determining subunit is used to determine the item boundary information of the target item based on the minimum bounding rectangle.

[0018] Optionally, after the first determining unit, the device further includes: The acquisition unit is used to acquire the Alpha channel values ​​of multiple pixels located outside the object boundary information in the image pixel data; The fourth determining unit is used to determine the number of transparent pixels whose alpha channel value corresponds to the transparent pixel value; The fifth determining unit is used to determine that the object image is a transparent background image if the proportion of the number of transparent pixels to all pixels in the image pixel data exceeds a preset proportion threshold, and to perform the step of determining the area of ​​the connected region of multiple non-transparent pixel groups in the non-transparent region.

[0019] Optionally, the second determining module includes: The sixth determining unit is used to determine whether the item image is located within the effective display area of ​​the item promotion position based on the item boundary information; The seventh determining unit is used to determine, based on the item boundary information, whether the margin ratio between the item image and the effective display area of ​​the item promotion position is greater than a preset margin ratio threshold if the item image is located within the effective display area of ​​the item promotion position. The eighth determining unit is used to determine that the item image matches the effective display area of ​​the item promotion position if the margin ratio between the item image and the effective display area of ​​the item promotion position is greater than a preset margin ratio threshold.

[0020] Thirdly, this application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the image detection method described in any of the first aspects.

[0021] Fourthly, this application provides a computer-readable storage medium storing a program for an image detection method, wherein when the image detection method program is executed by a processor, it implements the steps of any of the image detection methods described in the first aspect.

[0022] The technical solutions provided in this application have the following advantages compared with the prior art: This application embodiment directly acquires the image pixel data of the object image through front-end technology, and determines the object boundary information after filtering isolated pixels around the target object in the image pixel data. Then, it judges whether the object boundary information matches the effective display area to obtain the image detection result, realizing automatic image review without the need for manual review of each image against the image specifications, improving image review efficiency, reducing labor costs, and improving detection accuracy. Attached Figure Description

[0023] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 A flowchart of an image detection method provided in an embodiment of this application; Figure 2 This is a structural diagram of an image detection device provided in an embodiment of this application; Figure 3 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0027] Currently, the review of the aforementioned standards relies primarily on manual operation. Merchants or reviewers need to use professional image processing software (such as Photoshop) to open and compare each image individually. This manual review method not only consumes a large amount of human resources, resulting in high review costs, but also suffers from technical defects such as low efficiency and susceptibility to subjective factors leading to misjudgments or omissions. Currently, the industry urgently needs a technical solution that can automatically detect the compliance of product images to automate and intelligentize the review process, thereby improving the accuracy and efficiency of the review. Therefore, this application provides an image detection method, apparatus, electronic device, and storage medium.

[0028] This application provides an image detection method that can be applied to a front-end, such as... Figure 1 As shown, it includes: Step S101: Obtain the image pixel data corresponding to the object image of the target item; In this embodiment of the application, the item image contains the target item to be displayed in the browser. The item image is the image to be reviewed. The image pixel data is the basic unit data that constitutes the item image, which includes information such as the color and transparency of each pixel.

[0029] In this step, the front-end creates an image object using JavaScript, loads the uploaded file corresponding to the target item's image, and after loading, obtains basic information such as the width and height of the item image. Then, it draws the image and extracts the image pixel data using the Canvas API. For example, the front-end creates an image object `constimg=new Image()`, sets `img.src` to the file path of the item image, draws the image using `ctx.drawImage(img, 0, 0)` after loading, and then extracts the image pixel data using `ctx.getImageData(0, 0, canvas.width, canvas.height)`.

[0030] After obtaining the width and height of the item image, it can be directly compared with the standard size parameters set by the platform to quickly determine whether the image size is compliant.

[0031] Step S102: Determine the object boundary information of the target object from the image pixel data; In this embodiment of the application, the item boundary information is determined after filtering isolated pixels around the target item in the image pixel data; the item boundary information is used to define the position and range of the target item in the item image, and isolated pixels refer to a small set of pixels that are not related to the target item and are scattered.

[0032] In this step, the region where the target item is located is identified based on the features of the image pixel data. A specific algorithm is used to filter and remove isolated pixels around the target item, thereby accurately determining the boundary range of the target item. For example, region identification is performed on the extracted image pixel data to initially pinpoint the area where the target item may be located. Then, the distribution characteristics of pixels within this region are analyzed using an algorithm to filter and remove isolated pixels that are too small or have no connection to surrounding pixels. The boundary information of the target item is determined based on the remaining valid pixel area.

[0033] Step S103: Determine whether the item image matches the effective display area of ​​the item promotion position based on the item boundary information; In this embodiment of the application, the effective display area of ​​the item promotion position refers to a pre-defined specific area used to display item images, and this area has clear scope definition, size standards and other specifications.

[0034] In this step, the determined item boundary information is compared with the specifications of the effective display area of ​​the item promotion space to determine whether the position and range of the item image meet the set standards of the effective display area. For example, the coordinate range, size parameters, and other specification data of the effective display area of ​​the item promotion space are extracted, and the coordinate range and size data corresponding to the item boundary information are compared one by one with the relevant specification data of the effective display area to determine whether the item image meets the display requirements of the effective display area.

[0035] Step S104: If the item image matches the valid display area of ​​the item promotion position, the image detection is determined to be successful.

[0036] In this embodiment of the application, "image detection passed" means that the image of the item meets all the specifications of the effective display area of ​​the item promotion position and is ready for promotion and display.

[0037] In this step, after comparing and confirming that the image of the item meets the matching requirements of the valid display area, a conclusion that the image detection has passed can be generated and output, and relevant detection data can be attached for subsequent use.

[0038] For example, the front-end logic determines that the position, range, and other indicators of the item image meet the specifications of the effective display area for the item promotion position. In this case, the result of image detection is output, and relevant data such as the item boundary coordinates and matching verification results are recorded.

[0039] In practical applications, the detected subject bounding boxes can be drawn in real time on the front-end Canvas, with different colors indicating compliance status; simultaneously, the review result JSON data (including subject coordinates, safe zone status, image size, etc.) is output. The detection results are drawn on the image in real time as borders; users can instantly view and adjust uploaded images; batch processing and automated integration are supported.

[0040] In this embodiment, the review logic runs entirely on the browser side, allowing the front end to complete the review process and support batch processing without relying on the server side, thus reducing network and computing power dependence; it supports real-time detection and millisecond-level response; and it ensures image privacy and security.

[0041] In another embodiment of this application, after detecting whether the item image matches the effective display area of ​​the item promotion position, it can also detect whether the color of the item image and the color distribution in the browser page where the effective display area is located meet the color distribution specifications. If they meet the specifications, the image detection is determined to be successful.

[0042] This application embodiment directly acquires the image pixel data of the object image through front-end technology, and determines the object boundary information after filtering isolated pixels around the target object in the image pixel data. Then, it judges whether the object boundary information matches the effective display area to obtain the image detection result, realizing automatic image review without the need for manual review of each image against the image specifications, improving image review efficiency, reducing labor costs, and improving detection accuracy.

[0043] In another embodiment of this application, step S102, determining the object boundary information of the target object in the image pixel data, includes: Step S201: Determine the non-transparent area corresponding to the target item in the image pixel data; In this embodiment of the application, the non-transparent area refers to the area in the image where the target object is located and the pixels do not have the property of transparency. This area is the basis for identifying the target object.

[0044] In this step, each pixel in the image pixel data can be analyzed one by one. Based on the transparency attribute of the pixel, it can be determined whether it is a non-transparent pixel. The regions corresponding to all non-transparent pixels are aggregated to obtain the non-transparent region corresponding to the target item.

[0045] For example: iterate through each pixel in the image pixel data, read the transparency parameter of each pixel, determine whether the parameter meets the criteria for non-transparent pixels, record the coordinates of non-transparent pixels that meet the criteria, and aggregate the regions corresponding to the recorded coordinates to obtain the non-transparent region corresponding to the target item.

[0046] Step S202: Determine the area of ​​the connected components of multiple groups of non-transparent pixels in the non-transparent region; In this embodiment of the application, a non-transparent pixel group refers to a set of interconnected non-transparent pixels in a non-transparent region, and the area of ​​the connected region refers to the number of non-transparent pixels contained in each non-transparent pixel group.

[0047] In this step, the Connected Component Analysis (CBI) algorithm is used. Non-transparent pixels within the non-transparent region are grouped. Interconnected non-transparent pixels are grouped into the same non-transparent pixel group, while non-interconnected non-transparent pixels are grouped into different non-transparent pixel groups. The number of non-transparent pixels in each non-transparent pixel group is then counted to obtain the connected component area of ​​each non-transparent pixel group.

[0048] For example, the four-neighbor connectivity analysis algorithm is used to scan the non-transparent pixels in the non-transparent region. The non-transparent pixels that are adjacent to the current pixel in the four directions of up, down, left, and right are grouped into the same group to form multiple non-transparent pixel groups. Then, the number of non-transparent pixels in each non-transparent pixel group is counted one by one. This number is the area of ​​the connected region of the corresponding non-transparent pixel group.

[0049] Step S203: Filter out non-transparent pixel groups whose connected component area is less than a preset threshold; In this embodiment, the preset threshold refers to a pre-set numerical standard used to distinguish between effective non-transparent pixel groups and isolated pixel groups. This standard can be reasonably configured according to the actual application scenario and image quality requirements.

[0050] In this step, the area of ​​the connected region of each non-transparent pixel group is compared with a preset threshold. If the area of ​​the connected region of a certain non-transparent pixel group is less than the preset threshold, the non-transparent pixel group is determined to be an isolated pixel group and is filtered out.

[0051] For example, based on factors such as image resolution and common noise features, a threshold of 10 pixels for the area of ​​connected components is preset. The area of ​​the connected components of each non-transparent pixel group is compared with 10 pixels. For non-transparent pixel groups with a connected component area of ​​less than 10 pixels, they are filtered out from the non-transparent area.

[0052] Step S204: Determine the object boundary information of the target object based on the remaining non-transparent pixel group in the non-transparent area.

[0053] In this embodiment of the application, the remaining non-transparent pixel group refers to the set of non-transparent pixels that are retained in the non-transparent area after filtering out isolated pixel groups and can accurately reflect the outline features of the target object.

[0054] In this step, the distribution characteristics of the remaining non-transparent pixel groups are analyzed, and their extreme coordinate information is extracted to determine the object boundary information of the target item. For example, each remaining non-transparent pixel group is traversed, and the x-coordinate and y-coordinate of all non-transparent pixels are extracted. The minimum and maximum values ​​of the x-coordinate and y-coordinate are determined. Based on these four extreme coordinates, the smallest bounding region that can encompass all remaining non-transparent pixel groups is constructed. The boundary of this bounding region is the object boundary information of the target item.

[0055] This application embodiment effectively eliminates image edge noise and misjudgments by accurately determining non-transparent areas, calculating the area of ​​connected regions, and filtering isolated pixel groups. This significantly improves the accuracy of subject recognition and boundary stability, and can more accurately obtain object boundary information, providing a reliable basis for subsequent judgment on whether the image matches the effective display area, thereby improving the accuracy and stability of image detection.

[0056] In another embodiment of this application, step S201, determining the non-transparent region corresponding to the target item in the image pixel data, includes: Step S301: For each pixel in the image pixel data, read the Alpha channel value of the pixel; In this embodiment, the Alpha channel value is a parameter used to characterize the transparency state of a pixel, and its value ranges from 0 to 255, where 0 represents complete transparency and 255 represents complete opacity.

[0057] In this step, the pixel array corresponding to the image pixel data is traversed, and the alpha channel value of each pixel is read one by one according to the arrangement of the pixels to obtain the transparency information of each pixel. For example, the image pixel data is stored in the form of an imageData object, and the data property of this object is a one-dimensional array. Every four consecutive elements in the array correspond to the red, green, blue, and alpha channel values ​​of a pixel. By iterating through this array and reading the corresponding value every three elements, the alpha channel value of each pixel can be obtained.

[0058] Step S302: Determine the non-transparent area corresponding to the target item in the image pixel data based on the Alpha channel values ​​of multiple pixels.

[0059] In this embodiment, the non-transparent region refers to the region composed of pixels whose Alpha channel values ​​meet the non-transparent determination criteria. This region is directly related to the actual position and range of the target item.

[0060] In this step, a standard for judging the alpha channel value of non-transparent pixels is pre-set. Based on this standard, the alpha channel values ​​of all pixels are filtered, and the regions corresponding to the pixels that meet the standard are aggregated to form the non-transparent region corresponding to the target item.

[0061] For example, by setting an Alpha channel value greater than 0 as the criterion for determining non-transparent pixels, the Alpha channel values ​​of all pixels are iterated, and pixels with Alpha channel values ​​greater than 0 are marked as non-transparent pixels. Based on this, a transparent boundary mapping is generated, automatically distinguishing the product subject from the background area. This mapping realizes a purely front-end intelligent transparent background recognition function, providing a data foundation for subject detection without back-end intervention, making it lightweight and efficient. Afterwards, the coordinates of all marked non-transparent pixels can be aggregated to form the non-transparent area corresponding to the target item.

[0062] This application embodiment determines non-transparent areas by reading the Alpha channel value of pixels. The implementation method is simple and efficient, and can quickly lock the approximate range of the target object, laying the foundation for further determination of the object boundary information. Moreover, the entire process is executed at the front end, which improves the real-time performance of the detection.

[0063] In another embodiment of this application, step S202, determining the connected region area of ​​a plurality of non-transparent pixel groups in the non-transparent region, includes: Step S401: Perform connected component analysis on each non-transparent pixel in the non-transparent region to obtain multiple non-transparent pixel groups; In this embodiment of the application, connected component analysis refers to an analysis method that groups non-transparent pixels based on the connectivity between pixels. The connectivity includes four-neighbor connectivity (adjacent to each other in the top, bottom, left, and right) and eight-neighbor connectivity (adjacent to each other in the top, bottom, left, right, and diagonal).

[0064] In this step, a connected component analysis algorithm is used to fully scan the non-transparent pixels in the non-transparent region, determine the connectivity between each pixel and its surrounding pixels, and group the interconnected non-transparent pixels into a group to form multiple non-transparent pixel groups.

[0065] For example, using the eight-neighbor connectivity analysis algorithm, the algorithm scans line by line starting from the starting pixel of the non-transparent region. When an unmarked non-transparent pixel is encountered, the pixel is marked and the non-transparent pixels in its eight adjacent directions are found. All connected non-transparent pixels are marked as the same group. The scanning continues until all non-transparent pixels are grouped, resulting in multiple non-transparent pixel groups.

[0066] Step S402: Obtain the number of non-transparent pixels in each non-transparent pixel group, as the area of ​​the connected region of the non-transparent pixel group.

[0067] In this step, pixel counts are performed on each non-transparent pixel group obtained through connected component analysis, and the number of non-transparent pixels contained in each non-transparent pixel group is counted. This number is the connected component area of ​​the non-transparent pixel group.

[0068] For example: Assign a unique identifier to each non-transparent pixel group, traverse all marked non-transparent pixels within the non-transparent region, classify and count the pixels according to the identifier, and the total number of pixels corresponding to each identifier is the area of ​​the connected region of the non-transparent pixel group corresponding to that identifier.

[0069] This application embodiment divides non-transparent pixel groups by connected component analysis and counts the area of ​​connected components, which can accurately distinguish between pixel groups corresponding to target items and isolated pixel groups, providing data support for subsequent filtering of isolated pixels and helping to improve the accuracy of determining item boundary information.

[0070] In another embodiment of this application, step S204 determines the item boundary information of the target item based on the remaining non-transparent pixel group in the non-transparent region, including: Step S501: Determine the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate, and maximum vertical coordinate of the remaining non-transparent pixel group in the non-transparent region; In this embodiment, the horizontal coordinate is a coordinate parameter used to represent the position of a pixel in the horizontal direction of the image, and the vertical coordinate is a coordinate parameter used to represent the position of a pixel in the vertical direction of the image. The minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate, and maximum vertical coordinate refer to the extreme coordinates of all pixels in the remaining non-transparent pixel group in the horizontal and vertical directions.

[0071] In this step, all non-transparent pixels in the remaining non-transparent pixel group are traversed, and the x-coordinate and y-coordinate of each pixel are recorded. The minimum and maximum values ​​of the x-coordinate and the minimum and maximum values ​​of the y-coordinate are then selected.

[0072] For example: Initialize the minimum x-coordinate to the maximum possible value in the horizontal direction of the image and the maximum x-coordinate to 0; initialize the minimum y-coordinate to the maximum possible value in the vertical direction of the image and the maximum y-coordinate to 0; traverse each pixel of the remaining non-transparent pixel group, compare the x-coordinate of the current pixel with the recorded minimum and maximum x-coordinates and update them; similarly update the extreme values ​​of the y-coordinates, and finally obtain the minimum x-coordinate, maximum x-coordinate, minimum y-coordinate and maximum y-coordinate of the remaining non-transparent pixel group.

[0073] Step S502: Determine the minimum bounding rectangle of the target item based on the minimum x-coordinate, the maximum x-coordinate, the minimum y-coordinate, and the maximum y-coordinate; In this embodiment, the minimum bounding rectangle refers to the smallest rectangle that can completely contain the remaining non-transparent pixel group, and its boundary is determined by the extreme coordinates of the remaining non-transparent pixel group.

[0074] In this step, the minimum x-coordinate is used as the left boundary coordinate of the rectangle, the maximum x-coordinate is used as the right boundary coordinate of the rectangle, the minimum y-coordinate is used as the lower boundary coordinate of the rectangle, and the maximum y-coordinate is used as the upper boundary coordinate of the rectangle, thus constructing the minimum bounding rectangle of the target item.

[0075] For example, using the minimum x1, maximum x2, minimum y1, and maximum y2 obtained from the filtering as parameters, construct a rectangle with left boundary x=x1, right boundary x=x2, lower boundary y=y1, and upper boundary y=y2. This rectangle is the smallest bounding rectangle that can completely contain all the remaining non-transparent pixel groups.

[0076] Step S503: Determine the object boundary information of the target object based on the minimum bounding rectangle.

[0077] In this embodiment of the application, the object boundary information is the core information used to determine the position and range of the target object in the image, including boundary coordinates, region size, etc.

[0078] In this step, the boundary parameters and size parameters of the constructed minimum bounding rectangle are used as the object boundary information of the target object, clarifying the specific location and range of the target object in the image.

[0079] For example, the coordinates of the left, right, lower, and upper boundaries of the smallest bounding rectangle are used as the coordinate information of the object boundary. The difference between the right and left boundary coordinates is used as the width of the object boundary, and the difference between the upper and lower boundary coordinates is used as the height of the object boundary. The above coordinate information and size information together constitute the object boundary information of the target object.

[0080] This application embodiment determines the minimum bounding rectangle by extreme coordinates, thereby obtaining the object boundary information, which can accurately delineate the range of the target object and provide an accurate basis for subsequent matching judgment between the image and the effective display area.

[0081] In another embodiment of this application, after step S201 determines the non-transparent area corresponding to the target item in the image pixel data, the method further includes: Step S601: Obtain the Alpha channel values ​​of multiple pixels located outside the object boundary information in the image pixel data; In this embodiment, pixels outside the object boundary information refer to pixels not covered by the non-transparent area corresponding to the target object, i.e., pixels corresponding to the background area of ​​the image.

[0082] In this step, the object boundary information of the target object is first determined, the range of the background area is defined based on the boundary information, and then the Alpha channel values ​​of multiple pixels in the background area are extracted from the image pixel data.

[0083] For example: initially determine the boundary information of the object as a rectangular area, use the boundary of the rectangular area as a reference to define the background area outside the rectangular area, traverse the pixels within the background area, extract the Alpha channel value of each pixel and record it.

[0084] Step S602: Determine the number of transparent pixels whose Alpha channel value corresponds to the transparent pixel value; In this embodiment, the transparency channel value refers to the Alpha channel value that represents the completely transparent state of a pixel, and is usually set to 0. A transparent pixel is a pixel whose Alpha channel value is equal to the transparency channel value.

[0085] In this step, a specific value for the transparency channel is set, and the extracted alpha channel value is compared with this transparency channel value. The number of pixels whose alpha channel values ​​match the transparency channel value is then counted. For example, if the transparency channel value is set to 0, the alpha channel values ​​of the extracted background region pixels are iterated through, and each alpha channel value is compared with 0. The total number of pixels that match the comparison result is then counted, which gives the number of transparent pixels.

[0086] Step S603: If the number of transparent pixels accounts for more than a preset ratio threshold of all pixels in the image pixel data, the object image is determined to be a transparent background image, and the step of determining the connected region area of ​​multiple non-transparent pixel groups in the non-transparent area is executed.

[0087] In this embodiment of the application, the preset ratio threshold is a ratio standard used to determine whether an object image is a transparent background image. A transparent background image refers to an image in which the background area is mainly transparent.

[0088] In this step, the ratio of the number of transparent pixels to the total number of pixels in the image pixel data is calculated. This ratio is then compared with a preset ratio threshold. If the ratio exceeds the preset ratio threshold, the image is determined to be a transparent background image, and the subsequent steps for determining the area of ​​the connected components are performed.

[0089] For example: If the total number of pixels in the image pixel data is 10,000, the number of transparent pixels is 1,800, the preset ratio threshold is 15%, and the calculated ratio is 18%, which exceeds the preset threshold, the image of the item is determined to be a transparent background image, and the step of determining the area of ​​the connected components of multiple non-transparent pixel groups in the non-transparent area is executed.

[0090] This application embodiment determines whether the object image has a transparent background, ensuring that subsequent steps such as connected component area calculation are only performed on transparent background images. This improves the algorithm's targeting and effectiveness, avoids unnecessary processing of non-transparent background images, and enhances overall detection efficiency.

[0091] In another embodiment of this application, step S103, determining whether the item image matches the valid display area of ​​the item promotion position based on the item boundary information, includes: Step S701: Determine whether the item image is located within the valid display area of ​​the item promotion position based on the item boundary information; In this step, the coordinate range corresponding to the item boundary information is compared with the coordinate range of the effective display area of ​​the item promotion position to determine whether the coordinate range corresponding to the item boundary information is completely within the coordinate range of the effective display area.

[0092] For example: the coordinate range of the effective display area of ​​the item promotion position is left boundary x=a, right boundary x=b, lower boundary y=c, upper boundary y=d, and the coordinate range of the item boundary information is left boundary x=a1, right boundary x=b1, lower boundary y=c1, upper boundary y=d1. If a≤a1, b1≤b, c≤c1, d1≤d, then the item image is determined to be within the effective display area of ​​the item promotion position.

[0093] Step S702: If the item image is located within the effective display area of ​​the item promotion position, determine whether the margin ratio between the item image and the effective display area of ​​the item promotion position is greater than a preset margin ratio threshold based on the item boundary information. In this embodiment, the margin ratio refers to the ratio of the distance between the edge of the item image and the boundary of the effective display area of ​​the item promotion position to the corresponding side length of the effective display area. The preset margin ratio threshold refers to a pre-set ratio standard used to determine whether the margin meets the requirements.

[0094] In this step, the distance between each edge of the item image and the corresponding boundary of the effective display area is calculated, and the ratio of each distance to the corresponding side length of the effective display area is calculated. Each ratio is then compared with a preset margin ratio threshold to determine whether all of them are greater than the threshold.

[0095] For example: the width of the effective display area is W=ba and the height is H=dc. The distance between the left edge of the item image and the left boundary of the effective display area is L1=a1-a, the distance between the right edge and the right boundary is L2=b-b1, the distance between the top edge and the top boundary is L3=d-d1, and the distance between the bottom edge and the bottom boundary is L4=c1-c. The margin ratios are calculated as L1 / W, L2 / W, L3 / H, and L4 / H. If each ratio is greater than the preset margin ratio threshold, it is determined to meet the requirements.

[0096] If the item image is located outside the effective display area of ​​the item promotion position, it is determined that the item image does not match the effective display area of ​​the item promotion position, and the process ends without needing to execute step S703.

[0097] Step S703: If the margin ratio between the item image and the effective display area of ​​the item promotion position is greater than a preset margin ratio threshold, it is determined that the item image matches the effective display area of ​​the item promotion position.

[0098] In this embodiment of the application, matching the item image with the effective display area means that the item image is not only located within the effective display area, but also that the margin ratio between the item image and the boundary of the effective display area meets the preset standard and satisfies the specifications for promotion and display.

[0099] In this step, after confirming that the position and margin ratio of the item image meet the requirements in the aforementioned two steps, a determination is made that the item image matches the effective display area of ​​the item promotion position.

[0100] For example: If it is determined that the item image is completely within the effective display area and the margin ratio of each side is greater than the preset margin ratio threshold, the item image is determined to match the effective display area of ​​the item promotion position based on the two judgment results.

[0101] If the margin ratio between the item image and the effective display area of ​​the item promotion position is less than or equal to a preset margin ratio threshold, it is determined that the item image and the effective display area of ​​the item promotion position do not match.

[0102] This application embodiment determines the matching status of an item image with an effective display area in two steps: first, it determines whether the item is within the area, and then it determines whether the margin ratio meets the requirements. This ensures the accuracy of the matching judgment, effectively filters out item images that meet the requirements for promotion and display, and improves the display effect of item promotion.

[0103] In another embodiment of this application, an image detection device is also provided, such as... Figure 2 As shown, it includes: The acquisition module 11 is used to acquire the image pixel data corresponding to the image of the target item; The first determining module 12 is used to determine the object boundary information of the target object in the image pixel data, wherein the object boundary information is determined after filtering isolated pixels around the target object in the image pixel data; The second determining module 13 is used to determine whether the item image matches the effective display area of ​​the item promotion position based on the item boundary information. The third determining module 14 is used to determine that the image detection has passed if the item image matches the effective display area of ​​the item promotion position.

[0104] Optionally, the first determining module includes: The first determining unit is configured to determine the non-transparent area corresponding to the target item in the image pixel data; The second determining unit is used to determine the area of ​​the connected domain of multiple non-transparent pixel groups in the non-transparent region; The filtering unit is used to filter out non-transparent pixel groups whose connected region area is less than a preset threshold. The third determining unit is used to determine the object boundary information of the target object based on the remaining non-transparent pixel group in the non-transparent region.

[0105] Optionally, the first determining unit includes: The reading subunit is used to read the Alpha channel value of each pixel in the image pixel data; The first determining subunit is used to determine the non-transparent area corresponding to the target item in the image pixel data based on the Alpha channel values ​​of multiple pixels.

[0106] Optionally, the second determining unit includes: An analysis subunit is used to perform connected component analysis on each non-transparent pixel in the non-transparent region to obtain multiple non-transparent pixel groups; A sub-unit is used to obtain the number of non-transparent pixels contained in each of the non-transparent pixel groups, so as to serve as the area of ​​the connected region of the non-transparent pixel group.

[0107] Optionally, the third determining unit includes: The second determining subunit is used to determine the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate, and maximum vertical coordinate of the remaining non-transparent pixel group in the non-transparent region; The third determining subunit is used to determine the minimum bounding rectangle of the target item based on the minimum abscissa, the maximum abscissa, the minimum ordinate, and the maximum ordinate. The fourth determining subunit is used to determine the item boundary information of the target item based on the minimum bounding rectangle.

[0108] Optionally, after the first determining unit, the device further includes: The acquisition unit is used to acquire the Alpha channel values ​​of multiple pixels located outside the object boundary information in the image pixel data; The fourth determining unit is used to determine the number of transparent pixels whose alpha channel value corresponds to the transparent pixel value; The fifth determining unit is used to determine that the object image is a transparent background image if the proportion of the number of transparent pixels to all pixels in the image pixel data exceeds a preset proportion threshold, and to perform the step of determining the area of ​​the connected region of multiple non-transparent pixel groups in the non-transparent region.

[0109] Optionally, the second determining module includes: The sixth determining unit is used to determine whether the item image is located within the effective display area of ​​the item promotion position based on the item boundary information; The seventh determining unit is used to determine, based on the item boundary information, whether the margin ratio between the item image and the effective display area of ​​the item promotion position is greater than a preset margin ratio threshold if the item image is located within the effective display area of ​​the item promotion position. The eighth determining unit is used to determine that the item image matches the effective display area of ​​the item promotion position if the margin ratio between the item image and the effective display area of ​​the item promotion position is greater than a preset margin ratio threshold.

[0110] In another embodiment of this application, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. Memory, used to store computer programs; The processor, when executing a program stored in memory, implements the image detection method described in any of the foregoing method embodiments.

[0111] The electronic device provided in this invention allows the processor to execute a program stored in the memory, enabling the front-end technology to directly acquire image pixel data of an object image. After filtering isolated pixels around the target object in the image pixel data, the device determines the object boundary information and then determines whether the object boundary information matches the effective display area to obtain the image detection result. This achieves automatic image review without the need for manual review of each image against specifications, improving image review efficiency, reducing labor costs, and enhancing detection accuracy.

[0112] The communication bus 1140 mentioned in the above-mentioned electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus 1140 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0113] The communication interface 1120 is used for communication between the above-mentioned electronic device and other devices.

[0114] The memory 1130 may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0115] The processor 1110 mentioned above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0116] In another embodiment of this application, a computer-readable storage medium is provided, on which a program for an image detection method is stored, wherein when the image detection method program is executed by a processor, it implements the steps of the image detection method described in any of the foregoing method embodiments.

[0117] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0118] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. An image detection method, characterized in that, include: Obtain the image pixel data corresponding to the image of the target item; The object boundary information of the target object is determined from the image pixel data. The object boundary information is determined after filtering out isolated pixels around the target object in the image pixel data. Based on the item boundary information, determine whether the item image matches the effective display area of ​​the item promotion position; If the item image matches the valid display area of ​​the item promotion position, the image detection is deemed successful.

2. The image detection method according to claim 1, characterized in that, Determining the object boundary information of the target object from the image pixel data includes: Determine the non-transparent area corresponding to the target item in the image pixel data; Determine the area of ​​the connected components of multiple groups of non-transparent pixels in the non-transparent region; Filter out non-transparent pixel groups whose connected component area is less than a preset threshold; The object boundary information of the target object is determined based on the remaining non-transparent pixel group in the non-transparent region.

3. The image detection method according to claim 2, characterized in that, Determining the non-transparent region corresponding to the target item in the image pixel data includes: For each pixel in the image pixel data, read the Alpha channel value of that pixel; The non-transparent area corresponding to the target item is determined in the image pixel data based on the alpha channel values ​​of multiple pixels.

4. The image detection method according to claim 2, characterized in that, Determining the area of ​​the connected components of multiple groups of non-transparent pixels in the non-transparent region includes: Perform connected component analysis on each non-transparent pixel in the non-transparent region to obtain multiple non-transparent pixel groups; The number of non-transparent pixels contained in each of the non-transparent pixel groups is obtained as the area of ​​the connected region of the non-transparent pixel group.

5. The image detection method according to claim 2, characterized in that, The object boundary information of the target object is determined based on the remaining non-transparent pixel group in the non-transparent region, including: Determine the minimum x-coordinate, maximum x-coordinate, minimum y-coordinate, and maximum y-coordinate of the remaining non-transparent pixel group in the non-transparent region; The minimum bounding rectangle of the target item is determined based on the minimum x-coordinate, the maximum x-coordinate, the minimum y-coordinate, and the maximum y-coordinate. The object boundary information of the target object is determined based on the minimum bounding rectangle.

6. The image detection method according to claim 2, characterized in that, After determining the non-transparent region corresponding to the target item in the image pixel data, the method further includes: Obtain the Alpha channel values ​​of multiple pixels located outside the object boundary information in the image pixel data; Determine the number of transparent pixels whose alpha channel value corresponds to the alpha channel value of the transparent pixel; If the number of transparent pixels accounts for more than a preset threshold of all pixels in the image pixel data, the image of the item is determined to be a transparent background image, and the step of determining the area of ​​the connected components of multiple non-transparent pixel groups in the non-transparent region is executed.

7. The image detection method according to claim 1, characterized in that, Determining whether the item image matches the valid display area of ​​the item promotion position based on the item boundary information includes: Determine whether the item image is located within the valid display area of ​​the item promotion position based on the item boundary information; If the item image is located within the effective display area of ​​the item promotion position, determine whether the margin ratio between the item image and the effective display area of ​​the item promotion position is greater than a preset margin ratio threshold based on the item boundary information. If the margin ratio between the item image and the effective display area of ​​the item promotion position is greater than a preset margin ratio threshold, it is determined that the item image matches the effective display area of ​​the item promotion position.

8. An image detection device, characterized in that, include: The acquisition module is used to acquire the image pixel data corresponding to the image of the target item; The first determining module is used to determine the object boundary information of the target object in the image pixel data, wherein the object boundary information is determined after filtering isolated pixels around the target object in the image pixel data; The second determining module is used to determine whether the item image matches the effective display area of ​​the item promotion position based on the item boundary information. The third determining module is used to determine that the image detection has passed if the item image matches the effective display area of ​​the item promotion position.

9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in a memory, implements the image detection method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program for an image detection method, which, when executed by a processor, implements the steps of the image detection method according to any one of claims 1-7.