A method of image spherization and related apparatus

CN115936975BActive Publication Date: 2026-09-11SHENZHEN SHANJIAN INTELLIGENT SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211493789.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-25
Publication Date
2026-09-11
Estimated Expiration
2042-11-25

AI Technical Summary

Technical Problem

[0004]本发明要解决的技术问题在于目前对图像球体化的计算复杂,针对现有技术的不足,提供一种图像球体化方法和相关设备

Benefits of technology

[0042] Beneficial Effects: This invention provides an image spherization method and related equipment. First, the image to be spherized and the spherization command are acquired. A sphere is generated first, and then each vertex of the sphere is cut according to a preset three-dimensional coordinate system to obtain a spherical circle. Pixels on the surface of the spherical circle are considered as pixels after spherization. The corresponding pixel in a row or column of the processed image is then determined. After obtaining the spherical circle, its corresponding first mapping line segment is generated. The spherical circle is cut using the x-axis or y-axis as the mapping coordinate axis and another coordinate axis as the cutting coordinate axis. Therefore, based on the first mapping line segment and the mapping function, the two-dimensional pixel coordinates corresponding to each vertex in the processed image can be calculated. Finally, based on the two-dimensional pixel coordinates, the pixel value corresponding to each vertex is determined and rendered to generate a spherical image. This solution only requires mapping the cut spherical circle and the first mapping line segment, simplifying the calculation method and improving computational efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115936975B_ABST
    Figure CN115936975B_ABST
Patent Text Reader

Abstract

The application discloses a kind of image spherization method and related equipment, method includes: obtaining the processing image to be spherized and spherization instruction, and according to the spherization instruction, generate blank sphere;For any one vertex in the blank sphere, according to the preset three-dimensional coordinate system, determine the vertex coordinate of this vertex;With the x axis or the y axis in the three-dimensional coordinate system as mapping coordinate axis, another coordinate axis is taken as cutting coordinate axis, generate the cutting surface circle parallel to the x axis and perpendicular to the y axis and the first mapping line segment corresponding to the cutting surface circle;According to the first mapping line segment and preset mapping function, calculate the two-dimensional pixel coordinates of the processing image corresponding to the vertex;According to the two-dimensional pixel coordinates, render the blank sphere, generate the spherical image corresponding to the processing image.The application provides a kind of spherization scheme that is convenient and fast and has good spherization effect, and the display effect is realistic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an image spheroidization method and related equipment. Background Technology

[0002] To enhance the visual impact and richness of images, image effects are widely used in various fields of image processing. Common image effects include stylization and spherization.

[0003] Spherization, a technique in image effects, transforms a 2D image into a spherical shape, often used to create scenes such as planets or worlds within spheres. Spherization of 2D images primarily employs mesh-based approximation mapping algorithms. However, the resulting sphere has multiple vertices, demanding high computational performance and incurring a significant computational burden. Summary of the Invention

[0004] The technical problem to be solved by this invention is that the calculation of image spherization is currently very complex. In view of the shortcomings of the existing technology, this invention provides an image spherization method and related equipment.

[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0006] An image spherization method, the method comprising:

[0007] Obtain the image to be spherized and the spherization instruction, and generate a blank sphere according to the spherization instruction;

[0008] For any vertex in the blank sphere, the vertex coordinates are determined according to a preset three-dimensional coordinate system;

[0009] Using the x-axis or y-axis in the three-dimensional coordinate system as the mapping coordinate axis and the other coordinate axis as the cutting coordinate axis, a tangent circle parallel to the x-axis and perpendicular to the y-axis and a first mapping line segment corresponding to the tangent circle are generated.

[0010] Based on the first mapped line segment and the preset mapping function, calculate the two-dimensional pixel coordinates of the vertex corresponding to the processed image;

[0011] Based on the two-dimensional pixel coordinates, the blank sphere is rendered to generate a sphere image corresponding to the processed image.

[0012] The image spherization method, wherein the step of using the x-axis or the y-axis in the three-dimensional coordinate system as a mapping coordinate axis, and using the other coordinate axis as a cutting coordinate axis to generate a tangent circle parallel to the x-axis and perpendicular to the y-axis, and a first mapping line segment corresponding to the tangent circle, includes:

[0013] Calculate the distance between the vertex and the x-axis or y-axis based on the vertex coordinates.

[0014] Based on the distance, the blank sphere is cut to generate a tangent circle that is parallel to the x-axis and perpendicular to the y-axis, and a first mapping line segment corresponding to the tangent circle.

[0015] The image spherization method, wherein calculating the two-dimensional pixel coordinates of the vertex corresponding to the processed image based on the first mapped line segment and a preset mapping function includes:

[0016] The first mapped line segment is split to obtain several second mapped line segments;

[0017] Based on the preset selection rules, determine the single-sided line segments in the second mapped line segments;

[0018] Based on the vertex coordinates corresponding to the vertex and a preset mapping function, calculate the two-dimensional pixel coordinates of the line segment corresponding to the vertex.

[0019] The image spherization method, wherein calculating the two-dimensional pixel coordinates of the face line segment corresponding to the vertex based on the vertex coordinates and a preset mapping function includes:

[0020] Based on the mapping ratio in the spherization command, determine the mapping ratio between the deviation angle corresponding to the vertex in the tangent circle and the single-sided line segment;

[0021] Based on a preset mapping formula, the two-dimensional pixel coordinates of the vertex corresponding to the mapped coordinate axis are calculated.

[0022] The image spherization method, wherein rendering the blank sphere based on the two-dimensional pixel coordinates to generate a spherical image corresponding to the processed image includes:

[0023] Based on the two-dimensional pixel coordinates, determine the mapped pixel point in the processed image corresponding to the vertex;

[0024] Based on the mapped pixel points, determine the sphere pixel value corresponding to the vertex;

[0025] Based on the pixel values ​​of the sphere, the blank sphere is rendered to generate a sphere image corresponding to the processed image.

[0026] The image spherization method further includes a spherization instruction that includes light source coordinates and light source intensity; determining the spherical pixel value corresponding to the vertex based on the mapped pixel point includes:

[0027] Generate a unit vector for the light source based on the light source coordinates and the three-dimensional coordinate system;

[0028] Calculate the light intensity corresponding to the vertex based on the light source unit vector and the light source intensity;

[0029] The pixel value of the sphere corresponding to the vertex is determined based on the pixel value of the mapped pixel and the light intensity.

[0030] The image spherization method further includes a light source color as the spherization instruction; determining the spherical pixel value corresponding to the vertex based on the pixel value of the mapped pixel and the light intensity includes:

[0031] The pixel value of the sphere corresponding to the vertex is determined based on the pixel value of the mapped pixel, the color of the light source, and the light intensity.

[0032] An image spheroidization device, the image spheroidization device comprising:

[0033] The acquisition module is used to acquire the image to be spherized and the spherization instruction, and generate a blank sphere according to the spherization instruction;

[0034] The determination module is used to determine the vertex coordinates of any vertex in the blank sphere according to a preset three-dimensional coordinate system.

[0035] The generation module is used to take the x-axis or the y-axis in the three-dimensional coordinate system as the mapping coordinate axis, and the other coordinate axis as the cutting coordinate axis to generate a tangent circle that is parallel to the x-axis and perpendicular to the y-axis, and a first mapping line segment corresponding to the tangent circle.

[0036] The calculation module is used to calculate the two-dimensional pixel coordinates of the vertex corresponding to the processed image based on the first mapped line segment and a preset mapping function.

[0037] The rendering module is used to render the blank sphere according to the two-dimensional pixel coordinates to generate a sphere image corresponding to the processed image.

[0038] A computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps in any of the above-described image spheroidization methods.

[0039] A terminal device includes: a processor, a memory, and a communication bus; the memory stores a computer-readable program that can be executed by the processor.

[0040] The communication bus enables communication between the processor and the memory;

[0041] When the processor executes the computer-readable program, it implements the steps in any of the above-described image spheroidization methods.

[0042] Beneficial Effects: This invention provides an image spherization method and related equipment. First, the image to be spherized and the spherization command are acquired. A sphere is generated first, and then each vertex of the sphere is cut according to a preset three-dimensional coordinate system to obtain a spherical circle. Pixels on the surface of the spherical circle are considered as pixels after spherization. The corresponding pixel in a row or column of the processed image is then determined. After obtaining the spherical circle, its corresponding first mapping line segment is generated. The spherical circle is cut using the x-axis or y-axis as the mapping coordinate axis and another coordinate axis as the cutting coordinate axis. Therefore, based on the first mapping line segment and the mapping function, the two-dimensional pixel coordinates corresponding to each vertex in the processed image can be calculated. Finally, based on the two-dimensional pixel coordinates, the pixel value corresponding to each vertex is determined and rendered to generate a spherical image. This solution only requires mapping the cut spherical circle and the first mapping line segment, simplifying the calculation method and improving computational efficiency. Attached Figure Description

[0043] Figure 1 This is a schematic diagram of image spherization in the background art.

[0044] Figure 2 A flowchart of the image spherization method provided by this invention.

[0045] Figure 3 This is a schematic diagram illustrating the image processing in the image spheroidization method provided by the present invention.

[0046] Figure 4 This is a schematic diagram of the image structure after spherization in the image spherization method provided by the present invention.

[0047] Figure 5 A three-dimensional image of a blank sphere in the image spheroidization method provided by the present invention.

[0048] Figure 6 In the image spherization method provided by this invention, the tangent circle made with the x-axis as the mapping coordinate axis and the y-axis as the cutting coordinate axis is the first mapping line segment.

[0049] Figure 7 In the image spherization method provided by the present invention, the tangent circle made with the y-axis as the mapping coordinate axis and the x-axis as the cutting coordinate axis is the first mapping line segment.

[0050] Figure 8 The image spheroidization method provided by this invention does not include the spheroidized image obtained by the spheroidization instruction containing the light source intensity and light source coordinates.

[0051] Figure 9 This is a schematic diagram of light illumination in the image spheroidization method provided by the present invention.

[0052] Figure 10 The image spheroidization method provided by this invention includes a spheroidized image obtained by the light source intensity and light source coordinates.

[0053] Figure 11 The image after spheroidizing the processed image in the image spheroidization method provided by the present invention.

[0054] Figure 12 The image obtained by spherizing another processed image in the image spherization method provided by the present invention.

[0055] Figure 13 This is a schematic diagram of the image spheroidization device provided by the present invention.

[0056] Figure 14 The structural schematic diagram of the terminal device provided by the present invention. Detailed Implementation

[0057] This invention provides an image spheroidization method. To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining the invention and are not intended to limit the invention.

[0058] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.

[0059] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0060] like Figure 1As shown, sphericification is a process of applying special effects to an original planar image to make it appear spherical. Figure 2 As shown, this embodiment provides an image spheroidization method. For ease of explanation, a common server is used as the execution subject for description. The server here can be replaced by a tablet, computer, or other device with data processing capabilities. The image spheroidization method includes the following steps:

[0061] S10. Obtain the image to be spherized and the spherization instruction, and generate a blank sphere according to the spherization instruction.

[0062] Specifically, the image being processed is the image that will be spherized later, and the spherization command is the instruction used to initiate the spherization process. When the spherization command is detected, a blank sphere containing multiple vertices is first generated according to the command. The spherized image is then obtained by projecting the blank sphere.

[0063] The sphericification command includes the radius of the generated blank sphere. The value of this radius can be freely set, for example, the radius can be half the length or width of the image being processed, or a preset value.

[0064] To locate the processed image, an initial two-dimensional coordinate system is generated based on the processed image. The origin of this initial two-dimensional coordinate system is the top-left corner vertex, the horizontal direction is the x-axis, and the vertical direction is the y-axis. To present the spherical effect of this scheme, the following is provided: Figure 3 The processed image shown.

[0065] S20. For any vertex in the blank sphere, determine the vertex coordinates according to the preset three-dimensional coordinate system.

[0066] Specifically, the typical calculation method involves taking the coordinates of pixels in a two-dimensional image and then calculating their three-dimensional coordinates. In this example, however, the calculation is done by taking vertices as the objects and calculating their corresponding two-dimensional coordinates. For example... Figure 4 As shown, let point O be the center of the circle in the spheroidized image, and let P be a randomly selected pixel. Based on the initial two-dimensional coordinate system, the coordinates of the center O are (clo, row), and the coordinates of P are (clos, rows). To maintain consistency with the three-dimensional coordinate system, the two-dimensional coordinate system can be adjusted so that the center O is the origin, the horizontal direction is the x-axis, and the vertical direction is the y-axis, resulting in an adjusted two-dimensional coordinate system. Taking point P as an example, its coordinates in the adjusted two-dimensional coordinate system are (clos', rows'), and the transformation relationship between the two is as follows:

[0067] clos' = clos - clo;

[0068] rows' = rows - row.

[0069] First, a three-dimensional coordinate system is pre-set. This system includes an x-axis, a y-axis, a z-axis, and a three-dimensional origin. The origin is the center of the sphere. The x-axis passes horizontally through the origin, the y-axis passes horizontally through the origin and is perpendicular to the x-axis, and the z-axis passes perpendicularly through the origin and is perpendicular to the plane formed by the x-axis and y-axis. The coordinates of any point within the blank sphere can be determined using this three-dimensional coordinate system. Since this embodiment ultimately presents a spherical two-dimensional image, the coordinates of the pixels (vertices) on the surface of the blank sphere are primarily determined. The vertex coordinates of each vertex can be determined using the three-dimensional coordinate system. If the projection is from the z-axis, the coordinates of point P in the three-dimensional coordinate system are represented as (x, y, z). If projection in other directions is used, the coordinates of point P can be represented by other letters to distinguish between the three-dimensional and two-dimensional coordinate values.

[0070] S30. Using the x-axis or y-axis in the three-dimensional coordinate system as the mapping coordinate axis and the other coordinate axis as the cutting coordinate axis, a tangent circle parallel to the x-axis and perpendicular to the y-axis and a first mapping line segment corresponding to the tangent circle are generated.

[0071] Specifically, such as Figure 5 As shown, the distance from point P to the three-dimensional origin can be divided into OC along the x-axis, OB along the y-axis, and PA along the z-axis according to the three-dimensional coordinate system. Through translation and connection, a square pyramid with point P as its vertex and ABCO as its base is formed. If the radius of the blank sphere is r, then... |OB| represents the length of line segment OB, and |OP| represents the length of line segment OP; therefore, ∠OPB = arcsin(y / r), and the length of line segment PB, |PB| = |OP|*cos∠OPB = r*cos(arcsin(y / r)).

[0072] Taking the x-axis as the mapping axis and the y-axis as the cutting axis as an example, such as... Figure 6 As shown, a blank sphere is cut along a direction parallel to the x-axis and perpendicular to the y-axis to obtain a cutting surface. During cutting, the distance between the vertex and the x-axis or y-axis is calculated based on the vertex coordinates. Based on this calculated distance, a cutting circle parallel to the x-axis and perpendicular to the y-axis is generated. Simultaneously, for the cutting circle, each pixel corresponds to a row of pixels in the processed image under the initial two-dimensional coordinate system. Therefore, based on this principle, a first mapping line segment is generated, such as... Figure 6 Medium CD.

[0073] Taking the y-axis as the mapping axis and the x-axis as the cutting axis as an example, such as... Figure 7 As shown, a blank sphere is cut along a direction parallel to the x-axis and perpendicular to the x-axis to obtain a cutting surface. During cutting, the distance between the vertex and the x-axis or y-axis is calculated based on the vertex coordinates. Based on the calculated distance, a cutting circle parallel to the y-axis and perpendicular to the x-axis is generated. Simultaneously, for the cutting circle, each pixel corresponds to a specific column of pixels in the processed image under the initial two-dimensional coordinate system. Therefore, based on this principle, a first mapping line segment is generated, such as... Figure 7 GH.

[0074] S40. Calculate the two-dimensional pixel coordinates of the processed image corresponding to the vertex based on the first mapped line segment and the preset mapping function.

[0075] Specifically, each point in the first mapped line segment can represent a pixel. Each point in CD will eventually be mapped to the tangent circle, thereby determining the coordinates of each point in the tangent circle. Since the coordinates of each vertex in the tangent circle are known, the two-dimensional pixel coordinates corresponding to the vertex can be calculated based on the preset mapping function.

[0076] After spherizing, since users are viewing a flat, two-dimensional image, some of the original image content will inevitably not be displayed to them. Taking a planet as an example of the spherized result... Figure 6 As shown, in the final mapping, only half of the content of the first mapped line segment is displayed to the user. Points E, F, and N are the four division points of the first mapped line segment. If the first mapped line segments are arranged into a circle, then in the final display result, only line segments EF, ND, CN, or FE are presented to the user, which are called one-sided line segments. Therefore, the mapping object of point P is a point on the one-sided line segment. If the result of spherification is a water droplet, the first mapped line segment can be split in other proportions, such as 1:8:1. Therefore, according to the desired spherification effect in the spherification command, the first mapped line segment can be split in different ways to obtain several second mapped line segments, such as line segments CE and EN mentioned above. Then, according to the preset selection rules, the one-sided line segments in the second mapped line segments are determined. Figure 6 In this embodiment, line segment EF is used as a single-sided line segment. Finally, based on the mapping function and the vertex coordinates corresponding to that vertex, the two-dimensional pixel coordinates of the line segment corresponding to that vertex are calculated. In contrast, in this embodiment, the y-axis is used as the mapping coordinate axis, the x-axis is used as the cutting coordinate axis, and line segment JK is a single-sided line segment.

[0077] When performing the mapping, let point P correspond to point P' on the single-sided line segment, with coordinates (x0, y0).

[0078] The mapping method used in this embodiment is based on the deviation angle. The x-axis is the mapping coordinate axis, and the deviation angle is the angle between the plane formed by the line segment PO and the z-axis and y-axis, which is ∠APB on the tangent circle.

[0079] Taking a semicircular arc as an example, the mapping formula between point P and point P' is: (mapping ratio) × (x0 / length of the single-sided line segment) = ∠APB / π, where the single-sided line segment in this embodiment is clo, and ∠APB has been converted to an angle in radians; π is pi, which is the central angle of the upper half of the tangent circle. Based on the arc length formula, the ratio of the two represents the ratio between the arc length corresponding to ∠APB and the semicircular arc. Assuming the mapping ratio between the processed image and the spherically oriented image is 1:1, meaning there is a one-to-one correspondence between each pixel in the processed image and a pixel in the spherically oriented image, then the length of line segment EF is clo, and the mapping formula is x0 / clo = ∠APB / π. Since ∠APB can be calculated from the vertex coordinates, and clo and π are fixed values, the x-coordinate of point P' can be quickly calculated, and this x-coordinate can be used as the two-dimensional pixel coordinate of the y-axis corresponding to vertex P.

[0080] Similarly, as Figure 7 As shown, for a coordinate system with the y-axis as the mapping axis, the deviation angle is the angle between line segment PO and the plane formed by the z-axis and x-axis, which is ∠OPB on the tangent circle.

[0081] Taking a semicircular arc as an example, the mapping formula between point P and point P' is: (mapping ratio) × (y0 / length of the single-sided line segment) = ∠OPB / π, where the single-sided line segment in this embodiment is row, and ∠OPB has been converted to an angle in radians; π is pi, which is the central angle of the upper half of the tangent circle. Based on the arc length formula, the ratio of the two represents the ratio between the arc length corresponding to ∠OPB and the semicircular arc. When performing mapping, let the mapping ratio between the processed image and the spherical image be 1:1, that is, there is a one-to-one correspondence between each pixel in the processed image and the pixel in the spherical image. Then the length of line segment JK is row, and the mapping formula is y0 / row = ∠OPB / π. Since ∠OPB can be calculated from the vertex coordinates, and row and π are fixed values, the ordinate coordinate of point P' can be quickly calculated, and this coordinate is used as the two-dimensional pixel coordinate of the y-axis corresponding to vertex P.

[0082] Obtaining the x and y coordinates of P' yields the two-dimensional pixel coordinates of point P in the processed image. Taking this embodiment as an example, in the initial two-dimensional coordinate system, the two-dimensional coordinates of the pixel corresponding to point P are represented as (x', y'), and their calculation formula is:

[0083] x'=clo+x0=clo+clo*arcsin(x / r / cos(arcsin(y / r))) / π;

[0084] y'=row+y0=row+row*arcsin(y / r) / π.

[0085] S50. Render the blank sphere according to the two-dimensional pixel coordinates to generate a sphere image corresponding to the processed image.

[0086] Specifically, based on the two-dimensional pixel coordinates, the mapped pixel point corresponding to the vertex in the processed image is determined, and then the sphere pixel value corresponding to the vertex is determined based on the mapped pixel point. The simplest way to determine this is to directly use the pixel value of the corresponding mapped pixel point as the sphere pixel value of the vertex.

[0087] Furthermore, if the mapping ratio is not equal to 1:1, the two-dimensional pixel coordinates corresponding to point P may be non-integer. In this case, the pixel value corresponding to point P can be calculated using an interpolation algorithm based on the pixel values ​​of the neighboring pixels. For example, if the two-dimensional pixel coordinates are (0, 0.5), then the corresponding pixel value can be calculated based on the pixel values ​​of pixels (0, 0), (0, 1), (1, 0), and (1, 1).

[0088] To increase the realism of the spheroidized image, this embodiment can also add special effects commands to the spheroidized image. For example... Figure 8 As shown, without contrast between light and dark, the spheroidizing effect lacks realism. Therefore, in this embodiment, the spheroidizing command may also include light source parameters, such as light source coordinates and light source intensity.

[0089] Depend on Figure 9 It is known that the reflected light is strongest when the angle between ray PM and the sphere normal OP is 0 degrees, and there is almost no illumination when the angle exceeds 90 degrees. Therefore, the intensity of illumination at vertex P can be determined by the normalized vector product of the ray vector and the sphere normal vector. The process includes:

[0090] A10. Generate a unit vector for the light source based on the light source coordinates and the three-dimensional coordinate system.

[0091] Specifically, in a three-dimensional coordinate system, let the coordinates of the light source be (a, b, c), and its corresponding ray vector be (a, b, c). We must ensure that the magnitude of the ray vector is greater than the radius r of the sphere, meaning the light source is outside the sphere. Then, let the unit ray vector be (m, n, l). For any point P(x, y) on the spherical image from the first step, its z-coordinate value... Therefore, normalizing the ray vector yields the light source unit vector (m, n, l) as follows:

[0092]

[0093]

[0094]

[0095] A20. Calculate the light intensity corresponding to the vertex based on the unit vector of the light source and the light source intensity.

[0096] Specifically, after obtaining the unit vector of the light source and the light source intensity, the light intensity corresponding to the vertex can be calculated using the following formula:

[0097] (vector OP / |OP|)*light vector*light source intensity = (x / r)*m + (y / r)*n + (z / r)*l. In this example, the default value for light source intensity is 1. Since the length of each unit vector is 1, the maximum light intensity in this embodiment is 1.

[0098] A30. Determine the sphere pixel value corresponding to the vertex based on the pixel value of the mapped pixel and the light intensity.

[0099] Specifically, assuming the light source color is Light, and the pixel value of point P, determined by the previous steps, is Color (the pixel value of the mapped pixel), then the pixel values ​​of the sphere after mixed lighting can be:

[0100] Color (sphere) = Q * Light * Color (pixel value of the mapped pixel).

[0101] right Figure 8 After adding lighting effects, the result is as follows: Figure 10 The spherical image shown. For the processed image provided in this embodiment, using the above-described mapping rendering method and lighting effects, the following is obtained: Figure 11 The spherical image shown is more realistic and computationally efficient. Figure 12 In this process, the light source is green, and the final result is that only the part of the spherical image that can be illuminated by light appears green (the effect is not obvious in grayscale images), thus achieving the rapid implementation of two special effects: optical intensity and color transformation.

[0102] This invention uses vertices as the starting point and traces the pixel values ​​of pixels on the original processed image, resulting in a simple and fast calculation method. Furthermore, the sphericalized image exhibits realistic effects, conforming to the desired spherical effect. In addition, users can freely set the size and amplitude of the sphericalization, offering high flexibility and a wide range of applications. This scheme uses fewer support points, requiring less computation and exhibiting more stable performance compared to conventional mesh approximation methods. Moreover, it avoids the angularity often found in mesh approximation algorithms, allowing for better visual adjustment. Since video is composed of many frames, this scheme can also be applied to video processing. Furthermore, this method can incorporate light sources of different colors or intensities, making the sphericalized result even more realistic.

[0103] Based on the above image spheroidization method, the present invention also provides an image spheroidization device 100, such as... Figure 13 As shown, the device includes:

[0104] The acquisition module is used to acquire the image to be spherized and the spherization instruction, and generate a blank sphere according to the spherization instruction;

[0105] The determination module is used to determine the vertex coordinates of any vertex in the blank sphere according to a preset three-dimensional coordinate system.

[0106] The generation module is used to take the x-axis or the y-axis in the three-dimensional coordinate system as the mapping coordinate axis, and the other coordinate axis as the cutting coordinate axis to generate a tangent circle that is parallel to the x-axis and perpendicular to the y-axis, and a first mapping line segment corresponding to the tangent circle.

[0107] The calculation module is used to calculate the two-dimensional pixel coordinates of the vertex corresponding to the processed image based on the first mapped line segment and a preset mapping function.

[0108] The rendering module is used to render the blank sphere according to the two-dimensional pixel coordinates to generate a sphere image corresponding to the processed image.

[0109] Specifically, the generation module 130 is used for:

[0110] Calculate the distance between the vertex and the x-axis or y-axis based on the vertex coordinates.

[0111] Based on the distance, the blank sphere is cut to generate a tangent circle that is parallel to the x-axis and perpendicular to the y-axis, and a first mapping line segment corresponding to the tangent circle.

[0112] Specifically, the calculation module 140 is used for:

[0113] The first mapped line segment is split to obtain several second mapped line segments;

[0114] Based on the preset selection rules, determine the single-sided line segments in the second mapped line segments;

[0115] Based on the vertex coordinates corresponding to the vertex and a preset mapping function, calculate the two-dimensional pixel coordinates of the line segment corresponding to the vertex.

[0116] The rendering module 150 includes:

[0117] The first determining unit is used to determine the mapped pixel point in the processed image corresponding to the vertex based on the two-dimensional pixel coordinates;

[0118] The second unit is used to determine the sphere pixel value corresponding to the vertex based on the mapped pixel points;

[0119] The generation unit is used to render the blank sphere according to the sphere pixel values ​​to generate a sphere image corresponding to the processed image.

[0120] The sphericification instruction further includes the light source color; the generation unit includes:

[0121] A sub-unit is generated to generate a unit vector of the light source based on the light source coordinates and the three-dimensional coordinate system.

[0122] The calculation subunit is used to calculate the light intensity corresponding to the vertex based on the light source unit vector and the light source intensity;

[0123] A subunit is defined to determine the sphere pixel value corresponding to the vertex based on the pixel value of the mapped pixel and the light intensity.

[0124] The sphericification instruction further includes the light source color; the determination subunit is also used for:

[0125] The pixel value of the sphere corresponding to the vertex is determined based on the pixel value of the mapped pixel, the color of the light source, and the light intensity.

[0126] Based on the above image spheroidization method, the present invention also provides a terminal device, such as... Figure 14 As shown, it includes at least one processor 20; a display screen 21; and a memory 22, and may also include a communications interface 23 and a bus 24. The processor 20, display screen 21, memory 22, and communications interface 23 can communicate with each other via the bus 24. The display screen 21 is configured to display a preset user guide interface in the initial setup mode. The communications interface 23 can transmit information. The processor 20 can invoke logical commands stored in the memory 22 to execute the methods described in the above embodiments.

[0127] Furthermore, the logical commands in the aforementioned memory 22 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.

[0128] The memory 22, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, such as program commands or modules corresponding to the methods in the embodiments of this disclosure. The processor 20 executes functional applications and data processing by running the software programs, commands, or modules stored in the memory 22, thereby implementing the methods in the above embodiments.

[0129] The memory 22 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 22 may include high-speed random access memory (RAM) and non-volatile memory. Examples include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks; it may also be a transient computer-readable storage medium.

[0130] Furthermore, the specific process of loading and executing multiple command processors in the aforementioned computer-readable storage medium and terminal device has been described in detail in the above method, and will not be repeated here.

[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method of image spherization, characterized by, The method includes: Obtain the image to be spherized and the spherization instruction, and generate a blank sphere according to the spherization instruction; For any vertex in the blank sphere, the vertex coordinates are determined according to a preset three-dimensional coordinate system; Using either the x-axis or y-axis in the three-dimensional coordinate system as the mapping coordinate axis, and the other coordinate axis as the cutting coordinate axis, a tangent circle parallel to the x-axis and perpendicular to the y-axis, and a first mapping line segment corresponding to the tangent circle are generated; or a tangent circle parallel to the y-axis and perpendicular to the x-axis, and a first mapping line segment corresponding to the tangent circle are generated; specifically, Taking the x-axis as the mapping coordinate axis and the y-axis as the cutting coordinate axis as an example, the blank sphere is cut along a direction parallel to the x-axis and perpendicular to the y-axis to obtain a cutting surface. During cutting, the distance between the vertex and the x-axis or y-axis is calculated based on the vertex coordinates. Based on the calculated distance, a cutting circle parallel to the x-axis and perpendicular to the y-axis is generated. Simultaneously, for each pixel on the cutting circle, corresponding to a row of pixels in the processed image under the initial two-dimensional coordinate system, a first mapping line segment is generated; or... Taking the y-axis as the mapping coordinate axis and the x-axis as the cutting coordinate axis as an example, the blank sphere is cut along a direction parallel to the y-axis and perpendicular to the x-axis to obtain a cutting surface. During the cutting, the distance between the vertex and the x-axis or y-axis is calculated based on the vertex coordinates. Based on the calculated distance, a cutting circle parallel to the y-axis and perpendicular to the x-axis is generated. At the same time, for the cutting circle, each pixel on the circle corresponds to a certain column of pixels in the processed image under the initial two-dimensional coordinate system, and a first mapping line segment is generated. Based on the first mapped line segment and the preset mapping function, the two-dimensional pixel coordinates of the vertex corresponding to the processed image are calculated, and the mapping method is based on the angle. Based on the two-dimensional pixel coordinates, the blank sphere is rendered to generate a sphere image corresponding to the processed image.

2. The method of claim 1, wherein, The step of calculating the two-dimensional pixel coordinates of the vertex corresponding to the processed image based on the first mapped line segment and the preset mapping function includes: The first mapped line segment is split to obtain several second mapped line segments; Based on the preset selection rules, determine the single-sided line segments in the second mapped line segments; Based on the vertex coordinates corresponding to the vertex and a preset mapping function, calculate the two-dimensional pixel coordinates of the single-sided line segment corresponding to the vertex.

3. The method of claim 2, wherein, The step of calculating the two-dimensional pixel coordinates of the single-sided line segment corresponding to the vertex based on the vertex coordinates and a preset mapping function includes: Based on the mapping ratio in the spherization command, determine the mapping ratio between the deviation angle corresponding to the vertex in the tangent circle and the single-sided line segment; Based on a preset mapping formula, the two-dimensional pixel coordinates of the vertex corresponding to the mapped coordinate axis are calculated.

4. The method of claim 1, 2 or 3, wherein The step of rendering the blank sphere based on the two-dimensional pixel coordinates to generate a sphere image corresponding to the processed image includes: Based on the two-dimensional pixel coordinates, determine the mapped pixel point in the processed image corresponding to the vertex; Based on the mapped pixel points, determine the sphere pixel value corresponding to the vertex; Based on the pixel values ​​of the sphere, the blank sphere is rendered to generate a sphere image corresponding to the processed image.

5. The method of claim 4, wherein, The spherization instruction also includes light source coordinates and light source intensity; determining the sphere pixel value corresponding to the vertex based on the mapped pixel point includes: Generate a unit vector for the light source based on the light source coordinates and the three-dimensional coordinate system; Calculate the light intensity corresponding to the vertex based on the light source unit vector and the light source intensity; The pixel value of the sphere corresponding to the vertex is determined based on the pixel value of the mapped pixel and the light intensity.

6. The image spherization method according to claim 5, characterized in that, The spherization instruction also includes the light source color; the step of determining the spherical pixel value corresponding to the vertex based on the pixel value of the mapped pixel and the light intensity also includes: The sphere pixel value corresponding to the vertex is determined based on the pixel value of the mapped pixel, the color of the light source, and the light intensity.

7. An image spheroidization device, characterized in that, The image spheroidizing device includes: The acquisition module is used to acquire the image to be spherized and the spherization instruction, and generate a blank sphere according to the spherization instruction; The determination module is used to determine the vertex coordinates of any vertex in the blank sphere according to a preset three-dimensional coordinate system. The generation module is used to take the x-axis or y-axis in the three-dimensional coordinate system as the mapping coordinate axis and the other coordinate axis as the cutting coordinate axis to generate a tangent circle parallel to the x-axis and perpendicular to the y-axis, and a first mapping line segment corresponding to the tangent circle; or to generate a tangent circle parallel to the y-axis and perpendicular to the x-axis, and a first mapping line segment corresponding to the tangent circle; specifically, Taking the x-axis as the mapping coordinate axis and the y-axis as the cutting coordinate axis as an example, the blank sphere is cut along a direction parallel to the x-axis and perpendicular to the y-axis to obtain a cutting surface. During cutting, the distance between the vertex and the x-axis or y-axis is calculated based on the vertex coordinates. Based on the calculated distance, a cutting circle parallel to the x-axis and perpendicular to the y-axis is generated. Simultaneously, for each pixel on the cutting circle, corresponding to a row of pixels in the processed image under the initial two-dimensional coordinate system, a first mapping line segment is generated; or... Taking the y-axis as the mapping coordinate axis and the x-axis as the cutting coordinate axis as an example, the blank sphere is cut along a direction parallel to the y-axis and perpendicular to the x-axis to obtain a cutting surface. During the cutting, the distance between the vertex and the x-axis or y-axis is calculated based on the vertex coordinates. Based on the calculated distance, a cutting circle parallel to the y-axis and perpendicular to the x-axis is generated. At the same time, for the cutting circle, each pixel on the circle corresponds to a certain column of pixels in the processed image under the initial two-dimensional coordinate system, and a first mapping line segment is generated. The calculation module is used to calculate the two-dimensional pixel coordinates of the vertex corresponding to the processed image based on the first mapped line segment and the preset mapping function, wherein the mapping method is based on the angle. The rendering module is used to render the blank sphere according to the two-dimensional pixel coordinates to generate a sphere image corresponding to the processed image.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the steps in the image spheroidization method as described in any one of claims 1 to 6.

9. A terminal device, characterized in that, include: Processor, memory, and communication bus; The memory stores a computer-readable program that can be executed by the processor; The communication bus enables communication between the processor and the memory; When the processor executes the computer-readable program, it implements the steps in the image spheroidization method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Equal-proportion fisheye correction method and device, computer equipment and readable storage medium

    CN111861904A

  • Two-dimensional image illumination rendering method, device and system and electronic device

    CN114998504A