Image processing method and device, computer equipment and storage medium
By determining the distortion region in image processing and optimizing the image using the mapping relationship between wide-angle coordinates and distortion coordinates, the misjudgment and local distortion problems caused by distortion compensation based on a single region in the prior art are solved, and more efficient image distortion optimization is achieved.
Patent Information
- Application Number
- CN202310957962.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art compensates based on a single area in image distortion optimization, which can easily lead to misjudgment and local image distortion, which will affect the distortion optimization effect.
By acquiring the distortion value of the target image, the distortion area is determined, and the corresponding wide-angle image is acquired. Based on the mapping relationship between the wide-angle coordinates of pixel points in the distortion area and the distortion coordinates, the wide-angle coordinates of other pixel points except the target pixel point are calculated to optimize the distortion of the image.
It improves the accuracy and accuracy of image distortion optimization, reduces local image distortion phenomenon, and significantly improves the effect of distortion optimization.
Smart Images

Figure CN119477764A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image technology, and in particular to an image processing method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] Image distortion occurs during the image capture process of a terminal, and relatively small distortions will be infinitely magnified on the terminal. Especially when taking close-up images with the main camera, the distortion will be more obvious the closer the focal length is. With the development of technology, users have higher and higher requirements for the terminal's shooting functions. Therefore, the terminal needs to optimize the distortion in the output image.
[0003] In the related art, distortion compensation is specifically performed through adjacent areas. However, the basis of this distortion compensation algorithm is relatively simple, and there may be misjudgments in the distortion compensation, so local image distortion may occur, resulting in poor distortion optimization effect. Summary of the invention
[0004] Based on this, it is necessary to provide an image processing method, device, computer equipment, computer-readable storage medium and computer program product that can improve the distortion optimization effect in response to the above technical problems.
[0005] In a first aspect, the present application provides an image processing method. The method comprises:
[0006] Acquire a target image, and determine a distorted area based on a distortion value of the target image;
[0007] Acquire a wide-angle image corresponding to the target image, and determine the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image;
[0008] Based on the wide-angle coordinates of each target pixel point in the distorted area and the mapping relationship between the distorted coordinates of each target pixel point in the target image, obtaining the wide-angle coordinates of other pixel points in the distorted area except the target pixel point;
[0009] Based on the wide-angle coordinates of each pixel point in the distorted area, a distortion-optimized image of the target image is obtained.
[0010] In one of the embodiments, determining the distortion area based on the distortion value of the target image includes:
[0011] Based on the image data of each area of the target image, respectively calculating the distortion value of each area of the target image;
[0012] In the target image, a region whose distortion value is greater than a first distortion value threshold is determined as a distorted region.
[0013] In one of the embodiments, determining the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image includes:
[0014] Determining a linear pixel point in the distorted area as a target pixel point;
[0015] Based on the pixel position of the target pixel in the distorted area, the pixel position of the target pixel in the wide-angle image is determined, and based on the pixel position of the target pixel in the wide-angle image, the wide-angle coordinates of the target pixel are obtained.
[0016] In one of the embodiments, obtaining the wide-angle coordinates of other pixels in the distorted area except the target pixel based on the mapping relationship between the wide-angle coordinates of each target pixel in the distorted area and the distorted coordinates of each target pixel in the target image includes:
[0017] Fitting is performed based on the wide-angle coordinates of each target pixel point in the distorted area, the distorted coordinates of each target pixel point in the target image, and the distortion value of the distorted area to obtain a mapping relationship between the wide-angle coordinates and the distorted coordinates;
[0018] Based on the mapping relationship between the wide-angle coordinates and the distorted coordinates and the distorted coordinates of other pixels in the distorted area except the target pixel in the target image, the wide-angle coordinates of other pixels in the distorted area except the target pixel are calculated.
[0019] In one embodiment, acquiring the target image includes:
[0020] Get the initial image;
[0021] If the initial image meets the preset distortion optimization condition, the initial image is determined to be the target image.
[0022] In one embodiment, after the step of acquiring the initial image, the method further comprises:
[0023] Calculating a shooting distance between the initial image and an image acquisition device that shoots the initial image;
[0024] If the shooting distance is less than a preset distance threshold, calculating a distortion value of the initial image;
[0025] If the distortion value of the initial image is greater than a second distortion threshold, performing line recognition processing on the initial image to obtain the length of the lines in the initial image;
[0026] If the line length is greater than a preset length threshold, it is determined that the initial image meets a preset distortion optimization condition.
[0027] In one embodiment, calculating the distortion value of the initial image includes:
[0028] The initial image is input into a preset distortion value detection model to obtain the distortion value of the initial image.
[0029] In one embodiment, the preset distortion value detection model includes a classification layer and a detection layer; the method further includes:
[0030] Performing line detection on the initial image through the classification layer to obtain line data contained in the initial image, wherein the line data includes standard line information and actual line information of each line;
[0031] The detection layer is used to calculate the distortion angle of the initial image based on the standard line information and the actual line information of each line, and the distortion angle of the initial image is determined as the distortion value of the initial image.
[0032] In one embodiment, the preset distortion value detection model further includes a screening layer, and the detecting layer is used to calculate the distortion angle of the initial image based on the standard line information and the actual line information of each line, and the distortion angle of the initial image is determined as the distortion value of the initial image, including:
[0033] Calculating the distortion angle of each line based on the standard line information and the actual line information of each line through the detection layer;
[0034] Through the screening layer, the distortion angles of the initial image including each line calculated by the detection layer are screened, and the distortion angles satisfying preset normal conditions are determined as the distortion angles of the initial image, and the distortion angles of the initial image are determined as the distortion values of the initial image.
[0035] In one embodiment, the method further comprises:
[0036] A distortion-optimized image of the target image is displayed.
[0037] In a second aspect, the present application also provides an image processing device. The device comprises:
[0038] A first acquisition module, used to acquire a target image and determine a distortion area based on a distortion value of the target image;
[0039] A first determination module is used to collect a wide-angle image corresponding to the target image, and determine the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image;
[0040] A mapping module, configured to obtain the wide-angle coordinates of other pixel points in the distorted area except the target pixel point based on the mapping relationship between the wide-angle coordinates of each target pixel point in the distorted area and the distorted coordinates of each target pixel point in the target image;
[0041] The distortion optimization module is used to obtain a distortion optimized image of the target image based on the wide-angle coordinates of each pixel point in the distortion area.
[0042] In one of the embodiments, the first acquisition module is specifically used to calculate the distortion value of each area of the target image based on the image data of each area of the target image;
[0043] In the target image, a region whose distortion value is greater than a first distortion value threshold is determined as a distorted region.
[0044] In one of the embodiments, the first determination module is specifically configured to determine a linear pixel point in the distortion area as a target pixel point;
[0045] Based on the pixel position of the target pixel in the distorted area, the pixel position of the target pixel in the wide-angle image is determined, and based on the pixel position of the target pixel in the wide-angle image, the wide-angle coordinates of the target pixel are obtained.
[0046] In one of the embodiments, the mapping module is specifically used to: perform fitting based on the wide-angle coordinates of each target pixel point in the distorted area, the distorted coordinates of each target pixel point in the target image, and the distortion value of the distorted area to obtain a mapping relationship between the wide-angle coordinates and the distorted coordinates;
[0047] Based on the mapping relationship between the wide-angle coordinates and the distorted coordinates and the distorted coordinates of other pixels in the distorted area except the target pixel in the target image, the wide-angle coordinates of other pixels in the distorted area except the target pixel are calculated.
[0048] In one embodiment, the first acquisition module is specifically used to: acquire an initial image;
[0049] If the initial image meets the preset distortion optimization condition, the initial image is determined to be the target image.
[0050] In one embodiment, the device further comprises:
[0051] A first calculation module, used for calculating a shooting distance between the initial image and an image acquisition device that shoots the initial image;
[0052] A second calculation module, configured to calculate a distortion value of the initial image if the shooting distance is less than a preset distance threshold;
[0053] A line recognition module, configured to perform line recognition processing on the initial image to obtain the length of the lines in the initial image if the distortion value of the initial image is greater than a second distortion threshold;
[0054] The condition module is used to determine that the initial image meets a preset distortion optimization condition if the line length is greater than a preset length threshold.
[0055] In one embodiment, the second computing module is specifically used to:
[0056] The initial image is input into a preset distortion value detection model to obtain the distortion value of the initial image.
[0057] In one embodiment, the preset distortion value detection model includes a classification layer and a detection layer; the device also includes:
[0058] A line detection module, used to perform line detection on the initial image through the classification layer to obtain line data contained in the initial image, wherein the line data includes standard line information and actual line information of each line;
[0059] The distortion value calculation module is used to calculate the distortion angle of the initial image through the detection layer based on the standard line information and the actual line information of each line, and determine the distortion angle of the initial image as the distortion value of the initial image.
[0060] In one embodiment, the preset distortion value detection model further includes a screening layer, and the distortion value calculation module is specifically used to:
[0061] Calculating the distortion angle of each line based on the standard line information and the actual line information of each line through the detection layer;
[0062] Through the screening layer, the distortion angles of the initial image including each line calculated by the detection layer are screened, and the distortion angles satisfying preset normal conditions are determined as the distortion angles of the initial image, and the distortion angles of the initial image are determined as the distortion values of the initial image.
[0063] In one embodiment, the device further comprises:
[0064] A display module is used to display the distortion-optimized image of the target image.
[0065] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0066] Acquire a target image, and determine a distorted area based on a distortion value of the target image;
[0067] Acquire a wide-angle image corresponding to the target image, and determine the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image;
[0068] Based on the wide-angle coordinates of each target pixel point in the distorted area and the mapping relationship between the distorted coordinates of each target pixel point in the target image, obtaining the wide-angle coordinates of other pixel points in the distorted area except the target pixel point;
[0069] Based on the wide-angle coordinates of each pixel point in the distorted area, a distortion-optimized image of the target image is obtained.
[0070] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0071] Acquire a target image, and determine a distorted area based on a distortion value of the target image;
[0072] Acquire a wide-angle image corresponding to the target image, and determine the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image;
[0073] Based on the wide-angle coordinates of each target pixel point in the distorted area and the mapping relationship between the distorted coordinates of each target pixel point in the target image, obtaining the wide-angle coordinates of other pixel points in the distorted area except the target pixel point;
[0074] Based on the wide-angle coordinates of each pixel point in the distorted area, a distortion-optimized image of the target image is obtained.
[0075] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0076] Acquire a target image, and determine a distorted area based on a distortion value of the target image;
[0077] Acquire a wide-angle image corresponding to the target image, and determine the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image;
[0078] Based on the wide-angle coordinates of each target pixel point in the distorted area and the mapping relationship between the distorted coordinates of each target pixel point in the target image, obtaining the wide-angle coordinates of other pixel points in the distorted area except the target pixel point;
[0079] Based on the wide-angle coordinates of each pixel point in the distorted area, a distortion-optimized image of the target image is obtained.
[0080] The above-mentioned image processing method, device, computer equipment, storage medium and computer program product obtain a target image and determine the distortion area based on the distortion value of the target image; collect a wide-angle image corresponding to the target image, and determine the wide-angle coordinates of each target pixel point in the distortion area in the wide-angle image; based on the mapping relationship between the wide-angle coordinates of each target pixel point in the distortion area and the distortion coordinates of each target pixel point in the target image, obtain the wide-angle coordinates of other pixel points in the distortion area except the target pixel point; based on the wide-angle coordinates of each pixel point in the distortion area, obtain the distortion optimized image of the target image.
[0081] By adopting this method, the distortion area in the target image that needs to be subjected to distortion optimization processing can be precisely determined, and the wide-angle image corresponding to the distortion area can be acquired in real time. Based on the mapping relationship between the distortion coordinates of the pixel points in the distortion area and the wide-angle coordinates of the pixel points in the distortion area in the wide-angle area, the distortion of the image in the distortion area can be optimized, thereby ensuring the precision and accuracy of the distortion optimization. The method has a wide range of applications and high versatility. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] Figure 1 A diagram showing an application environment of an image processing method in an embodiment;
[0083] Figure 2 is a schematic flow chart of an image processing method in one embodiment;
[0084] Figure 3 A schematic diagram of a flow chart of a step of determining a distortion region in an embodiment;
[0085] Figure 4 A schematic diagram of a flow chart of a step of calculating a wide-angle coordinate of a target pixel point in one embodiment;
[0086] Figure 5 A schematic diagram of a flow chart of a step of calculating wide-angle coordinates of other pixel points except the target pixel point in one embodiment;
[0087] Figure 6A schematic diagram of a process for determining a target image in one embodiment;
[0088] Figure 7 A schematic diagram of a flow chart of a step of determining whether a preset distortion optimization condition is met in one embodiment;
[0089] Figure 8 A schematic diagram of a flow chart of a step of calculating a distortion value in one embodiment;
[0090] Fig. 9 A schematic diagram of a flow chart of a step of calculating a distortion value in one embodiment;
[0091] Fig.10 A schematic flow chart of an image processing method in another embodiment;
[0092] Fig.11 is a schematic flow chart of a distortion identification step in one embodiment;
[0093] Fig.12 is a schematic flow chart of a distortion optimization step in one embodiment;
[0094] Fig.13 is a schematic diagram of a function obtained by fitting in one embodiment;
[0095] Fig.14 is a structural block diagram of an image processing device in one embodiment;
[0096] Fig.15 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0097] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0098] The embodiments of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 can be a terminal including an image acquisition device 104. The terminal 102 performs a shooting operation through the image acquisition device 104 to obtain a target image, and when it is determined that the target image can be optimized for distortion, the target image can be optimized for distortion based on the wide-angle coordinates of each pixel point in the distortion area of the target image to obtain a distortion-optimized image corresponding to the target image, and output the distortion-optimized image on the terminal. In an example, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, and the like.
[0099] In one embodiment, Figure 2 As shown, an image processing method is provided. This embodiment is described by taking the method applied to a terminal as an example. The terminal may be a terminal including an image acquisition device. In this embodiment, the image processing method includes the following steps:
[0100] Step 202: Acquire a target image, and determine a distortion area based on a distortion value of the target image.
[0101] Among them, the target image can be an image to be subjected to distortion optimization processing, or it can be an image acquired by an image acquisition device on the terminal, and the image acquisition device can be a main camera module on the terminal; in one example, the terminal can acquire the target image through the main camera module on the terminal in response to an image acquisition instruction of the user; the distortion value of the target image is a numerical value representing the degree of distortion of the target image, and the distortion value can be a distortion angle, etc.; the distortion area can be an area with more obvious distortion obtained by screening in the target image, for example, it can be a distorted area obtained by screening in the target image based on the distortion value.
[0102] Specifically, the terminal can obtain the target image through the image acquisition device on the terminal; the terminal can calculate the distortion value of each area contained in the target image, and screen the various areas contained in the target image based on the distortion value, and determine the distorted area in the target image.
[0103] Step 204 , acquiring a wide-angle image corresponding to the target image, and determining the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image.
[0104] Among them, the wide-angle image can be an image collected by a wide-angle module on the terminal, the wide-angle image can be an undistorted image, the target image can contain multiple pixels, and each target pixel point corresponding to the distortion area can be a pixel point in a linear area of the distortion area, or a pixel point obtained by screening in a non-linear area of the distortion area; the wide-angle coordinates of the target pixel point in the wide-angle image can be the position coordinate information of the target pixel point in the wide-angle image, that is, the undistorted coordinates of the target pixel point.
[0105] Specifically, the terminal can re-capture the target image through the wide-angle module on the terminal to obtain a wide-angle image corresponding to the target image; based on this, the terminal can determine one or more pixels from the multiple pixels included in the distorted area to determine the target pixel. In this way, the terminal can determine the wide-angle coordinates of the target pixel in the wide-angle image based on the pixel positions of each target pixel.
[0106] In one example, the terminal can perform image capture at the first spatial position coordinates through an image capture device on the terminal to obtain a target image; in this way, when the terminal performs distortion optimization processing on the target image, it can perform image capture again based on the first spatial position coordinates and the wide-angle module on the terminal to obtain a wide-angle image corresponding to the target image, and the image information in the wide-angle image includes the image information in the target image.
[0107] Step 206 , based on the wide-angle coordinates of each target pixel point in the distorted area and the mapping relationship between the distorted coordinates of each target pixel point in the target image, obtain the wide-angle coordinates of other pixel points in the distorted area except the target pixel point.
[0108] Among them, the mapping relationship between the wide-angle coordinates of each target pixel point in the distorted area and the distorted coordinates of each target pixel point in the target image can be a mapping relationship between the distorted coordinates corresponding to the distorted area and the wide-angle coordinates, or a mapping relationship between the distorted coordinates corresponding to the distorted area and the undistorted coordinates; other pixel points in the distorted area except the target pixel point can be multiple other pixel points contained in the distorted area except the target pixel point.
[0109] Specifically, after the step of determining each target pixel in the distorted area, the terminal can determine the pixel position of each target pixel in the distorted area, and based on the pixel position of each target pixel in the distorted area, determine the pixel position of each target pixel in the wide-angle image, and obtain the wide-angle coordinates of each target pixel in the wide-angle image, and obtain the mapping relationship between the distorted coordinates of each target pixel in the distorted area and the wide-angle coordinates of each target pixel in the wide-angle image. Based on this, the terminal can calculate the wide-angle coordinates of each pixel other than the target pixel in the distorted area based on the mapping relationship between the distorted coordinates of the determined target pixel in the distorted area and the wide-angle coordinates in the wide-angle image.
[0110] Step 208: obtaining a distortion-optimized image of the target image based on the wide-angle coordinates of each pixel point in the distortion area.
[0111] The distortion-optimized image of the target image may be an image obtained after the terminal performs distortion optimization processing on the target image, for example, it may be an image whose distortion degree is imperceptible to the user.
[0112] Specifically, the terminal can move each pixel in the distorted image to the corresponding wide-angle coordinate position based on the determined wide-angle coordinates of each pixel in the distorted area to obtain an image of the distorted area after distortion optimization. At the same time, the terminal can also screen based on the distortion values of each area in the target image to determine the non-distorted area in the target image; based on this, the terminal can process the image of the distorted area after distortion optimization and the image corresponding to the non-distorted area in the target image to obtain the target image after distortion optimization.
[0113] In an example, the terminal may perform a splicing process on the image of the distorted area after distortion optimization and the image corresponding to the non-distorted area in the target image to obtain the target image after distortion optimization.
[0114] In the above image processing method, a target image is acquired, and a distorted area is determined based on the distortion value of the target image. A wide-angle image corresponding to the target image is acquired, and the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image are determined. Based on the mapping relationship between the wide-angle coordinates of each target pixel point in the distorted area and the distorted coordinates of each target pixel point in the target image, the wide-angle coordinates of other pixels in the distorted area except the target pixel point are obtained. Based on the wide-angle coordinates of each pixel point in the distorted area, a distortion-optimized image of the target image is obtained.
[0115] By adopting this method, the distortion area in the target image that needs to be subjected to distortion optimization processing can be precisely determined, and the wide-angle image corresponding to the distortion area can be collected in real time. Based on the mapping relationship between the distortion coordinates of the pixel points in the distortion area and the wide-angle coordinates of the pixel points in the distortion area in the wide-angle area, the distortion of the image in the distortion area can be optimized to ensure the precision and accuracy of the distortion optimization. It is also possible to timely perform distortion optimization processing on the collected image after the user takes the image through the terminal, and output the obtained distortion optimized image of the target image in real time, thereby realizing distortion optimization processing without the user's perception, improving the user's picture shooting experience, and also improving the image quality.
[0116] In one embodiment, Figure 3 As shown, the specific processing process of step 202 "determining the distortion area based on the distortion value of the target image" includes:
[0117] Step 302: Calculate the distortion value of each area of the target image based on the image data of each area of the target image.
[0118] Among them, the image data of each area in the target image can be the straight line information of each area in the target image, and the straight line information can include actual straight line data and preset straight line data corresponding to the actual straight line data; the distortion value can be the distortion angle calculated based on the straight line information in the area.
[0119] Specifically, the terminal can obtain the straight line information of each area in the target image, for example, the terminal can obtain the original image data (raw image) corresponding to the target image, and extract the straight line information corresponding to each area in the original image data. For each straight line information in each area, the terminal can calculate the angle between the preset straight line data and the actual straight line data based on the actual straight line data in the straight line information and the preset straight line data corresponding to the actual straight line data, and determine the calculated angle as the amount of distortion value corresponding to the straight line information, that is, as the distortion value in the area; wherein the actual straight line data can be the actual position information of the straight line contained in the area, and the standard straight line data corresponding to the actual straight line data can be the theoretical position information of the straight line in theory.
[0120] In a possible implementation, the terminal may perform distortion value detection on the target image through a preset distortion value detection model to obtain the distortion values corresponding to each region in the target image and the distortion value corresponding to the target image.
[0121] Step 304: In the target image, determine that a region whose distortion value is greater than a first distortion value threshold is a distorted region.
[0122] Among them, the first distortion value threshold may be a preconfigured distortion value threshold, for example, it may be a distortion value threshold determined based on the degree of distortion at which the user is not aware of the distortion, for example, the degree of distortion at which the user is not aware of the distortion may be a target value, and the first distortion value threshold may be a distortion value less than or equal to the target value; the first distortion value may also be a distortion value threshold determined based on a correspondence between a field of view angle and a distortion value; in an example, the first distortion value threshold may be 0.4. The present disclosure does not limit the specific numerical value of the first distortion value threshold, and those skilled in the art may determine it specifically based on actual application scenarios.
[0123] Specifically, the terminal can screen the images contained in the target image based on the distortion values of the various regions contained in the target image. For example, the terminal can compare the distortion values of the various regions with the first distortion value threshold respectively, and determine the region whose distortion value is greater than or equal to the first distortion value threshold as the distorted region corresponding to the target image; accordingly, the terminal can determine the region whose distortion value is less than the first distortion value threshold as the distortion-free region corresponding to the target image.
[0124] In one example, the terminal may respectively compare the distortion value of each area with the first distortion value threshold, and determine the area whose distortion value is greater than the first distortion value threshold as the distorted area corresponding to the target image; accordingly, the terminal may determine the area whose distortion value is less than or equal to the first distortion value threshold as the distortion-free area corresponding to the target image.
[0125] In another example, the terminal can perform a balanced calculation based on the computing power resources in the actual application scenario and the degree of distortion that ensures that the user is unaware of the distortion, and obtain a first distortion value threshold, which can ensure a balance between the consumption of computing power resources and the user's unawareness of the distortion.
[0126] In this embodiment, the distorted image in the target image is determined by the distortion values of each area in the target image, which provides a data basis for the subsequent distortion optimization processing. Under the condition of ensuring that the target image is optimized for distortion with fewer computing power resources, the image that is more in need of distortion optimization can be optimized, thereby ensuring the user's image viewing experience and avoiding additional consumption of terminal resources.
[0127] In one embodiment, Figure 4 As shown, the specific processing process of step 204 "determining the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image" includes:
[0128] Step 402: determine the linear pixel points in the distortion area as target pixel points.
[0129] The linear pixel points in the distorted area may be respective pixel points contained in the linear area in the distorted area.
[0130] Specifically, the terminal can divide the linear region and the nonlinear region in the distortion region to obtain the linear region and the nonlinear region corresponding to the distortion region. In this way, the terminal can determine the target pixel point based on each pixel point included in the linear region, and the terminal can also determine the target pixel point based on each pixel point in the nonlinear region.
[0131] In one example, the terminal can take points in the linear area of the distortion area. For example, the pixel points corresponding to the endpoints of the straight line contained in the linear area can be determined as target pixel points respectively. For example, 2 points can be taken in the linear area, which are distortion-free points after correction.
[0132] In another example, the terminal may take points in a nonlinear area in the distortion area, for example, from each pixel point included in the nonlinear area, take points every 10 pixels to determine the target pixel point.
[0133] Step 404, based on the pixel position of the target pixel in the distorted area, determine the pixel position of the target pixel in the wide-angle image, and based on the pixel position of the target pixel in the wide-angle image, obtain the wide-angle coordinates of the target pixel.
[0134] Among them, the pixel position of the target pixel in the distorted area may be the pixel coordinates of the target pixel in the distorted area, for example, the pixel may be in row coordinates and column coordinates, etc. The pixel position of the target pixel in the wide-angle image may be the pixel coordinates of multiple pixels contained in the wide-angle image of the target pixel, and the wide-angle coordinates of the target pixel may be the position coordinates of the target pixel in the wide-angle image.
[0135] Specifically, the terminal can determine the corresponding pixel position in the wide-angle image based on the pixel position of the target pixel in the distortion area, and extract the position coordinates of the corresponding pixel position in the wide-angle image through a position coordinate acquisition algorithm and determine them as wide-angle coordinates.
[0136] In this embodiment, by performing point calibration on each target pixel point included in the distorted area, the accurate position coordinates of each target pixel point in the wide-angle image can be obtained, thereby improving the efficiency of obtaining the wide-angle coordinates of the target pixel point, and providing an accurate data basis for subsequent distortion optimization, thereby ensuring the accuracy of distortion optimization.
[0137] In one embodiment, Figure 5 As shown, the specific processing process of step 206 "obtaining the wide-angle coordinates of other pixel points in the distorted area except the target pixel point based on the wide-angle coordinates of each target pixel point in the distorted area and the mapping relationship between the distorted coordinates of each target pixel point in the target image" includes:
[0138] Step 502 , fitting is performed based on the distortion value of the distorted area, the wide-angle coordinates of each target pixel point in the distorted area, and the distorted coordinates of each target pixel point in the target image to obtain a mapping relationship between the wide-angle coordinates and the distorted coordinates.
[0139] The mapping relationship between the wide-angle coordinates and the distortion coordinates may be a function obtained based on a coordinate function fitting process.
[0140] Specifically, the terminal can perform coordinate function fitting processing through the distortion value in the distortion area, the distortion coordinates of each target pixel point contained in the distortion area, and the wide-angle coordinates of each target pixel point contained in the distortion area in the wide-angle image. The obtained function can be a mapping relationship between the distortion coordinates and the wide-angle coordinates of the pixel points in the distortion area.
[0141] Step 504 , based on the mapping relationship between the wide-angle coordinates and the distorted coordinates and the distorted coordinates of the other pixels in the distorted area except the target pixel in the target image, calculate the wide-angle coordinates of the other pixels in the distorted area except the target pixel.
[0142] Specifically, the terminal can calculate the distorted coordinates of each pixel point in the distorted area except the target pixel point based on the mapping relationship between the wide-angle coordinates corresponding to the determined distorted area and the distorted coordinates, and obtain the wide-angle coordinates of the other pixel points in the distorted area except the target pixel point, that is, determine the undistorted coordinates corresponding to each pixel point in the distorted area.
[0143] In this embodiment, by performing a fitting process of a coordinate function, relatively accurate distortion-free coordinates corresponding to each pixel point in the distortion area can be obtained, thereby achieving a better distortion optimization effect.
[0144] In one embodiment, Figure 6 As shown, the specific processing process of step 202 "obtaining the target image" includes:
[0145] Step 602, obtaining an initial image.
[0146] Specifically, in response to the image capturing operation of the user, the terminal may capture an image through a main camera module on the terminal, and the terminal may determine the captured image as an initial image.
[0147] Step 604: If the initial image meets the preset distortion optimization condition, the initial image is determined to be the target image.
[0148] Among them, the preset distortion optimization condition is a condition used to determine whether the image needs to be distorted optimized. Specifically, it can be based on the shooting distance between the initial image and the image acquisition device, the distortion value of the initial image, and the straight line information in the initial image, to determine whether the initial image meets the preset distortion optimization condition.
[0149] Specifically, after the terminal acquires the initial image through the main camera module of the terminal, the terminal can obtain the image data of the initial image, and judge whether the initial image meets the preset distortion optimization condition based on the image data of the initial image. If the terminal determines that the initial image meets the preset distortion optimization condition, the terminal can determine that the initial image is an image that needs to be distorted, that is, a target image.
[0150] In this embodiment, by presetting the distortion optimization conditions to screen whether the images collected by the terminal need to be subjected to distortion optimization processing, it can be ensured that the images that need to be subjected to distortion optimization processing are accurately and efficiently screened out under the condition of consuming less computing power resources, thereby avoiding outputting images with a more obvious degree of distortion, and further improving the image quality of the terminal output image.
[0151] In one embodiment, Figure 7 As shown, after the step of acquiring the initial image, the image processing method further includes:
[0152] Step 702: Calculate the shooting distance between the initial image and the image acquisition device that shoots the initial image.
[0153] The image acquisition device for capturing the initial image may be an image acquisition device on the terminal, or may be an image acquisition device independent of the terminal but connected to the terminal network, for example, it may be a main camera module on the terminal, or a video camera, etc.; the shooting distance between the initial image and the image acquisition device for capturing the initial image may be the distance between the content contained in the initial image and the image acquisition device for capturing the initial image. In one example, the image content contained in the initial image may be a building, and the shooting distance between the initial image and the image acquisition device for capturing the initial image may be the distance between the building and the image acquisition device.
[0154] Specifically, after acquiring the initial image, the terminal can collect the AF code value of the initial image, and determine the shooting distance corresponding to the AF code value of the initial image based on the pre-configured correspondence between the AF code value and the shooting distance, where different AF code values correspond to different shooting distances.
[0155] Step 704: If the shooting distance is less than the preset distance threshold, the distortion value of the initial image is calculated.
[0156] Among them, the preset distance threshold can be a pre-configured distance value, for example, it can be a distance value determined based on the actual application scenario. In one example, when the terminal is a mobile phone terminal equipped with a main camera module, the preset distance can be 30 cm. The present disclosure does not specifically limit the preset distance threshold, and technical personnel in this field can determine it based on the actual application scenario.
[0157] Specifically, after determining the shooting distance of the initial image, the terminal can compare the shooting distance of the initial image with a preset distance threshold to obtain a comparison result, and determine different first image processing strategies based on different comparison results. In one example, the comparison result obtained by the terminal may be that the shooting distance is less than the preset distance threshold, so that the terminal can determine that the initial image is obtained by shooting with a main camera module with a close focal length. Therefore, the terminal can determine that the first image processing strategy corresponding to the comparison result may be that the terminal performs scene recognition on the initial image to obtain a distortion value corresponding to the initial image.
[0158] The specific process of the terminal performing scene recognition and obtaining the distortion value corresponding to the initial image may be: when the terminal determines that the captured image of the initial image is less than a preset distance threshold, the terminal detects whether there is a straight line in the initial image. If a straight line exists, the terminal calculates the distortion angle of the straight line, and determines the distortion angle of the straight line as the distortion value of the initial image.
[0159] Step 706: If the distortion value of the initial image is greater than the second distortion threshold, line recognition processing is performed on the initial image to obtain the line length in the initial image.
[0160] Among them, the second distortion threshold can be a pre-configured distortion value, for example, it can be a distortion value corresponding to the degree of distortion that affects the user's image viewing experience and needs to be optimized based on the actual application scenario. In one example, the second distortion threshold can be 1°. The present disclosure does not specifically limit the second distortion threshold, and those skilled in the art can determine it based on the actual application scenario.
[0161] Specifically, after determining the distortion value of the initial image, the terminal may compare the distortion value of the initial image with the second distortion threshold to obtain a comparison result, and determine different second image processing strategies based on different comparison results. The second image processing strategy may be an image processing strategy for performing line recognition processing, and may also include an image processing strategy for not performing line recognition processing. In one example, the comparison result obtained by the terminal may be that the distortion value is greater than the second distortion threshold, so that the terminal may perform line recognition processing on the initial image based on the image processing strategy for performing line recognition processing to obtain the line length in the initial image.
[0162] The specific process of the terminal performing line recognition and obtaining the line length corresponding to the initial image can be: the terminal can perform line recognition on the initial image based on the 0.8F external field of view line detection algorithm of the image, and obtain the line length of the lines contained in the initial image. For example, it can be based on the LSD algorithm to recognize the lines in the initial image and calculate the line length of the recognized lines.
[0163] Step 708: If the line length is greater than a preset length threshold, it is determined that the initial image meets a preset distortion optimization condition.
[0164] Among them, the preset length threshold can be a pre-configured line length value, for example, it can be a line length value determined based on an actual application scenario. In one example, when the terminal is a mobile phone terminal equipped with a main camera module, the preset distance can be 10 mm. The present disclosure does not specifically limit the preset length threshold, and technical personnel in this field can determine it based on the actual application scenario.
[0165] Specifically, the terminal may compare the line length of the initial image with a preset length threshold to obtain a comparison result, and determine whether the initial image satisfies the preset distortion optimization condition based on the comparison result. If the line length of the initial image is greater than the preset length threshold, the terminal may determine that the initial image satisfies the preset distortion optimization condition, and the terminal may also determine that the initial image needs to be subjected to distortion optimization processing, that is, determine that the initial image is the target image; if the line length of the initial image is less than or equal to the preset length threshold, the terminal may determine that the initial image does not satisfy the preset distortion optimization condition, and the terminal may determine that the initial image does not need to be subjected to distortion optimization processing.
[0166] In this embodiment, whether the initial image meets the preset distortion optimization conditions is accurately judged by the shooting distance between the initial image and the image acquisition device, the distortion value of the initial image, and the straight line information in the initial image. This can ensure that images that require distortion optimization processing are accurately and efficiently screened out with less computing power consumption, avoid outputting images with obvious distortion, and further improve the image quality of the terminal output image.
[0167] In one embodiment, the specific processing of the step of "calculating the distortion value of the initial image" includes:
[0168] The initial image is input into a preset distortion value detection model to obtain the distortion value of the initial image.
[0169] The preset distortion value detection model may be a pre-trained distortion value detection model, for example, a pre-trained neural network detection model, or an AI model, etc. The preset distortion value detection model may include a classification layer, a detection layer, and a screening layer, etc., for calculating the distortion value of the image output to the distortion value detection model.
[0170] Specifically, the terminal can input the initial image into the distortion value detection model. After acquiring the initial image, the distortion value detection model can perform distortion value detection processing on the initial image to obtain the distortion value corresponding to the initial image, and output the distortion value corresponding to the initial image as the output result of the distortion value detection model. The terminal can determine the distortion value contained in the output result of the acquired distortion value detection model as the distortion value of the initial image.
[0171] In this embodiment, the distortion value detection model is used to detect the distortion value of the initial image, so as to improve the detection efficiency and accuracy of the distortion value.
[0172] In one embodiment, the preset distortion value detection model includes a classification layer and a detection layer. Specifically, the classification layer can be used to classify the lines in the initial image, and the detection layer is used to detect the distortion values of the lines in the initial image.
[0173] like Figure 8 As shown, the image processing method also includes:
[0174] Step 802: Perform line detection on the initial image through the classification layer to obtain line data contained in the initial image.
[0175] The line data includes standard line information and actual line information of each line.
[0176] Specifically, the terminal can input the initial image into a preset distortion value detection model, and detect and process the lines in the initial image through the classification layer in the preset distortion value detection model to obtain the lines and line data contained in the initial image, wherein each line data includes at least the actual line information of the line, and the line data can also include standard line information corresponding to each line, that is, preset theoretical line information.
[0177] Step 804 , calculating the distortion angle of the initial image based on the standard line information and the actual line information of each line through the detection layer, and determining the distortion angle of the initial image as the distortion value of the initial image.
[0178] Specifically, the terminal can input the line data contained in the initial image obtained by the classification layer into the detection layer in the preset distortion value detection model, and through the detection layer, based on the standard line information and actual line information of each line, calculate the maximum angle between the actual line and the standard line of each line; based on this, the detection layer can determine the distortion angle of the initial image based on the maximum angle corresponding to each line, and determine the distortion angle as the distortion value of the initial image.
[0179] In this embodiment, the distortion value of the initial image is detected by using a distortion value detection model, so that the accuracy of the distortion value calculation can be guaranteed.
[0180] In one embodiment, the preset distortion value detection model further includes a screening layer.
[0181] like Fig. 9 As shown, the specific processing process of the step of "calculating the distortion angle of the initial image through the detection layer based on the standard line information and the actual line information of each line, and determining the distortion angle of the initial image as the distortion value of the initial image" includes:
[0182] Step 902 , calculating the distortion angle of each line based on the standard line information and the actual line information of each line through the detection layer.
[0183] Specifically, the terminal can calculate the maximum angle between the actual line and the standard line of each line through the detection layer based on the standard line information and actual line information of each line; based on this, the detection layer can determine the distortion angle of the initial image based on the maximum angle corresponding to each line.
[0184] Step 904, through the screening layer, the distortion angles of each line in the initial image calculated by the detection layer are screened, the distortion angles that meet the preset normal conditions are determined as the distortion angles of the initial image, and the distortion angles of the initial image are determined as the distortion values of the initial image.
[0185] Among them, the preset normal condition is used to detect abnormal distortion values.
[0186] Specifically, the terminal can filter the distortion angles of each line included in the initial image calculated by the detection layer through the screening layer to obtain the distortion angles that meet the preset normal conditions. In this way, the terminal can obtain the distortion angle of the initial image based on the distortion angles that meet the preset normal conditions, and the terminal can determine the distortion angle of the initial image as the distortion value of the initial image.
[0187] In one example, the terminal can respectively calculate the difference between the distortion angle of each line and the preset distortion angle threshold. If the difference is greater than the preset difference threshold, the terminal can determine that the distortion angle of the line corresponding to the difference is a distortion angle that does not meet the preset normal condition; if the difference is less than or equal to the preset difference threshold, the terminal can determine that the distortion angle of the line corresponding to the difference is a distortion angle that meets the preset normal condition. The present disclosure does not specifically limit the preset distortion angle threshold and the preset difference threshold, and those skilled in the art can make specific determinations based on actual application scenarios.
[0188] In this embodiment, by performing abnormal detection on the distortion angle of each line in the initial image, the accuracy of the calculation of the distortion value of the initial image is ensured, and abnormal data is removed in time.
[0189] In one embodiment, the image processing method further includes:
[0190] Displays a distortion-optimized image of the target image.
[0191] Specifically, after the step of obtaining the distortion-optimized image of the target image, the terminal may display the distortion-optimized image on a display module of the terminal.
[0192] In this embodiment, by timely performing distortion optimization processing on the target image and outputting and displaying the obtained distortion optimized image in a timely manner, the distortion optimization processing of the image can be achieved without the user's perception, thereby ensuring the user experience.
[0193] The specific implementation process of the above image processing method is described in detail below in conjunction with a specific embodiment:
[0194] In the related technology, the distortion requirements of the terminal corresponding to the terminal of the end user are becoming more and more stringent, and the slight distortion is infinitely magnified on the terminal of the end user. Since the main camera module in the terminal is a close-focus camera module, the distortion generated by reaching 1.5° will seriously affect the user experience. Therefore, it is necessary to optimize the distortion of the image collected on the terminal in a timely manner and ensure the accuracy of the distortion optimization.
[0195] A distorted image in an actual application scenario may be, for example, a distorted image with a distortion value of 1°. When the distorted image is observed at a distance of 30 cm, the angle corresponding to the calculated bending amount may be 2.4°. Ideally, the limit resolution that the human eye can distinguish is 1.2°. However, when the image is displayed on a computer or a giant screen, the distortion will be magnified to a level that is noticeable to the human eye. Therefore, it is very necessary to optimize the distortion of the image in a timely manner.
[0196] like Fig.10As shown, it can be a flowchart of distortion optimization in a specific embodiment, which mainly includes distortion recognition and distortion optimization. The process of distortion recognition includes processing processes such as the mobile phone picture to be recognized, distance recognition, scene recognition, and line detection. The specific process of distortion recognition can be the detection of distance, scene, base variable, line, etc., to confirm whether the distortion amount has an impact on the user. If it is determined that the distortion amount has an impact on the user, the mobile phone picture to be recognized is subjected to distortion optimization processing.
[0197] The distortion optimization process includes: starting the distortion strategy, confirming the distortion scheme, optimizing the coordinate distortion, optimizing the distortion coordinates, optimizing the distortion calculation, comparing with the threshold, and if it is greater than the threshold, it is necessary to perform the distortion optimization process again, and if it is less than the threshold, output the effect map; specifically, the terminal can determine the distortion-free coordinates of each target pixel point contained in the mobile phone picture to be identified, and verify the optimized distorted image, and output the distortion-optimized effect map if it meets the requirements; the image processing method provided in this embodiment introduces distortion recognition and distortion coordinate optimization to improve the overall image performance. Since the main camera is the most frequently used by users, the distortion of the near focus will be greater than that of the mid-focus and far-focus in the design, and the degree of distortion is different in different scenes. The image processing method provided in this embodiment can save the power consumption of the algorithm through identification, and can optimize the distortion more efficiently.
[0198] like Fig.11 As shown, it can be a specific flow diagram of distortion recognition, that is, the distortion detection process: distance detection, obtain the shooting distance of the mobile phone picture to be identified; determine whether the shooting distance is less than 30cm. If the shooting distance is greater than 30cm, the distortion design value is already within 0.8, and the user can no longer identify it, so there is no need to optimize the distortion; if the shooting distance is less than 30cm, perform scene recognition, calculate the distortion value, and determine whether the distortion is greater than 1°. If the distortion is greater than 1°, perform line recognition, specifically by detecting the lines in the 0.8F external field of view to obtain the line length; determine whether the length is greater than 10mm, specifically, determine whether the detected line length exceeds 10mm. If the line length exceeds 10mm, it is determined that the distortion optimization process needs to be performed.
[0199] Specifically, the scene recognition in the image processing method provided in this embodiment can adopt a linearity detection mechanism, by collecting single-frame data, controlling the recognition part to pass AI classification and detection, and then performing AI screening, and then outputting the result. The AI classification and detection here specifically detect and classify the linearity in the picture, and AI screens and judges the lines, and outputs the recognition result. That is, the distortion value distribution map of different areas of the picture can be calculated to provide a data basis for optimizing distortion.
[0200] like Fig.12As shown, it can be a specific flow diagram of distortion optimization, that is, the distortion optimization process: obtain the raw image S0, calculate the distortion step-by-step diagram, determine whether the distortion is greater than 0.4, if it is less than or equal to 0.4, mark S1; if it is greater than 0.4, obtain the distortion area S2; turn on the wide angle, grab S3, build the distortion-free coordinates, fit the global function, and output the effect diagram; specifically, the terminal can calculate the distortion value distribution diagram corresponding to the mobile phone picture to be identified, and then set the distortion less than 0.4 as the undistorted area, that is, the coordinates of this area are the undistorted position. For the distorted area, turn on the wide angle assistance, grab the raw, assist in providing the distortion-free position, and finally output the effect diagram through fitting; that is, the terminal can perform distortion optimization processing by obtaining the distortion-free position corresponding to each pixel on the original image.
[0201] Specifically, the terminal can define the area below 0.4 as the distortion-free coordinate through the distortion value, locate more distortion-free coordinates through wide-angle assistance, and use finite point fitting for the remaining unconfirmed distortion area points.
[0202] In one example, if Fig.13 As shown, the fitting curve can be obtained: by selecting the relationship between multiple known points, after determining the coordinates of the points at 0, 0.1, 0.2...1, the trigonometric function can be selected as the model, and then the fitting process can be performed to obtain the fitting curve, and the coordinates of 0.01, 0.02, etc. can be determined based on the fitting curve.
[0203] The image data method provided in this embodiment is to optimize the close-range distortion of the main camera. It proposes a distortion recognition scheme for the first time, and improves the performance of the whole machine based on the distortion value optimization scheme. It proposes a multi-camera assisted point map construction for the first time, which improves the precision and accuracy of optimization; it proposes a distortion recognition scheme for the first time and applies it to the ghost optimization scheme, and applies it to products, greatly improving the competitiveness of products. It proposes to apply the multi-camera assisted point map construction to ghost optimization for the first time, and the effect is better; this solution is not only applicable to the mobile phone industry, but also to all products with camera distortion. It can be applied not only to distortion optimization, but also to effect debugging and driver performance optimization.
[0204] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0205] Based on the same inventive concept, the embodiment of the present application also provides an image processing device for implementing the above-mentioned image processing method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more image processing device embodiments provided below can refer to the limitations on the image processing method above, and will not be repeated here.
[0206] In one embodiment, Fig.14 As shown, an image processing device 1400 is provided, comprising: a first acquisition module 1402, a first determination module 1404, a mapping module 1406 and a distortion optimization module 1408, wherein:
[0207] A first acquisition module 1402 is used to acquire a target image and determine a distortion area based on a distortion value of the target image;
[0208] A first determination module 1404 is used to collect a wide-angle image corresponding to the target image, and determine the wide-angle coordinates of each target pixel point in the distortion area in the wide-angle image;
[0209] A mapping module 1406 is used to obtain the wide-angle coordinates of other pixels in the distorted area except the target pixel point based on the mapping relationship between the wide-angle coordinates of each target pixel point in the distorted area and the distorted coordinates of each target pixel point in the target image;
[0210] The distortion optimization module 1408 is used to obtain a distortion optimized image of the target image based on the wide-angle coordinates of each pixel point in the distortion area.
[0211] In one of the embodiments, the first acquisition module is specifically used to calculate the distortion value of each area of the target image based on the image data of each area of the target image;
[0212] In the target image, a region whose distortion value is greater than a first distortion value threshold is determined as a distorted region.
[0213] In one of the embodiments, the first determination module is specifically configured to determine a linear pixel point in the distortion area as a target pixel point;
[0214] Based on the pixel position of the target pixel in the distorted area, the pixel position of the target pixel in the wide-angle image is determined, and based on the pixel position of the target pixel in the wide-angle image, the wide-angle coordinates of the target pixel are obtained.
[0215] In one embodiment, the mapping module is specifically used to: perform fitting based on the wide-angle coordinates of each target pixel point in the distorted area, the distorted coordinates of each target pixel point in the target image, and the distortion value of the distorted area to obtain a mapping relationship between the wide-angle coordinates and the distorted coordinates;
[0216] Based on the mapping relationship between the wide-angle coordinates and the distorted coordinates and the distorted coordinates of other pixels in the distorted area except the target pixel in the target image, the wide-angle coordinates of other pixels in the distorted area except the target pixel are calculated.
[0217] In one embodiment, the first acquisition module is specifically used to: acquire an initial image;
[0218] If the initial image meets the preset distortion optimization condition, the initial image is determined to be the target image.
[0219] In one embodiment, the device further comprises:
[0220] A first calculation module, used for calculating a shooting distance between an initial image and an image acquisition device that shoots the initial image;
[0221] A second calculation module, configured to calculate a distortion value of the initial image if the shooting distance is less than a preset distance threshold;
[0222] A line recognition module, configured to perform line recognition processing on the initial image to obtain the length of the lines in the initial image if the distortion value of the initial image is greater than a second distortion threshold;
[0223] The condition module is used to determine whether the initial image meets the preset distortion optimization condition if the line length is greater than a preset length threshold.
[0224] In one embodiment, the second computing module is specifically configured to:
[0225] The initial image is input into a preset distortion value detection model to obtain the distortion value of the initial image.
[0226] In one embodiment, the preset distortion value detection model includes a classification layer and a detection layer; the device also includes:
[0227] A line detection module is used to perform line detection on the initial image through the classification layer to obtain line data contained in the initial image, where the line data includes standard line information and actual line information of each line;
[0228] The distortion value calculation module is used to calculate the distortion angle of the initial image through the detection layer based on the standard line information and the actual line information of each line, and determine the distortion angle of the initial image as the distortion value of the initial image.
[0229] In one embodiment, the preset distortion value detection model further includes a screening layer and a distortion value calculation module, which are specifically used to:
[0230] Through the detection layer, based on the standard line information and actual line information of each line, the distortion angle of each line is calculated;
[0231] Through the screening layer, the distortion angles of each line in the initial image calculated by the detection layer are screened, and the distortion angles that meet the preset normal conditions are determined as the distortion angles of the initial image, and the distortion angles of the initial image are determined as the distortion values of the initial image.
[0232] In one embodiment, the device further comprises:
[0233] The display module is used to display the distortion-optimized image of the target image.
[0234] Each module in the above image processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0235] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.15 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store image data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an image processing method is implemented.
[0236] Those skilled in the art will understand that Fig.15The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0237] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0238] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0239] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0240] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0241] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0242] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0243] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An image processing method, characterized in that: The method comprises: Acquire a target image, and determine a distorted area based on a distortion value of the target image; Acquire a wide-angle image corresponding to the target image, and determine the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image; Based on the wide-angle coordinates of each target pixel point in the distorted area and the mapping relationship between the distorted coordinates of each target pixel point in the target image, obtaining the wide-angle coordinates of other pixel points in the distorted area except the target pixel point; Based on the wide-angle coordinates of each pixel point in the distorted area, a distortion-optimized image of the target image is obtained.
2. The method according to claim 1, characterized in that The determining of the distortion area based on the distortion value of the target image includes: Based on the image data of each area of the target image, respectively calculating the distortion value of each area of the target image; In the target image, a region whose distortion value is greater than a first distortion value threshold is determined as a distorted region.
3. The method according to claim 1, characterized in that The determining of the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image includes: Determining a linear pixel point in the distorted area as a target pixel point; Based on the pixel position of the target pixel in the distorted area, the pixel position of the target pixel in the wide-angle image is determined, and based on the pixel position of the target pixel in the wide-angle image, the wide-angle coordinates of the target pixel are obtained.
4. The method according to claim 1, characterized in that The obtaining, based on the mapping relationship between the wide-angle coordinates of each target pixel point in the distorted area and the distorted coordinates of each target pixel point in the target image, the wide-angle coordinates of other pixel points in the distorted area except the target pixel point, comprises: Fitting is performed based on the distortion value of the distorted area, the wide-angle coordinates of each target pixel point in the distorted area, and the distorted coordinates of each target pixel point in the target image to obtain a mapping relationship between the wide-angle coordinates and the distorted coordinates; Based on the mapping relationship between the wide-angle coordinates and the distorted coordinates and the distorted coordinates of other pixels in the distorted area except the target pixel in the target image, the wide-angle coordinates of other pixels in the distorted area except the target pixel are calculated.
5. The method according to claim 1, characterized in that The acquiring of the target image comprises: Get the initial image; If the initial image meets the preset distortion optimization condition, the initial image is determined to be the target image.
6. The method according to claim 5, characterized in that After the step of acquiring the initial image, the method further comprises: Calculating a shooting distance between the initial image and an image acquisition device that shoots the initial image; If the shooting distance is less than a preset distance threshold, calculating a distortion value of the initial image; If the distortion value of the initial image is greater than a second distortion threshold, performing line recognition processing on the initial image to obtain the length of the lines in the initial image; If the line length is greater than a preset length threshold, it is determined that the initial image meets a preset distortion optimization condition.
7. The method according to claim 6, characterized in that The calculating the distortion value of the initial image includes: The initial image is input into a preset distortion value detection model to obtain the distortion value of the initial image.
8. The method according to claim 7, characterized in that The preset distortion value detection model includes a classification layer and a detection layer; the method further includes: Performing line detection on the initial image through the classification layer to obtain line data contained in the initial image, wherein the line data includes standard line information and actual line information of each line; The detection layer is used to calculate the distortion angle of the initial image based on the standard line information and the actual line information of each line, and the distortion angle of the initial image is determined as the distortion value of the initial image.
9. The method according to claim 8, characterized in that The preset distortion value detection model further includes a screening layer, and the detection layer is used to calculate the distortion angle of the initial image based on the standard line information and the actual line information of each line, and the distortion angle of the initial image is determined as the distortion value of the initial image, including: Calculating the distortion angle of each line based on the standard line information and the actual line information of each line through the detection layer; Through the screening layer, the distortion angles of the initial image including each line calculated by the detection layer are screened, and the distortion angles satisfying preset normal conditions are determined as the distortion angles of the initial image, and the distortion angles of the initial image are determined as the distortion values of the initial image.
10. The method according to claim 1, characterized in that The method further comprises: A distortion-optimized image of the target image is displayed.
11. An image processing device, characterized in that: The device comprises: A first acquisition module, used to acquire a target image and determine a distortion area based on a distortion value of the target image; A first determination module is used to collect a wide-angle image corresponding to the target image, and determine the wide-angle coordinates of each target pixel point in the distorted area in the wide-angle image; A mapping module, configured to obtain the wide-angle coordinates of other pixel points in the distorted area except the target pixel point based on the mapping relationship between the wide-angle coordinates of each target pixel point in the distorted area and the distorted coordinates of each target pixel point in the target image; The distortion optimization module is used to obtain a distortion optimized image of the target image based on the wide-angle coordinates of each pixel point in the distortion area.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
Citation Information
Cited By
Fisheye camera distortion removal method and device, storage medium and program product
CN121437337A
Portrait proportion stretching method and device, equipment, storage medium and product
CN121746256A