Three-dimensional camera automatic positioning method and device based on scene size self-adaption

By automatically positioning the camera based on the 3D scene size and pitch angle, the problem of camera positioning relying on manual adjustment in existing technologies is solved, achieving efficient and accurate camera positioning that adapts to scenes of different sizes.

CN121616641AActive Publication Date: 2026-03-06ZHUHAI PILOT TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511763704.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-27
Publication Date
2026-03-06
Estimated Expiration
2045-11-27

AI Technical Summary

Technical Problem

In existing 3D modeling software, the automatic camera positioning function relies on manual adjustment, which is difficult to adapt to different sized scenes, resulting in incomplete cropping or composition, and the operation is cumbersome and inefficient.

Method used

By calculating the dimensions of the 3D scene and the user-specified pitch angle, the camera position is automatically determined, including object acquisition, data conversion, length calculation, distance compensation, and displacement calculation, and new cameras are created to adapt to scenes of different sizes.

Benefits of technology

It enables automatic and accurate positioning of the camera, adapts to different sized scenes, reduces manual debugging, and improves work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121616641A_ABST
    Figure CN121616641A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of three-dimensional modeling software, and particularly discloses a three-dimensional camera automatic positioning method and device based on scene size self-adaption. The scene size self-adaption-based three-dimensional camera automatic positioning method comprises the following steps of obtaining an object specified by a user in a three-dimensional scene; reading vertex data of an axis alignment bounding box of an object specified by a user, and converting the vertex data into a world coordinate system; traversing all vertexes, and calculating the width and length of the scene and the diagonal length of the bounding box; receiving a pitch angle a selected or set by a user; calculating a view angle b of the camera in the horizontal direction, and calculating a basic distance D1 required by the camera under the condition that the view angle directly faces the center of the three-dimensional scene; and when the camera shoots at a pitch angle, distance compensation is carried out based on the basic distance in order to see a complete horizontal scene. The method can be adapted to scenes of different sizes, the optimal camera position can be automatically and accurately positioned, and the working efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of 3D modeling software technology, and in particular to a method and apparatus for automatic positioning of a 3D camera based on scene size adaptation. Background Technology

[0002] In the field of 3D modeling, the camera is a core tool for defining the viewpoint, composition, and narrative focus of the final rendered image. To quickly set up the camera, mainstream 3D software (such as Blender and 3ds Max) generally provides a function called "Align Camera to Current View." The basic workflow of this function is as follows: the user first adjusts the 3D view window to a desired viewing angle using mouse operations (such as rotating, panning, and zooming the view) or predefined view switches; then, the user executes the "Align Camera to Current View" command, and the software automatically sets the spatial position and rotation angle of the selected active camera in the current scene to be completely consistent with the viewing parameters of the current view. This function enables the rapid creation of a corresponding camera from any viewpoint, becoming a fundamental and frequently used operation in 3D content creation.

[0003] This function only copies the current view angle and relies entirely on the user to manually adjust the view. For scenes of different sizes, users need to rely on experience and repeated attempts to adjust the view to ensure that the entire scene or target object is within the camera's field of view. It cannot be automatically adapted. Because it relies on human judgment, it is difficult to ensure that the scene boundary is exactly and completely within the camera's field of view, which can easily lead to cropping or incomplete composition. For projects that require multiple angles with consistent perspectives, it is difficult to achieve accurate copying through manual operation. In addition, when dealing with large or complex scenes, users need to repeatedly perform the cycle of "adjusting the view -> aligning the camera -> checking the effect -> fine-tuning" for each required angle. The process is tedious, time-consuming, laborious, and inefficient. Summary of the Invention

[0004] This invention provides a method and apparatus for automatic positioning of a 3D camera based on scene size adaptation, which can adapt to scenes of different sizes, automatically and accurately locate the optimal camera position, and improve work efficiency.

[0005] To solve the above problems, the present invention adopts the following technical solution:

[0006] According to a first aspect of the present invention, embodiments of the present invention provide an automatic positioning method for a 3D camera based on scene size adaptation, comprising the following steps:

[0007] Retrieve the object specified by the user in the 3D scene;

[0008] Read the vertex data of the axis-aligned bounding box of the object specified by the user and convert it to the world coordinate system;

[0009] Traverse all vertices and calculate the width and length of the scene, as well as the diagonal length of the bounding box;

[0010] Receive the pitch angle α selected or set by the user;

[0011] Calculate the field of view angle b of the camera in the horizontal direction, and calculate the base distance D1 required for the camera to be directly facing the center of the three-dimensional scene with the field of view angle;

[0012] When the camera is shooting at the aforementioned pitch angle, distance compensation is performed based on the aforementioned base distance in order to see the complete horizontal scene;

[0013] Based on the compensated distance D2 and pitch angle a, determine the camera's displacement S1 on the Y-axis and displacement S2 on the Z-axis;

[0014] Based on the displacement, a new camera is created in three-dimensional space, and the angle of the new camera is set to face the center point of the scene.

[0015] In some embodiments, the steps of calculating the width and length of the scene specifically include: finding the maximum and minimum values ​​of the vertices on the X-axis and Y-axis respectively; subtracting the maximum and minimum values ​​on the X-axis to obtain the length of the scene; and subtracting the maximum and minimum values ​​on the Y-axis to obtain the width of the scene.

[0016] In some embodiments, the base distance D1 = (diagonal length of the 3D scene / 2) / tan(b / 2).

[0017] In some embodiments, the compensated distance D2 = [D1 / cos(a)] * K, where K is a preset safety factor.

[0018] In some embodiments, the displacement of the camera on the Y-axis is S1 = -D2*cos(a), and the displacement of the camera on the Z-axis is S2 = D2*sin(a).

[0019] According to a second aspect of the present invention, embodiments of the present invention provide an automatic positioning device for a three-dimensional camera based on scene size adaptation, comprising:

[0020] The object acquisition module is used to acquire objects specified by the user in the 3D scene;

[0021] The data conversion module is used to read the vertex data of the axis-aligned bounding box of the object specified by the user and convert it to the world coordinate system.

[0022] The length calculation module is used to traverse all vertices and calculate the width and length of the scene, as well as the diagonal length of the bounding box.

[0023] Angle receiving module, used to receive the pitch angle α selected or set by the user;

[0024] The distance calculation module is used to calculate the field of view angle b of the camera in the horizontal direction, and to calculate the basic distance D1 required for the camera when the field of view angle is directly facing the center of the three-dimensional scene;

[0025] The distance compensation module is used to perform distance compensation based on the base distance in order to see the complete horizontal scene when the camera is shooting at the pitch angle.

[0026] The displacement calculation module is used to determine the camera's displacement S1 on the Y-axis and displacement S2 on the Z-axis based on the compensated distance D2 and pitch angle a.

[0027] A camera positioning module is used to create a new camera in three-dimensional space based on the displacement, and the angle of the new camera is set to face the center point of the scene.

[0028] In some embodiments, the length calculation module is used to find the maximum and minimum values ​​of the vertices on the X-axis and Y-axis respectively, and to obtain the length of the scene by subtracting the maximum and minimum values ​​on the X-axis, and to obtain the width of the scene by subtracting the maximum and minimum values ​​on the Y-axis.

[0029] In some embodiments, the base distance D1 = (diagonal length of the 3D scene / 2) / tan(b / 2).

[0030] In some embodiments, the compensated distance D2 = [D1 / cos(a)] * K, where K is a preset safety factor.

[0031] In some embodiments, the displacement of the camera on the Y-axis is S1 = -D2*cos(a), and the displacement of the camera on the Z-axis is S2 = D2*sin(a).

[0032] The present invention has at least the following beneficial effects: The present invention can automatically analyze the size of a three-dimensional scene and determine the position of the camera based on the size and the pitch angle specified by the user, thus it can adapt to scenes of different sizes and has a wide range of applications; at the same time, the final camera position is obtained by the system through calculation, without relying on human subjective judgment, and the result is more accurate, which also saves users from the process of repeated debugging and effectively improves work efficiency. Attached Figure Description

[0033] Figure 1This is a flowchart illustrating an embodiment of the automatic positioning method for a 3D camera based on scene size adaptation according to the present invention.

[0034] Figure 2 This is a schematic diagram of the structure of an automatic positioning device for a 3D camera based on scene size adaptation according to an embodiment of the present invention.

[0035] The attached figures are labeled as follows: Detailed Implementation

[0036] The present invention is provided below with reference to the accompanying drawings to aid in a full understanding of the various embodiments of the invention as defined by the claims and their equivalents. The description includes various specific details to aid understanding, but these details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the various embodiments described herein without departing from the scope and spirit of the invention.

[0037] In the description of this invention, the orientation descriptions, such as up, down, front, back, left, right, etc., are based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.

[0038] It should be understood that when one element (e.g., the first element) is “connected” to another element (e.g., the second element), the element may be directly connected to the other element, or there may be an intermediary element (e.g., the third element) between the element and the other element.

[0039] Embodiments of the present invention provide a method for automatic localization of a 3D camera based on scene size adaptation, such as... Figure 1 As shown, it includes the following steps:

[0040] S100: Get the object specified by the user in the 3D scene.

[0041] After a user opens the 3D modeling software, the 3D scene is presented on the user's display interface at the initial camera position. The 3D scene can include one or more objects, which can be the floor representing the entire scene area or objects with boundaries. Users can directly select the model of an object in the 3D scene, or select the corresponding object from the model tree in the sidebar.

[0042] S200: Reads the vertex data of the axis-aligned bounding box of the user-specified object and converts it to the world coordinate system.

[0043] Each object in the 3D scene has pre-stored vertex data with axis-aligned bounding boxes, which the system can directly read from storage. Since this data is not stored in world coordinates, it needs to be converted to world coordinates for subsequent calculations.

[0044] S300: Traverse all vertices and calculate the width and length of the scene, as well as the diagonal length of the bounding box.

[0045] The system iterates through all vertices and calculates the width and length of the scene based on them. Only by knowing the width and length of the 3D scene can the camera's bounding box be set to ensure that the entire 3D scene is placed within the camera's field of view. The diagonal length is a key parameter to ensure that the scene is placed within the field of view without any omissions.

[0046] S400: Receives the pitch angle α selected or set by the user.

[0047] The system offers multiple pitch angles (α) for users to choose from, such as "Top View" and "20-degree Top View," which users can directly select. Additionally, the system provides a customization function, allowing users to adjust the angle data and thus customize the pitch angle. This provides users with diverse options, greater flexibility, and meets their varied needs.

[0048] S500: Calculate the field of view angle b of the camera in the horizontal direction, and calculate the base distance D1 required for the camera to be directly facing the center of the three-dimensional scene with the field of view angle.

[0049] The system can determine the horizontal field of view angle b of the camera based on the camera's focal length. The specific determination process is existing technology and is a built-in function of the system, so it will not be described in detail here. The calculation of the base distance D1 aims to ensure that the diagonal of the scene bounding box can be completely placed in the field of view.

[0050] S600: When the camera is shooting at the stated pitch angle, distance compensation is performed based on the stated base distance in order to see the complete horizontal scene.

[0051] Because cameras have a pitch angle, changes in the pitch angle can cause a deviation between the actual distance and the baseline distance. In order for the camera's perspective to fully see the scene, the original baseline distance needs to be compensated to obtain the true and correct distance.

[0052] S700: Based on the compensated distance D2 and pitch angle a, determine the camera's displacement S1 on the Y-axis and displacement S2 on the Z-axis.

[0053] The displacement is calculated based on the compensated distance D2, which is the displacement from the initial camera position to the target position. The ideal target position can display the entire 3D scene completely within the field of view.

[0054] S800: Based on the displacement, create a new camera in three-dimensional space, with the angle of the new camera set to face the center point of the scene.

[0055] Starting from the initial camera position, move the camera according to the displacement amount mentioned above. The final position is the ideal target position. Create a new camera at this target position. The angle of the new camera is set to face the center point of the scene. Of course, internal parameters such as focal length can also be set at the same time. In this way, the entire 3D scene can be fully displayed in the field of view of the new camera.

[0056] Therefore, this embodiment can automatically analyze the size of the 3D scene and determine the position of the camera based on the size and the pitch angle specified by the user. Thus, it can adapt to scenes of different sizes and has a wide range of applications. At the same time, the final camera position is obtained by the system through calculation, without relying on human subjective judgment, and the result is more accurate. This also saves users from repeated debugging and effectively improves work efficiency.

[0057] In some embodiments, the step S300 of calculating the width and length of the scene specifically includes: finding the maximum and minimum values ​​of the vertices on the X-axis and Y-axis respectively, subtracting the maximum and minimum values ​​on the X-axis to obtain the length of the scene, and subtracting the maximum and minimum values ​​on the Y-axis to obtain the width of the scene.

[0058] In the world coordinate system, these vertices must have maximum and minimum values ​​on the X and Y axes. Subtracting the minimum value on the X-axis from the maximum value on the X-axis gives the length of the scene, and subtracting the minimum value on the Y-axis from the maximum value on the Y-axis gives the width of the scene.

[0059] In some embodiments, the diagonal length of the bounding box in step S300 can be obtained according to the Pythagorean theorem, that is, the square of the diagonal length of the bounding box is equal to the sum of the square of the length of the bounding box and the square of the width of the bounding box. The length and width of the bounding box are preset data of the system and are known, so the diagonal length of the bounding box can be calculated accordingly.

[0060] In some embodiments, the base distance D1 in step S500 is calculated as (diagonal length of the 3D scene / 2) / tan(b / 2), meaning the base distance D1 equals half the diagonal length of the 3D scene divided by the tangent of half the field of view angle. The diagonal length of the 3D scene can also be obtained using the Pythagorean theorem, where the square of the diagonal length of the 3D scene equals the sum of the square of the scene's length and the square of its width. Since the scene's length and width have already been calculated, the diagonal length of the 3D scene can be calculated accordingly.

[0061] In some embodiments, in step S600, the compensated distance D2 = [D1 / cos(a)]*K, where K is a preset safety factor. That is, the compensated distance D2 is equal to the base distance divided by the cosine of the pitch angle, and then multiplied by a safety factor, which is determined by those skilled in the art based on experience, for example, it can be 1.1.

[0062] In some embodiments, in step S700, the displacement S1 of the camera on the Y-axis is equal to -D2*cos(a), and the displacement S1 of the camera on the Y-axis is equal to the negative value of the product of the compensated distance and the cosine of the pitch angle.

[0063] The camera's displacement on the Z-axis, S2, is equal to D2*sin(a), which is the product of the compensated distance and the sine of the pitch angle. In this embodiment, the camera's displacement on the Y and Z axes is decomposed using trigonometric functions based on the compensated distance and pitch angle. The camera's coordinates on the X-axis are usually aligned with the scene center or slightly offset to optimize the composition; therefore, it is not necessary to calculate the camera's displacement on the X-axis.

[0064] According to a second aspect of the present invention, embodiments of the present invention provide an automatic positioning device for a three-dimensional camera based on scene size adaptation, such as... Figure 2 As shown, it includes:

[0065] The object acquisition module 100 is used to acquire objects specified by the user in the 3D scene;

[0066] The data conversion module 200 is used to read the vertex data of the axis-aligned bounding box of the object specified by the user and convert it to the world coordinate system.

[0067] The length calculation module 300 is used to traverse all vertices and calculate the width and length of the scene, as well as the diagonal length of the bounding box.

[0068] Angle receiving module 400 is used to receive the pitch angle α selected or set by the user;

[0069] The distance calculation module 500 is used to calculate the field of view angle b of the camera in the horizontal direction, and to calculate the basic distance D1 required by the camera when the field of view angle is directly facing the center of the three-dimensional scene;

[0070] The distance compensation module 600 is used to perform distance compensation based on the base distance in order to see the complete horizontal scene when the camera is shooting at the pitch angle.

[0071] The displacement calculation module 700 is used to determine the displacement S1 of the camera on the Y-axis and the displacement S2 on the Z-axis based on the compensated distance D2 and the pitch angle a.

[0072] The camera positioning module 800 is used to create a new camera in three-dimensional space based on the displacement, and the angle of the new camera is set to face the center point of the scene.

[0073] In some embodiments, the length calculation module 300 is used to find the maximum and minimum values ​​of the vertices on the X-axis and Y-axis respectively, and to obtain the length of the scene by subtracting the maximum and minimum values ​​on the X-axis, and to obtain the width of the scene by subtracting the maximum and minimum values ​​on the Y-axis.

[0074] In some embodiments, the base distance D1 = (diagonal length of the 3D scene / 2) / tan(b / 2).

[0075] In some embodiments, the compensated distance D2 = [D1 / cos(a)] * K, where K is a preset safety factor.

[0076] In some embodiments, the displacement of the camera on the Y-axis is S1 = -D2*cos(a), and the displacement of the camera on the Z-axis is S2 = D2*sin(a).

[0077] Since the above-described embodiments of the automatic positioning device for a 3D camera based on scene size adaptation are embodiments corresponding to the above-described method class, specific descriptions of the embodiments of the automatic positioning device for a 3D camera based on scene size adaptation can be found in the above embodiments, and will not be repeated here.

[0078] The terms and words used in the foregoing description and claims are not limited to their literal meaning, but are merely used by the applicant to enable a clear and consistent understanding of the invention. Therefore, those skilled in the art will understand that the foregoing description of various embodiments of the invention is illustrative only and not intended to limit the invention as defined by the appended claims and their equivalents.

Claims

1. A method for automatic positioning of a three-dimensional camera based on scene size adaptation, characterized in that, The method comprises the following steps: Obtaining an object specified by a user in a three-dimensional scene; Reading vertex data of an axis-aligned bounding box of the object specified by the user and converting the vertex data to a world coordinate system; Traversing all the vertices to calculate a width and a length of the scene and a diagonal length of the bounding box; Receiving an angle of elevation a selected or set by the user; Calculating a horizontal field of view angle b of the camera, calculating a base distance D1 required by the camera when the camera is directed at the center of the three-dimensional scene at the horizontal field of view angle; When the camera is shooting at the angle of elevation, distance compensation is performed based on the base distance for the camera to see a complete horizontal scene; According to the compensated distance D2 and the angle of elevation a, determining a displacement S1 of the camera on the Y-axis and a displacement S2 of the camera on the Z-axis; Based on the displacements, creating a new camera in the three-dimensional space, and setting an angle of the new camera to be directed at a center point of the scene.

2. The method of claim 1, wherein, The step of calculating the width and the length of the scene specifically comprises: finding maximum values and minimum values of the vertices on the X-axis and the Y-axis respectively, calculating a difference between the maximum value and the minimum value on the X-axis to obtain the length of the scene, and calculating a difference between the maximum value and the minimum value on the Y-axis to obtain the width of the scene.

3. The method of claim 1, wherein, The base distance D1=(diagonal length of the three-dimensional scene / 2) / tan(b / 2).

4. The method of claim 3, wherein, The compensated distance D2=[D1 / cos(a)]*K, wherein K is a preset safety coefficient.

5. The method of claim 1, wherein, The displacement S1 of the camera on the Y-axis is -D2*cos(a), and the displacement S2 of the camera on the Z-axis is D2*sin(a).

6. A three-dimensional camera automatic positioning device based on scene size adaptation, characterized in that, The method comprises the following steps: An object obtaining module is configured to obtain an object specified by a user in a three-dimensional scene; A data conversion module is configured to read vertex data of an axis-aligned bounding box of the object specified by the user and convert the vertex data to a world coordinate system; A length calculation module is configured to traverse all the vertices to calculate a width and a length of the scene and a diagonal length of the bounding box; An angle receiving module is configured to receive an angle of elevation a selected or set by the user; A distance calculation module is configured to calculate a horizontal field of view angle b of the camera, and calculate a base distance D1 required by the camera when the camera is directed at the center of the three-dimensional scene at the horizontal field of view angle; A distance compensation module is configured to, when the camera is shooting at the angle of elevation, perform distance compensation based on the base distance for the camera to see a complete horizontal scene; A displacement calculation module is configured to, according to the compensated distance D2 and the angle of elevation a, determine a displacement S1 of the camera on the Y-axis and a displacement S2 of the camera on the Z-axis; A camera positioning module is configured to, based on the displacements, create a new camera in the three-dimensional space, and set an angle of the new camera to be directed at a center point of the scene.

7. The scene size adaptive three-dimensional camera auto-positioning apparatus according to claim 6, wherein, The length calculation module is configured to find maximum values and minimum values of the vertices on the X-axis and the Y-axis respectively, calculate a difference between the maximum value and the minimum value on the X-axis to obtain the length of the scene, and calculate a difference between the maximum value and the minimum value on the Y-axis to obtain the width of the scene.

8. The scene size adaptive three-dimensional camera auto-positioning apparatus according to claim 6, wherein, The base distance D1=(diagonal length of the three-dimensional scene / 2) / tan(b / 2).

9. The scene size adaptive three-dimensional camera auto-positioning apparatus according to claim 8, wherein, The compensated distance D2=[D1 / cos(a)]*K, wherein K is a preset safety coefficient.

10. The scene size adaptive three-dimensional camera auto-positioning apparatus according to claim 6, wherein, The displacement amount S1 of the camera on the Y axis is -D2*cos(a), and the displacement amount S2 of the camera on the Z axis is D2*sin(a).

Citation Information

Patent Citations

  • Generation method of optimal monitoring position according to monitoring target position

    CN105635698A

  • Three-dimensional scene building method and device

    CN113781628A

  • Camera attitude parameter verification method and device, storage medium and terminal

    CN117544759A

  • Method for dynamically calculating scene virtual camera cutting plane based on scene boundary

    CN118941754A

  • Device, mobile body device, positional deviation detecting method, and distance measuring method

    JP2018004420A