A method, apparatus and storage medium for detecting device movement

By using image processing technology to identify the offset of reference objects and detect the movement of PTZ devices, the problem of high cost or complex structure in existing technologies is solved, and efficient and low-cost device movement detection is achieved in harsh environments.

CN117422761BActive Publication Date: 2026-07-31ZHEJIANG UNIVIEW TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIVIEW TECH CO LTD
Filing Date
2022-07-11
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing PTZ equipment is susceptible to external forces in outdoor environments, causing it to tilt downwards. Existing detection methods are either costly or structurally complex and are not suitable for use in harsh environments.

Method used

By implementing a device movement detection method on a PTZ device, image processing technology is used to identify reference objects with fixed geographical locations to determine whether the device has moved, including determining the type and offset of the reference object, thereby realizing the detection of the device position.

Benefits of technology

Without adding hardware, it can quickly detect whether a device is moving, reduce hardware design costs, improve product competitiveness, and maintain high accuracy in harsh environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117422761B_ABST
    Figure CN117422761B_ABST
Patent Text Reader

Abstract

A device movement detection method, apparatus, and storage medium are disclosed. The device movement detection method includes: controlling a device to be detected to reach a preset position, locking the motor and acquiring an initial image collected by the device; identifying a reference object in the initial image; determining the type of the reference object, including a first type and a second type; acquiring a first position of the reference object in the initial image, wherein the reference object is a geographically fixed object; acquiring a detection image collected by the device during device operation; acquiring a second position of the reference object in the detection image; and determining whether the device has moved based on the type of the reference object and the offset between the second and first positions of the reference object. This technical solution can quickly detect device movement without adding new hardware, thereby reducing product hardware design costs and improving product competitiveness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This article relates to detection technology, and in particular to a method, apparatus and storage medium for detecting the movement of equipment. Background Technology

[0002] Currently, PTZ (Pan / Tilt / Zoom, omnidirectional movement and lens zoom / zoom control) devices are generally installed in outdoor environments. When exposed to external forces (such as strong earthquakes or strong winds), the PTZ device is prone to tilting downwards.

[0003] The following methods are typically used to determine if a PTZ device is tilted down:

[0004] Option 1: Manually determine whether the equipment has tilted down;

[0005] Option 2: Use an accelerometer sensor to dynamically detect the difference between the current position and the initial preset position to determine whether the PTZ device is tilting down.

[0006] Option 3 uses an encoder to provide real-time position information, forming a closed-loop feedback control.

[0007] The above technical solution has the following disadvantages:

[0008] For Option 1, manual control has a time difference, and without an early warning system, it is not easy to detect the loss of PTZ direction, which will result in the loss of the pre-captured video stream at a certain time point;

[0009] For Option 2, using an accelerometer sensor requires adding an accelerometer module, which increases the overall cost of the device.

[0010] For Option 3, the encoder is large in size and has a complicated structure, requiring sufficient reserved space, which increases the difficulty of product structure design. In addition, the internal components of the photoelectric encoder are greatly affected by the environment and are easily contaminated, making them unsuitable for outdoor and harsh environments. The magnetoelectric encoder is also susceptible to electromagnetic interference and requires compensation and protection measures to avoid temperature drift. Summary of the Invention

[0011] This application provides a device and storage medium for detecting device movement, which can detect whether a device has moved without adding new hardware.

[0012] This application provides a device movement detection method, including:

[0013] The device to be tested is controlled to reach a preset position, the motor is locked, and an initial image collected by the device is acquired. A reference object is determined in the initial image, and the type of the reference object is determined. The type includes a first type and a second type. Under the same external force, the offset of the reference object of the first type is less than the offset of the reference object of the second type.

[0014] Obtain the first position of the reference object in the initial image, wherein the reference object is an object with a fixed geographical location;

[0015] During the operation of the device, the detection image collected by the device is acquired; the second position of the reference object in the detection image is acquired;

[0016] Whether the device moves is determined based on the type of the reference object and the offset between the second and first positions of the reference object.

[0017] In an exemplary embodiment, determining whether the device has moved based on the type of the reference object and the offset between the second position and the first position of the reference object includes:

[0018] When the initial image includes a reference object of the first type, and the offset between the second position and the first position of at least one reference object of the first type does not meet a preset offset threshold, it is determined that the device has moved.

[0019] In an exemplary embodiment, determining whether the device has moved based on the type of the reference object and the offset between the second position and the first position of the reference object includes:

[0020] When the initial image does not include reference objects of the first type but includes at least one reference object of the second type, for each reference object of the second type, if the offset between the second position of the reference object and the first position of the reference object of the second type satisfies a preset offset threshold, the confidence weight of the reference object of the second type is determined to be the preset confidence weight corresponding to the reference object of the second type; if the offset between the second position of the reference object and the first position of the reference object of the second type does not satisfy the preset offset threshold, the confidence weight of the reference object of the second type is determined to be 0.

[0021] Determine the average confidence weight of all reference objects of the second type, and determine the device movement when the average confidence weight meets a preset condition.

[0022] In an exemplary embodiment, the mean confidence weight satisfies the following preset conditions:

[0023] When the average confidence weight is less than the sum of the preset confidence weights corresponding to each second type of reference object * t / the number of second type of reference objects, the average confidence weight satisfies the preset condition, where t is 0 to 1.

[0024] In an exemplary embodiment, the reference objects are assigned priorities, and the preset confidence weight of a high-priority reference object is greater than the preset confidence weight of a low-priority reference object. Under the same external force, the offset ratio of a high-priority reference object is less than the offset ratio of a low-priority reference object. The offset ratio is the ratio of the offset of the reference object under the external force to the size of the reference object along the offset direction.

[0025] In an exemplary embodiment, when different parts of the same object in the initial image have different offsets under the action of external force, the object is divided into a first part and a second part. The maximum offset ratio of the first part is less than or equal to a preset offset ratio threshold, and the maximum offset ratio of the second part is greater than the preset offset ratio threshold. The first part is used as a reference object, and the second part is used as another reference object. The priority of the first part is greater than the priority of the second part.

[0026] In an exemplary embodiment, determining whether the device has moved based on the type of the reference object and the offset between the second position and the first position of the reference object includes:

[0027] When the initial image does not include the first type of reference object but includes at least one second type of reference object, and when the offset between the second position and the first position of at least one second type of reference object does not meet a preset offset threshold, N detection images are acquired, with a preset time interval between adjacent detection images; for any detection image, when the offset between the second position and the first position of at least one second type of reference object in the detection image does not meet a preset offset threshold, the detection image is considered to have an offset; when the number of detection images with offsets in the N detection images is greater than or equal to a preset number threshold, it is determined that the device has moved, and the preset number threshold is less than or equal to N.

[0028] In an exemplary embodiment, whether the offset between the second position of the reference object and the first position of the reference object satisfies a preset offset threshold for any reference object includes:

[0029] Determine the first pixel region where the reference object is located in the initial image. The first pixel region is the region after expanding the minimum region that completely includes the reference object by a preset margin. The preset margin of the first pixel region of the first type of reference object is smaller than the preset margin of the first pixel region of the second type of reference object.

[0030] When the second position of the reference object is entirely located within the first pixel region, the offset between the second position of the reference object and the first position of the reference object satisfies a preset offset threshold; when the second position of the reference object is at least partially located outside the first pixel region, the offset between the second position of the reference object and the first position of the reference object does not satisfy the preset offset threshold.

[0031] Alternatively, determine the second pixel region in the detected image where the reference object is located, where the second pixel region is the region after expanding the minimum region that completely includes the reference object by a preset margin;

[0032] When the first position of the reference object is entirely located within the second pixel region, the offset between the second position of the reference object and the first position of the reference object satisfies a preset offset threshold; when the first position of the reference object is at least partially located outside the second pixel region, the offset between the second position of the reference object and the first position of the reference object does not satisfy the preset offset threshold.

[0033] This disclosure provides a device motion detection apparatus, including a memory and a processor. The memory stores a program, which, when read and executed by the processor, implements the device motion detection method described in any of the above embodiments.

[0034] This disclosure provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the device movement detection method described in any of the above embodiments.

[0035] This application includes a device and a storage medium for detecting device movement. The device movement detection method includes: controlling the device to be detected to reach a preset position, locking the motor and acquiring an initial image collected by the device; determining a reference object in the initial image; determining the type of the reference object, which includes a first type and a second type; wherein, under the same external force, the offset of the first type of reference object is less than the offset of the second type of reference object; acquiring a first position of the reference object in the initial image, wherein the reference object is a geographically fixed object; acquiring a detection image collected by the device during device operation; acquiring a second position of the reference object in the detection image; and determining whether the device has moved based on the type of the reference object and the offset between the second and first positions of the reference object. This technical solution can quickly detect device movement without adding new hardware, thereby reducing product hardware design costs and improving product competitiveness.

[0036] Other features and advantages of this application will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the application. Other advantages of this application can be realized and obtained by means of the solutions described in the description and the accompanying drawings. Attached Figure Description

[0037] The accompanying drawings are used to provide an understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.

[0038] Figure 1 This is a flowchart of the device movement detection method according to Embodiment 1 of this application;

[0039] Figure 2 This is a schematic diagram of a reference object according to Embodiment 1 of this application;

[0040] Figure 3 This is a schematic diagram of the reference object region division in Embodiment 1 of this application;

[0041] Figure 4 This is a schematic diagram of the reference object pixel region division in Embodiment 1 of this application;

[0042] Figure 5 This is the third flowchart of the device movement detection method in Embodiment 1 of this application;

[0043] Figure 6 This is a schematic diagram of the device movement detection device according to Embodiment 1 of this application;

[0044] Figure 7This is a flowchart of the device movement detection method in Example 1 of this application;

[0045] Figure 8 This is a schematic diagram of the detection image in Example 1 of this application;

[0046] Figure 9 This is another schematic diagram of the detection image in Example 1 of this application;

[0047] Figure 10 This is a flowchart of the device movement detection method in Example 2 of this application;

[0048] Figure 11 This is a schematic diagram of the detection scenario in Example 3 of this application. Detailed Implementation

[0049] This application describes several embodiments, but these descriptions are exemplary and not restrictive, and it will be apparent to those skilled in the art that many more embodiments and implementations are possible within the scope of the embodiments described herein. Although many possible combinations of features are shown in the drawings and discussed in the detailed description, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with, or may replace, any feature or element of any other embodiment.

[0050] This application includes and contemplates combinations of features and elements known to those skilled in the art. The embodiments, features, and elements disclosed in this application may also be combined with any conventional features or elements to form a unique inventive scheme as defined by the claims. Any feature or element of any embodiment may also be combined with features or elements from other inventive schemes to form another unique inventive scheme as defined by the claims. Therefore, it should be understood that any feature shown and / or discussed in this application may be implemented individually or in any suitable combination. Therefore, the embodiments are not limited except by the limitations imposed by the appended claims and their equivalents. Furthermore, various modifications and changes may be made within the scope of the appended claims.

[0051] Furthermore, in describing representative embodiments, the specification may have presented methods and / or processes as a specific sequence of steps. However, the method or process should not be limited to the specific order of steps described herein, to the extent that it does not depend on such a specific order. As will be understood by those skilled in the art, other sequences of steps are also possible. Therefore, the specific order of steps set forth in the specification should not be construed as a limitation of the claims. Moreover, the claims concerning the method and / or process should not be limited to the steps performed in the written order, and those skilled in the art will readily understand that these orders can be varied and still remain within the spirit and scope of the embodiments of this application.

[0052] Example 1

[0053] like Figure 1 As shown, this embodiment provides a device movement detection method, including:

[0054] Step S101: Control the device to be detected to reach a preset position, lock the motor and acquire the initial image collected by the device, determine a reference object in the initial image, determine the type of the reference object, the type includes a first type and a second type; wherein, under the same external force, the offset of the reference object of the first type is less than the offset of the reference object of the second type; acquire the first position of the reference object in the initial image, the reference object is an object with a fixed geographical location;

[0055] Step S102: During the operation of the device, acquire the detection image collected by the device; acquire the second position of the reference object in the detection image; and determine whether the device has moved based on the type of the reference object and the offset between the second position and the first position of the reference object.

[0056] In one exemplary embodiment, the device includes, but is not limited to, PTZ devices, such as PTZ cameras and pan-tilt cameras. Device movement refers to a change in the device's position, deviating from a preset position.

[0057] In one exemplary embodiment, such as Figure 2 As shown, objects that cannot move (whose geographical location will not change) such as trees, buildings, stone blocks, roads, traffic signs (already installed and fixed), and billboards (already installed and fixed) can all be used as reference objects (the reference objects themselves will not move, but may sway under the action of external forces, such as swaying in a strong wind). Pedestrians, animals, vehicles, and other objects that can move (whose geographical location may change) are not used as reference objects.

[0058] In one exemplary embodiment, a reference object can be identified to determine its type; alternatively, the user can set and save the type of the reference object.

[0059] The above technical solution can detect whether the device is moving without adding new hardware, thereby reducing the hardware design cost of the product and greatly improving the product's competitiveness.

[0060] In an exemplary embodiment, reference objects with a maximum offset ratio less than or equal to a preset first offset ratio threshold can be designated as first-type reference objects, and reference objects with a maximum offset ratio greater than the preset first offset ratio threshold can be designated as second-type reference objects. The preset first offset ratio threshold is, for example, 0 to 1%, or 0 to 5%, etc. The offset ratio is the ratio of the offset of the reference object under external force to the dimension of the reference object along the offset direction. The offset is, for example, the offset of the center point of the reference object along the offset direction; or, the offset of the part of the reference object with the largest offset (for example, the top of a billboard), along the offset direction, etc. For example, when a tree is offset horizontally by wind, the ratio of the distance the center point of the tree is offset horizontally to the horizontal dimension of the tree is the offset ratio. The maximum offset ratio refers to the maximum offset ratio under external forces in a normal environment (such as wind, vibrations from passing vehicles, etc.), excluding the offset ratio under extreme conditions (such as earthquakes, explosions, or severe winds). In an exemplary embodiment, the first-type reference object can be, for example, a relatively stationary reference object such as a road, building, or stone pier that will not experience significant offset. The second type of reference object can be a reference object that may shift under the action of external forces, such as trees, traffic signs, billboards, etc.

[0061] In another exemplary embodiment, billboards, traffic signs, etc., can be used as reference objects of the first type, and trees, etc., can be used as reference objects of the second type.

[0062] In subsequent embodiments, the first type of reference object can be referred to as a static reference object, and the second type of reference object can be referred to as a dynamic reference object.

[0063] In an exemplary embodiment, determining whether the device moves based on the type of the reference object and the offset between the second and first positions of the reference object includes: determining whether the type of the reference object and the offset between the second and first positions of the reference object satisfy a preset movement condition; if so, the device moves. The preset movement condition can include various factors. For example, if a first type of reference object exists, and the offset between the second and first positions of at least one first type of reference object does not satisfy a preset offset threshold, then the preset movement condition is satisfied. Alternatively, if a second type of reference object exists, a confidence weight of the reference object is determined, and it is determined whether the confidence weight satisfies the preset condition; if so, the preset movement condition is satisfied, and so on.

[0064] In an exemplary embodiment, determining whether the device has moved based on the type of the reference object and the offset between the second position and the first position of the reference object includes:

[0065] When the initial image includes a reference object of the first type, and the offset between the second position and the first position of at least one reference object of the first type does not meet a preset offset threshold, it is determined that the device has moved.

[0066] The above scheme determines whether the device has moved based on the offset of reference objects of the first type in the detection image. This can be determined when some or all of the reference objects of the first type in the detection image do not meet a preset offset threshold. Meeting the preset offset threshold means that the offset between the second position and the first position is less than or equal to the preset offset threshold. Whether the offset between the second position and the first position is less than or equal to the preset offset threshold is determined in various ways, such as whether the distance between the center point of the second position and the center point of the first position is less than or equal to the preset offset threshold, etc.

[0067] In another exemplary embodiment, the device can be determined to have moved when the offset between the second position and the first position of at least one reference object of the first type in multiple detection images does not meet a preset offset threshold. That is, the determination of device movement can be made using multiple detection images, reducing the probability of false positives and improving accuracy.

[0068] In an exemplary embodiment, determining whether the device has moved based on the type of the reference object and the offset between the second position and the first position of the reference object includes:

[0069] When the initial image does not include reference objects of the first type but includes at least one reference object of the second type, for each reference object of the second type, if the offset between the second position of the reference object and the first position of the reference object of the second type satisfies a preset offset threshold, the confidence weight of the reference object of the second type is determined to be the preset confidence weight corresponding to the reference object of the second type; if the offset between the second position of the reference object and the first position of the reference object of the second type does not satisfy the preset offset threshold, the confidence weight of the reference object of the second type is determined to be 0.

[0070] Determine the average confidence weight of all reference objects of the second type, and determine the device movement when the average confidence weight meets a preset condition.

[0071] In an exemplary embodiment, the average confidence weight of all reference objects (including reference objects of the first type and reference objects of the second type) can be determined, and when the average confidence weight meets a preset condition, the device is determined to move.

[0072] In an exemplary embodiment, the mean confidence weight satisfies the following preset conditions:

[0073] When the average confidence weight is less than the sum of the preset confidence weights corresponding to each second type of reference object * t / the number of second type of reference objects, the average confidence weight satisfies the preset condition, where t is 0 to 1.

[0074] The t value may be different when the reference object is different. In an exemplary embodiment, a suitable t value can be determined by testing, and a t value that makes the detection error less than a preset error threshold can be selected.

[0075] In one exemplary embodiment, the reference objects correspond to priorities, and the preset confidence weight corresponding to a higher priority reference object is greater than the preset confidence weight corresponding to a lower priority reference object. Under the same external force, the offset ratio of a higher priority reference object is less than the offset ratio of a lower priority reference object. A pre-established correspondence between reference object types and priorities can be established; identifying the type of a reference object yields its priority. For example, if a reference object is identified as a tree, the correspondence between trees and priorities can be found to determine the reference object's priority. Alternatively, the user can set the priority of the reference object after it has been identified.

[0076] In one exemplary embodiment, the priority of a first type of reference object may be higher than the priority of a second type of reference object.

[0077] In an exemplary embodiment, the object can be divided into multiple reference objects based on the swinging parts of the object, with the priority of the less swaying region (the region with smaller offset) being greater than that of the more swaying region (the region with larger offset).

[0078] In an exemplary embodiment, when different parts of the same object in the initial image have different offsets under the action of external force, the object can be divided into a first part and a second part. The maximum offset ratio of the first part is less than or equal to a preset offset ratio threshold, and the maximum offset ratio of the second part is greater than the preset offset ratio threshold. The first part is used as a reference object, and the second part is used as another reference object. The priority of the first part is greater than the priority of the second part.

[0079] The maximum offset ratio of the first part can be the maximum offset ratio of the preset settings of the first part (including but not limited to the center point, boundary point, etc.); the maximum offset ratio of the second part can be the maximum offset ratio of the preset position of the second part (including but not limited to the center point, boundary point, etc.).

[0080] In one exemplary embodiment, the object may be, for example, a tree.

[0081] In one exemplary embodiment, the preset offset ratio threshold can be greater than 0 and less than or equal to 5%.

[0082] The solution provided in this embodiment can divide the same object into two reference objects according to different maximum offset ratios. Different reference objects can be set with different expansion margins, which can more accurately determine whether the object has shifted.

[0083] For example, if there are trees in the initial image, the trees can be divided into two parts along their extension direction. The part of the tree whose width along the direction perpendicular to the extension direction of the tree (i.e., the extension direction of the trunk from the bottom) is less than or equal to a preset value is divided into the first part, and the part of the tree whose width along the direction perpendicular to the extension direction of the tree is greater than the preset value is divided into the second part. The first part is used as the first reference object, and the second part is used as the second reference object, with the first reference object having a higher priority than the second reference object.

[0084] like Figure 3 As shown, when a tree is detected, it can be divided into a first part 31 (trunk part) and a second part 32 (canopy part). The first part 31 serves as one reference object, and the second part 32 serves as another reference object. The priority of the first part 31 is higher than that of the second part 32.

[0085] In an exemplary embodiment, determining whether the device has moved based on the type of the reference object and the offset between the second position and the first position of the reference object includes:

[0086] When the initial image does not include a reference object of the first type but includes at least one reference object of the second type, and the offset between the second position and the first position of at least one reference object of the second type does not meet a preset offset threshold, N detection images are acquired, with a preset time interval between adjacent detection images. For any detection image, if the offset between the second position and the first position of at least one reference object of the second type in the detection image does not meet the preset offset threshold, the detection image is considered to have an offset. When the number of detection images with offsets among the N detection images is greater than or equal to a preset number threshold, it is determined that the device has moved. N is greater than 0, and the preset number threshold is less than or equal to N. For example, if N = 10 and the preset number threshold is 8, and one detection image is acquired every hour, if 8 out of 10 detection images show an offset, the device is considered to have moved.

[0087] In one exemplary embodiment, the time intervals between different adjacent detection images can be the same or different.

[0088] In an exemplary embodiment, determining whether the device has moved based on the type of the reference object and the offset between the second position and the first position of the reference object includes:

[0089] When the offset between the second position of the reference object of the first type and the first position of the same reference object of the first type does not meet the preset offset threshold, and the offset between the second position of the reference object of the second type and the first position of the same reference object of the second type meets the preset offset threshold, it is determined that the device has moved;

[0090] When the offset between the second position of a reference object of the first type and the first position of a reference object of the same first type satisfies the preset offset threshold, and the offset between the second position of a reference object of the second type and the first position of a reference object of the same second type does not satisfy the preset offset threshold, it is determined that the second type of reference object is shaking. In this embodiment, image shift may occur when the device is moved by an external force or when the reference object shakes. Therefore, the device movement or the reference object shaking can be determined based on the offset of the first type of reference object and the offset of the second type of reference object in the detected image. The first type of reference object is usually not shaken by external forces; its position changes only when the device shakes. Therefore, it can be used to determine whether the device has moved.

[0091] In one exemplary embodiment, for any reference object, the offset between the second position of the reference object and the first position of the reference object satisfies a preset offset threshold, including:

[0092] The first pixel region where the reference object is located in the initial image is determined. The first pixel region is the region after expanding the minimum region that completely includes the reference object by a preset margin. The preset margin of the first pixel region of the first type of reference object is smaller than the preset margin of the first pixel region of the second type of reference object.

[0093] When the second position of the reference object is entirely located within the first pixel region, the offset between the second position of the reference object and the first position of the reference object satisfies a preset offset threshold; when the second position of the reference object is at least partially located outside the first pixel region, the offset between the second position of the reference object and the first position of the reference object does not satisfy the preset offset threshold.

[0094] Alternatively, determine the second pixel region in the detected image where the reference object is located, where the second pixel region is the region after expanding the minimum region that completely includes the reference object by a preset margin;

[0095] When the first position of the reference object is entirely located within the second pixel region, the offset between the second position of the reference object and the first position of the reference object satisfies a preset offset threshold; when the first position of the reference object is at least partially located outside the second pixel region, the offset between the second position of the reference object and the first position of the reference object does not satisfy the preset offset threshold.

[0096] In one exemplary embodiment, the expansion preset margin can be expanded in four directions outward from the reference object (towards the top, bottom, left, and right sides of the image), or it can be expanded towards opposite sides, etc. The margins for expansion in different directions can be the same or different. The first pixel region can be a rectangle or other shape, and the second pixel region can be a rectangle or other shape.

[0097] In one exemplary embodiment, the preset margins for expansion of different reference objects may be the same or different.

[0098] In an exemplary embodiment, the preset margin can be determined based on the maximum offset ratio of the reference object, and the preset margin can be greater than or equal to the maximum offset ratio. For example, if the maximum offset ratio of the reference object is less than 5%, the preset expansion margin can be 5%. This means that the smallest region completely encompassing the reference object can be expanded by 5% on one or more sides to form the first pixel region of the reference object. For instance, the smallest region completely encompassing the reference object can be expanded by 5% to the left, right, top, and bottom respectively to form the first pixel region of the reference object. Alternatively, if the maximum offset ratio of the reference object is less than 10% but greater than 5%, the smallest region completely encompassing the reference object can be expanded by 10% to the left, right, top, and bottom respectively to form the first pixel region of the reference object. The maximum offset ratio of the reference object can be determined by statistically analyzing the offset ratio of the reference object over a relatively long period; or, the maximum offset ratio of the reference object can be determined experimentally, for example, by applying different wind forces or vibrations to test the offset ratio of the reference object, and taking the largest offset ratio obtained from the test as the maximum offset ratio, and so on.

[0099] In one exemplary embodiment, the preset margin of a high-priority reference object is less than or equal to the preset margin of a low-priority reference object. For example, the preset margin of a billboard is less than the preset margin of a tree canopy.

[0100] like Figure 4 As shown, taking a tree as an example, since trees are prone to swaying in the wind, when a tree is used as a reference object, the expansion margin of the tree can be set to 10% of the tree body pixels; that is, the expansion amount on one side is 10% of the tree body pixels (the width of the tree body pixels from left to right), and it can be expanded by 10% to the left and right sides of the tree respectively.

[0101] Taking traffic signs as an example, traffic signs are not easy to sway in windy conditions. Therefore, when a traffic sign is used as a reference object, the expansion margin of the traffic sign can be set to 5% of the traffic sign body pixels, that is, 5% of the traffic sign body pixels on one side, and can be expanded by 5% to the left and right sides of the traffic sign respectively.

[0102] like Figure 5 As shown, in one exemplary embodiment, the device movement detection method further includes:

[0103] Step S103: After determining that the device has moved, control the device to return to the zero position. When the number of steps to return to the zero position is inconsistent with the recorded number of steps from the zero position to the preset position, confirm that the device has moved.

[0104] In this embodiment, after determining that the device has moved, further verification can be performed to ultimately confirm whether the device has moved. That is, after determining that the device has moved based on the type of the reference object and the offset between the second and first positions of the reference object, verification is required to ultimately confirm whether the device has moved or not. The verification scheme can be achieved by comparing the number of steps the device takes to return from its current position to the zero point with the recorded number of steps from the zero point to the preset position. If they match, the device is ultimately confirmed not to have moved; if they do not match, the device is ultimately confirmed to have moved. This technical solution can improve redundancy while ensuring detection accuracy.

[0105] In an exemplary embodiment, when the number of steps taken to return to the zero point position matches the recorded number of steps taken to reach the preset position from the zero point position, it is considered that the device has not moved. That is, upon secondary confirmation through the number of steps taken to return to the zero point position, it is considered that the device has not moved.

[0106] In an exemplary embodiment, after controlling the device to return to the zero position, the method further includes: controlling the device to reach the preset position. That is, controlling the device to restore its position before movement and continue monitoring. The solution provided in this embodiment can automatically perform movement detection and recovery without manual intervention, which is highly efficient. It also requires no additional components, has low cost, does not increase device size, has low environmental requirements, and is more practical. In this embodiment, regardless of whether the number of steps to return to the zero position is consistent with the recorded number of steps from the zero position to the preset position, the device is controlled to reach the preset position.

[0107] like Figure 6 As shown, this disclosure also provides a device movement detection apparatus, including a memory 10 and a processor 11. The memory 10 stores a program, which, when read and executed by the processor 11, implements the device movement detection method as described in any of the foregoing embodiments.

[0108] This disclosure also provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the device movement detection method as described above.

[0109] Example 1

[0110] This example uses the detection of whether a PTZ device has moved as an example to further illustrate the device movement detection method of this application embodiment. In this embodiment, the reference objects are all set as first type reference objects. For example... Figure 7 As shown, the device movement detection method provided in this embodiment includes:

[0111] Step 210: Control the PTZ device to reach the preset position, lock the motor and acquire an initial image, determine the reference object in the initial image, acquire the first position of the reference object in the initial image, and determine the first pixel area based on the first position;

[0112] Step S211: During the operation of the PTZ device, acquire at least one detection image;

[0113] Step S212: Determine the offset information based on the offset between the second position and the first position of the reference object in the detection image;

[0114] This step includes: for each reference object, if the offset between the second position of the reference object and the first position of the reference object does not meet a preset offset threshold, the offset information of the reference object is determined to be offset. If the offset between the second position of the reference object and the first position of the reference object meets the preset offset threshold, the offset information of the reference object is determined to be no offset.

[0115] In this example, for each reference object, the following method can be used to determine whether the reference object is offset:

[0116] Method 1: Determine the first pixel region in the initial image where the reference object is located. The first pixel region is the region after expanding the minimum region that completely includes the reference object by a preset margin (e.g., ...). Figure 4 The pixel region of the tree shown is the minimum region containing the tree, which is expanded by 5% on one side of the tree body; when the second position of the reference object is located in the first pixel region, the offset information of the reference object is determined to be no offset; when the second position of the reference object is at least partially not located in the first pixel region, the offset information of the reference object is determined to be offset.

[0117] In this example, three reference objects are set, such as Figure 4 As shown, the image includes tree 1, tree 2, and a traffic sign. A first pixel region of the aforementioned reference objects is determined in the initial image. This first pixel region can be obtained by expanding a first position by a preset margin. For example, the expansion margin for tree 1 and tree 2 is set to 10% of the tree's main pixel area, i.e., expanding the tree's main pixel area by 10% on one side; the margin for the traffic sign is set to 5% of the traffic sign's main pixel area, i.e., expanding the tree's main pixel area by 5% on one side. In this embodiment, the first pixel region is always rectangular.

[0118] Method 2: Determine the second pixel region where the reference object is located in the detected image. The second pixel region is the region after expanding the minimum region that completely includes the reference object by a preset margin. When the first position of the reference object is located in the second pixel region, the offset information of the reference object is determined to be no offset. When the first position of the reference object is at least partially not located in the second pixel region, the offset information of the reference object is determined to be offset.

[0119] It should be noted that "at least part of the second position of the reference object is not located in the first pixel area" means that the second position of the reference object cannot be completely located in the first pixel area. For example, part of it may be in the first pixel area and part of it may not be in the first pixel area, or it may not be in the first pixel area at all.

[0120] Similarly, "the first position of the reference object is not at least partially located in the second pixel region" means that the first position of the reference object cannot be completely located in the second pixel region. For example, part of it may be in the second pixel region and part of it may not be in the second pixel region, or it may be completely not in the second pixel region.

[0121] Step S213: Determine whether the offset information of the detected image meets the preset movement conditions. If the preset movement conditions are met, proceed to step S214; otherwise, proceed to step S218.

[0122] In this embodiment, the condition that the offset information of the detected image satisfies the preset movement condition includes: when the offset information of each reference object in the detected image is an offset, it is determined that the offset information of the detected image satisfies the preset movement condition.

[0123] If the offset information of the detected image does not meet the preset movement conditions, it is confirmed that the PTZ device has not moved, and the detection ends.

[0124] Assuming the initial image from the PTZ device is as follows: Figure 4 As shown, the PTZ device acquires images after starting image monitoring, as shown below. Figure 8 The image shown. Figure 8 Tree 1, Tree 2, and traffic signs are in the picture. Figure 4 Compared to Tree 1, Tree 2, and the traffic sign, the positions of these trees have not changed, therefore it can be determined that the PTZ device has not moved.

[0125] If the PTZ device collects data as follows Figure 9 When the image shown is displayed, due to Figure 9 Tree 1, Tree 2, and the traffic sign are all missing. Figure 4 Within the first pixel area of ​​tree 1, tree 2, and the traffic sign, therefore, it is concluded that... Figure 9 The offset information of the image shown meets the preset movement conditions.

[0126] Step S214: After a set time interval, determine the offset information again based on the offset between the second position and the first position of the reference object in the acquired detection image;

[0127] Step S215: Determine whether the offset information of the detected image meets the preset movement conditions. If the preset movement conditions are met, proceed to step S216 or step S217; if the preset conditions are not met, proceed to step S218.

[0128] Step S216: Control the PTZ device to return to the zero position, and determine whether the number of steps to return to the zero position is consistent with the recorded number of steps from the zero position to the preset position. If they are consistent, proceed to step S218; if they are inconsistent, proceed to step S217.

[0129] Step S217: Confirm the PTZ device has moved. Adjust the PTZ device to the preset position. This test is now complete.

[0130] Step S218: Confirm that the PTZ device has not moved, adjust the PTZ device to the preset position, and the test is completed.

[0131] In another exemplary embodiment, in step 213, when the offset information of the detected image meets the preset movement conditions, the process can proceed directly to step 217, that is, without performing a second confirmation of the return to the zero point position.

[0132] Example 2

[0133] This example still uses the detection of whether a PTZ device has moved as an example to illustrate the device movement detection method of this application. In this embodiment, the device movement is determined based on the average confidence weight of all reference objects (including reference objects of the first type and reference objects of the second type). Figure 10 As shown, the device movement detection provided in this embodiment includes:

[0134] Step S310: Control the PTZ device to reach the preset position, lock the motor and acquire an initial image, determine the reference object in the initial image, and acquire the first position of the reference object in the initial image;

[0135] Step S311: During the operation of the PTZ device, acquire at least one detection image;

[0136] Step S312: Determine the offset information based on the offset between the second position and the first position of the reference object in the detection image, and determine the confidence weight of the reference object based on the offset information;

[0137] When the offset between the second position of the reference object and the first position of the reference object meets a preset offset threshold, the confidence weight of the reference object is determined to be the preset confidence weight corresponding to the reference object; when the offset between the second position of the reference object and the first position of the reference object does not meet the preset offset threshold, the confidence weight of the reference object is determined to be 0.

[0138] Step S313: Calculate the mean confidence weight of the reference object in the detected image, and determine whether the mean confidence weight is greater than or equal to the confidence weight threshold. If the mean confidence weight is greater than or equal to the confidence weight threshold, proceed to step S318. If the mean confidence weight is less than the confidence weight threshold, proceed to step S317 or step S314.

[0139] This example uses Table 1 to calculate the credibility weight of each reference object, and then calculates the mean credibility weight. As shown in Table 1, the following parameters are set: reference object type, margin, priority, and credibility weight. The values ​​shown in Table 1 are merely examples, and the embodiments disclosed in this disclosure are not limited thereto.

[0140] Table 1 Reliability Weight Table

[0141]

[0142] In Table 1, traffic signs and billboards are not easily swayed and are used as static reference objects. Trees are easily swayed and are used as dynamic reference objects. Static reference objects have a higher priority than dynamic reference objects.

[0143] For dynamic reference objects, they can be further divided into regions based on the swaying parts, with regions less prone to swaying having a higher priority than regions more prone to swaying. For example, when dividing a tree into two parts, the lower half of the tree has a higher priority than the upper half.

[0144] If there is a first-priority reference object in the detected image, the first-priority reference object can be identified first; if there is no first-priority reference object in the detected image, but there is a second-priority reference object, the second-priority reference object can be identified first.

[0145] This example can use the reference object offset determination method described above, which will not be repeated here.

[0146] In this example, the credibility weights of tree 1, tree 2, and traffic sign are first determined, and then the average credibility weight is calculated based on these three credibility weights. It is then determined whether the average credibility weight (i.e., the average of the previously calculated credibility weights) is greater than or equal to the credibility weight threshold (for example, the credibility weight threshold can be set as: the sum of preset credibility weights corresponding to all reference objects / the number of reference objects * t, where t is any rational number from 0 to 1). If the average credibility weight is greater than or equal to the credibility weight threshold, it is confirmed that the PTZ product has not moved; if the average credibility weight is less than the credibility weight threshold, it is confirmed that the PTZ product has moved, or it is considered that the PTZ product may have moved, and the process proceeds to step S314 for further verification.

[0147] Step S314: After a set time interval, acquire the detection image again, and determine the offset information based on the offset between the second position and the first position of the reference object in the acquired detection image;

[0148] Step S315: Calculate the mean confidence weight of the reference object in the detected image, and determine whether the mean confidence weight is greater than or equal to the confidence weight threshold. If the mean confidence weight is greater than or equal to the confidence weight threshold, proceed to step S318. If the mean confidence weight is less than the confidence weight threshold, proceed to step S316 or step S317.

[0149] Step S316: Control the PTZ device to return to the zero position, and determine whether the number of steps to return to the zero position is consistent with the recorded number of steps from the zero position to the preset position. If they are consistent, proceed to step S318; if they are inconsistent, proceed to step S317.

[0150] Step S317: Confirm the PTZ device has moved. Adjust the PTZ device to the preset position. This test is now complete.

[0151] Step S318: Confirm that the PTZ device has not moved, adjust the PTZ device to the preset position, and the test is completed.

[0152] Example 3

[0153] This example illustrates how to determine the source of an image shift when there are subtle shifts in the image.

[0154] like Figure 11 As shown, this example demonstrates how to determine the possible source of the offset by using a reference object (such as a tree) and a road.

[0155] If the location of the road and the location of the trees in the detected image do not change, then it is confirmed that the PTZ device has not moved.

[0156] If the location of the road changes in the detected image but the location of the trees does not change, it is confirmed that the PTZ device may be shaken by an external force, that is, the slight image shift is caused by the movement of the PTZ device.

[0157] If the location of the road in the detected image does not change, but the location of the trees changes, it is confirmed that the reference object may be shaken by an external force, that is, the slight image shift is caused by the shaking of the reference object.

[0158] The device movement detection method provided in this application has the following technical effects:

[0159] 1. It can quickly detect whether the device has moved without adding new hardware, reducing the possibility of video stream loss;

[0160] 2. Since no new hardware equipment is required, the hardware design cost of the product can be effectively reduced, thereby improving the product's competitiveness.

[0161] 3. By setting a confidence weight, the accuracy of lens detection can be guaranteed while increasing redundancy.

[0162] 4. When a slight shift appears in the detected image, the source of the shift can be determined, thus making the results of the device's motion detection more accurate.

[0163] 5. Divide the reference object into regions for easy-to-move reference objects to make the offset detection of reference objects more accurate.

[0164] It will be understood by those skilled in the art that all or some of the steps, systems, or apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

Claims

1. A device movement detection method characterized by, include: The device to be tested is controlled to reach a preset position, the motor is locked, and an initial image collected by the device is acquired. A reference object is determined in the initial image, and the type of the reference object is determined. The type includes a first type and a second type. Under the same external force, the offset of the reference object of the first type is less than the offset of the reference object of the second type. Obtain the first position of the reference object in the initial image, wherein the reference object is an object with a fixed geographical location; During the operation of the device, the detection image collected by the device is acquired; the second position of the reference object in the detection image is acquired; Determining whether the device has moved based on the type of the reference object and the offset between the second and first positions of the reference object includes: When the initial image does not include the first type of reference object but includes at least one second type of reference object, the average confidence weight of all second type of reference objects is determined. When the average confidence weight meets a preset condition, the device is determined to have moved.

2. The device movement detection method according to claim 1, characterized by, Determining whether the device has moved based on the type of the reference object and the offset between the second and first positions of the reference object includes: When the initial image includes a reference object of the first type, and the offset between the second position and the first position of at least one reference object of the first type does not meet a preset offset threshold, it is determined that the device has moved.

3. The device movement detection method according to claim 1, characterized by, The mean confidence weights for all second-type reference objects are determined as follows: For each second type of reference object, if the offset between the second position of the second type of reference object and the first position of the second type of reference object meets a preset offset threshold, the confidence weight of the second type of reference object is determined to be the preset confidence weight corresponding to the second type of reference object; if the offset between the second position of the second type of reference object and the first position of the second type of reference object does not meet the preset offset threshold, the confidence weight of the second type of reference object is determined to be 0, and the average confidence weight of all second type of reference objects is calculated.

4. The device movement detection method according to claim 3, characterized by, The mean confidence weight satisfies the following preset conditions: When the average confidence weight is less than the sum of the preset confidence weights corresponding to each second type of reference object * t / the number of second type of reference objects, the average confidence weight satisfies the preset condition, where t is 0 to 1.

5. The device movement detection method according to claim 3, wherein The reference objects are assigned priorities, and the preset confidence weight of a higher priority reference object is greater than that of a lower priority reference object. Under the same external force, the offset ratio of a higher priority reference object is less than that of a lower priority reference object. The offset ratio is the ratio of the offset of the reference object under the external force to the size of the reference object along the offset direction.

6. The device movement detection method according to claim 5, wherein When different parts of the same object in the initial image have different offsets under the action of external force, the object is divided into a first part and a second part. The maximum offset ratio of the first part is less than or equal to a preset offset ratio threshold, and the maximum offset ratio of the second part is greater than the preset offset ratio threshold. The first part is used as a reference object, and the second part is used as another reference object. The priority of the first part is greater than the priority of the second part.

7. The device movement detection method according to claim 1, wherein Determining whether the device has moved based on the type of the reference object and the offset between the second and first positions of the reference object includes: When the initial image does not include the first type of reference object but includes at least one second type of reference object, and when the offset between the second position and the first position of at least one second type of reference object does not meet a preset offset threshold, N detection images are acquired, with a preset time interval between adjacent detection images; for any detection image, when the offset between the second position and the first position of at least one second type of reference object in the detection image does not meet a preset offset threshold, the detection image is considered to have an offset; when the number of detection images with offsets in the N detection images is greater than or equal to a preset number threshold, it is determined that the device has moved, and the preset number threshold is less than or equal to N.

8. The device movement detection method according to any one of claims 2 to 7, characterized in that, For any reference object, whether the offset between the second position of the reference object and the first position of the reference object satisfies a preset offset threshold includes: Determine the first pixel region where the reference object is located in the initial image. The first pixel region is the region after expanding the minimum region that completely includes the reference object by a preset margin. The preset margin of the first pixel region of the first type of reference object is smaller than the preset margin of the first pixel region of the second type of reference object. When the second position of the reference object is entirely located within the first pixel region, the offset between the second position of the reference object and the first position of the reference object satisfies a preset offset threshold; when the second position of the reference object is at least partially located outside the first pixel region, the offset between the second position of the reference object and the first position of the reference object does not satisfy the preset offset threshold. Alternatively, determine the second pixel region in the detected image where the reference object is located, where the second pixel region is the region after expanding the minimum region that completely includes the reference object by a preset margin; When the first position of the reference object is entirely located within the second pixel region, the offset between the second position of the reference object and the first position of the reference object satisfies a preset offset threshold; when the first position of the reference object is at least partially located outside the second pixel region, the offset between the second position of the reference object and the first position of the reference object does not satisfy the preset offset threshold.

9. An apparatus for detecting movement of a device, the apparatus comprising: The device includes a memory and a processor, wherein the memory stores a program that, when read and executed by the processor, implements the device movement detection method as described in any one of claims 1 to 8.

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