Camera calibration and ship tracking method and device, electronic equipment and storage medium

Through the camera calibration method and ship tracking technology, the problem of poor supervision effect in traditional maritime ship supervision is solved, real-time tracking and video transmission of risky ships are realized, supervision efficiency and accuracy are improved, and operation and maintenance costs are reduced.

CN118587299APending Publication Date: 2024-09-03WUHAN XINHAI YUANHANG TECH R & D CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410747656.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2024-09-03

Smart Images

  • Figure CN118587299A_ABST
    Figure CN118587299A_ABST
Patent Text Reader

Abstract

The invention relates to a camera calibration and ship tracking method and device, electronic equipment and a storage medium, and belongs to the technical field of maritime ship supervision, and the method comprises the steps: obtaining the first positioning information of a camera, and the video information shot by the camera; selecting a reference object in the center of the camera based on the video information, and acquiring second positioning information of the reference object and first PTZ information of the camera; and based on the first positioning information, the second positioning information and the first PTZ information, calibrating installation information and video linkage parameters of the camera. According to the method, the problem of poor ship supervision effect in the prior art is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of maritime ship supervision technology, and in particular to a camera calibration and ship tracking method, device, electronic equipment and storage medium. Background Art

[0002] Water transportation is a mode of transportation that uses ships, rafts and other floating tools to transport passengers and goods on rivers, lakes, artificial waterways and oceans. It is an important part of my country's comprehensive transportation system and is increasingly showing its great role. Due to the limitations of water monitoring conditions, the supervision effect on ships is not good. In traditional maritime ship supervision scenarios, supervisors cannot detect risky ships in a timely manner, and the original camera video retrieval cannot fully cover, resulting in difficulty in review and supervision. Summary of the invention In view of this, it is necessary to provide a camera calibration and ship tracking method, device, electronic device and storage medium to solve the problem of poor supervision effect of ships in existing technologies.

[0003] In order to solve the above problem, the present invention provides a camera calibration method, comprising: Obtaining first positioning information of a camera and video information captured by the camera; Selecting a reference object at the exact center of the camera based on the video information, and acquiring second positioning information of the reference object and first PTZ information of the camera; The installation information and video linkage parameters of the camera are calibrated based on the first positioning information, the second positioning information and the first PTZ information.

[0004] In a possible implementation, the first positioning information includes: first latitude and longitude coordinates and installation height of the camera installation location; The second positioning information includes: second latitude and longitude coordinates of the reference object.

[0005] In a possible implementation, the camera installation information includes: vertical installation height difference and longitude and latitude information of the camera installation point; The video linkage parameters of the camera include: the horizontal rotation error coefficient, the horizontal offset angle and the vertical error compensation angle of the camera; The calibrating the installation information and the video linkage parameters of the camera based on the first positioning information, the second positioning information and the first PTZ information includes: Calculating the azimuth angle of the reference object relative to the camera based on the first longitude and latitude coordinates, the second longitude and latitude coordinates, and the earth coordinate orientation; Analyzing and obtaining a rotation angle of the camera based on the first PTZ information; The horizontal rotation error coefficient and the horizontal offset angle of the camera are calculated based on the azimuth angle and the rotation angle, wherein the horizontal offset angle includes: the horizontal offset angle between the initial 0° angle of the camera installation and the true north direction; Based on the trigonometric relationship between the installation height, the first longitude and latitude coordinates, and the second longitude and latitude coordinates, a vertical error compensation angle and a vertical installation height difference of the camera are calculated; The camera is calibrated based on the horizontal rotation error coefficient, the horizontal offset angle, the vertical error compensation angle and the vertical installation height difference.

[0006] The present invention also provides a ship tracking method, comprising: Predict the third-party positioning information of the target ship based on the ship tracking prediction algorithm; Calculate second PTZ information of the tracking camera based on the third positioning information; updating the parameters of the tracking camera based on the second PTZ information; Tracking the target vessel based on the updated tracking camera; Wherein, the tracking camera is calibrated according to the camera calibration method described in any one of the above method items.

[0007] In a possible implementation, tracking the target ship based on the updated tracking camera includes: Based on the updated tracking camera, the target ship is captured at a preset time interval to obtain a video stream; The video stream is transcoded, saved and transmitted to the client to complete the tracking.

[0008] In a possible implementation, transcoding, saving, and transmitting the video stream to the client includes: Establishing a communication connection between the tracking camera and the client based on P2P direct connection technology; The video stream is transcoded based on the ffmpeg program and saved as a video file in mp4 format; The video file is transmitted to the client based on the webstream technology.

[0009] The present invention also provides a ship tracking device, comprising: A calibration module, used to calibrate the installation information of the tracking camera according to the camera calibration method described in any one of the above method items; A prediction module, used to predict the third positioning information of the target ship based on a ship tracking prediction algorithm; An updating module, configured to update parameters of the tracking camera based on the second PTZ information; The tracking module is used to track the target ship based on the updated tracking camera.

[0010] In a possible implementation, the tracking module includes: A communicator, used to establish a communication connection between the tracking camera and the client based on P2P direct connection technology; A transcoder, used for transcoding the video stream based on the ffmpeg program and saving it into a video file in mp4 format; A transmitter is used to transmit the video file to the client based on the webstream technology.

[0011] The present invention also provides an electronic device, comprising: Memory, used to store programs; A processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the camera calibration method as described in any one of the above method items, or the steps in the ship tracking method as described in any one of the above method items.

[0012] The present invention also provides a storage medium for storing a computer-readable program or instruction, which, when executed by a processor, can implement the steps of a camera calibration method as described in any one of the above-mentioned method items, or the steps of a ship tracking method as described in any one of the above-mentioned method items.

[0013] The beneficial effects of the present invention are as follows: the present invention provides a camera calibration method, which first obtains the positioning information of the camera and the shot video, then selects a reference object in the exact center of the video, obtains the positioning information of the reference object and the PTZ information of the camera, and then calibrates the installation information and linkage parameters of the camera based on the positioning information of the two points and the PTZ information of the camera. After a risky ship is detected, the linkage camera can continuously track, capture, and record the risky ship, which is convenient for immediate reminders and later evidence collection, thereby better solving the problem of poor supervision effect of the existing technology on ships. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 A method flow chart of an embodiment of a camera calibration method provided by the present invention; Figure 2 for Figure 1 A method flow chart of an embodiment of step S103; Figure 3 A method flow chart of an embodiment of a ship tracking method provided by the present invention; Figure 4 for Figure 3 A method flow chart of an embodiment of step S304; Figure 5 for Figure 4 A method flow chart of an embodiment of step S402; Figure 6 A schematic structural diagram of an embodiment of a ship tracking device provided by the present invention; Figure 7 for Figure 6 A schematic diagram of the structure of an embodiment of a tracking module; Figure 8 A schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0015] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.

[0016] In the description of the embodiments of the present invention, unless otherwise specified, "multiple" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone.

[0017] The descriptions of "first", "second", etc. involved in the embodiments of the present invention are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the technical features defined as "first" and "second" may explicitly or implicitly include at least one of the features.

[0018] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0019] In order to solve the above problems, Figure 1 The present invention provides a camera calibration method, comprising: Step S101, obtaining first positioning information of a camera and video information captured by the camera; Step S102: selecting a reference object at the exact center of the camera based on the video information, and obtaining second positioning information of the reference object and first PTZ information of the camera; Step S103: calibrate the camera installation information and video linkage parameters based on the first positioning information, the second positioning information and the first PTZ information.

[0020] It should be noted that the positioning information collected in the embodiment of the present invention may be obtained through a GIS map.

[0021] Furthermore, this embodiment adopts video linkage calibration technology. When collecting video linkage data, you can first find a reference object in the video screen (either static or dynamic, static reference object calibration is simpler and more convenient) as the center of the video, and mark the reference object on the GIS map at the same time to obtain the latitude and longitude information of the reference object and the PTZ information of the camera.

[0022] Compared with the prior art, the camera calibration method provided by the present invention first obtains the positioning information of the camera and the video taken, then selects a reference object in the exact center of the video, obtains the positioning information of the reference object and the PTZ information of the camera, and then calibrates the installation information and linkage parameters of the camera based on the positioning information of the two points and the PTZ information of the camera. After detecting a risky ship, the linkage camera can continuously track, capture, and record the risky ship, which is convenient for immediate reminders and later evidence collection, thereby better solving the problem of poor supervision effect of ships in the prior art. In addition, this method can also greatly reduce the learning cost of the implementation personnel and facilitate operation and maintenance.

[0023] In a possible implementation, the first positioning information includes: first latitude and longitude coordinates of the camera installation location and an installation height; The second positioning information includes: second latitude and longitude coordinates of the reference object.

[0024] In a possible implementation, the camera installation information includes: vertical installation height difference and longitude and latitude information of the camera installation point; The video linkage parameters of the camera include: the horizontal rotation error coefficient, horizontal offset angle and vertical error compensation angle of the camera; like Figure 2 , step S103 includes: Step S201, calculating the azimuth of the reference object relative to the camera based on the first longitude and latitude coordinates, the second longitude and latitude coordinates and the earth coordinate orientation; Step S202: Analyze and obtain the rotation angle of the camera based on the first PTZ information; Step S203: Calculate the horizontal rotation error coefficient and horizontal offset angle of the camera based on the azimuth angle and the rotation angle, wherein the horizontal offset angle includes: the horizontal offset angle between the initial 0° angle of the camera installation and the true north direction; Step S204, calculating the vertical error compensation angle and the vertical installation height difference of the camera based on the trigonometric function relationship between the installation height, the first longitude and latitude coordinates, and the second longitude and latitude coordinates; Step S205: calibrate the camera based on the horizontal rotation error coefficient, the horizontal offset angle, the vertical error compensation angle, and the vertical installation height difference.

[0025] like Figure 3 The present invention also provides a ship tracking method, comprising: Step S301, predicting the third positioning information of the target ship based on the ship tracking prediction algorithm; Step S302, calculating the second PTZ information of the tracking camera based on the third positioning information; Step S303: updating the parameters of the tracking camera based on the second PTZ information; Step S304: Tracking the target ship based on the updated tracking camera; The tracking camera is calibrated according to the camera calibration method described in any one of the above method items.

[0026] It is understandable that, because the ship tracking prediction algorithm has accurate positioning and supports online debugging, if the camera installation information is deviated due to environmental factors in the later stage, the system can also quickly complete recalibration, which is convenient for operation and maintenance; like Figure 4 In a possible implementation, step S304 includes: Step S401: capturing the target ship at a preset time interval based on the updated tracking camera to obtain a video stream; Step S402: transcode, save and transmit the video stream to the client to complete the tracking.

[0027] like Figure 5 In a possible implementation, step S402 includes: Step S501: establishing a communication connection between the tracking camera and the client based on P2P direct connection technology; Step S502: transcode the video stream based on the ffmpeg program and save it as a video file in mp4 format; Step S503: Transmit the video file to the client based on the webstream technology.

[0028] It should be noted that after the browser plug-in is cancelled, the conventional FLV and HLS video stream processing technology mainly decodes the video RTSP stream and transcodes it into FLV and HLS so that the browser can directly play it using the video tag. However, this method will consume a certain amount of time during the first decoding and transcoding process, resulting in a delay in the final playback of the video on the browser. It is not applicable in application scenarios where video linkage tracking requires low video latency.

[0029] The embodiment of the present invention adopts the P2P direct connection mode and the webRtc technology, and through NAT mapping, enables the client to directly connect to the camera to reduce the delay, and then through the webstream technology, there is no need to perform secondary transcoding on the video, and supports direct playback of the rtsp live stream in the browser, further reducing the video delay, and finally controlling the video delay within 1 second.

[0030] like Figure 6 The present invention further provides a ship tracking device 60, comprising: A calibration module 610, configured to calibrate the installation information of the tracking camera according to the camera calibration method described in any one of the above method items; A prediction module 620, configured to predict the third positioning information of the target ship based on a ship tracking prediction algorithm; An updating module 630, configured to update parameters of the tracking camera based on the second PTZ information; The tracking module 640 is used to track the target ship based on the updated tracking camera.

[0031] like Figure 7 In one possible implementation, the tracking module 640 includes: The communicator 710 is used to establish a communication connection between the tracking camera and the client based on the P2P direct connection technology; The transcoder 720 is used to transcode the video stream based on the ffmpeg program and save it into a video file in mp4 format; The transmitter 730 is used to transmit the video file to the client based on the webstream technology.

[0032] like Figure 8 As shown, the present invention also provides an electronic device 80. The electronic device 80 includes a processor 810 and a memory 820. Figure 8 Only some of the components of the electronic device 80 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0033] In some embodiments, the processor 810 may be a central processing unit (CPU), a microprocessor or other data processing chip, and is used to run program codes or process data stored in the memory 820, such as the point trace aggregation method of the present invention.

[0034] In some embodiments, the processor 810 may be a single server or a server group. The server group may be centralized or distributed. In some embodiments, the processor 810 may be local or remote. In some embodiments, the processor 810 may be implemented in a cloud platform. In one embodiment, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-cloud, etc., or any combination thereof.

[0035] In some embodiments, the memory 820 may be an internal storage unit of the electronic device 80, such as a hard disk or memory of the electronic device 80. In other embodiments, the memory 820 may also be an external storage device of the electronic device 80, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 80.

[0036] Furthermore, the memory 820 may include both an internal storage unit of the electronic device 80 and an external storage device. The memory 820 is used to store application software installed in the electronic device 80 and various data.

[0037] In one embodiment, when the processor 810 executes the camera calibration program in the memory 820, the following steps may be implemented: Obtaining first positioning information of the camera and video information captured by the camera; A reference object is selected at the exact center of the video information, and the second positioning information of the reference object and the first PTZ information of the camera are obtained; The installation information of the camera is calibrated based on the first positioning information, the second positioning information, and the first PTZ information.

[0038] In one embodiment, when the processor 810 executes the ship tracking program in the memory 820, the following steps may be implemented: Predict the third-party positioning information of the target ship based on the ship tracking prediction algorithm; Calculate second PTZ information of the tracking camera based on the third positioning information; updating parameters of the tracking camera based on the second PTZ information; Tracking of target vessels based on updated tracking cameras; The tracking camera is calibrated according to the camera calibration method described in any one of the above method items.

[0039] It should be understood that: when the processor 810 executes the point trace clustering and point trace condensation programs in the memory 820, in addition to the above functions, other functions may also be implemented. For details, please refer to the description of the corresponding method embodiments above.

[0040] Furthermore, the embodiment of the present invention does not specifically limit the type of the electronic device 80 mentioned, and the electronic device 80 may be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, a laptop computer, etc. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with IOS, Android, Microsoft or other operating systems. The above-mentioned portable electronic device may also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, the electronic device 80 may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0041] An embodiment of the present application also provides a storage medium for storing a computer-readable program or instruction, which, when executed by a processor, can implement the steps of a camera calibration method as described in any one of the above method items, or the steps of a ship tracking method as described in any one of the above method items.

[0042] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a computer storage medium, wherein the computer storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.

[0043] The above is a detailed introduction to the point clustering and point condensation method, device, electronic device and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A camera calibration method, characterized in that: include: Obtaining first positioning information of a camera and video information captured by the camera; Selecting a reference object at the exact center of the camera based on the video information, and acquiring second positioning information of the reference object and first PTZ information of the camera; The installation information and video linkage parameters of the camera are calibrated based on the first positioning information, the second positioning information and the first PTZ information.

2. The camera calibration method according to claim 1, characterized in that: The first positioning information includes: first latitude and longitude coordinates of the camera installation location and installation height; The second positioning information includes: second latitude and longitude coordinates of the reference object.

3. The camera calibration method according to claim 2, characterized in that: The camera installation information includes: vertical installation height difference and longitude and latitude information of the camera installation point; The video linkage parameters of the camera include: the horizontal rotation error coefficient, the horizontal offset angle and the vertical error compensation angle of the camera; The calibrating the installation information and the video linkage parameters of the camera based on the first positioning information, the second positioning information and the first PTZ information includes: Calculating the azimuth angle of the reference object relative to the camera based on the first longitude and latitude coordinates, the second longitude and latitude coordinates, and the earth coordinate orientation; Analyzing and obtaining a rotation angle of the camera based on the first PTZ information; The horizontal rotation error coefficient and the horizontal offset angle of the camera are calculated based on the azimuth angle and the rotation angle, wherein the horizontal offset angle includes: the horizontal offset angle between the initial 0° angle of the camera installation and the true north direction; Based on the trigonometric relationship between the installation height, the first longitude and latitude coordinates, and the second longitude and latitude coordinates, a vertical error compensation angle and a vertical installation height difference of the camera are calculated; The camera is calibrated based on the horizontal rotation error coefficient, the horizontal offset angle, the vertical error compensation angle and the vertical installation height difference.

4. A ship tracking method, characterized in that: include: Predict the third-party positioning information of the target ship based on the ship tracking prediction algorithm; Calculate second PTZ information of the tracking camera based on the third positioning information; updating the parameters of the tracking camera based on the second PTZ information; Tracking the target vessel based on the updated tracking camera; Wherein, the tracking camera is calibrated according to the camera calibration method described in any one of claims 1 to 3.

5. The ship tracking method according to claim 4, characterized in that: The tracking of the target ship based on the updated tracking camera includes: Based on the updated tracking camera, the target ship is captured at a preset time interval to obtain a video stream; The video stream is transcoded, saved and transmitted to the client to complete the tracking.

6. The ship tracking method according to claim 5, characterized in that: The step of transcoding, storing and transmitting the video stream to the client comprises: Establishing a communication connection between the tracking camera and the client based on P2P direct connection technology; The video stream is transcoded based on the ffmpeg program and saved as a video file in mp4 format; The video file is transmitted to the client based on the webstream technology.

7. A ship tracking device, characterized in that: include: A calibration module, used to calibrate the installation information of the tracking camera according to the camera calibration method described in any one of claims 1 to 3 above; A prediction module, used to predict the third positioning information of the target ship based on a ship tracking prediction algorithm; An updating module, configured to update parameters of the tracking camera based on the second PTZ information; The tracking module is used to track the target ship based on the updated tracking camera.

8. The ship tracking device according to claim 7, characterized in that: The tracking module includes: A communicator, used to establish a communication connection between the tracking camera and the client based on P2P direct connection technology; A transcoder, used for transcoding the video stream based on the ffmpeg program and saving it into a video file in mp4 format; A transmitter is used to transmit the video file to the client based on the webstream technology.

9. An electronic device, characterized in that: include: Memory, used to store programs; A processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the camera calibration method as described in any one of claims 1 to 3, or the steps in the ship tracking method as described in any one of claims 4 to 6.

10. A storage medium, characterized in that: Used to store computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the camera calibration method as described in any one of claims 1 to 3, or the steps in the ship tracking method as described in any one of claims 4 to 6.