Image processing method, apparatus and electronic device

By obtaining the gradient map of the image and refining the integer bit values ​​of the pixels, the problems of tortuosity and layering caused by precision loss in image processing are solved, and high-quality color images are generated.

CN119031250BActive Publication Date: 2025-11-28VIVO MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411054651.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2025-11-28
Estimated Expiration
2044-08-01

AI Technical Summary

Technical Problem

During image processing, the conversion between floating-point numbers and integers leads to a loss of precision, which can cause the generated color album images to have problems such as tearing and layering.

Method used

By acquiring the gradient map of the image, the integer and decimal values ​​of the pixels are determined, and the integer values ​​of the pixels are refined based on the gradient values ​​and tendency indicators to generate the target pixel values, thereby reducing the image tortuosity and layering problems caused by the loss of precision.

Benefits of technology

It effectively reduces image tortuosity and delamination problems caused by loss of accuracy, and generates higher quality color images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119031250B_ABST
    Figure CN119031250B_ABST
Patent Text Reader

Abstract

The application discloses an image processing method and device and electronic equipment, and belongs to the technical field of image processing. The method comprises the following steps: acquiring a gradient graph corresponding to a first image, wherein the bit depth of the first image is a first bit depth; determining the integer bit value and the decimal bit value of the pixel value of each pixel point in the first image when the pixel point in the first image is converted into a pixel point with a second bit depth, wherein the second bit depth is lower than the first bit depth; determining a tendency index of the integer bit value of each pixel point according to the decimal bit value corresponding to each pixel point and the gradient value corresponding to the gradient graph; determining the target pixel value of each pixel point in the first image converted into the pixel point with the second bit depth based on the tendency index and the integer bit value corresponding to each pixel point; and generating a second image according to the target pixel value of each pixel point with the second bit depth.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of image processing, and particularly relates to an image processing method and device and electronic equipment. BACKGROUND

[0002] When an image is processed by using an electronic device, conversion between a floating-point number and an integer number will be faced, and precision loss is inevitable. For example, when a shooting object is shot by using an electronic device, a color image presented by an album is obtained, a shooting process is that the electronic device first collects a raw image, then performs brightness processing, color processing, noise processing, and the like, and finally presents a color album image. The raw image is a 16-bit deep image, and the album image is an 8-bit deep image. In this process, conversion between a floating-point number and an integer number is involved, and precision loss will occur.

[0003] The above-mentioned precision loss is caused by the fact that a rounding method is used to process the raw image in the image shooting process. This processing method can make pixel values of adjacent pixel points in the raw image become the same pixel value, and thus the color album image generated in this way is prone to have problems of discontinuity and stratification. SUMMARY

[0004] An embodiment of the present application aims to provide an image processing method, device and electronic equipment, which can weaken the problems of discontinuity and stratification caused by precision loss when an image is processed.

[0005] In a first aspect, an embodiment of the present application provides an image processing method, which comprises the following steps.

[0006] obtaining a gradient image corresponding to a first image, wherein a bit depth of the first image is a first bit depth;

[0007] determining integer bit values and decimal bit values of pixel values of each pixel point in the first image when each pixel point in the first image is converted into a pixel point with a second bit depth, wherein the second bit depth is lower than the first bit depth;

[0008] determining a tendency index of the decimal bit value of each pixel point according to the decimal bit value of each pixel point and a gradient value corresponding to the gradient image;

[0009] determining a target pixel value of each pixel point in the first image converted into the pixel point with the second bit depth based on the tendency index of each pixel point and the integer bit value;

[0010] generating a second image according to the target pixel value of each pixel point with the second bit depth.

[0011] In a second aspect, an embodiment of the present application provides an image processing device, which comprises the following steps.

[0012] The first obtaining module is configured to obtain a gradient image corresponding to a first image, wherein the first image has a first bit depth;

[0013] The first determining module is configured to determine integer bit values and decimal bit values of pixel values of each pixel point in the first image when the each pixel point in the first image is converted into a pixel point having a second bit depth, wherein the second bit depth is lower than the first bit depth;

[0014] The second determining module is configured to determine a tendency index of the decimal bit value of each pixel point according to the decimal bit value of the each pixel point and a gradient value corresponding to the gradient image;

[0015] The third determining module is configured to determine a target pixel value of each pixel point in the first image converted into a pixel point having the second bit depth based on the tendency index of the each pixel point and the integer bit value of the each pixel point;

[0016] The fourth determining module is configured to generate a second image according to the target pixel value of each pixel point having the second bit depth.

[0017] In a third aspect, an electronic device is provided, which includes a processor and a memory. The memory stores programs or instructions executable on the processor. When the programs or instructions are executed by the processor, the steps of the method according to the first aspect are implemented.

[0018] In a fourth aspect, a readable storage medium is provided, which stores programs or instructions. When the programs or instructions are executed by a processor, the steps of the method according to the first aspect are implemented.

[0019] In a fifth aspect, a chip is provided, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is configured to run programs or instructions to implement the method according to the first aspect.

[0020] In a sixth aspect, a computer program product is provided, which is stored in a storage medium. The computer program product is executed by at least one processor to implement the method according to the first aspect.

[0021] In the embodiments of the present application, when processing the image, the gradient value of each pixel point in the first image and the decimal value when each pixel point is converted into a second bit depth pixel point are referred to, and a tendency index for indicating that the pixel value of the pixel point converted into the second bit depth pixel point is an integer value is obtained. The tendency index is used to finely process the integer value of the pixel point, so that the target pixel value of the pixel point converted into the second bit depth pixel point can be accurately obtained, and the second image of the fading layer is obtained. Compared with the prior art, the image fault and layering problem caused by the loss of accuracy are effectively reduced by the scheme of the embodiments of the present application. BRIEF DESCRIPTION OF DRAWINGS

[0022] Figure 1 FIG. 1 is a flowchart of an image processing method provided by some embodiments of the present application;

[0023] FIG. 2(a) is an edge feature diagram of a vertical line type edge provided by some embodiments of the present application;

[0024] FIG. 2(b) is an edge feature diagram of a vertical line edge with a vertex provided by some embodiments of the present application;

[0025] FIG. 2(c) is an edge feature diagram of a diagonal line type edge provided by some embodiments of the present application;

[0026] FIG. 3(a) is a gradient diagram of a 16-bit depth image provided by some embodiments of the present application;

[0027] FIG. 3(b) is a gradient diagram obtained by processing FIG. 3(a) by using the rounding method in the prior art provided by some embodiments of the present application;

[0028] FIG. 3(c) is a gradient diagram obtained by processing FIG. 3(a) by using the scheme provided by some embodiments of the present application;

[0029] Figure 4 FIG. 4 is a structural diagram of an image processing device provided by some embodiments of the present application;

[0030] Figure 5 FIG. 5 is a structural diagram of an electronic device provided by some embodiments of the present application;

[0031] Figure 6 FIG. 6 is a hardware structural diagram of an electronic device provided by some embodiments of the present application. DETAILED DESCRIPTION

[0032] In the description of the technical solutions in the embodiments of the present application, the accompanying drawings will be referenced, obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.

[0033] The terms "first", "second" and the like in the specification of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second" and the like are generally a kind, and do not limit the number of objects, for example, the first object can be one or more. In addition, "and / or" in the specification means at least one of the connected objects, and the character " / ", generally means that the front and rear associated objects are in a "or" relationship.

[0034] As described in the background section, using rounding to process the image can cause loss of image accuracy, and further cause the image to be prone to problems such as layering. To solve the above problems, the present application provides an image processing method, device and electronic equipment. When processing the image, the gradient values of each pixel point in the first image and the decimal values of each pixel point converted into a second bit depth pixel point are referred to, and a tendency index for indicating that the pixel value of the pixel point converted into a second bit depth pixel point is an integer value is obtained. The tendency index is used to finely process the value of the integer value of the pixel point, so that the target pixel value of the second bit depth pixel point converted from the pixel point can be accurately obtained, and a second image with faded layering is obtained. Compared with the prior art of processing the pixel points in the first image by rounding, the scheme of the present application effectively reduces the image layering problem caused by loss of accuracy.

[0035] The technical solutions of the embodiments of the present application can be applied to the storage, display and other scenes of the image, for example, in the scene of using an electronic device to take a photograph of a shooting object to obtain a color image presented by an album.

[0036] The image processing method provided by the embodiments of the present application will be described in detail below in combination with the accompanying drawings and specific embodiments and application scenarios.

[0037] Figure 1 is a flowchart of an image processing method provided by the embodiments of the present application,

[0038] As shown in Figure 1 The image processing method provided by the embodiments of the present application can include steps 110-150.

[0039] Step 110, obtaining a gradient map corresponding to the first image.

[0040] The first image can be a raw image collected by the electronic device, or can be a color image presented in an album, which is not limited in the embodiments of the present application.

[0041] It should be noted that the bit depth of the first image is a first bit depth.

[0042] It should be noted that, in the case that the first image is a raw image collected by the electronic device, the second image generated in step 150 is an image presented in an album after processing the raw image. In the case that the first image is a color image presented in an album, the second image generated in step 150 is a color image of a second bit depth presented in the album, where the second bit depth is lower than the first bit depth.

[0043] In some embodiments of the present application, the first image gradient map can be obtained in the following two ways:

[0044] The first way is to obtain the gradient map of the first image directly from the device channel of the electronic device, when the device channel of the electronic device is not limited, i.e. the device channel of the electronic device supports transmitting the gradient map to the algorithm corresponding to the embodiments of the present application. This is because the device channel of the electronic device will have its corresponding gradient map when sharpening the image, so the gradient map of the first image can be obtained directly from the device channel of the electronic device.

[0045] The second way is to obtain the gradient map of the first image by processing the first image through a Sobel matrix, when the device channel of the electronic device is limited, i.e. the device channel of the electronic device does not support transmitting the gradient map to the algorithm corresponding to the embodiments of the present application.

[0046] It should be noted that the specific expression of the Sobel matrix is shown in the following formula (1):

[0047]

[0048] The second way of obtaining the gradient map of the first image will be described in detail below, i.e. the gradient map of the first image can include:

[0049] The first sub-matrix in the Sobel matrix is used to process each pixel point in the first image to obtain second gradient information of each pixel point in the first direction;

[0050] The second sub-matrix in the Sobel matrix is used to process each pixel point in the first image to obtain third gradient information of each pixel point in the second direction;

[0051] According to the second gradient information and the third gradient information of the pixel points, a gradient image of the first image is obtained.

[0052] The first sub-matrix can be one of the sub-matrices in the Sobel matrix, for example, can be

[0053] The second sub-matrix can be another sub-matrix in the Sobel matrix except the first sub-matrix, for example, the second sub-matrix can be

[0054] The first direction can be the direction in which the first sub-matrix processes the pixel points in the first image. The second direction can be the direction in which the second sub-matrix processes the pixel points in the first image.

[0055] In some embodiments of the present application, the position of a pixel point in the first image can be represented in the form of coordinates, for example, the position of a pixel point in the first image is (x, y), and the first direction can be the x direction and the second direction can be the y direction.

[0056] The second gradient information can be the gradient information of the pixel points in the first direction. The third gradient information can be the gradient information of the pixel points in the second direction.

[0057] In some embodiments of the present application, for each pixel point in the first image, the first sub-matrix in the Sobel matrix can be used to process the pixel point to obtain the second gradient information of the pixel point in the first direction, and then the second sub-matrix in the Sobel matrix can be used to process the pixel point to obtain the third gradient information of the pixel point in the second direction, and then the second gradient information and the third gradient information of the pixel point are weighted to obtain the gradient image of the first image.

[0058] It should be noted that, in addition to the above processing of the pixel points in the first image by using the Sobel matrix to obtain the gradient image corresponding to the first image, other methods can also be used to process the pixel points in the first image to obtain the gradient image corresponding to the first image, such as the canny operator. The specific method for processing the pixel points in the first image to obtain the gradient image corresponding to the first image can be selected according to user requirements, and is not limited in the embodiments of the present application.

[0059] It should be noted that, after the first image is processed according to the Sobel matrix to obtain the gradient image corresponding to the first image, each pixel point on the first image and each pixel point on the gradient image are in a one-to-one correspondence, that is, one pixel point on the first image always has a corresponding pixel point on the gradient image.

[0060] In the embodiments of this application, for each pixel in the first image, the pixel is processed using the first submatrix of the Sobel matrix to obtain the second gradient information of the pixel in the first direction. Then, the pixel is processed using the second submatrix of the Sobel matrix to obtain the third gradient information of the pixel in the second direction. Then, based on the second gradient information and the third gradient information of each pixel in the first image, the gradient map of the first image can be obtained. In this way, by quantizing the gradient information of each pixel in the first image, the gradient map of the first image can be accurately obtained.

[0061] Step 120: Determine the integer and fractional values ​​of the pixel values ​​of each pixel in the first image when converting each pixel in the first image to a second bit depth pixel.

[0062] The second bit depth can be different from the first bit depth; specifically, the second bit depth can be lower than the first bit depth.

[0063] In some embodiments of this application, for converting each pixel in the first image into a second bit-depth pixel, the pixel value conversion formula for each pixel in the first image can be as shown in the following formula (2):

[0064]

[0065] Where, value 第一位深 The pixel value of the first deepest pixel, value 第二位深 Let A be the pixel value corresponding to the second depth, and B be the maximum value of the pixel value range of the first depth pixel.

[0066] In one example, taking the first bit depth as 16 bits and the second bit depth as 8 bits, in the above formula (2), A = 65535 and B = 255, that is, the pixel value range of the pixel point in the 16-bit image is [0-65535], and the pixel value range of the pixel point in the 8-bit image is [0-255].

[0067] In some embodiments of this application, each pixel of the first image is calculated according to the above formula (2), and each pixel will generate an integer number of digits and a decimal number of digits.

[0068] Step 130: Determine the tendency index for rounding the decimal value of each pixel based on the decimal value of each pixel and the gradient value of the gradient map.

[0069] The tendency index corresponding to each pixel point in the first image can be a tendency of the decimal value of the pixel point to be rounded when the pixel point is converted into a pixel point of the second bit depth. The rounding can be upward rounding or downward rounding, and the specific rounding can be determined according to specific conditions.

[0070] In some embodiments of the present application, in order to accurately determine the tendency index of the decimal value rounding of each pixel point, step 130 can specifically include:

[0071] According to the gradient value of each pixel point in the gradient map and the reference threshold, the gradient degree of each pixel point is determined.

[0072] According to the decimal value corresponding to each pixel point and the gradient degree, the tendency index of the decimal value rounding of each pixel point is determined.

[0073] The reference threshold can be a threshold corresponding to the gradient value of each pixel point in the gradient map, and the determination method of the reference threshold will be described in detail in the following embodiments.

[0074] The gradient degree of each pixel point can be used to represent the degree of the gradient of each pixel point.

[0075] In some embodiments of the present application, the gradient degree of the pixel point can be [0, 1], when the gradient degree of a certain pixel point is 0, it represents that the pixel point has no gradient, that is, the pixel point is a pixel point in a flat area, when the gradient degree of a certain pixel point is 1, it represents that the pixel point is an edge pixel point.

[0076] In some embodiments of the present application, since each pixel point in the gradient map is one-to-one corresponding to each pixel point in the first image, the gradient degree of each pixel point can be determined according to the gradient value of each pixel point in the gradient map and the reference threshold, and then the tendency index of the decimal value rounding of each pixel point can be determined according to the decimal value corresponding to each pixel point and the gradient degree.

[0077] In some embodiments of the present application, for each pixel point in the first image, the tendency index of the decimal value rounding of the pixel point can be determined according to the decimal value corresponding to the pixel point and the gradient degree corresponding to the gradient map according to the following formula (3):

[0078] f final = (abs(f gra - 0.5) x (f fra - 0.5) + 0.25) x 2 (3)

[0079] In the above formula (3), for each pixel point in the first image, f final is the tendency index corresponding to the pixel point, and f grais the gradient degree corresponding to the pixel point, f fra is the decimal value of the pixel point when converting, and abs(·) is the absolute value.

[0080] In some embodiments of the present application, the calculation of the inclination index refers to the gradient degree and the decimal value of the pixel point, so as to weaken the layering problem. For the flat area in the first image, if the pixel point is a pixel point of the flat area, f gra tends to 0, and abs(f gra -0.5) will be larger, f fra approaches 0 (or 1), f final will be closer to 0 (or 1), that is, the inclination of the rounding of the decimal value of the pixel point is intensified, that is, if f fra approaches 0, f final will be closer to 0, that is, the inclination of the rounding down of the decimal value of the pixel point is intensified, and if f fra approaches 1, f final will be closer to 1, that is, the inclination of the rounding up of the decimal value of the pixel point is intensified.

[0081] In the embodiments of the present application, compared with directly rounding the decimal value in the prior art, the inclination index of the rounding of the decimal value of each pixel point is determined by referring to the gradient degree of each pixel point in the present application, so that the value of the integer value of the pixel point can be finely processed by using the value inclination index, and the image fault and layering problem caused by the loss of precision are weakened.

[0082] In some embodiments of the present application, in order to accurately determine the gradient degree of each pixel point, the gradient degree of each pixel point is determined according to the gradient value of each pixel point in the gradient map and the reference threshold, which can specifically include:

[0083] The ratio of the pixel value of each pixel point to the reference threshold is determined as the gradient value of each pixel point.

[0084] In some embodiments of the present application, for each pixel point in the gradient map, the ratio of the pixel value of the pixel point to the reference threshold can be determined as the gradient degree of the pixel point.

[0085] In the embodiments of the present application, for each pixel point in the gradient map, the ratio of the pixel value of the pixel point to the reference threshold is determined as the gradient degree of the pixel point, so that the gradient degree of the pixel point can be quantified, so as to more intuitively determine the gradient degree of each pixel point.

[0086] In some embodiments of the present application, before the gradient degree of each pixel point is determined according to the gradient value of each pixel point in the gradient map and the reference threshold, the above-mentioned method can further include:

[0087] obtaining a target edge feature type corresponding to each pixel point in the gradient map;

[0088] processing the reference image of each target edge feature type by using a Sobel matrix to obtain first gradient information corresponding to the reference image of each target edge feature type;

[0089] taking the first gradient information corresponding to the first target edge feature type as a reference threshold value corresponding to the first pixel point in the gradient map.

[0090] The target edge feature type corresponding to each pixel point can be an edge feature type to which each pixel point belongs.

[0091] In some embodiments of the present application, the edge feature type can include a vertical line type edge feature type, a vertical line with vertex edge feature type, and an oblique line type edge feature type.

[0092] The reference image can be a standard image of different target edge feature types. The reference image can be a raw image or a color image presented in an album, which is not limited in the embodiments of the present application.

[0093] In an example, FIG. 2(a) is an edge feature schematic diagram of a reference image of a vertical line type edge feature type, FIG. 2(b) is an edge feature schematic diagram of a reference image of a vertical line with vertex edge feature type, and FIG. 2(c) is an edge feature schematic diagram of a reference image of an oblique line type edge feature type. The reference images represented by FIG. 2(a), FIG. 2(b), and FIG. 2(c) are all 8-bit deep images.

[0094] The first gradient information can be gradient information corresponding to the reference image of each target edge feature type after processing the reference image of each target edge feature type by using a Sobel matrix.

[0095] The first target edge feature type can be any one of the target edge feature types.

[0096] The first pixel point can be a pixel point in the gradient map whose edge feature type is the first target edge feature type.

[0097] In some embodiments of the present application, the edge feature of each pixel point in the gradient map of the first image can be detected by using an edge type detection algorithm to determine the target edge feature type of each pixel point, then the reference image of each target edge feature type is processed by using a Sobel matrix to obtain first gradient information corresponding to the reference image of each edge feature type, and then the first gradient information is taken as a reference threshold value of each pixel point in the gradient map whose edge feature type is the same edge feature type as the reference image.

[0098] The determination manner of the first gradient information can be the determination manner of referring to the gradient map of the first image, that is, the first gradient information herein can be obtained by first processing the first direction of the reference image by using the first sub-matrix in the Sobel matrix to obtain the gradient information in the first direction, then processing the second direction of the reference image by using the second sub-matrix in the Sobel matrix to obtain the gradient information in the second direction, and then performing weighted calculation on the gradient information in the first direction and the gradient information in the second direction.

[0099] It should be noted that the detection of the edge feature of each pixel point in the gradient map of the first image by the edge type detection algorithm to determine the target edge feature type of each pixel point belongs to the prior art, and will not be described here.

[0100] Continuing to refer to the above example, the output values of the reference images corresponding to the vertical line type edge feature type in FIG. 2(a), the vertical line with vertex type edge feature type in FIG. 2(b) and the diagonal line type edge feature type in FIG. 2(c) are 4, 1 and 8 respectively, and then it can be determined that the reference threshold of the pixel points with the vertical line type edge feature type in the gradient map of the first image is 4, the reference threshold of the pixel points with the vertical line with vertex type edge feature type in the gradient map of the first image is 1, and the reference threshold of the pixel points with the diagonal line type edge feature type in the gradient map of the first image is 8.

[0101] It should be noted that the first gradient information corresponding to each of the reference images of the target edge feature type can be taken as the minimum value of the reference threshold, that is, if the pixel value of a pixel point with a certain edge feature type is greater than the reference threshold corresponding thereto, the pixel point is determined to be an edge pixel point, and if the pixel value of the pixel point is less than the reference threshold corresponding thereto, the pixel point is determined to be a pixel point in a flat area.

[0102] Continuing to refer to the above example, if the pixel value (i.e., the gradient value) of a pixel point with a vertical line type edge feature type in the gradient map of the first image is 9, which is greater than the reference threshold 4 corresponding thereto, the pixel point is determined to be an edge pixel point, and if the pixel value of the pixel point is 2, which is less than the reference threshold 4 corresponding thereto, the pixel point is determined to be a pixel point in a flat area.

[0103] In some embodiments of the present application, the bit depth of the reference image can be selected according to user requirements, but when determining the reference threshold, the obtained first gradient information of the reference image needs to be converted into first gradient information corresponding to the bit depth of the first image. For example, the reference image is an 8-bit depth image, the first image is a 16-bit depth image, and the gradient image corresponding to the first image is also a 16-bit depth image. The first gradient information of the reference image after Sobel matrix processing is 10, which is 8-bit depth gradient information. Therefore, it needs to be converted into 16-bit depth gradient information, and only the converted 16-bit depth gradient information is the reference threshold of the pixel point in the gradient image corresponding to the edge feature type of the reference image.

[0104] In the embodiments of the present application, the target edge feature type of each pixel point in the gradient image is determined, and then the reference threshold of each pixel point in the gradient image is determined according to the first gradient information of the reference image corresponding to each target edge feature type after gradient calculation. Thus, the corresponding reference threshold of each pixel point is determined, and then the corresponding subsequent operation can be performed for the reference threshold of each pixel point, which improves the fineness of processing each pixel point and improves the fineness of the image quality of the second image and reduces the layering problem of the second image.

[0105] In some embodiments of the present application, in order to improve the generation efficiency of the second image, the reference threshold of each pixel point can also not be set in the above-mentioned manner, that is, the reference threshold corresponding to each pixel point in the gradient image can be set to the same reference threshold. In this way, the power consumption can be reduced and the generation efficiency of the second image can be improved. Whether the reference threshold corresponding to each pixel point is the same or not can be selected according to actual user requirements, which is not limited in the embodiments of the present application.

[0106] It should be noted that, since the value range of f gra is [0, 1], in the case where the ratio of the gradient value of a certain pixel point in the gradient image to its reference threshold is greater than the upper limit of the value range of f gra , the gradient degree corresponding to the pixel point is taken as the upper limit of the value range of f gra , in the case where the ratio of the gradient value of a certain pixel point in the gradient image to its reference threshold is less than the lower limit of the value range of f gra , the gradient degree corresponding to the pixel point is taken as the lower limit of the value range of f gra , and in the case where the ratio of the gradient value of a certain pixel point in the gradient image to its reference threshold is within the value range of f gra , the gradient degree corresponding to the pixel point is taken as the ratio of the gradient value of the pixel point to its reference threshold.

[0107] In one example, if the ratio of the gradient value of a pixel in the gradient map to the reference threshold value is 3, which is greater than the upper limit 1 of the value range of f gra , the gradient degree of the pixel is taken as 1; if the ratio of the gradient value of a pixel in the gradient map to the reference threshold value is -2, which is less than the lower limit 0 of the value range of f gra , the gradient degree of the pixel is taken as 0; if the ratio of the gradient value of a pixel in the gradient map to the reference threshold value is 0.4, which is within the value range of f gra , the gradient degree of the pixel is taken as 0.4.

[0108] Step 140, based on the inclination index and the integer bit value corresponding to each pixel point, determining the target pixel value of the pixel point converted from the first image to the second bit depth.

[0109] In one example, the target pixel value of the pixel point converted from the first image to the second bit depth can be the pixel value of the pixel point in the second bit depth image after the pixel point is converted to the second bit depth.

[0110] In some embodiments of the present application, for each pixel point in the first image, the target pixel value of the pixel point in the second bit depth image after the pixel point is converted to the second bit depth can be determined according to the inclination index and the integer bit value corresponding to the pixel point.

[0111] In some embodiments of the present application, in order to accurately determine the target pixel value of the pixel point converted from the first image to the second bit depth, step 140 can specifically include:

[0112] randomly generating a random value using a random function;

[0113] determining the correction value corresponding to each pixel point according to the random value, the inclination index corresponding to each pixel point, and the maximum value in the range of the random value randomly generated by the random function;

[0114] correcting the integer bit value corresponding to each pixel point based on the correction value of each pixel point, to obtain the target pixel value of the pixel point converted from the first image to the second bit depth.

[0115] In one example, the random value can be a value randomly generated by the random function.

[0116] The maximum value in the range of the random value randomly generated by the random function can be the maximum value in the range of the random value randomly generated by the random function.

[0117] In one example, if the random number value range generated by the random function is [0, 8], the maximum value of the random number value range randomly generated by the random function is 8, and if the random number value range generated by the random function is [0, 300], the maximum value of the random number value range randomly generated by the random function is 300.

[0118] For each pixel point in the first image, the correction value corresponding to the pixel point can be a value for correcting the integer bit value corresponding to the pixel point.

[0119] In some embodiments of the present application, for a pixel point in the first image, a random number value can be randomly generated by using a random function, and then a correction value corresponding to the pixel point can be determined according to the random number value, the tendency index corresponding to the pixel point, and the maximum value of the random number value range randomly generated by the random function, the integer bit value corresponding to the pixel point is corrected by using the correction value of the pixel point, and the target pixel value of the pixel point converted into the second bit depth is obtained.

[0120] In some embodiments of the present application, according to the random number value, the tendency index corresponding to each pixel point, and the maximum value of the random number value range randomly generated by the random function, the correction value corresponding to each pixel point can be obtained according to the following formula (4):

[0121] diff=rand(·)<f final ×rand_max?1:0 (4)

[0122] In the above formula (4), rand(·) is a random number value generated by using a random function, rand_max is the maximum value of the random number value range randomly generated by the random function, and diff is a correction value.

[0123] The meaning of the above formula (4) is that if rand(·)<f final ×rand_max, diff takes the value 1, otherwise diff takes the value 0.

[0124] In some embodiments of the present application, according to the above formula (4), when f final tends to 0 (or 1), the probability that diff takes 0 (or 1) tends to 1. When f final tends to 0.5, f gra tends to 0.5 (0 for completely flat, 1 for edge), or f fra tends to 0.5, rounding to the nearest integer may produce stratification. When f final tends to 0.5, the probability that diff takes 0 or 1 is the same.

[0125] In the embodiments of the present application, for each pixel point in the first image, a random number value is randomly generated by using a random function, and then according to the random number value, the tendency index corresponding to the pixel point and the maximum value of the random number value range randomly generated by the random function, the correction value corresponding to the pixel point can be determined, so that the integer bit value corresponding to the pixel point can be corrected by using the correction value of the pixel point, and then the target pixel value of the pixel point converted into the second bit depth can be accurately obtained. Compared with the direct rounding of the decimal bit value in the prior art, the scheme of the embodiments of the present application uses the tendency index to determine the tendency of rounding the decimal bit value, and then uses the tendency to correct the integer bit value, so as to weaken the image layering problem caused by the loss of accuracy.

[0126] In some embodiments of the present application, in order to further weaken the image layering problem caused by the loss of accuracy, the correction value of each pixel point is used to correct the integer bit value corresponding to each pixel point to obtain the target pixel value of the pixel point converted into the second bit depth, which can specifically include:

[0127] The sum of the correction value of each pixel point and the integer bit value corresponding to each pixel point is determined as the target pixel value of the pixel point converted into the second bit depth.

[0128] In some embodiments of the present application, for each pixel point in the first image, the sum of the correction value of the pixel point and the integer bit value corresponding to the pixel point can be determined as the target pixel value of the pixel point converted into the second bit depth, that is, for each pixel point in the first image, according to the correction value of the pixel point and the integer bit value corresponding to the pixel point, the target pixel value of the pixel point converted into the second bit depth can be obtained according to the following formula (5):

[0129] value int2 =i+diff (5)

[0130] In the above formula (5), for each pixel point in the first image, value int2 is the target pixel value of the pixel point converted into the second bit depth, and i is the integer bit value corresponding to the pixel point.

[0131] In the embodiments of the present application, for each pixel point in the first image, the sum of the correction value of the pixel point and the integer bit value corresponding to the pixel point can be determined as the target pixel value of the pixel point converted into the second bit depth, so that the target pixel value can be accurately determined, and the second image with faded layering can be obtained, thereby weakening the image layering problem caused by the loss of accuracy.

[0132] Step 150, generating a second image according to the target pixel value of each pixel point with the second bit depth.

[0133] In some embodiments of the present application, a second image of the second bit depth can be generated according to the target pixel values of each pixel point of the second bit depth of the conversion layer.

[0134] In one example, referring to FIG. 3(a), FIG. 3(b) and FIG. 3(c), FIG. 3(a) is a schematic diagram of a gradient image of a 16-bit image, FIG. 3(b) is a gradient image obtained by processing FIG. 3(a) by using the rounding method in the prior art, and it can be seen from FIG. 3(b) that the image processed by using the rounding method in the prior art has a layered problem, that is, the white fault line boxed in block 31 in FIG. 3(b), and FIG. 3(c) is a gradient image obtained by processing FIG. 3(a) by using the scheme provided in the embodiments of the present application, and it can be seen from FIG. 3(c) that the image processed by using the scheme provided in the embodiments of the present application simplifies the layered problem of the image.

[0135] The image processing method provided in the embodiments of the present application can be executed by an image processing device. The image processing device provided in the embodiments of the present application is described by taking the image processing device executing the image processing method as an example.

[0136] Figure 4 FIG. 1 is a structural schematic diagram of an image processing device according to an exemplary embodiment.

[0137] As shown in FIG. 4, the image processing device 400 can include: Figure 4

[0138] The first acquisition module 410 is configured to acquire a gradient image corresponding to a first image, wherein the bit depth of the first image is a first bit depth.

[0139] The first determination module 420 is configured to determine an integer bit value and a decimal bit value of a pixel value of each pixel point in the first image when each pixel point in the first image is converted into a pixel point of a second bit depth, wherein the second bit depth is lower than the first bit depth.

[0140] The second determination module 430 is configured to determine a tendency index of the decimal bit value corresponding to each pixel point according to the decimal bit value corresponding to each pixel point and a gradient value corresponding to the gradient image.

[0141] The third determination module 440 is configured to determine a target pixel value of each pixel point in the first image converted into a pixel point of the second bit depth based on the tendency index corresponding to each pixel point and the integer bit value.

[0142] The fourth determination module 450 is configured to generate a second image according to the target pixel value of each pixel point of the second bit depth.

[0143] ​In the embodiments of the present application, when processing the image, the gradient values of the pixel points in the first image and the decimal point values of the pixel points converted into the second bit depth pixel points are referred to, and a tendency index for indicating that the pixel value of the pixel point converted into the second bit depth pixel point is an integer value is obtained. The tendency index is used to finely process the integer value of the pixel point, so that the target pixel value of the second bit depth pixel point converted from the pixel point can be accurately obtained, and the second image of the fading layer is obtained. Compared with the prior art of processing the pixel points in the first image by rounding, the scheme of the embodiments of the present application effectively reduces the image fault and layering problem caused by the loss of accuracy.

[0144] In some embodiments of the present application, the second determination module 430 can specifically include:

[0145] The first determination unit is configured to determine the gradient degree of each pixel point in the gradient map according to the gradient value of each pixel point in the gradient map and a reference threshold value.

[0146] The second determination unit is configured to determine the tendency index of the integer of the decimal point value corresponding to each pixel point according to the gradient degree and the decimal point value corresponding to each pixel point.

[0147] In some embodiments of the present application, the first determination unit is specifically configured to:

[0148] Determine the ratio of the pixel value of each pixel point to the reference threshold value as the gradient degree of each pixel point.

[0149] In some embodiments of the present application, the second determination module 430 can further include:

[0150] The first acquisition unit is configured to acquire the target edge feature type corresponding to each pixel point in the gradient map.

[0151] The third determination unit is configured to process the reference image of each target edge feature type by using a Sobel matrix to obtain the first gradient information corresponding to the reference image of each target edge feature type.

[0152] The fourth determination unit is configured to take the first gradient information corresponding to the first target edge feature type as the reference threshold value corresponding to the first pixel point in the gradient map, wherein the first target edge feature type is any one of the target edge feature types, and the first pixel point is a pixel point with the edge feature type of the first target edge feature type in the gradient map.

[0153] In some embodiments of the present application, the first acquisition module 410 is specifically configured to:

[0154] The first sub-matrix in the Sobel matrix is used to process each pixel point in the first image to obtain second gradient information of the each pixel point in a first direction;

[0155] The second sub-matrix in the Sobel matrix is used to process each pixel point in the first image to obtain third gradient information of the each pixel point in a second direction;

[0156] The second gradient information and the third gradient information of the each pixel point are used to obtain a gradient map of the first image.

[0157] In some embodiments of the present application, the third determining module 440 includes:

[0158] A fifth determining unit is configured to randomly generate a random number value by using a random function;

[0159] A sixth determining unit is configured to determine a correction value corresponding to the each pixel point according to the random number value, the inclination index corresponding to the each pixel point, and a maximum value of a random number value range randomly generated by the random function;

[0160] A seventh determining unit is configured to correct the integer bit value corresponding to the each pixel point based on the correction value of the each pixel point to obtain a target pixel value of the each pixel point converted into a pixel point of the second bit depth.

[0161] In some embodiments of the present application, the seventh determining unit is specifically configured to:

[0162] The sum of the correction value of the each pixel point and the integer bit value corresponding to the each pixel point is determined as the target pixel value of the each pixel point converted into a pixel point of the second bit depth.

[0163] The image processing apparatus in the embodiments of the present applicationapplicationbe an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic deviceapplicationbe a terminal, or other devices than a terminal. For example, the electronic deviceapplicationbe a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., andapplicationbe a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc., and the embodiments of the present application do not make a specific limitation.

[0164] The image processing apparatus in the embodiments of the present applicationapplicationbe a device with an operating system. The operating systemapplicationbe an Android operating system, an ios operating system, or other possible operating systems, and the embodiments of the present application do not make a specific limitation.

[0165] The image processing apparatus provided in the embodiments of the present applicationapplicationimplement the method embodiments of the present application, and achieve the same technical effects. For the sake of avoiding repetition, the details are not described herein. Figure 1 The method embodiments achieve the same technical effects as the image processing apparatus embodiments, and for the sake of avoiding repetition, the details are not described herein.

[0166] Optionally, as shown in Figure 5 the embodiments of the present application further provide an electronic device 500, which includes a processor 501 and a memory 502, and the memory 502 stores programs or instructions which can be run on the processor 501. When the programs or instructions are executed by the processor 501, the programs or instructions implement the steps of the above-mentioned image processing method embodiments, and achieve the same technical effects. For the sake of avoiding repetition, the details are not described herein.

[0167] It should be noted that the electronic device in the embodiments of the present applicationapplicationinclude the above-mentioned mobile electronic device and non-mobile electronic device.

[0168] Figure 6 For the sake of implementing the hardware structure of an electronic device in the embodiments of the present application.

[0169] The electronic device 600 includes, but is not limited to, a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, and a processor 610, etc.

[0170] Those skilled in the art can understand that the electronic device 600 can also include a power supply (such as a battery) for supplying power to various components, and the power supply can be logically connected to the processor 610 through a power management system, so that the power management system can realize functions such as management of charging, discharging, and power consumption management. Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device can include more or fewer components than shown, or combine certain components, or different component arrangements, which will not be described here.

[0171] The processor 610 is configured to obtain a gradient map corresponding to a first image, wherein the first image has a first bit depth; determine integer bit values and decimal bit values of pixel values of each pixel point in the first image when the each pixel point is converted into a pixel point with a second bit depth, the second bit depth being lower than the first bit depth; determine a tendency index of the decimal bit values of each pixel point according to the gradient values corresponding to the gradient map and the decimal bit values corresponding to each pixel point; determine target pixel values of the each pixel point in the first image converted into the pixel point with the second bit depth based on the tendency index corresponding to each pixel point and the integer bit values; and generate a second image according to the target pixel values of each pixel point with the second bit depth.

[0172] In this way, when processing the image, the gradient values of each pixel point in the first image and the decimal bit values when each pixel point is converted into a pixel point with a second bit depth are referred to, a tendency index for indicating that the pixel value of the pixel point converted into the pixel point with the second bit depth is the integer bit value is obtained, the value of the integer bit value of the pixel point is finely processed by using the tendency index, the target pixel value of the pixel point converted into the pixel point with the second bit depth is accurately obtained, and then a second image with faded layers is obtained. Compared with the prior art in which the pixel points in the first image are processed by rounding, the scheme of the embodiment of the present application effectively reduces the image fault and layering problem caused by loss of accuracy.

[0173] In some embodiments, the processor 610 is further configured to determine a gradient degree of each pixel point in the gradient map according to the gradient value of each pixel point and a reference threshold value; and determine a tendency index of the decimal bit values of each pixel point according to the gradient degree and the decimal bit values corresponding to each pixel point.

[0174] Therefore, compared with directly rounding the decimal value in the prior art, the tendency index of rounding the decimal value of each pixel point is determined by referring to the gradient degree of each pixel point in the present application. Therefore, the value of the integer value of the pixel point can be finely processed by using the value tendency index, which reduces the image fault and layering problem caused by the loss of accuracy.

[0175] In some embodiments, the processor 610 is further configured to determine the ratio of the pixel value of each pixel point to the reference threshold value as the gradient degree of each pixel point.

[0176] Therefore, for each pixel point in the gradient map, the ratio of the pixel value of the pixel point to the reference threshold value is determined as the gradient degree of the pixel point. Therefore, the gradient degree of the pixel point can be quantified to more intuitively determine the gradient degree of each pixel point.

[0177] In some embodiments, the processor 610 is further configured to obtain a target edge feature type corresponding to each pixel point in the gradient map; process a reference image of each target edge feature type using a Sobel matrix to obtain first gradient information corresponding to the reference image of each target edge feature type; and determine the first gradient information corresponding to the first target edge feature type as a reference threshold value corresponding to a first pixel point in the gradient map, wherein the first target edge feature type is any one of the target edge feature types, and the first pixel point is a pixel point in the gradient map whose edge feature type is the first target edge feature type.

[0178] Therefore, by determining the target edge feature type of each pixel point in the gradient map, and then determining the reference threshold value of each pixel point in the gradient map according to the first gradient information of the reference image of each target edge feature type after gradient calculation, the reference threshold value corresponding to each pixel point is determined, and then the subsequent operation corresponding to the reference threshold value of each pixel point can be performed, which improves the fineness of processing each pixel point, and further improves the fineness of the image quality of the second image, and reduces the layering problem of the second image.

[0179] In some embodiments, the processor 610 is further configured to process each pixel point in the first image using a first sub-matrix in the Sobel matrix to obtain second gradient information of the pixel point in a first direction; process each pixel point in the first image using a second sub-matrix in the Sobel matrix to obtain third gradient information of the pixel point in a second direction; and obtain a gradient map of the first image according to the second gradient information and the third gradient information of each pixel point.

[0180] Thus, for each pixel point in the first image, the second gradient information of the pixel point in the first direction is obtained by processing the pixel point using the first sub-matrix in the Sobel matrix, and then the third gradient information of the pixel point in the second direction is obtained by processing the pixel point using the second sub-matrix in the Sobel matrix, and then the gradient map of the first image can be obtained according to the second gradient information and the third gradient information of each pixel point. Thus, by quantizing the gradient information of each pixel point in the first image, the gradient map of the first image can be accurately obtained.

[0181] In some embodiments, the processor 610 is further configured to randomly generate a random number value using a random function; determine a correction value corresponding to each pixel point according to the random number value, the tendency index corresponding to the pixel point, and a maximum value of a range of random number values randomly generated by the random function; and correct the integer bit value corresponding to each pixel point based on the correction value of each pixel point to obtain a target pixel value of the pixel point converted into the second bit depth.

[0182] Thus, for each pixel point in the first image, a random number value is randomly generated using a random function, and then a correction value corresponding to the pixel point is determined according to the random number value, the tendency index corresponding to the pixel point, and a maximum value of a range of random number values randomly generated by the random function. Thus, the integer bit value corresponding to the pixel point can be corrected using the correction value of the pixel point, and then the target pixel value of the pixel point converted into the second bit depth can be accurately obtained. Thus, compared with directly rounding the decimal bit value in the prior art, the scheme of the embodiments of the present application uses the tendency index to determine the tendency of rounding the decimal bit value, and then uses the tendency to correct the integer bit value, thereby reducing the image layering problem caused by precision loss.

[0183] In some embodiments, the processor 610 is further configured to determine the sum of the correction value of each pixel point and the integer bit value corresponding to each pixel point as the target pixel value of the pixel point converted into the second bit depth.

[0184] Thus, for each pixel point in the first image, the sum of the correction value of the pixel point and the integer bit value corresponding to the pixel point can be determined as the target pixel value of the pixel point converted into the second bit depth, so that the target pixel value can be accurately determined, and then the second image with faded layering can be obtained, thereby reducing the image layering problem caused by precision loss.

[0185] It should be understood that in the embodiments of the present application, the input unit 604 can include a graphics processor (GPU) 6041 and a microphone 6042. The graphics processor 5041 processes image data of a still picture or a video obtained by an image capture device (such as a color camera) in a video capture mode or an image capture mode. The display unit 606 can include a display panel 6061, which can be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 607 includes at least one of a touch panel 6071 and other input devices 6072. The touch panel 6071 is also referred to as a touch screen. The touch panel 6071 can include two parts of a touch detection device and a touch controller. The other input devices 6072 can include, but are not limited to, a physical keyboard, function keys (such as volume control keys, on-off keys, and the like), a trackball, a mouse, a joystick, and the like, which will not be described here.

[0186] The memory 609 can be used to store software programs and various data. The memory 609 can mainly include a first storage area storing programs or instructions and a second storage area storing data, wherein the first storage area can store an operating system, application programs or instructions required by at least one function (such as a sound playing function, an image playing function, and the like), and the like. In addition, the memory 609 can include a volatile memory or a non-volatile memory, or the memory 609 can include both volatile and non-volatile memories. The non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct memory bus random access memory (Direct Rambus RAM, DRRAM). The memory 609 in the embodiments of the present application includes but is not limited to these and any other suitable types of memory.

[0187] The processor 610 can include one or more processing units; optionally, the processor 610 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and an application program, and the modem processor mainly processes a wireless communication signal, such as a baseband processor. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 610.

[0188] The embodiment of the present application further provides a readable storage medium, and the readable storage medium stores a program or instructions, the program or instructions are executed by a processor to realize various processes of the above-mentioned image processing method embodiment, and the same technical effects can be achieved, and details are not repeated here.

[0189] The processor is the processor in the electronic device in the above-mentioned embodiment. The readable storage medium includes a computer readable storage medium, such as a computer readable only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like.

[0190] The embodiment of the present application further provides a chip, and the chip includes a processor and a communication interface, the communication interface is coupled with the processor, and the processor is used to run a program or instructions to realize various processes of the above-mentioned image processing method embodiment, and the same technical effects can be achieved, and details are not repeated here.

[0191] It should be understood that the chip mentioned in the embodiment of the present application can also be referred to as a system level chip, a system chip, a chip system, or a system on chip, etc.

[0192] The embodiment of the present application provides a computer program product, and the program product is stored in a storage medium, and the program product is executed by at least one processor to realize various processes of the above-mentioned image processing method embodiment, and the same technical effects can be achieved, and details are not repeated here.

[0193] It should be noted that, in the present document, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element. Furthermore, it is to be understood that the method and apparatus of the present application can be carried out by more than one process, method, article, or apparatus either simultaneously, concurrently, or with intervening action that are carried out at the same time, either in a simultaneous fashion or in a fashion that is interleaved in time. For example, the described methods can be performed in a different order from that described, and / or various steps can be combined or omitted, and / or additional steps can be added, without departing from the scope of the present application. Also, features described with respect to certain examples can be combined in other examples.

[0194] From the above description of the embodiments, it is apparent that the above-mentioned method can be realized by means of software and necessary universal hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solution of the present application can be embodied in the form of computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, or network equipment, etc.) execute the method described in various embodiments of the present application.

[0195] The embodiments of the present application are described above in conjunction with the drawings, but the present application is not limited to the above-described specific embodiments, and the above-described specific embodiments are merely illustrative, rather than limiting, and those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the scope protected by the claims.

Claims

1. An image processing method, characterized by, The method comprises: obtaining a gradient map corresponding to a first image, wherein the first image has a first bit depth; determining integer bit values and decimal bit values of pixel values of each pixel point in the first image when the pixel points are converted into pixel points with a second bit depth lower than the first bit depth; determining a tendency index of the decimal bit values of each pixel point according to the gradient values corresponding to the gradient map and the decimal bit values corresponding to each pixel point; determining target pixel values of each pixel point in the first image converted into pixel points with the second bit depth based on the tendency index corresponding to each pixel point and the integer bit values; generating a second image according to the target pixel values of each pixel point with the second bit depth.

2. The method of claim 1, wherein, The method comprises: determining a gradient degree of each pixel point in the gradient map according to the gradient values of each pixel point in the gradient map and a reference threshold value; determining a tendency index of the decimal bit values of each pixel point according to the gradient degree and the decimal bit values corresponding to each pixel point.

3. The method of claim 2, wherein, The method comprises: determining the gradient degree of each pixel point as a ratio of the gradient value of each pixel point to the reference threshold value.

4. The method of claim 2, wherein, Before the gradient degree of each pixel point in the gradient map is determined according to the gradient value of each pixel point in the gradient map and a reference threshold value, the method further comprises: obtaining a target edge feature type corresponding to each pixel point in the gradient map; processing reference images of each target edge feature type by using a Sobel matrix to obtain first gradient information corresponding to the reference images of each target edge feature type; taking the first gradient information corresponding to a first target edge feature type as a reference threshold value corresponding to a first pixel point in the gradient map, wherein the first target edge feature type is any one of the target edge feature types, and the first pixel point is a pixel point with the first target edge feature type in the gradient map.

5. The method of claim 1, wherein, The method comprises: processing each pixel point in the first image by using a first sub-matrix in a Sobel matrix to obtain second gradient information of the pixel point in a first direction; processing each pixel point in the first image by using a second sub-matrix in the Sobel matrix to obtain third gradient information of the pixel point in a second direction; obtaining a gradient map corresponding to the first image according to the second gradient information and the third gradient information of each pixel point.

6. The method of claim 1, wherein, The method comprises: randomly generating a random value by using a random function; determine a correction value corresponding to each pixel point according to the random value, the tendency index corresponding to each pixel point, and a maximum value of a random value range randomly generated by the random function; correct the integer bit value corresponding to each pixel point based on the correction value of each pixel point, to obtain a target pixel value of each pixel point converted into a pixel point of the second bit depth.

7. The method of claim 6, wherein, The correcting the integer bit value corresponding to each pixel point based on the correction value of each pixel point, to obtain a target pixel value of each pixel point converted into a pixel point of the second bit depth, includes: determining a sum of the correction value of each pixel point and the integer bit value corresponding to each pixel point as the target pixel value of the pixel point converted into the pixel point of the second bit depth.

8. An image processing apparatus characterized by comprising: The apparatus includes: a first acquisition module configured to acquire a gradient map corresponding to a first image, wherein a bit depth of the first image is a first bit depth; a first determination module configured to determine an integer bit value and a decimal bit value of a pixel value conversion of each pixel point in the first image when each pixel point in the first image is converted into a pixel point of a second bit depth, wherein the second bit depth is lower than the first bit depth; a second determination module configured to determine a tendency index of an integer rounding of the decimal bit value corresponding to each pixel point according to the decimal bit value corresponding to each pixel point and a gradient value corresponding to the gradient map; a third determination module configured to determine a target pixel value of each pixel point converted into the pixel point of the second bit depth in the first image based on the tendency index corresponding to each pixel point and the integer bit value; a fourth determination module configured to generate a second image according to the target pixel value of each pixel point of the second bit depth.

9. The apparatus of claim 8, wherein, The second determination module includes: a first determination unit configured to determine a gradient degree of each pixel point in the gradient map according to a gradient value of each pixel point in the gradient map and a reference threshold value; a second determination unit configured to determine a tendency index of an integer rounding of the decimal bit value corresponding to each pixel point according to the decimal bit value corresponding to each pixel point and the gradient degree.

10. An electronic device, comprising: An apparatus includes a processor and a memory storing a program or instructions executable on the processor, the program or instructions being executed by the processor to implement steps of the image processing method of any one of claims 1-7.

Citation Information

Patent Citations

  • FPGA-based linear feature extraction system

    CN106504182A

  • Image edge detection and tracking method

    CN116109661A