Camera pose adjusting method and system
The method establishes coordinate systems and transformation matrices to enable precise camera posture adjustments, addressing the cumbersome and imprecise nature of existing adjustment methods, allowing for accurate monitoring.
Patent Information
- Application Number
- CN202411750537.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing camera adjustment methods are cumbersome and lack precision, making it difficult to achieve accurate posture control according to monitoring requirements.
A method involving the establishment of environmental, camera, and display coordinate systems, calculation of transformation matrices, and division of the display screen into regions to facilitate precise camera posture adjustments based on user inputs.
Enables quick and accurate adjustment of camera posture to better monitor target areas by quantizing distance and using mapping matrices for precise positioning and focusing.
Smart Images

Figure CN119233093A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of posture adjustment, and in particular to a method for adjusting the posture of a camera. Background Art
[0002] In recent years, with the advancement of technology, the growth of social needs and the continuous expansion of application scenarios, cameras have played a vital role in modern society. Cameras have played a very important role in security monitoring, public safety maintenance, traffic management, commercial applications, remote office and conferencing, and personal life. To a large extent, they have ensured social order and the safety of citizens' lives and promoted social development. Therefore, the development of camera technology research and development is particularly important. In different application scenarios, it is often necessary to adjust the monitoring points and the camera requires different postures.
[0003] Existing cameras usually need to be rotated manually or the bracket needs to be adjusted to achieve the rotation, tilt and other actions of the camera, but the operation is cumbersome, the adjustment accuracy is not high, and the precise control of the camera posture cannot be achieved according to the monitoring requirements. Summary of the invention
[0004] The technical problem solved by the present invention is that the operation of adjusting the position of the camera is complicated, the adjustment accuracy is not high, and the precise control of the camera posture cannot be achieved according to monitoring requirements.
[0005] In order to solve the above technical problems, the present invention provides a technical solution: a camera posture adjustment method, comprising the steps of: Step S100, collecting an original image of a monitoring environment, and determining environmental coordinate points, camera coordinate points, and display image coordinate points of the original image; Step S200, calculating a first conversion coordinate matrix through the environment coordinate points and the camera coordinate points; Step S300, calculating a second conversion coordinate matrix through the camera coordinate points and the display image coordinate points; Step S400, dividing the display screen into N regions, and calculating a mapping matrix between the first conversion coordinate matrix and the second conversion coordinate matrix for each region; Step S500, obtaining a monitoring command input by a user, and adjusting the camera posture through the mapping matrix to execute the monitoring command.
[0006] As a preferred solution of the camera posture adjustment method described in the present invention, step S100 specifically includes: Step S101, establishing an environmental coordinate system of the monitoring environment with the center of the area covered by the monitoring range as the origin, selecting the original image of the monitoring environment, and determining the environmental coordinate points of the original image in the environmental coordinate system; Step S102, taking the light point of the camera as the origin, establishing a camera coordinate system for camera monitoring, selecting the original image of the monitoring environment, and determining the camera coordinate point of the original image in the camera coordinate system; Step S103, taking the center of the display screen as the origin, establishing a screen coordinate system for screen monitoring, selecting the original image of the monitoring environment, and determining the display image coordinate point of the original image in the screen coordinate system; As a preferred solution of the camera posture adjustment method described in the present invention, step S200 specifically includes: Step S201, calculating the corresponding rotation matrix according to the environment coordinate point and the camera coordinate point, the calculation formula is: ; ; ; ; in, represents the rotation angle between the environment coordinate point and the camera coordinate point, represents the Z-axis rotation matrix of the environment coordinate point and the camera coordinate point, represents the X-axis rotation matrix of the environment coordinate point and the camera coordinate point, represents the Y-axis rotation matrix of the environment coordinate point and the camera coordinate point, A transformation matrix representing the environment coordinate point and the camera coordinate point; Step S202, calculating the corresponding translation vector according to the environment coordinate point and the camera coordinate point, the calculation formula is: , , ; ;
[0007] in, represents the X-axis translation vector between the environment coordinate point and the camera coordinate point, Indicates the X-axis coordinate point of the environment coordinate system. Indicates the X-axis coordinate point of the camera coordinate system. represents the Y-axis translation vector between the environment coordinate point and the camera coordinate point, Indicates the Y-axis coordinate point of the environment coordinate system. Indicates the Y-axis coordinate point of the camera coordinate system. represents the Z-axis translation vector between the environment coordinate point and the camera coordinate point, Indicates the Z-axis coordinate point of the environment coordinate system. Indicates the Z-axis coordinate point of the camera coordinate system. A translation vector representing the environment coordinate point and the camera coordinate point; Step S203, integrating the transformation matrix and translation vector of the environment coordinate point and the camera coordinate point to obtain the first transformation coordinate matrix, the specific formula is: ; in, , and represents the X, Y and Z axis coordinate values of the environment coordinate point, , and represents the X, Y and Z axis coordinate values of the camera coordinate point, represents the first transformed coordinate matrix.
[0008] As a preferred solution of the camera posture adjustment method described in the present invention, wherein: The second conversion coordinate matrix is calculated according to the camera coordinate point and the display image coordinate point, and the calculation formula is: ;
[0009] Wherein, x and y represent the X-axis and Y-axis coordinate values of the coordinate point of the displayed image, and f represents the focal length. , and The X, Y and Z axis coordinate values of the camera coordinate point are represented by a matrix: ; Among them, the matrix is the second transformation coordinate matrix.
[0010] As a preferred solution of the camera posture adjustment method described in the present invention, step S400 specifically includes: Step S401: divide the display screen into N areas. The specific division method is: Dividing the long side and the wide side of the display image by the fixed step length to obtain the number of long sides and the number of wide sides of the display image, and obtaining N areas of the display image, where the length of the area is the fixed step length; Step S402, calculating the long side change measurement matrix of the first conversion coordinate matrix and the second conversion coordinate matrix of the long side of the display screen, the specific calculation process is: horizontally moving the display screen one by one according to a fixed step size, and obtaining the first conversion coordinate matrix 1, the second conversion coordinate matrix 1, the first conversion coordinate matrix 2, the second conversion coordinate matrix 2, the first conversion coordinate matrix 3, the second conversion coordinate matrix 3... the first conversion coordinate matrix n and the second conversion coordinate matrix n corresponding to the long side 1, the long side 2, the long side 3... the long side n; Subtract the first conversion coordinate matrix n-1 and the second conversion coordinate matrix n-1 from the first conversion coordinate matrix n and the second conversion coordinate matrix n, respectively, and gradually decrease until n=2 to obtain the long side matrix change value n, at this time, n=1, 2, 3...n; Add the long side matrix change values n to obtain the sum of the long side matrix change values, and divide the sum of the long side matrix change values by n to obtain a long side change measurement matrix; Step S403, calculating the long side change measurement matrix of the first conversion coordinate matrix and the second conversion coordinate matrix of the long side of the display screen, the specific calculation process is: horizontally moving the display screen one by one according to a fixed step size, and obtaining the first conversion coordinate matrix 1, the second conversion coordinate matrix 1, the first conversion coordinate matrix 2, the second conversion coordinate matrix 2, the first conversion coordinate matrix 3, the second conversion coordinate matrix 3...the first conversion coordinate matrix n and the second conversion coordinate matrix n corresponding to the wide side 1, wide side 2, wide side 3...wide side n; Subtract the first conversion coordinate matrix n-1 and the second conversion coordinate matrix n-1 from the first conversion coordinate matrix n and the second conversion coordinate matrix n, respectively, and gradually decrease until n=2 to obtain a wide side matrix change value n, at which time n=1, 2, 3...n; Add the broadside matrix change values n to obtain a broadside matrix change value sum, and divide the broadside matrix change value sum by n to obtain a broadside change metric matrix; The long side variation measurement matrix and the wide side variation measurement matrix are mapping matrices between each region.
[0011] As a preferred solution of the camera posture adjustment method described in the present invention, step S500 specifically includes: Step S501, obtaining a monitoring command input by a user, wherein the user inputs the monitoring command through a mouse, and the monitoring command is a scroll signal input by a mouse wheel and a monitoring position; Step S502, the scroll signal includes a scroll direction and a distance, and a zoom factor is calculated according to the scroll direction and distance, and a total length of the scroll wheel; a focus factor of the camera is set according to the zoom factor, and the camera is focused; Step S503, obtaining the target position clicked by the user on the display panel with the mouse, and adjusting the position of the camera according to the mapping matrix.
[0012] As a preferred solution of the camera posture adjustment method described in the present invention, wherein: the long side change measurement matrix includes two change measurement matrices, namely the long side position measurement matrix and the long side focal length measurement matrix; The broadside change measurement matrix includes two change measurement matrices, namely a broadside position measurement matrix and a broadside focal length measurement matrix.
[0013] As a preferred solution of the camera posture adjustment method described in the present invention, wherein: focusing the camera further includes: If it is detected that the total length of the wheel scrolling is 0, it means that the user has not entered a specified zoom factor, and the focus is adjusted by default according to the long side focal length measurement matrix and the wide side focal length measurement matrix in the long side change measurement matrix and the wide side change measurement matrix. If it is detected that the total length of the wheel scrolling is not 0, the zoom factor is calculated according to the scrolling direction and distance, and the total length of the wheel scrolling, the focus factor of the camera is set according to the zoom factor, and the camera is focused.
[0014] As a preferred solution of the camera posture adjustment method described in the present invention, the specific process of adjusting the position of the camera by the mapping matrix is as follows: Obtaining the initial position of the monitoring environment before the camera on the display panel, determining the target position of the mouse clicked on the display panel, subtracting the initial position from the target position, and obtaining a long side position change value and a wide side position change value; Dividing the long side position change value by the fixed step length to obtain a long side position change measurement value; Dividing the wide side position change value by the fixed step size to obtain a wide side position change measurement value; Multiplying the long side position change measurement value by the long side change measurement matrix to obtain a mapping matrix corresponding to the long side; Multiplying the broadside position change measurement value by the broadside change measurement matrix to obtain a mapping matrix corresponding to the broadside; The corresponding numerical squares of the mapping matrix of the long side and the mapping matrix of the wide side are added and squared to obtain the mapping matrix, and the position and posture of the camera are adjusted using the mapping matrix.
[0015] A camera posture adjustment system includes an acquisition module, a calculation module and an execution module; The acquisition module is used to acquire the original image of the monitoring environment, and determine the environment coordinate points, camera coordinate points and display image coordinate points of the original image; The calculation module is used to calculate the first conversion coordinate matrix between the environment coordinate point and the camera coordinate point, calculate the second conversion coordinate matrix between the camera coordinate point and the display image coordinate point, and calculate the mapping matrix between each area of the first conversion coordinate matrix and the second conversion coordinate matrix; The execution module is used to obtain and execute the monitoring command input by the user.
[0016] The beneficial effects of the present invention are as follows: a coordinate system under a monitoring environment, a coordinate system of a camera and a coordinate system of a monitoring display screen are established by an environment coordinate system, a camera coordinate system and a screen display coordinate system; an environment under the environment coordinate system is taken as an original monitoring point; a rotation matrix and a translation vector are calculated by the environment coordinate point of the original monitoring point in the environment coordinate system and the camera coordinate point in the camera coordinate system; the rotation matrix and the translation vector can characterize the posture relationship between the monitoring environment and the camera; a focal length matrix is calculated by the camera coordinate point in the camera coordinate system and the screen coordinate point in the screen display coordinate system; the focal length matrix can characterize the projection relationship between the camera and the display screen; the rotation matrix, the translation vector and the focal length matrix are integrated to obtain a mapping matrix; the mapping matrix can characterize the posture and projection relationship between the monitoring environment and the display screen; by dividing the display screen area, the distance quantization can be multiplied by the mapping matrix according to the distance between the original monitoring point and the target monitoring point on the display screen; the posture of the camera of the target monitoring point can be quickly and accurately calculated; the posture of the camera corresponding to the area of the display screen can be refined, so that the posture of the camera can better monitor the target monitoring area. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A schematic diagram of the basic flow of a camera posture adjustment method provided for one embodiment of the present invention. DETAILED DESCRIPTION
[0018] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings. It is obvious that the described embodiments are only part of the embodiments of the present invention, but not all of the embodiments.
[0019] Example, see Figure 1 , as an embodiment of the present invention, provides a camera posture adjustment method, comprising the following steps: Step S100, collecting an original image of a monitoring environment, and determining environmental coordinate points, camera coordinate points, and display image coordinate points of the original image; Step S200, calculating a first conversion coordinate matrix through the environment coordinate points and the camera coordinate points; Step S300, calculating a second conversion coordinate matrix through the camera coordinate points and the display image coordinate points; Step S400, dividing the display screen into N regions, and calculating a mapping matrix between the first conversion coordinate matrix and the second conversion coordinate matrix for each region; Step S100 specifically includes: Step S101, establishing an environmental coordinate system of the monitoring environment with the center of the area covered by the monitoring range as the origin, selecting the original image of the monitoring environment, and determining the environmental coordinate points of the original image in the environmental coordinate system; Step S102, taking the light point of the camera as the origin, establishing a camera coordinate system for camera monitoring, selecting the original image of the monitoring environment, and determining the camera coordinate point of the original image in the camera coordinate system; Step S103 , establishing a screen coordinate system for screen monitoring with the center of the display screen as the origin, selecting the original image of the monitoring environment, and determining the display image coordinate point of the original image in the screen coordinate system.
[0020] In this embodiment, the coordinate system of the monitoring environment, the coordinate system of the camera and the coordinate system of the monitoring display screen are established through the environment coordinate system, the camera coordinate system and the screen coordinate system. An environment in the environment coordinate system is taken as the original monitoring point, the original monitoring point is taken as the origin of the environment coordinate system, the light spot of the camera is taken as the origin, and the camera coordinate point of the original monitoring point in the camera coordinate system is obtained. The center of the display screen is taken as the origin, and the display image coordinate point of the original monitoring point in the screen coordinate system is obtained.
[0021] Step S200 specifically includes: Step S201, calculating the corresponding rotation matrix according to the environment coordinate point and the camera coordinate point, the calculation formula is: ; ; ;
[0022] ;
[0023] in, represents the rotation angle between the environment coordinate point and the camera coordinate point, represents the Z-axis rotation matrix of the environment coordinate point and the camera coordinate point, represents the X-axis rotation matrix of the environment coordinate point and the camera coordinate point, represents the Y-axis rotation matrix of the environment coordinate point and the camera coordinate point, A transformation matrix representing the environment coordinate point and the camera coordinate point; Step S202, calculating the corresponding translation vector according to the environment coordinate point and the camera coordinate point, the calculation formula is: ; ;
[0024] in, represents the X-axis translation vector between the environment coordinate point and the camera coordinate point, Indicates the X-axis coordinate point of the environment coordinate system. Indicates the X-axis coordinate point of the camera coordinate system. represents the Y-axis translation vector between the environment coordinate point and the camera coordinate point, Indicates the Y-axis coordinate point of the environment coordinate system. Indicates the Y-axis coordinate point of the camera coordinate system. represents the Z-axis translation vector between the environment coordinate point and the camera coordinate point, Indicates the Z-axis coordinate point of the environment coordinate system. Indicates the Z-axis coordinate point of the camera coordinate system. A translation vector representing the environment coordinate point and the camera coordinate point; Step S203, integrating the rotation matrix and translation vector of the environment coordinate point and the camera coordinate point to obtain the first conversion coordinate matrix, the specific formula is: ;
[0025] in, , and represents the X, Y and Z axis coordinate values of the environment coordinate point, , and represents the X, Y and Z axis coordinate values of the camera coordinate point, represents the first transformed coordinate matrix.
[0026] In this embodiment, the environmental coordinate point of the original monitoring point in the environmental coordinate system and the camera coordinate point of the original monitoring point in the camera coordinate system are respectively obtained to obtain the rotation angle of the corresponding coordinate axis, and the rotation angle of each corresponding coordinate axis is substituted into the rotation matrix formula of the corresponding axis, and the obtained rotation matrices of each axis are multiplied to obtain the rotation matrix of the original monitoring point in the environmental coordinate system and the camera coordinate system, and the coordinate change of each corresponding coordinate axis is substituted into the translation vector formula of the corresponding axis to obtain the translation vector of the original monitoring point in the environmental coordinate system and the camera coordinate system. The rotation matrix is: The matrix of the translation vector is The transformation matrix is integrated with the translation vector to obtain the first transformation coordinate matrix.
[0027] The second conversion coordinate matrix is calculated according to the camera coordinate point and the display image coordinate point, and the calculation formula is: ;
[0028] Wherein, x and y represent the X-axis and Y-axis coordinate values of the coordinate point of the displayed image, and f represents the focal length. , and The X, Y and Z axis coordinate values of the camera coordinate point are represented by a matrix: ;
[0029] Among them, the matrix is the second transformation coordinate matrix.
[0030] In this embodiment, the camera coordinate point of the original monitoring point in the camera coordinate system and the display image coordinate point in the screen coordinate system are substituted into the focal length formula, and the three-dimensional coordinate point is projected to the two-dimensional coordinate point to obtain a second transformation coordinate matrix representing the relationship between the original monitoring point in the camera and the display screen.
[0031] Step S400 specifically includes: Step S401: divide the display screen into N areas. The specific division method is: Dividing the long side and the wide side of the display image by the fixed step length to obtain the number of long sides and the number of wide sides of the display image, and obtaining N areas of the display image, where the length of the area is the fixed step length; Step S402, calculating the long side change measurement matrix of the first conversion coordinate matrix and the second conversion coordinate matrix of the long side of the display screen, the specific calculation process is: horizontally moving the display screen one by one according to a fixed step size, and obtaining the first conversion coordinate matrix 1, the second conversion coordinate matrix 1, the first conversion coordinate matrix 2, the second conversion coordinate matrix 2, the first conversion coordinate matrix 3, the second conversion coordinate matrix 3... the first conversion coordinate matrix n and the second conversion coordinate matrix n corresponding to the long side 1, the long side 2, the long side 3... the long side n; Subtract the first conversion coordinate matrix n-1 and the second conversion coordinate matrix n-1 from the first conversion coordinate matrix n and the second conversion coordinate matrix n, respectively, and gradually decrease until n=2 to obtain the long side matrix change value n, at this time, n=1, 2, 3...n; Add the long side matrix change values n to obtain the sum of the long side matrix change values, and divide the sum of the long side matrix change values by n to obtain a long side change measurement matrix; Step S403, calculating the long side change measurement matrix of the first conversion coordinate matrix and the second conversion coordinate matrix of the long side of the display screen, the specific calculation process is: horizontally moving the display screen one by one according to a fixed step size, and obtaining the first conversion coordinate matrix 1, the second conversion coordinate matrix 1, the first conversion coordinate matrix 2, the second conversion coordinate matrix 2, the first conversion coordinate matrix 3, the second conversion coordinate matrix 3...the first conversion coordinate matrix n and the second conversion coordinate matrix n corresponding to the wide side 1, wide side 2, wide side 3...wide side n; Subtract the first conversion coordinate matrix n-1 and the second conversion coordinate matrix n-1 from the first conversion coordinate matrix n and the second conversion coordinate matrix n, respectively, and gradually decrease until n=2 to obtain a wide side matrix change value n, at which time n=1, 2, 3...n; Add the broadside matrix change values n to obtain a broadside matrix change value sum, and divide the broadside matrix change value sum by n to obtain a broadside change metric matrix; The long side variation measurement matrix and the wide side variation measurement matrix are mapping matrices between each region.
[0032] In this embodiment, the display screen is divided into N areas, and the long side and the wide side of the display screen are divided with a fixed step size. The first transformation coordinate matrix and the second transformation coordinate matrix of the long side are subtracted from each other in sequence to obtain a long side change measurement matrix of the first transformation coordinate matrix and the second transformation coordinate matrix of the long side as the long side changes. The first transformation coordinate matrix and the second transformation coordinate matrix of the wide side are subtracted from each other in sequence to obtain a wide side change measurement matrix of the first transformation coordinate matrix and the second transformation coordinate matrix of the wide side as the wide side changes. The long side change measurement matrix and the wide side change measurement matrix jointly represent the change law of the position and posture of the camera when the environmental monitoring point changes from the monitored environment to the display screen.
[0033] Step S500 specifically includes: Step S501, obtaining a monitoring command input by a user, wherein the user inputs the monitoring command through a mouse, and the monitoring command is a scroll signal input by a mouse wheel and a monitoring position; Step S502, the scroll signal includes a scroll direction and a distance, and a zoom factor is calculated according to the scroll direction and distance, and a total length of the scroll wheel; a focus factor of the camera is set according to the zoom factor, and the camera is focused; Step S503, obtaining the target position clicked by the user on the display panel with the mouse, and adjusting the position of the camera according to the mapping matrix.
[0034] In this embodiment, a monitoring command input by the user is obtained, and the user can specify the location of the monitoring environment and the zoom factor of the environmental monitoring point on the display screen. According to the position change of the monitoring environment specified by the user on the display screen, a corresponding mapping matrix is obtained, and the position of the camera is adjusted according to the mapping matrix.
[0035] The long side change measurement matrix includes two change measurement matrices, namely a long side position measurement matrix and a long side focal length measurement matrix; The broadside change measurement matrix includes two change measurement matrices, namely a broadside position measurement matrix and a broadside focal length measurement matrix.
[0036] The focusing of the camera further comprises: if it is detected that the total length of the scroll wheel is 0, it means that the user has not input a specified zoom factor, focusing is performed by default according to the long side focal length measurement matrix and the wide side focal length measurement matrix in the long side change measurement matrix and the wide side change measurement matrix; If it is detected that the total length of the wheel scrolling is not 0, the zoom factor is calculated according to the scrolling direction and distance, and the total length of the wheel scrolling, the focus factor of the camera is set according to the zoom factor, and the camera is focused.
[0037] In this embodiment, the total length and direction input of the user's mouse wheel scrolling are monitored. If it is not 0, the zoom factor is calculated, and the focus factor of the camera is set according to the zoom factor. The user's focus command has a higher priority than the default focus command.
[0038] The specific process of adjusting the position of the camera by the mapping matrix is as follows: obtaining the initial position of the monitoring environment before the camera on the display panel, determining the target position of the mouse clicked on the display panel, subtracting the initial position from the target position, and obtaining the long side position change value and the wide side position change value; Dividing the long side position change value by the fixed step length to obtain a long side position change measurement value; Dividing the wide side position change value by the fixed step size to obtain a wide side position change measurement value; Multiplying the long side position change measurement value by the long side change measurement matrix to obtain a mapping matrix corresponding to the long side; Multiplying the broadside position change measurement value by the broadside change measurement matrix to obtain a mapping matrix corresponding to the broadside; The corresponding numerical squares of the mapping matrix of the long side and the mapping matrix of the wide side are added and squared to obtain the mapping matrix, and the position and posture of the camera are adjusted using the mapping matrix.
[0039] In this embodiment, the initial position of the monitoring environment in front of the camera on the display panel is obtained and subtracted from the target position input by the user to obtain the change values of the long side and the wide side of the initial position and the target position. The change values are quantized according to a fixed step size to obtain their respective mapping matrices. The corresponding squares of the mapping matrix of the long side and the mapping matrix of the wide side are added and squared to obtain the target mapping matrix, and the mapping matrix is used to adjust the position and posture of the camera.
[0040] A camera posture adjustment system includes an acquisition module, a calculation module and an execution module; The acquisition module is used to acquire the original image of the monitoring environment, and determine the environment coordinate points, camera coordinate points and display image coordinate points of the original image; The calculation module is used to calculate the first conversion coordinate matrix between the environment coordinate point and the camera coordinate point, calculate the second conversion coordinate matrix between the camera coordinate point and the display image coordinate point, and calculate the mapping matrix between each area of the first conversion coordinate matrix and the second conversion coordinate matrix; The execution module is used to obtain and execute the monitoring command input by the user.
[0041] The coordinate system of the monitoring environment, the coordinate system of the camera and the coordinate system of the monitoring display screen are established through the environment coordinate system, the camera coordinate system and the screen display coordinate system. An environment in the environment coordinate system is taken as the original monitoring point. The rotation matrix and the translation vector are calculated through the environment coordinate point of the original monitoring point in the environment coordinate system and the camera coordinate point in the camera coordinate system. The rotation matrix and the translation vector can represent the position and posture relationship between the monitoring environment and the camera. The focal length matrix is calculated through the camera coordinate point in the camera coordinate system and the screen coordinate point in the screen display coordinate system. The focal length matrix can represent the projection relationship between the camera and the display screen. The rotation matrix, the translation vector and the focal length matrix are integrated to obtain the mapping matrix. The mapping matrix can represent the position and projection relationship between the monitoring environment and the display screen. By dividing the display screen area, the distance quantization can be multiplied by the mapping matrix according to the distance between the original monitoring point and the target monitoring point on the display screen, so that the position and posture of the camera of the target monitoring point can be quickly and accurately calculated, and the camera position and posture corresponding to the area of the display screen can be refined, so that the position and posture of the camera can better monitor the target monitoring area.
[0042] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. Among them, the storage medium may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, referred to as EPROM), programmable read-only memory (Programmable Red-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0043] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A camera posture adjustment method, characterized in that: include: Step S100, collecting an original image of a monitoring environment, and determining environmental coordinate points, camera coordinate points, and display image coordinate points of the original image; Step S200, calculating a first conversion coordinate matrix through the environment coordinate points and the camera coordinate points; Step S300, calculating a second conversion coordinate matrix through the camera coordinate points and the display image coordinate points; Step S400, dividing the display screen into N regions, and calculating a mapping matrix between the first conversion coordinate matrix and the second conversion coordinate matrix for each region; Step S500, obtaining a monitoring command input by a user, and adjusting the camera posture through the mapping matrix to execute the monitoring command.
2. A camera posture adjustment method as claimed in claim 1, characterized in that: Step S100 specifically includes: Step S101, establishing an environmental coordinate system of the monitoring environment with the center of the area covered by the monitoring range as the origin, selecting the original image of the monitoring environment, and determining the environmental coordinate points of the original image in the environmental coordinate system; Step S102, taking the light point of the camera as the origin, establishing a camera coordinate system for camera monitoring, selecting the original image of the monitoring environment, and determining the camera coordinate point of the original image in the camera coordinate system; Step S103 , establishing a screen coordinate system for screen monitoring with the center of the display screen as the origin, selecting the original image of the monitoring environment, and determining the display image coordinate point of the original image in the screen coordinate system.
3. A camera posture adjustment method as claimed in claim 2, characterized in that: Step S200 specifically includes: Step S201, calculating the corresponding rotation matrix according to the environment coordinate point and the camera coordinate point, the calculation formula is: ; ; ; ; in, represents the rotation angle between the environment coordinate point and the camera coordinate point, represents the Z-axis rotation matrix of the environment coordinate point and the camera coordinate point, represents the X-axis rotation matrix of the environment coordinate point and the camera coordinate point, represents the Y-axis rotation matrix of the environment coordinate point and the camera coordinate point, A transformation matrix representing the environment coordinate point and the camera coordinate point; Step S202, calculating the corresponding translation vector according to the environment coordinate point and the camera coordinate point, the calculation formula is: ; ; in, represents the X-axis translation vector between the environment coordinate point and the camera coordinate point, Indicates the X-axis coordinate point of the environment coordinate system. Indicates the X-axis coordinate point of the camera coordinate system. represents the Y-axis translation vector between the environment coordinate point and the camera coordinate point, Indicates the Y-axis coordinate point of the environment coordinate system. Indicates the Y-axis coordinate point of the camera coordinate system. represents the Z-axis translation vector between the environment coordinate point and the camera coordinate point, Indicates the Z-axis coordinate point of the environment coordinate system. Indicates the Z-axis coordinate point of the camera coordinate system. A translation vector representing the environment coordinate point and the camera coordinate point; Step S203, integrating the transformation matrix and translation vector of the environment coordinate point and the camera coordinate point to obtain the first transformation coordinate matrix, the specific formula is: ; in, , and represents the X, Y and Z axis coordinate values of the environment coordinate point, , and represents the X, Y and Z axis coordinate values of the camera coordinate point, represents the first transformation coordinate matrix.
4. A camera posture adjustment method as claimed in claim 3, characterized in that: The second conversion coordinate matrix is calculated according to the camera coordinate point and the display image coordinate point, and the calculation formula is: ; Wherein, x and y represent the X-axis and Y-axis coordinate values of the coordinate point of the displayed image, and f represents the focal length. , and The X, Y and Z axis coordinate values of the camera coordinate point are represented by a matrix: ; Among them, the matrix is the second transformation coordinate matrix.
5. A camera posture adjustment method as claimed in claim 4, characterized in that: Step S400 specifically includes: Step S401: divide the display screen into N areas. The specific division method is: Dividing the long side and the wide side of the display image by the fixed step length to obtain the number of long sides and the number of wide sides of the display image, and obtaining N areas of the display image, where the length of the area is the fixed step length; Step S402, calculating the long side change measurement matrix of the first conversion coordinate matrix and the second conversion coordinate matrix of the long side of the display screen, the specific calculation process is: horizontally moving the display screen one by one according to a fixed step size to obtain the first conversion coordinate matrix 1, the second conversion coordinate matrix 1, the first conversion coordinate matrix 2, the second conversion coordinate matrix 2, the first conversion coordinate matrix 3, the second conversion coordinate matrix 3... the first conversion coordinate matrix n and the second conversion coordinate matrix n corresponding to the long side 1, the long side 2, the long side 3... the long side n; Subtract the first transformation coordinate matrix n-1 and the second transformation coordinate matrix n-1 from the first transformation coordinate matrix n and the second transformation coordinate matrix n, respectively, and gradually decrease until n=2, to obtain the long side matrix change value n, at this time, n=1, 2, 3...n; Add the long side matrix change values n to obtain the sum of the long side matrix change values, and divide the sum of the long side matrix change values by n to obtain a long side change measurement matrix; Step S403, calculating the long side change measurement matrix of the first conversion coordinate matrix and the second conversion coordinate matrix of the long side of the display screen, the specific calculation process is: The display screen is horizontally moved one by one according to a fixed step length to obtain the first conversion coordinate matrix 1, the second conversion coordinate matrix 1, the first conversion coordinate matrix 2, the second conversion coordinate matrix 2, the first conversion coordinate matrix 3, the second conversion coordinate matrix 3...the first conversion coordinate matrix n and the second conversion coordinate matrix n corresponding to the wide side 1, the wide side 2, the wide side 3...the wide side n; Subtract the first conversion coordinate matrix n-1 and the second conversion coordinate matrix n-1 from the first conversion coordinate matrix n and the second conversion coordinate matrix n, respectively, and gradually decrease until n=2 to obtain a wide side matrix change value n, at which time n=1, 2, 3...n; Add the broadside matrix change values n to obtain a broadside matrix change value sum, and divide the broadside matrix change value sum by n to obtain a broadside change metric matrix; The long side variation measurement matrix and the wide side variation measurement matrix are mapping matrices between each region.
6. A camera posture adjustment method as claimed in claim 5, characterized in that: Step S500 specifically includes: Step S501, obtaining a monitoring command input by a user, wherein the user inputs the monitoring command through a mouse, and the monitoring command is a scroll signal input by a mouse wheel and a monitoring position; Step S502, the scrolling signal includes a scrolling direction and a distance, a zoom factor is calculated according to the scrolling direction and the distance, and a total length of the scroll wheel, a focus factor of the camera is set according to the zoom factor, and the camera is focused; Step S503, obtaining the target position clicked by the user on the display panel with the mouse, and adjusting the position of the camera according to the mapping matrix.
7. A camera posture adjustment method as claimed in claim 6, characterized in that: The long side change measurement matrix includes two change measurement matrices, namely a long side position measurement matrix and a long side focal length measurement matrix; The broadside change measurement matrix includes two change measurement matrices, namely a broadside position measurement matrix and a broadside focal length measurement matrix.
8. A camera posture adjustment method as claimed in claim 7, characterized in that: The focusing of the camera further comprises: If it is detected that the total length of the scroll wheel is 0, it means that the user has not input a specified zoom factor, focusing is performed according to the long side focal length measurement matrix and the wide side focal length measurement matrix in the long side change measurement matrix and the wide side change measurement matrix; If it is detected that the total length of the wheel scrolling is not 0, the zoom factor is calculated according to the scrolling direction and distance, and the total length of the wheel scrolling, the focus factor of the camera is set according to the zoom factor, and the camera is focused.
9. A camera posture adjustment method as claimed in claim 8, characterized in that: The specific process of adjusting the position of the camera by the mapping matrix is as follows: obtaining the initial position of the monitoring environment before the camera on the display panel, determining the target position of the mouse clicked on the display panel, subtracting the initial position from the target position, and obtaining the long side position change value and the wide side position change value; Dividing the long side position change value by the fixed step length to obtain a long side position change measurement value; Dividing the wide side position change value by the fixed step size to obtain a wide side position change measurement value; Multiplying the long side position change measurement value by the long side change measurement matrix to obtain a mapping matrix corresponding to the long side; Multiplying the broadside position change measurement value by the broadside change measurement matrix to obtain a mapping matrix corresponding to the broadside; The mapping matrix is obtained by adding and taking the square root of the corresponding numerical values of the mapping matrix of the long side and the mapping matrix of the wide side, and the position and posture of the camera are adjusted using the mapping matrix.
10. A camera posture adjustment system, comprising a camera posture adjustment method as claimed in any one of claims 1 to 9, characterized in that: It includes an acquisition module, a calculation module and an execution module; The acquisition module is used to acquire the original image of the monitoring environment, and determine the environment coordinate points, camera coordinate points and display image coordinate points of the original image; The calculation module is used to calculate the first conversion coordinate matrix between the environment coordinate point and the camera coordinate point, calculate the second conversion coordinate matrix between the camera coordinate point and the display image coordinate point, and calculate the mapping matrix between each area of the first conversion coordinate matrix and the second conversion coordinate matrix; The execution module is used to obtain and execute the monitoring command input by the user.
Citation Information
Patent Citations
Three-dimensional space positioning method and system and storage medium
CN115511961A
Augmented reality label tracking method and device, equipment and storage medium
CN117474984A
