WO2021052236A1 - 图像畸变校正方法及装置 - Google Patents

图像畸变校正方法及装置 Download PDF

Info

Publication number
WO2021052236A1
WO2021052236A1 PCT/CN2020/114400 CN2020114400W WO2021052236A1 WO 2021052236 A1 WO2021052236 A1 WO 2021052236A1 CN 2020114400 W CN2020114400 W CN 2020114400W WO 2021052236 A1 WO2021052236 A1 WO 2021052236A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
area
region
field
view
Prior art date
Application number
PCT/CN2020/114400
Other languages
English (en)
French (fr)
Inventor
苏忱
彭焕文
彭水燃
曾毅华
郑士胜
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP20864788.3A priority Critical patent/EP4024325A4/en
Publication of WO2021052236A1 publication Critical patent/WO2021052236A1/zh
Priority to US17/698,650 priority patent/US20220207747A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/18Image warping, e.g. rearranging pixels individually
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/60Rotation of whole images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/44Morphing

Definitions

  • This application relates to image processing technology, in particular to image distortion correction methods and devices.
  • terminals such as mobile phones
  • the photography function has become one of the important functions of the terminal.
  • the problem of portrait image distortion in the image captured by the terminal has become more and more significant.
  • Image distortion is due to the fact that the optical system with large field of view and short focal length does not meet the pinhole model. After the chief rays of different fields of view pass through the optical system, the focal height of the Gaussian image plane is not equal to the ideal image height, which makes the actual image point deviate from the ideal image point.
  • the content in the image is deformed and distorted by geometric shapes such as stretching and distortion.
  • a mobile phone with a wide-angle lens can obtain images with a larger field of view, but it is also easy to introduce significant image distortion. For example, a portrait located outside the image (that is, a larger field of view) in the captured image will show greater distortion distortion. Therefore, it is necessary to correct the image with image distortion to make the image conform to human vision.
  • a detection algorithm is used to determine the rectangular area of the person and the background area in the source image (original image) collected by the camera, and establish a homography constraint for the rectangular area of the person to correct the appearance of the rectangular area of the person. Stretching deformation; the straight line detection algorithm is used to determine the straight line area in the background area, and the straight line constraint is established for the straight line area to ensure that the corrected straight line does not appear to be bent; it also establishes the homography compatibility constraint for the character rectangular area and the background area to ensure The continuity of the straight line boundary of these two regions is rendered to obtain the final corrected image.
  • the left image in (1) in Figure 1 is the image before correction, and the image on the right is the image after correction. It can be seen that the body of the person on the left in the corrected image has not been corrected. In addition, this solution can easily cause tomographic phenomena in the background area.
  • the left image in (2) in Figure 1 is the image before correction, and the image on the right is the image after correction. You can see the straight line of the character background in the corrected image. The content appears to be disjointed and incoherent.
  • the embodiments of the present application provide an image distortion correction method and device, which can solve the defects of the prior art, realize more natural image distortion correction, and improve user experience.
  • an embodiment of the present application provides an image distortion correction method, which can be applied to a terminal.
  • the method includes: performing optical distortion correction on a collected source image to obtain a first corrected image; the first corrected image includes A background area and a stretched and deformed portrait, where the stretched and deformed portrait includes at least a stretched and deformed first body area and a stretched and deformed second body area; for the first body area and the second body area
  • the algorithm constraint correction is performed on the region and the background region to obtain a second corrected image, wherein the constraint items adopted by the algorithm constraint correction respectively constrain the first human body region, the second human body region, and the background region.
  • the constraint items corresponding to the first body region and the second body region are determined based on different projection algorithms, so that the first body region and the second body region can achieve different amounts of deformation,
  • the stretching and deformation of the first body region and the second body region are respectively corrected
  • the constraint item of the background region is used to constrain the background region of the second corrected image, so that the image of the background region
  • the content is not distorted, and the image content that penetrates the portrait in the background area has no discontinuity in human vision; the transition between the first human body area, the second human body area and the background area is smooth and natural.
  • the terminal can perform algorithm constraint correction processing on the sub-regions (including the first human body region, the second human body region, and the background region) of the image (ie, the first corrected image) after optical distortion correction, where:
  • shape correction is performed based on different projection algorithms to ensure the best correction of the portrait.
  • the background image it is ensured that the image content of the background area will not cause background distortion or faulty phenomenon due to foreground correction. Therefore, the implementation of the solution of this application can ensure that after the image is corrected, the portrait and background content can be natural, coherent, and coordinated, conform to the visual habits of the human eye, and greatly improve the user experience.
  • the first corrected image further includes an edge area of the field of view, which is a stripe area located at the edge of the image in the first corrected image;
  • the algorithm constraint correction is performed on the human body area, the second human body area, and the background area to obtain a second corrected image, including: performing an algorithm for the first human body area, the second human body area, the background area, and the visual area.
  • Algorithm constraint correction is performed on the edge area of the field to obtain the second corrected image.
  • the first human body region includes the head region of the portrait
  • the second human body region includes the body region of the portrait
  • the implementation of the embodiments of this application can perform algorithm constraint correction processing on the head area, body area, background area, and edge area of the field of view of the portrait, so as to optimize the deformation of the head area and the body area respectively to ensure the best portrait Correction.
  • the algorithm constraint correction is performed on the first body region, the second body region, the background region, and the edge region of the field of view to obtain the second body region. Correct the image, including:
  • the second corrected image is obtained through color mapping.
  • the terminal can set weight coefficients for the head area, body area, edge area of the field of view, background area, and regular constraint items of the portrait, and establish a constraint equation based on each constraint item and the corresponding weight coefficient, and solve the constraint Equation, the offset of each pixel in each area can be obtained.
  • the new position of each pixel in the final corrected image ie the second corrected image
  • the second corrected image can be obtained by performing color mapping at the new position . Therefore, the implementation of the embodiments of the present application can automatically complete the correction of the image, and the algorithm constraint correction process can basically occur inside the processor of the terminal without being perceived by the user. Therefore, for users, after shooting with the terminal, they can see the rectangular image effect with excellent portrait effect and background effect, which greatly improves the user experience.
  • the obtaining the second corrected image through color mapping according to the corresponding initial image matrix and the corresponding displacement matrix includes:
  • the body area, the background area, and the field of view corresponding to the head area, the body area, the background area, and the edge area of the field of view, respectively Displacement matrices respectively corresponding to the edge regions to obtain target image matrices respectively corresponding to the head region, the body region, the background region, and the edge region of the field of view;
  • the target image matrix corresponding to the head area, the body area, the background area, and the edge area of the field of view and, the head area, the body area, the background area, and the The second corrected image is obtained by color matrices corresponding to the edge regions of the field of view respectively.
  • the coordinate matrix (also referred to as the target image matrix) of the corrected image (ie, the second corrected image) of the algorithm constraint is Mt(i,j):
  • the displacement matrix compared to the image matrix M0(i,j) in the first corrected image is Dt(i,j):
  • Term1 to Term5 are the constraint items corresponding to the head area, the body area, the edge area of the field of view, the background area, and the global image area, respectively.
  • ⁇ 1(i,j) ⁇ 5(i,j) are the weight coefficients (weight matrix) corresponding to Term1 ⁇ Term5, respectively.
  • the displacement matrix Dt(i,j) of each pixel of the image can be obtained.
  • the constraint item (Term1) corresponding to the head region is used to constrain the target image matrix corresponding to the head region to approximate the image matrix after geometric transformation of the first image matrix, so as to correct the head region Stretching deformation occurs; wherein, the first image matrix is obtained by processing the initial image matrix corresponding to the head region using a spherical projection algorithm, and the geometric transformation includes at least one of image rotation, image translation, and image scaling One kind.
  • the constraint term (Term2) corresponding to the body region is used to constrain the target image matrix corresponding to the body region to approximate the image matrix after geometric transformation of the second image matrix, so as to correct the stretching deformation of the body region
  • the second image matrix is obtained by processing the initial image matrix corresponding to the body region using Mercator projection algorithm, and the geometric transformation includes at least one of image rotation, image translation, and image scaling.
  • the spherical projection algorithm by applying the spherical projection algorithm to the correction of the head area, it is beneficial to make the head of the image of the image look natural and coordinated in human vision.
  • the Mercator projection algorithm By applying the Mercator projection algorithm to the correction of the body area, it is conducive to make the image of the human body look straight and coordinated in human vision without tilting.
  • By combining the spherical projection algorithm and the Mercator projection algorithm it is beneficial to make the entire portrait conform to the human vision, making the human image look natural, coordinated and unobtrusive, and enhance the user experience.
  • the constraint item (Term3) corresponding to the edge area of the field of view is used to: constrain the pixels in the initial image matrix corresponding to the edge area of the field of view to be along the edge of the first corrected image or toward the first corrected image The outer side is displaced to maintain or expand the edge area of the field of view.
  • the constraint item (Term4) corresponding to the background area is used to restrict the displacement of pixels in the initial image matrix corresponding to the background area, and the first vector corresponding to the pixel before the displacement and the pixel after the displacement
  • the corresponding second vector is kept parallel, so that the image content in the background area is smooth and continuous and the image content in the background area that penetrates the portrait is continuously consistent in human vision;
  • the first vector represents The vector between the pixel point before the displacement and the neighboring pixel point corresponding to the pixel point before the displacement;
  • the second vector represents the difference between the pixel point after the displacement and the neighbor pixel point corresponding to the pixel point after the displacement Between the vectors.
  • the regular constraint term (Term5) is used to restrict any two of the displacement matrices corresponding to the head region, the body region, the background region, and the edge region of the field of view in the second corrected image.
  • the difference between the two displacement matrices is smaller than the preset threshold, so that the global image content of the second corrected image is smooth and continuous.
  • the terminal when the terminal performs the algorithm constraint correction processing on the special-shaped image after optical distortion correction, the sub-regions (including the head region, the body region, the background region and the edge region of the field of view) respectively set independent
  • the constraints are optimized to ensure the best correction of the portrait.
  • For the background area by constraining the positional relationship between the background pixel point and its control domain point before and after the transformation, it is ensured that the image content of the background area will not cause background distortion or faulting due to foreground correction.
  • content adaptive boundary control is adopted, which not only does not cause the field of view loss problem, but can even expand the field of view boundary, thereby minimizing the content loss and field of view loss caused by cropping. Therefore, the implementation of the embodiments of the present application can ensure that after the image is corrected, the portrait and background content can be natural, coherent, and coordinated, conform to human visual habits, greatly improve user experience, and have greater commercial application value.
  • the first corrected image is a non-rectangular image; after obtaining the second corrected image, the method further includes: cropping the second corrected image to obtain a rectangular image and output .
  • said performing optical distortion correction on the collected source image to obtain a first corrected image includes: performing optical distortion correction on the collected source image to obtain a non-rectangular image; The non-rectangular image is cropped into a rectangular image, and the first corrected image is the rectangular image.
  • the image area occupied by the first human body region is positively correlated with the weight coefficient corresponding to the constraint item of the first human body region; the image area occupied by the second human body region is positively correlated with The weight coefficients corresponding to the constraint items of the second human body region are positively correlated.
  • the image area occupied by the head region of the portrait in the first corrected image is positively correlated with the weight coefficient corresponding to the head constraint item.
  • the image area occupied by the body area of the portrait in the first corrected image is positively correlated with the weight coefficient corresponding to the body constraint item.
  • the field angle of the first human body region is positively correlated with the weight coefficient corresponding to the constraint term of the first human body region; the field angle of the second human body region is positively correlated with The weight coefficients corresponding to the constraint items of the second human body region are positively correlated.
  • the field angle of the head region in the first corrected image is positively correlated with the weight coefficient corresponding to the head constraint item.
  • Configure the field of view of the body region in the first corrected image to be positively correlated with the weight coefficient corresponding to the body constraint item.
  • the saliency of the texture of the background region is positively correlated with the weight coefficient corresponding to the constraint item of the background region.
  • the texture saliency of the background area in the first corrected image can be configured to be positively correlated with the weight coefficient corresponding to the background constraint item.
  • the texture details of the background area are weak, the background area is not sensitive to distortion or faults caused by correction, and the weight of the background constraint items in the corresponding area can be reduced to achieve better foreground portrait correction.
  • the weight coefficient corresponding to the constraint item of the edge region of the field of view when there is portrait content in the edge region of the field of view is greater than the weight coefficient of the constraint item of the edge region of the field of view when there is no portrait content in the edge region of the field of view.
  • the weight coefficient corresponding to the constraint item in the edge area of the field of view is greater than the weight coefficient of the constraint item of the edge region of the field of view when there is no portrait content in the edge region of the field of view.
  • the weight coefficient corresponding to the field edge constraint item when there is portrait content in the edge area of the field of view in the first corrected image may be configured to be greater than the weight coefficient corresponding to the field edge constraint item when there is no portrait content in the field edge area. That is to say, when there is a portrait at the edge of the image field of view, the boundary constraint may affect the correction effect of the foreground portrait, and the weight value of the boundary constraint item of the corresponding region can be increased to achieve better foreground portrait correction.
  • the terminal performs optical distortion correction on the source image to obtain the first corrected image, including: using an optical distortion correction algorithm to perform optical distortion correction on the source image collected by the camera device, specifically ,
  • the optical distortion correction algorithm can be Zhang Zhengyou's camera calibration algorithm. After processing by the optical distortion correction algorithm, the first corrected image is obtained, and the curved straight line in the first corrected image will be corrected into a straight line.
  • the terminal may divide the first corrected image into the first body region, the second body region, the background region, the edge region of the field of view, and other object regions through the image segmentation method.
  • the image segmentation method may be an image semantic segmentation method.
  • NPU neural-network processing unit
  • the first human body region of the portrait may be the head region and limb regions of the portrait
  • the second human body region of the portrait may be the trunk region of the portrait
  • an embodiment of the present application provides a device, the device includes: an optical distortion correction module and an algorithm constraint correction module, wherein: the optical distortion correction module is used to perform optical distortion correction on the collected source image to obtain the first A corrected image; the first corrected image includes a background area and a stretched and deformed portrait, and the stretched and deformed portrait includes at least a stretched and deformed first body area and a stretched and deformed second body area; algorithm constraint correction The module is used to perform algorithm constraint correction on the first human body region, the second human body region, and the background region to obtain a second corrected image; wherein the constraint items used in the algorithm constraint correction respectively constrain the first The human body area, the second human body area, and the background area.
  • the device may specifically implement the method described in any implementation manner/embodiment of the first aspect through various functional modules.
  • an embodiment of the present application provides a terminal, which may include: one or more processors and memories; the processors and the memories are connected or coupled together by a bus; the foregoing memory stores one or more computer programs, One or more processors are used to execute the one or more computer programs; the one or more computer programs include instructions for executing the methods described in the possible implementations/embodiments of the above-mentioned first aspect.
  • an embodiment of the present application provides a terminal, which may include: one or more processors, a memory, and a display screen for image display.
  • the processor, memory, and display screen may be connected by one or more communication buses; one or more computer programs are stored in the above-mentioned memory, and one or more processors are used to execute the one or more computer programs; one or more The computer program includes instructions for executing the method described in the possible implementation/embodiment of the first aspect described above.
  • an embodiment of the present application provides a computer-readable storage medium storing a computer program.
  • the computer program includes program instructions that, when executed by an executing processor, cause the processor to execute as in the first aspect. The method described in any embodiment.
  • the embodiments of the present application provide a computer program product, which is executed to implement the method described in any embodiment of the first aspect when the computer program product runs on a computer.
  • the terminal can perform algorithm constraint correction processing on the image division area (including the head area, the body area, the background area, and the edge area of the field of view) after the optical distortion correction.
  • the body area and body area are respectively corrected for shape based on different projection algorithms to ensure the best correction of the portrait.
  • the embodiments of the present application can also ensure that the image content of the background area will not cause background distortion or fracture due to foreground correction, and reduce the content loss and field of view loss caused by cropping. Therefore, the implementation of the embodiments of the present application can ensure that after the image is corrected, the portrait and background content can be natural, coherent, and coordinated, conform to the visual habits of the human eye, and greatly improve the user experience.
  • Figure 1 is a comparison diagram of two image corrections of existing solutions
  • FIG. 2 is a schematic structural diagram of a terminal provided by an embodiment of the present application.
  • FIG. 3 is a block diagram of the software structure of a terminal provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a camera interface and an album interface of a terminal provided by an embodiment of the present application
  • FIG. 5 is a schematic diagram of a comparison between a barrel-shaped distortion image, a pincushion distortion image, and a normal image according to an embodiment of the present application;
  • Fig. 6 is a comparison diagram of an optical distortion correction process provided by an embodiment of the present application.
  • FIG. 7 is a schematic flowchart of an image distortion correction method provided by an embodiment of the present application.
  • FIG. 8 is an exemplary schematic diagram of dividing regions of an image provided by an embodiment of the present application.
  • FIG. 9 is a schematic flowchart of another image distortion correction method provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of a processing scene of a spherical projection algorithm and a Mercator projection algorithm provided by an embodiment of the present application;
  • FIG. 11 is a schematic diagram of a processing scene of the edge area of the field of view of an image provided by an embodiment of the present application.
  • FIG. 12 is a schematic diagram of a processing scene of a background area of an image provided by an embodiment of the present application.
  • FIG. 13 is a schematic diagram of a scene for cropping and enlarging a special-shaped image according to an embodiment of the present application
  • FIG. 14 is a schematic diagram of a processing flow of a mobile phone camera application scenario provided by an embodiment of the present application.
  • 15 is a schematic flowchart of another image distortion correction method provided by an embodiment of the present application.
  • FIG. 16 is a schematic diagram of another processing scene for the edge area of the field of view of an image provided by an embodiment of the present application.
  • FIG. 17 is a schematic diagram of the processing flow of another mobile phone camera application scenario provided by an embodiment of the present application.
  • FIG. 18 is a schematic diagram of the processing flow of another mobile phone camera application scenario provided by an embodiment of the present application.
  • FIG. 19 is a schematic structural diagram of a device provided by an embodiment of the present application.
  • first and second are only used for descriptive purposes, and cannot be understood as implying or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with “first” and “second” may explicitly or implicitly include one or more of these features. In the description of the embodiments of the present application, unless otherwise specified, “multiple” The meaning is two or more.
  • terminal devices can be mobile phones, tablets, laptops, palmtops, mobile internet devices (MIDs, mobile internet devices), wearable devices (such as smart bracelets, Smart watches, etc.), AR devices, VR devices, imaging devices (such as video recorders, smart cameras, digital cameras, cameras, etc.), in-vehicle devices, or other devices with shooting functions.
  • terminal devices can be mobile phones, tablets, laptops, palmtops, mobile internet devices (MIDs, mobile internet devices), wearable devices (such as smart bracelets, Smart watches, etc.), AR devices, VR devices, imaging devices (such as video recorders, smart cameras, digital cameras, cameras, etc.), in-vehicle devices, or other devices with shooting functions.
  • FIG. 2 exemplarily shows a schematic structural diagram of a terminal 100.
  • the terminal 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142 , Camera 193 and display 194.
  • the terminal 100 may also include antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone interface 170D, sensor module 180, buttons 190, and instructions And one or more of a subscriber identification module (subscriber identification module, SIM) card interface 195, and so on.
  • the sensor module 180 may include, for example, one or more of a pressure sensor, a gyroscope sensor, an acceleration sensor, a distance sensor, a fingerprint sensor, and so on.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait.
  • AP application processor
  • modem processor modem processor
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the different processing units may be independent devices or integrated in one or more processors.
  • a memory may also be provided in the processor 110 to store instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory can store instructions or data that the processor 110 has just used or used cyclically. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
  • the processor 110 may include one or more interfaces.
  • Interfaces can include integrated circuit (I2C) interfaces, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interfaces, pulse code modulation (PCM) interfaces, universal asynchronous transmitters receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / Or Universal Serial Bus (USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART mobile industry processor interface
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB Universal Serial Bus
  • the interface connection relationship between the modules illustrated in the embodiment of the present application is merely a schematic description, and does not constitute a structural limitation of the terminal 100.
  • the terminal 100 may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.
  • the processor 110 can complete control of fetching instructions, executing instructions, and calling data according to instruction operation codes and timing signals. Specifically, the processor 110 may be used to execute the image distortion correction method described in the embodiment of the present application.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charge management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
  • the wireless communication function of the terminal 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
  • the terminal 100 can implement image/video display functions through a GPU, a display screen 194, and an application processor.
  • the GPU is a microprocessor for image processing, connected to the display 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • the processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos, and the like.
  • the display screen 194 includes a display panel.
  • the display panel can use liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • active-matrix organic light-emitting diode active-matrix organic light-emitting diode
  • AMOLED flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc.
  • the terminal 100 may include one or N display screens 194, and N is a positive integer greater than one.
  • the display screen 194 may be a touch screen, and the touch screen may include a display panel and a touch-sensitive surface covering the display panel.
  • the touch-sensitive surface detects a touch operation on or near it (for example, the user uses a finger, stylus, or any other suitable object or accessory to touch, click, press, slide, etc.) on or near the touch-sensitive surface )
  • the processor 110 determines the type of the touch event, and then the processor 110 provides a corresponding visual output on the display panel according to the type of the touch event.
  • the touch-sensitive surface and the display panel are used as two independent components to implement input and input functions.
  • the touch-sensitive surface and the display panel are integrated to realize input and output functions.
  • the touch-sensitive surface may include two parts: a touch detection device and a touch controller.
  • the touch detection device detects the user's touch position, detects the signal brought by the touch operation, and transmits the signal to the touch controller;
  • the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it To the processor 110, and can receive and execute the commands sent by the processor 110.
  • multiple types such as resistive, capacitive, infrared, and surface acoustic waves can be used to realize the touch-sensitive surface.
  • the display panel may be used to display information input by the user or information provided to the user, and various display interfaces of the terminal 100.
  • the display interface may be a user interface (UI) or a graphical user interface (Graphical User Interface, GUI), these interface contents can include the interface of the running application and system-level menus, etc., which can be specifically composed of images (picture), text (text), icons (Icon), video (video), buttons (Button), sliding Bar (Scroll Bar), menu (Menu), window (Window), label (Label), input box (input box) and any combination thereof.
  • UI user interface
  • GUI graphical User Interface
  • the terminal 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
  • the ISP is used to process the data fed back from the camera 193. For example, when taking a picture, the shutter is opened, the light is transmitted to the photosensitive element of the camera through the lens, the light signal is converted into an electrical signal, and the photosensitive element of the camera transfers the electrical signal to the ISP for processing and is converted into an image visible to the naked eye.
  • ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193.
  • the camera 193 is used to capture still images or videos.
  • the object generates an optical image through a lens (such as an optical lens module) and projects it to the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transfers the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the image signal can then be displayed on the display screen 194, and/or the image signal can be saved to the internal memory 121 or the external memory.
  • the camera 193 may include a camera that collects images required for face recognition, such as an infrared camera or other cameras.
  • the camera that collects the image required for face recognition is generally located on the front of the electronic device, for example, above the touch screen, and may also be located at other positions, which is not limited in the embodiment of the present application.
  • the camera of the camera device 193 includes, but is not limited to, an optical camera, an infrared camera, and a depth camera.
  • the specific form may be a monocular camera or a multi-view camera.
  • the camera lens can be a standard lens, a wide-angle lens, an ultra-wide-angle lens, a fisheye lens or a long focal length lens, or a combination of the above-mentioned multiple lenses.
  • the camera of the camera device 193 may include a front camera and/or a rear camera.
  • the image signal output by the imaging device 193 may be referred to as a “source image”.
  • the source image can be output to the processor for further image distortion correction processing.
  • Video codecs are used to compress or decompress digital video.
  • the terminal 100 may support one or more video codecs. In this way, the terminal 100 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, and so on.
  • MPEG moving picture experts group
  • MPEG2 MPEG2, MPEG3, MPEG4, and so on.
  • DSP is used to process digital signals. In addition to digital image signals, it can also process other digital signals. For example, when the terminal 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
  • NPU is used to learn from the structure of biological neural networks, for example, to learn from the transfer mode between human brain neurons, to quickly process input information, and to continue self-learning.
  • applications such as intelligent cognition of the terminal 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, and so on.
  • the internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions.
  • the processor 110 executes various functional applications and data processing of the terminal 100 by running instructions stored in the internal memory 121.
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, at least one application program required by a function (such as a camera shooting APP, an image beautification APP), etc.
  • the data storage area can store data created during the use of the terminal 100 (such as corrected image data) and the like.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
  • UFS universal flash storage
  • the external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, save images, videos, and other files in an external memory card.
  • the terminal 100 may also implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor.
  • the audio module 170 is used to convert digital audio information into an analog audio signal for output, and also used to convert an analog audio input into a digital audio signal.
  • the speaker 170A also called “speaker”
  • the receiver 170B also called “earpiece”
  • the microphone 170C also called “microphone”, “microphone”, is used to convert sound signals into electrical signals.
  • the earphone interface 170D is used to connect wired earphones.
  • the earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the button 190 may include a power-on button, a volume button, and so on.
  • the button 190 may be a mechanical button. It can also be a touch button.
  • the terminal 100 may receive key input, and generate key signal input related to user settings and function control of the terminal 100.
  • the indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, or to indicate messages, missed calls, notifications, and so on.
  • the SIM card interface 195 is used to connect to the SIM card.
  • the SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the terminal 100.
  • the terminal 100 adopts an eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the terminal 100 and cannot be separated from the terminal 100.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal 100.
  • the terminal 100 may include more or fewer components than shown, or combine two or more components, or split some components, or have different component configurations.
  • the various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.
  • the software system of the terminal 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the following takes an Android system with a layered architecture as an example to illustrate a software structure of the terminal 100 by way of example.
  • FIG. 3 is a block diagram of a possible software structure of the terminal 100 according to an embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Communication between layers through software interface.
  • the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
  • the application layer can include a series of application packages. As shown in Figure 3, the application package may include applications such as a camera APP, an image beautification APP, and an album APP.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions. As shown in Figure 3, the application framework layer can include a window manager, a content provider, a resource manager, a view system, and so on. among them:
  • the window manager is used to manage window programs.
  • the window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, etc.
  • the content provider is used to store and retrieve data and make these data accessible to applications.
  • the data may include image data, video data, and so on.
  • the resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, and so on.
  • the view system can be used to construct the display interface of the application.
  • the display interface of a photographing APP presented through the view system is shown in (1) in FIG. 4, the photographing interface 20 may be displayed on the display panel of the terminal 100, and the photographing interface 20 may include a preview frame 204 and some related Controls, such as image browsing control 201, shooting control 202, front and rear camera switching control 203, etc.
  • the preview frame 204 is used to preview the scene image to be shot.
  • the image presented by the preview frame 204 may be a corrected image (also referred to as a first corrected image) after optical distortion correction processing.
  • the image presented by the preview frame 204 may be a corrected image (also referred to as a second corrected image) after optical distortion correction processing and algorithm constraint processing.
  • the image presented by the preview frame 204 may be a source image that has not undergone optical distortion correction processing and has not undergone algorithm constraint processing.
  • the terminal 100 may be instructed to select the front camera or the rear camera for shooting.
  • the terminal 100 When the user clicks or touches the shooting control 202, the terminal 100 will drive the camera device to initiate a shooting operation, instruct the lower system library to process the source image into a second corrected image, and save the second corrected image in an album.
  • the terminal 100 can call the album APP and display the second corrected image.
  • the display interface 30 of the album APP may include the obtained second corrected image 301, and optionally may also include one or more thumbnails 302 of the most recently taken images.
  • the scheduling and management of the Android system can include core libraries and virtual machines.
  • the core library consists of two parts: one part is the function functions that the java language needs to call, and the other part is the core library of Android.
  • the application layer and the application framework layer run in a virtual machine.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), graphics engine (for example: SGL), etc.
  • the surface manager is used to manage the display subsystem and provide layer fusion functions for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the graphics engine is a drawing engine for image processing.
  • the graphics engine can be used to process the source image into the first corrected image and process the first corrected image into the second corrected image.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, sensor driver, etc.
  • the camera driver can be used to drive the camera of the terminal 100 to shoot
  • the display driver can be used to display images (the first corrected image and the second corrected image) on the display panel of the display screen.
  • the so-called “source image” refers to the original image collected by the camera device of the terminal.
  • the imaging device includes an optical lens module and a photosensitive element.
  • the photosensitive element including a charge coupled device (CCD) as an example
  • CCD charge coupled device
  • the CCD is made of high-sensitivity semiconductor materials, and usually includes many photosensitive units, usually in megapixels.
  • each photosensitive unit will reflect the charge on the component, which can convert the light into an electrical signal.
  • the signals generated by all the photosensitive units are added together to form a complete electrical signal.
  • the CCD transfers the electrical signal to the ISP and converts it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the imaging process of the camera device essentially reflects the conversion process of the coordinate system. That is, the imaging process is actually to convert the point of the subject in the world coordinate system to the camera coordinate system of the camera device, and then project it to the image physical coordinate system of the imaging plane, and finally convert the data on the imaging plane to The process of the image pixel coordinate system of the image plane.
  • the source image obtained by the optical lens module usually introduces optical distortion and causes image distortion.
  • Distortion refers to the degree of distortion of the image formed by the optical system on the object relative to the object itself.
  • Optical distortion refers to the degree of distortion calculated in optical theory. The straight line in space will bend in an image with optical distortion. The distortion caused by optical distortion is very detrimental to the image quality of the photo. Due to the existence of optical distortion, after the straight line in the world coordinate system of the subject is finally transformed into the image pixel coordinate system, it may appear as a curve. In particular, the closer the position of the image is to the edge of the image, the more obvious the distortion of the image by this kind of optical distortion. In addition, the wide-angle camera has more significant optical distortion compared to the ordinary camera.
  • the optical lens module When the terminal is a mobile terminal such as a mobile phone, a tablet computer, a wearable device, etc., affected by the optical design of the lens, the optical lens module usually has a larger optical distortion, which is related to the field of view of the mobile terminal, and the larger the field of view is usually , The greater the optical distortion of the optical lens module.
  • Optical distortion can also be called image distortion, lens distortion, camera distortion, camera distortion, lens distortion and so on.
  • the types of optical distortion mainly include radial distortion and tangential distortion.
  • Tangential distortion is usually caused by defects in the manufacturing of the imaging device that make the lens itself not parallel to the image plane.
  • Radial distortion specifically includes barrel distortion (Barrel Distortion) and pincushion distortion (Pincushion Distortion). As shown in FIG. 5, FIG. 5 shows a schematic diagram of the comparison between the barrel distortion image, the pincushion distortion image, and the ideal normal image.
  • Barrel distortion can also be called barrel distortion, which is caused by the physical properties of the lens in the lens and the structure of the lens group.
  • barrel distortion is most easily noticed.
  • straight lines in the picture especially straight lines near the edge of the image
  • barrel distortion is most easily noticed.
  • Pincushion distortion can also be called pincushion distortion, which is a distortion phenomenon caused by the lens to "shrink" the picture toward the middle.
  • pincushion distortion is a distortion phenomenon caused by the lens to "shrink" the picture toward the middle.
  • pincushion distortion is most easily noticed.
  • pincushion distortion is prone to occur.
  • pincushion distortion is most easily noticed.
  • the "source image” collected by the camera device may also be referred to as a "distorted image”.
  • the source image may be corrected for optical distortion first.
  • the optical distortion correction is to determine the distortion coefficient of the image by calculating the mapping relationship between the point positions before and after the image distortion through the optical distortion correction algorithm, and then The transformation opposite to the distortion is performed, and the pixel value of the distorted position is assigned to the original position, which can alleviate the distortion caused by the distortion.
  • the left image in Figure 6 is a rectangular image (referred to as rectangular image for short) collected by the optical lens module.
  • the position of the pixel points The displacement will cause the image after optical distortion correction to be a non-rectangular image, as shown in the right image in Figure 6.
  • the non-rectangular image corrected for optical distortion may also be referred to as an "extra-shaped image”.
  • the special-shaped image can also be cropped into a rectangular image, and then displayed to display through operations such as image resolution conversion. panel.
  • the background content that becomes a curve due to distortion is usually well corrected and becomes a normal straight line content.
  • the inherent straight line content is less, there are still distortions such as stretching, twisting, etc., including the deformation of the head and the body in the portrait.
  • the embodiment of the application continues to perform algorithm constraint correction on the image (which may be called the first corrected image) after optical distortion correction, and corrects the head, body parts, image background, image edge, etc. of the portrait based on different algorithms. , Thereby obtaining a second corrected image.
  • algorithm constraint correction on the image (which may be called the first corrected image) after optical distortion correction, and corrects the head, body parts, image background, image edge, etc. of the portrait based on different algorithms. , Thereby obtaining a second corrected image.
  • the head and body of the portrait in the second corrected image can be in line with human vision, and the image content that penetrates the portrait in the image background of the second corrected image is continuous and consistent in human vision, thereby avoiding the appearance of curved tomography in the image background.
  • the second corrected image also avoids the loss of the angle of view.
  • FIG. 7 is a schematic flowchart of an image distortion correction method provided by an embodiment of the present application.
  • the method may be applied to the terminal shown in FIG. 1 or FIG. 2.
  • the method includes but is not limited to the following steps:
  • the terminal collects a source image.
  • the terminal may collect the source image through a camera device (including an optical lens module and a photosensitive element).
  • the source image may be a rectangular image. Since the optical lens module usually has a certain degree of optical distortion (for example, barrel distortion), this results in distortion and distortion of the image content of the collected source image.
  • S402 The terminal performs optical distortion correction on the source image to obtain a first corrected image.
  • the terminal may use an optical distortion correction algorithm to perform optical distortion correction on the source image collected by the camera device.
  • the optical distortion correction algorithm may be a Zhang Zhengyou camera calibration algorithm.
  • a special-shaped image ie, a non-rectangular image
  • the irregular image is the first corrected image.
  • the irregular image may be cut into a rectangular image, and then scaled into an image of the target resolution, and the image of the target resolution is the first corrected image.
  • the terminal separately processes the first human body area, the second human body area, and the background area to obtain a second corrected image.
  • the image in order to achieve better portrait correction and to ensure that the background is not significantly distorted in the process of correcting the foreground portrait, the image needs to be divided into regions first.
  • the terminal may divide the first corrected image into several specific target regions of interest through an image segmentation method.
  • the image segmentation method may be an image semantic segmentation method.
  • NPU neural-network processing unit
  • the regions divided by the first corrected image include a first human body region, a second human body region, and a background region of the portrait, where the first human body region of the portrait and the second human body region of the portrait refer to a part of the portrait. area.
  • the first human body region of the portrait may be the head region of the portrait
  • the second human body region of the portrait may be the body region of the portrait.
  • the first human body region of the portrait may be the head region and limb regions of the portrait
  • the second human body region of the portrait may be the torso region of the portrait, and so on.
  • the background area is an effective area outside the first human body area and the second human body area from which the human image is removed in the first corrected image.
  • the terminal can perform algorithm constraint correction processing on the first human body region, the second human body region, and the background region respectively to obtain the second corrected image.
  • the algorithm constraint correction the first human body region and the second human body region of the portrait in the second corrected image can be based on different algorithms (for example, the spherical projection algorithm is used to process the head region of the portrait, and the Mercator algorithm is used to process Body region) and present different amounts of deformation, so that the stretching deformation of the first body region and the second body region are respectively corrected, which conforms to human vision, and the background region of the second corrected image penetrates the The image content of the portrait is continuous and consistent in human vision, without any discontinuities.
  • the area divided by the first corrected image includes not only the first human body area, the second human body area, and the background area of the portrait, but also the edge area of the field of view.
  • the edge area of the field of view is located in the first corrected image.
  • a threshold can be set to determine the width of the stripe.
  • the background area is the effective area except the first human body area, the second human body area, and the edge area of the field of view from which the portrait is removed in the first corrected image.
  • the terminal can perform algorithm constraint correction processing on the first human body area, the second human body area, the background area, and the edge area of the field of view, respectively, to obtain the second corrected image.
  • the first human body region and the second human body region of the portrait in the second corrected image can be based on different algorithms (for example, the spherical projection algorithm is used to process the head region of the portrait, and the Mercator algorithm is used to process Body region) and present different amounts of deformation, so that the stretching deformation of the first body region and the second body region are respectively corrected, which conforms to human vision, and the background region of the second corrected image penetrates the
  • the image content of the portrait is continuous and consistent in human vision, without any discontinuities.
  • by constraining the boundary of the edge area of the field of view not only does the field of view loss problem occur, but the image content at the boundary of the field of view can even be expanded.
  • the terminal can perform algorithm constraint correction processing on the special-shaped image after optical distortion correction, sub-regions (including head region, body region, background region, and edge region of the field of view).
  • the head area and body area are respectively corrected based on different projection algorithms to ensure the best correction of the portrait.
  • the embodiments of the present application can also ensure that the image content of the background area will not cause background distortion or fracture due to foreground correction, and reduce the content loss and field of view loss caused by cropping. Therefore, the implementation of the embodiments of the present application can ensure that after the image is corrected, the portrait and background content can be natural, coherent, and coordinated, conform to the visual habits of the human eye, and greatly improve the user experience.
  • FIG. 9 is a schematic flowchart of another image distortion correction method provided by an embodiment of the present application.
  • the method may be applied to the terminal shown in FIG. 1 or FIG. 2.
  • the method includes but is not limited to the following steps:
  • the terminal collects a source image.
  • S401 the description of S401 in the embodiment in FIG.
  • the terminal performs optical distortion correction on the source image to obtain a first corrected image.
  • the terminal may use an optical distortion correction algorithm to perform optical distortion correction on the source image collected by the camera device.
  • the optical distortion correction algorithm may be a Zhang Zhengyou camera calibration algorithm.
  • the first corrected image is obtained, where the first corrected image is no longer a rectangular image, but an irregular image (or called a non-rectangular image).
  • the curved straight line in the image will be corrected into a straight line, but at this time the portrait in the image still has a certain degree of distortion.
  • the larger the portrait angle of view the more severe the distortion.
  • the first corrected image may be further subjected to algorithm constraint correction, and the obtained image may be referred to as the second corrected image.
  • the processing procedure of algorithm constraint correction may include the following steps S503-S507.
  • the terminal recognizes that the first corrected image has a stretched and deformed portrait area, a background area, and an edge area of the field of view.
  • the stretched and deformed portrait area includes at least a stretched and deformed head area and a stretched and deformed body area.
  • the image in order to achieve better portrait correction and to ensure that the background is not significantly distorted in the process of correcting the foreground portrait, the image needs to be divided into regions.
  • the terminal may divide the first corrected image into several specific target regions of interest through an image segmentation method.
  • the image segmentation method may be an image semantic segmentation method.
  • NPU neural-network processing unit
  • the terminal recognizes and marks the following areas on the first corrected image: the head area of the portrait (or the head area of the portrait), the body area of the portrait, the background area, and the edge of the field of view. area.
  • the terminal recognizes an area other than the first corrected image as an invalid area.
  • the head area of the portrait covers the head, neck and related decorations (such as hats, headwear, glasses, etc.) of each portrait in the image.
  • the body area of a portrait covers the torso, limbs, clothes, pants, and shoes of each portrait in the image.
  • the alien image as shown in Figure 8 shows three foreground portraits, each of which includes its own head area (head area 1, head area 2 and head area 3 in the figure) and body area (In the figure, body area 1, body area 2 and body area 3).
  • the edge area of the field of view is the ring-shaped strip area near the invalid area in the special-shaped image and located at the edge of the special-shaped image.
  • a threshold can be set to determine the width of this strip.
  • the background area is the effective area except the head area, the body area and the edge area of the field of view from which the portrait is removed.
  • the embodiment of the present application is not limited to dividing a portrait into a head area and a body area, and other division methods are also possible, for example, it may also be divided into a head area, a limb area, and a torso area, and so on.
  • the terminal determines the initial image matrixes respectively corresponding to the head area, the body area, the background area, and the edge area of the field of view.
  • the terminal separately determines the initial position and color information of the pixel points in the head area, body area, background area, and edge area of the field of view of each portrait in the first corrected image.
  • the initial position of the pixel can be represented by the initial image matrix (or called the initial coordinate matrix), and the color information of the pixel can be represented by the color matrix.
  • the initial image matrix is used to record the position of each pixel in the first corrected image.
  • the plane position coordinates of the pixel point [i,j] T in the i-th row and j-th column in the first corrected image can be expressed as:
  • u(i,j) represents the abscissa
  • v(i,j) represents the ordinate
  • the color matrix is used to record the color information of each pixel.
  • the color matrix of the pixel in the i-th column and j-th row in the first corrected image can be expressed as:
  • r(i,j), g(i,j), b(i,j) represent red, green, and blue color information, respectively.
  • the initial image matrix of each pixel of the first corrected image can be normalized. Assuming that the width and height of the first corrected image are W and H respectively, the normalized coordinate matrix can be expressed as
  • the normalized initial image matrix (also referred to as the image matrix) of each pixel of the first corrected image can be represented by M0, which is specifically:
  • the amount of stretching and deformation of the head area and the body area of the portrait are different. Because the area of the head area and the body area are different, the user's tolerance for their deformation is different. In the embodiments of the present application, in order to ensure that the deformation of the head area and the body area are well corrected at the same time, different projection algorithms are also used for coordinate processing for the head area and the body area respectively.
  • the spherical projection algorithm may be used for coordinate processing for the head area of the portrait
  • the Mercator projection algorithm may be used for coordinate processing for the body area of the portrait.
  • atan(v0/sqrt(u0*u0+1)), and ⁇ is the scaling factor.
  • M0 of the head region M1 obtained by the spherical projection algorithm can participate in the subsequent step S505 to correct the stretching deformation of the head of the portrait
  • M2 of the body region M0 obtained by the Mercator projection algorithm can participate in the subsequent step S505.
  • the subsequent step S505 the body stretching deformation of the portrait is corrected.
  • the spherical projection algorithm by applying the spherical projection algorithm to the correction of the head area, it is beneficial to make the head of the image of the image look natural and coordinated in human vision.
  • the Mercator projection algorithm to the correction of the body area, it is beneficial to make the image of the human body look straight and coordinated in human vision without tilting.
  • S505 The terminal separately constructs constraint items corresponding to the head area, body area, background area, and edge area of the field of view, and regular constraint items.
  • the terminal constructs corresponding constraint items for the head area, body area, background area, and edge area of the field of view of the portrait, and constructs regular constraint items for the global image.
  • the head area, body area, background area, and edge area of the field of view of the portrait construct corresponding constraints and regular constraints to determine the required displacement of each pixel in the image.
  • the following describes the constraints of the head region, body region, background region, and edge region of the field of view of the portrait, and the regular constraints used for the overall image.
  • the constraint item corresponding to the head region of the portrait is used to constrain the target image matrix corresponding to the head region in the second corrected image to be approximated to the image matrix after geometric transformation of the first image matrix (ie M1), to Correct the stretch deformation that occurs in the head area.
  • the geometric transformation in this embodiment represents a kind of spatial mapping, that is, one image matrix is transformed into another image matrix.
  • the geometric transformation in this embodiment may be at least one of image translation, image scaling, and image rotation.
  • the constraint item corresponding to the head region of the portrait may be referred to as the head constraint item for short.
  • the head region of different portraits may correspond to different head constraint items.
  • the head area 1, the head area 2, and the head area 3 may respectively correspond to different head constraint items.
  • the head constraint item can be recorded as Term1, and the expression of Term1 is as follows:
  • Term1(i,j) SUM (i,j) ⁇ HeadRegionk ⁇ M0(i,j)+Dt(i,j)-Func1 k [M1(i,j)] ⁇
  • represents the vector 2 norm.
  • the head constraint Term1(i,j) needs to ensure that under the action of the displacement matrix Dt(i,j), the image matrix M0(i,j) tends to be the proper geometric transformation of M1(i,j), including the image At least one transformation operation of rotation, image translation, and image scaling.
  • the geometric transformation function Func1 k corresponding to the k-th head region indicates that all points in the k-th head region share the same geometric transformation function Func1 k , and different head regions correspond to different geometric transformation functions.
  • the geometric transformation function Func1 k can be specifically expressed as:
  • ⁇ 1k represents the scaling factor of the k-th head region
  • ⁇ 1k represents the rotation angle of the k-th head region
  • TX 1k and TY 1k respectively represent the horizontal and vertical displacement of the k-th head region.
  • Term1(i,j) can be specifically expressed as:
  • du(i,j) and dv(i,j) are the unknown quantities that need to be solved, and it is necessary to ensure that this term is as small as possible when solving the constraint equations later.
  • the constraint item corresponding to the body region is used to constrain the target image matrix corresponding to the body region in the second corrected image to be the image matrix after geometric transformation of the second image matrix (ie M2) to correct the appearance of the body region Stretch deformation.
  • the geometric transformation in this embodiment may be at least one of image translation transformation, image scaling transformation, and image rotation transformation.
  • the constraint item corresponding to the body region of the portrait may be referred to as the body constraint item for short.
  • the body regions of different portraits may correspond to different body constraint items.
  • the body area 1, the body area 2, and the body area 3 may respectively correspond to different body constraint items.
  • the body constraint term can be recorded as Term2, and the expression of Term2 is as follows:
  • Term2(i,j) SUM (i,j) ⁇ BodyRegionk ⁇ M0(i,j)+Dt(i,j)-Func2 k [M2(i,j)] ⁇
  • represents the vector 2 norm.
  • the body constraint item must ensure that under the action of the displacement matrix Dt(i,j), the image matrix M0(i,j) tends to be an appropriate geometric transformation of M2(i,j), including image rotation, image translation and image scaling At least one transformation operation in.
  • the k-th body region corresponds to the geometric transformation function Func2 k, which means that all points in the k-th body region share the same geometric transformation function Func2 k , and different body regions correspond to different geometric transformation functions.
  • the geometric transformation function Func2 k can be expressed as:
  • ⁇ 2k represents the scaling factor of the k-th body region
  • ⁇ 2k represents the rotation angle of the k-th body region
  • TX 2k and TY 2k respectively represent the horizontal and longitudinal displacement of the k-th body region.
  • Term2(i,j) can be specifically expressed as:
  • du(i,j) and dv(i,j) are the unknown quantities that need to be solved, and it is necessary to ensure that this term is as small as possible when solving the constraint equations later.
  • the constraint item corresponding to the edge area of the field of view is used to constrain the pixels in the initial image matrix corresponding to the edge area of the field of view in the first corrected image to be along the edge of the first corrected image or to all directions.
  • the outer side of the first corrected image is displaced to maintain or expand the edge area of the field of view.
  • the constraint item corresponding to the edge area of the field of view can be referred to as the edge constraint item of the field of view for short.
  • the edge constraint item of the field of view can be recorded as Term3.
  • the expression of Term3 is as follows:
  • Term3(i,j) SUM (i,j) ⁇ EdgeRegion
  • M0(i,j) here represents the image coordinates of the pixel at the edge area of the field of view (ie (i,j) ⁇ EdgeRegion), and Dt(i,j) here represents the corresponding M0(i,j)
  • the displacement matrix of Func3 (i,j) represents the displacement function of M0(i,j), and
  • the edge constraint item of the field of view must ensure that under the action of the displacement matrix Dt(i,j), the image matrix M0(i,j) tends to be an appropriate displacement of the coordinate value M0(i,j), and the displacement rule is only along the edge
  • the area may be appropriately moved to the outside of the edge area to avoid moving to the inside of the edge area.
  • ⁇ (u0,v0) needs to be limited to not less than 0 to ensure that the point does not shift to the edge of the field of view, and the sign of ⁇ (u0,v0) does not need to be restricted.
  • ⁇ (u0,v0) and ⁇ (u0,v0) are intermediate unknowns that do not need to be displayed.
  • Term3(i,j) can be specifically expressed as:
  • du(i,j) and dv(i,j) are the unknown quantities that need to be solved, and it is necessary to ensure that this term is as small as possible when solving the constraint equations later.
  • the constraint item corresponding to the background area is used to constrain the pixel points in the image matrix corresponding to the background area in the first corrected image to be displaced, and the first vector corresponding to the pixel point before the displacement and the pixel point corresponding to the displacement
  • the second vector should be kept parallel as much as possible to make the image content in the background area smooth and continuous and make the image content of the portrait in the background area continuous and consistent in human vision; where the first vector represents the pixel point before displacement and the pixel point before displacement The vector between the corresponding neighboring pixels; the second vector represents the vector between the pixel point after displacement and the neighboring pixel point corresponding to the pixel point after displacement.
  • the constraint item corresponding to the background area can be referred to as the background constraint item for short, and the background constraint item can be recorded as Term4.
  • the expression of Term4 is as follows:
  • Term4(i,j) SUM (i,j) ⁇ BkgRegion ⁇ Func4 (i,j) (M0(i,j),M0(i,j)+Dt(i,j)) ⁇
  • M0(i,j) here represents the image coordinates of the pixels located in the background area (ie (i,j) ⁇ BkgRegion)
  • Dt(i,j) here represents the displacement corresponding to the M0(i,j) Matrix
  • Func4 (i,j) represents the displacement function of M0(i,j)
  • represents the norm of vector 2.
  • each pixel in the background area can be divided into different control domains, and the present application does not limit the size, shape, and number of the control domains.
  • the control domain needs to extend across the foreground portrait to the other end of the foreground portrait. As shown in Figure 12, it includes rectangular control domain 2 and non-rectangular control domain 1. Control domain 1 is taken as an example.
  • angle[] represents the angle between the two vectors
  • vec1 represents the vector formed by the background point [i,j] T and a point in the control domain before correction
  • vec2 represents the corrected background point [i,j] T and A vector formed by a certain point after correction in the control domain
  • SUM (i+di,j+dj) ⁇ CtrlRegion represents the sum of the angles of all vectors in the control domain.
  • Term4(i,j) can be specifically expressed as:
  • Term4(i,j) SUM (i,j) ⁇ BkgRegion ⁇ SUM (i+di,j+dj) ⁇ CtrlRegion ⁇ angle[vec1,vec2] ⁇
  • du(i,j) and dv(i,j) are the unknown quantities that need to be solved, and it is necessary to ensure that this term is as small as possible when solving the constraint equations later.
  • the regular constraint term is used to constrain the displacement matrix of any two adjacent pixels in the displacement matrix corresponding to the background area, the head area of the portrait, the body area of the portrait, and the edge area of the field of view in the second corrected image.
  • the difference value of is smaller than the preset threshold, so that the global image content of the second corrected image is smooth and continuous.
  • Term5(i,j) SUM (i,j) ⁇ AllRegion ⁇ Func5 (i,j) (Dt(i,j)) ⁇
  • the regular constraint item needs to ensure that the displacement matrix Dt(i,j) of adjacent pixels is smooth and continuous to avoid occurrence Partially large jumps.
  • the restriction principle is that the difference between the displacement of the point [i,j] T and the displacement of its neighboring point (i+di,j+dj) should be as small as possible (that is, less than a certain threshold).
  • Func5 (i,j) can be specifically expressed as:
  • Term5(i,j) can be specifically expressed as:
  • du(i,j) and dv(i,j) are the unknown quantities that need to be solved, and it is necessary to ensure that this term is as small as possible when solving the constraint equations later.
  • S506 The terminal obtains a displacement matrix corresponding to each region according to each constraint item and the weight coefficient corresponding to each constraint item.
  • the terminal can set weight coefficients for the head area, body area, edge area of the field of view, background area, and regular restriction items of the portrait, establish a restriction equation based on each restriction item and the corresponding weight coefficient, and solve the restriction equation , The offset of each position point in each area can be obtained.
  • the coordinate matrix (also called the target image matrix) of the corrected image (that is, the second corrected image) of the algorithm constraint is Mt(i,j)
  • Mt(i,j) [ut(i,j),vt (i,j)] T
  • its displacement matrix compared to the image matrix M0(i,j) is Dt(i,j)
  • ⁇ 1(i,j) ⁇ 5(i,j) are the weight coefficients (weight matrix) corresponding to Term1 ⁇ Term5, respectively.
  • the displacement matrix Dt(i,j) of each pixel of the image is finally obtained.
  • ⁇ 1(i,j) ⁇ 5(i,j) can be set as fixed weight values, respectively.
  • weight coefficients can also be adaptively generated according to the image content to achieve local weight control.
  • the weight coefficient adaptive configuration principle can include but not Limited to at least one of the following:
  • the image area occupied by the head region of the portrait in the first corrected image is positively correlated with the weight coefficient corresponding to the head constraint item.
  • the weight value of the face constraint item or the body constraint item in the corresponding area can be increased.
  • the weight value of the face constraint item or the body constraint item in the corresponding area can be increased.
  • the texture saliency of the background area in the first corrected image is configured to be positively correlated with the weight coefficient corresponding to the background constraint item.
  • the background area when the texture details of the background area are weak, the background area is not sensitive to distortion or faults caused by correction, and the weight of the background constraint items in the corresponding area can be reduced to achieve better foreground portrait correction.
  • the boundary constraint may affect the correction effect of the foreground portrait, and the weight value of the boundary constraint item of the corresponding region can be increased to achieve better foreground portrait correction.
  • S507 The terminal obtains a second corrected image through color mapping according to the initial image matrix and the displacement matrix respectively corresponding to each area.
  • the terminal crops the second corrected image into a rectangular image and outputs it.
  • the second corrected image obtained in step 507 is a Wt*Ht special-shaped image (non-rectangular image). Therefore, the special-shaped image needs to be cropped and zoomed to output a rectangular image of the target resolution.
  • the edge position of the special-shaped image can be cut along the rectangular dashed line to obtain a rectangular area, and the rectangular area can be enlarged to the resolution of Wt*Ht, thereby obtaining Wt*Ht Rectangular image.
  • the terminal can perform algorithm constraint correction processing on the special-shaped image after optical distortion correction, sub-regions (including head region, body region, background region, and edge region of the field of view).
  • the head area and body area are respectively corrected based on different projection algorithms, and independent constraints are set to optimize the solution to ensure the best correction of the portrait.
  • For the background area by constraining the positional relationship between the background pixel point and its control domain point before and after the transformation, it is ensured that the image content of the background area will not cause background distortion or faulting due to foreground correction.
  • the implementation of the embodiments of the present application can ensure that after the image is corrected, the portrait and background content can be natural, coherent, and coordinated, conform to human visual habits, greatly improve user experience, and have greater commercial application value.
  • the terminal when the user needs to take a photo with the mobile phone, the user opens the camera APP in the mobile phone, and the display interface 20 of the camera APP is presented on the display panel of the mobile phone.
  • the camera device driving the mobile phone collects the source image in real time, and performs optical distortion correction of the source image into the first corrected image in the processor, and the first corrected image is displayed in the preview frame 204 in the display interface 20.
  • the processor performs algorithm constraint correction on the first corrected image to obtain a second corrected image, and cuts the second corrected image into a rectangular image for storage, for example, to an album.
  • the mobile phone when the user clicks on the image browsing control 201 in the display interface 20, the mobile phone will switch to the display interface 30 of the album APP, and display the rectangular image in the display interface 30. It can be seen that since the mobile phone automatically completes the correction of the image, the correction process is basically not perceived by the user. For the user, the rectangular image effect with excellent portrait effect and background effect can be seen in time after shooting, which greatly improves the user experience.
  • FIG. 15 is a schematic flowchart of another image distortion correction method provided by an embodiment of the present application.
  • the method may be applied to the terminal shown in FIG. 1 or FIG. 2.
  • the main difference between the method embodiment in FIG. 15 and the method embodiment in FIG. 9 is that, in the embodiment in FIG. 15, the special-shaped image obtained by the optical distortion correction is first cut to obtain a rectangular image, and then further processing is performed on the basis of the rectangular image.
  • Algorithm constraint correction As shown in Figure 15, the method includes but is not limited to the following steps:
  • the terminal collects a source image.
  • the terminal performs optical distortion correction on the source image to obtain a special-shaped image.
  • the terminal crops the irregular image to obtain a first corrected image.
  • the special-shaped image obtained in step 602 is a Wt*Ht special-shaped image (non-rectangular image).
  • the special-shaped image can be cropped along the edge position to obtain a rectangular area, and the rectangular area is enlarged.
  • a rectangular image of Wt*Ht is obtained, that is, the first corrected image.
  • the terminal recognizes that the first corrected image has a stretched and deformed portrait area, a background area, and an edge area of the field of view.
  • the stretched and deformed portrait area includes at least a stretched and deformed head area and a stretched and deformed body area.
  • the terminal determines the initial image matrixes respectively corresponding to the head area, the body area, the background area, and the edge area of the field of view.
  • the terminal separately constructs constraint items corresponding to the head area, body area, background area, and edge area of the field of view, and regular constraint items.
  • the head constraint item, the body constraint item, the background constraint item, and the regular constraint item can be similarly referred to the related description in S505 of the embodiment of FIG. 9, which will not be repeated here.
  • the realization process of the field boundary constraint item in this step is the same as the field boundary in S505 of the embodiment of FIG. 9
  • the implementation process of constraints is different.
  • the field edge constraint term is used to constrain the pixel points in the initial image matrix corresponding to the edge area of the field of view in the first corrected image to shift along the edge of the first corrected image, so as to Maintain the edge area of the field of view.
  • Term3(i,j) SUM (i,j) ⁇ EdgeRegion
  • M0(i,j) here represents the image coordinates of the pixel at the edge area of the field of view (ie (i,j) ⁇ EdgeRegion), and Dt(i,j) here represents the corresponding M0(i,j)
  • the displacement matrix of Func3 (i,j) represents the displacement function of M0(i,j), and
  • This field edge constraint must ensure that under the action of the displacement matrix Dt(j,i), the image matrix M0(i,j) tends to be an appropriate displacement of the coordinate value M0(j,i), and the displacement rule is only along the image Move the edge area of the image to avoid moving to the inside or outside of the image to minimize the loss of image information caused by subsequent rectangular cutting.
  • Term3 can be expressed as:
  • du(i,j) and dv(i,j) are unknown quantities that need to be solved, and it is necessary to ensure that this term is as small as possible when solving the constraint equations later.
  • S607 The terminal obtains a displacement matrix corresponding to each region according to each constraint item and the weight coefficient corresponding to each constraint item.
  • the terminal obtains and outputs a second corrected image through color mapping according to the initial image matrix and the displacement matrix respectively corresponding to each area.
  • the content of S607-S608 please refer to the description of S506-S507 of the embodiment in FIG. Since the first corrected image in this embodiment is a rectangular image, the second corrected image obtained through S608 is also a rectangular image, and the second corrected image can be output afterwards without cutting the second corrected image.
  • the terminal corrects the optical distortion to obtain a special-shaped image, crops the special-shaped image into a rectangular image, and divides the rectangular image into regions (including the head region, the body region, the background region, and the visual field).
  • the field edge area performs algorithm constraint correction processing, in which the head area and body area of the portrait are respectively subjected to shape correction based on different projection algorithms, and independent constraints are set to optimize the solution to ensure the best correction of the portrait.
  • For the background area by constraining the positional relationship between the background pixel point and its control domain point before and after the transformation, it is ensured that the image content of the background area will not cause background distortion or faulting due to foreground correction.
  • the implementation of the embodiments of the present application can ensure that after the image is corrected, the portrait and background content can be natural, coherent, and coordinated, conform to human visual habits, greatly improve user experience, and have greater commercial application value.
  • the user when the user needs to take a photo with the mobile phone, the user opens the camera APP in the mobile phone, and the display interface 20 of the camera APP is presented on the display panel of the mobile phone.
  • the camera APP The camera device of the mobile phone is driven to collect the source image in real time, and the source image is subjected to optical distortion correction in the processor into a special-shaped image, and the combined special-shaped image is cropped and enlarged to obtain the first corrected image in the form of a rectangle.
  • the preview frame 204 displays the first corrected image.
  • the processor When the user clicks the shooting control 202 in the display interface 20, the processor performs algorithm constraint correction on the first corrected image to obtain a second corrected image in a rectangular form, and saves the second corrected image, for example, to an album.
  • the mobile phone will switch to the display interface 30 of the album APP, and display the rectangular image in the display interface 30. It can be seen that since the mobile phone automatically completes the correction of the image, the correction process is basically not perceived by the user. For the user, what the preview frame 204 sees is a rectangular image, and after shooting, the rectangular image effect with excellent portrait effect and background effect can be seen in time, which greatly improves the user experience.
  • the terminal when the user needs to take a photo with the mobile phone, the user opens the camera APP in the mobile phone, and the display panel of the mobile phone displays the camera APP display In interface 20, the camera APP drives the camera device of the mobile phone to collect the source image in real time, and displays the source image in the preview box 204 in the display interface 20.
  • the shooting control 202 in the display interface 20 the source image is processed in the processor.
  • the optical distortion is corrected as the first corrected image (the first corrected image may be a special-shaped image or a cropped rectangular image.
  • a special-shaped image is taken as an example).
  • the processor performs algorithm constraint correction on the first corrected image to obtain a second corrected image, and crops and enlarges the second corrected image into a rectangular image for storage, for example, to an album.
  • the mobile phone will switch to the display interface 30 of the album APP, and display the rectangular image in the display interface 30. It can be seen that since the mobile phone also automatically completes the correction of the image, the correction process is basically not perceived by the user. For the user, what the preview frame 204 sees is a rectangular image, and after shooting, the rectangular image effect with excellent portrait effect and background effect can be seen in time, which greatly improves the user experience.
  • FIG. 19 is a schematic structural diagram of an apparatus 70 provided by an embodiment of the present application.
  • the apparatus 70 includes an optical distortion correction module 701 and an algorithm constraint correction module 702.
  • the optical distortion correction module 701 and the algorithm constraint correction module 702 may run on the processor 110 of the terminal 100.
  • the related functions of the optical distortion correction module 701 and the algorithm constraint correction module 702 can be implemented in the graphics engine of the system library described in the embodiment of FIG. 3. among them:
  • the optical distortion correction module 701 is configured to perform optical distortion correction according to the collected source image to obtain a first corrected image;
  • the first corrected image includes a stretched and deformed portrait and a background area, and the stretched and deformed portrait includes at least A stretched and deformed first human body region and a stretched and deformed second body region;
  • the algorithm constraint correction module 702 is configured to process the first human body region, the second human body region, and the background region to obtain a second corrected image; wherein, the first human image in the second corrected image is A human body region and a second human body region present different deformations based on different algorithms, so that the stretching deformation of the first human body region and the second human body region are respectively corrected, and the background region of the second corrected image
  • the image content running through the portrait has no discontinuities in human vision.
  • optical distortion correction module 701 and the algorithm constraint correction module 702 can be specifically used to implement the relevant method steps in the terminal as shown in the embodiment of FIG. 7, FIG. 9, or FIG. 15. For the sake of brevity of the description, the details are not repeated here.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable memory.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory.
  • a number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
  • the program can be stored in a computer-readable memory, and the memory can include: flash memory Disk, read-only memory (English: Read-Only Memory, abbreviation: ROM), random access device (English: Random Access Memory, abbreviation: RAM), magnetic disk or optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

本申请提供了图像畸变校正方法及装置,方法包括:对采集的源图像进行光学畸变校正,获得第一校正图像;第一校正图像包括背景区域和具有拉伸变形的人像,拉伸变形的人像至少包括拉伸变形的第一人体区域和拉伸变形的第二人体区域;对第一人体区域、第二人体区域和背景区域进行算法约束校正,获得第二校正图像;算法约束校正采用的约束项分别约束第一人体区域、第二人体区域以及所述背景区域,从而使第一人体区域和第二人体区域的拉伸变形分别得到校正,且背景区域中贯穿人像的图像内容在人眼视觉中无断层现象。本申请能实现较自然的图像畸变校正,提升用户使用体验。

Description

图像畸变校正方法及装置
本申请要求于2019年9月18日提交到中国专利局、申请号201910896549.6、申请名为“图像畸变校正方法及装置”的中国专利的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理技术,尤其涉及图像畸变校正方法及装置。
背景技术
随着信息技术的发展,终端(如手机)集成越来越多的功能,摄影功能已成为终端重要的功能之一。近年来,随着终端镜头视场角越来越大,终端所拍摄图像中的人像图像畸变问题变得越来越显著。
图像畸变是由于大视场短焦距光学系统不满足针孔模型,不同视场的主光线通过光学系统后与高斯像面的焦点高度不等于理想像高,使得实际像点偏离理想像点,从而图像中的内容出现拉伸、扭曲等几何形状的变形失真。例如,对于具有广角镜头的手机,能获取较大视场的图像,但也容易引入显著的图像畸变,比如所拍摄图像中位于图像外侧(即视场角度较大)的人像会呈现更大的变形失真。因此,需要对出现图像畸变的图像进行校正,使得图像符合人眼视觉。
在一种现有解决方案中,通过检测算法在摄像头采集的源图像(原始图像)中确定出人物矩形区域与背景区域,为人物矩形区域建立单应性约束,以校正人物矩形区域中出现的拉伸变形;通过直线检测算法确定背景区域中的直线区域,为直线区域建立直线性约束,以保证校正后的直线不出现弯曲;还为人物矩形区域与背景区域建立单应性兼容约束,保证这两个区域的直线边界的连续性,从而渲染获得最终的校正图像。
然而,由于该方案需要在源图像上标定直线,最终的图像校正效果会受到直线检测精度的影响。另外,该方案只能整体性校正人像,导致最终的人像未能真正符合人眼视觉,如图1中的(1)中的左侧图像为校正前图像,右侧图像为校正后图像,可以看到校正后图像中左边人物身体未能得到校正。此外,该方案还容易导致背景区域出现断层现象,如图1中的(2)中的左侧图像为校正前图像,右侧图像为校正后图像,可以看到校正后图像中人物背景的直线内容出现了断层、不连贯的状况。
所以,如何实现较自然的图像畸变校正依然是一种严峻的技术挑战。
发明内容
本申请实施例提供了图像畸变校正方法及装置,能够解决现有技术缺陷,实现较自然的图像畸变校正,提升用户使用体验。
第一方面,本申请实施例提供了一种图像畸变校正方法,该方法可应用于终端,方法包括:对采集的源图像进行光学畸变校正,获得第一校正图像;所述第一校正图像包括背景区域和具有拉伸变形的人像,所述拉伸变形的人像至少包括拉伸变形的第一人体区域和拉伸变形的第二人体区域;对所述第一人体区域、所述第二人体区域和所述背景区域进行算法约束校正,获得第二校正图像,其中,所述算法约束校正采用的约束项分别约束所述第一人体区 域、第二人体区域以及背景区域。具体的,所述第一人体区域、所述第二人体区域对应的约束项是基于不同的投影算法而确定的,从而所述第一人体区域、所述第二人体区域可实现不同变形量,进而使得所述第一人体区域和所述第二人体区域的拉伸变形分别得到校正;所述背景区域的约束项用于约束所述第二校正图像的背景区域,使得所述背景区域的图像内容无扭曲,所述背景区域中贯穿所述人像的图像内容在人眼视觉中无断层现象;所述第一人体区域、所述第二人体区域和所述背景区域之间过渡平滑、自然。
可以看到,本申请方案中,终端可对光学畸变校正后的图像(即第一校正图像)分区域(包括第一人体区域,第二人体区域,背景区域)进行算法约束校正处理,其中,对人像的第一人体区域和第二人体区域的约束中,分别基于不同的投影算法进行形状校正,确保人像得到最好的校正。通过对背景图像的约束,确保背景区域的图像内容不会由于前景校正而导致背景扭曲或断层现象。所以实施本申请方案能够确保图像被校正后,人像和背景内容均能自然、连贯、协调,符合人眼视觉习惯,极大提高用户使用体验。
基于第一方面,在可能的实施方式中,所述第一校正图像还包括视场边缘区域,视场边缘区域为第一校正图像中位于图像边缘的条带区域;所述对所述第一人体区域、所述第二人体区域和所述背景区域进行算法约束校正,获得第二校正图像,包括:对所述第一人体区域、所述第二人体区域、所述背景区域和所述视场边缘区域进行算法约束校正,获得所述第二校正图像。
实施本申请实施例,通过对视场边缘区域进行边界约束,可以减少避免出现视场损失问题,减少裁切带来的内容损失,提高用户使用体验。
基于第一方面,在可能的实施方式中,所述第一人体区域包括所述人像的头部区域,所述第二人体区域包括所述人像的身体区域。
由于人像的头部区域和身体区域的拉伸变形量和变形方式有所差异,头部区域和身体区域的面积不同,用户对其变形的容忍度有所不同。实施本申请实施例,可对人像的头部区域、身体区域、背景区域和视场边缘区域进行算法约束校正处理,从而能分别针对头部区域和身体区域的变形进行优化,确保人像得到最好的校正。
基于第一方面,在可能的实施方式中,所述对所述第一人体区域、所述第二人体区域、所述背景区域和所述视场边缘区域进行算法约束校正,获得所述第二校正图像,包括:
确定所述第一校正图像中的所述头部区域、所述身体区域、所述背景区域和所述视觉边缘区域分别对应的初始图像矩阵;
构建所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的约束项;
以及,构建用于所述第一校正图像的正则约束项;根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的约束项和所述正则约束项,以及各个约束项对应的权重系数,获得所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵;
根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的初始图像矩阵和所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵;通过颜色映射获得所述第二校正图像。
具体的,终端可针对人像的头部区域、身体区域、视场边缘区域、背景区域的约束项以及正则约束项设置权重系数,根据各个约束项和对应的权重系数建立约束方程,通过求解该 约束方程,就可获得各个区域中的各个像素点的偏移量。根据各个像素点的原始位置和偏移量,就能知道各个像素点在最终校正的图像(即第二校正图像)中的新位置,在新位置进行颜色映射即可获得所述第二校正图像。所以,实施本申请实施例能够自动完成了对图像的校正,算法约束校正过程可基本发生在终端的处理器内部不被用户感知。所以对于用户而言,使用终端拍摄完就能够看到人像效果和背景效果均极佳的矩形图像效果,极大提高了用户使用体验。
基于第一方面,在可能的实施方式中,所述根据所述对应的初始图像矩阵和所述对应的位移矩阵,通过颜色映射获得所述第二校正图像,包括:
根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的初始图像矩阵和所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵,获得所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的目标图像矩阵;
根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的目标图像矩阵,和,所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的颜色矩阵,获得所述第二校正图像。
基于第一方面,在可能的实施方式中,假设算法约束校正后的图像(即第二校正图像)的坐标矩阵(又可称为目标图像矩阵)为Mt(i,j):
Mt(i,j)=[ut(i,j),vt(i,j)]T
其相比于在第一校正图像中的图像矩阵M0(i,j)的位移矩阵为Dt(i,j):
Dt(i,j)=[du(i,j),dv(i,j)]T
也即是说:
Mt(i,j)=M0(i,j)+Dt(i,j)
对各约束项分配权重系数,并构建约束方程如下:
Dt(i,j)=(du(i,j),dv(i,j))=argmin(α1(i,j)*Term1(i,j)+α2(i,j)*Term2(i,j)+α3(i,j)*Term3(i,j)+α4(i,j)*Term4(i,j)+α5(i,j)*Term5(i,j))
其中,Term1~Term5分别是头部区域、身体区域、视场边缘区域、背景区域、全局图像区域对应的约束项。
α1(i,j)~α5(i,j)分别为Term1~Term5对应的权重系数(权重矩阵)。
通过使用最小二乘法或梯度下降法或各类改进算法求解该约束方程,就可以得到图像的各个像素点的位移矩阵Dt(i,j)。
其中,所述头部区域对应的约束项(Term1)用于:约束所述头部区域对应的目标图像矩阵逼近为对第一图像矩阵进行几何变换后的图像矩阵,以校正所述头部区域出现的拉伸变形;其中,所述第一图像矩阵是对所述头部区域对应的初始图像矩阵用球面投影算法处理得到的,所述几何变换包括图像旋转、图像平移和图像缩放中的至少一种。
所述身体区域对应的约束项(Term2)用于:约束所述身体区域对应的目标图像矩阵逼近为对第二图像矩阵进行几何变换后的图像矩阵,以校正所述身体区域出现的拉伸变形;其中,所述第二图像矩阵是对所述身体区域对应的初始图像矩阵用墨卡托投影算法处理得到的,所述几何变换包括图像旋转、图像平移和图像缩放中的至少一种。
本实施例通过应用球面投影算法于头部区域的校正,有利于让图像的人像头部在人眼视觉中看起来自然、协调。通过应用墨卡托投影算法于身体区域的校正,有利于让图像的人像 身体在人眼视觉中看起来笔直协调、不侧倾。而通过结合球面投影算法和墨卡托投影算法,有利于使整个人像符合人眼视觉的观看,让人像看起来自然协调不突兀,提升用户体验。
需要说明的是,本申请中针对人像的头部区域和身体区域还可以采用其他的投影算法进行坐标处理。例如,针对头部区域还可采用演进的自适应球面投影算法,针对身体区域还可以采用自适应墨卡托算法。
所述视场边缘区域对应的约束项(Term3)用于:约束所述视场边缘区域对应的初始图像矩阵中的像素点沿着所述第一校正图像的边缘或者向所述第一校正图像的外侧发生位移,以保持或扩大所述视场边缘区域。
所述背景区域对应的约束项(Term4)用于:约束所述背景区域对应的初始图像矩阵中的像素点发生位移,且位移前所述像素点对应的第一向量和位移后所述像素点对应的第二向量保持平行,以使所述背景区域中的图像内容平滑连续和使所述背景区域中贯穿所述人像的图像内容在人眼视觉上连续一致;其中,所述第一向量表示位移前所述像素点与位移前所述像素点对应的邻域像素点之间的向量;所述第二向量表示位移后所述像素点与位移后所述像素点对应的邻域像素点之间的向量。
所述正则约束项(Term5)用于:约束所述第二校正图像中所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵中的任意两个位移矩阵的差值小于预设阈值,以使所述第二校正图像的全局图像内容平滑连续。
可以看到,本申请实施例中,终端在对光学畸变校正后的异形图像,分区域(包括头部区域,身体区域,背景区域和视场边缘区域)进行算法约束校正处理时,分别设置独立的约束项优化求解,确保人像得到最好的校正。对背景区域,通过约束背景像素点与其控制域点在变换前后的位置关系,确保背景区域的图像内容不会由于前景校正而导致背景扭曲或断层现象。对视场边缘区域,采用内容自适应的边界控制,不仅不会出现视场损失问题,甚至还能扩充视场边界,从而最大程度地减少裁切带来的内容损失和视场损失问题。所以实施本申请实施例能够确保图像被校正后,人像和背景内容均能自然、连贯、协调,符合人眼视觉习惯,极大提高用户使用体验,具有较大的商业应用价值。
基于第一方面,在可能的实施方式中,所述第一校正图像为非矩形图像;所述获得第二校正图像之后,还包括:对所述第二校正图像进行裁剪,获得矩形图像并输出。
基于第一方面,在可能的实施方式中,所述对采集的源图像进行光学畸变校正,获得第一校正图像,包括:对采集的源图像进行光学畸变校正,获得非矩形图像;将所述非矩形图像裁剪成为矩形图像,所述第一校正图像为所述矩形图像。
基于第一方面,在可能的实施方式中,所述第一人体区域所占图像面积和所述第一人体区域的约束项对应的权重系数正相关;所述第二人体区域所占图像面积和所述第二人体区域的约束项对应的权重系数正相关。
具体的,可配置第一校正图像中人像的头部区域所占图像面积和头部约束项对应的权重系数正相关。可配置第一校正图像中人像的身体区域所占图像面积和身体约束项对应的权重系数正相关。也即是说,当头部区域或身体区域所占图像面积较大时,由于大面积的人像对变形更为敏感,可增加相应区域的面部约束项或身体约束项的权重值,从而让头部区域或身体区域校正后更加自然、协调。
基于第一方面,在可能的实施方式中,所述第一人体区域的视场角和所述第一人体区域的约束项对应的权重系数正相关;所述第二人体区域的视场角和所述第二人体区域的约束项 对应的权重系数正相关。
具体的,可配置第一校正图像中头部区域的视场角和头部约束项对应的权重系数正相关。配置第一校正图像中身体区域的视场角和身体约束项对应的权重系数正相关。也即是说,当头部区域或身体区域位于视场角较大区域时,由于大视场角的人像变形更为严重,可增加相应区域的面部约束项或身体约束项的权重值,从而让头部区域或身体区域校正后更加自然、协调,避免显著变形。
基于第一方面,在可能的实施方式中,所述背景区域的纹理显著性和所述背景区域的约束项对应的权重系数正相关。
具体的,可配置第一校正图像中背景区域的纹理显著性和背景约束项对应的权重系数正相关。也即是说,当背景区域纹理细节较弱时,背景区域对校正带来的扭曲或断层不敏感,可减少相应区域的背景约束项的权重,以实现更好的前景人像校正。
基于第一方面,在可能的实施方式中,所述视场边缘区域存在人像内容时所述视场边缘区域的约束项对应的权重系数,大于所述视场边缘区域不存在人像内容时所述视场边缘区域的约束项对应的权重系数。
具体的,可配置第一校正图像中视场边缘区域存在人像内容时视场边缘约束项对应的权重系数,大于视场边缘区域不存在人像内容时视场边缘约束项对应的权重系数。也即是说,当图像视场边缘处存在人像时,边界约束可能会影响前景人像的校正效果,可增加相应区域的边界约束项的权重值,以实现更好的前景人像校正。
基于第一方面,在可能的实施方式中,终端对该源图像进行光学畸变校正,获得第一校正图像,包括:对摄像装置采集到的源图像利用光学畸变校正算法做光学畸变校正,具体的,光学畸变校正算法可以是张正友相机标定算法。经过光学畸变校正算法处理之后,获得第一校正图像,第一校正图像中弯曲的直线将被校正成直线。
基于第一方面,在可能的实施方式中,终端可通过图像分割(image segmentation)的方法将第一校正图像分成第一人体区域、第二人体区域、背景区域和视场边缘区域等等对象区域。例如该图像分割方法可以是图像语义分割方法,通过终端内的神经网络处理器(neural-network processing unit,NPU),自动针对第一校正图像像素级地进行图像识别,标注出第一校正图像中每个像素所属的对象类别并识别其中的内容,从而在第一校正图像中分割出各个对象区域。
基于第一方面,在可能的实施方式中,人像的第一人体区域可以是人像的头部区域和四肢区域,人像的第二人体区域可以是人像的躯干区域。
第二方面,本申请实施例提供了一种装置,所述装置包括:光学畸变校正模块和算法约束校正模块,其中:光学畸变校正模块用于对采集的源图像进行光学畸变校正,获得第一校正图像;所述第一校正图像包括背景区域和具有拉伸变形的人像,所述拉伸变形的人像至少包括拉伸变形的第一人体区域和拉伸变形的第二人体区域;算法约束校正模块用于对所述第一人体区域、所述第二人体区域和所述背景区域进行算法约束校正,获得第二校正图像;其中,所述算法约束校正采用的约束项分别约束所述第一人体区域、第二人体区域以及所述背景区域。
所述装置具体可通过各功能模块来实现第一方面任意实施方式/实施例所描述的方法。
第三方面,本申请实施例提供一种终端,该终端可以包括:一个或多个处理器和存储器;处理器和存储器通过总线连接或者耦合在一起;上述存储器中存储一个或多个计算机程序, 一个或多个处理器用于执行该一个或多个计算机程序;一个或多个计算机程序包括指令,该指令用于执行如上述第一方面的可能的实施方式/实施例中描述的方法。
第四方面,本申请实施例提供一种终端,该终端可以包括:一个或多个处理器、存储器以及用于图像显示的显示屏。
其中,处理器、存储器、显示屏可以通过一个或多个通信总线连接;上述存储器中存储一个或多个计算机程序,一个或多个处理器用于执行该一个或多个计算机程序;一个或多个计算机程序包括指令,该指令用于执行如上述第一方面的可能的实施方式/实施例中描述的方法。
第五方面,本申请实施例提供一种计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被执行处理器执行时使所述处理器执行如第一方面任意实施例所描述的方法。
第六方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品运行于计算机时,被执行以实现第一方面任意实施例描述的方法。
可以看到,本申请实施例中,终端可对光学畸变校正后的图像划分区域(包括头部区域,身体区域,背景区域和视场边缘区域)进行算法约束校正处理,其中,对人像的头部区域和身体区域分别基于不同的投影算法进行形状校正,确保人像得到最好的校正。本申请实施例还能确保背景区域的图像内容不会由于前景校正而导致背景扭曲或断层现象,以及减少裁切带来的内容损失和视场损失问题。所以实施本申请实施例能够确保图像被校正后,人像和背景内容均能自然、连贯、协调,符合人眼视觉习惯,极大提高用户使用体验。
附图说明
图1是现有方案的两种图像校正的比对图;
图2是本申请实施例提供的一种终端的结构示意图;
图3是本申请实施例提供的一种终端的软件结构框图;
图4是本申请实施例提供的一种终端的拍照界面和相册界面的示意图;
图5是本申请实施例提供的一种桶形畸变图像、枕形畸变图像与正常图像的对比示意图;
图6是本申请实施例提供的一种光学畸变校正处理的比对图;
图7是本申请实施例提供的一种图像畸变校正方法的流程示意图;
图8是本申请实施例提供的一种对图像划分区域的示例性示意图;
图9是本申请实施例提供的又一种图像畸变校正方法的流程示意图;
图10是本申请实施例提供的一种球面投影算法和墨卡托投影算法的处理场景示意图;
图11是本申请实施例提供的一种对图像的视场边缘区域的处理场景示意图;
图12是本申请实施例提供的一种图像的背景区域的处理场景示意图;
图13是本申请实施例提供的一种对异形图像进行裁剪和放大的场景示意图;
图14是本申请实施例提供的一种手机拍照应用场景的处理流程示意图;
图15是本申请实施例提供的又一种图像畸变校正方法的流程示意图;
图16是本申请实施例提供的又一种对图像的视场边缘区域的处理场景示意图;
图17是本申请实施例提供的又一种手机拍照应用场景的处理流程示意图;
图18是本申请实施例提供的一种又一种手机拍照应用场景的处理流程示意图;
图19是本申请实施例提供的一种装置的结构示意图。
具体实施方式
下面将基于附图详细描述本申请的各种实施方案。应理解的是,本说明书并非旨在将本申请限制于那些示例性实施方案。相反,本申请旨在不但覆盖这些示例性实施方案,而且覆盖可以包括在由所附权利要求所限定的本申请的精神和范围之内的各种替选方式、修改方式、等同方式以及其它的实施方案。
在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;文本中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,另外,在本申请实施例的描述中,“多个”是指两个或多于两个。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
本申请实施例的方法可应用于终端设备(简称终端),终端可以是手机、平板电脑、笔记本电脑、掌上电脑、移动互联网设备(MID,mobile internet device)、可穿戴设备(如智能手环、智能手表等)、AR设备、VR设备、摄像设备(例如录像机、智能相机、数码相机、摄影机等)、车载设备或者其他具有拍摄功能的设备。
参见图2,图2示例性示出了一种终端100的结构示意图。如图2所示,终端100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,摄像装置193和显示屏194。可选的,终端100还可以包括天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,指示器192,以及用户标识模块(subscriber identification module,SIM)卡接口195等等中的一个或多个。其中传感器模块180例如可以包括压力传感器,陀螺仪传感器,加速度传感器,距离传感器,指纹传感器等等中的一个或多个。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器 (universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对终端100的结构限定。在本申请另一些实施例中,终端100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
处理器110可以根据指令操作码和时序信号,完成取指令、执行指令的控制和数据的调用。具体的,处理器110可用于执行本申请实施例所描述的图像畸变校正方法。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像装置193,和无线通信模块160等供电。
终端100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
终端100可通过GPU,显示屏194,以及应用处理器等实现图像/视频显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,终端100可以包括1个或N个显示屏194,N为大于1的正整数。
在一些实现中,显示屏194可以是触摸屏,触摸屏可包括:显示面板以及覆盖在该显示面板上的触敏表面。当触敏表面检测到在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触敏表面上或在触敏表面附近进行触摸、点击、按压、滑动等操作)后,传送给处理器110以确定触摸事件的类型,随后处理器110根据触摸事件的类型在显示面板上提供相应的视觉输出。一种示例中,触敏表面与显示面板是作为两个独立的部件来实现输入和输入功能。又一种示例中,触敏表面与显示面板通过集成而实现输入和输出功能。
可选的,触敏表面又可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器110,并能接收处理器110发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型来实现该触敏表面。
可选的,显示面板可用于显示由用户输入的信息或提供给用户的信息以及终端100的各种显示界面,显示界面可以是用户界面(User Interface,UI)或图形用户界面(Graphical User Interface,GUI),这些界面内容可包括正在运行的应用程序的界面以及系统级别菜单 等,具体可以由图像(picture)、文本(text)、图标(Icon)、视频(video)、按键(Button)、滑动条(Scroll Bar)、菜单(Menu)、视窗(Window)、标签(Label)、输入框(input box)和其任意组合来构成。
终端100可以通过ISP,摄像装置193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像装置193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头的感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像装置193中。
摄像装置193用于捕获静态图像或视频。物体通过镜头(如光学透镜模组)生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。然后可将该图像信号通过显示屏194进行显示,和/或,将该图像信号保存到内部存储器121或外部存储器。
在一些实施例中,摄像装置193可包括采集人脸识别所需图像的摄像头,如红外摄像头或其他摄像头。该采集人脸识别所需图像的摄像头一般位于电子设备的正面,例如触控屏的上方,也可以位于其他位置,本申请实施例对此不做限制。
在一些实施例中,摄像装置193的摄像头包括但不限于光学摄像头、红外摄像头、深度摄像头,具体形态可以是单目摄像头或多目摄像头。摄像头的镜头可以为标准镜头,广角镜头,超广角镜头,鱼眼镜头或长焦距镜头,或者上述多种镜头的组合。
在一些实施例中,摄像装置193的摄像头可包括前置摄像头和/或后置摄像头。
本文中,摄像装置193输出的图像信号可称为“源图像”。源图像可被输出到处理器进行进一步的图像畸变校正处理。
视频编解码器用于对数字视频压缩或解压缩。终端100可以支持一种或多种视频编解码器。这样,终端100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
DSP用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当终端100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
NPU用于通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现终端100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行终端100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如相机拍摄APP,图像美化APP)等。存储数据区可存储终端100使用过程中所创建的数据(比如校正后的图像数据)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件, 闪存器件,通用闪存存储器(universal flash storage,UFS)等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展终端100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将图像、视频等文件保存在外部存储卡中。
可选的,终端100还可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,视频背景音乐播放,录音等。其中,音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
按键190可包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。终端100可以接收按键输入,产生与终端100的用户设置以及功能控制有关的键信号输入。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和终端100的接触和分离。在一些实施例中,终端100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在终端100中,不能和终端100分离。
应当理解的是,本申请实施例示意的结构并不构成对终端100的具体限定。在本申请另一些实施例中,终端100可以包括比图示更多或更少的部件,或者组合两个或多个的部件,或者拆分某些部件,或者不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。
终端100的软件系统可以采用分层架构、事件驱动架构、微核架构、微服务架构、或云架构。下面以分层架构的安卓(Android)系统为例,示例性说明终端100的一种软件结构。
参见图3,图3是本申请实施例的终端100的一种可能的软件结构框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。
应用程序层可以包括一系列应用程序包。如图3所示,应用程序包可以包括相机APP,图像美化APP,相册APP等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。如图3所示,应用程序框架层可以包括窗口管理器,内容提供器,资源管理器,视图系统,等。其中:
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括图像数据,视频数据等。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序的显示界面。
举例来说,通过视图系统呈现的一种拍照APP的显示界面如图4中的(1)所示,终端100的显示面板上可显示拍照界面20,拍照界面20可包括预览框204以及一些相关控件,如图像浏览控件201,拍摄控件202,前后摄像头切换控件203等。
预览框204用于预览所要拍摄的场景图像。
本申请一种实施例中,预览框204所呈现的图像可以是经过光学畸变校正处理后的校正图像(又可称为第一校正图像)。
本申请又一种实施例中,预览框204所呈现的图像可以是经过光学畸变校正处理和算法约束处理后的校正图像(又可称为第二校正图像)。
本申请又一种实施例中,预览框204所呈现的图像可以是未经过光学畸变校正处理和未经过算法约束处理的源图像。
当用户点击或触摸前后摄像头切换控件203,可指示终端100选择前置摄像头或后置摄像头进行拍摄。
当用户点击或触摸拍摄控件202,终端100将驱动摄像装置发起拍摄操作,指示下层的系统库将源图像加工为第二校正图像,并将第二校正图像保存到相册中。
当用户点击或触摸图像浏览控件201,终端100可调用相册APP并显示该第二校正图像。如图4中的(2)所示,相册APP的显示界面30可包括所获得的第二校正图像301,可选的还包括一个或多个最近拍摄图像的缩略图302。
安卓运行时(Android Runtime)安卓系统的调度和管理,可包括核心库和虚拟机。核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),图形引擎(例如:SGL)等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供图层融合功能。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
图形引擎是用于进行图像加工处理的绘图引擎。本申请实施例中,图形引擎可用于实现将源图像处理为第一校正图像,以及将第一校正图像处理为第二校正图像。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动等。其中,摄像头驱动可用于驱动终端100的摄像头进行拍摄,显示驱动可用于将图像(第一校正图像、第二校正图像)显示在显示屏的显示面板上。
下面说明本申请实施例所涉及的一些概念。
本申请实施例中,所谓“源图像”表示经终端的摄像装置采集的原始图像。摄像装置包括光学透镜模组和感光元件,以感光元件包括电荷耦合器件(charge coupled device,CCD) 为例,在拍摄中,被摄景物的光线通过光学透镜模组聚焦并投射到CCD。CCD采用高感光度的半导体材料制成,通常包括许多感光单位,通常以百万像素为单位。当CCD表面受到光线照射时,每个感光单位会将电荷反映在组件上,从而能将光线转变成电信号。所有的感光单位所产生的信号加在一起构成了完整的电信号。之后CCD将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。
摄像装置的成像过程实质上反映了坐标系的转换过程。即,成像过程实际就是将被摄景物在世界坐标系的点,转换到摄像装置的摄像坐标系,然后再将其投影到成像平面的图像物理坐标系,最后再将成像平面上的数据转换到图像平面的图像像素坐标系的过程。
由于光学透镜模组中的透镜的固有特性(凸透镜汇聚光线、凹透镜发散光线),以及透镜精度和加工工艺的原因,通常经光学透镜模组获得的源图像会引入光学畸变从而导致图像失真。畸变是指光学系统对物体所成的像相对于物体本身而言的失真程度,光学畸变是指光学理论上计算所得到的变形度,空间直线在具有光学畸变的图像中将变弯曲。光学畸变导致的失真对于照片的成像质量是非常不利的。由于光学畸变的存在,使得被摄景物在世界坐标系中的直线最终转化到图像像素坐标系后,可能呈现的是曲线。尤其是图像中越靠近图像边缘的位置,这种光学畸变对图像的扭曲就越明显,此外,广角摄像头相比普通摄像头而言,光学畸变更加显著。
当终端为手机、平板电脑、可穿戴设备等移动终端时,受镜片光学设计影响,光学透镜模组通常具有较大的光学畸变,这与移动终端的视场角有关,通常视场角越大,光学透镜模组的光学畸变越大。
光学畸变又可被称为图像畸变,透镜畸变,摄像畸变,相机畸变,镜头畸变等。光学畸变的类型主要包含径向畸变和切向畸变。
切向畸变通常是由于摄像装置在制造上的缺陷使得透镜本身与图像平面不平行而产生的。
径向畸变产生原因是光线在远离透镜中心的地方比靠近中心的地方更加弯曲。径向畸变具体主要包含桶形畸变(Barrel Distortion)和枕形畸变(Pincushion Distortion)两种。如图5所示,图5示出了桶形畸变图像、枕形畸变图像与理想的正常图像的对比示意图。
桶形畸变又可称桶形失真,是由镜头中透镜物理性能以及镜片组结构引起的成像画面呈桶形膨胀状的失真现象。通常地,在使用广角镜头或使用变焦镜头的广角端时,最容易察觉桶形失真现象。当画面中有直线(尤其是靠近图像边缘的直线)的时候,桶形失真最容易被察觉。
枕形畸变又可称枕形失真,是由镜头引起的画面向中间“收缩”的失真现象。通常地,在使用长焦镜头或使用变焦镜头的长焦端时,最容易察觉枕形失真现象。特别是在使用焦距转换器后,枕形失真便很容易发生。当画面中有直线(尤其是靠近相框边缘的直线)的时候,枕形失真最容易被察觉。
所以,本申请实施例中,摄像装置采集的“源图像”又可称为“畸变图像”。
为了减轻图像中的失真,本申请实施例中,可先对源图像进行光学畸变校正,光学畸变校正是通过光学畸变校正算法计算图像畸变前后的点位置的映射关系来确定图像的畸变系数,然后做与畸变相反的变换,将畸变后的位置的像素值赋给原位置,从而能够缓解畸变带来的失真。
如图6所示,图6中的左侧图像为通过光学透镜模组采集获得的矩形形状的图像(简称 为矩形图像),将该矩形图像进行光学畸变校正处理后,由于像素点的位置发生了位移,会导致光学畸变校正后的图像为非矩形图像,如图6中的右侧图像所示。本申请实施例中,也可将光学畸变校正的非矩形图像称为“异形图像”。为了能将异形图像显示到终端显示面板的矩形的显示界面(例如,矩形预览框)上,还可以将该异形图像裁剪成矩形形状的图像,进而通过图像分辨率的转换等操作实现显示到显示面板。
在异形图像中,因失真而变成曲线的背景内容通常得到了良好的校正,而变成正常的直线内容。然而,对于图像中的人像,由于固有的直线内容较少,所以依然存在拉伸、扭曲等变形失真的状况,包括人像中的头部变形、身体变形等。
为了更好校正变形人像,同时保证人像得到校正的同时避免其他区域产生明显变形(如背景直线不能弯曲断层等),以及保证校正后的图像不会由于矩形裁剪造成太大的视场角损失,本申请实施例继续对经由光学畸变校正后的图像(可称为第一校正图像)进行算法约束校正,对人像的头部、身体部位,以及图像背景、图像边缘等分别基于不同的算法进行校正,从而获得第二校正图像。该第二校正图像中的人像的头部和身体均可符合人眼视觉,且第二校正图像的图像背景中贯穿人像的图像内容在人眼视觉上连续一致,从而避免图像背景出现弯曲断层的状况,同时,第二校正图像也较好地避免了视场角的损失。有关算法约束校正的内容将在下文展开详述。
基于上文的描述,下面给出本申请实施例提供的一些图像畸变校正方法。
对于下文描述的各方法实施例,为了方便起见,将其都表述为一系列的动作步骤的组合,但是本邻域技术人员应该知悉,本申请技术方案的具体实现并不受所描述的一系列的动作步骤的顺序的限制。
参见图7,图7是本申请实施例提供的一种图像畸变校正方法的流程示意图,在一些实现中,该方法可应用于图1或图2所示的终端。该方法包括但不限于以下步骤:
S401、终端采集源图像。
具体的,终端可通过摄像装置(包括光学透镜模组和感光元件)采集源图像。该源图像可为矩形图像。由于光学透镜模组通常具有一定程度的光学畸变(例如,桶形畸变),这导致采集到的源图像的图像内容存在变形失真。
S402、终端对源图像进行光学畸变校正,获得第一校正图像。
具体的,终端可对摄像装置采集到的源图像利用光学畸变校正算法做光学畸变校正,示例性地,光学畸变校正算法可以是张正友相机标定算法。经过光学畸变校正算法处理之后,获得异形图像(即非矩形图像)。在一种实施例中,该异形图像即为第一校正图像。在又一种实施例中,可将该异形图像剪切成矩形图像,并缩放处理为目标分辨率的图像,该目标分辨率的图像即为第一校正图像。
S403、终端分别对第一人体区域、第二人体区域和背景区域进行处理,获得第二校正图像。
本申请实施例中,为了在实现更好的人像校正,并保证在校正前景人像过程中避免背景产生明显的扭曲,首先需要对图像进行区域划分。
具体的,终端可通过图像分割(image segmentation)的方法将第一校正图像分成若干个特定的感兴趣目标区域。例如该图像分割方法可以是图像语义分割方法,通过终端内的神经网络处理器(neural-network processing unit,NPU),自动针对第一校正图像像素级地进 行图像识别,标注出第一校正图像中每个像素所属的对象类别并识别其中的内容,从而在第一校正图像中分割出对象区域。
在一种实现中,第一校正图像划分的区域包括人像的第一人体区域、第二人体区域和背景区域,其中,人像的第一人体区域、人像的第二人体区域分别指人像中的一部分区域。举例来说,如图8所示,人像的第一人体区域可以是人像的头部区域,人像的第二人体区域可以是人像的身体区域。又举例来说,人像的第一人体区域可以是人像的头部区域和四肢区域,人像的第二人体区域可以是人像的躯干区域,等等。相应的,背景区域为第一校正图像中去除人像的第一人体区域、第二人体区域之外的有效区域。
相应的,终端可分别对第一人体区域、第二人体区域和背景区域进行算法约束校正处理,获得第二校正图像。在算法约束校正中,第二校正图像中的人像的第一人体区域和第二人体区域可分别基于不同的算法(例如使用球面投影算法来处理人像的头部区域,使用墨卡托算法来处理身体区域)而呈现不同变形量,使得所述第一人体区域和所述第二人体区域的拉伸变形分别得到校正,符合人眼视觉,且所述第二校正图像的背景区域中贯穿所述人像的图像内容在人眼视觉上连续一致,无断层现象。
在又一种实现中,第一校正图像划分的区域除了包括人像的第一人体区域、第二人体区域、背景区域外,还包括视场边缘区域,视场边缘区域为第一校正图像中位于图像边缘的条带区域,具体实现中可以设定阈值决定这个条带的宽度。相应的,背景区域为第一校正图像中去除人像的第一人体区域、第二人体区域、视场边缘区域之外的有效区域。
相应的,终端可分别对第一人体区域、第二人体区域、背景区域和视场边缘区域进行算法约束校正处理,获得第二校正图像。在算法约束校正中,第二校正图像中的人像的第一人体区域和第二人体区域可分别基于不同的算法(例如使用球面投影算法来处理人像的头部区域,使用墨卡托算法来处理身体区域)而呈现不同变形量,使得所述第一人体区域和所述第二人体区域的拉伸变形分别得到校正,符合人眼视觉,且所述第二校正图像的背景区域中贯穿所述人像的图像内容在人眼视觉上连续一致,无断层现象。此外,通过对视场边缘区域进行边界约束,不仅不会出现视场损失问题,甚至还能扩充视场边界的图像内容。
可以看到,本申请实施例中,终端可对光学畸变校正后的异形图像,分区域(包括头部区域,身体区域,背景区域和视场边缘区域)进行算法约束校正处理,其中,对人像的头部区域和身体区域分别基于不同的投影算法进行形状校正,确保人像得到最好的校正。本申请实施例还能确保背景区域的图像内容不会由于前景校正而导致背景扭曲或断层现象,以及减少裁切带来的内容损失和视场损失问题。所以实施本申请实施例能够确保图像被校正后,人像和背景内容均能自然、连贯、协调,符合人眼视觉习惯,极大提高用户使用体验。
参见图9,图9是本申请实施例提供的又一种图像畸变校正方法的流程示意图,在一些实现中,该方法可应用于图1或图2所示的终端。该方法包括但不限于以下步骤:
S501、终端采集源图像。具体可参考图7实施例S401的描述,这里不再赘述。
S502、终端对该源图像进行光学畸变校正,获得第一校正图像。
具体的,终端可对摄像装置采集到的源图像利用光学畸变校正算法做光学畸变校正,示例性地,光学畸变校正算法可以是张正友相机标定算法。经过光学畸变校正算法处理之后,获得第一校正图像,这里的第一校正图像不再为矩形图像,而是异形图像(或称非矩形图像)。图像中弯曲的直线将被校正成直线,但是此时图像中的人像依然具有一定程度的变形,通常 人像视场角越大,变形越剧烈。
为了更好校正变形人像,同时保证人像得到校正的同时避免背景区域产生弯曲、断层等变形,以及保证校正后的图像不会由于矩形裁剪造成太大的视场角损失,本申请实施例中,可将对第一校正图像进一步进行算法约束校正,所获得的图像可称为第二校正图像。本实施例中,算法约束校正的处理过程可包括下述步骤S503-S507。
S503、终端识别该第一校正图像存在具有拉伸变形的人像区域、背景区域和视场边缘区域。其中,该拉伸变形的人像区域至少包括拉伸变形的头部区域和拉伸变形的身体区域。
本申请实施例中,为了在实现更好的人像校正,并保证在校正前景人像过程中避免背景产生明显的扭曲,需要对图像进行区域划分。
具体的,终端可通过图像分割(image segmentation)的方法将第一校正图像分成若干个特定的感兴趣目标区域。例如该图像分割方法可以是图像语义分割方法,通过终端内的神经网络处理器(neural-network processing unit,NPU),自动针对第一校正图像像素级地进行图像识别,标注出第一校正图像中每个像素所属的对象类别并识别其中的内容,从而在第一校正图像中分割出对象区域。
如图8所示,在一种示例中,终端对第一校正图像识别并标记以下几个区域:人像的头部区域(或者人像头部区域)、人像的身体区域、背景区域和视场边缘区域。当第一校正图像为异形图像时,终端将第一校正图像以外的区域识别为无效区域。
人像的头部区域涵盖图像中各个人像的头部、颈部以及相关装饰物(如帽子、头饰、眼镜等)。
人像的身体区域涵盖图像中各个人像的躯干、四肢、衣服、裤子和鞋子等。
如图8所呈现的异形图像中示出了3个前景人像,每个人像包括各自的头部区域(图示中分别为头部区域1、头部区域2和头部区域3)和身体区域(图示中分别为身体区域1、身体区域2和身体区域3)。
视场边缘区域为异形图像中靠近无效区域的、位于异形图像边缘的环状条带区域,具体实现中可以设定阈值决定这个条带的宽度。
背景区域为异形图像中去除人像的头部区域、身体区域以及视场边缘区域之外的有效区域。
需要说明的是,本申请实施例不限定于将人像划分为头部区域和身体区域,还可以有其他的划分方式,例如还可以划分为头部区域、四肢区域和躯干区域,等等。
S504、终端确定头部区域、身体区域、背景区域和视场边缘区域分别对应的初始图像矩阵。
具体的,终端分别确定第一校正图像中各个人像的头部区域、身体区域以及背景区域和视场边缘区域中的像素点的初始位置点以及颜色信息。像素点的初始位置点可以用初始图像矩阵(或称初始坐标矩阵)来表示,像素点的颜色信息可以用颜色矩阵来表示。
初始图像矩阵用来记录各像素点在第一校正图像中的位置,第一校正图像中的第i行第j列的像素点[i,j] T的平面位置坐标可表示为:
M(i,j)=[u(i,j),v(i,j)] T
其中,u(i,j)表示横坐标,v(i,j)表示纵坐标。
颜色矩阵用来记录各像素点的颜色信息,第一校正图像中第i列第j行的像素点的颜色矩阵可表示为:
C(i,j)=[r(i,j),g(i,j),b(i,j)] T
其中,r(i,j),g(i,j),b(i,j)分别表示红、绿、蓝颜色信息。
为了便于后续运算处理,可将第一校正图像各像素点的初始图像矩阵进行归一化。设第一校正图像的宽度和高度分别为W和H,则归一化的坐标矩阵可表示为
u0=(j-W/2)/W,v0=(H/2–i)/H
基于该归一化的坐标矩阵,第一校正图像各像素点归一化的初始图像矩阵(也可简称为图像矩阵)可用M0表示,具体为:
M0(i,j)=[u0(i,j),v0(i,j)] T
人像的头部区域和身体区域的拉伸变形量和变形方式有所差异,由于头部区域和身体区域的面积不同,用户对其变形的容忍度有所不同。本申请实施例中,为了保证同时很好地校正头部区域和身体区域的变形,还分别针对头部区域和身体区域采用不同的投影算法进行坐标处理。
在一种实施例中,如图10所示,针对人像的头部区域可采用球面投影算法进行坐标处理,针对人像的身体区域可采用墨卡托投影算法进行坐标处理。
将第一校正图像中的头部区域的初始图像坐标M0(i,j),(i,j)∈HeadRegion,按照球面投影算法进行映射,转换成第一图像矩阵M1,M1记为:M1(i,j)=[u1(i,j),v1(i,j)] T
具体地,该M0(i,j)=[u0,v0] T到M1(i,j)=[u1,v1] T的球面投影算法可表示为:
u1=λ*tan(0.5atan(r0))*cos(θ0),v1=λ*tan(0.5atan(r0))*sin(θ0),
其中,r0=sqrt(u0*u0+v0*v0),θ0=atan(v0/u0),λ为缩放系数。
将第一校正图像中的身体区域的初始图像坐标M0(i,j),(i,j)∈BodyRegion,按照墨卡托投影算法进行映射,转换成第二图像矩阵M2,M2记为:M2(i,j)=[u2(i,j),v2(i,j)] T,M2(i,j)=(u2,v2)。
具体地,该M0(i,j)=[u0,v0] T到M2(i,j)=[u2(i,j),v2(i,j)] T的墨卡托投影算法可表示为:
u2=λ*atan(u0),v2=λ*log(tan(π/4+φ/2))
其中,φ=atan(v0/sqrt(u0*u0+1)),λ为缩放系数。
本实施例中,头部区域的M0经球面投影算法得到的M1可以参与到后续步骤S505中以校正人像的头部拉伸变形,身体区域的M0经墨卡托投影算法得到的M2可以参与到后续步骤S505中以校正人像的身体拉伸变形。
本实施例通过应用球面投影算法于头部区域的校正,有利于让图像的人像头部在人眼视觉中看起来自然、协调。通过应用墨卡托投影算法于身体区域的校正,有利于让图像的人像身体在人眼视觉中看起来笔直协调、不侧倾。而通过结合球面投影算法和墨卡托投影算法,有利于使整个人像符合人眼视觉的观看,让人像看起来自然协调不突兀,提升用户体验。
需要说明的是,本申请中针对人像的头部区域和身体区域还可以采用其他的投影算法进行坐标处理。例如,针对头部区域还可采用演进的自适应球面投影算法,针对身体区域还可以采用自适应墨卡托算法。
S505、终端分别构建头部区域、身体区域、背景区域和视场边缘区域分别对应的约束项,以及正则约束项。
本申请实施例中,终端分别针对人像的头部区域、身体区域、背景区域和视场边缘区域构建对应的约束项,以及构建用于全局图像的正则约束项。人像的头部区域、身体区域、背 景区域和视场边缘区域构建对应的约束项以及正则约束项共同用于确定图像中的各个像素点所需的位移。
下面分别对人像的头部区域、身体区域、背景区域以及视场边缘区域的约束项以及用于图像全局的正则约束项展开描述。
(1)人像的头部区域对应的约束项,用于约束对第二校正图像中头部区域对应的目标图像矩阵逼近成为对第一图像矩阵(即M1)进行几何变换后的图像矩阵,以校正头部区域出现的拉伸变形。本实施例中的几何变换表示一种空间映射,即将一个图像矩阵通过变换映射为另一个图像矩阵。本实施例中的几何变换可以是图像平移变换(Translation),图像缩放变换(Scale),图像旋转变换(Rotation)中的至少一种变换。
为了便于描述,可将人像的头部区域对应的约束项简称为头部约束项,当图像中存在多个人像时,不同的人像的头部区域可对应不同的头部约束项。例如对于图8所示的异形图像,头部区域1、头部区域2和头部区域3可分别对应不同的头部约束项。
头部约束项可记为Term1,Term1的算式表达式如下:
Term1(i,j)=SUM (i,j)∈HeadRegionk‖M0(i,j)+Dt(i,j)-Func1 k[M1(i,j)]‖
其中,对于位于头部区域(即(i,j)∈HeadRegionk)的像素点的图像矩阵M0(i,j),其面部保形后的坐标值为M1(i,j)=[u1(i,j),v1(i,j)] T,这里的Dt(i,j)表示该M0(i,j)对应位移矩阵,k表示图像的第k个头部区域,Func1 k表示第k个头部区域对应的几何变换函数,||…||表示向量2范数。
头部约束项Term1(i,j)需保证在该位移矩阵Dt(i,j)作用下,图像矩阵M0(i,j)倾向于为M1(i,j)的适当的几何变换,包括图像旋转、图像平移和图像缩放中的至少一种变换操作。
第k个头部区域对应的几何变换函数Func1 k表示第k个头部区域内的所有点共享相同的几何变换函数Func1 k,不同头部区域对应不同几何变换函数。几何变换函数Func1 k可具体表示为:
Figure PCTCN2020114400-appb-000001
其中,ρ 1k表示第k个头部区域的缩放系数,θ 1k表示第k个头部区域的旋转角度,TX 1k和TY 1k分别表示第k个头部区域的横向位移与纵向位移。
Term1(i,j)可具体表示为:
Figure PCTCN2020114400-appb-000002
其中,du(i,j)和dv(i,j)是需要求解的未知量,后续求解约束方程时需保证该项尽量小。
(2)身体区域对应的约束项用于,约束第二校正图像中身体区域对应的目标图像矩阵逼近成为对第二图像矩阵(即M2)进行几何变换后的图像矩阵,以校正身体区域出现的拉伸变形。本实施例中的几何变换可以是图像平移变换,图像缩放变换,图像旋转变换中的至少一 种变换。
为了便于描述,可将人像的身体区域对应的约束项简称为身体约束项,当图像中存在多个人像时,不同的人像的身体区域可对应不同的身体约束项。例如对于图8所示的异形图像,身体区域1、身体区域2和身体区域3可分别对应不同的身体约束项。
身体约束项可记为Term2,Term2的算式表达式如下:
Term2(i,j)=SUM (i,j)∈BodyRegionk‖M0(i,j)+Dt(i,j)-Func2 k[M2(i,j)]‖
其中,对于位于身体区域(即(i,j)∈BodyRegionk)的像素点M0(i,j),其身体保形后的坐标值为M2(i,j)=[u2(i,j),v2(i,j)] T,这里的Dt(i,j)表示该M0(i,j)对应的位移矩阵,k表示图像的第k个头部区域,Func2 k表示第k个头部区域对应的几何变换函数,||…||表示向量2范数。
身体约束项需保证在该位移矩阵Dt(i,j)作用下,图像矩阵M0(i,j)倾向于为M2(i,j)的适当的几何变换,包括图像旋转、图像平移和图像缩放中的至少一种变换操作。
第k个身体区域对应于几何变换函数Func2 k表示第k个身体区域内的所有点共享相同的几何变换函数Func2 k,不同身体区域对应不同几何变换函数。几何变换函数Func2 k可表示为:
Figure PCTCN2020114400-appb-000003
其中,ρ 2k表示第k个身体区域的缩放系数,θ 2k表示第k个身体区域的旋转角度,TX 2k和TY 2k分别表示第k个身体区域的横向位移与纵向位移。
Term2(i,j)可具体表示为:
Figure PCTCN2020114400-appb-000004
其中,du(i,j)和dv(i,j)是需要求解的未知量,后续求解约束方程时需保证该项尽量小。
(3)视场边缘区域对应的约束项用于,约束所述第一校正图像中所述视场边缘区域对应的初始图像矩阵中的像素点沿着所述第一校正图像的边缘或者向所述第一校正图像的外侧发生位移,以保持或扩大该视场边缘区域。
为了便于描述,可将视场边缘区域对应的约束项简称为视场边缘约束项,视场边缘约束项可记为Term3,Term3的算式表达式如下:
Term3(i,j)=SUM (i,j)∈EdgeRegion||M0(i,j)+Dt(i,j)-Func3 (i,j)[M0(i,j)]||
其中,这里的M0(i,j)表示位于视场边缘区域(即(i,j)∈EdgeRegion)的像素点的图像坐标,这里的Dt(i,j)表示该M0(i,j)对应的位移矩阵,Func3 (i,j)表示M0(i,j)的位移函数,||…||表示向量2范数。
视场边缘约束项需保证在该位移矩阵Dt(i,j)作用下,图像矩阵M0(i,j)倾向于为坐标值M0(i,j)的适当位移,位移规则为只沿着边缘区域或向边缘区域外侧适当移动,避免向边缘区域内侧移动,这样做的好处是可以尽量减少后续矩形裁切造成的图像信息损失,甚至可 以增益扩充视场边缘区域的图像内容。
如图11所示,假设位于异形图像的视场边缘区域的一个像素点A,其图像坐标为[u0,v0] T,该点A沿视场边界的切向向量表示为y(u0,v0),向图像外侧的法向量表示为x(u0,v0),当边界区域已知时,x(u0,v0)和y(u0,v0)也是已知的。则Func3 (i,j)可具体表示为:
Figure PCTCN2020114400-appb-000005
其中,α(u0,v0)需被限制为不小于0,以确保该点不会向视场边缘内部位移,β(u0,v0)的正负无需限制。α(u0,v0)和β(u0,v0)是不需要显示求解的中间未知量。
Term3(i,j)可具体表示为:
Figure PCTCN2020114400-appb-000006
其中,du(i,j)和dv(i,j)是需要求解的未知量,后续求解约束方程时需保证该项尽量小。
(4)背景区域对应的约束项用于,约束第一校正图像中所述背景区域对应的图像矩阵中的像素点发生位移,且位移前像素点对应的第一向量和位移后像素点对应的第二向量尽量保持平行,以使背景区域中的图像内容平滑连续和使背景区域中贯穿人像的图像内容在人眼视觉上连续一致;其中,第一向量表示位移前像素点与位移前像素点对应的邻域像素点之间的向量;第二向量表示位移后像素点与位移后像素点对应的邻域像素点之间的向量。
为了便于描述,可将背景区域对应的约束项简称为背景约束项,背景约束项可记为Term4,Term4的算式表达式如下:
Term4(i,j)=SUM (i,j)∈BkgRegion{Func4 (i,j)(M0(i,j),M0(i,j)+Dt(i,j))}
其中,这里的M0(i,j)表示位于背景区域(即(i,j)∈BkgRegion)的像素点的图像坐标,这里的Dt(i,j)表示该M0(i,j)对应的位移矩阵,Func4 (i,j)表示M0(i,j)的位移函数,||…||表示向量2范数。
背景约束项需保证在该位移矩阵Dt(i,j)作用下的坐标值M0(i,j)倾向于为坐标值M0(i,j)的适当位移。本申请实施例中可将背景区域中的各个像素点划分到不同的控制域,本申请不对控制域的大小、形状、数量做限定。特别地,对于位于前景人像与背景边界处的背景像素点,其控制域需跨越前景人像延伸至前景人像的另一端。如图12所示,包括矩形控制域2和非矩形控制域1,控制域1为例,假设存在某背景像素点A和其控制域像素点集{Bi},控制域为A点的邻域,A的控制域跨越中间人像的头部区域,延伸至该头部区域的另一端。Bi表示A的邻域像素点,当它们发生位移后,分别被移动到A′和{B′i}。位移规则为,背景约束项将限制向量ABi和向量A′B′i尽量保持方向平行。这样做的好处是,可以确保前景人像与背景区域过渡平滑,且背景区域中贯穿人像的图像内容在人眼视觉上能连续一致,避免背景图像产生扭曲变形或产生空洞拉丝等现象。Func4 (i,j)可具体表示为:
Figure PCTCN2020114400-appb-000007
其中:
Figure PCTCN2020114400-appb-000008
其中,angle[]表示两个向量的夹角,vec1表示校正前背景点[i,j] T与其控制域内某点所组成的向量,vec2表示经校正后的背景点[i,j] T与其控制域内经校正后的某点所组成的向量,SUM (i+di,j+dj)∈CtrlRegion表示对控制域内所有向量夹角做求和。
Term4(i,j)可具体表示为:
Term4(i,j)=SUM (i,j)∈BkgRegion{SUM (i+di,j+dj)∈CtrlRegion{angle[vec1,vec2]}}
其中,du(i,j)和dv(i,j)是需要求解的未知量,后续求解约束方程时需保证该项尽量小。
(5)正则约束项用于,约束第二校正图像中背景区域、人像的头部区域、人像的身体区域和视场边缘区域分别对应的位移矩阵中的任意两个相邻像素点的位移矩阵的差值小于预设阈值,以使得第二校正图像的全局图像内容平滑连续。
正则约束项可记为Term5,Term5的算式表达式如下:
Term5(i,j)=SUM (i,j)∈AllRegion{Func5 (i,j)(Dt(i,j))}
对于整个图像范围(即(i,j)∈AllRegion)的像素点M0(i,j),正则约束项需保证相邻像素点的位移矩阵Dt(i,j)是平滑连续的,以避免出现局部过大跳变。限定原则是,点[i,j] T处的位移量与其邻域点(i+di,j+dj)的位移量之差应尽量小(即小于某个阈值)。Func5 (i,j)可具体表示为:
Figure PCTCN2020114400-appb-000009
Term5(i,j)可具体表示为:
Figure PCTCN2020114400-appb-000010
其中,du(i,j)和dv(i,j)是需要求解的未知量,后续求解约束方程时需保证该项尽量小。
S506、终端根据各个约束项以及各个约束项对应的权重系数,获得各区域分别对应的位移矩阵。
具体的,终端可针对人像的头部区域、身体区域、视场边缘区域、背景区域的约束项以 及正则约束项设置权重系数,根据各个约束项和对应的权重系数建立约束方程,求解该约束方程,就可获得各个区域中的各个位置点的偏移量。
假设算法约束校正后的图像(即第二校正图像)的坐标矩阵(又可称为目标图像矩阵)为Mt(i,j),Mt(i,j)=[ut(i,j),vt(i,j)] T,其相比于图像矩阵M0(i,j)的位移矩阵为Dt(i,j),Dt(i,j)=[du(i,j),dv(i,j)] T,也即是说:
Mt(i,j)=M0(i,j)+Dt(i,j)
ut(i,j)=u0(i,j)+du(i,j)
vt(i,j)=v0(i,j)+dv(i,j)
对各约束项分配权重系数,并构建约束方程如下:
Dt(i,j)=(du(i,j),dv(i,j))=argmin(α1(i,j)*Term1(i,j)+α2(i,j)*Term2(i,j)+α3(i,j)*Term3(i,j)+α4(i,j)*Term4(i,j)+α5(i,j)*Term5(i,j))
其中,α1(i,j)~α5(i,j)分别为Term1~Term5对应的权重系数(权重矩阵)。
通过使用最小二乘法或梯度下降法或各类改进算法求解该约束方程,最终得到图像的各个像素点的位移矩阵Dt(i,j)。
在一种实施例中,可将α1(i,j)~α5(i,j)分别设置为固定的权重值。
在又一种实施例中,由于校正过程相当于在前后景校正中选择平衡点,所以也可以根据图像内容自适应地生成权重系数,实现局部权重控制,权重系数自适应配置原则可包括但不限于以下中的至少一种:
配置第一校正图像中人像的头部区域所占图像面积和头部约束项对应的权重系数正相关。
配置第一校正图像中人像的身体区域所占图像面积和身体约束项对应的权重系数正相关。
也即是说,当头部区域或身体区域所占图像面积较大时,由于大面积的人像对变形更为敏感,可增加相应区域的面部约束项或身体约束项的权重值。
配置第一校正图像中头部区域的视场角和头部约束项对应的权重系数正相关。
配置第一校正图像中身体区域的视场角和身体约束项对应的权重系数正相关。
也即是说,当头部区域或身体区域位于视场角较大区域时,由于大视场角的人像变形更为严重,可增加相应区域的面部约束项或身体约束项的权重值。
配置第一校正图像中背景区域的纹理显著性和背景约束项对应的权重系数正相关。
也即是说,当背景区域纹理细节较弱时,背景区域对校正带来的扭曲或断层不敏感,可减少相应区域的背景约束项的权重,以实现更好的前景人像校正。
配置第一校正图像中视场边缘区域存在人像内容时视场边缘约束项对应的权重系数,大于视场边缘区域不存在人像内容时视场边缘约束项对应的权重系数。
也即是说,当图像视场边缘处存在人像时,边界约束可能会影响前景人像的校正效果,可增加相应区域的边界约束项的权重值,以实现更好的前景人像校正。
S507、终端根据各区域分别对应的初始图像矩阵和位移矩阵,通过颜色映射获得第二校正图像。
具体实现中,在获得图像的各个像素点的位移矩阵Dt(i,j)后,终端根据第一校正图像中的各区域的像素点分别对应的图像矩阵M0(i,j)和位移矩阵Dt(i,j),获得第一校正图像中的各区域的像素点的目标图像矩阵Mt(i,j),Mt(i,j)=M0(i,j)+Dt(i,j)。然后,根据目标图像矩阵Mt(i,j)和颜色矩阵C(i,j)生成目标分辨率的图像(假设为Wt*Ht),即获得第二校正图像(即Wt*Ht的新的异形图像)。具体的,可将归一化的Mt(i,j)=[ut(i, j),vt(i,j)] T转换成实际图像的坐标[it,jt] T,转换规则如下:
it=Ht/2-vt*Ht
jt=ut*Wt+Wt/2
获得实际图像的坐标[it,jt] T,即可将第一校正图像的像素点[i,j] T的颜色矩阵C(i,j)填充到第二校正图像的像素点[it,jt] T。由于[it,jt] T可能是小数,所以在一些实现中,还需要对其进行插值取整,常用插值取整算法包括线性插值和Lanczos插值算法等,本申请对此不作限定。
S508、终端将第二校正图像裁剪为矩形图像并输出。
本实施例中,经步骤507获得的第二校正图像为Wt*Ht的异形图像(非矩形图像),所以,还需对该异形图像进行剪裁和缩放处理,输出目标分辨率的矩形图像。在一种示例中,如图13所示,可以在该异形图像的边缘位置沿着矩形虚线进行裁切,获得矩形区域,将该矩形区域放大到Wt*Ht的分辨率,从而得到Wt*Ht的矩形图像。
可以看到,本申请实施例中,终端可对光学畸变校正后的异形图像,分区域(包括头部区域,身体区域,背景区域和视场边缘区域)进行算法约束校正处理,其中,对人像的头部区域和身体区域分别基于不同的投影算法进行形状校正,并分别设置独立的约束项优化求解,确保人像得到最好的校正。对背景区域,通过约束背景像素点与其控制域点在变换前后的位置关系,确保背景区域的图像内容不会由于前景校正而导致背景扭曲或断层现象。对视场边缘区域,采用内容自适应的边界控制,不仅不会出现视场损失问题,甚至还能扩充视场边界,从而最大程度地减少裁切带来的内容损失和视场损失问题。所以实施本申请实施例能够确保图像被校正后,人像和背景内容均能自然、连贯、协调,符合人眼视觉习惯,极大提高用户使用体验,具有较大的商业应用价值。
为了更好理解上述方案,下面结合一种实际应用场景进行方案的描述。
参见图14,在一种示例性场景中,以终端为智能手机为例,当用户需要用手机拍照时,用户打开手机中的拍照APP,手机显示面板上呈现拍照APP的显示界面20,拍照APP驱动手机的摄像装置实时采集源图像,并在处理器中将源图像进行光学畸变校正为第一校正图像,并且在显示界面20中的预览框204显示该第一校正图像。当用户点击显示界面20中的拍摄控件202时,处理器对第一校正图像进行算法约束校正获得第二校正图像,并将第二校正图像裁剪为矩形图像保存,例如保存到相册。这样,当用户点击显示界面20中的图像浏览控件201,手机将切换至相册APP的显示界面30,并且在显示界面30中显示该矩形图像。可以看到,由于手机自动完成了对图像的校正,校正过程基本不被用户感知。对于用户而言,拍摄完就能够及时看到人像效果和背景效果均极佳的矩形图像效果,极大提高了用户使用体验。
参见图15,图15是本申请实施例提供的又一种图像畸变校正方法的流程示意图,在一些实现中,该方法可应用于图1或图2所示的终端。图15的方法实施例和上述图9的方法实施例的主要区别在于,图15实施例中先对光学畸变校正所得的异形图像做裁切,获得矩形图像,之后在该矩形图像基础上进一步进行算法约束校正。如图15所示,该方法包括但不限于以下步骤:
S601、终端采集源图像。
S602、终端对该源图像进行光学畸变校正,获得异形图像。
有关S601-S602的内容可参考图9实施例S501-S502的描述,为了说明书简洁,这里不再赘述。
S603、终端裁剪异形图像,获得第一校正图像。
具体的,本实施例中,经步骤602获得的异形图像为Wt*Ht的异形图像(非矩形图像),可对该异形图像沿着边缘位置进行裁切,获得矩形区域,将该矩形区域放大到Wt*Ht的分辨率,从而得到Wt*Ht的矩形图像,即第一校正图像。
在一种示例中,本步骤的裁剪和放大处理的具体实现也可类似参考图13实施例的描述,这里不再赘述。
S604、终端识别该第一校正图像存在具有拉伸变形的人像区域、背景区域和视场边缘区域。其中,该拉伸变形的人像区域至少包括拉伸变形的头部区域和拉伸变形的身体区域。
S605、终端确定头部区域、身体区域、背景区域和视场边缘区域分别对应的初始图像矩阵。
有关S604-S605的具体实现内容可参考图9实施例S503-S504的描述,主要区别在于这里的第一校正的矩形图像,而图9实施例中为异形图像。为了说明书简洁,这里不再赘述。
S606、终端分别构建头部区域、身体区域、背景区域和视场边缘区域分别对应的约束项,以及正则约束项。
本步骤中,关于头部约束项、身体约束项、背景约束项以及正则约束项,均可类似参考图9实施例的S505中的相关描述,这里不再赘述。
而本步骤中,由于所针对的第一校正图像为矩形图像,其视场边缘区域为矩形的边缘区域,所以本步骤的视场边界约束项的实现过程与图9实施例的S505中视场边界约束项的实现过程有所不同。
本实施例中,视场边缘约束项用于,约束所述第一校正图像中所述视场边缘区域对应的初始图像矩阵中的像素点沿着所述第一校正图像的边缘发生位移,以保持该视场边缘区域。
若将该视场边缘约束项记为Term3,则这里的Term3的算式表达式如下:
Term3(i,j)=SUM (i,j)∈EdgeRegion||M0(i,j)+Dt(i,j)-Func3 (i,j)[M0(i,j)]||
其中,这里的M0(i,j)表示位于视场边缘区域(即(i,j)∈EdgeRegion)的像素点的图像坐标,这里的Dt(i,j)表示该M0(i,j)对应的位移矩阵,Func3 (i,j)表示M0(i,j)的位移函数,||…||表示向量2范数。
该视场边缘约束项需保证在位移矩阵Dt(j,i)作用下,图像矩阵M0(i,j)倾向于为坐标值M0(j,i)的适当位移,位移规则为只沿着图像的边缘区域移动,避免向图像的内侧或外侧移动,以尽量减少后续矩形裁切造成的图像信息损失。
如图16所示,假设位于视场边缘区域的一个像素点A,其图像坐标为[u0,v0] T,该点A沿视场边界的切向向量表示为y(u0,v0),当边界区域已知时,y(u0,v0)也是已知的。则Func3 (i,j)可表示为:
Figure PCTCN2020114400-appb-000011
β(u0,v0)的正负无需限制,以确保能够沿着边界进行移动。Term3可表示为:
Figure PCTCN2020114400-appb-000012
du(i,j)和dv(i,j)是需要求解的未知量,后续求解约束方程时需保证该项尽量小。
S607、终端根据各个约束项以及各个约束项对应的权重系数,获得各区域分别对应的位移矩阵。
S608、终端根据各区域分别对应的初始图像矩阵和位移矩阵,通过颜色映射获得第二校正图像并输出。
有关S607-S608的内容可参考图9实施例S506-S507的描述,为了说明书简洁,这里不再赘述。由于本实施例的第一校正图像为矩形图像,所以经过S608获得的第二校正图像同样为矩形图像,后续不需要再对第二校正图像剪裁就可输出。
可以看到,本申请实施例中,终端对光学畸变校正获得异形图像,对该异形图像裁剪为矩形图像,在该矩形图像的基础上分区域(包括头部区域,身体区域,背景区域和视场边缘区域)进行算法约束校正处理,其中,对人像的头部区域和身体区域分别基于不同的投影算法进行形状校正,并分别设置独立的约束项优化求解,确保人像得到最好的校正。对背景区域,通过约束背景像素点与其控制域点在变换前后的位置关系,确保背景区域的图像内容不会由于前景校正而导致背景扭曲或断层现象。对视场边缘区域,采用内容自适应的边界控制,最大程度地减少裁切带来的内容损失和视场损失问题。所以实施本申请实施例能够确保图像被校正后,人像和背景内容均能自然、连贯、协调,符合人眼视觉习惯,极大提高用户使用体验,具有较大的商业应用价值。
为了更好理解上述方案,下面结合一种实际应用场景进行方案的描述。
参见图17,在一种示例性场景中,以终端为智能手机为例,当用户需要用手机拍照时,用户打开手机中的拍照APP,手机显示面板上呈现拍照APP的显示界面20,拍照APP驱动手机的摄像装置实时采集源图像,并在处理器中将源图像进行光学畸变校正为异形图像,对并异形图像进行剪裁放大,获得矩形形式的第一校正图像,并且在显示界面20中的预览框204显示该第一校正图像。当用户点击显示界面20中的拍摄控件202时,处理器对第一校正图像进行算法约束校正获得矩形形式的第二校正图像,并将该第二校正图像保存,例如保存到相册。这样,当用户点击显示界面20中的图像浏览控件201,手机将切换至相册APP的显示界面30,并且在显示界面30中显示该矩形图像。可以看到,由于手机自动完成了对图像的校正,校正过程基本不被用户感知。对于用户而言,预览框204看到的是矩形图像,且拍摄完就能够及时看到人像效果和背景效果均极佳的矩形图像效果,极大提高了用户使用体验。
需要说明的是,图14和图17所示的应用场景仅用于示例性解释本申请的方案而非限定。事实上,基于本申请的技术思想和技术方案,在实际产品中还可以设计更多的应用呈现方案。
举例来说,参见图18,在又一种示例性场景中,以终端为智能手机为例,当用户需要用手机拍照时,用户打开手机中的拍照APP,手机显示面板上呈现拍照APP的显示界面20,拍 照APP驱动手机的摄像装置实时采集源图像,并且在显示界面20中的预览框204显示该源图像,当用户点击显示界面20中的拍摄控件202时,处理器中将源图像进行光学畸变校正为第一校正图像(第一校正图像可以是异形图像,也可以是经裁剪后的矩形图像,这里以异形图像为例)。处理器对第一校正图像进行算法约束校正获得第二校正图像,并将该第二校正图像裁剪放大为矩形图像进行保存,例如保存到相册。这样,当用户点击显示界面20中的图像浏览控件201,手机将切换至相册APP的显示界面30,并且在显示界面30中显示该矩形图像。可以看到,由于手机同样自动完成了对图像的校正,校正过程基本不被用户感知。对于用户而言,预览框204看到的是矩形图像,且拍摄完就能够及时看到人像效果和背景效果均极佳的矩形图像效果,极大提高了用户使用体验。
上文描述了本申请实施例的相关系统架构和方法,基于相同的申请构思,下面描述本申请实施例的相关装置/设备。
参见图19,图19是本申请实施例提供的一种装置70的结构示意图,该装置70包括光学畸变校正模块701和算法约束校正模块702。在一些实施例中,光学畸变校正模块701和算法约束校正模块702可运行于终端100的处理器110。在又一些实施例中,光学畸变校正模块701和算法约束校正模块702的相关功能可在图3实施例所描述的系统库的图形引擎中实现。其中:
光学畸变校正模块701用于,根据采集的源图像进行光学畸变校正,获得第一校正图像;所述第一校正图像包括具有拉伸变形的人像和背景区域,所述拉伸变形的人像至少包括拉伸变形的第一人体区域和拉伸变形的第二人体区域;
算法约束校正模块702用于,分别对所述第一人体区域、所述第二人体区域和所述背景区域进行处理,获得第二校正图像;其中,所述第二校正图像中的人像的第一人体区域和第二人体区域分别基于不同的算法呈现不同变形量,使得所述第一人体区域和所述第二人体区域的拉伸变形分别得到校正,所述第二校正图像的背景区域中贯穿所述人像的图像内容在人眼视觉上无断层。
光学畸变校正模块701和算法约束校正模块702具体可用于实现如图7、图9、或图15实施例中所示的终端中的相关方法步骤,为了说明书的简洁,这里不再赘述。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个 单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
本邻域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取器(英文:Random Access Memory,简称:RAM)、磁盘或光盘等。
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本邻域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上上述,本说明书内容不应理解为对本申请的限制。

Claims (35)

  1. 一种图像畸变校正方法,其特征在于,所述方法包括:
    对采集的源图像进行光学畸变校正,获得第一校正图像;所述第一校正图像包括背景区域和具有拉伸变形的人像,所述拉伸变形的人像至少包括拉伸变形的第一人体区域和拉伸变形的第二人体区域;
    对所述第一人体区域、所述第二人体区域和所述背景区域进行算法约束校正,获得第二校正图像;其中,所述算法约束校正采用的约束项分别约束所述第一人体区域、第二人体区域以及所述背景区域。
  2. 根据权利要求1所述的方法,其特征在于,所述第一校正图像还包括视场边缘区域;
    所述对所述第一人体区域、所述第二人体区域和所述背景区域进行算法约束校正,获得第二校正图像,包括:
    对所述第一人体区域、所述第二人体区域、所述背景区域和所述视场边缘区域进行算法约束校正,获得所述第二校正图像。
  3. 根据权利要求2所述的方法,其特征在于,所述第一人体区域包括所述人像的头部区域,所述第二人体区域包括所述人像的身体区域。
  4. 根据权利要求3所述的方法,其特征在于,所述对所述第一人体区域、所述第二人体区域、所述背景区域和所述视场边缘区域进行算法约束校正,获得所述第二校正图像,包括:
    构建所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的约束项;
    构建用于所述第一校正图像的正则约束项;
    根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的约束项和所述正则约束项,获得所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵;
    根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的初始图像矩阵和所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵,通过颜色映射获得所述第二校正图像。
  5. 根据权利要求4所述的方法,其特征在于,所述根据所述对应的初始图像矩阵和所述对应的位移矩阵,通过颜色映射获得所述第二校正图像,包括:
    根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的初始图像矩阵和所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵,获得所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的目标图像矩阵;
    根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的目标 图像矩阵,和,所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的颜色矩阵,获得所述第二校正图像。
  6. 根据权利要求4或5所述的方法,其特征在于,所述头部区域对应的约束项用于:
    约束所述头部区域对应的目标图像矩阵逼近为对第一图像矩阵进行几何变换后的图像矩阵,以校正所述头部区域出现的拉伸变形;其中,所述第一图像矩阵是对所述头部区域对应的初始图像矩阵用球面投影算法处理得到的,所述几何变换包括图像旋转、图像平移和图像缩放中的至少一种。
  7. 根据权利要求4-6任一项所述的方法,其特征在于,所述身体区域对应的约束项用于:
    约束所述身体区域对应的目标图像矩阵逼近为对第二图像矩阵进行几何变换后的图像矩阵,以校正所述身体区域出现的拉伸变形;其中,所述第二图像矩阵是对所述身体区域对应的初始图像矩阵用墨卡托投影算法处理得到的,所述几何变换包括图像旋转、图像平移和图像缩放中的至少一种。
  8. 根据权利要求4-7任一项所述的方法,其特征在于,所述背景区域对应的约束项用于:
    约束所述背景区域对应的初始图像矩阵中的像素点发生位移,且位移前所述像素点对应的第一向量和位移后所述像素点对应的第二向量保持平行;其中,所述第一向量表示位移前所述像素点与位移前所述像素点对应的邻域像素点之间的向量;所述第二向量表示位移后所述像素点与位移后所述像素点对应的邻域像素点之间的向量。
  9. 根据权利要求4-8任一项所述的方法,其特征在于,所述正则约束项用于:
    约束所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵中的任意两个位移矩阵的差值小于预设阈值。
  10. 根据权利要求4-9任一项所述的方法,其特征在于,所述视场边缘区域对应的约束项用于:
    约束所述视场边缘区域对应的初始图像矩阵中的像素点沿着所述第一校正图像的边缘发生位移。
  11. 根据权利要求4-10任一项所述的方法,其特征在于,所述视场边缘区域对应的约束项用于:
    约束所述视场边缘区域对应的初始图像矩阵中的像素点向所述第一校正图像的外侧发生位移。
  12. 根据权利要求1-11任一项所述的方法,其特征在于,所述第一校正图像为非矩形图像;
    所述获得第二校正图像之后,还包括:
    对所述第二校正图像进行裁剪,获得矩形图像。
  13. 根据权利要求1-11任一项所述的方法,其特征在于,所述对采集的源图像进行光学畸变校正,获得第一校正图像,包括:
    对采集的源图像进行光学畸变校正,获得非矩形图像;
    将所述非矩形图像裁剪成为矩形图像,所述第一校正图像为所述矩形图像。
  14. 根据权利要求1-13任一项所述的方法,其特征在于,
    所述第一人体区域所占图像面积和所述第一人体区域的约束项对应的权重系数正相关;
    所述第二人体区域所占图像面积和所述第二人体区域的约束项对应的权重系数正相关。
  15. 根据权利要求1-14任一项所述的方法,其特征在于,
    所述第一人体区域的视场角和所述第一人体区域的约束项对应的权重系数正相关;
    所述第二人体区域的视场角和所述第二人体区域的约束项对应的权重系数正相关。
  16. 根据权利要求1-15任一项所述的方法,其特征在于,
    所述背景区域的纹理显著性和所述背景区域的约束项对应的权重系数正相关。
  17. 根据权利要求1-16任一项所述的方法,其特征在于,
    所述视场边缘区域存在人像内容时所述视场边缘区域的约束项对应的权重系数,大于所述视场边缘区域不存在人像内容时所述视场边缘区域的约束项对应的权重系数。
  18. 一种装置,其特征在于,所述装置包括:
    光学畸变校正模块,用于对采集的源图像进行光学畸变校正,获得第一校正图像;所述第一校正图像包括背景区域和具有拉伸变形的人像,所述拉伸变形的人像至少包括拉伸变形的第一人体区域和拉伸变形的第二人体区域;
    算法约束校正模块,用于对所述第一人体区域、所述第二人体区域和所述背景区域进行算法约束校正,获得第二校正图像;其中,所述算法约束校正采用的约束项分别约束所述第一人体区域、第二人体区域以及所述背景区域。
  19. 根据权利要求18所述的装置,其特征在于,所述第一校正图像还包括视场边缘区域;
    所述算法约束校正模块还用于,对所述第一人体区域、所述第二人体区域、所述背景区域和所述视场边缘区域进行算法约束校正,获得所述第二校正图像。
  20. 根据权利要求19所述的装置,其特征在于,所述第一人体区域包括所述人像的头部区域,所述第二人体区域包括所述人像的身体区域。
  21. 根据权利要求20所述的装置,其特征在于,所述算法约束校正模块具体用于:
    构建所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的约束项;
    构建用于所述第一校正图像的正则约束项;
    根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的约束项和所述正则约束项,获得所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵;
    根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的初始图像矩阵和所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵,通过颜色映射获得所述第二校正图像。
  22. 根据权利要求21所述的装置,其特征在于,所述算法约束校正模块具体用于:
    根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的初始图像矩阵和所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵,获得所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的目标图像矩阵;
    根据所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的目标图像矩阵,和,所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的颜色矩阵,获得所述第二校正图像。
  23. 根据权利要求21或22所述的装置,其特征在于,所述头部区域对应的约束项用于:
    约束所述头部区域对应的目标图像矩阵逼近为对第一图像矩阵进行几何变换后的图像矩阵,以校正所述头部区域出现的拉伸变形;其中,所述第一图像矩阵是对所述头部区域对应的初始图像矩阵用球面投影算法处理得到的,所述几何变换包括图像旋转、图像平移和图像缩放中的至少一种。
  24. 根据权利要求21-23任一项所述的装置,其特征在于,所述身体区域对应的约束项用于:
    约束所述身体区域对应的目标图像矩阵逼近为对第二图像矩阵进行几何变换后的图像矩阵,以校正所述身体区域出现的拉伸变形;其中,所述第二图像矩阵是对所述身体区域对应的初始图像矩阵用墨卡托投影算法处理得到的,所述几何变换包括图像旋转、图像平移和图像缩放中的至少一种。
  25. 根据权利要求21-24任一项所述的装置,其特征在于,所述背景区域对应的约束项 用于:
    约束所述背景区域对应的初始图像矩阵中的像素点发生位移,且位移前所述像素点对应的第一向量和位移后所述像素点对应的第二向量保持平行;其中,所述第一向量表示位移前所述像素点与位移前所述像素点对应的邻域像素点之间的向量;所述第二向量表示位移后所述像素点与位移后所述像素点对应的邻域像素点之间的向量。
  26. 根据权利要求21-25任一项所述的装置,其特征在于,所述正则约束项用于:
    约束所述头部区域、所述身体区域、所述背景区域和所述视场边缘区域分别对应的位移矩阵中的任意两个位移矩阵的差值小于预设阈值。
  27. 根据权利要求21-26任一项所述的装置,其特征在于,所述视场边缘区域对应的约束项用于:
    约束所述视场边缘区域对应的初始图像矩阵中的像素点沿着所述第一校正图像的边缘发生位移。
  28. 根据权利要求21-27任一项所述的装置,其特征在于,所述视场边缘区域对应的约束项用于:
    约束所述视场边缘区域对应的初始图像矩阵中的像素点向所述第一校正图像的外侧发生位移。
  29. 根据权利要求18-28任一项所述的装置,其特征在于,所述第一校正图像为非矩形图像;
    所述算法约束校正模块还用于,对所述第二校正图像进行裁剪,获得矩形图像。
  30. 根据权利要求18-28任一项所述的装置,其特征在于,所述光学畸变校正模块具体用于:
    对采集的源图像进行光学畸变校正,获得非矩形图像;
    将所述非矩形图像裁剪成为矩形图像,所述第一校正图像为所述矩形图像。
  31. 根据权利要求18-30任一项所述的装置,其特征在于,
    所述第一人体区域所占图像面积和所述第一人体区域的约束项对应的权重系数正相关;
    所述第二人体区域所占图像面积和所述第二人体区域的约束项对应的权重系数正相关。
  32. 根据权利要求18-31任一项所述的装置,其特征在于,
    所述第一人体区域的视场角和所述第一人体区域的约束项对应的权重系数正相关;
    所述第二人体区域的视场角和所述第二人体区域的约束项对应的权重系数正相关。
  33. 根据权利要求18-32任一项所述的装置,其特征在于,
    所述背景区域的纹理显著性和所述背景区域的约束项对应的权重系数正相关。
  34. 根据权利要求18-33任一项所述的装置,其特征在于,
    所述视场边缘区域存在人像内容时所述视场边缘区域的约束项对应的权重系数,大于所述视场边缘区域不存在人像内容时所述视场边缘区域的约束项对应的权重系数。
  35. 一种终端设备,其特征在于,包括:至少一个处理器和存储器;所述处理器和所述存储器通过总线连接或者耦合在一起;所述存储器用于存储一个或多个计算机程序,所述一个或多个计算机程序包括指令;所述处理器用于执行所述一个或多个计算机程序以实现如权利要求1-17的任一项所描述的方法。
PCT/CN2020/114400 2019-09-18 2020-09-10 图像畸变校正方法及装置 WO2021052236A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP20864788.3A EP4024325A4 (en) 2019-09-18 2020-09-10 METHOD AND DEVICE FOR CORRECTING IMAGE DISTORTION
US17/698,650 US20220207747A1 (en) 2019-09-18 2022-03-18 Image Distortion Correction Method and Apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910896549.6 2019-09-18
CN201910896549.6A CN112529784B (zh) 2019-09-18 2019-09-18 图像畸变校正方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/698,650 Continuation US20220207747A1 (en) 2019-09-18 2022-03-18 Image Distortion Correction Method and Apparatus

Publications (1)

Publication Number Publication Date
WO2021052236A1 true WO2021052236A1 (zh) 2021-03-25

Family

ID=74884501

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/114400 WO2021052236A1 (zh) 2019-09-18 2020-09-10 图像畸变校正方法及装置

Country Status (4)

Country Link
US (1) US20220207747A1 (zh)
EP (1) EP4024325A4 (zh)
CN (1) CN112529784B (zh)
WO (1) WO2021052236A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115601738A (zh) * 2022-09-23 2023-01-13 北京精英路通科技有限公司(Cn) 停车信息获取方法、装置、设备、存储介质及程序产品

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11720999B2 (en) * 2019-10-11 2023-08-08 Kayrros Method, device and non-transitory computer-readable storage medium for increasing the resolution and dynamic range of a sequence of respective top view images of a same terrestrial location
CN113034351A (zh) * 2021-03-25 2021-06-25 联想(北京)有限公司 图像处理方法及装置
US11756171B1 (en) * 2021-07-07 2023-09-12 Gopro, Inc. Systems and methods for increasing image fidelity
CN113487508B (zh) * 2021-07-08 2024-03-26 山东志盈医学科技有限公司 数字切片扫描仪的图片清晰度动态调整的方法和装置
CN113628229B (zh) * 2021-08-04 2022-12-09 展讯通信(上海)有限公司 图像裁剪方法及相关产品
WO2023023960A1 (zh) * 2021-08-24 2023-03-02 深圳市大疆创新科技有限公司 图像处理及神经网络的训练方法和装置
CN115358497B (zh) * 2022-10-24 2023-03-10 湖南长理尚洋科技有限公司 基于gis技术的智慧全景巡河方法及系统

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103996172A (zh) * 2014-05-08 2014-08-20 东北大学 一种基于多步校正的鱼眼图像校正方法
CN105046657A (zh) * 2015-06-23 2015-11-11 浙江大学 一种图像拉伸畸变自适应校正方法
CN107506693A (zh) * 2017-07-24 2017-12-22 深圳市智美达科技股份有限公司 畸变人脸图像校正方法、装置、计算机设备和存储介质
CN107665477A (zh) * 2016-07-28 2018-02-06 三星电子株式会社 电子设备和控制电子设备的方法
CN108986172A (zh) * 2018-07-25 2018-12-11 西北工业大学 一种面向小景深系统的单视图线性摄像机标定方法
CN109961401A (zh) * 2017-12-14 2019-07-02 西安全志科技有限公司 一种双目相机的图像校正方法和存储介质
JP2019125269A (ja) * 2018-01-18 2019-07-25 Kddi株式会社 前景背景分離に好適な方法および装置

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101820550B (zh) * 2009-02-26 2011-11-23 华为终端有限公司 多视点视频图像校正方法、装置及系统
US9041734B2 (en) * 2011-07-12 2015-05-26 Amazon Technologies, Inc. Simulating three-dimensional features
CN103247024A (zh) * 2012-02-03 2013-08-14 苏州科泽数字技术有限公司 一种基于同心圆算法的180度鱼眼图像展开方法和装置
US9881203B2 (en) * 2013-08-29 2018-01-30 Nec Corporation Image processing device, image processing method, and program
KR20150037091A (ko) * 2013-09-30 2015-04-08 삼성전자주식회사 영상처리장치 및 그 제어방법
CN104517292A (zh) * 2014-12-25 2015-04-15 杭州电子科技大学 基于平面单应矩阵约束的多摄像机高密度人群分割方法
US9514524B2 (en) * 2015-02-27 2016-12-06 Sony Corporation Optical distortion compensation
KR102290301B1 (ko) * 2015-05-06 2021-08-17 엘지전자 주식회사 이동 단말기 및 이의 제어방법
CN106228510B (zh) * 2016-08-11 2019-01-29 中国电子科技集团公司第三十八研究所 基于畸变程度分割的无人机载实时sar图像配准方法
CN107481267A (zh) * 2017-08-14 2017-12-15 华南理工大学 一种基于双目视觉的摄像投影交互系统及方法
CN108133487A (zh) * 2017-12-04 2018-06-08 王连圭 视频跨区域单人体姿态目标检测提取方法
CN108335350A (zh) * 2018-02-06 2018-07-27 聊城大学 双目立体视觉的三维重建方法
US20190251675A1 (en) * 2018-02-09 2019-08-15 Megvii Technology Llc Image processing method, image processing device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103996172A (zh) * 2014-05-08 2014-08-20 东北大学 一种基于多步校正的鱼眼图像校正方法
CN105046657A (zh) * 2015-06-23 2015-11-11 浙江大学 一种图像拉伸畸变自适应校正方法
CN107665477A (zh) * 2016-07-28 2018-02-06 三星电子株式会社 电子设备和控制电子设备的方法
CN107506693A (zh) * 2017-07-24 2017-12-22 深圳市智美达科技股份有限公司 畸变人脸图像校正方法、装置、计算机设备和存储介质
CN109961401A (zh) * 2017-12-14 2019-07-02 西安全志科技有限公司 一种双目相机的图像校正方法和存储介质
JP2019125269A (ja) * 2018-01-18 2019-07-25 Kddi株式会社 前景背景分離に好適な方法および装置
CN108986172A (zh) * 2018-07-25 2018-12-11 西北工业大学 一种面向小景深系统的单视图线性摄像机标定方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4024325A4

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115601738A (zh) * 2022-09-23 2023-01-13 北京精英路通科技有限公司(Cn) 停车信息获取方法、装置、设备、存储介质及程序产品
CN115601738B (zh) * 2022-09-23 2023-08-04 北京精英路通科技有限公司 停车信息获取方法、装置、设备、存储介质及程序产品

Also Published As

Publication number Publication date
CN112529784B (zh) 2024-05-28
EP4024325A1 (en) 2022-07-06
CN112529784A (zh) 2021-03-19
EP4024325A4 (en) 2023-01-04
US20220207747A1 (en) 2022-06-30

Similar Documents

Publication Publication Date Title
WO2021052236A1 (zh) 图像畸变校正方法及装置
WO2021078001A1 (zh) 一种图像增强方法及装置
EP4156082A1 (en) Image transformation method and apparatus
CN113099146B (zh) 一种视频生成方法、装置及相关设备
US20200167896A1 (en) Image processing method and device, display device and virtual reality display system
CN113452969B (zh) 图像处理方法和装置
WO2024021742A1 (zh) 一种注视点估计方法及相关设备
US20230224574A1 (en) Photographing method and apparatus
WO2023093169A1 (zh) 拍摄的方法和电子设备
CN114782296B (zh) 图像融合方法、装置及存储介质
KR20210049649A (ko) 얼굴 이미지를 강화하는 방법 및 장치, 전자 기기
CN115689963A (zh) 一种图像处理方法及电子设备
WO2021185374A1 (zh) 一种拍摄图像的方法及电子设备
US20230353864A1 (en) Photographing method and apparatus for intelligent framing recommendation
US20230014272A1 (en) Image processing method and apparatus
CN113850709A (zh) 图像变换方法和装置
WO2022206589A1 (zh) 一种图像处理方法以及相关设备
WO2021227988A1 (zh) 人脸图像处理方法、装置、设备及计算机可读存储介质
CN115587938A (zh) 视频畸变校正方法及相关设备
CN114693538A (zh) 一种图像处理方法及装置
CN115988339B (zh) 图像处理方法、电子设备、存储介质及程序产品
EP4395353A1 (en) Filming method and electronic device
CN117689545A (zh) 图像处理方法、电子设备和计算机可读存储介质
CN117710261A (zh) 图像处理方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20864788

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2020864788

Country of ref document: EP

Effective date: 20220330