Image morphological processing method and device, computer readable medium and electronic equipment

By sampling the binary image and performing morphological processing based on the sampled values, the problem of low efficiency of morphological image processing and high consumption of computing resources in the existing technology is solved, and more efficient processing and lower power consumption are achieved.

CN118674600APending Publication Date: 2024-09-20XIAN OPPO COMM TECH CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310267692.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-17
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

Existing morphological image processing methods are inefficient, resulting in serious consumption of computing resources on graphics processors and increased power consumption.

Method used

By sampling the binary image, the image sampling values ​​are obtained, and morphological processing is performed based on these sampling values, making full use of the hardware advantages of the texture sampling unit of the graphics processor to reduce the consumption of computing resources.

Benefits of technology

The efficiency of morphological processing is improved, the power consumption of the graphics processor is reduced, and the processing efficiency and user experience are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118674600A
    Figure CN118674600A
Patent Text Reader

Abstract

The invention provides an image morphological processing method and device, a computer readable medium and electronic equipment, and relates to the technical field of image processing. The method comprises the following steps: acquiring a binary image to be processed; carrying out sampling processing on the binary image to obtain an image sampling value; and determining a morphological processing result corresponding to the binary image based on the image sampling value. According to the method, the hardware advantages of the texture sampling unit in the graphics processor are fully utilized, computing resources, consumed during binary image morphological processing, of the graphics processor can be effectively reduced, the binary image morphological processing efficiency is improved, and the power consumption of the graphics processor is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] Morphological Image Processing is one of the most widely used techniques in image processing. It is mainly used to extract image components that are meaningful for expressing and depicting the shape of the region, so that subsequent recognition work can grasp the most essential shape features of the target object, such as boundaries and connected areas. The basic idea of ​​morphology is to use a special structural element to measure or extract the corresponding shape or feature in the input image for further image analysis and target recognition.

[0003] At present, in the related morphological image processing solutions, the efficiency of morphological image processing is low, and the computing resources of the graphics processing unit (GPU) are seriously consumed, thereby increasing the power consumption of the graphics processing unit. Summary of the invention

[0004] The purpose of the present disclosure is to provide an image morphological processing method, an image morphological processing device, a computer-readable medium and an electronic device, thereby effectively improving the efficiency of binary image morphological processing, reducing the computing resources of a graphics processor consumed during binary image morphological processing, and reducing the power consumption of the graphics processor.

[0005] According to a first aspect of the present disclosure, there is provided an image morphological processing method, comprising:

[0006] Get the binary image to be processed;

[0007] Performing sampling processing on the binary image to obtain image sampling values;

[0008] A morphological processing result corresponding to the binary image is determined based on the image sampling value.

[0009] According to a second aspect of the present disclosure, there is provided an image morphological processing device, comprising:

[0010] An image acquisition module, used for acquiring a binary image to be processed;

[0011] An image sampling module, used for performing sampling processing on the binary image to obtain an image sampling value;

[0012] The morphological processing module is used to determine the morphological processing result corresponding to the binary image based on the image sampling value.

[0013] According to a third aspect of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented.

[0014] According to a fourth aspect of the present disclosure, there is provided an electronic device, characterized in that it includes:

[0015] Processor; and

[0016] The memory is used to store one or more programs. When the one or more programs are executed by one or more processors, the one or more processors implement the above method.

[0017] An image morphological processing method provided by an embodiment of the present disclosure can obtain a binary image to be processed, and perform sampling processing on the binary image to obtain image sampling values, and then determine the morphological processing result corresponding to the binary image based on the image sampling values. On the one hand, by sampling and processing the binary image to obtain the image sampling values, and then performing morphological processing through the image sampling values, compared with judging all pixel values, the morphological processing efficiency of the binary image can be effectively improved; on the other hand, by performing morphological processing through the image sampling values, the hardware advantages of the texture sampling unit of the graphics processor can be fully utilized, and while improving the morphological processing efficiency, the consumption of the graphics processor computing resources by the morphological processing process can be effectively reduced, thereby reducing the power consumption of the graphics processor.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0020] Figure 1 A schematic diagram showing an exemplary system architecture to which embodiments of the present disclosure may be applied;

[0021] Figure 2 A schematic diagram schematically illustrates the principle of image morphological processing in a related solution in an exemplary embodiment of the present disclosure;

[0022] Figure 3 A schematic diagram schematically illustrates a flow chart of an image morphology processing method in an exemplary embodiment of the present disclosure;

[0023] Figure 4 A schematic diagram of a process of sampling a binary image in an exemplary embodiment of the present disclosure is schematically shown;

[0024] Figure 5A schematic diagram of a process for determining sampling coordinates in an exemplary embodiment of the present disclosure is schematically shown;

[0025] Figure 6 A schematic diagram schematically shows a principle of determining an image sampling value by a texture sampling unit in an exemplary embodiment of the present disclosure;

[0026] Figure 7 A schematic diagram schematically shows the composition of an image morphological processing device in an exemplary embodiment of the present disclosure;

[0027] Figure 8 A schematic diagram of an electronic device to which the embodiments of the present disclosure can be applied is shown. DETAILED DESCRIPTION

[0028] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0029] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0030] Figure 1 A schematic diagram of a system architecture of an exemplary application environment in which an image morphological processing method and apparatus according to an embodiment of the present disclosure can be applied is shown.

[0031] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal devices 101, 102, 103 may be various electronic devices with image processing functions, including but not limited to desktop computers, portable computers, smart phones, tablet computers, etc. It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.

[0032] The image morphological processing method provided in the embodiment of the present disclosure is generally executed by the terminal devices 101, 102, and 103, and accordingly, the image morphological processing device is generally arranged in the terminal devices 101, 102, and 103. However, it is easy for those skilled in the art to understand that the image morphological processing method provided in the embodiment of the present disclosure can also be executed by the server 105, and accordingly, the image morphological processing device can also be arranged in the server 105, and this is not particularly limited in the present exemplary embodiment. For example, in an exemplary embodiment, a user may obtain a binary image through the terminal devices 101, 102, and 103, and then upload the binary image to the server 105. After the server generates a morphological processing result through the image morphological processing method provided in the embodiment of the present disclosure, the server transmits the morphological processing result to the terminal devices 101, 102, and 103, etc.

[0033] In the relevant morphological image processing scheme, morphological image processing can generally include image erosion operation and image dilation operation. For the sake of convenience, the image erosion operation is taken as an example below. Assume that an image erosion operation is required for a binary image (an image composed of 0 and 1). If the erosion kernel size of the image erosion operation is 5*5, then within the 5*5 pixels centered on the current point (usually), if at least one pixel value is 0, then the result after the current point is eroded is 0, otherwise it is 1, that is, the image erosion operation is equivalent to finding the minimum value within the range of the erosion kernel size.

[0034] Figure 2 The following is a schematic diagram schematically showing the principle of image morphological processing in a related solution in an exemplary embodiment of the present disclosure.

[0035] refer to Figure 2 As shown in the figure, for an image erosion operation of a binary image with an erosion kernel size of 5*5, if the general approach is used on the GPU, each pixel to be processed in the image needs to correspond to a GPU thread, and for each pixel to be processed, the values ​​of the 25 pixels corresponding to the 5*5 kernel are determined one by one. Figure 2In a single image corrosion operation, 25 GPU threads are required to judge the pixel values ​​of pixels 1-25 in the 5*5 core. If the current pixel value is 0, the value of the current pixel to be processed after corrosion is 0, and the processing is completed; if the current pixel value is 1, then the next pixel is judged until all 25 pixels are judged. If the values ​​of all 25 pixels are 1, the value of the current pixel to be processed after corrosion is 1. Each pixel to be processed may need to read the pixel value and judge 25 times at most.

[0036] Therefore, in the current morphological image processing scheme, the efficiency of morphological image processing is low, and the computing resources of the graphics processing unit (GPU) are seriously consumed, thereby increasing the power consumption of the graphics processing unit.

[0037] Based on one or more problems in the related technical solutions, an image morphological processing method is first provided in an embodiment of the present disclosure. Taking the execution of the method by a terminal device as an example, the image morphological processing method and image morphological processing device of the exemplary embodiment of the present disclosure are specifically described below.

[0038] Figure 3 A schematic flow chart of an image morphology processing method in this exemplary embodiment is shown, which may include the following steps S310 to S330:

[0039] In step S310, a binary image to be processed is obtained.

[0040] In an exemplary embodiment, a binary image refers to a situation where there are only two pixel values ​​in the image. For example, the pixel values ​​of a binary image may include 0 and 1. Of course, a binary image may also be a situation where there are other two pixel values. For example, a binary image may include 0 and 255, 100 and 200, etc. This exemplary embodiment does not specifically limit the type of binary image.

[0041] Optionally, any other binary image can be converted into a binary image of 0 and 1 by normalization, and after the morphological image processing, the morphological image processing result can be restored according to the value of the original binary image, which can effectively reduce the amount of calculation and reduce the calculation complexity.

[0042] Specifically, the binary image can be generated during the deep learning process, or it can be stored by itself, or it can be collected or input through a terminal device, or it can be transmitted through other terminal devices that are connected to the current terminal device. This example embodiment does not specifically limit the source of the binary image.

[0043] In step S320, the binary image is sampled to obtain image sampling values.

[0044] In an exemplary embodiment, sampling processing refers to a process of sampling the pixel values ​​of at least two pixels in a binary image. For example, the sampling processing may be bilinear interpolation sampling performed by a texture sampling unit of a graphics processor, and bilinear interpolation is an interpolation method that uses 4 (2*2) points in an original image to calculate a point in a new image; the sampling processing may also be bicubic interpolation sampling, and bicubic interpolation is a difference method that uses 16 (4*4) points in an original image to calculate a point in a new image; of course, the sampling processing may also be other processing processes that can sample the pixel values ​​of at least two pixels in a binary image, and this exemplary embodiment does not specifically limit this.

[0045] An image sampling value refers to a numerical value obtained by performing corresponding interpolation calculations on pixel values ​​obtained through sampling processing. For example, an image sampling value may be a new pixel value obtained by performing bilinear interpolation sampling on pixel points in a binary image, or a new pixel value obtained by performing bicubic interpolation sampling on pixel points in a binary image. This example embodiment does not impose any special limitation on this.

[0046] In step S330, a morphological processing result corresponding to the binary image is determined based on the image sampling value.

[0047] In an exemplary embodiment, the morphological processing result corresponding to the binary image refers to an image obtained by performing corresponding morphological processing on the binary image based on the image sampling values. For example, the morphological processing result can be an eroded image obtained by performing image erosion processing on the binary image based on the image sampling values, or it can be an expanded image obtained by performing image dilation processing on the binary image based on the image sampling values.

[0048] By sampling and processing the binary image to obtain the image sampling value, and then performing morphological processing through the image sampling value, the morphological processing efficiency of the binary image can be effectively improved compared to judging all the pixel values; by performing morphological processing through the image sampling value, the hardware advantages of the texture sampling unit of the graphics processor can be fully utilized, and while improving the morphological processing efficiency, the consumption of the graphics processor computing resources by the morphological processing process can be effectively reduced, thereby reducing the power consumption of the graphics processor.

[0049] Morphological processing may include at least one of image erosion and image dilation. For example, for the same binary image, morphological processing may include only image erosion or only image dilation. Of course, image erosion may be performed on part of the image area in the binary image, and image dilation may be performed on part of the image area. This example embodiment does not make any special limitation on this.

[0050] Below, the steps from step S310 to step S330 are described in detail by taking the example that the morphological processing in the binary image only includes image erosion.

[0051] In an exemplary embodiment, the Figure 4 The steps in the above code implement the sampling process of binary images and obtain the image sampling values. Figure 4 As shown, it may specifically include:

[0052] Step S410, obtaining a morphological processing size, and determining a morphological processing area in the binary image according to the morphological processing size;

[0053] Step S420, determining sampling coordinates based on the morphological processing area;

[0054] Step S430: performing sampling processing on the morphological processing area according to the sampling coordinates to obtain image sampling values.

[0055] The morphological processing size refers to the convolution kernel size set when performing morphological processing on a binary image. For example, the morphological processing size can be 5*5 or 3*3. The morphological processing size can be customized according to actual usage, and this example embodiment does not specifically limit this. For ease of explanation, the following description will be based on the common 5*5 morphological processing size as an example.

[0056] The morphological processing area refers to the image area that needs to be processed by morphological operations and is selected in the binary image based on the morphological processing size. For example, if the morphological processing size is 5*5, then the morphological processing area determined in the binary image can be a 5*5 image area, which contains 25 pixels (pixel values).

[0057] Optionally, you can Figure 5 The steps in step S420 implement the content of determining the sampling coordinates based on the morphological processing area, refer to Figure 5 As shown, it may specifically include:

[0058] Step S510, determining sampling parameters of a texture sampling unit of a graphics processor, wherein the sampling parameters include a sampling size;

[0059] Step S520: divide the morphological processing area into non-overlapping parts according to the sampling size to obtain sampling coordinates.

[0060] The sampling parameters refer to hardware parameters corresponding to the texture sampling unit. The sampling parameters may include a sampling mode of the texture sampling unit or a sampling size of the texture sampling unit. This embodiment does not specifically limit the type of the sampling parameters.

[0061] For example, if the sampling method of the texture sampling unit is bilinear interpolation sampling, then the sampling size of the texture sampling unit can be 2*2; if the sampling method of the texture sampling unit is bicubic interpolation sampling, then the sampling size of the texture sampling unit can be 4*4. This example embodiment is not limited to this.

[0062] The morphological processing area can be divided into non-overlapping areas according to the sampling size of the texture sampling unit to obtain sampling coordinates. Figure 6 A schematic diagram schematically illustrates a principle of determining an image sampling value by a texture sampling unit in an exemplary embodiment of the present disclosure, with reference to Figure 6 As shown, taking the 5*5 image erosion operation on a binary image as an example, if the image erosion kernel is 5*5 in size, then the determined morphological processing area can be 5*5 pixels in the binary image. At this time, if the sampling size of the texture sampling unit is determined to be 2*2, then the 5*5 pixels in the morphological processing area can be divided into non-overlapping areas to obtain 9 sampling points ai, each sampling point corresponds to 4 pixels, and the coordinates of these 4 pixels are the sampling coordinates. Among them, Figure 6 The solid circle marked with numbers in the figure represents the 5*5=25 pixels to be processed currently, and the dotted circle marked with letters represents the 9 sampling points that need to be sampled. The four sampling points a, b, d, and e are all located at the centers of the corresponding four pixels, and the four sampling points c, f, g, and h are all located at the centers of the corresponding two pixels. The i sampling point happens to be pixel 25.

[0063] In an exemplary embodiment, the texture sampling unit can be used for bilinear interpolation sampling, then the sampling size of the texture sampling unit can be 2*2, and the morphological processing area can be bilinearly interpolated based on the determined sampling coordinates to obtain at least one image sampling value.

[0064] Continue to refer Figure 6 As shown, for sampling point a, its corresponding sampling coordinates are the coordinates corresponding to pixel points 1, 2, 6, and 7. At this time, bilinear interpolation operations can be performed on the pixel values ​​corresponding to pixel points 1, 2, 6, and 7 to obtain an image sampling value; similarly, bilinear interpolation operations can be performed on the pixel values ​​of the four pixels of other sampling points. For the 5*5 morphological processing area, a total of 9 image sampling values ​​can be obtained, and then the morphological processing result of the current morphological processing area can be determined through these 9 image sampling values.

[0065] For example, Figure 6For example, the image sampling value is obtained by bilinear interpolation of the pixel values ​​of pixel points 1, 2, 6, and 7 at sampling point a. When the GPU samples at sampling point a, it will perform bilinear interpolation calculations on the four pixel points 1, 2, 6, and 7 around it. Specifically, the image sampling value corresponding to each sampling point can be calculated by using equation (1):

[0066] I a =(1.0-x)(1.0-y)I1+x(1.0-y)I2+(1.0-x)yI6+xyI7 (1)

[0067] Among them, I a can represent the image sampling value corresponding to the sampling point a, I1, I2, I6, I7 can represent the pixel values ​​corresponding to the pixel points 1, 2, 6, 7 respectively, x and y can represent coefficients related to the interpolation position, for the convenience of calculation, x and y here can be taken as 0.5, of course, the values ​​of x and y can be customized according to the actual situation, and this example embodiment is not limited to this.

[0068] For a binary image, the pixel value in the image can only be 0 or 1. Then, combined with the bilinear interpolation relationship (1), as long as the I a If it is not 1, it means that one of the pixel values ​​of pixel points 1, 2, 6, and 7 must be 0, that is, the erosion result of the current point is 0. In this way, the judgment of the four pixel values ​​of pixel points 1, 2, 6, and 7 is completed only by judging the image sampling value of sampling point a once, and the three sampling points b, d, and e are similar. Specifically, the image erosion operation of the morphological processing area can be implemented through the following relationship (2):

[0069]

[0070] Among them, I a It can represent the image sampling value corresponding to the sampling point a. When I a =1, it means that the pixel values ​​of pixels 1, 2, 6, and 7 are all 1, the image erosion result of the current sampling point is 1, and the image sampling values ​​of other sampling points in the current morphological processing area are continued to be judged; when I a When <1, it means that at least one of the four pixel values ​​of pixel points 1, 2, 6, and 7 is 0, and the image erosion result of the current sampling point is 0. At this time, it can be determined that the image erosion result of the current morphological processing area is 0.

[0071] In addition, for the four sampling points c, f, g, and h, the value judgment of the corresponding two pixels can be completed through one sampling respectively; the sampling point i only represents the value judgment of pixel 25. In this way, the value judgment of the entire 25 pixels is completed through a maximum of 9 samplings, and there is no need to call 25 threads of the GPU for value judgment, which reduces the number of GPU thread calls, effectively improves the computational efficiency of morphological image processing, and reduces the power consumption of the GPU.

[0072] In an exemplary embodiment, the minimum value of each morphological processing area in the binary image can be determined based on the image sampling value, and the image erosion result of the binary image can be determined based on the minimum value; and / or the maximum value of the morphological processing area in the binary image can be determined based on the image sampling value, and the image dilation result of the binary image can be determined based on the maximum value.

[0073] In an exemplary embodiment, the morphological processing result corresponding to the binary image can be determined based on the image sampling value by the following steps:

[0074] The sub-morphological processing results of the morphological processing area can be determined based on the image sampling values, and the morphological processing result corresponding to the binary image can be determined according to each sub-morphological processing result.

[0075] Among them, the sub-morphological processing result refers to the morphological processing result corresponding to the current morphological processing area. For example, when a binary image is eroded by a 5*5 image erosion kernel, it is necessary to perform image erosion operations on all pixels in the binary image. Since the size of the image erosion kernel is generally smaller than the image size of the binary image, it is necessary to perform multiple image erosion operations on the binary image. Each image erosion operation is performed on a 5*5 pixel area. Each image erosion operation on a 5*5 pixel area can obtain an image erosion result, namely, a sub-morphological processing result. Each 5*5 pixel area has a sub-morphological processing result. Finally, according to the image erosion results of all morphological processing areas, the morphological processing result of the complete binary image, namely, the eroded image, can be obtained.

[0076] In an exemplary embodiment, the morphological processing size can be a one-dimensional morphological processing size or a two-dimensional morphological processing size; whether it is a one-dimensional morphological processing size or a two-dimensional morphological processing size, the processing method provided in this embodiment can be used for morphological processing.

[0077] Optionally, if the morphological processing size is a two-dimensional morphological processing size, the two-dimensional morphological processing size can be dimensionally separated to obtain a one-dimensional morphological processing size in the horizontal direction and a one-dimensional morphological processing size in the vertical direction. For example, for an image erosion of a two-dimensional morphological processing size of 5*5, it can be converted into an image erosion operation with a horizontal width of 5 and an image erosion operation with a vertical height of 5.

[0078] In summary, in this exemplary embodiment, a binary image to be processed can be obtained, and the binary image can be sampled to obtain image sampling values, and then the morphological processing result corresponding to the binary image can be determined based on the image sampling values. On the one hand, by sampling the binary image to obtain the image sampling values, and then performing morphological processing through the image sampling values, compared with judging all pixel values, the morphological processing efficiency of the binary image can be effectively improved; on the other hand, by performing morphological processing through the image sampling values, the hardware advantages of the texture sampling unit of the graphics processor can be fully utilized, and while improving the morphological processing efficiency, the consumption of the graphics processor computing resources by the morphological processing process can be effectively reduced, thereby reducing the power consumption of the graphics processor.

[0079] The image morphological processing method provided in the embodiments of the present disclosure reduces the number of sampling times and the number of value judgments of the GPU during morphological processing, reduces the number of GPU thread calls during morphological processing, reduces the time and energy consumption of morphological processing, and improves user experience.

[0080] The disclosed embodiment makes full use of the hardware capabilities of the texture sampling unit of the GPU and completes the judgment of the corresponding four pixel values ​​through a single sampling, thereby reducing the number of sampling times and mathematical operations when the GPU performs morphological processing, thereby reducing processing time and power consumption, reducing the power consumption of the GPU, and improving the user experience.

[0081] It should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0082] For further reference, Figure 7 As shown, in the embodiment of this example, an image morphological processing device 700 is also provided, comprising an image acquisition module 710, an image sampling module 720 and a morphological processing module 730. Among them:

[0083] The image acquisition module 710 is used to acquire a binary image to be processed;

[0084] The image sampling module 720 is used to perform sampling processing on the binary image to obtain image sampling values;

[0085] The morphological processing module 730 is used to determine the morphological processing result corresponding to the binary image based on the image sampling value.

[0086] In an exemplary embodiment, the image sampling module 720 may be used to:

[0087] Acquire a morphological processing size, and determine a morphological processing area in the binary image according to the morphological processing size;

[0088] determining sampling coordinates based on the morphologically processed region;

[0089] The morphological processing area is sampled according to the sampling coordinates to obtain image sampling values.

[0090] In an exemplary embodiment, the image sampling module 720 may be used to:

[0091] Determining sampling parameters of a texture sampling unit of a graphics processor, wherein the sampling parameters include a sampling size;

[0092] The morphological processing area is divided into non-overlapping parts according to the sampling size to obtain sampling coordinates.

[0093] In an exemplary embodiment, the texture sampling unit may be used for bilinear interpolation sampling, and the image sampling module 720 may be used for:

[0094] Bilinear interpolation sampling is performed on the morphological processing area based on the sampling coordinates to obtain at least one image sampling value.

[0095] In an exemplary embodiment, the morphological processing module 730 may be used to:

[0096] Determine a sub-morphological processing result of the morphological processing area based on the image sampling value;

[0097] The morphological processing result corresponding to the binary image is determined according to each of the sub-morphological processing results.

[0098] In an exemplary embodiment, the morphological processing size may include any one of a one-dimensional morphological processing size and a two-dimensional morphological processing size;

[0099] When the morphological processing size can be a two-dimensional morphological processing size, the image morphological processing apparatus 700 may include a two-dimensional morphological processing size splitting unit, and the two-dimensional morphological processing size splitting unit may be used to:

[0100] The two-dimensional morphological processing size is dimensionally separated to obtain a one-dimensional morphological processing size in the horizontal direction and a one-dimensional morphological processing size in the vertical direction.

[0101] In an exemplary embodiment, the morphological processing may include at least one of image erosion and image dilation, and the morphological processing module 730 may be used to:

[0102] Determining the minimum value of each morphological processing area in the binary image based on the image sampling value, and determining the image erosion result of the binary image according to the minimum value; and / or

[0103] A maximum value of a morphological processing area in the binary image is determined based on the image sampling value, and an image dilation result of the binary image is determined based on the maximum value.

[0104] The specific details of each module in the above device have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.

[0105] It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits", "modules" or "systems".

[0106] The exemplary embodiment of the present disclosure also provides an electronic device. The electronic device may be the above-mentioned terminal devices 101, 102, 103 and server 105. Generally, the electronic device may include a processor and a memory, the memory is used to store executable instructions of the processor, and the processor is configured to execute the above-mentioned image morphological processing method by executing the executable instructions.

[0107] Below Figure 8 The mobile terminal 800 in FIG. 1 is taken as an example to exemplify the structure of the electronic device. It should be understood by those skilled in the art that, in addition to the components specifically used for mobile purposes, Figure 8 The construction in can also be applied to fixed type equipment.

[0108] like Figure 8 As shown, the mobile terminal 800 may specifically include: a processor 801, a memory 802, a bus 803, a mobile communication module 804, an antenna 1, a wireless communication module 805, an antenna 2, a display screen 806, a camera module 807, an audio module 808, a power module 809 and a sensor module 810.

[0109] The processor 801 may include one or more processing units, for example, the processor 801 may include an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor and / or an NPU (Neural-Network Processing Unit), etc. The image morphology processing method in this exemplary embodiment may be executed by an AP, a GPU or a DSP. When the method involves processing related to a neural network, it may be executed by an NPU, for example, the NPU may load neural network parameters and execute algorithm instructions related to the neural network.

[0110] The encoder can encode (i.e. compress) an image or video to reduce the data size for easy storage or transmission. The decoder can decode (i.e. decompress) the encoded data of the image or video to restore the image or video data. The mobile terminal 800 can support one or more encoders and decoders, for example: image formats such as JPEG (Joint Photographic Experts Group), PNG (Portable Network Graphics), BMP (Bitmap), and video formats such as MPEG (Moving Picture Experts Group) 1, MPEG10, H.1063, H.1064, and HEVC (High Efficiency Video Coding).

[0111] The processor 801 may be connected to the memory 802 or other components via a bus 803 .

[0112] The memory 802 may be used to store computer executable program codes, which may include instructions. The processor 801 executes various functional applications and data processing of the mobile terminal 800 by running the instructions stored in the memory 802. The memory 802 may also store application data, such as images, videos, and other files.

[0113] The communication function of the mobile terminal 800 can be implemented by the mobile communication module 804, antenna 1, wireless communication module 805, antenna 2, modulation and demodulation processor and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. The mobile communication module 804 can provide 3G, 4G, 5G and other mobile communication solutions applied to the mobile terminal 800. The wireless communication module 805 can provide wireless communication solutions such as wireless LAN, Bluetooth, near field communication, etc. applied to the mobile terminal 800.

[0114] The display screen 806 is used to implement display functions, such as displaying user interfaces, images, videos, etc. The camera module 807 is used to implement shooting functions, such as shooting images, videos, etc. The audio module 808 is used to implement audio functions, such as playing audio, collecting voice, etc. The power module 809 is used to implement power management functions, such as charging the battery, powering the device, monitoring the battery status, etc.

[0115] The sensor module 810 may include one or more sensors for implementing corresponding sensing detection functions. For example, the sensor module 810 may include an inertial sensor for detecting the motion posture of the mobile terminal 800 and outputting inertial sensing data.

[0116] The exemplary embodiments of the present disclosure also provide a computer-readable storage medium on which a program product capable of implementing the above-mentioned method of the present specification is stored. In some possible implementations, various aspects of the present disclosure can also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of the present specification, for example, it can execute Figures 3 to 8 Any one or more steps in .

[0117] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0118] In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0119] In addition, program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0120] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0121] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for image morphological processing, characterized in that: include: Get the binary image to be processed; Performing sampling processing on the binary image to obtain image sampling values; A morphological processing result corresponding to the binary image is determined based on the image sampling value.

2. The method according to claim 1, characterized in that The step of sampling the binary image to obtain an image sampling value includes: Acquire a morphological processing size, and determine a morphological processing area in the binary image according to the morphological processing size; determining sampling coordinates based on the morphologically processed region; The morphological processing area is sampled according to the sampling coordinates to obtain image sampling values.

3. The method according to claim 2, characterized in that The step of determining the sampling coordinates based on the morphological processing area comprises: Determining sampling parameters of a texture sampling unit of a graphics processor, wherein the sampling parameters include a sampling size; The morphological processing area is divided into non-overlapping parts according to the sampling size to obtain sampling coordinates.

4. The method according to claim 3, characterized in that The texture sampling unit is used for bilinear interpolation sampling, and the sampling process of the binary image to obtain the image sampling value includes: Bilinear interpolation sampling is performed on the morphological processing area based on the sampling coordinates to obtain at least one image sampling value.

5. The method according to claim 3, characterized in that: The determining, based on the image sampling value, a morphological processing result corresponding to the binary image comprises: Determine a sub-morphological processing result of the morphological processing area based on the image sampling value; The morphological processing result corresponding to the binary image is determined according to each of the sub-morphological processing results.

6. The method according to claim 2, characterized in that The morphological processing size includes any one of a one-dimensional morphological processing size and a two-dimensional morphological processing size; When the morphological processing size is a two-dimensional morphological processing size, the method further comprises: The two-dimensional morphological processing size is dimensionally separated to obtain a one-dimensional morphological processing size in the horizontal direction and a one-dimensional morphological processing size in the vertical direction.

7. The method according to any one of claims 1 to 6, characterized in that: The morphological processing includes at least one of image erosion and image dilation, and the determining the morphological processing result corresponding to the binary image based on the image sampling value includes: Determining the minimum value of each morphological processing area in the binary image based on the image sampling value, and determining the image erosion result of the binary image according to the minimum value; and / or A maximum value of a morphological processing area in the binary image is determined based on the image sampling value, and an image dilation result of the binary image is determined based on the maximum value.

8. An image morphological processing device, characterized in that: include: An image acquisition module, used for acquiring a binary image to be processed; An image sampling module, used for performing sampling processing on the binary image to obtain an image sampling value; The morphological processing module is used to determine the morphological processing result corresponding to the binary image based on the image sampling value.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.