Pan-tilt camera control method and device, and storage medium
By pre-constructing low-value area information and adjusting the rotation strategy of the PTZ camera, the problem of low operating efficiency of the PTZ camera in low-value areas is solved, achieving more efficient image acquisition and an optimized user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU HUACHENG SOFTWARE TECH CO LTD
- Filing Date
- 2025-12-03
- Publication Date
- 2026-04-21
AI Technical Summary
When pan-tilt-zoom (PTZ) cameras rotate, they tend to enter low-value areas, leading to low operational efficiency and a poor user experience. Existing technologies cannot effectively avoid these ineffective areas.
By pre-constructing low-value area information and combining it with the current coordinates and control commands of the PTZ camera, the rotation process of the PTZ camera is adjusted. Adjustment strategies such as increasing speed, modifying the path, or changing the focal length are adopted to avoid acquiring images of low-value areas.
This reduces the amount of image acquisition from low-value areas by the PTZ camera, improving operational efficiency and user experience.
Smart Images

Figure CN121908138A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of PTZ control technology, and in particular to a PTZ camera control method, device, and storage medium. Background Technology
[0002] A pan-tilt head (PTZ) is a support device for mounting and securing mobile phones, cameras, camcorders, and other equipment. They are generally divided into two types: fixed and motorized. For example, a common PTZ camera integrates the camera and the PTZ unit into one device. The PTZ's ability to rotate freely allows the camera to easily capture video image data from various directions.
[0003] Taking pan-tilt cameras as an example (such as PTZ cameras), pan-tilt cameras are currently typically mounted on ceilings or walls. However, due to the limitations of the physical installation location, when the pan-tilt is rotated horizontally or vertically, there are a large number of low-value areas within its field of view, such as walls, ceilings, and certain obstructions.
[0004] Once the pan-tilt-zoom (PTZ) moves the camera into a low-value area, users will not only waste time observing the low-value area, but also easily lose their sense of target orientation, resulting in low operating efficiency of the PTZ camera and a poor user experience. Summary of the Invention
[0005] This application provides at least one method, apparatus, device, and computer-readable storage medium for controlling a PTZ camera.
[0006] The first aspect of this application provides a method for controlling a PTZ camera, comprising: acquiring low-value area information of a pre-constructed low-value area, wherein the low-value area is a portion of the field of view captured by the PTZ camera; responding to a received PTZ control command, determining whether to adjust the PTZ camera's command execution process in response to the PTZ control command based on the low-value area information, the PTZ control command, and the current coordinates of the PTZ camera; if so, adjusting the command execution process according to a preset control adjustment strategy.
[0007] In one embodiment, determining whether to adjust the gimbal camera's instruction execution process for the gimbal control instruction based on the low-value area information, the gimbal control instruction, and the current coordinates of the gimbal camera includes: predicting whether the image acquired by the gimbal camera during the instruction execution process includes the low-value area based on the gimbal control instruction, the current coordinates, and the low-value area information; if so, determining to adjust the instruction execution process.
[0008] In one embodiment, the low-value area information includes low-value coordinates marked by the PTZ camera when it acquires an image of the low-value area. The step of predicting whether the image acquired by the PTZ camera during the execution of the command includes the low-value area based on the PTZ control command, the current coordinates, and the low-value area information. This includes: determining the range of coordinate changes of the PTZ camera during the execution of the command based on the PTZ control command and the current coordinates; and predicting that the image acquired by the PTZ camera includes the low-value area if the low-value coordinates are within the range of coordinate changes.
[0009] In one embodiment, adjusting the instruction execution process according to a preset control adjustment strategy includes: obtaining the initial focal length of the PTZ camera when executing the PTZ control instruction; and reducing the initial focal length in response to the current coordinates of the PTZ camera reaching the low-value coordinates of the low-value region during the instruction execution process.
[0010] In one embodiment, adjusting the instruction execution process according to a preset control adjustment strategy includes: obtaining the initial motion speed corresponding to the PTZ control instruction; and accelerating the initial motion speed in response to the current coordinates of the PTZ camera reaching the low-value coordinates of the low-value area during the instruction execution process.
[0011] In one embodiment, adjusting the instruction execution process according to a preset control adjustment strategy includes: obtaining the initial motion path corresponding to the PTZ control instruction; and, in response to the current coordinates of the PTZ camera reaching the low-value coordinates of the low-value area during the instruction execution process, performing path replanning on the initial motion path based on the low-value coordinates.
[0012] In one embodiment, after adjusting the instruction execution process according to a preset control adjustment strategy, the method further includes: in response to the low-value coordinates of the current coordinates of the PTZ camera being far away from the low-value area during the instruction execution process, obtaining initial control parameters of the PTZ control instruction; and controlling the PTZ camera to move to the target coordinates corresponding to the PTZ control instruction according to the initial control parameters.
[0013] In one embodiment, before obtaining the low-value region information of the pre-constructed low-value region, the method further includes: obtaining the initial image captured by the PTZ camera and the initial coordinates when the PTZ camera captures each frame of the initial image; identifying the image containing the low-value region in each initial image to obtain the low-value image; and determining the initial coordinates corresponding to the low-value image as the low-value region information.
[0014] A second aspect of this application provides a PTZ camera control device, comprising: an acquisition module for acquiring low-value area information of a pre-constructed low-value area, wherein the low-value area is a portion of the field of view captured by the PTZ camera; a judgment module for, in response to a received PTZ control command, determining whether to adjust the PTZ camera's command execution process in response to the low-value area information, the PTZ control command, and the current coordinates of the PTZ camera; and an adjustment module for, if so, adjusting the command execution process according to a preset control adjustment strategy.
[0015] A third aspect of this application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the above-described pan-tilt camera control method.
[0016] The fourth aspect of this application provides a computer-readable storage medium having program instructions stored thereon, which, when executed by a processor, implement the above-described pan-tilt camera control method.
[0017] The above scheme pre-determines the field of view supported by the PTZ camera, and then constructs low-value areas based on a portion of the field of view, thereby acquiring low-value area information. Upon receiving a PTZ control command, it can determine whether the PTZ camera will capture images of the low-value areas when rotating in response to the command, based on the low-value area information, the PTZ control command, and the PTZ camera's current coordinates. This determines whether to adjust the PTZ camera's command execution process. If adjustment is needed, the command execution process is adjusted according to a preset control adjustment strategy, reducing image acquisition of low-value areas when the PTZ camera rotates in response to the command. This minimizes invalid information acquired by the PTZ camera, improves its operational efficiency, and optimizes the user experience.
[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this application. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.
[0020] Figure 1 This is a flowchart illustrating an exemplary embodiment of the PTZ camera control method of this application; Figure 2 This is an exemplary path replanning diagram in the PTZ camera control method of this application; Figure 3 This is an exemplary schematic diagram of the field of view acquisition effect in the PTZ camera control method of this application; Figure 4 This is a block diagram illustrating a PTZ camera control device in an exemplary embodiment of this application; Figure 5 This is a schematic diagram of the structure of an embodiment of the electronic device of this application; Figure 6 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. Detailed Implementation
[0021] The solution of this embodiment will now be described in detail with reference to the accompanying drawings.
[0022] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.
[0023] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this document means two or more. Moreover, the term "at least one" in this document means any combination of at least two of any one or more of a plurality of objects. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.
[0024] To facilitate understanding, one of the applicable scenarios of this application will be illustrated by example.
[0025] A pan-tilt head (PTZ) is a support device for mounting and securing mobile phones, cameras, camcorders, and other equipment. They are generally divided into two types: fixed and motorized. For example, a common PTZ camera integrates the camera and the PTZ unit into one device. The PTZ's ability to rotate freely allows the camera to easily capture video image data from various directions.
[0026] Taking pan-tilt cameras as an example (such as PTZ cameras, which include horizontal rotation, vertical rotation, and lens zoom functions), pan-tilt cameras are currently typically mounted on ceilings or walls. However, due to the limitations of the physical installation location, when the pan-tilt is rotating horizontally or vertically, there are a large number of low-value areas within its field of view, such as walls, ceilings, and certain obstructions.
[0027] Low-value areas can also be called invalid areas. This is mainly because when a PTZ camera captures images of invalid areas, the resulting video images usually contain meaningless content (invalid information), which is difficult to effectively help in subsequent image applications.
[0028] Once the pan-tilt-zoom (PTZ) moves the camera into a low-value area, users will not only waste time observing the low-value area, but also easily lose their sense of target orientation, resulting in low operating efficiency of the PTZ camera and a poor user experience.
[0029] Currently, common PTZ camera control methods can address low-value areas that don't require attention by setting virtual shielding areas: users manually draw virtual areas on the display screen to shield them. However, this requires pre-setting statically, cannot adapt to new obstructions, and the fixed pixel area will deviate from the actual spatial coordinates when the PTZ rotates.
[0030] Alternatively, motion detection can be used: during auto-navigation, if the screen remains unchanged for an extended period, it is considered an invalid screen and skipped. However, this method does not work in manual control mode and is easily affected by lighting conditions and slight changes (such as swaying leaves), resulting in a delayed response.
[0031] Therefore, current common technical solutions are inefficient and provide a poor user experience when controlling the rotation of a PTZ camera, and cannot effectively solve the need to quickly skip invalid areas in scenarios where users control PTZ cameras.
[0032] Please see Figure 1 , Figure 1 This is a flowchart illustrating an exemplary embodiment of the pan-tilt camera control method of this application. Specifically, it may include the following steps: Step S110: Obtain low-value area information from the pre-constructed low-value area. The low-value area is a portion of the field of view captured by the PTZ camera.
[0033] Low-value areas generally refer to a portion of the field of view captured by a PTZ camera. The field of view refers to the observable range of the PTZ camera in the current application scenario (i.e., the range of the field of view from which image data can be acquired), which mainly depends on the focal length and the range of rotation of the PTZ.
[0034] Low-value areas can be pre-defined or constructed through the identification of acquired images; this is not a limitation. Low-value areas may include, but are not limited to, walls, ceilings, and / or other fixed obstructions.
[0035] Low-value area information refers to the acquisition parameter information corresponding to the pan-tilt camera when it acquires images of low-value areas. This may include, but is not limited to, the coordinate information, focal length information, and the field of view (FOV) range corresponding to the focal length information when the pan-tilt camera acquires images of low-value areas.
[0036] Since a PTZ camera captures an image containing low-value areas, these low-value areas can be the entire image region or a portion of the image region. Therefore, the same low-value area can correspond to one or more low-value area information, which will not be elaborated further here.
[0037] Step S120: In response to the received PTZ control command, determine whether to adjust the PTZ camera's command execution process based on the low-value area information, the PTZ control command, and the current coordinates of the PTZ camera.
[0038] The PTZ camera can have a communication connection with the client, and the PTZ control commands can be received by the PTZ camera from the user through the client. PTZ control commands are typically used to control the PTZ camera to rotate according to the user's needs (including horizontal and / or vertical rotation).
[0039] During a single gimbal control operation, there may be one or more gimbal control commands. These commands can be consecutive or intermittent, and no restrictions are imposed here.
[0040] In traditional methods, after receiving a PTZ control command, the PTZ camera needs to rotate to the target coordinates indicated by the PTZ control command. PTZ coordinates generally include the PTZ's horizontal and vertical spatial orientation coordinates, which will not be elaborated upon further. In addition, the PTZ control command can also indicate the PTZ camera's image acquisition parameters (such as focal length).
[0041] However, during the process of the gimbal rotating from the current coordinates to the target coordinates, its camera may capture images of low-value areas, thus collecting a large amount of useless information during the gimbal rotation control process.
[0042] Therefore, the PTZ control method of this application can determine whether the PTZ camera will capture an image of a low-value area during its rotation from the current coordinates to the target coordinates corresponding to the PTZ control command, based on low-value area information, PTZ control commands, and the current coordinates of the PTZ camera. Accordingly, it determines whether to adjust the process of the PTZ camera executing the PTZ control commands.
[0043] It should be noted that the embodiments in this application mainly illustrate a manual control application scenario where the user issues PTZ control commands through a client. However, the PTZ camera control method of this application is not actually limited to the automatic cruise process of a PTZ camera; similar applications can also be used. Further details are omitted here.
[0044] Step S130: If yes, then adjust the instruction execution process according to the preset control adjustment strategy.
[0045] Based on the steps described above, if it is determined that the execution process of the PTZ camera's control commands needs to be adjusted, a pre-set control adjustment strategy can be obtained to adjust the command execution process.
[0046] The control and adjustment strategies may include, but are not limited to: 1. Increase the rotation speed of the pan-tilt unit (PTZ) when it passes through low-value areas. This reduces the time the PTZ camera spends acquiring data from these areas, thus reducing the amount of image data captured.
[0047] 2. When the pan-tilt unit is about to pass through a low-value area, modify the pan-tilt unit's motion path (rotation path). This allows the pan-tilt camera to replan its motion path to avoid passing through the low-value area, thus preventing image acquisition from that area.
[0048] 3. Adjust the camera's focal length as the pan-tilt-zoom (PTZ) camera rotates through low-value areas. This allows the PTZ camera to reduce its focal length (enlarge the field of view) when passing through low-value areas, reducing the proportion of low-value areas in the captured image and capturing valuable content from other areas.
[0049] As can be seen, this application predetermines the field of view supported by the PTZ camera, and then constructs low-value areas based on a portion of the field of view, thereby obtaining low-value area information. Upon receiving a PTZ control command, it can determine whether the PTZ camera will capture images of the low-value areas when rotating in response to the PTZ control command, based on the low-value area information, the PTZ control command, and the current coordinates of the PTZ camera. This determines whether to adjust the PTZ camera's command execution process in response to the PTZ control command. If adjustment is needed, the command execution process is adjusted according to a preset control adjustment strategy, reducing image acquisition of low-value areas when the PTZ camera rotates in response to the PTZ control command. This minimizes invalid information acquired by the PTZ camera, improves the operating efficiency of the PTZ camera, and optimizes the user experience.
[0050] Based on the above embodiments, it should be noted that the PTZ camera control method of this application mainly includes a learning and mapping stage before formal application, and a real-time control and optimization stage during actual application.
[0051] The learning and mapping phases are illustrated for example.
[0052] For example, by controlling the PTZ camera to rotate and scan (image acquisition) in a preset mode (such as the self-learning mode after initial installation or the continuous learning mode during daily use), all images captured by the PTZ camera within its maximum supported field of view can be obtained.
[0053] The video stream (or image stream) is analyzed in real time using an onboard image recognition unit (such as an AI chip). The analysis process may include determining whether an area is a low-value region based on the image texture, depth information, and / or image content of each video frame.
[0054] When a low-value area is identified, the current spatial coordinates of the pan-tilt unit, such as the horizontal and vertical angles (which is equivalent to marking the low-value coordinates of the low-value area), the current focal length of the pan-tilt camera lens, and its corresponding field of view (FOV) range are recorded, thus obtaining the low-value area information.
[0055] Furthermore, the coordinates, focal length, and field of view parameters of all low-value areas captured by the PTZ camera can be stored to form a low-value area mapping table. This table essentially defines a "blind spot" map in the motion space of the PTZ camera. That is, when the PTZ camera moves to the corresponding low-value coordinates with the focal length in the low-value area mapping table, by adjusting its motion parameters and / or acquisition parameters, the low-value area can be quickly skipped (without acquiring images of the low-value area).
[0056] Optionally, the image acquisition device can also upload this low-value area mapping table to the server for storage. If the image acquisition device needs to be replaced due to damage or other reasons, the server can restore this low-value area mapping table to the new device at that location, thereby facilitating subsequent maintenance.
[0057] The low-value region mapping table can also store calibration images collected during the learning and mapping phases. Because the server may contain low-value region mapping tables for multiple locations, once a new device is positioned at a certain location, it can rotate and scan at that location to obtain the current environment image. By performing image matching processing (e.g., feature matching, corner matching, texture matching, etc.) between the current environment image and the calibration images of each location, the target location of the new device is determined from these locations. This leads to the acquisition of the low-value region mapping table corresponding to the target location.
[0058] The above example method can also be applied to the specific execution process of step S110 of this application to obtain the corresponding low-value area information, which will not be elaborated here.
[0059] It should be noted that if the PTZ camera does not have a recognition unit, the video stream can be sent to a backend server with which it has a communication connection for similar processing to obtain low-value area information, which will not be elaborated here.
[0060] Specifically, in the learning and mapping phase, for example, after the PTZ camera is installed, the user can trigger the "environment learning" function on the client's APP, so that the PTZ camera can automatically perform panoramic scanning and image acquisition (such as 360° horizontal rotation and 180° vertical rotation).
[0061] Furthermore, the lightweight CNN model built into the PTZ camera can analyze the captured video frames. If a low-value feature (such as "wall" or "ceiling") is identified in a video frame and the confidence level exceeds a confidence threshold (e.g., 90%), then that image region can be identified as a low-value region. Alternatively, based on the texture features of the video frame, image regions with uniform texture and lacking texture details can also be identified as low-value regions, etc., which will not be elaborated here.
[0062] Therefore, the PTZ camera system can record parameters such as Pan (horizontal angle), Tilt (vertical angle), and Zoom (focal length) at this moment to characterize the spatial orientation coordinates when the PTZ camera captures a low-value area, calculate the corresponding field of view, store it in the database, and obtain low-value area information.
[0063] Another example is the description of the real-time control and optimization phase.
[0064] In the user's manual control mode: the PTZ camera system can receive the user's PTZ control commands in real time, such as PTZ control via a mobile APP, and at the same time obtain the current spatial coordinates of the PTZ (current coordinates).
[0065] Prediction and Judgment: Compare the current coordinates with the low-value area information stored in the low-value area mapping table to predict whether the gimbal's movement trend and speed according to the gimbal control command are about to enter the pre-built low-value area (image of the low-value area is acquired).
[0066] Triggering and Execution: When it is determined that the PTZ is about to acquire an image of a low-value area, an optimization adjustment command is generated and executed. This optimization adjustment command can modify the control effect of the user's original PTZ control commands. By executing the optimization adjustment command, the execution process of the PTZ control commands can be adjusted.
[0067] The optimization and adjustment instructions can include, but are not limited to, the strategies described in the aforementioned embodiments: 1. increasing the rotation speed; 2. modifying the path; 3. changing the focal length, which will not be elaborated here.
[0068] Specifically, for ease of explanation, this implementation mainly takes the horizontal rotation of the gimbal as an example, so the coordinate changes in the vertical rotation direction can be ignored.
[0069] For example, in the real-time control and optimization phase, when the user controls the PTZ to continuously rotate to the right through the PTZ control panel, the system detects the current angle (current coordinates) of the PTZ in real time. It finds that the current angle is Pan=90°, and according to the low-value area mapping table, the low-value area information is displayed. The coordinate range from the first low-value coordinate Pan=100° to the second low-value coordinate Pan=120° is the low-value area (wall area).
[0070] Therefore, a preset adjustment strategy can be triggered when the gimbal rotates to coordinate Pan=95° (approaching the low-value region). The selected adjustment strategy can be as follows: Strategy A (Main Strategy): Immediately increase the gimbal rotation speed from the user-set 20° / s to 60° / s.
[0071] Strategy B (auxiliary strategy): At the same time, zoom the lens focal length from 10mm to 5mm (wide-angle end) to expand the field of view.
[0072] Therefore, the PTZ camera can rotate at high speed over low-value areas with a pan angle of 100° to 120°. Furthermore, due to the wider field of view, the PTZ camera may actually be able to capture other areas besides walls (such as high-value areas, corridor scenes, etc.) even at a pan angle of 118°.
[0073] Optionally, in low-value areas, discrete shooting points can be preset, and the images captured at these discrete points can be stitched together. Therefore, when a user views the recording, they can still see the corresponding captured footage when playing back to the low-value area.
[0074] When the system detects that the current coordinate Pan of the gimbal is greater than 120°, it can immediately restore the user-set rotation speed of 20° / s and return the focus control to the client, so as to continue to respond to the client's gimbal control commands.
[0075] Based on the above embodiments, this embodiment further explains step S120. Specifically, the method in step S120 for determining whether to adjust the execution process of the PTZ camera's PTZ control command based on low-value area information, PTZ control commands, and the current coordinates of the PTZ camera may include steps S121 to S122.
[0076] Step S121: Based on the PTZ control command, current coordinates, and low-value area information, predict whether the image acquired by the PTZ camera during command execution includes low-value areas.
[0077] The gimbal control command specifies the target coordinates to which the gimbal needs to rotate.
[0078] By combining the current coordinates with the target coordinates, the default rotation path (i.e. the range of coordinates that the gimbal needs to traverse) can be determined during the process of rotating from the current coordinates to the target coordinates.
[0079] Therefore, by combining the analysis with information on low-value areas, it can be determined whether the pan-tilt-zoom (PTZ) camera's field of view will pass through low-value areas during the rotation process (during command execution) (i.e., whether the image captured by the PTZ camera will include low-value areas).
[0080] Step S122: If yes, then determine the execution process of the adjustment instruction.
[0081] Based on the steps described above, if it is determined that the images captured by the PTZ camera during instruction execution include low-value areas.
[0082] Therefore, it is determined that the instruction execution process corresponding to the PTZ control command needs to be adjusted.
[0083] Based on the above embodiments, this embodiment further explains step S121. Specifically, the method in step S121 for predicting whether the image acquired by the PTZ camera during the execution of the command includes a low-value area based on the PTZ control command, the current coordinates, and the low-value area information may include steps S1211 to S1212.
[0084] Step S1211: Determine the range of coordinate changes of the PTZ camera during the execution of the command based on the PTZ control command and the current coordinates.
[0085] The gimbal control command specifies the target coordinates to which the gimbal needs to rotate. By comparing the target coordinates with the current coordinates, the range of coordinate changes the gimbal can be determined during the execution of this command.
[0086] In step S1212, in response to the low-value coordinates being within the range of coordinate changes, it is predicted that the image acquired by the PTZ camera includes the low-value region.
[0087] The low-value area information includes the low-value coordinates (such as the horizontal and vertical angles in the aforementioned embodiment) marked by the PTZ camera when it captures images of low-value areas.
[0088] Therefore, by analyzing whether the coordinate change range during the execution of this instruction includes these low-value coordinates (equivalent to determining whether the low-value coordinates are within the coordinate change range), it can be determined whether the pan-tilt camera will capture images of low-value areas during its rotation, that is, whether the images captured by the pan-tilt camera include low-value areas.
[0089] Specifically, if the low-value coordinates are within the range of coordinate changes, the image captured by the PTZ camera is determined to include the low-value area; if the low-value coordinates are not within the range of coordinate changes, the image captured by the PTZ camera is determined to not include the low-value area.
[0090] Optionally, when determining whether low-value coordinates are within the range of coordinate changes, one can compare and analyze all pre-calibrated low-value coordinates with the range of coordinate changes; or, one can search for low-value coordinates with corresponding focal length information from the low-value area information based on the focal length information of the PTZ camera during instruction execution, and compare and analyze them with the range of coordinate changes. No limitation is made here.
[0091] Among them, finding low-value coordinates corresponding to focal length information may include, but is not limited to: finding low-value coordinates with equal focal length information; or finding low-value coordinates where the focal length at calibration is greater than or equal to the focal length at instruction execution (the larger the focal length, the smaller the field of view; therefore, if there is a low-value region in a smaller field of view under the same coordinate, there will still be a low-value region in a larger field of view).
[0092] Based on the above embodiments, this embodiment further describes step S130. Specifically, the method for adjusting the instruction execution process according to a preset control adjustment strategy in step S130 may include steps S131 to S132.
[0093] This embodiment mainly illustrates the strategy of changing the focal length in the control adjustment strategy.
[0094] Step S131: Obtain the initial focal length of the PTZ camera when it executes the PTZ control command.
[0095] The initial focal length refers to the focal length when the gimbal begins to execute gimbal control commands (which is also equivalent to the initial field of view when the gimbal begins to execute gimbal control commands).
[0096] Step S132: In response to the current coordinates of the PTZ camera reaching the low-value coordinates of a low-value area during instruction execution, the initial focal length is reduced.
[0097] When the PTZ camera's current coordinates reach (or are about to reach) the low-value coordinates of a low-value area during the execution of instructions, the lens motor is controlled to reduce its initial focal length (equivalent to wide-angle processing).
[0098] The criteria for determining "about to be reached" can be set using a preset threshold. For example, the difference between the current coordinates and the low-value coordinates is less than the preset threshold, which will not be elaborated here.
[0099] It is understandable that the smaller the focal length, the larger the field of view. Therefore, when the current coordinates of the PTZ camera reach the low-value coordinates, and when the PTZ camera's field of view passes through the low-value area, because the increased field of view allows for the acquisition of more other areas, the low-value area only occupies a small portion of the image (that is, the proportion of invalid information in the image is reduced, and more valid information is introduced).
[0100] Therefore, images containing low-value regions acquired by PTZ cameras after reducing the initial focal length contain more effective information than images containing low-value regions acquired by traditional methods (based on the initial focal length). These images can be applied to more subsequent scenarios such as image detection and image analysis, which will not be elaborated here.
[0101] Based on the above embodiments, this embodiment further describes step S130. Specifically, the method for adjusting the instruction execution process according to a preset control adjustment strategy in step S130 may include steps S133 to S134.
[0102] This embodiment mainly illustrates the strategy of accelerating the rotation speed in the control adjustment strategy.
[0103] Step S133: Obtain the initial motion speed corresponding to the gimbal control command.
[0104] The initial focal length refers to the motor rotation speed when the gimbal begins to execute gimbal control commands.
[0105] Step S134: In response to the current coordinates of the PTZ camera reaching the low-value coordinates of a low-value area during the execution of the instruction, the initial motion speed is accelerated.
[0106] When the PTZ camera's current coordinates reach (or are about to reach) the low-value coordinates of a low-value area during the execution of instructions, the PTZ motor is controlled to accelerate its rotation speed, so that the PTZ camera's field of view quickly passes through the low-value area at a speed higher than that indicated by the PTZ control command.
[0107] This reduces the time required for PTZ cameras to capture images of low-value areas and the time users spend viewing those areas.
[0108] Optionally, in some application scenarios, in order to also capture low-value areas, preset points can be set in the low-value areas. When the PTZ camera reaches the preset point, it can capture an image to prevent the low-value area from being ignored.
[0109] Furthermore, it allows for the comparison of images acquired at preset locations at different times. For example, a first image captured at a preset location at a first moment can be compared with a second image captured at the same preset location at a second moment, where the second moment is later than the first moment.
[0110] If the second image shows significant changes compared to the first image, the "low-value area" rating for the area containing the preset point can be cancelled. This transforms the low-value area from an invalid area into a valid area.
[0111] The methods for determining whether there is a significant change between two images may include, but are not limited to: comparing the pixel difference between the two images at the same pixel location (or the same image area) with a preset pixel difference threshold; or comparing the differences in the image content of the two images by intelligent identification, etc., which are not limited here.
[0112] Based on the above embodiments, this embodiment further describes step S130. Specifically, the method for adjusting the instruction execution process according to a preset control adjustment strategy in step S130 may include steps S135 to S136.
[0113] This embodiment mainly illustrates the strategy of modifying the path in the control adjustment strategy.
[0114] Step S135: Obtain the initial motion path corresponding to the gimbal control command.
[0115] The initial motion path refers to the rotation path (which may include horizontal rotation and / or vertical rotation) planned when the gimbal executes the gimbal control command.
[0116] For ease of understanding, this embodiment uses a horizontal rotation path as an example.
[0117] For example, refer to Figure 2 As shown, Figure 2 This is an exemplary path replanning diagram in the PTZ camera control method of this application.
[0118] Step S136: In response to the current coordinates of the PTZ camera reaching the low-value coordinates of the low-value area during the instruction execution process, the initial motion path is replanned based on the low-value coordinates.
[0119] When the PTZ camera is executing a command and its current coordinates reach (or are about to reach) the low-value coordinates of a low-value area, a new path is planned based on the current coordinates, the target coordinates, and the low-value coordinates. This allows the PTZ camera to avoid the low-value coordinates while rotating from the current coordinates to the target coordinates along the replanned path.
[0120] Therefore, by controlling the pan-tilt camera to rotate according to the replanned path, the pan-tilt camera can reduce or avoid capturing data in low-value areas.
[0121] Specifically, for example, if the default rotation path (initial motion path) planned based on the current coordinates and the target coordinates is a horizontal rotation, then low-value coordinates can be introduced as the coordinates that the replanned path needs to detour around (such as a circular arc) during path replanning. Subsequently, the PTZ camera can be controlled to rotate along the new trajectory (replanned path).
[0122] Optionally, when the PTZ camera rotates on the arc, it can also refer to the preset point setting method of the aforementioned embodiment to capture images according to preset discrete points. Subsequently, the images captured at these discrete points can be stitched with other image frames to form a continuous shooting scene, thereby avoiding the lack of image display in low-value areas.
[0123] Based on the above embodiments, this embodiment should also explain that the multiple control adjustment strategies provided in the foregoing embodiments, such as 1. increasing the rotation speed; 2. modifying the path; and 3. changing the focal length, can be adjusted by selecting at least one strategy during the specific implementation process. That is, in some application scenarios, all strategies can be used to adjust the instruction execution process, which is not limited here.
[0124] Based on the above embodiments, this embodiment further describes the method after step S130. Specifically, the method after adjusting the instruction execution process according to the preset control adjustment strategy in step S130 may further include steps S140 to S150.
[0125] The foregoing embodiments mainly described the control adjustment strategies that can be executed when a PTZ camera is about to rotate into a low-value area. This embodiment mainly describes the restoration process when the current coordinates of the PTZ camera are far away from the low-value coordinates after the instruction execution process has been adjusted (that is, when the PTZ camera's field of view leaves the low-value area, its instruction execution process needs to be restored).
[0126] Step S140: In response to the low-value coordinates of the PTZ camera being far from the low-value area during the execution of the instruction, the initial control parameters of the PTZ control instruction are obtained.
[0127] If the current coordinates of the PTZ camera move far away from the low-value coordinates of the low-value area during command execution, it indicates that the PTZ camera's field of view is about to move away from the low-value area. Therefore, the initial control parameters corresponding to this PTZ control command can be obtained, that is, the PTZ control parameters before the command execution process is adjusted.
[0128] Once the current coordinates of the PTZ camera leave the low-value area, controlling the PTZ to rotate according to the initial control parameters can restore normal PTZ control effects (such as restoring normal rotation speed, focal length, and trajectory), and subsequent PTZ control commands issued by the user can be executed normally.
[0129] It should be noted that an image region can be represented by the coordinates of a geometric center of the image region and the distance from the geometric center to the boundary of the region, or by the coordinates of at least two boundary points (or corner points) of the image region.
[0130] Therefore, a low-value area can be determined by a low-value coordinate and the distance from which the pan-tilt unit (the field of view) rotates to the boundary of the low-value area, or by multiple low-value coordinates, which will not be elaborated here.
[0131] In other words, when determining whether the pan-tilt camera's field of view enters or leaves a low-value area, the reference low-value coordinates can be the same or different, which will not be elaborated here.
[0132] For example, during the pre-construction of low-value regions, two low-value coordinates (PTZ coordinates) can be selected from the coordinates of the images containing the low-value regions acquired by the PTZ camera to determine the boundaries of the low-value regions. When the PTZ camera rotates between these two low-value coordinates, it will acquire images of the corresponding low-value regions.
[0133] Similarly, during the rotation of the gimbal, when its current coordinates approach one of the low-value coordinates, it indicates that the gimbal's field of view is about to enter a low-value area; when its current coordinates approach another low-value coordinate, it indicates that the gimbal's field of view is about to leave that low-value area.
[0134] Step S150: Control the pan-tilt camera to move to the target coordinates corresponding to the pan-tilt control command according to the initial control parameters.
[0135] Based on the steps described above, once it is determined that the current coordinates of the PTZ camera have left the low-value area, the PTZ camera can be controlled to move to the target coordinates corresponding to the PTZ control command in accordance with the initial control parameters.
[0136] The foregoing embodiments are illustrated by way of example. See also... Figure 3 As shown, Figure 3 This is an exemplary schematic diagram of the field of view acquisition effect in the PTZ camera control method of this application. Figure 3 The image shown is unfolded and displayed as the pan-tilt-zoom camera rotates horizontally to the right.
[0137] In this setup, the pan-tilt camera's field of view at the current coordinates can be view A. The pan-tilt camera receives a control command that requires it to rotate to the right to reach the target coordinates, ultimately capturing view E. Views C and D are images captured by the pan-tilt camera in a low-value area. Views C and D can be a single low-value area, defined by two low-value coordinates (a first low-value coordinate and a second low-value coordinate).
[0138] Specifically, the normal execution of the PTZ control command is as follows: the PTZ camera rotates to the right at the specified initial rotation speed V, scanning the area of screen A. Then it continues to rotate to the right, capturing the area of screen B; until the PTZ camera's field of view (or current coordinates) reaches the left boundary of screen C, which is the starting position of the left boundary of the low-value area (the first low-value coordinate).
[0139] At this point, the focal length can be reduced (wide-angle processing), which expands the field of view (the rotation speed can also be increased, such as by 3 times the initial rotation speed, i.e., 3V). Select preset discrete points in the low-value area for shooting to obtain images C and D. Optionally, the images of images C and D can be stitched together to avoid missing any images.
[0140] Furthermore, as the PTZ camera continues to rotate to the right until its field of view (or current coordinates) reaches the right boundary of image D, which is the termination position of the right boundary of the low-value area (the second low-value coordinate), the image magnification (focal length) and rotation speed used before the PTZ camera's field of view entered the low-value areas C and D can be restored.
[0141] Finally, the PTZ camera continues to rotate to the right until it reaches the target coordinates, and performs image acquisition according to the acquisition parameters indicated by the PTZ control command, resulting in image E.
[0142] Based on the above embodiments, this embodiment describes the method prior to step S110. Specifically, the method prior to obtaining the low-value region information of the pre-constructed low-value region in step S110 may further include steps S010 to S030.
[0143] Step S010: Obtain the initial image captured by the PTZ camera and the initial coordinates when the PTZ camera captures each frame of the initial image.
[0144] Step S020: Identify images containing low-value regions in each initial image to obtain low-value images.
[0145] Step S030: Determine the initial coordinates corresponding to the low-value image as low-value region information.
[0146] In conjunction with the foregoing embodiments, the specific implementation process of this embodiment can be referred to the examples of the learning and mapping stages in the foregoing embodiments, which will not be repeated here.
[0147] It should be further noted that the executor of the PTZ camera control method can be a PTZ camera control device. For example, the PTZ camera control method can be executed by a terminal device, a server, or other processing devices. The terminal device can be a user equipment (UE), computer, mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, vehicle-mounted device, wearable device, etc. In some possible implementations, the PTZ camera control method can be implemented by a processor calling computer-readable instructions stored in memory.
[0148] Figure 4 This is a block diagram illustrating a pan-tilt camera control device according to an exemplary embodiment of this application. Figure 4 As shown, the exemplary pan-tilt camera control device 400 includes: an acquisition module 410, a judgment module 420, and an adjustment module 430. Specifically: The acquisition module 410 is used to acquire low-value area information of a pre-constructed low-value area, which is a part of the field of view of the pan-tilt camera.
[0149] The judgment module 420 is used to respond to the received PTZ control command and, based on the low-value area information, the PTZ control command, and the current coordinates of the PTZ camera, determine whether to adjust the PTZ camera's command execution process for the PTZ control command.
[0150] The adjustment module 430 is used to adjust the instruction execution process according to a preset control adjustment strategy if the condition is met.
[0151] In this exemplary PTZ camera control device, by pre-determining the field of view supported by the PTZ camera, and then constructing a low-value region based on a portion of the field of view, low-value region information can be obtained. Upon receiving a PTZ control command, the device can determine whether the PTZ camera will capture an image of the low-value region when rotating in response to the PTZ control command, based on the low-value region information, the PTZ control command, and the current coordinates of the PTZ camera. This determines whether to adjust the PTZ camera's command execution process. If adjustment is needed, the command execution process is adjusted according to a preset control adjustment strategy, reducing image acquisition of the low-value region when the PTZ camera rotates in response to the PTZ control command. This minimizes invalid information acquired by the PTZ camera, improves the operating efficiency of the PTZ camera, and optimizes the user experience.
[0152] It should be noted that the apparatus and method provided in the above embodiments belong to the same concept, and the specific ways in which each module and unit performs operations have been described in detail in the method embodiments, and will not be repeated here. In practical applications, the apparatus provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the apparatus can be divided into different functional modules to complete all or part of the functions described above, and this is not a limitation.
[0153] The functions of each module can be found in the implementation example of the PTZ camera control method, and will not be repeated here.
[0154] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. The electronic device 100 includes a memory 101 and a processor 102. The processor 102 is used to execute program instructions stored in the memory 101 to implement the steps in any of the above embodiments of the pan-tilt camera control method. In a specific implementation scenario, the electronic device 100 may include, but is not limited to, a microcomputer or a server. In addition, the electronic device 100 may also include mobile devices such as laptops and tablets, which are not limited here.
[0155] Specifically, processor 102 controls itself and memory 101 to implement the steps in any of the above-described embodiments of the pan-tilt camera control method. Processor 102 can also be referred to as a CPU (Central Processing Unit). Processor 102 may be an integrated circuit chip with signal processing capabilities. Processor 102 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 102 can be implemented using integrated circuit chips.
[0156] In this exemplary electronic device, by pre-determining the field of view supported by the PTZ camera, and then constructing a low-value region based on a portion of the field of view, low-value region information can be obtained. Upon receiving a PTZ control command, the system can determine whether the PTZ camera will capture an image of the low-value region when rotating in response to the PTZ control command, based on the low-value region information, the PTZ control command, and the current coordinates of the PTZ camera. This determines whether to adjust the PTZ camera's command execution process. If adjustment is needed, the command execution process is adjusted according to a preset control adjustment strategy, reducing image capture of the low-value region when the PTZ camera rotates in response to the PTZ control command. This minimizes invalid information captured by the PTZ camera, improves the operating efficiency of the PTZ camera, and optimizes the user experience.
[0157] Please see Figure 6 , Figure 6 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application. The computer-readable storage medium 110 stores program instructions 111 that can be executed by a processor. The program instructions 111 are used to implement the steps in any of the above embodiments of the pan-tilt camera control method.
[0158] In this exemplary storage medium, by running the program instructions stored in the storage medium, the field of view supported by the PTZ camera is predetermined. Then, a low-value region is constructed based on a portion of the field of view, thereby acquiring low-value region information. Upon receiving a PTZ control command, the system can determine whether the PTZ camera will capture images of the low-value region when rotating in response to the command, based on the low-value region information, the PTZ control command, and the PTZ camera's current coordinates. This determines whether to adjust the PTZ camera's command execution process. If adjustment is needed, the process is adjusted according to a preset control adjustment strategy, reducing image acquisition of low-value regions when the PTZ camera rotates in response to the command. This minimizes invalid information acquired by the PTZ camera, improves its operational efficiency, and optimizes the user experience.
[0159] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0160] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0161] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0162] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes 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.
Claims
1. A method for controlling a PTZ camera, characterized in that, The method includes: Obtain low-value area information from a pre-constructed low-value area, wherein the low-value area is a portion of the field of view captured by the PTZ camera; In response to a received PTZ control command, based on the low-value area information, the PTZ control command, and the current coordinates of the PTZ camera, it is determined whether to adjust the PTZ camera's command execution process for the PTZ control command. If so, the instruction execution process will be adjusted according to the preset control adjustment strategy.
2. The method according to claim 1, characterized in that, The step of determining whether to adjust the execution process of the PTZ camera's response to the PTZ control command based on the low-value area information, the PTZ control command, and the current coordinates of the PTZ camera includes: Based on the PTZ control command, the current coordinates, and the low-value area information, predict whether the image captured by the PTZ camera during the execution of the command includes the low-value area; If so, then it is determined that the execution process of the instruction should be adjusted.
3. The method according to claim 2, characterized in that, The low-value area information includes the low-value coordinates marked by the PTZ camera when it acquires an image of the low-value area. The step of predicting whether the image acquired by the PTZ camera during the execution of the command includes the low-value area, based on the PTZ control command, the current coordinates, and the low-value area information. Based on the PTZ control command and the current coordinates, determine the range of coordinate changes of the PTZ camera during the execution of the command; In response to the low-value coordinates being within the range of coordinate changes, it is predicted that the image captured by the PTZ camera includes the low-value region.
4. The method according to claim 1, characterized in that, The adjustment process of the instruction execution according to the preset control adjustment strategy includes: Obtain the initial focal length of the PTZ camera when it executes the PTZ control command; In response to the current coordinates of the PTZ camera reaching the low-value coordinates of the low-value region during the execution of the instruction, the initial focal length is reduced.
5. The method according to claim 1, characterized in that, The adjustment process of the instruction execution according to the preset control adjustment strategy includes: Obtain the initial motion speed corresponding to the gimbal control command; In response to the current coordinates of the PTZ camera reaching the low-value coordinates of the low-value area during the execution of the instruction, the initial motion speed is accelerated.
6. The method according to claim 1, characterized in that, The adjustment process of the instruction execution according to the preset control adjustment strategy includes: Obtain the initial motion path corresponding to the gimbal control command; In response to the current coordinates of the PTZ camera reaching the low-value coordinates of the low-value area during the execution of the instruction, the initial motion path is replanned based on the low-value coordinates.
7. The method according to claim 1, characterized in that, After adjusting the instruction execution process according to the preset control adjustment strategy, the method further includes: In response to the low-value coordinates of the PTZ camera being far from the low-value area during the execution of the instruction, the initial control parameters of the PTZ control instruction are obtained. The PTZ camera is controlled to move to the target coordinates corresponding to the PTZ control command based on the initial control parameters.
8. The method according to claim 1, characterized in that, Before obtaining the low-value region information of the pre-constructed low-value region, the method further includes: Obtain the initial image captured by the PTZ camera and the initial coordinates when the PTZ camera captures each frame of the initial image; The low-value images are obtained by identifying the low-value regions in each initial image; The initial coordinates corresponding to the low-value image are determined as the low-value region information.
9. An electronic device, characterized in that, The method includes a memory and a processor, the processor being configured to execute program instructions stored in the memory to implement the method according to any one of claims 1 to 8.
10. A computer-readable storage medium having program instructions stored thereon, characterized in that, When the program instructions are executed by the processor, they implement the method described in any one of claims 1 to 8.