Portrait proportion stretching method and device, equipment, storage medium and product

By loading a preset sparse mapping table into the image processing unit, non-linear stretching of wide-angle camera images is performed, solving the hardware resource dependency problem in traditional methods, realizing portrait proportion correction under wide-angle lenses, and improving visual realism and image quality.

CN121746256APending Publication Date: 2026-03-27VALUEHD CORP
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-02
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Traditional affine transformations are insufficient to fully correct nonlinear distortions in wide-angle lenses, requiring additional hardware resources for joint optimization.

Method used

By using a preset sparse mapping table loaded in the image processing unit, each pixel in the original image captured by the wide-angle camera is non-linearly stretched to generate the target position after the portrait ratio is stretched. Custom design is carried out using the specific parameters of the wide-angle camera to achieve non-linear stretching in different directions.

Benefits of technology

Without relying on additional hardware resources, non-linear stretching of wide-angle camera images was achieved, improving visual realism and geometric accuracy while reducing power consumption and latency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121746256A_ABST
    Figure CN121746256A_ABST
Patent Text Reader

Abstract

The invention discloses a portrait proportion stretching method and device, equipment, a storage medium and a product, and relates to the technical field of image processing, and the portrait proportion stretching method comprises the steps: obtaining an original image shot by a wide-angle camera; the initial position of each pixel in the original image is mapped through a preset sparse mapping table loaded in an image processing unit to obtain a target position after portrait proportional stretching, an output image is determined based on the target position, the preset sparse mapping table is determined based on the wide-angle camera, and the preset sparse mapping table is determined based on the wide-angle camera. The preset sparse mapping table is used for performing nonlinear stretching on the original image in different directions. According to the method and the device, non-linear stretching of the original image in different directions can be realized without additional hardware resources.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a portrait scale stretching method, device, equipment, storage medium and product. BACKGROUND

[0002] Due to perspective distortion, the proportion of the character is distorted, especially under wide-angle lens, the part of the character close to the edge of the picture is stretched and enlarged, and the center area is relatively compressed, which affects the visual reality. Traditional affine transformation is difficult to completely correct the non-linear distortion, and needs to be combined with camera calibration parameters and depth estimation for joint optimization, which needs to rely on additional hardware resources. SUMMARY

[0003] The main purpose of the present application is to provide a portrait scale stretching method, device, equipment, storage medium and product, which aims to solve the technical problem of correcting non-linear distortion and relying on additional hardware resources.

[0004] To achieve the above purpose, the present application provides a portrait scale stretching method, which comprises:

[0005] obtaining an original image captured by a wide-angle camera; mapping the initial position of each pixel in the original image to obtain a target position after portrait scale stretching through a preset sparse mapping table loaded in the image processing unit, and determining an output image based on the target position, wherein the preset sparse mapping table is determined based on the wide-angle camera, and the preset sparse mapping table is used for non-linear stretching in different directions of the original image.

[0006] In an embodiment, the step of obtaining an original image captured by a wide-angle camera comprises: obtaining a single mapping table for distortion elimination; non-linearly stretching the single mapping table in different directions to obtain a composite mapping table; non-uniformly sampling the composite mapping table to obtain a preset sparse mapping table.

[0007] In an embodiment, the step of non-linearly stretching the single mapping table in different directions to obtain a composite mapping table comprises: obtaining a target resolution of the output image, and determining the pixel coordinates of each pixel in the output image based on the target resolution; calculating the offset of the pixel coordinates compared to the center coordinates of the output image; non-linearly stretching the single mapping table in different directions based on the offset, the center coordinates and the pixel coordinates to obtain a composite mapping table.

[0008] In one embodiment, the offset includes a horizontal offset, the different directions include a preset first direction and a preset second direction, and the step of performing nonlinear stretching of the single mapping table in different directions based on the offset, the center coordinates, and the pixel coordinates to obtain a composite mapping table includes: Obtain the first stretch factor in the preset first direction and the second stretch factor in the preset second direction; Based on the first stretching factor, the pixel coordinates, the center coordinates, and the horizontal offset, the single mapping table is subjected to nonlinear stretching in the preset first direction to obtain an initial composite mapping table, wherein the stretching intensity of the nonlinear stretching in the preset first direction is positively correlated with the distance from the center coordinates. Based on the second stretching factor, the pixel coordinates, and the center coordinates, the initial composite mapping table is subjected to nonlinear stretching in the preset second direction to obtain a composite mapping table, wherein the nonlinear stretching in the preset second direction is used to enhance the vertical visual extension of the image.

[0009] In one embodiment, the step of performing nonlinear stretching of the single mapping table in a preset first direction based on the first stretching factor, the pixel coordinates, the center coordinates, and the horizontal offset to obtain an initial composite mapping table includes: The stretching gain is determined based on the center coordinates in the first coordinates of the preset first direction, the pixel coordinates, and the horizontal offset. Based on the stretching gain and the horizontal offset, a first stretching offset is determined; Using the first coordinate as a reference point and based on the first stretching offset, the single mapping table is subjected to nonlinear stretching in the preset first direction to obtain an initial composite mapping table.

[0010] In one embodiment, the step of performing nonlinear stretching in the preset second direction on the initial composite mapping table based on the second stretching factor and the center coordinates to obtain the composite mapping table includes: Based on the pixel coordinates and the second stretching factor, a second stretching offset is determined, wherein the stretching direction of the second stretching offset is opposite in different preset regions of the original image. Using the center coordinates at the second coordinates in the preset second direction as a reference point, and based on the second stretching offset, the initial composite mapping table is nonlinearly stretched in the preset second direction to obtain the composite mapping table.

[0011] Furthermore, to achieve the above objectives, this application also proposes a portrait scaling device, which includes: The acquisition module is used to acquire the raw images captured by the wide-angle camera; The stretching module is used to map the initial position of each pixel in the original image to the target position after portrait scaling by using a preset sparse mapping table loaded in the image processing unit, and to determine the output image based on the target position. The preset sparse mapping table is determined based on the wide-angle camera and is used to perform nonlinear stretching of the original image in different directions.

[0012] In addition, to achieve the above objectives, this application also proposes a portrait proportioning stretching device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the portrait proportioning stretching method as described above.

[0013] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the portrait scaling method described above.

[0014] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the portrait scaling method described above.

[0015] One or more technical solutions proposed in this application have at least the following technical effects: Compared to traditional affine transformations, which struggle to fully correct nonlinear distortions and require joint optimization combining camera calibration parameters and depth estimation, necessitating additional hardware resources, this application acquires the original image captured by a wide-angle camera. Using a preset sparse mapping table loaded in the image processing unit, the initial position of each pixel in the original image is mapped to the target position after portrait scaling. Based on the target position, the output image is determined. The preset sparse mapping table is determined based on the wide-angle camera and is used to perform nonlinear scaling of the original image in different directions. After acquiring the original image captured by the wide-angle camera, this application directly maps the initial position of each element in the original image to the target position after portrait scaling using a preset sparse mapping table determined by the wide-angle camera loaded in the image processing unit, achieving nonlinear scaling of the original image in different directions without requiring additional hardware resources. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart illustrating the applicant's proportional stretching method in Embodiment 1; Figure 2 A flowchart for constructing a pre-defined sparse mapping table for the applicant's image scaling method; Figure 3 A flowchart illustrating the applicant's proportional stretching method in Embodiment 2; Figure 4 This is a schematic diagram of the module structure of the portrait scaling device according to an embodiment of this application; Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the portrait scaling method in this application embodiment.

[0019] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0020] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0021] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0022] The main solution of this application embodiment is: to acquire the original image captured by the wide-angle camera; to map the initial position of each pixel in the original image to the target position after portrait scaling by using a preset sparse mapping table loaded in the image processing unit; and to determine the output image based on the target position. The preset sparse mapping table is determined based on the wide-angle camera and is used to perform nonlinear scaling of the original image in different directions.

[0023] Traditional affine transformations are difficult to completely correct nonlinear distortions and require joint optimization by combining camera calibration parameters and depth estimation, which relies on additional hardware resources.

[0024] After acquiring the original image captured by the wide-angle camera, this application uses a preset sparse mapping table determined by the wide-angle camera and loaded in the image processing unit to directly map the initial position of each element in the original image to the target position after the portrait is stretched. This achieves non-linear stretching of the original image in different directions without the need for additional hardware resources.

[0025] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or portrait scaling device capable of performing the above functions. The following description uses a portrait scaling device as an example to illustrate this embodiment and the subsequent embodiments.

[0026] Based on this, the embodiments of this application provide a method for portrait proportion stretching, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the applicant's image scaling method.

[0027] In this embodiment, the portrait scaling method includes steps S10 to S20: Step S10: Acquire the original image captured by the wide-angle camera; It should be noted that the execution subject in this embodiment is the portrait scaling device. A wide-angle camera refers to an imaging module with a field of view (FOV) greater than 70°, typically used for front-facing video calls or selfies. Its imaging is susceptible to perspective distortion, resulting in proportional distortion such as stretched or expanded limbs at the edges of the image. The original video frame data, without distortion correction and scaling processing by the Image Signal Processor (ISP) built into the Rockchip RK3588 chip, retains the initial state of lens optical distortion and spatial geometric distortion. Since the RK3588's ISP hardware itself has a grid-based geometric distortion correction function, which is usually used to correct radial or tangential distortion of the lens, the portrait proportion stretching function is integrated into the ISP's preset sparse mapping table for distortion elimination. After the portrait proportion stretching device acquires the original image captured by the wide-angle camera, nonlinear stretching logic in the X / Y direction can be embedded while the ISP hardware performs distortion correction. This allows for real-time and natural correction of the proportion of people in the video stream with zero computing power cost. This method effectively overcomes the problems of traditional software-level body shaping algorithms relying on hardware resources such as GPU / NPU and introducing high latency and power consumption. At the same time, it avoids the shortcomings of affine transformation in terms of nonlinear distortion correction capability, and significantly improves the visual coordination and realism of human body contours in wide-angle video scenes.

[0028] Step S20: Using a preset sparse mapping table loaded in the image processing unit, the initial position of each pixel in the original image is mapped to obtain the target position after portrait scaling. Based on the target position, the output image is determined. The preset sparse mapping table is determined based on the wide-angle camera and is used to perform nonlinear scaling of the original image in different directions.

[0029] Understandably, a preset sparse mapping table refers to a set of coordinate transformation relationships pre-calculated and stored based on the optical characteristics of a specific wide-angle camera. Its purpose is to transform the perspective distortion caused by the wide-angle lens in the original image into a target image that conforms to human visual habits. This mapping table is customized based on the specific parameters of the wide-angle camera (such as focal length, field of view, etc.) to adapt to the unique distortion patterns of different camera models. The portrait scaling device uses the preset sparse mapping table stored in the ISP hardware to apply different scaling strategies in the X and Y axes to the initial position of each pixel in the original image to obtain the target position after portrait scaling, so as to more accurately restore the true shape and proportion of the object.

[0030] In one possible implementation, the following steps are included prior to step S10: Obtain a single mapping table for distortion reduction; It should be noted that a single mapping table refers to the basic coordinate mapping relationship used to correct optical distortions (such as barrel distortion) in wide-angle cameras, and only compensates for geometric distortions. The portrait scaling device obtains the single mapping table for distortion reduction originally stored in the ISP module of the RK3588 chip.

[0031] Specifically, refer to Figure 2 , Figure 2 A flowchart for constructing a pre-defined sparse mapping table is provided. Figure 2In this context, "mesh" refers to a pre-defined sparse mapping table. The portrait scaling device uses a front-facing camera to acquire multiple frames of a checkerboard calibration board image under controlled conditions. These images must cover the entire field of view, especially including the edges and corners, to ensure accurate reflection of lens distortion characteristics. The acquisition process is typically performed under stable lighting to avoid reflections or blurring affecting corner detection accuracy. A specialized fisheye camera calibration algorithm is then used to process the acquired checkerboard image sequence. First, it automatically identifies the positions of all corner points in each checkerboard grid in each image. Then, it uses the two-dimensional coordinates of these corner points in the image to... Based on the known correspondence of three-dimensional coordinates in the real world, a nonlinear optimization problem is constructed. Through iterative solution, the algorithm finally outputs a set of camera intrinsic parameters (including focal length, principal point, etc.) and four fisheye distortion coefficients. After obtaining the intrinsic parameters and distortion parameters, the algorithm traverses the position of each pixel in the target output image (e.g., 1920×1080 resolution) and, based on the aforementioned calibration parameters, calculates the precise coordinates that the pixel should be sampled in the original fisheye image. This results in the inverse mapping function from the ideal distortion-free image to the original distortion image, i.e., a single mapping table.

[0032] By performing nonlinear stretching in different directions on the single mapping table, a composite mapping table is obtained; It is understandable that a composite mapping table refers to a fused coordinate transformation table generated by superimposing nonlinear stretching logic onto a single mapping table. It simultaneously incorporates the dual functions of distortion correction and portrait proportion optimization, and can be directly used for image remapping processing. The portrait proportion stretching device constructs a composite mapping table suitable for wide-angle portrait scenes by introducing a nonlinear stretching strategy on top of a single mapping table. By fusing the two types of mapping operations at the mapping table level, it not only simplifies the ISP pipeline structure but also ensures the consistency of geometric accuracy and visual naturalness in the final output image. Especially in high frame rate video stream processing, this composite mapping table can be directly loaded and executed by hardware, achieving real-time portrait optimization with low power consumption and zero additional computing power overhead.

[0033] Non-uniform sampling is performed on the composite mapping table to obtain a preset sparse mapping table.

[0034] It should be noted that the preset sparse mapping table refers to a lightweight mapping table generated after non-uniform sampling. It only stores the coordinate offset information of some key control points, and the remaining positions are reconstructed in real time through interpolation (such as bilinear or bicubic interpolation). Since the composite mapping table exists in the form of a high-density grid (such as one control point per pixel or every several pixels), the data volume is large. Therefore, the portrait scaling device retains a higher sampling density in areas where the portrait appears frequently, and reduces the sampling density in background edges or low-sensitivity areas, based on the difference in importance of image regions. This significantly compresses the table size while ensuring the mapping accuracy of key areas.

[0035] Optionally, after the dense mapping table is generated, the portrait scaling device can also perform spatial gradient analysis on it. Specifically, it iterates through each position in the table and calculates the rate of change of coordinates of its adjacent pixels in the horizontal and vertical directions, thus obtaining two gradient components: one reflecting the intensity of the change in the X-direction coordinate, and the other reflecting the intensity of the change in the Y-direction. These two components are combined to form a "deformation intensity heatmap," where the higher the value, the more complex the geometric transformation and the stronger the nonlinearity of the region. For example, when the user is in profile, the area near the jawline shows a high gradient value due to the abrupt change in the stretching direction, while the forehead area has a lower gradient due to the gentler change.

[0036] Optionally, in addition to storing a preset sparse mapping table, the ISP's register can also store a visual sensitivity weight map. This map is generated based on a large amount of psychological visual experimental data and is perfectly aligned with the output image size. Each pixel position is assigned a weight value between 0 and 1. Since the human eye is extremely sensitive to facial contours and distortions around the eyes, but has a higher tolerance for hair edges and clothing textures, highly sensitive areas (such as eyes, nose, corners of the mouth, and jaw contours) are marked with high weights; less sensitive areas such as cheeks and forehead are given medium weights; and low-attention areas such as hair edges, collars, and backgrounds are given low weights.

[0037] Furthermore, the portrait scaling device uses the face bounding box output in real time by a lightweight face detector to generate a binary portrait semantic mask, marking "high probability of containing portraits" in the image. This mask is then logically ANDed with the deformation intensity heatmap obtained through spatial gradient analysis, retaining only the regions that "contain both portraits and exhibit high nonlinear deformation" as key correction areas. Within the key correction areas, the deformation gradient magnitude is multiplied pixel by pixel with the visual sensitivity weight map to obtain a comprehensive importance score map. Based on the comprehensive importance score map, an exponential decay function is used to dynamically allocate local sampling density. Traditional sparse mapping tables typically use fixed grids or radial density distributions, which cannot distinguish the visual importance differences between "portrait edge distortion" and "background distortion". This step is the first to couple real-time human image semantic information with deformation physical characteristics, increasing the sampling density only in the intersection of "human eye attention + severe distortion", avoiding redundant high-precision correction of pure background areas (such as corners and sky), maintaining the natural proportions of the human image, further compressing the mapping table volume by more than 15% (compared to methods that only use sensitivity maps or gradient maps), and preventing background textures from producing artifacts due to excessive interpolation.

[0038] Furthermore, the exponential decay function is defined based on the distance from the center point of the critical region. This function gradually decreases the sampling density as the distance increases. The device applies the exponential decay function to each pixel on the overall importance score map to determine the sampling density at that point. Pixels closer to the critical region will receive a higher sampling density, while those farther away will receive a correspondingly lower density.

[0039] Furthermore, the preset sparse mapping table obtained through non-uniform sampling is loaded into the LUT (lookup table) register of the RK3588 ISP. For each target pixel in the output image, if it falls into a high-density region, bicubic interpolation is used to reconstruct the accurate source coordinates from the sparse control points. If it falls into a low-density region, fast bilinear interpolation is used. In the medium-density transition region, a perceptual smoothing factor is introduced to perform hybrid interpolation.

[0040] Specifically, the perceptual smoothing factor dynamically adjusts the interpolation algorithm weights based on visual sensitivity, ensuring high-fidelity interpolation in highly sensitive areas and saving computation in low-sensitivity areas. Two-stage interpolation dynamically switches interpolation strategies based on regional importance, balancing accuracy and efficiency.

[0041] Because wide-angle lenses produce asymmetric distortion at extremely close distances (<40cm) (e.g., one side of the face is stretched more severely), a single mapping table cannot fully compensate for it. The portrait scaling device obtains the average depth value D of the face region in the current frame from the ToF or dual-camera module. If D < 40cm (close-up selfie), a small reverse displacement compensation is applied along the X direction to the area covered by the portrait mask in the generated output image. This compensation does not modify the mapping table, but rather superimposes the offset in the post-processing register before ISP output to avoid recalculating the mapping. Specifically, after completing the main mapping, a lightweight pixel displacement is applied to a specific area based on the depth information to correct residual perspective errors.

[0042] In this embodiment, by implementing a non-uniform sampling strategy oriented towards human image perception priority on the composite mapping table, the size of the mapping table is compressed to 10% to 25% of the original composite table, which greatly reduces firmware storage usage and ISP memory bandwidth pressure.

[0043] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 The method for stretching human portrait proportions further includes steps S01 to S03: (The step involves performing nonlinear stretching in different directions on the single mapping table to obtain a composite mapping table.) Step S01: Obtain the target resolution of the output image, and determine the pixel coordinates of each pixel in the output image based on the target resolution; It should be noted that the target resolution refers to the desired output image size after image processing. The portrait scaling device determines the pixel coordinates (x, y) of each pixel in the output image in a two-dimensional plane at that target resolution.

[0044] Step S02: Calculate the offset of the pixel coordinates relative to the center coordinates of the output image; It can be understood that the offset refers to the distance of the current pixel coordinates relative to the center point in the horizontal direction (Δcx=width / 2) and the vertical direction (cy=height / 2). Here, width refers to the image width (number of pixels) in the target resolution of the output image, i.e., the horizontal dimension of the "target resolution of the output image" obtained in step S01. Height refers to the image height (number of pixels) in the target resolution of the output image, i.e., the vertical dimension of the "target resolution of the output image" obtained in step S01. The portrait scaling device calculates the offset of each output pixel relative to the image center.

[0045] Step S03: Based on the offset, the center coordinates, and the pixel coordinates, the single mapping table is nonlinearly stretched in different directions to obtain a composite mapping table.

[0046] It should be noted that the portrait scaling device uses the center coordinates as a reference and performs directional nonlinear stretching of the pixel coordinates driven by the pixel offset to obtain a composite mapping table.

[0047] In one feasible implementation, step S03 includes: Obtain the first stretch factor in the preset first direction and the second stretch factor in the preset second direction; Understandably, the preset first direction refers to the primary stretching direction used in image processing to correct portrait proportion distortion, typically the horizontal direction (X-axis). The preset second direction refers to the auxiliary stretching direction orthogonal to the first direction, typically the vertical direction (Y-axis), used for fine-tuning the head-to-body ratio or the longitudinal proportion of the torso. The first stretching factor, strength_x, is a non-linear scaling coefficient acting in the X-direction, which can be set to 0.13 to avoid excessive distortion. The second stretching factor, strength_y, is a non-linear scaling coefficient acting in the Y-direction, which can be set to -0.3, meaning that the central area is slightly compressed on the Y-axis, while the top and bottom edges are relatively expanded, thereby enhancing the visual extension of the image's vertical direction. The portrait proportion stretching device acquires the stretching factors in two orthogonal directions, achieving fine-tuning of portrait proportion distortion.

[0048] Optionally, in addition to storing the preset sparse mapping table, the ISP register can also store a multimodal human image prior template library. This template library can contain preset stretching parameter combinations corresponding to several typical user types (such as adult males, adult females, children, broad-shouldered body types, etc.). Each type of template defines the transverse tensile strength, longitudinal compressive strength, and grid density distribution strategy of highly sensitive areas suitable for that population.

[0049] Specifically, after a raw image frame is output from the sensor, before entering the ISP main processing pipeline, the portrait scaling device first sends it to a lightweight visual analysis unit (which can be executed by a dedicated coprocessor, low-power NPU, or CPU small core) to quickly determine whether a face exists in the image and obtain its bounding box position and scale. If a face is detected, a lightweight keypoint regression network (such as a 5-point or 68-point model) is further run to obtain the geometric features of facial key points such as eye distance, nose tip position, and jaw contour. Then, through the dual cameras or ToF sensor equipped in the device, the depth map is directly read to calculate the average depth value of the face region.

[0050] Furthermore, the facial proportion stretching device matches the current user to the closest prior template category based on the geometric proportions of facial key points (such as the ratio of eye spacing to face width, jaw angle opening, and facial length-to-width ratio). For example, if the eye spacing is narrow, the face is round, and the head-to-body ratio is large, the user is identified as a "child". Once the user type is determined, the device retrieves the default strength_x and strength_y parameters for that category from the prior library. However, human proportions are continuously changing (e.g., a 12-year-old teenager is between a child and an adult), and hard classification can easily lead to boundary jumps. Therefore, if the user's features are between two categories (e.g., a teenager), the parameters of adjacent templates are linearly or weightedly interpolated to generate a more fitting intermediate value.

[0051] Furthermore, the portrait scaling device uses the average depth value (i.e., the distance from the portrait to the lens) as an adjustment factor. If the distance is close (e.g., less than 40 cm), it indicates that the subject is in a high-frequency wide-angle distortion zone. The system automatically increases the absolute value of strength_x (enhancing edge stretching) and moderately adjusts strength_y to compensate for near-field perspective compression. If the distance is far (e.g., greater than 80 cm), the stretching intensity is reduced to avoid the subject appearing flat or distorted due to overcorrection. Finally, a set of dynamically generated stretching parameters adapted to the current scene and the user is output.

[0052] Based on the first stretching factor, the pixel coordinates, the center coordinates, and the horizontal offset, the single mapping table is subjected to nonlinear stretching in the preset first direction to obtain an initial composite mapping table, wherein the stretching intensity of the nonlinear stretching in the preset first direction is positively correlated with the distance from the center coordinates. It should be noted that the portrait scaling device combines the first scaling factor, pixel coordinates, center coordinates, and horizontal offset to obtain an initial composite mapping table, which enables the mapping transformation to accurately respond to the regional patterns of portrait distortion in wide-angle imaging. Due to the human eye's sensitivity to lateral deformation, a piecewise nonlinear mapping function is used to enhance the scaling force in the edge areas of the image and gradually transition towards the center to maintain geometric continuity and avoid image tearing caused by abrupt changes.

[0053] Based on the second stretching factor, the pixel coordinates, and the center coordinates, the initial composite mapping table is subjected to nonlinear stretching in the preset second direction to obtain a composite mapping table, wherein the nonlinear stretching in the preset second direction is used to enhance the vertical visual extension of the image.

[0054] It should be noted that when the portrait scaling device performs image processing, in order to further optimize the image effect, especially to enhance the visual extension of the image in the vertical direction (i.e., the vertical direction, the Y-axis), it can perform a preset second-direction nonlinear stretching on the initial composite mapping table based on the second stretching factor, pixel coordinates and center coordinates to obtain the composite mapping table.

[0055] In one feasible implementation, the step of performing nonlinear stretching of the single mapping table in the preset first direction based on the first stretching factor, the pixel coordinates, the center coordinates, and the horizontal offset to obtain an initial composite mapping table includes: The stretching gain is determined based on the center coordinates in the first coordinates of the preset first direction, the pixel coordinates, and the horizontal offset. Understandably, the first coordinate refers to the coordinate value of the geometric center of the output image on the X-axis, denoted as cx. The stretching gain is a weighting parameter used to adjust the nonlinear stretching intensity in the first direction, controlling the actual effect of the first stretching factor at the current pixel position. The portrait scaling device explicitly correlates the horizontal offset with the center coordinates in the first direction, constructing a spatially aware stretching gain model. Because wide-angle distortion has significant radial symmetry and edge enhancement characteristics on portraits, the stretching gain needs to monotonically increase with distance from the center coordinates to ensure stronger scaling correction in areas further from the center.

[0056] Specifically, the stretching gain is: Where x is the x-coordinate of the current pixel in pixel coordinates.

[0057] Based on the stretching gain and the horizontal offset, a first stretching offset is determined; It should be noted that the first stretch offset refers to the additional displacement that needs to be applied to the original mapped coordinates in the first direction. The portrait scaling device generates a first stretch offset with spatially adaptive characteristics by coupling the stretch gain with the horizontal offset, so that pixels at different horizontal positions in the wide-angle image receive a correction force that matches their degree of distortion.

[0058] Specifically, the first stretch offset is: Using the first coordinate as a reference point and based on the first stretching offset, the single mapping table is subjected to nonlinear stretching in the preset first direction to obtain an initial composite mapping table.

[0059] Understandably, the portrait scaling device uses the first coordinate of the image center as a symmetry reference and precisely injects the spatially adaptive first scaling offset into the X-direction component of a single mapping table to obtain an initial composite mapping table, thereby achieving directional suppression of lateral distortion in wide-angle portraits.

[0060] Specifically, the coordinates in the X direction in the initial composite mapping table are: In one feasible implementation, the step of performing nonlinear stretching in the preset second direction on the initial composite mapping table based on the second stretching factor and the center coordinates to obtain the composite mapping table includes: Based on the pixel coordinates and the second stretching factor, a second stretching offset is determined, wherein the stretching direction of the second stretching offset is opposite in different preset regions of the original image. It should be noted that the preset area divides the original image into two regions: a central region and upper and lower edge regions. In the central region, the proportion of the human figure is slightly compressed, while the upper and lower edge regions are relatively expanded to optimize the overall vertical proportion of the human figure. The human figure stretching device uses a second stretching factor to achieve a second stretching offset in opposite directions in different vertical regions, thus realizing fine-grained control over the vertical structure of the human figure.

[0061] Specifically, the second stretch offset is:

[0062] Where y is the ordinate of the current pixel in the pixel coordinate system.

[0063] Using the center coordinates at the second coordinates in the preset second direction as a reference point, and based on the second stretching offset, the initial composite mapping table is nonlinearly stretched in the preset second direction to obtain the composite mapping table.

[0064] Understandably, the second coordinate refers to the Y-axis coordinate value of the geometric center of the output image, denoted as cy = height / 2. The portrait scaling device uses the second coordinate of the center coordinate as a reference, and precisely injects the second scaling offset, which has regional directional differences, into the Y-axis component of the initial composite mapping table to obtain the composite mapping table.

[0065] Specifically, the Y-axis coordinates in the composite mapping table are:

[0066] In this embodiment, the stretching in the X and Y directions works together to create a more three-dimensional and dynamically balanced deformation effect, which conforms to the human eye's perception of the naturalness of deformation. While maintaining the stability of the central subject, the edge area presents a progressive stretching effect, effectively simulating the optical characteristics of a wide-angle lens.

[0067] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the applicant's image scaling method. Any simple modifications based on this technical concept are within the scope of protection of this application.

[0068] This application also provides a portrait scaling device; please refer to... Figure 4 The portrait scaling device includes: The acquisition module 10 is used to acquire the original image captured by the wide-angle camera; The stretching module 20 is used to map the initial position of each pixel in the original image to the target position after portrait scaling by means of a preset sparse mapping table loaded in the image processing unit, and to determine the output image based on the target position. The preset sparse mapping table is determined based on the wide-angle camera and is used to perform nonlinear stretching of the original image in different directions.

[0069] Optionally, the acquisition module includes: The sampling submodule is used to obtain a single mapping table for distortion elimination; to perform nonlinear stretching of the single mapping table in different directions to obtain a composite mapping table; and to perform non-uniform sampling on the composite mapping table to obtain a preset sparse mapping table.

[0070] Optionally, the sampling submodule includes: A calculation unit is used to obtain the target resolution of the output image, determine the pixel coordinates of each pixel in the output image based on the target resolution, calculate the offset of the pixel coordinates relative to the center coordinates of the output image, and perform nonlinear stretching of the single mapping table in different directions based on the offset, the center coordinates, and the pixel coordinates to obtain a composite mapping table.

[0071] Optionally, the computing unit includes: A stretching subunit is used to obtain a first stretching factor in a preset first direction and a second stretching factor in a preset second direction; based on the first stretching factor, the pixel coordinates, the center coordinates, and the horizontal offset, a single mapping table is nonlinearly stretched in the preset first direction to obtain an initial composite mapping table, wherein the stretching intensity of the nonlinear stretching in the preset first direction is positively correlated with the distance from the center coordinates; based on the second stretching factor, the pixel coordinates, and the center coordinates, the initial composite mapping table is nonlinearly stretched in the preset second direction to obtain a composite mapping table, wherein the nonlinear stretching in the preset second direction is used to enhance the vertical visual extension of the image.

[0072] Optionally, the stretching subunit includes: A first stretching component is configured to determine a stretching gain based on the center coordinates in a first coordinate in a preset first direction, the pixel coordinates, and the horizontal offset; determine a first stretching offset based on the stretching gain and the horizontal offset; and perform nonlinear stretching of the single mapping table in the preset first direction based on the first coordinates and the first stretching offset to obtain an initial composite mapping table.

[0073] The second stretching component determines a second stretching offset based on the pixel coordinates and the second stretching factor, wherein the stretching direction of the second stretching offset is opposite in different preset regions of the original image; taking the second coordinate of the center coordinate in the preset second direction as the reference point, and based on the second stretching offset, the initial composite mapping table is nonlinearly stretched in the preset second direction to obtain the composite mapping table.

[0074] The portrait scaling device provided in this application, employing the portrait scaling method described in the above embodiments, can solve the technical problem of portrait scaling. Compared with the prior art, the beneficial effects of the portrait scaling device provided in this application are the same as those of the portrait scaling method described in the above embodiments, and other technical features in the portrait scaling device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0075] This application provides a portrait scaling device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the portrait scaling method in Embodiment 1 above.

[0076] The following is for reference. Figure 5The diagram illustrates a structural schematic suitable for implementing the portrait scaling device of the present application embodiments. The portrait scaling device in the present application embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, tablets, digital broadcast receivers, PDAs (Personal Digital Assistants), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The portrait scaling device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of this application.

[0077] like Figure 5 As shown, the portrait scaling device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the portrait scaling device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. The communication device 1009 allows the portrait scaling device to communicate wirelessly or wiredly with other devices to exchange data. Although the figures show portrait scaling devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0078] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0079] The portrait scaling device provided in this application, employing the portrait scaling method described in the above embodiments, can solve the technical problem of portrait scaling. Compared with the prior art, the beneficial effects of the portrait scaling device provided in this application are the same as those of the portrait scaling method described in the above embodiments, and other technical features of the portrait scaling device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0080] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0081] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0082] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to perform the portrait scaling method described in the above embodiments.

[0083] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0084] The aforementioned computer-readable storage medium may be included in the portrait scaling device; or it may exist independently and not assembled into the portrait scaling device.

[0085] The aforementioned computer-readable storage medium carries one or more programs that, when executed by the portrait scaling device, cause the portrait scaling device to: acquire an original image captured by a wide-angle camera; map the initial position of each pixel in the original image to a target position after portrait scaling using a preset sparse mapping table loaded in the image processing unit; and determine an output image based on the target position, wherein the preset sparse mapping table is determined based on the wide-angle camera and is used to perform nonlinear scaling of the original image in different directions.

[0086] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0087] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0088] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0089] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described portrait proportion stretching method, thereby solving the technical problem of portrait proportion stretching. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the portrait proportion stretching method provided in the above embodiments, and will not be repeated here.

[0090] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the portrait scaling method described above.

[0091] The computer program product provided in this application can solve the technical problem of portrait scaling. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the portrait scaling method provided in the above embodiments, and will not be repeated here.

[0092] The above description is only a part of the embodiments of this application and does not limit the scope of protection of this application. All equivalent structural transformations made under the technical concept of this application and using the content of this application specification and drawings, or direct / indirect applications in other related technical fields, are included in the scope of protection of this application.

Claims

1. A method for stretching the proportions of a human portrait, characterized in that, The portrait scaling method includes: Acquire raw images captured by a wide-angle camera; By using a preset sparse mapping table loaded in the image processing unit, the initial position of each pixel in the original image is mapped to the target position after portrait scaling. Based on the target position, the output image is determined. The preset sparse mapping table is determined based on the wide-angle camera and is used to perform nonlinear scaling of the original image in different directions.

2. The portrait proportion stretching method as described in claim 1, characterized in that, Prior to the step of acquiring the raw image captured by the wide-angle camera, the following steps are included: Obtain a single mapping table for distortion reduction; By performing nonlinear stretching in different directions on the single mapping table, a composite mapping table is obtained; Non-uniform sampling is performed on the composite mapping table to obtain a preset sparse mapping table.

3. The portrait proportion stretching method as described in claim 2, characterized in that, The step of performing nonlinear stretching in different directions on the single mapping table to obtain a composite mapping table includes: Obtain the target resolution of the output image, and based on the target resolution, determine the pixel coordinates of each pixel in the output image; Calculate the offset of the pixel coordinates relative to the center coordinates of the output image; Based on the offset, the center coordinates, and the pixel coordinates, the single mapping table is nonlinearly stretched in different directions to obtain a composite mapping table.

4. The portrait proportion stretching method as described in claim 3, characterized in that, The offset includes a horizontal offset, and the different directions include a preset first direction and a preset second direction. The step of performing nonlinear stretching on the single mapping table in different directions based on the offset, the center coordinates, and the pixel coordinates to obtain a composite mapping table includes: Obtain the first stretch factor in the preset first direction and the second stretch factor in the preset second direction; Based on the first stretching factor, the pixel coordinates, the center coordinates, and the horizontal offset, the single mapping table is subjected to nonlinear stretching in the preset first direction to obtain an initial composite mapping table, wherein the stretching intensity of the nonlinear stretching in the preset first direction is positively correlated with the distance from the center coordinates. Based on the second stretching factor, the pixel coordinates, and the center coordinates, the initial composite mapping table is subjected to nonlinear stretching in the preset second direction to obtain a composite mapping table, wherein the nonlinear stretching in the preset second direction is used to enhance the vertical visual extension of the image.

5. The portrait proportion stretching method as described in claim 4, characterized in that, The step of performing nonlinear stretching in a preset first direction on the single mapping table based on the first stretching factor, the pixel coordinates, the center coordinates, and the horizontal offset to obtain an initial composite mapping table includes: The stretching gain is determined based on the center coordinates in the first coordinates of the preset first direction, the pixel coordinates, and the horizontal offset. Based on the stretching gain and the horizontal offset, a first stretching offset is determined; Using the first coordinate as a reference point and based on the first stretching offset, the single mapping table is subjected to nonlinear stretching in the preset first direction to obtain an initial composite mapping table.

6. The portrait proportion stretching method as described in claim 4, characterized in that, The step of performing nonlinear stretching in the preset second direction on the initial composite mapping table based on the second stretching factor and the center coordinates to obtain the composite mapping table includes: Based on the pixel coordinates and the second stretching factor, a second stretching offset is determined, wherein the stretching direction of the second stretching offset is opposite in different preset regions of the original image. Using the center coordinates at the second coordinates in the preset second direction as a reference point, and based on the second stretching offset, the initial composite mapping table is nonlinearly stretched in the preset second direction to obtain the composite mapping table.

7. A human portrait scaling device, characterized in that, The device includes: The acquisition module is used to acquire the raw images captured by the wide-angle camera; The stretching module is used to map the initial position of each pixel in the original image to the target position after portrait scaling by using a preset sparse mapping table loaded in the image processing unit, and to determine the output image based on the target position. The preset sparse mapping table is determined based on the wide-angle camera and is used to perform nonlinear stretching of the original image in different directions.

8. A portrait proportion stretching device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the portrait scaling method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the portrait scaling method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the portrait scaling method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Rapid image splicing method based on wide-angle lenses

    CN103971352A

  • Image correction method and device based on sparse marker and storage medium

    CN117853382A

  • Thermal imager image signal calibration enhancement method and system based on FPGA

    CN119444626A

  • Image processing method and device, computer equipment and storage medium

    CN119477764A