Edge detection processing method, device, equipment and storage medium

By obtaining the transparency value of each pixel and its adjacent pixels in the image, and judging whether the pixel is a transparent edge point based on preset conditions, the cross detection method is used to solve the problem of high edge detection complexity in the existing technology and improve processing efficiency and achieves precise detection of edges.

CN111768422BActive Publication Date: 2024-10-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010046585.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-16
Publication Date
2024-10-18
Estimated Expiration
2040-01-16

AI Technical Summary

Technical Problem

The edge detection methods in the existing technology are computationally complex and have low processing efficiency, and cannot effectively improve the efficiency of image processing.

Method used

By obtaining the transparency value of each pixel in the image and the transparency value of its adjacent pixels, it is judged whether the pixel is a transparent edge point based on preset judgment conditions, and the cross detection method is used to reduce the computational complexity.

Benefits of technology

It effectively improves the processing efficiency of edge detection, reduces the computational complexity, and achieves accurate edge detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111768422B_ABST
    Figure CN111768422B_ABST
Patent Text Reader

Abstract

The present application provides a processing method, device, equipment and storage medium for edge detection, the method comprising: obtaining original image data; for each pixel in the original image data, obtaining the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel; judging whether the pixel belongs to a transparent edge point according to the transparency value of the pixel and the transparency values ​​of each other pixel; obtaining transparent edge data according to the judgment result of each pixel in the original image data. The image edge can be accurately and effectively detected so that the edge can be processed accordingly in subsequent rendering, effectively reducing the computational complexity and improving the processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a processing method, device, equipment and storage medium for edge detection. Background Art

[0002] In image processing, edge detection is a common image processing method. The principle of edge detection is to use some edge detection operators to perform convolution operations on the image.

[0003] In the prior art, edge detection operators such as Roberts, Prewitt, and Sobel are usually used to perform a series of operations on each pixel in an image.

[0004] However, the edge detection method in the prior art is computationally complex and has low processing efficiency. Summary of the invention

[0005] The present application provides an edge detection processing method, device, equipment and storage medium to solve the defects of the prior art such as complex calculation and low processing efficiency.

[0006] The first aspect of the present application provides a processing method for edge detection, comprising:

[0007] Get the original image data;

[0008] For each pixel in the original image data, obtaining a transparency value of the pixel and transparency values ​​of other pixels adjacent to the pixel;

[0009] Determining whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of each of the other pixels;

[0010] The transparent edge data is obtained according to the judgment result of each pixel in the original image data.

[0011] Optionally, obtaining the transparent edge data according to a determination result of each pixel in the original image data includes:

[0012] The identification information of each pixel belonging to the transparent edge point is used as the transparent edge data.

[0013] Optionally, obtaining transparency values ​​of other pixels adjacent to the pixel includes:

[0014] Obtain transparency values ​​of four other pixels adjacent to the four sides of the pixel respectively;

[0015] The determining, according to the transparency value of the pixel and the transparency values ​​of each of the other pixels, whether the pixel is a transparent edge point comprises:

[0016] Based on a preset judgment condition, it is judged whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of the four other pixels.

[0017] Optionally, the preset judgment condition includes: the transparency value of the pixel is 0, and the sum of the transparency values ​​of the other pixels is greater than 0;

[0018] Based on a preset judgment condition, judging whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of the four other pixels includes:

[0019] If the transparency value of the pixel and the transparency values ​​of each of the other pixels meet the preset judgment condition, then determining that the pixel belongs to a transparent edge point;

[0020] Otherwise, it is determined that the pixel does not belong to a transparent edge point.

[0021] Optionally, the identification information of each pixel is the position information of each pixel in the original image.

[0022] Optionally, the method further comprises:

[0023] The original image data is rendered accordingly based on the transparent edge data of the original image.

[0024] A second aspect of the present application provides an edge detection processing device, comprising:

[0025] A first acquisition module, used for acquiring original image data;

[0026] A second acquisition module, used for acquiring, for each pixel in the original image data, a transparency value of the pixel and transparency values ​​of other pixels adjacent to the pixel;

[0027] A judging module, used for judging whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of each of the other pixels;

[0028] The processing module is used to obtain the transparent edge data according to the judgment result of each pixel in the original image data.

[0029] Optionally, the processing module is specifically used to:

[0030] The identification information of each pixel belonging to the transparent edge point is used as the transparent edge data.

[0031] Optionally, the second acquisition module is specifically used to:

[0032] Obtain transparency values ​​of four other pixels adjacent to the four sides of the pixel respectively;

[0033] The judgment module is specifically used for:

[0034] Based on a preset judgment condition, it is judged whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of the four other pixels.

[0035] Optionally, the preset judgment condition includes: the transparency value of the pixel is 0, and the sum of the transparency values ​​of the other pixels is greater than 0;

[0036] The judgment module is specifically used for:

[0037] If the transparency value of the pixel and the transparency values ​​of each of the other pixels meet the preset judgment condition, then determining that the pixel belongs to a transparent edge point;

[0038] Otherwise, it is determined that the pixel does not belong to a transparent edge point.

[0039] Optionally, the identification information of each pixel is the position information of each pixel in the original image.

[0040] Optionally, the processing module is further used to:

[0041] Based on the transparent edge data of the original image, corresponding rendering processing is performed on the original image data.

[0042] A third aspect of the present application provides an electronic device, comprising: at least one processor and a memory;

[0043] The memory stores computer-executable instructions;

[0044] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method described in the first aspect and various possible designs of the first aspect.

[0045] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in the first aspect and various possible designs of the first aspect are implemented.

[0046] The edge detection processing method, device, equipment and storage medium provided by the present application obtain the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel for each pixel in the original image data, and judge whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of each other pixel, and obtain transparent edge data according to the judgment result of each pixel in the original image data, so that the edge can be processed accordingly in subsequent rendering. Since the cross detection method is adopted, it is only necessary to calculate the transparency value of the pixels adjacent to the middle pixel to determine whether the middle pixel point is a transparent edge pixel, which effectively reduces the calculation complexity and improves the processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0048] Figure 1 A schematic diagram of the processing system architecture on which the embodiments of the present application are based;

[0049] Figure 2 A schematic diagram of a process flow of an edge detection processing method provided in an embodiment of the present application;

[0050] Figure 3 A schematic diagram of a cross convolution kernel provided in one embodiment of the present application;

[0051] Figure 4 A schematic diagram of a process flow of an edge detection method provided by another embodiment of the present application;

[0052] Figure 5 A schematic diagram of performing convolution calculation based on a cross convolution kernel provided in one embodiment of the present application;

[0053] Figure 6 A schematic diagram of the structure of an edge detection processing device provided in one embodiment of the present application;

[0054] Figure 7 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application.

[0055] The above drawings have shown clear embodiments of the present application, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0057] First, the terms involved in this application are explained:

[0058] Shader: A shader is a programmable shading program that works on the GPU.

[0059] Vertex Shader: Vertex shader, fully programmable, used to implement vertex space transformation, vertex shading and other functions.

[0060] Fragment Shader: Fragment shader, fully programmable, used to implement shading operations on a per-fragment basis.

[0061] Draw Call: The CPU calls a graphics programming interface, such as DirectX or OpenGL, to instruct the GPU to perform rendering operations.

[0062] GPU: Graphics Processing Unit, also known as display core, visual processor, display chip, is a microprocessor dedicated to performing image and graphics related calculations on personal computers, workstations, game consoles and some mobile devices (such as tablets, smart phones, etc.).

[0063] The edge detection processing method provided in the embodiment of the present application is applicable to the application scenario of edge detection of an image in a GPU. Figure 1 FIG. 1 is a schematic diagram of the processing system architecture based on the embodiment of the present application. The processing system may include a CPU and a GPU, and the CPU calls a graphics programming interface to command the GPU to perform a rendering operation. The edge detection processing method provided in the embodiment of the present application acts on the image rendering process in the GPU, specifically on Figure 1The CPU sends the original image data to the GPU through the graphics programming interface. The GPU obtains the original image data, obtains the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel for each pixel in the original image data, and determines whether the pixel belongs to a transparent edge point according to the transparency value of the pixel and the transparency values ​​of each other pixel. According to the judgment result of each pixel in the original image data, the transparent edge data is obtained, and the rendering operation is performed based on the transparent edge data to obtain the screen image and display it on the terminal screen. That is, the transparent edge detection processing based on the cross detection rule is realized. It is only necessary to determine whether each pixel is an edge based on the transparency of each pixel of the original image and its adjacent pixels, which effectively reduces the calculation complexity and improves the processing efficiency. It solves the technical problems that the edge detection of the prior art needs to collect many pixels, the calculation is complex, the efficiency is low, the detection is not fine enough, and it depends on the gradient difference condition between the pixel transparency, which is not accurate enough. It should be noted that the method of the embodiment of the present application is not limited to the above-mentioned GPU scenario, but can also be other feasible scenarios.

[0064] In addition, the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following embodiments, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.

[0065] The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0066] Embodiment 1

[0067] This embodiment provides an edge detection processing method for transparent edge detection of an image. The execution subject of this embodiment is an edge detection processing device, which can be set in an electronic device, specifically a terminal device such as a mobile phone, a tablet computer, a game console, etc.

[0068] like Figure 2 FIG. 1 is a flow chart of a method for edge detection provided in this embodiment, the method comprising:

[0069] Step 101, obtaining original image data.

[0070] Specifically, when a terminal device displays an image, a rendering operation needs to be performed. The terminal device can obtain original image data. The original image data may include pixel data describing the original image. The pixel data includes four channel values ​​of RGBA, where R, G, B, and A represent Red, Green, Blue, and Alpha (transparency value), respectively, and RGBA represents the color space of Red, Green, Blue, and Alpha.

[0071] Exemplarily, the CPU of the terminal device may call a graphics programming interface to transfer the original image data to the GPU, and the GPU may obtain the original image data.

[0072] After the original image data is acquired, edge detection processing can be performed on the original image data based on a preset cross detection rule to obtain a detection result.

[0073] Exemplarily, the cross detection rule may be a detection rule based on a cross edge detection operator, and the original image data is convolved based on the cross edge detection operator. The cross edge detection operator may also be called a cross convolution kernel, and may include five parts corresponding to five pixels in the image, such as Figure 3 As shown in FIG. 1 , it is a schematic diagram of the cross convolution kernel provided in this embodiment. The five pixels corresponding to the cross convolution kernel are the pixels to be detected ( Figure 3 The pixel point of the middle cross) and 4 auxiliary pixels ( Figure 3 For each pixel in the original image data, it is used as the pixel to be detected, and the pixel to be detected is convolved based on the cross convolution kernel to determine whether the pixel to be detected is an edge point. Each pixel in the original image data is traversed to determine whether each pixel is an edge point to obtain the detection result.

[0074] The detection result may include edge data belonging to edge points in the original image data, the edge data includes identification information of each pixel belonging to edge points in the original image data, or may include identification information of each pixel in the original image data and attributes corresponding to each identification information, and the attributes may include edge and non-edge. The identification information may be the position information of the pixel in the original image, such as the coordinates in the original image, or may be information that can be mapped to the corresponding position in the original image, or may be other information that can identify each pixel, which may be set according to actual needs.

[0075] Step 102, for each pixel in the original image data, obtaining the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel;

[0076] Step 103: judging whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of other pixels.

[0077] Step 104, obtaining transparent edge data according to the judgment result of each pixel in the original image data.

[0078] Specifically, the original image data can be processed for transparent edge detection to obtain transparent edge data of the original image. Specifically, for each pixel in the original image data, as a pixel to be detected (also referred to as a target pixel), the transparency value of the target pixel and the transparency values ​​of other pixels adjacent to the target pixel can be obtained, and whether the target pixel belongs to a transparent edge point can be determined based on the transparency value of the target pixel and the transparency values ​​of each other pixel. By traversing each pixel in the original image data as a target pixel, the attributes of each pixel in the original image data can be determined, that is, whether each pixel belongs to a transparent edge point can be determined, and the transparent edge data can be obtained based on the judgment result of each pixel. The transparent edge data can include identification information of each pixel belonging to a transparent edge point.

[0079] The transparency value of a pixel is the alpha channel value of the pixel, which can be obtained from the original image data.

[0080] Optionally, the transparent edge data may include fully transparent edge data or semi-transparent edge data etc. according to actual needs, and may be specifically set according to actual needs, which is not limited in this embodiment.

[0081] The edge detection processing method provided in this embodiment obtains the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel for each pixel in the original image data, and judges whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of each other pixel. According to the judgment result of each pixel in the original image data, transparent edge data is obtained so that the edge can be processed accordingly in subsequent rendering. Since the cross detection method is adopted, it is only necessary to calculate the transparency values ​​of the pixels adjacent to the middle pixel to determine whether the middle pixel point is a transparent edge pixel, which effectively reduces the calculation complexity and improves the processing efficiency.

[0082] Embodiment 2

[0083] This embodiment further supplements the method provided in the first embodiment.

[0084] like Figure 4 , which is a flow chart of the edge detection processing method provided in this embodiment.

[0085] As an implementable manner, based on the above embodiment, optionally, obtaining transparent edge data according to the judgment result of each pixel in the original image data may specifically include:

[0086] Step 1041: Use identification information of each pixel belonging to a transparent edge point as transparent edge data.

[0087] As an implementable manner, based on the above embodiment, optionally, obtaining transparency values ​​of other pixels adjacent to the pixel may specifically include:

[0088] Step 2011, obtaining transparency values ​​of four other pixels adjacent to the four sides of the pixel respectively.

[0089] Accordingly, judging whether a pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of other pixels may specifically include:

[0090] Step 1031 , based on a preset judgment condition, according to the transparency value of the pixel and the transparency values ​​of four other pixels, it is determined whether the pixel is a transparent edge point.

[0091] Specifically, the transparency values ​​of four other pixels adjacent to the four sides of the pixel to be detected (i.e., the target pixel) can be obtained, as shown above. Figure 3 The transparency values ​​of the four other pixels adjacent to the "upper", "lower", "left" and "right" of the target pixel, that is, the Alpha channel value.

[0092] For example, Figure 5 As shown, it is a schematic diagram of convolution calculation based on a cross convolution kernel provided in this embodiment. The original image data takes an 8×8 image as an example, and convolution calculation is performed based on a cross convolution kernel. In the actual processing process, the original image can be an image of any size. This is only an exemplary description and not a limitation.

[0093] Optionally, the preset judgment condition may include: the transparency value of the pixel (target pixel) is 0, and the sum of the transparency values ​​of other pixels is greater than 0, as follows:

[0094] a. The transparency value of the target pixel Alpha (middle) = 0.

[0095] b. Alpha(upper)+Alpha(lower)+Alpha(left)+Alpha(right)>0. Alpha(upper), Alpha(lower), Alpha(left), and Alpha(right) respectively represent the alpha channel values ​​of other pixels adjacent to the target pixel above, below, left, and right.

[0096] Accordingly, based on the preset judgment condition, judging whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of four other pixels may specifically include:

[0097] If the transparency value of the pixel and the transparency values ​​of each other pixel meet the preset judgment condition, it is determined that the pixel belongs to a transparent edge point;

[0098] Otherwise, it is determined that the pixel does not belong to a transparent edge point.

[0099] Specifically, the target pixel is determined to be a transparent edge point if and only if a and b are satisfied at the same time. Among them, condition a indicates that the target pixel is a fully transparent point, and condition b indicates that other pixels adjacent to the target pixel are not fully transparent points. When both conditions are satisfied, it can be determined that the target pixel is a transparent edge point.

[0100] Optionally, the identification information of each pixel is the position information of each pixel in the original image.

[0101] The edge detection processing method provided in the embodiment of the present application performs convolution calculation on the original image data based on the cross detection operator. For the judgment of each pixel, the edge pixel point can be detected quickly and efficiently using only 5 pixels including the pixel and simple addition and subtraction operations, which effectively reduces the calculation complexity and improves the image processing efficiency. Moreover, since the detection accuracy is based on pixels, the width edge of the pixel level can be accurately controlled and detected.

[0102] As another practicable manner, based on the above embodiment, optionally, the method may further include:

[0103] Step 105 : performing corresponding rendering processing on the original image data based on the transparent edge data of the original image.

[0104] Specifically, after edge detection is performed on the original image data to obtain the detection result, rendering processing can be performed based on the detection result. Specifically, the original image data is rendered accordingly based on the edge transparency data of the original image. For example, stroke processing, blur processing, edge anti-aliasing processing, etc. can be performed. The specific processing can be performed according to actual needs, and this embodiment does not limit it.

[0105] For example, if the background of the ID photo is transparent, the transparent edge data of the portrait can be obtained through edge detection, and when rendering, the portrait can be stroked according to the transparent edge data.

[0106] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any manner without conflict, and this application is not limited thereto.

[0107] The edge detection processing method provided in the present embodiment obtains the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel for each pixel in the original image data, and determines whether the pixel is a transparent edge point based on the transparency value of the pixel and the transparency values ​​of each other pixel. According to the judgment result of each pixel in the original image data, transparent edge data is obtained so that the edge can be processed accordingly for subsequent rendering. Since the cross detection method is adopted, it is only necessary to calculate the transparency values ​​of the pixels adjacent to the middle pixel to determine whether the middle pixel point is a transparent edge pixel, which effectively reduces the calculation complexity and improves the processing efficiency. Moreover, since the detection accuracy is based on pixels, the width edge of the pixel level can be accurately controlled and detected.

[0108] Embodiment 3

[0109] This embodiment provides an edge detection processing device, which is used to execute the edge detection processing method of the above embodiment.

[0110] like Figure 6 , which is a schematic diagram of the structure of the edge detection processing device provided in this embodiment. The edge detection processing device 30 includes a first acquisition module 31, a second acquisition module 32, a judgment module 33 and a processing module 34.

[0111] Among them, the first acquisition module is used to acquire the original image data; the second acquisition module is used to acquire the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel for each pixel in the original image data; the judgment module is used to judge whether the pixel belongs to a transparent edge point according to the transparency value of the pixel and the transparency values ​​of each of the other pixels; the processing module is used to obtain the transparent edge data according to the judgment result of each pixel in the original image data.

[0112] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0113] According to the edge detection processing device provided by the present embodiment, by obtaining the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel for each pixel in the original image data, it is determined whether the pixel is a transparent edge point based on the transparency value of the pixel and the transparency values ​​of each other pixel, and transparent edge data is obtained based on the judgment result of each pixel in the original image data, so that the edge can be processed accordingly for subsequent rendering. Since the cross detection method is adopted, it is only necessary to calculate the transparency values ​​of the pixels adjacent to the middle pixel to determine whether the middle pixel point is a transparent edge pixel, which effectively reduces the calculation complexity and improves the processing efficiency.

[0114] Embodiment 4

[0115] This embodiment further supplements the edge detection processing device provided in the above embodiment.

[0116] As an implementable manner, based on the above embodiment, optionally, the processing module is specifically used to:

[0117] The identification information of each pixel belonging to the transparent edge point is used as the transparent edge data.

[0118] Optionally, the second acquisition module is specifically used to:

[0119] Get the transparency values ​​of the four other pixels adjacent to the four sides of the pixel.

[0120] The judgment module is specifically used for:

[0121] Based on the preset judgment conditions, it is determined whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of four other pixels.

[0122] Optionally, the preset judgment condition includes: the transparency value of the pixel is 0, and the sum of the transparency values ​​of other pixels is greater than 0.

[0123] The judgment module is specifically used for:

[0124] If the transparency value of the pixel and the transparency values ​​of each other pixel meet the preset judgment condition, it is determined that the pixel belongs to a transparent edge point; otherwise, it is determined that the pixel does not belong to a transparent edge point.

[0125] Optionally, the identification information of each pixel is the position information of each pixel in the original image.

[0126] As another practicable manner, based on the above embodiment, optionally, the processing module is further configured to:

[0127] Based on the transparent edge data of the original image, the original image data is rendered accordingly.

[0128] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0129] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any manner without conflict, and this application is not limited thereto.

[0130] According to the edge detection processing device of the present embodiment, for each pixel in the original image data, the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel are obtained, and whether the pixel is a transparent edge point is determined based on the transparency value of the pixel and the transparency values ​​of each other pixel. According to the judgment result of each pixel in the original image data, transparent edge data is obtained so that the edge can be processed accordingly for subsequent rendering. Since the cross detection method is adopted, it is only necessary to calculate the transparency values ​​of the pixels adjacent to the middle pixel to determine whether the middle pixel point is a transparent edge pixel, which effectively reduces the calculation complexity and improves the processing efficiency. Moreover, since the detection accuracy is based on pixels, the width edge of the pixel level can be accurately controlled and detected.

[0131] Embodiment 5

[0132] This embodiment provides an electronic device, which is used to execute the method provided in the above embodiment.

[0133] like Figure 7 FIG. 5 is a schematic diagram of the structure of an electronic device provided in this embodiment. The electronic device 50 includes: at least one processor 51 and a memory 52 .

[0134] The memory stores computer-executable instructions; at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method provided in any of the above embodiments.

[0135] According to the electronic device of this embodiment, by obtaining the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel for each pixel in the original image data, it is determined whether the pixel is a transparent edge point based on the transparency value of the pixel and the transparency values ​​of each other pixel, and transparent edge data is obtained based on the judgment result of each pixel in the original image data, so that the edge can be processed accordingly for subsequent rendering. Since the cross detection method is adopted, it is only necessary to calculate the transparency values ​​of the pixels adjacent to the middle pixel to determine whether the middle pixel point is a transparent edge pixel, which effectively reduces the calculation complexity and improves the processing efficiency. Moreover, since the detection accuracy is based on pixels, the width edge of the pixel level can be accurately controlled and detected.

[0136] Embodiment 6

[0137] This embodiment provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method provided in any of the above embodiments is implemented.

[0138] According to the computer-readable storage medium of the present embodiment, by obtaining the transparency value of the pixel and the transparency values ​​of other pixels adjacent to the pixel for each pixel in the original image data, it is determined whether the pixel is a transparent edge point based on the transparency value of the pixel and the transparency values ​​of each other pixel, and transparent edge data is obtained based on the judgment result of each pixel in the original image data, so that the edge can be processed accordingly for subsequent rendering. Since the cross detection method is adopted, it is only necessary to calculate the transparency values ​​of the pixels adjacent to the middle pixel to determine whether the middle pixel point is a transparent edge pixel, which effectively reduces the calculation complexity and improves the processing efficiency. In addition, since the detection accuracy is based on pixels, the width edge detected at the pixel level can be accurately controlled.

[0139] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0140] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0141] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0142] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0143] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A processing method for edge detection, It is characterized in that include: Get the original image data; For each pixel in the original image data, obtain the transparency value of the pixel and the transparency values ​​of four other pixels respectively adjacent to four sides of the pixel; Based on a preset judgment condition, judging whether the pixel is a transparent edge point according to the transparency value of the pixel and the transparency values ​​of the four other pixels; The preset judgment condition includes: the transparency value of the pixel is 0, and the sum of the transparency values ​​of the other pixels is greater than 0; If the transparency value of the pixel and the transparency values ​​of each of the other pixels meet the preset judgment condition, then determining that the pixel belongs to a transparent edge point; Otherwise, determining that the pixel does not belong to a transparent edge point; According to the judgment result of each pixel in the original image data, transparent edge data is obtained.

2. The method according to claim 1, It is characterized in that Obtaining the transparent edge data according to the judgment result of each pixel in the original image data includes: The identification information of each pixel belonging to the transparent edge point is used as the transparent edge data.

3. The method according to claim 2, It is characterized in that The identification information of each pixel is the position information of each pixel in the original image.

4. The method according to any one of claims 1 to 3, It is characterized in that The method further comprises: The original image data is rendered accordingly based on the transparent edge data of the original image.

5. A processing device for edge detection, It is characterized in that include: A first acquisition module, used for acquiring original image data; A second acquisition module is used to acquire, for each pixel in the original image data, a transparency value of the pixel and transparency values ​​of four other pixels respectively adjacent to four sides of the pixel; A judgment module, configured to judge whether the pixel is a transparent edge point based on a preset judgment condition and according to the transparency value of the pixel and the transparency values ​​of the four other pixels; The preset judgment condition includes: the transparency value of the pixel is 0, and the sum of the transparency values ​​of the other pixels is greater than 0; if the transparency value of the pixel and the transparency values ​​of the other pixels meet the preset judgment condition, it is determined that the pixel belongs to a transparent edge point; otherwise, it is determined that the pixel does not belong to a transparent edge point; The processing module is used to obtain transparent edge data according to the judgment result of each pixel in the original image data.

6. The device according to claim 5, It is characterized in that The processing module is specifically used for: The identification information of each pixel belonging to the transparent edge point is used as the transparent edge data.

7. An electronic device, It is characterized in that include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 4.

8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 4 is implemented.