A high-precision PTZ camera active tracking control method
By performing threshold determination and protocol mapping on the four-dimensional joystick input signal of the PTZ camera, combined with buffering and status feedback mechanisms, the problems of joystick wear and instruction queue accumulation were solved, achieving high-precision and smooth camera control and improving the reliability and long-term stability of the equipment.
Patent Information
- Application Number
- CN202511378951.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-25
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2045-09-25
AI Technical Summary
The existing control method of PTZ cameras has problems such as joystick wear leading to failure to return to the center position, excessively high input signal precision causing misoperation, and instruction queue accumulation during rapid switching, which affect shooting effect and equipment reliability.
By acquiring the four-dimensional joystick input signal, threshold determination and normalization are performed, a protocol mapping and caching mechanism is introduced, invalid stop commands are removed, and a closed-loop control is performed in conjunction with a status feedback mechanism to ensure accurate command matching and camera status feedback.
It improves the control precision and smoothness of the PTZ camera, reduces the probability of misoperation, extends the lifespan of the joystick, and ensures stability and reliability in high-intensity scenarios.
Smart Images

Figure CN120871634B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image communication, and in particular to an active tracking control method of a high-precision PTZ camera. BACKGROUND
[0002] PTZ (Pan-Tilt-Zoom, PTZ) cameras are widely used in TV studios, live events, e-commerce live streaming, etc. The core advantage of PTZ cameras is that they can remotely adjust the horizontal, vertical and zoom of the camera, enabling multi-camera shooting and flexible switching. In the early days, physical buttons or simple joysticks were used to control the direction and zoom, and later touch control based on mobile phones, tablets or web pages was introduced to make the operation more intuitive. However, in high-intensity live streaming scenarios, touch control has problems such as inability to operate blindly, response delay and accidental triggering. Some high-end devices try to introduce a joystick device in the control terminal to achieve a gamepad-like intuitive control, but are limited by mechanical precision and lifespan, and still have reliability issues. The existing control methods of PTZ cameras have exposed many defects in practical applications:
[0003] Firstly, the joystick may not return to the center position due to wear, spring rebound force decay or structural tolerance after long-term use, causing the camera to fail to trigger the stop command correctly and increasing the risk of continuous rotation or even damaging the motor.
[0004] Secondly, the joystick input signal has high precision, but the PTZ protocol has limited actual speed levels, so slight input deviations may be misidentified as valid actions, increasing the probability of accidental operation.
[0005] Thirdly, when the user quickly switches directions or operates the zoom at the same time, the joystick signal returning to the center will trigger unnecessary stop commands. Due to network delays, the command queue may be stacked, causing the camera image to freeze or move discontinuously, affecting the shooting effect. SUMMARY
[0006] Therefore, it is necessary to provide an active tracking control method for a high-precision PTZ camera to solve at least one of the above technical problems.
[0007] To achieve the above-mentioned purpose, an active tracking control method for a high-precision PTZ camera is provided, which is applied to a PTZ camera including a four-dimensional joystick. The method includes the following steps:
[0008] Step S1: Obtain a RockerCmd object; based on the RockerCmd object, determine the speed values of each axis of the four-dimensional joystick to obtain a modified joystick input value;
[0009] Step S2: protocol mapping is performed on the modified joystick input value, and the modified joystick input value is cached to obtain a command queue;
[0010] Step S3: removing invalid stop instructions in the instruction queue to obtain an optimized continuous control instruction sequence; collecting time and direction of the optimized continuous control instruction sequence to obtain a modified control instruction set;
[0011] Step S4: driving the PTZ camera based on the modified control instruction set, and collecting the execution state of the PTZ camera to obtain camera state feedback information.
[0012] The present application avoids the problem of not returning to the middle position caused by rocker wear, structural tolerance or rebound force attenuation by threshold judgment and normalization processing of the rocker input signal, thereby preventing the risk of continuous rotation or inability to stop of the camera, and prolonging the service life of the rocker. By introducing a protocol mapping and caching mechanism in the instruction generation link, the input signal can be accurately matched with the speed gear supported by the PTZ camera, avoiding slight shaking from being recognized as an effective action, and reducing the probability of misoperation. By adding logical analysis and time direction judgment in the instruction processing link, redundant stop instructions caused by rapid switching or zooming operations can be effectively removed, preventing instructions from accumulating in network transmission, and ensuring the motion continuity and smoothness of the camera. By introducing a state feedback mechanism in the execution stage, the real-time working state of the camera can be collected and fed back to the control end, realizing closed-loop control, and further improving the stability and reliability of the overall control system. In summary, the method significantly improves the fault tolerance, smoothness and long-term reliability of the control while ensuring high-precision control, meeting the actual needs of television studios, live events and e-commerce live streaming for active tracking control of PTZ cameras in high-intensity scenarios. BRIEF DESCRIPTION OF DRAWINGS
[0013] Other features, objects and advantages of the present application will become more apparent from the following detailed description of non-limiting embodiments made with reference to the accompanying drawings:
[0014] Fig. 1 A step flowchart of the active tracking control method of a high-precision PTZ camera according to the present application;
[0015] Fig. 2 A control logic diagram of an embodiment of the present application;
[0016] Fig. 3 An instruction queue diagram of an embodiment of the present application;
[0017] Fig. 4 A physical connection diagram of an embodiment of the present application. DETAILED DESCRIPTION
[0018] The technical method of the present application will be described clearly and completely below in conjunction with the drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0019] In addition, the drawings are only schematic illustrations of the present application and are not necessarily drawn to scale. Identical reference signs in the drawings represent identical or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities, which do not necessarily have to correspond to physically or logically independent entities. The functional entities can be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different network and / or processor methods and / or microcontroller methods.
[0020] It should be understood that although the terms "first", "second" and the like can be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of the exemplary embodiments, a first element can be referred to as a second element, and similarly a second element can be referred to as a first element. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0021] To achieve the above-mentioned purpose, please refer to Figs. 1 to 4 The present application provides an active tracking control method of a high-precision PTZ camera, which is applied to a PTZ camera comprising a four-dimensional rocker. The method comprises the following steps:
[0022] Step S1: Obtain a RockerCmd object; determine the speed values of each axis on the four-dimensional rocker based on the RockerCmd object to obtain a modified rocker input value;
[0023] Step S2: Protocol map the modified rocker input value and cache it to obtain an instruction queue;
[0024] Step S3: Remove invalid stop instructions in the instruction queue to obtain an optimized continuous control instruction sequence; collect the time and direction of the optimized continuous control instruction sequence to obtain a modified control instruction set;
[0025] Step S4: Drive the PTZ camera based on the modified control instruction set and collect the execution state of the PTZ camera to obtain camera state feedback information.
[0026] Preferably, step S1 comprises the following steps:
[0027] Step S11: Collecting the X-axis, Y-axis, Z-axis, T-axis direction input signals of the four-dimensional rocker, obtaining a RockerCmd object;
[0028] Step S12: Based on the RockerCmd object, decomposing the axis input signals into X-axis speed value, Y-axis speed value, Z-axis speed value and T-axis speed value, obtaining the original speed data set;
[0029] Step S13: Comparing the original speed data set with the preset minimum speed threshold, obtaining the filtered speed value set;
[0030] Step S14: Zero-value normalization processing on the filtered speed value set, obtaining the corrected rocker input value.
[0031] In the embodiment of the application, the four-dimensional rocker collecting device configured on the PTZ camera control terminal collects the input signals of the rocker in the X-axis, Y-axis, Z-axis and T-axis direction in real time. The voltage signal value range is limited between 0 and 255, and the collection cycle is limited to 10 milliseconds. The collected voltage signal is converted into digital quantity by an analog-digital conversion circuit and stored as a RockerCmd object. The RockerCmd object includes a unique identifier, a control timestamp, a switch state and each axis input signal value. The RockerCmd object is called in the subsequent step S12. Based on each axis input signal in the RockerCmd object, the corresponding values of the X-axis, Y-axis, Z-axis and T-axis are read and divided to form an original speed data set containing four values. Each value in the original speed data set is in the range of 0 to 255. The original speed data set is used as comparison data in the subsequent step S13. Each value in the original speed data set is compared with the preset minimum speed threshold one by one. The calculation method of the minimum speed threshold MinPTZAny is 255 divided by the number of speed gears supported by the protocol and then divided by 2. When the protocol is VISCA protocol and the maximum number of speed gears is 7, the minimum speed threshold MinPTZAny is limited to 18. The comparison method is: when the input value of any axis is less than 18, the value of the axis is determined to be invalid and is set to zero; when the input value is greater than or equal to 18, the value is kept unchanged. The filtered speed value set is obtained after the above processing. The filtered speed value set is used as input in the subsequent step S14. The zero-value normalization processing is performed on the filtered speed value set. The rule of the zero-value normalization processing is: the axis with a value equal to zero in the set is directly kept as zero, and the value greater than zero in the set is maintained as the original value, thereby forming the corrected rocker input value. The corrected rocker input value contains the X-axis speed value, Y-axis speed value, Z-axis speed value and T-axis speed value after threshold filtering and normalization processing. The corrected rocker input value is used as an input parameter in the subsequent protocol mapping and instruction caching operation of step S2, and is used to generate a control instruction conforming to the PTZ control protocol.
[0032] Preferably, step S2 comprises the following steps:
[0033] Step S21: parsing the modified joystick input value into an X-axis speed value, a Y-axis speed value, a Z-axis speed value, and a T-axis speed value to obtain a parsed speed parameter set;
[0034] Step S22: performing PTZ control protocol mapping on the axis speed values based on the parsed speed parameter set to obtain a control instruction set;
[0035] Step S23: packaging the control instruction set to obtain a control instruction object;
[0036] Step S24: caching the control instruction object to obtain a thread-safe instruction queue.
[0037] In the embodiment, the modified joystick input value obtained in step S14 is input into a parsing module. The parsing module reads the four values contained in the modified joystick input value, and labels them as an X-axis speed value, a Y-axis speed value, a Z-axis speed value, and a T-axis speed value, respectively. The parsing result is output in the form of an array and stored as a parsed speed parameter set. The parsed speed parameter set contains four values, and the value range is limited to 0 to 255. The parsed speed parameter set is called in subsequent step S22. Based on the parsed speed parameter set, PTZ control protocol mapping is performed on the axis speed values. The mapping rule is defined as follows: when the VISCA control protocol is used, the speed gear of the PTZ camera is at most 7 gears. Therefore, the input value range of 0 to 255 is equally divided into 7 intervals, and each interval corresponds to a speed gear. For example, when the X-axis speed value is in the interval [0, 36], it corresponds to gear 1, when it is in the interval [37, 72], it corresponds to gear 2, and so on until gear 7. The four speed values after mapping are recombined to form a control instruction set. The control instruction set contains the target speed gear numbers of the X-axis, Y-axis, Z-axis, and T-axis. The control instruction set is input in subsequent step S23. The control instruction set is packaged. The packaging process includes combining the control instruction set with a unique instruction identifier, a timestamp, protocol header information, and a check code to generate a data structure that meets the communication requirements of the PTZ camera. The data structure is defined as a control instruction object. The control instruction object ensures that complete control information is included. The control instruction object is input in subsequent step S24. The control instruction object is stored in a concurrent cache container implemented based on a linked list structure. The container is defined as a thread-safe instruction queue. The thread safety mechanism is implemented through lock separation and unbounded first-in-first-out strategy, which ensures that multiple instruction objects can enter the queue in order without conflict in a high-frequency control environment. The thread-safe instruction queue is input in step S3 as an optimized continuous control instruction sequence.
[0038] Preferably, removing the invalid stop instruction in the instruction queue in step S3 comprises:
[0039] traversing the instruction queue and extracting instruction data to obtain an instruction sequence;
[0040] performing logical analysis on the instruction sequence to obtain an invalid stop instruction set;
[0041] removing the invalid stop instruction set in the instruction sequence to obtain an optimized continuous control instruction sequence.
[0042] In the embodiment of the application, first, the thread safety instruction queue obtained in step S24 is subjected to a traversal operation, the traversal tool is an iterator based on a linked list structure, the traversal order is performed according to the first-in first-out rule, a complete instruction sequence is obtained, each element in the instruction sequence is a control instruction object, and contains a unique identifier, a protocol parameter and an execution type, wherein the execution type is limited to a move instruction or a stop instruction; then, logical analysis is performed on the instruction sequence, when the time stamp of a stop instruction and the time stamp of an adjacent previous move instruction have a difference less than 500 milliseconds, and the direction information of the stop instruction is inconsistent with the direction information of a subsequent move instruction, the stop instruction is determined to be invalid, the comparison method of the direction information is to compare the speed signs of the X axis, the Y axis and the Z axis, for example, when the X axis speed of the previous move instruction is a positive value and the X axis speed of the subsequent move instruction is a negative value, it is determined that the direction is switched; all the stop instructions determined according to the above rule form an invalid stop instruction set, which is used as a removal object in subsequent operations; finally, a removal operation is performed on the instruction sequence, the instruction identifiers in the invalid stop instruction set are traversed and the corresponding control instruction objects in the instruction sequence are deleted one by one, after the deletion operation is completed, an optimized continuous control instruction sequence is formed, the control instruction objects contained in the optimized continuous control instruction sequence are all valid move instructions and reasonable stop instructions, and the optimized continuous control instruction sequence will be used as an input for acquisition time and direction determination in subsequent steps.
[0043] Preferably, the logical analysis on the instruction sequence comprises:
[0044] performing stop instruction screening on the instruction sequence to obtain a stop instruction set;
[0045] comparing adjacent move instructions and stop instructions based on the instruction sequence to obtain direction change information;
[0046] calculating the time difference between the stop instruction and the adjacent move instruction to obtain time interval data;
[0047] performing invalidity determination based on the stop instruction set, the direction change information and the time interval data to obtain an invalid stop instruction set.
[0048] In the embodiment of the present application, first, the instruction sequence obtained in step S31 is subjected to stop instruction screening. The screening method is to traverse each control instruction object in the instruction sequence, and determine whether it is a stop instruction by reading its execution type field. When the execution type field is marked as "0", it is determined to be a stop instruction. All control instruction objects meeting the condition are stored in a new data set, which is defined as a stop instruction set. The stop instruction set is used as one of the inputs for invalidity determination in the subsequent steps. Then, the adjacent movement instructions and stop instructions are compared based on the instruction sequence. The speed field values of adjacent control instruction objects are read. The speed field values correspond to the direction values of X-axis, Y-axis and Z-axis respectively. When the speed value of a movement instruction on a certain axis is positive and the speed value of the movement instruction after the stop instruction on the same axis is negative, it is determined that the direction has changed. The direction change is stored as direction change information, which is used as one of the inputs for invalidity determination in the subsequent steps. Next, the time difference between the stop instruction and the adjacent movement instruction is calculated. The time stamp fields in the stop instruction object and its adjacent previous movement instruction object are read, and the time interval is obtained by the difference between the two. When the time interval is less than 500 milliseconds, it is recorded as an abnormal interval. The calculation result is stored as time interval data. The time interval data is used as one of the inputs for invalidity determination in the subsequent steps. Finally, invalidity determination is performed based on the stop instruction set, the direction change information and the time interval data. When the stop instruction meets the direction change condition and the corresponding time interval data is less than 500 milliseconds, the stop instruction is marked as invalid and stored in a new set, which is defined as an invalid stop instruction set. The invalid stop instruction set is used as the input for removal operation in step S33.
[0049] Preferably, the invalidity determination based on the stop instruction set, the direction change information and the time interval data comprises:
[0050] Screening based on the stop instruction set and the direction change information obtains a subset of stop instructions with unmatched directions;
[0051] Comparing the subset of stop instructions with unmatched directions with the time interval data obtains a subset of stop instructions with insufficient time threshold values;
[0052] Performing validity filtering on the subset of stop instructions with insufficient time threshold values obtains an invalid stop instruction candidate set;
[0053] Performing set merging on the invalid stop instruction candidate set obtains the invalid stop instruction set.
[0054] In the embodiment of the present application, first, the stop instruction set is screened based on the direction change information. The screening method is to read each control instruction object in the stop instruction set one by one, and compare the corresponding mark field in the direction change information. When the mark field is "inconsistent", it indicates that the stop instruction and the adjacent movement instruction direction do not match. Such stop instructions are stored in a new data set, which is defined as the stop instruction subset with direction mismatch. Then, the stop instruction subset with direction mismatch is compared with the time interval data. The time stamp field in the stop instruction subset with direction mismatch is read and matched with the corresponding time difference value in the time interval data. When the time difference is less than 500 milliseconds, the stop instruction is marked and stored in a new set, which is defined as the stop instruction subset with insufficient threshold value. Then, the stop instruction subset with insufficient threshold value is filtered for effectiveness. It is checked whether each stop instruction in the subset still retains the same direction component within the speed value interval of the adjacent movement instruction. When the condition is not met, the stop instruction is directly determined to be invalid and added to the candidate set. Finally, the invalid stop instruction candidate set is obtained. Finally, the invalid stop instruction candidate set is merged. All invalid stop instructions marked in the candidate set are reordered according to the time stamp sequence and stored in a new set. The new set is the invalid stop instruction set. The invalid stop instruction set will be directly input to the removal operation in step S33, used to delete the corresponding invalid instruction object in the instruction sequence.
[0055] Preferably, the step S3 of collecting the optimized continuous control instruction sequence includes:
[0056] The optimized continuous control instruction sequence is time-resolved to obtain an instruction collection time data set.
[0057] The direction of the optimized continuous control instruction sequence is determined based on the instruction collection time data set to obtain a direction determination result.
[0058] The optimized continuous control instruction sequence and the direction determination result are merged into a corrected control instruction set.
[0059] In the embodiment of the present application, firstly, the time of the optimized continuous control instruction sequence is analyzed, the analysis method is to read the time stamp field of each control instruction object in the sequence in turn, and the time difference value of adjacent control instruction objects is calculated in milliseconds, the calculation method of the time difference value is to subtract the time stamp of the previous instruction from the time stamp of the next instruction, and all the calculation results are stored as instruction collection time data set, which is used as a time reference in subsequent direction determination; then, the direction determination is performed based on the optimized continuous control instruction sequence and the instruction collection time data set, the speed component symbols of adjacent two control instruction objects are compared, wherein the X-axis, Y-axis and Z-axis speed values are limited between-127 and +127, when it is found that the speed symbols of adjacent two control instruction objects in a certain axis are opposite and the time difference value is less than 500 milliseconds, the direction change of the axis is marked as effective reverse switching, otherwise it is marked as keeping the direction unchanged, all direction comparison results are stored as direction determination results, and the direction state of each instruction in each axis is listed in the direction determination results; finally, the optimized continuous control instruction sequence and the direction determination results are combined, a direction state field is added to the original control instruction object structure and the corresponding direction determination results are filled in, while the original speed parameter and time stamp data are retained, and after the combination, a modified control instruction set is formed, which is used as the input of the PTZ camera driving in the subsequent step S4, so as to ensure that the camera can execute actions according to the modified continuous instructions when the direction is quickly switched.
[0060] Preferably, step S4 comprises the following steps:
[0061] Step S41: analyzing the modified control instruction set to obtain a driving instruction object;
[0062] Step S42: sending the driving instruction object and receiving an acknowledgement signal to obtain an execution trigger signal;
[0063] Step S43: driving the PTZ camera based on the execution trigger signal to obtain a camera execution action result;
[0064] Step S44: monitoring the camera execution action result to obtain camera execution state data;
[0065] Step S45: performing conversion processing based on the camera execution state data to obtain camera state feedback information.
[0066] In the embodiment of the present application, the modified control instruction set generated in step S3 is parsed, the parsing operation is to read the speed parameter, direction state and timestamp field in the control instruction object one by one, and the protocol identification field is combined for reorganization to generate a data structure containing a complete protocol header, protocol body and check bit, which is defined as a drive instruction object, which ensures that each instruction conforms to the format requirements of the PTZ camera communication protocol; the drive instruction object is input to the sending module, the sending module encodes the drive instruction object into a byte stream data packet, and transmits it to the PTZ camera through a TCP-based network channel, the transmission time is limited to a maximum delay of not more than 300 milliseconds, and the data packet returns an acknowledgement frame after sending is completed, the acknowledgement frame is parsed to generate an execution trigger signal, the execution trigger signal is used to indicate that the camera is about to perform the corresponding action; the PTZ camera is driven based on the execution trigger signal, the driving process is that the motor control unit inside the camera controls the horizontal rotation, pitch adjustment and zoom operation according to the speed gear and direction parameter in the trigger signal, the working voltage of the motor is limited to 12-volt direct current, and the camera action result is obtained after driving, which is embodied in the form of real-time position data returned by the motor encoder; the camera action result is monitored, the monitoring method is to collect the angle value, focal length value and rotation speed value feedback by the encoder and sensor inside the camera, and compare them with the target value in the execution trigger signal, the deviation should not exceed 2%, and the result of the monitoring process is stored as camera execution state data, which includes horizontal angle, pitch angle, focal length and running state flag; the camera execution state data is converted, the conversion process is to parse the state data into a structured field, and if the angle deviation exceeds the threshold value after abnormality detection, an error code is written, then the result is re-encoded into a data frame of a unified format, and finally the camera state feedback information is generated, which will be used as the basis for updating the RockerCmd object in step S1, thereby forming a complete closed-loop control link.
[0067] Preferably, step S42 comprises the following steps:
[0068] Step S421: encode the drive instruction object to obtain a data packet conforming to the PTZ camera communication protocol;
[0069] Step S422: determine the communication mode based on the data packet conforming to the PTZ camera communication protocol to obtain transmission channel information;
[0070] Step S423: send the data packet conforming to the PTZ camera communication protocol based on the transmission channel information to obtain sending result data;
[0071] Step S424: detect the sending result data to obtain acknowledgement information;
[0072] Step S425: logical verification and state judgment are performed based on the confirmation reply information, and an execution trigger signal of the PTZ camera is obtained.
[0073] In the embodiment of the present application, the drive instruction object generated in step S41 is encoded. The encoding operation is to rearrange the protocol header, speed parameter, direction parameter, timestamp and check bit in the drive instruction object according to the VISCA communication protocol format, and convert it into a byte stream. The data length of the byte stream is limited to 8 to 16 bytes. Each instruction is identified by 0x80 as the starting identifier and 0xFF as the ending identifier. After the processing, a data packet conforming to the PTZ camera communication protocol is formed. The communication mode is determined based on the data packet conforming to the PTZ camera communication protocol. The determination mode is to detect the transmission parameter configured in the control terminal. When the target address is a serial interface, it is determined that the communication mode is an RS-232 channel. When the target address is a network port, it is determined that the communication mode is a TCP-based network channel. The determination result is stored as transmission channel information. The data packet conforming to the PTZ camera communication protocol is sent based on the transmission channel information. If the transmission channel information indicates an RS-232 channel, the data packet is sent at a rate of 115200 bits through a serial port driver. If the transmission channel information indicates a TCP network channel, the data packet is sent through a socket function with a fixed port number 52381. After the sending is completed, a sending result data is obtained. The sending result data includes the number of sent bytes and the sending timestamp. The sending result data is detected. The detection mode is to receive a reply frame from the PTZ camera and check whether the starting identifier and the ending identifier of the reply frame are 0x90 and 0xFF respectively. At the same time, it is checked whether the length of the reply frame is between 6 and 12 bytes. If the above conditions are met, a confirmation reply information is generated. The confirmation reply information contains a reply code and a return timestamp. Logical verification and state judgment are performed based on the confirmation reply information. The logical verification operation is to compare whether the reply code in the confirmation reply information is consistent with the unique identifier of the drive instruction object. The state judgment operation is to detect whether the difference between the return timestamp and the sending timestamp is less than 300 milliseconds. When the above conditions are all met, the confirmation reply information is parsed as a valid trigger signal, which is defined as the execution trigger signal of the PTZ camera. The execution trigger signal will be used as a direct input to drive the camera action in step S43.
[0074] Preferably, step S45 includes the following steps:
[0075] Step S451: the camera execution state data is parsed to obtain a state parsing result;
[0076] Step S452: abnormality detection is performed based on the state parsing result to obtain an abnormality detection result;
[0077] Step S453: the abnormality detection result is encoded to obtain state encoding data;
[0078] Step S454: integration based on state coding data, to obtain camera state feedback information.
[0079] In the embodiment of the application, the camera execution state data obtained in step S44 is parsed, and the parsing manner is to split the original values returned by the camera encoder and the focal length sensor into horizontal angle value, pitch angle value, focal length value and motor speed value according to fields, the horizontal angle value is limited in the range of 0 to 360 degrees, the pitch angle value is limited in the range of -30 to +90 degrees, the focal length value is limited in the range of 10 to 200 millimeters, and the motor speed value is limited in the range of 0 to 200 revolutions per minute, and the parsing result is stored as a state parsing result; based on the state parsing result, abnormality detection is performed, and the rule of abnormality detection is that when the difference between the horizontal angle value and the target angle value exceeds 2 degrees, it is determined as angle abnormality, when the difference between the pitch angle value and the target angle value exceeds 2 degrees, it is determined as pitch abnormality, when the difference between the focal length value and the target focal length exceeds 3 millimeters, it is determined as focal length abnormality, and when the motor speed value continuously exceeds 180 revolutions per minute, it is determined as speed abnormality, and all the detected abnormality information is recorded as an abnormality detection result; the abnormality detection result is encoded, and the encoding rule is to write the flag bit corresponding to each type of abnormality into a fixed length binary bit segment, for example, angle abnormality is encoded as 0001, pitch abnormality is encoded as 0010, focal length abnormality is encoded as 0100, and speed abnormality is encoded as 1000, and multiple types of abnormality can be superimposed to form a combined encoding through bit OR operation, and all the results are output as state coding data; based on the state coding data, integration is performed, and the integration manner is to combine the state coding data and the original parameters of the state parsing result into a data frame in a unified format, the data frame includes frame header identification, state field, encoding field, check field and frame tail identification, the frame header identification is fixed as 0xAA, the frame tail identification is fixed as 0x55, the data frame is defined as camera state feedback information, and the camera state feedback information will be used as the input of the updated RockerCmd object in step S1, so as to realize closed loop management of the control link.
[0080] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting, the scope of the application is not limited by the above description, and therefore all changes falling within the meaning and scope of the equivalent elements of the application file are intended to be included in the application.
[0081] The above description is only a specific implementation of the application, enabling those skilled in the art to understand or implement the application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the application. Therefore, the application will not be limited to these embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An active tracking control method for a high-precision PTZ camera, characterized in that, The method is applied to a PTZ camera, which includes a four-dimensional joystick, and the method includes the following steps: Step S1: Obtain the RockerCmd object; based on the RockerCmd object, determine the velocity values of each axis on the four-dimensional joystick to obtain the corrected joystick input value, which includes the following steps: Step S11: Collect the X-axis, Y-axis, Z-axis and T-axis direction input signals of the four-dimensional joystick to obtain the RockerCmd object; Step S12: Based on the RockerCmd object, decompose the input signals of each axis into X-axis velocity values, Y-axis velocity values, Z-axis velocity values and T-axis velocity values to obtain the original velocity dataset; Step S13: Compare the original speed dataset with the preset minimum speed threshold to obtain a set of filtered speed values; Step S14: Perform zero-value normalization on the set of filtering speed values to obtain the corrected joystick input value; Step S2: Perform protocol mapping on the corrected joystick input values and cache them to obtain the instruction queue; Step S3: Remove invalid stop commands from the command queue to obtain an optimized continuous control command sequence; determine the acquisition time and direction of the optimized continuous control command sequence to obtain a corrected control command set; Step S4: Drive the PTZ camera based on the modified control instruction set, collect the execution status of the PTZ camera, and obtain camera status feedback information.
2. The active tracking control method for a high-precision PTZ camera according to claim 1, characterized in that, Step S2 includes the following steps: Step S21: Analyze the corrected joystick input value into X-axis velocity value, Y-axis velocity value, Z-axis velocity value and T-axis velocity value to obtain the analytical velocity parameter set; Step S22: Map the speed values of each axis to the PTZ control protocol based on the analytical speed parameter set to obtain the control command set; Step S23: Encapsulate the control instruction set to obtain a control instruction object; Step S24: Cache the control instruction object to obtain a thread-safe instruction queue.
3. The active tracking control method for a high-precision PTZ camera according to claim 1, characterized in that, Step S3 involves removing invalid stop instructions from the instruction queue, including: Traverse the instruction queue and extract instruction data to obtain the instruction sequence; Logical analysis of the instruction sequence yields a set of invalid stop instructions; Remove invalid stop instruction sets from the instruction sequence to obtain an optimized continuous control instruction sequence.
4. The active tracking control method for a high-precision PTZ camera according to claim 3, characterized in that, Logical analysis of instruction sequences includes: The instruction sequence is filtered for stop instructions to obtain a set of stop instructions; By comparing adjacent movement and stop commands based on the command sequence, direction change information is obtained; Calculate the time difference between the stop command and the adjacent move command to obtain the time interval data; Invalid stop command set is obtained by determining invalidity based on the stop command set, direction change information and time interval data.
5. The active tracking control method for a high-precision PTZ camera according to claim 4, characterized in that, Invalidity determination based on stop command set, direction change information, and time interval data includes: Based on the set of stop commands and direction change information, a subset of stop commands with mismatched directions is obtained; The subset of stop commands with mismatched directions is compared with the time interval data to obtain the subset of stop commands with insufficient time. The subset of stop commands that are below the time threshold is filtered for validity to obtain a candidate set of invalid stop commands. The invalid stop instruction candidate set is merged to obtain the invalid stop instruction set.
6. The active tracking control method for a high-precision PTZ camera according to claim 1, characterized in that, Step S3, which involves determining the acquisition time and direction of the optimized continuous control command sequence, includes: Time analysis is performed on the optimized continuous control command sequence to obtain the command acquisition time dataset; Direction determination is performed based on the optimized continuous control command sequence and command acquisition time dataset to obtain the direction determination result. The optimized continuous control command sequence and direction determination results are merged into a corrected control command set.
7. The active tracking control method for a high-precision PTZ camera according to claim 1, characterized in that, Step S4 includes the following steps: Step S41: Parse and modify the control instruction set to obtain the drive instruction object; Step S42: Send the driver instruction object and receive the confirmation response signal to obtain the execution trigger signal; Step S43: Drive the PTZ camera based on the execution trigger signal to obtain the camera's execution action results; Step S44: Monitor the camera's action results and obtain camera execution status data; Step S45: Perform conversion processing based on camera execution state data to obtain camera state feedback information.
8. The active tracking control method for a high-precision PTZ camera according to claim 7, characterized in that, Step S42 includes the following steps: Step S421: Encode the drive instruction object to obtain a data packet conforming to the PTZ camera communication protocol; Step S422: Determine the communication mode based on data packets conforming to the PTZ camera communication protocol to obtain transmission channel information; Step S423: Send data packets conforming to the PTZ camera communication protocol based on the transmission channel information to obtain the transmission result data; Step S424: Detect the transmitted result data and obtain the confirmation response information; Step S425: Perform logical verification and status judgment based on the confirmation response information to obtain the execution trigger signal of the PTZ camera.
9. The active tracking control method for a high-precision PTZ camera according to claim 7, characterized in that, Step S45 includes the following steps: Step S451: Parse the camera execution state data to obtain the state parsing result; Step S452: Perform anomaly detection based on the state resolution results to obtain anomaly detection results; Step S453: Encode the anomaly detection results to obtain state coding data; Step S454: Integrate the state-coded data to obtain camera state feedback information.
Citation Information
Patent Citations
Target positioning and tracking method and system based on cooperation of PTZ camera and radar
CN118549924A
KR20220139540A