A ship number identification method, an image acquisition method, a device and equipment
By detecting the distance to target vessels using radar and utilizing a pre-established relationship between object distance and focal length, the pan-tilt camera is controlled to adjust its focus, solving the problem of unclear images of vessels at night or moving at high speeds, and improving the efficiency and accuracy of vessel identification.
Patent Information
- Application Number
- CN202311786452.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-22
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-12-22
AI Technical Summary
At night or when ships are moving at high speeds, existing technologies struggle to repeatedly focus on the image, resulting in low efficiency in ship number identification.
By detecting the distance to the target vessel using radar, and utilizing the pre-established correspondence between object distance and focal length, the focusing and zoom parameters of the gimbal camera are determined. The gimbal camera is then controlled to focus, acquire clear images of the vessel, and identify its number.
It enables the rapid acquisition of clear images at night or when ships are moving at high speeds, improving the efficiency and accuracy of ship number identification.
Smart Images

Figure CN117809265B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image recognition, in particular to a ship number recognition method, an image acquisition method, a device and equipment. BACKGROUND
[0002] In the field of public security management of water traffic or road traffic, it is often necessary to identify the information of some target objects, for example, using a thunder cloud all-in-one machine to identify the ship number of an entering ship. In order to identify the information of the target object, it is crucial to collect an image of the target object that meets the clear imaging requirement.
[0003] In the related art, after the pan-tilt camera is rotated to a position for image acquisition of the target object, repeated focusing is performed according to the image imaging effect to collect a clear image containing the target object. However, due to the night or rapid movement of the target object such as a ship, the image imaging effect is often not ideal, and the focusing method in the related art relies on the image imaging effect. Therefore, it is difficult to obtain a suitable focal length value to collect a clear image at this time, resulting in low recognition efficiency when identifying the ship number of the entering ship. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide a ship number recognition method to improve the ship number recognition efficiency. In addition, the embodiments of the present application also provide an image acquisition method to efficiently collect an image that meets the clear imaging requirement. The specific technical solutions are as follows:
[0005] In a first aspect, the embodiments of the present application provide a ship number recognition method applied to a monitoring system, wherein the monitoring system includes a radar and a pan-tilt camera, and the method includes:
[0006] In response to the radar detecting a target ship on the water surface, determining a distance of the target ship relative to the radar to obtain a first object distance;
[0007] Based on a first corresponding relationship between the object distance and the focal length value constructed in advance, determining the focal length value corresponding to the first object distance to obtain the focusing parameter to be used by the pan-tilt camera; wherein each object distance in the first corresponding relationship represents a distance relative to the radar, and the first corresponding relationship is a relationship constructed based on the object distances and the focal length values corresponding to a plurality of predetermined sample points on the water surface. The object distance corresponding to each predetermined sample point is the distance relative to the radar, and the focal length value corresponding to each predetermined sample point is the focal length value used when the pan-tilt camera is rotated to a position for image acquisition of the predetermined sample point and an image meeting the clear imaging requirement is collected;
[0008] Based on the first object distance, calculating the zoom parameter to be used by the pan-tilt camera;
[0009] According to the focusing parameter and the zooming parameter, the pan-tilt camera is controlled to focus, and after the focusing is completed, an image containing the target ship is acquired.
[0010] The image containing the target ship is subjected to ship number recognition, and a ship number of the target ship is obtained.
[0011] In a second aspect, an embodiment of the present application provides an image acquisition method, and the method comprises:
[0012] In response to the radar detecting a target object, a distance of the target object relative to the radar is determined, and a target object distance is obtained.
[0013] Based on a first correspondence relationship between object distances and focal length values that is constructed in advance, a focal length value corresponding to the target object distance is determined, and a target focal length value is obtained. Each object distance in the first correspondence relationship represents a distance relative to the radar, and the first correspondence relationship is constructed based on object distances and focal length values corresponding to a plurality of predetermined sample points. The object distance corresponding to each predetermined sample point is a distance relative to the radar, and the focal length value corresponding to each predetermined sample point is a focal length value used when the pan-tilt camera is rotated to a position for image acquisition of the predetermined sample point and an image meeting imaging clarity requirements is acquired.
[0014] The pan-tilt camera is controlled to rotate to a position for image acquisition of the target object and to acquire an image of the target object at the target focal length value, and an image containing the target object is obtained.
[0015] In a third aspect, an embodiment of the present application provides an image acquisition system, comprising a radar, a pan-tilt camera, and a processing device.
[0016] The radar is configured to detect a target object.
[0017] The processing apparatus is configured to: in response to the radar detecting a target object on the water surface, determine a distance of the target object relative to the radar, to obtain a target distance; determine a focal length value corresponding to the target distance based on a first correspondence relationship between a distance and a focal length value, to obtain a target focal length value; control the pan-tilt camera to rotate to a position for image acquisition of the target object and perform image acquisition of the target object at the target focal length value, to obtain an image containing the target object; wherein each distance in the first correspondence relationship represents a distance relative to the radar, and the first correspondence relationship is a relationship constructed based on distances and focal length values corresponding to a plurality of predetermined sample points, wherein the distance corresponding to each predetermined sample point is a distance relative to the radar, and the focal length value corresponding to each predetermined sample point is a focal length value used when the pan-tilt camera rotates to a position for image acquisition of the predetermined sample point and an image meeting imaging clarity requirements is acquired;
[0018] The pan-tilt camera is configured to rotate to a position for image acquisition of the target object and perform image acquisition of the target object at the target focal length value under the control of the processing apparatus, to obtain an image containing the target object.
[0019] In a fourth aspect, an embodiment of the present application provides a ship number recognition apparatus applied to a monitoring system, wherein the monitoring system includes a radar and a pan-tilt camera, and the apparatus includes:
[0020] A distance determination module is configured to, in response to the radar detecting a target ship on the water surface, determine a distance of the target ship relative to the radar, to obtain a first distance.
[0021] A focal length determination module is configured to determine a focal length value corresponding to the first distance based on a first correspondence relationship between a distance and a focal length value, to obtain a focusing parameter to be used by the pan-tilt camera; wherein each distance in the first correspondence relationship represents a distance relative to the radar, and the first correspondence relationship is a relationship constructed based on distances and focal length values corresponding to a plurality of predetermined sample points on the water surface, wherein the distance corresponding to each predetermined sample point is a distance relative to the radar, and the focal length value corresponding to each predetermined sample point is a focal length value used when the pan-tilt camera rotates to a position for image acquisition of the predetermined sample point and an image meeting imaging clarity requirements is acquired.
[0022] A calculation module is configured to calculate a zoom parameter to be used by the pan-tilt camera based on the first distance.
[0023] A focusing module is configured to control the pan-tilt camera to focus according to the focusing parameter and the zoom parameter, and perform image acquisition of the target ship after focusing is completed, to obtain an image containing the target ship.
[0024] a recognition module, configured to perform ship number recognition on the image containing the target ship, to obtain a ship number of the target ship.
[0025] In a fifth aspect, an embodiment of the present application provides an image acquisition device, the device comprising:
[0026] a first determination module, configured to determine a distance of a target object relative to the radar in response to the radar detecting the target object, to obtain a target distance;
[0027] a second determination module, configured to determine a focal length value corresponding to the target distance based on a first correspondence relationship between distances and focal length values, to obtain a target focal length value; wherein each distance in the first correspondence relationship represents a distance relative to the radar, and the first correspondence relationship is a relationship constructed based on distances and focal length values corresponding to a plurality of predetermined sample points, wherein the distance corresponding to each predetermined sample point is a distance relative to the radar, and the focal length value corresponding to each predetermined sample point is a focal length value used when the gimbal camera is rotated to a position for image acquisition of the predetermined sample point and an image meeting imaging clarity requirements is acquired;
[0028] a control module, configured to control the gimbal camera to rotate to a position for image acquisition of the target object and to perform image acquisition of the target object at the target focal length value, to obtain an image containing the target object.
[0029] In a sixth aspect, an embodiment of the present application provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
[0030] the memory, configured to store a computer program;
[0031] the processor, configured to execute the program stored on the memory, to implement the steps of the ship number recognition method or the image acquisition method.
[0032] In a seventh aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium storing a computer program, and the computer program is executed by a processor to implement the steps of the ship number recognition method or the image acquisition method.
[0033] Embodiments of the present application have the following beneficial effects:
[0034] In the ship number identification method provided by the embodiment of the application, in response to the radar detecting a target ship on the water surface, the distance of the target ship relative to the radar is determined as a first object distance; based on a first correspondence relationship between the object distance and the focal length value constructed in advance, the focal length value corresponding to the first object distance is determined as a focusing parameter to be used, and a zoom parameter is calculated based on the first object distance; the pan-tilt camera is controlled to focus according to the focusing parameter and the zoom parameter, and after the focusing is completed, the target ship is imaged to obtain an image containing the target ship. The ship number of the target ship is identified from the image containing the target ship. Since the first correspondence relationship between the object distance and the focal length value is constructed based on the focal length value used when the image meeting the imaging clarity requirement is collected under each object distance, after the first object distance is determined, the target focal length value is directly determined according to the first correspondence relationship, and the focal length value under the target object distance, at which the image meeting the imaging clarity requirement can be collected, can be quickly obtained. Therefore, the focusing parameter and the zoom parameter can be quickly determined according to the first object distance to focus the pan-tilt camera, so that the image meeting the imaging clarity requirement can be efficiently collected. Further, the ship number identification efficiency can be improved.
[0035] In addition, in the image collection method provided by the embodiment of the application, the focal length value of the pan-tilt camera can be quickly adjusted using the obtained focal length value to realize quick focusing. Compared with the prior art that relies on repeated focusing according to the imaging effect, the present solution can efficiently collect the image meeting the imaging clarity requirement.
[0036] Of course, implementing any product or method of the present application does not necessarily require all the advantages described above. BRIEF DESCRIPTION OF DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other embodiments can also be obtained by those skilled in the art based on these drawings.
[0038] Figure 1 A flowchart of a ship number identification method provided by an embodiment of the present application;
[0039] Figure 2 A flowchart of a construction method of a first correspondence relationship provided by an embodiment of the present application;
[0040] Figure 3 A flowchart of a correction method of a radar-pan-tilt conversion matrix provided by an embodiment of the present application;
[0041] Figure 4A flowchart of an image acquisition method provided by an embodiment of the present application;
[0042] Figure 5 A schematic diagram of selecting a predetermined sample point provided by an embodiment of the present application;
[0043] Figure 6 A schematic diagram of a gimbal camera and a Cartesian plane provided by an embodiment of the present application;
[0044] Figure 7 A schematic diagram of a fitting curve between a distance and a focal length provided by an embodiment of the present application;
[0045] Figure 8A A schematic diagram of a water level correction point provided by an embodiment of the present application;
[0046] Figure 8B A schematic diagram of a No. 1 point and a No. 2 point before and after a water level change provided by an embodiment of the present application;
[0047] Figure 9 A structural schematic diagram of an image acquisition system provided by an embodiment of the present application;
[0048] Figure 10 A structural schematic diagram of a ship number recognition device provided by an embodiment of the present application;
[0049] Figure 11 A structural schematic diagram of an image acquisition device provided by an embodiment of the present application;
[0050] Figure 12 A block diagram of an electronic device for implementing an image acquisition method provided by an embodiment of the present application. DETAILED DESCRIPTION
[0051] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art based on the present application belong to the scope of protection of the present application.
[0052] Next, the professional terms involved in the present application will be introduced first.
[0053] PTZ coordinates: including PT coordinates and Z coordinates, wherein the PT coordinates are parameters for moving the gimbal camera left and right and up and down, the P and T coordinates are horizontal angle pan and pitch angle tilt respectively, and the Z coordinates are magnification parameters of the gimbal camera; it should be noted that in the present application, the position of the gimbal camera for image acquisition of any target, i.e. the position of the PT coordinates required for image acquisition of the target;
[0054] Object distance calibration: a calibration technique that associates the distance of the target from the radar with the focal length value of the PTZ camera;
[0055] Fast focusing: simultaneous zoom and focusing movement, unaffected by image quality;
[0056] Adaptive water level correction: automatically calculates the height difference between the radar and PTZ camera to the horizontal plane, and is used for error elimination of the radar-PTZ calibration conversion matrix.
[0057] Next, first introduce a ship number recognition method provided by the embodiment of the application.
[0058] The ship number recognition method provided by the embodiment of the application can be applied to a monitoring system. Illustratively, the monitoring system can be a radar-PTZ integrated machine, which at least integrates a radar and a PTZ camera. In actual application, after detecting a target ship on the water surface through the radar, the radar-PTZ integrated machine can control the PTZ camera to track the ship according to the detected radar information, so as to collect an image containing the target ship.
[0059] The ship number recognition method provided by the embodiment of the application can include the following steps:
[0060] In response to the radar detecting a target ship on the water surface, determining the distance of the target ship relative to the radar to obtain a first object distance;
[0061] Based on a first corresponding relationship between the object distance and the focal length value constructed in advance, determining the focal length value corresponding to the first object distance to obtain the focusing parameter to be used by the PTZ camera; wherein each object distance in the first corresponding relationship represents the distance relative to the radar, and the first corresponding relationship is a relationship constructed based on the object distances and focal length values corresponding to a plurality of predetermined sample points on the water surface. The object distance corresponding to each predetermined sample point is the distance relative to the radar, and the focal length value corresponding to each predetermined sample point is the focal length value used when the PTZ camera is rotated to a position for image acquisition of the predetermined sample point and an image meeting the imaging clarity requirement is collected;
[0062] Based on the first object distance, calculating the zoom parameter to be used by the PTZ camera;
[0063] According to the focusing parameter and the zoom parameter, controlling the PTZ camera to focus, and after focusing is completed, performing image acquisition on the target ship to obtain an image containing the target ship;
[0064] Performing ship number recognition on the image containing the target ship to obtain the ship number of the target ship.
[0065] The solution provided in this application, in response to radar detecting a target vessel on the water surface, determines the distance of the target vessel relative to the radar as a first object distance; based on a pre-constructed first correspondence between object distance and focal length, determines the focal length value corresponding to the first object distance as a focusing parameter to be used, and calculates zoom parameters based on the first object distance; controls the gimbal camera to focus according to the focusing parameters and zoom parameters, and after focusing is completed, acquires an image of the target vessel to obtain an image containing the target vessel. The image containing the target vessel is then used to identify the vessel's number. Since the first correspondence between object distance and focal length is constructed based on the focal length values used when acquiring images that meet the imaging clarity requirements at various object distances, after determining the first object distance, the target focal length value can be directly determined according to the first correspondence, allowing for the rapid acquisition of the focal length value that meets the imaging clarity requirements at the target object distance. Therefore, based on the first object distance, the focusing parameters and zoom parameters can be quickly determined to focus the gimbal camera, efficiently acquiring images that meet the imaging clarity requirements. This can improve the efficiency of ship number identification.
[0066] The ship number identification method provided in the embodiments of this application will be described below with reference to the accompanying drawings.
[0067] like Figure 1 As shown, the ship number identification method provided in this application embodiment may include steps S101-S105:
[0068] S101, in response to the radar detecting a target vessel on the water surface, determine the distance of the target vessel relative to the radar, and obtain the first object distance;
[0069] As we can understand, radar is an electronic device that uses electromagnetic waves to detect targets. Radar can detect targets on the water's surface. It emits electromagnetic waves to illuminate the target and receives the reflected echoes, thereby obtaining information such as the target's distance and azimuth from the electromagnetic wave emission point. Therefore, when radar detects a target vessel on the water's surface, it can obtain the distance between the target vessel and the radar from the detected information; this distance is the first object distance. In practical applications, if radar detects a target vessel on the water's surface, it can determine the target vessel's radar coordinates, its size, and its distance relative to the radar.
[0070] S102, determine the focal length value corresponding to the first object distance based on a first correspondence relationship between object distance and focal length value, to obtain the focusing parameter to be used by the PTZ camera; wherein each object distance in the first correspondence relationship represents a distance relative to the radar, and the first correspondence relationship is a relationship constructed based on object distances and focal length values corresponding to a plurality of predetermined sample points on the water surface, the object distance corresponding to each predetermined sample point being a distance relative to the radar, and the focal length value corresponding to each predetermined sample point being a focal length value used when the PTZ camera is rotated to a position for image acquisition of the predetermined sample point and an image meeting the imaging clarity requirement is acquired;
[0071] In this embodiment, a first correspondence relationship between object distance and focal length value can be constructed in advance to determine the focal length value corresponding to the first object distance as the target focal length value according to the first correspondence relationship. For example, the first correspondence relationship can be constructed in the following manner: a plurality of sample points at different object distances on the water surface are obtained as predetermined sample points, for each predetermined sample point, the PTZ camera is controlled to rotate to a position for image acquisition of the predetermined sample point to adjust the focal length value, and a focal length value used when an image meeting the imaging clarity requirement is acquired is obtained as the focal length value corresponding to the predetermined sample point. Linear fitting is performed according to the object distance and the focal length value corresponding to each predetermined sample point to obtain the first correspondence relationship between the object distance and the focal length value. For example, the sample points at different object distances can be sample points in an object distance range of 100 m-1000 m. It can be understood that the position for image acquisition of the predetermined sample point can be a position capable of acquiring the PT coordinates of the predetermined sample point.
[0072] It should be noted that, in order to keep the layout clear, the specific implementation steps for constructing the first correspondence relationship are introduced in the following embodiments, which will not be described here.
[0073] S103, calculate the zoom parameter to be used by the PTZ camera based on the first object distance;
[0074] It can be understood that, in order to acquire clear images of the ship at different object distances, the screen-to-body ratio of the ship when imaging should be in a suitable interval, at this time, a target screen-to-body ratio required when a target ship is imaged in the PTZ camera can be preset, when the object distance decreases, the magnification should be adapted to decrease to keep the screen-to-body ratio unchanged, and when the object distance increases, the magnification should be adapted to increase. For example, the preset screen-to-body ratio can be 80%, 90%, etc.
[0075] Optionally, in an implementation manner, calculating the zoom parameter to be used by the PTZ camera based on the first object distance can include steps A1-A2:
[0076] A1, calculating a target field of view according to the first object distance, a length of the target ship, and a preset screen ratio required when the target ship is imaged in the pan-tilt camera, by using a first formula; wherein the length of the target ship is information detected by the radar for the target ship;
[0077] A2, finding a magnification corresponding to the target field of view from a mapping table between field of view and magnification, to obtain a zoom parameter to be used by the pan-tilt camera;
[0078] wherein the first formula is:
[0079]
[0080] wherein fov is the target field of view, L is the length of the target ship, screenRatio is the preset screen ratio, and dis is the first object distance.
[0081] In the present implementation, the target field of view fov of the pan-tilt camera can be calculated by the first formula. Since there is a fixed mapping relationship between the field of view and the magnification, the magnification corresponding to the target field of view can be found from the mapping table between the field of view and the magnification, as the zoom parameter to be used by the pan-tilt camera.
[0082] It should be noted that the present application does not limit the way of calculating the zoom parameter. For example, in actual application, different magnifications corresponding to different object distance ranges can also be preset, so that after the first object distance is obtained, the magnification corresponding to the object distance range in which the first object distance is located can be determined according to the preset magnifications in the different object distance ranges, as the zoom parameter, which is reasonable.
[0083] S104, controlling the pan-tilt camera to focus according to the focusing parameter and the zoom parameter, and after focusing is completed, image acquisition is performed on the target ship to obtain an image containing the target ship;
[0084] It can be understood that after the focusing parameter and the zoom parameter at the first object distance are determined, the focusing motor and the zoom motor of the pan-tilt camera can be controlled to work simultaneously to adjust the focal length value of the pan-tilt camera to the determined focusing parameter and adjust the magnification of the pan-tilt camera to the determined zoom parameter, so as to complete focusing. After focusing is completed, the pan-tilt camera is controlled to perform image acquisition on the target ship to obtain an image containing the target ship.
[0085] Optionally, in an implementation, before the image acquisition on the target ship is performed to obtain an image containing the target ship, the method can further include:
[0086] controlling the pan-tilt camera to rotate to a position for image acquisition on the target ship;
[0087] After the focus parameter and the zoom parameter are determined, the pan-tilt camera can be controlled to rotate to a position for image acquisition of the target ship, and the target ship is imaged with the focus parameter and the zoom parameter to acquire an image meeting the imaging clarity requirement. For example, the position of the pan-tilt camera for image acquisition of the target ship can be the PT coordinate used by the pan-tilt camera to acquire the target ship. In actual application, the pan-tilt camera can be controlled to rotate to the position for image acquisition of the target ship in the following manner: the radar coordinate of the target ship is converted into the PT coordinate by using the radar-pan-tilt calibration conversion matrix obtained by radar-pan-tilt calibration in advance, and then the pan-tilt camera is controlled to rotate to the position of the PT coordinate. The radar coordinate of the target ship can be obtained by radar detection. It can be understood that, by the implementation manner, the pan-tilt camera can be adjusted based on the PT coordinate, the focus parameter and the zoom parameter at the same time, so that the pan-tilt camera can be focused quickly, and an image meeting the imaging clarity requirement can be acquired efficiently.
[0088] Correspondingly, in the embodiment, the image acquisition of the target ship to obtain the image containing the target ship can include:
[0089] In response to the pan-tilt camera rotating to the position for image acquisition of the target ship, the image acquisition of the target ship to obtain the image containing the target ship;
[0090] The determination manner of the position for image acquisition of the target ship includes:
[0091] The radar coordinate of the target ship detected by the radar is converted into the PT coordinate required by the pan-tilt camera by using the radar-pan-tilt calibration conversion matrix obtained by radar-pan-tilt calibration in advance, as the position for image acquisition of the target ship.
[0092] In the embodiment, the radar coordinate of the target ship detected by the radar can be converted by using the radar-pan-tilt calibration conversion matrix obtained by radar-pan-tilt calibration in advance. That is, the radar coordinate of the target ship is brought into the radar-pan-tilt calibration conversion matrix, and the horizontal angle pan and the tilt angle tilt are calculated to obtain the PT coordinate required by the pan-tilt camera. The radar-pan-tilt calibration conversion matrix can refer to the related content of the following step S201, which will not be described here.
[0093] S105, ship number recognition is performed on the image containing the target ship to obtain the ship number of the target ship.
[0094] In this embodiment, the ship number recognition manner of the ship image can be using an existing image recognition algorithm, for example, an OCR (Optical Character Recognition) algorithm, a support vector machine algorithm, or the like, to recognize the ship number of the ship image to obtain a ship number recognition result. It should be noted that the ship number recognition manner in this embodiment is not limited.
[0095] It can be understood that, since the number of ships contained in the collected ship image when the image of the target ship is collected can be multiple, the ship number recognition result obtained by recognizing the ship number of the ship image can include multiple ship numbers.
[0096] Optionally, in an implementation manner, the ship number recognition of the image containing the target ship to obtain the ship number of the target ship can include steps B1-B3.
[0097] B1, performing image analysis processing on the image containing the target ship for ship number recognition to obtain an initial ship number recognition result.
[0098] For example, the image analysis processing manner can be using an image recognition algorithm, for example, an OCR algorithm, a support vector machine algorithm, or the like, to recognize the ship number of the image containing the target ship to obtain the initial ship number recognition result.
[0099] B2, performing predetermined filtering processing on the initial ship number recognition result to obtain a ship number to be used; wherein the predetermined filtering processing is used to remove the ship numbers included in the initial ship number recognition result that already exist in a ship number history list, and the ship number history list stores the ship numbers of the recognized historical ships.
[0100] It can be understood that, when each ship enters the radar detection range, the pan-tilt camera collects the image of the ship, and performs ship number recognition on the collected ship image. Since the previous ship can still be in the field of view of the pan-tilt camera when the new ship is captured, the ship number of the old ship already exists in the ship number history list at this time, and therefore, the ship numbers included in the ship number recognition result that already exist in the ship number history list can be removed to determine the current unrecognized ship number from the ship number recognition result as the ship number to be used. Thus, the ship number of the target ship can be determined according to the ship number to be used subsequently.
[0101] In addition, in actual application, when the ship number recognition is performed on the ship image, the image recognition algorithm can also recognize the ship as a stationary ship or a leaving ship, and if the stationary ship or the leaving ship is recognized, the ship number corresponding to the stationary ship or the leaving ship can also be filtered to meet the business requirement of recognizing the ship number of the entering ship.
[0102] B3, determining a ship number with the highest similarity to the to-be-used ship number from a preset ship name library as the ship number of the target ship; wherein the ship name library stores a plurality of ship numbers.
[0103] Due to the existence of handwriting, pollution, and no reflective mark of the ship plate of the ship, the accuracy of ship number recognition is low. In the embodiment, after obtaining the to-be-used ship number, the to-be-used ship number can be compared with the ship numbers stored in the preset ship name library to select a ship number with the highest similarity to the to-be-used ship number from the ship name library as the ship number of the target ship.
[0104] For example, in a specific implementation, the step B3 of determining a ship number with the highest similarity to the to-be-used ship number from a preset ship name library as the ship number of the target ship can include steps C1-C4:
[0105] C1, traversing the ship numbers in the preset ship name library, and performing character matching on the traversed ship number and the to-be-used ship number;
[0106] For example, the character matching on the traversed ship number and the to-be-used ship number can be performed by using a string matching algorithm such as a BF (Brute Force) algorithm, a KMP (Knuth-Morris-Pratt) algorithm, and the like.
[0107] C2, if a ship number identical to the to-be-used ship number is traversed, determining the traversed ship number as the ship number of the target ship;
[0108] C3, if a ship number identical to the to-be-used ship number is not traversed, scoring the traversed ship number based on the character proportion of the to-be-used ship number matched on the traversed ship number to obtain a score value of the traversed ship number;
[0109] C4, determining the ship number corresponding to the maximum score value as the ship number of the target ship.
[0110] In the implementation, if a ship number identical to the to-be-used ship number is traversed, the traversed ship number can be determined as the ship number of the target ship. If a ship number identical to the to-be-used ship number is not traversed, the traversed ship number can be scored based on the character proportion of the to-be-used ship number matched on the traversed ship number. For example, in actual application, the character proportion of the to-be-used ship number matched on the traversed ship number can be directly determined as the score value of the traversed ship number. Then, the ship number corresponding to the maximum score value is determined as the ship number of the target ship. It should be noted that the scoring manner is not limited in the embodiment, and any scoring manner that makes the score value positively correlated with the character proportion can be used in the application.
[0111] It can be understood that, according to the first correspondence relationship between the object distance and the focal length value, the focusing parameter corresponding to the first object distance can be quickly determined, so that the image meeting the imaging clear requirement can be efficiently collected, and the efficiency of the ship number identification can be improved. Moreover, since the focusing mode used when collecting the image does not depend on the imaging effect of the image, the focused clear image can also be collected at night or when the ship is moving fast, so that the accuracy of the ship number identification can be effectively improved.
[0112] The scheme provided by the embodiment of the present application can determine the distance of the target ship relative to the radar as the first object distance in response to the radar detecting the target ship on the water surface, determine the focal length value corresponding to the first object distance as the focusing parameter to be used based on the first correspondence relationship between the object distance and the focal length value, and calculate the zoom parameter based on the first object distance. The pan-tilt camera is controlled to focus according to the focusing parameter and the zoom parameter, and the image of the target ship is collected after the focusing is completed to obtain the image containing the target ship. The ship number of the target ship is obtained by performing ship number identification on the image containing the target ship. Since the first correspondence relationship between the object distance and the focal length value is constructed based on the focal length value used when collecting the image meeting the imaging clear requirement under each object distance, the target focal length value can be directly determined according to the first correspondence relationship after the first object distance is determined, and the focal length value under the target object distance, which can be used to collect the image meeting the imaging clear requirement, can be quickly obtained. Therefore, the focusing parameter and the zoom parameter can be quickly determined according to the first object distance to control the pan-tilt camera to focus, so that the image meeting the imaging clear requirement can be efficiently collected. Further, the efficiency of the ship number identification can be improved.
[0113] Optionally, in another embodiment of the present application, as shown in Figure 2 the construction method of the first correspondence relationship can include steps S201-S203:
[0114] S201, obtaining the object distance and the focal length value corresponding to a plurality of predetermined sample points on the water surface;
[0115] In the embodiment, a plurality of sample points can be first selected from the water surface as predetermined sample points, and then the object distance and the focal length value corresponding to each predetermined sample point are determined. For example, Figure 5As shown, the way of selecting the plurality of predetermined sample points on the water surface can be: in the fan-shaped detection range of the radar, a polygonal region is selected, then the minimum value point and the maximum value point of the y value in the polygonal region are found, the maximum value point of the y value and the normal line connecting the radar position are selected, and four sample points on the normal line are selected as the predetermined sample points. The four sample points can be the maximum value point P1 of the y value of the polygonal region, the minimum value point P4 of the y value of the polygonal region and the tangent intersection point of the normal line, and the three equidivision points P2 and P3 on the line connecting the P1 point and the P4 point. It should be noted that the number of the predetermined sample points is not limited in the embodiment of the present application. For example, if 10 predetermined sample points are selected, P1, P4 and each nine equidivision point on the line connecting the P1 point and the P4 point can be selected.
[0116] After the plurality of predetermined sample points are selected, the object distance corresponding to each predetermined sample point can be calculated through the radar coordinates of each predetermined sample point and the erection height of the radar. For example, the object distance corresponding to each predetermined sample point can be calculated through the following formula:
[0117]
[0118] Wherein, x and y are the horizontal and vertical coordinates of the predetermined sample point in the radar coordinate system, height is the erection height of the radar, and dis is the object distance corresponding to the predetermined sample point.
[0119] In addition, according to the radar coordinates of each predetermined sample point, the focal length value corresponding to the predetermined sample point can also be obtained.
[0120] Optionally, in an implementation manner, the determination manner of the focal length value corresponding to each predetermined sample point can include:
[0121] controlling the pan-tilt camera to rotate to a position for image acquisition of the predetermined sample point, performing image acquisition, and adjusting the focal length value of the pan-tilt camera during the image acquisition, so as to determine the focal length value used when the image meeting the imaging clarity requirement is collected, and obtain the focal length value corresponding to the predetermined sample point;
[0122] Wherein, the determination process of the position for image acquisition of the predetermined sample point can include:
[0123] performing coordinate conversion on the radar coordinates of the predetermined sample point based on the radar-cloud calibration conversion matrix between the radar and the pan-tilt camera obtained through the radar-cloud calibration in advance, to obtain the PT coordinates used when the pan-tilt camera rotates, as the position for image acquisition of the predetermined sample point.
[0124] In the present implementation, the radar coordinates of each predetermined sample point can be converted into PT coordinates according to the thundercloud calibration conversion matrix obtained by pre-calibration of thundercloud, and then the PT camera is controlled to rotate to the position of the PT coordinates, image acquisition is performed, and the focal length value of the PT camera is adjusted during image acquisition to obtain the focal length value used when an image meeting the imaging clarity requirement is collected. For example, the focal length value can be adjusted manually or automatically, for example, the focal length value is adjusted according to a preset adjustment step, which is reasonable. In addition, in actual application, a clarity threshold can be preset according to the imaging clarity requirement, and whether the image meeting the imaging clarity requirement is collected is determined by judging whether the clarity of the collected image reaches the threshold. In addition, it is worth mentioning that according to the lens focusing curve principle, if the image is collected at the maximum magnification and the imaging is clear, the image collected at a small magnification will also be clear, so during image acquisition, the image can be collected at the maximum magnification, that is, the Z coordinate of the PT camera at this time can be the maximum magnification value of the PT camera.
[0125] For example, the process of obtaining the thundercloud calibration conversion matrix by thundercloud calibration can include: mapping the radar coordinate system to the PT camera Cartesian coordinate system by the following formula:
[0126]
[0127] In the formula, H represents the homography matrix, (x, y) represents the PT camera Cartesian coordinate value, (x0, y0) represents the radar coordinate value, and h represents the height of the radar relative to the horizontal plane, which is the erection height of the thundercloud integrated machine at the initial time. The PT coordinates of the PT camera are calculated according to the mapped PT camera Cartesian coordinates, and a schematic diagram of the position relationship between the PT camera and the Cartesian plane based on the visualization of the ship target object A is shown in FIG. 1: Figure 6
[0128] Suppose that the erection height of the thundercloud integrated machine at the current water level is h, the horizontal angle of the PT camera when detecting the ship is pan, and the tilt angle is tilt, the following formula can be obtained:
[0129]
[0130]
[0131] Where x and y are the PT camera Cartesian coordinate values, the radar tangent is the positive direction of the X axis, the radar normal is the positive direction of the Y axis, and O is the coordinate origin. The conversion relationship between the radar coordinate system and the PT camera PT coordinate system can be represented as:
[0132]
[0133] It can be understood that the conversion relationship obtained by the calibration is a thundercloud calibration conversion matrix. Through the conversion relationship, the radar coordinates can be converted into PT coordinates used when the pan-tilt camera rotates. The value of the P coordinate is the horizontal angle pan in the formula, and the value of the T coordinate is the tilt angle tilt in the formula.
[0134] It should be noted that the embodiments of the present application do not limit the way of determining the focal length value corresponding to the predetermined sample point. For example, in actual application, for each predetermined sample point, the pan-tilt camera can be controlled to rotate to any position where the predetermined sample point can be captured, and then the focal length value is adjusted so that the pan-tilt camera can capture an image meeting the imaging clarity requirement, and the focal length value used when the image meeting the imaging clarity requirement is captured is determined as the focal length value corresponding to the predetermined sample point.
[0135] S202, based on the object distance and focal length value corresponding to the plurality of predetermined sample points, constructing a linear expression about the focal length value under each object distance range to obtain a segmented linear expression; wherein each object distance range contains at least two object distances corresponding to the predetermined sample points;
[0136] In the embodiments, after obtaining the object distance and focal length value corresponding to each predetermined sample point, the obtained each group of object distance and focal length value can be linearly fitted to construct a linear expression about the focal length value under each object distance range to obtain a segmented linear expression.
[0137] For example, if the number of predetermined sample points is 5, the following segmented linear expression can be obtained:
[0138]
[0139] wherein x1, x2, x3, x4 are object distances under different object distance ranges. When x takes a value in [dis1, dis2], f(x) about the focal length value is represented as a linear expression of a1x1+b1, wherein a1 and b1 are constants, x1 is the object distance, and other expressions are similar.
[0140] S203, curve fitting is performed on the constructed segmented linear expression, and the curve expression obtained after the curve fitting is taken as the first corresponding relationship between the object distance and the focal length value.
[0141] It can be understood that since the constructed segmented linear expression will have a sudden change in the focal length value at the boundary of the object distance range corresponding to each segmented linear expression, the accuracy of the determined focal length value is low. Therefore, in order to improve the accuracy of the focal length value, the constructed segmented linear expression can be curve fitted to improve the curve smoothness and avoid the sudden change of the focal length value. The curve expression obtained after the curve fitting is taken as the first corresponding relationship between the object distance and the focal length value.
[0142] The process of curve fitting can include: according to the obtained piecewise linear expression f(x i )(i = 1, 2, 3…, n), n is a positive integer, the fitting function p(x) is obtained:
[0143] ε i = p(x i )-f(x i )
[0144] The vector
[0145] e = [ε1, ε2…, ε n ]
[0146] So that the polynomial square difference
[0147]
[0148] Is the minimum, then p(x) is the best curve obtained by fitting. In the piecewise linear region, each straight line can be regarded as a multivariate function of the polynomial square difference and the coefficients a i , b i , and the extreme value of the multivariate function of the fitting polynomial is obtained. Taking the first straight line in the piecewise linear expression in step S202 as an example, assuming that the fitting curve p(x) = m0x 2 +m1x+m2, the following can be obtained:
[0149]
[0150] Where n is the number of sampling points, and then the bivariate equation of m2, m1 and m0 is obtained:
[0151]
[0152] Elimination obtains the coefficients of the fitting curve.
[0153] It can be seen that by the scheme, the first correspondence between the object distance and the focal length value can be constructed.
[0154] Optionally, in another embodiment of the present application, as shown in Figure 3 The ship number recognition method can further include steps S301-S304:
[0155] S301, in response to the calibration condition for the thundercloud calibration conversion matrix being met, acquiring, as the current focal length value, a focal length value used when an image meeting the imaging clarity requirement is collected if image collection is performed at a position indicated by a predetermined PTZ coordinate of the pan-tilt camera; wherein the predetermined PTZ coordinate is a PTZ coordinate used when image collection is performed by the pan-tilt camera based on the thundercloud calibration conversion matrix for a preset point having a specified object distance, in response to the thundercloud calibration conversion matrix being determined;
[0156] For example, the calibration condition for the thundercloud calibration conversion matrix can be that a preset calibration time is reached, or a condition that an image not meeting the imaging clarity requirement is collected when image collection is performed at the position indicated by the predetermined PTZ coordinate, and the like. It can be understood that when the calibration condition is met, the focal length value used when an image meeting the imaging clarity requirement is collected if image collection is performed at the position indicated by the predetermined PTZ coordinate can be acquired as the current focal length value. For example, if the image collected when image collection is performed at the position indicated by the predetermined PTZ coordinate at this time does not meet the imaging clarity requirement, the focal length value can be adjusted, and the adjusted focal length value meeting the imaging clarity requirement can be taken as the current focal length value.
[0157] The predetermined PTZ coordinate is a PTZ coordinate used when image collection is performed by the pan-tilt camera based on the thundercloud calibration conversion matrix for a preset point having a specified object distance, in response to the thundercloud calibration conversion matrix being determined. It can be understood that the height between the thundercloud all-in-one machine and the horizontal plane used when the thundercloud calibration conversion matrix is determined is the installation height of the thundercloud all-in-one machine, and after the thundercloud calibration is performed based on the height, the change of the water level will cause the thundercloud calibration conversion matrix to be inaccurate, thereby affecting the image clarity when image collection is performed for the preset point. In this embodiment, when the thundercloud calibration conversion matrix is determined, a point on the water surface can be selected as the preset point, and the PTZ coordinate used when the pan-tilt camera performs image collection for the preset point can be determined as the predetermined PTZ coordinate. Thus, subsequently, the change of the installation height of the radar relative to the horizontal plane can be determined by comparing the change of the focal length value used when an image meeting the imaging clarity requirement is collected at the same PTZ coordinate of the pan-tilt camera.
[0158] S302, if the current focal length value is inconsistent with the reference focal length value, determining an object distance corresponding to the current focal length value based on a second correspondence relationship between the object distance and the focal length value, to obtain a second object distance; wherein the reference focal length value is a focal length value corresponding to the specified object distance in the second correspondence relationship;
[0159] In the present implementation, the second correspondence relationship can be constructed in the same way as the first correspondence relationship, but the difference is that the specified sample points are those within a short distance range, such as 10 meters, 30 meters, or 50 meters. It can be understood that when the water level changes, the focal length changes significantly if clear images are to be captured within a short distance range. Therefore, by using the specified sample points within a short distance range to construct the second correspondence relationship, the water level change can be reflected in the clarity of the captured images in a timely manner, so that the thundercloud calibration matrix can be calibrated in a timely manner. Of course, in another implementation, the second correspondence relationship can also be the first correspondence relationship.
[0160] It can be understood that, according to the second correspondence relationship between the object distance and the focal length value constructed in advance, and the current focal length value and the reference focal length value, the second object distance corresponding to the current focal length value and the specified object distance corresponding to the reference focal length value can be obtained. The second object distance is the object distance under the current water level, and the specified object distance is the object distance before the water level changes.
[0161] S303, determining the erection height of the radar relative to the current horizontal plane based on the second object distance and the T coordinate in the predetermined PTZ coordinate;
[0162] After the second object distance is determined, the erection height of the radar relative to the current horizontal plane can be calculated based on the second object distance and the pitch angle of the pan-tilt camera.
[0163] Optionally, in an implementation, determining the erection height of the radar relative to the current horizontal plane based on the second object distance and the T coordinate in the predetermined PTZ coordinate can include:
[0164] calculating the erection height of the radar relative to the current horizontal plane by using a second formula; wherein the second formula is:
[0165]
[0166] wherein H is the erection height of the radar relative to the current horizontal plane, D is the second object distance, t is the T coordinate in the predetermined PTZ coordinate, and θ is the predetermined pitch angle error.
[0167] For example, Figure 8BAs shown, A1 is a preset point on the water surface before the water level changes. After the water level A drops to water level B, the PTZ coordinates remain unchanged, and the image of A2 on the water surface can be collected. By acquiring the image of A2, the focal length value used when the image meeting the clear imaging requirement is collected is obtained, and based on the second correspondence relationship between the pre-constructed focal length value and the object distance, the distance between A2 and the radar, i.e., the second object distance D, is obtained. Then, according to the value t1 of the T coordinate in the predetermined PTZ coordinates corresponding to the A1 point, the height H2 of the radar relative to the current horizontal plane can be calculated by the second formula. Wherein, θ is a predetermined pitch angle error, which is a known value in calculation.
[0168] S304, correcting the thundercloud calibration conversion matrix by using the determined installation height.
[0169] In this embodiment, after the installation height of the radar relative to the current horizontal plane is determined, the pre-determined thundercloud calibration conversion matrix can be corrected based on the determined installation height to achieve adaptive correction of the thundercloud calibration conversion matrix when the water level changes.
[0170] For example, the way of correcting the thundercloud calibration conversion matrix by using the determined installation height can include: using the determined installation height as the installation height of the radar for thundercloud calibration to obtain the corrected thundercloud calibration conversion matrix.
[0171] For example, the way of using the determined installation height as the installation height of the radar for thundercloud calibration can be: replacing the installation height of the radar used in the thundercloud calibration conversion matrix with the determined installation height. It can be understood that by replacing the new installation height with the old installation height, the installation height parameter of the radar in the thundercloud calibration conversion matrix can be corrected to obtain a new thundercloud calibration conversion matrix.
[0172] It can be seen that by this scheme, the thundercloud calibration conversion matrix can be corrected in time when the water level changes, so that images meeting the clear imaging requirement can be collected when the water level changes, and the ship number recognition efficiency can be ensured when the water level changes.
[0173] The embodiment of the present application also provides an image collection method, as shown in Figure 4 The image collection method provided by the embodiment of the present application can include steps S401-S403 as shown:
[0174] S401, in response to the radar detecting a target object, determining the distance of the target object relative to the radar to obtain a target object distance;
[0175] It can be understood that when the radar detects a target object, the distance of the target object relative to the radar can be obtained from the information of the target object detected by the radar, and the distance is the target distance. For example, the target object can be an object to be identified in water traffic or road traffic, such as a ship, a vehicle, etc. In actual application, if the radar detects a target object, the radar coordinates of the target object, the size of the target object, and the distance of the target object relative to the radar can be detected by the radar.
[0176] S402, determining the target focal length value corresponding to the target distance based on a first correspondence relationship between the distance and the focal length value, obtaining a target focal length value; wherein each distance in the first correspondence relationship represents a distance relative to the radar, and the first correspondence relationship is a relationship constructed based on the distance and the focal length value corresponding to a plurality of predetermined sample points, the distance corresponding to each predetermined sample point is a distance relative to the radar, and the focal length value corresponding to each predetermined sample point is a focal length value used when the pan-tilt camera is rotated to a position for image acquisition of the predetermined sample point and an image meeting the imaging clarity requirement is acquired;
[0177] It should be noted that the specific implementation steps for constructing the first correspondence relationship can refer to the related content in the above embodiments, which will not be repeated here. In addition, the construction process of the first correspondence relationship in the above embodiments can be different, and the predetermined sample points used can not be limited to predetermined sample points on the water surface.
[0178] It can be understood that by using the first correspondence relationship constructed in advance to determine the target focal length value corresponding to the target distance, the focal length value at which an image meeting the imaging clarity requirement can be acquired under the target distance can be quickly obtained. Therefore, the focal length value obtained can be used to quickly adjust the focal length value of the pan-tilt camera to achieve rapid focusing.
[0179] S403, controlling the pan-tilt camera to rotate to a position for image acquisition of the target object and image acquisition of the target object at the target focal length value, obtaining an image containing the target object.
[0180] It can be understood that since the target focal length value is the focal length value used when the image meeting the imaging clarity requirement is collected under the target object distance, after the target focal length value is determined, the pan-tilt camera can be controlled to rotate to the position for image collection of the target object, and image collection of the target object is performed at the target focal length value to collect an image meeting the imaging clarity requirement. For example, the position of the pan-tilt camera for image collection of the target object can be the PT coordinate used when the pan-tilt camera can collect the target object. In actual application, the manner of controlling the pan-tilt camera to rotate to the position for image collection of the target object can be to convert the radar coordinate of the target object into the PT coordinate by using the radar calibration conversion matrix obtained by radar calibration in advance, and then control the pan-tilt camera to rotate to the position of the PT coordinate. The radar coordinate of the target object can be obtained by radar detection. It should be noted that the magnification of the pan-tilt camera during image collection can be the maximum value, or the magnification that makes the imaging size of the target object in the pan-tilt camera reach the preset screen ratio, which are both reasonable.
[0181] Optionally, in an implementation manner, controlling the pan-tilt camera to rotate to the position for image collection of the target object and performing image collection of the target object at the target focal length value to obtain an image containing the target object can include:
[0182] controlling the pan-tilt camera to rotate to the target PTZ coordinate and perform image collection of the target object at the target focal length value to obtain an image containing the target object;
[0183] In the implementation manner, the detection information of the target object by the radar can include the size, radar coordinate, distance from the radar, and the like of the target object. According to the detection information of the target object, the pan-tilt camera can be controlled to track the target object to determine the position for image collection of the target object. It can be understood that since the target PTZ coordinate is the position for image collection of the target object determined based on the detection information of the target object by the radar, the pan-tilt camera can be controlled to rotate to the target PTZ coordinate and perform image collection of the target object at the target focal length value to obtain an image containing the target object. Moreover, the PT motion (i.e., the motion of P and T coordinates) of the pan-tilt camera and the zoom and focus adjustment can be simultaneously controlled to control the pan-tilt camera to rotate to the target PTZ coordinate for image collection at the target focal length value, thereby improving the efficiency of image collection.
[0184] The determination manner of the target PTZ coordinate can include steps D1-D3:
[0185] D1, based on a thundercloud calibration conversion matrix between the radar and the pan-tilt-zoom camera obtained by pre-calibrating the thundercloud, performing coordinate conversion on the radar coordinates of the target object detected by the radar to obtain PT coordinates in the target PTZ coordinates required for the pan-tilt-zoom camera to rotate;
[0186] In the present implementation, the radar coordinates of the target object can be brought into the thundercloud calibration conversion matrix to calculate the horizontal angle pan and the tilt angle tilt to obtain the PT coordinates in the target PTZ coordinates required for the pan-tilt-zoom camera to rotate.
[0187] D2, obtaining size information of the target object detected by the radar;
[0188] It can be understood that when the radar detects the target object, the size information of the target object can be obtained, and the size information can at least include the length information of the target object.
[0189] D3, based on the size information of the target object, the target object distance, and a preset screen ratio of the target object imaging in the pan-tilt-zoom camera, calculating the Z coordinate in the target PTZ coordinates required for the pan-tilt-zoom camera to rotate.
[0190] In the present embodiment, the screen ratio of the target object in the required image to be collected can be determined in advance, that is, the proportion of the camera screen occupied by the target object imaging in the pan-tilt-zoom camera, as the preset screen ratio. Then, according to the size information of the target object, the target object distance, and the preset screen ratio of the target object imaging in the pan-tilt-zoom camera, the Z coordinate is calculated.
[0191] Optionally, in an implementation, based on the size information of the target object, the target object distance, and the preset screen ratio of the target object imaging in the pan-tilt-zoom camera, calculating the Z coordinate in the target PTZ coordinates required for the pan-tilt-zoom camera to rotate can include steps E1-E2:
[0192] E1, based on the length of the target object, the target object distance, and the preset screen ratio of the target object imaging in the pan-tilt-zoom camera, calculating the target field of view angle by using a first formula;
[0193] E2, from a mapping table between the field of view angle and the magnification, finding the magnification corresponding to the target field of view angle to obtain the Z coordinate in the target PTZ coordinates required for the pan-tilt-zoom camera to rotate;
[0194] The first formula is:
[0195]
[0196] In the present implementation, fov is the target field of view, L is the length of the target object, screenRatio is the preset screen ratio, and dis is the target object distance.
[0197] In the present implementation, the target field of view fov of the PTZ camera can be calculated by the first formula. Since there is a fixed mapping relationship between the field of view and the magnification, the magnification corresponding to the target field of view can be found from the mapping table between the field of view and the magnification, as the Z coordinate in the target PTZ coordinate.
[0198] The scheme provided by the embodiments of the present application responds to the target object on the water surface detected by the radar, determines the target object distance of the target object relative to the radar, determines the target focal length value corresponding to the target object distance based on the first corresponding relationship between the object distance and the focal length value constructed in advance, controls the PTZ camera to rotate to a position for image acquisition of the target object and performs image acquisition of the target object at the target focal length value to obtain an image containing the target object. Since the first corresponding relationship between the object distance and the focal length value is constructed based on the focal length value used when an image meeting the imaging clarity requirement is acquired under each object distance, after the target object distance is determined, the target focal length value is directly determined according to the first corresponding relationship, and the focal length value under the target object distance at which an image meeting the imaging clarity requirement can be acquired can be quickly acquired. Therefore, the focal length value of the PTZ camera can be quickly adjusted using the acquired focal length value to achieve rapid focusing. Compared with the repeated focusing depending on the imaging effect in the prior art, the present scheme can efficiently acquire an image meeting the imaging clarity requirement.
[0199] Optionally, in another embodiment of the present application, the above-mentioned image acquisition method can further include steps F1-F4:
[0200] F1, in response to the calibration condition for calibrating the radar-camera conversion matrix being met, acquiring, as the current focal length value, the focal length value used when an image meeting the imaging clarity requirement is acquired if the PTZ camera performs image acquisition at the position indicated by the predetermined PTZ coordinate; wherein the predetermined PTZ coordinate is the PTZ coordinate used when the radar-camera conversion matrix is determined, the PTZ camera performs image acquisition for the preset point with the specified object distance based on the radar-camera conversion matrix;
[0201] F2, if the current focal length value is inconsistent with the reference focal length value, determining the object distance corresponding to the current focal length value based on a second correspondence relationship between the object distance and the focal length value, to obtain a second object distance; wherein the reference focal length value is the focal length value corresponding to the first object distance in the second correspondence relationship; and the second correspondence relationship is a relationship constructed based on the object distances and the focal length values corresponding to a plurality of specified sample points, the object distance corresponding to each specified sample point being a distance relative to the radar, and the focal length value corresponding to each specified sample point being a focal length value used when the gimbal camera is turned to a position for image acquisition of the specified sample point and an image meeting the imaging clarity requirement is acquired;
[0202] F3, determining the erection height of the radar relative to the current horizontal plane based on the second object distance and the T coordinate in the predetermined PTZ coordinate;
[0203] F4, correcting the radar-gimbal calibration conversion matrix using the determined erection height.
[0204] It should be noted that the implementation process of steps F1-F4 can refer to the description of steps S301-S304 above, which will not be repeated here.
[0205] It can be seen that through the present solution, the radar-gimbal calibration conversion matrix can be corrected in time when the water level changes, so that images meeting the imaging clarity requirement can be acquired even when the water level changes.
[0206] Optionally, in another embodiment of the present application, the above image acquisition method can further include steps G1-G3:
[0207] G1, in response to the acquired image containing the target object being a ship image obtained by image acquisition of a target ship, performing ship number recognition on the ship image to obtain a ship number recognition result;
[0208] G2, performing predetermined filtering processing on the ship number recognition result to obtain a to-be-used ship number; wherein the predetermined filtering processing is used to remove the ship numbers included in the ship number recognition result that already exist in a ship number history list, and the ship number history list stores the ship numbers of the recognized historical ships;
[0209] G3, determining a ship number with the highest similarity to the to-be-used ship number from a preset ship name library as the ship number of the target ship; wherein the ship name library stores a plurality of ship numbers.
[0210] The specific implementation process of steps G1-G3 can refer to the related descriptions of steps B1-B3 and C1-C4 above, which will not be repeated here.
[0211] It can be seen that, by the scheme, the target object distance corresponding target focal length value is determined quickly according to the pre-constructed first correspondence relationship between the object distance and the focal length value, the ship number recognition is performed on the basis of efficiently collecting the image meeting the imaging clear requirement, and the accuracy of the ship number recognition can be improved. Moreover, since the focusing mode used when the image is collected is independent of the image imaging effect, the focused clear image can be collected at night or when the ship moves quickly, and thus the accuracy of the ship number recognition can be effectively improved.
[0212] In order to better understand the content of the embodiments of the present application, the following is described in combination with a specific example.
[0213] The present example includes three parts, the first part proposes an object distance calibration method, the second part introduces a ship number recognition method, and the third part introduces a method for self-adaptive correction of the thundercloud calibration conversion matrix.
[0214] I. Object distance calibration (corresponding to the construction of the first correspondence relationship in the foregoing)
[0215] (I) Four calibration sample points (corresponding to the predetermined sample points in the foregoing) are selected from the radar sector detection range as calibration inputs, and the selection method is to find the y value minimum point and the y value maximum point in a polygon region. The normal line is formed by the y maximum value point and the radar device, and four points on the normal line are selected as calibration sample points. As shown in Figure 5 The four sample points are the y value maximum point P1 of the polygon region, the y value minimum point P4 of the polygon region, and the three equal division points P2 and P3 on the connecting line of P1 and P4. Correspondingly, if ten calibration sample points are selected, after P1 and P4 are determined, nine equal division points are obtained to obtain all the sample points.
[0216] (II) The four calibration sample points are used to obtain the thundercloud calibration conversion matrix, which is used to convert the radar coordinates of the ship after the ship appears to obtain the PTZ coordinates.
[0217] The process of obtaining the thundercloud calibration conversion matrix by thundercloud calibration can include: mapping the radar coordinate system to the pan-tilt Cartesian coordinate system by the following formula:
[0218]
[0219] In the formula, represents a homography matrix, (x, y) represents a gimbal Cartesian coordinate value, (x0, y0) represents a radar coordinate value, h represents a height of the radar relative to the horizontal plane, and h0 represents an initial height of the radar-gimbal integrated machine. The PT coordinates of the gimbal camera are calculated according to the gimbal Cartesian coordinates obtained by mapping, wherein a schematic diagram of a position relationship between the gimbal camera and the Cartesian plane based on the ship object A visualization is as shown in FIG. 1. Figure 6
[0220] Suppose that the initial height of the radar-gimbal integrated machine is h, the horizontal angle of the gimbal camera when detecting the ship is pan, and the tilt angle is tilt, the following formula can be obtained:
[0221]
[0222]
[0223] wherein x and y are the gimbal Cartesian coordinate values, the radar tangent is the positive direction of the x axis, the radar normal is the positive direction of the y axis, and O is the coordinate origin. The conversion relationship between the radar coordinate system and the PT coordinate system of the gimbal camera can be represented as:
[0224]
[0225] It can be understood that the conversion relationship obtained by the calibration is the radar-gimbal calibration conversion matrix, and through the conversion relationship, the radar coordinates can be converted into the PT coordinates used when the gimbal camera rotates. The value of the P coordinate is the horizontal angle pan in the formula, and the value of the T coordinate is the tilt angle tilt in the formula.
[0226] (Three) Establish a distance value dis and focal length value F corresponding relationship table (corresponding to the first corresponding relationship in the foregoing).
[0227] First, the accurate distance value corresponding to the calibration sample point (corresponding to the object distance corresponding to the predetermined sample point in the foregoing) is obtained, and the accurate distance value, the device shore-based erection height, and the x, y coordinates detected by the radar constitute a three-dimensional coordinate relationship:
[0228]
[0229] wherein x and y are the horizontal and vertical coordinates of the calibration sample point in the radar coordinate system, height is the erection height of the radar, and dis is the accurate distance value corresponding to the calibration sample point.
[0230] All selected calibration sample points are rotated to the specified position (corresponding to the position for image acquisition of the predetermined sample point in the foregoing) using the gimbal, PTZ coordinate values are obtained, a small magnification is used for focusing, and a curve correction is used to determine the focal length value F that meets the focusing clarity standard (corresponding to the imaging clarity requirement in the foregoing).
[0231] After the distance value dis and the focal length value F are obtained, the first corresponding relationship curve of dis and F adopts a manner of splitting the relationship curve into a plurality of straight lines, and expressing the dis / F relationship curve by using a set of all straight lines. Taking five calibration sample points as an example, the distances are 100 m, 300 m, 500 m, 700 m and 900 m, and the set of straight lines is represented by f(x). The curve expression is:
[0232]
[0233] When the abscissa is [dis1, dis2], the focal length value corresponding curve f(x1) is expressed as a straight line of a1x1+b1, where a1 and b1 represent a constant, and other expressions are similar.
[0234] Further, the obtained segmented straight lines are subjected to curve fitting to improve the accuracy of the focal length value. According to the obtained segmented straight lines f(x i )(i=1, 2, 3, 4), a straight line fitting function p(x) is obtained:
[0235] ε i =p(x i )-f(x i )
[0236] Let the vector
[0237] e=[ε1,ε2,ε3,ε4]
[0238] such that the polynomial square difference
[0239]
[0240] is minimum, then p(x) is the best fitting straight line. For the five calibration sample points collected by the ship for the first time, the polynomial square difference and the coefficients a i , b i in the segmented straight line region can be regarded as a multivariate function, and then the extreme value of the multivariate function of the fitting polynomial is obtained. Taking the first straight line as an example, the fitting curve p(x)=m0x 2 +m1x+m2 can be obtained
[0241]
[0242] where n is the number of sample points, and then the bivariate equation of m2, m1 and m0 is obtained
[0243]
[0244] The coefficients of the fitting curve are obtained by eliminating the equation. For example Figure 7The shown is a fitting curve between the distance D and the focal length value F constructed based on the calibration sample points at distances of 100 m, 300 m, 500 m, 700 m and 900 m.
[0245] (Four) After obtaining the dis / F relationship curve, when the ship is detected to enter the detection area, the radar detects the radar coordinates of the ship body in real time, calculates the specific distance from the ship to the radar, and obtains the accurate focal length value F (corresponding to the target focal length value in the foregoing) according to the curve relationship between the distance and the focal length.
[0246] At this time, the radar can also detect the ship length, and solve the optimal magnification required for current tracking based on the following formula:
[0247]
[0248] Wherein, fov is the field of view, shipL is the ship length, screenRatio is the preset screen ratio, and dis is the object distance corresponding to the ship.
[0249] After obtaining the PTZ coordinates and the value of the focal length F, the PTZ camera can be controlled to move to the specified position based on the PT coordinates, the Z coordinates and the focal length value F.
[0250] II. Ship number recognition
[0251] Because of the handwritten, stained, and no reflective mark of the ship plate, the ship number recognition ability of the image recognition algorithm will decrease. Therefore, the post ship number optimization and multi-ship number collision technology are proposed. After the image acquisition is completed, multiple ship numbers in the real-time output snapshot frame are analyzed and processed.
[0252] Post ship number optimization (corresponding to the predetermined filtering processing in the foregoing):
[0253] (1) If a new ship is captured, the previous ship is still in the field of view, and the ship number of the old ship already exists in the ship number history list, then filtering is performed;
[0254] (2) If the ship target frame fed back by the algorithm is static or the ship number target frame is opposite to the current evidence ship running direction (corresponding to the ship leaving in the foregoing), then filtering is performed;
[0255] Multi-ship number collision:
[0256] (1) The ship names in the ship name library are traversed, the input ship number and the traversed ship number are character matched, and the number of correctly matched characters is marked as a similarity score. The traversal priority is:
[0257] If the ship number input by the algorithm is exactly the same as a ship number in the ship name library, the collision is successful, for example, the ship number recognized by OCR is“A123456”, and there is a ship number“A123456”in the ship name library, so the recognized ship number is directly output;
[0258] If the ship number input by the algorithm can be changed into a ship number in the ship name library by modifying no more than 2 characters, the collision is considered successful, and the ship number in the ship name library that collides successfully is output at this time, otherwise the recognized ship number by OCR is directly output; for example, the ship number recognized by OCR is“A123456”, and there is a ship number“A125456”in the ship name library, so“A125456”is output;
[0259] If the ship number input by the algorithm belongs to a substring of a ship number in the ship name library, the collision is considered successful, otherwise the recognized ship number by OCR is directly output; for example, the ship number recognized by OCR is“A123456”, and there is a ship number“A1234”in the ship name library, so“A123456”is output;
[0260] (2) If multiple ship names are collided, the best ship name collision result is selected according to the similarity score as the final ship number output.
[0261] III. Adaptive correction of thundercloud calibration conversion matrix
[0262] In order to ensure stable tracking of the ship, it is necessary to build the relationship between the radar coordinate and the PTZ coordinate of the pan-tilt camera, and the mapping relationship between the radar and the pan-tilt camera is affected by the height of the equipment erection. Affected by the rainfall in the dry season and the flood season, the water level will rise and fall, and the thunder-cloud conversion relationship based on the water level at a certain moment is not applicable to other moments. When tracking the ship, the PT coordinate obtained by converting the radar coordinate has errors, which causes the ship to not be in the center of the screen in real time when the pan-tilt camera is tracking. In order to ensure stable tracking and snapshot of the target, a water level adaptive correction technology is proposed:
[0263] (I) The height of the horizontal plane at the erection moment of the thunder-cloud all-in-one machine is taken as the reference water level. As shown in Figure 8A , the calibration points A, B and C on the water surface are determined, and the corresponding ranges are 10 meters, 30 meters and 50 meters respectively; the water level correction points 1 and 2 correspond to the ranges of 20 meters and 40 meters respectively. Among them, the calibration points and the water level correction points can be the calibration sample points in the above.
[0264] According to the thunder-cloud calibration conversion matrix, the PT coordinates corresponding to the point positions at each range can be converted, which are respectively denoted as PT A , PT B , and PT CPT1, PT2; for A, B, C, 1, 2 five point, control PT coordinates of the PTZ camera to the specified location, that is, the calculated PT coordinates; adjust the magnification Z coordinate to the maximum limit; through the active focusing to obtain the focus value F when the image is focused; get the relationship between the radar distance D and the magnification Z, focal length F of each point, and construct the mapping relationship of focal length F and distance D (corresponding to the second correspondence in the above).
[0265] (ii) Set the water level correction point 1, 2 as the preset point; when the water level rises or falls, call the No. 1 point preset point to get the current focal length value; compare the current focal length value with the focal length value of No. 1 preset point at the reference water level (corresponding to the reference focal length value in the above), the object distance at the current water level can be obtained (corresponding to the second object distance in the above). As shown in Figure 8B , if water level A is the water level before the water level changes, water level B is the water level after the water level drops, O point is the position point of the thunder cloud all-in-one machine, A1 point is No. 1 point preset point at water level A, and A2 point is No. 1 point preset point at water level B. The object distance of No. 1 preset point before the water level changes is the distance OA1 from the PTZ camera to A1, and the object distance of No. 1 preset point after the water level changes is the distance OB1 from the PTZ camera to B1. The erection height of the thunder cloud all-in-one machine before the water level changes is OH1, and the erection height after the water level changes is OH2.
[0266] The relationship between the erection height of the thunder cloud all-in-one machine and the object distance can be expressed as:
[0267]
[0268] , where D is the object distance, H is the erection height of the thunder cloud all-in-one machine, angle t is the angle between the T axis of the PTZ camera and the horizontal direction, that is, the erection pitch angle, θ is the pitch angle error of the T axis of the PTZ camera when the thunder cloud all-in-one machine is erected, and is a known value. By substituting the object distance OB1 at the current water level into this formula, the height OH2 of the thunder cloud all-in-one machine to the horizontal plane at the current water level can be obtained, and the calculated height is used to correct the thunder cloud calibration conversion matrix to form a tracking closed loop. It can be understood that based on the similar principle of calculating the height of the thunder cloud all-in-one machine to the horizontal plane by calling the No. 1 point preset point, the object distance of the No. 2 preset point at the current water level can also be calculated, so as to calculate the height of the thunder cloud all-in-one machine to the horizontal plane. In practical application, one preset point can be selected to calculate the height of the current thunder cloud all-in-one machine to the horizontal plane, or two preset points can be selected to calculate the height of the current thunder cloud all-in-one machine to the horizontal plane and then take the average value as the final height, which is reasonable.
[0269] It can be seen that the mapping relationship between the radar object distance and the P, T, Z and F coordinates is established by the scheme. In the ship tracking process, the ship position detected by the radar is converted into the focal length value in real time, so that the fast zooming and focusing during image acquisition of the moving ship is realized. The problems of the traditional automatic focusing scheme, such as dependence on image effect, long focusing time, inability to focus clearly at night, and inability to simultaneously perform zooming and focusing, are solved. Moreover, the image acquisition system can be used for adaptive water level correction. According to the object distance calibration mapping table, the focal length value is converted into the object distance, a trigonometric function is constructed, so that the height difference between the device and the current water surface is obtained, and the thunder cloud calibration conversion matrix is corrected. The influence of the four-season water level change on the ship tracking and snapshot precision caused by the absence of a tidal table in the inland river is solved, and the ship is always in the center of the screen during tracking and snapshot.
[0270] Corresponding to the method embodiments, the embodiments of the present application also provide an image acquisition system, as shown in the following table. Figure 9 The image acquisition system comprises a radar 910, a processing device 920 and a pan-tilt camera 930.
[0271] The radar 910 is configured to detect a target object.
[0272] The processing device 920 is configured to, in response to the radar detecting a target object on the water surface, determine the distance of the target object relative to the radar to obtain a target object distance; determine the focal length value corresponding to the target object distance based on a pre-constructed first corresponding relationship between the object distance and the focal length value to obtain a target focal length value; control the pan-tilt camera to rotate to a position for image acquisition of the target object and perform image acquisition of the target object at the target focal length value to obtain an image containing the target object; wherein each object distance in the first corresponding relationship represents the distance relative to the radar, and the first corresponding relationship is a relationship constructed based on the object distances and the focal length values corresponding to a plurality of predetermined sample points. The object distance corresponding to each predetermined sample point is the distance relative to the radar, and the focal length value corresponding to each predetermined sample point is the focal length value used when the pan-tilt camera rotates to a position for image acquisition of the predetermined sample point and an image meeting the imaging clarity requirement is acquired;
[0273] The pan-tilt camera 930 is configured to, under the control of the processing device, rotate to a position for image acquisition of the target object and perform image acquisition of the target object at the target focal length value to obtain an image containing the target object.
[0274] It should be noted that the specific function implementation of the radar, the processing device and the pan-tilt camera included in the image acquisition system is introduced in the above method embodiments, which will not be repeated here. In addition, the image acquisition system can constitute a thunder cloud all-in-one machine.
[0275] Corresponding to the above ship number identification method embodiments, the embodiments of the present application also provide a ship number identification device applied to a monitoring system, wherein the monitoring system comprises a radar and a pan-tilt camera, as shown in Figure 10 The device comprises:
[0276] A distance determination module 1010 is configured to determine a distance of a target ship on the water surface relative to the radar in response to the radar detecting the target ship on the water surface, and obtain a first object distance;
[0277] A focal length determination module 1020 is configured to determine a focal length value corresponding to the first object distance based on a first corresponding relationship between object distances and focal length values, and obtain a focusing parameter to be used by the pan-tilt camera; wherein each object distance in the first corresponding relationship represents a distance relative to the radar, and the first corresponding relationship is a relationship constructed based on object distances and focal length values corresponding to a plurality of predetermined sample points on the water surface. The object distance corresponding to each predetermined sample point is a distance relative to the radar, and the focal length value corresponding to each predetermined sample point is a focal length value used when the pan-tilt camera is rotated to a position for image acquisition of the predetermined sample point and an image meeting the imaging clarity requirement is acquired;
[0278] A calculation module 1030 is configured to calculate a zoom parameter to be used by the pan-tilt camera based on the first object distance;
[0279] A focusing module 1040 is configured to control the pan-tilt camera to focus according to the focusing parameter and the zoom parameter, and acquire an image of the target ship after the focusing is completed, and obtain an image containing the target ship;
[0280] An identification module 1050 is configured to perform ship number identification on the image containing the target ship, and obtain a ship number of the target ship.
[0281] Optionally, the first corresponding relationship is constructed in the following manner:
[0282] Object distances and focal length values corresponding to a plurality of predetermined sample points on the water surface are obtained;
[0283] Based on the object distances and focal length values corresponding to the plurality of predetermined sample points, a linear expression of the focal length value under each object distance range is constructed, and a piecewise linear expression is obtained; wherein each object distance range contains object distances corresponding to at least two predetermined sample points;
[0284] The constructed piecewise linear expression is subjected to curve fitting, and a curve expression obtained after the curve fitting is taken as the first corresponding relationship between the object distance and the focal length value.
[0285] Optionally, the focal length value corresponding to each predetermined sample point is determined in the following manner:
[0286] controlling the pan-tilt camera to rotate to a position for image acquisition of the predetermined sample point, performing image acquisition, and adjusting a focal length value of the pan-tilt camera during the image acquisition to determine a focal length value used when an image meeting the imaging clarity requirement is acquired, to obtain a focal length value corresponding to the predetermined sample point;
[0287] wherein the determination of the position for image acquisition of the predetermined sample point comprises:
[0288] performing coordinate conversion on the radar coordinates of the predetermined sample point based on a radar-pan-tilt calibration conversion matrix between the radar and the pan-tilt camera obtained through pre-radar-pan-tilt calibration, to obtain PT coordinates used when the pan-tilt camera rotates, as the position for image acquisition of the predetermined sample point.
[0289] Optionally, before the focusing module performs image acquisition on the target ship to obtain an image containing the target ship, the method further comprises:
[0290] controlling the pan-tilt camera to rotate to a position for image acquisition of the target ship;
[0291] the focusing module performs image acquisition on the target ship to obtain an image containing the target ship, comprising:
[0292] in response to the pan-tilt camera rotating to the position for image acquisition of the target ship, performing image acquisition on the target ship to obtain an image containing the target ship;
[0293] wherein the determination of the position for image acquisition of the target ship comprises:
[0294] performing coordinate conversion on the radar coordinates of the target ship detected by the radar based on a radar-pan-tilt calibration conversion matrix between the radar and the pan-tilt camera obtained through pre-radar-pan-tilt calibration, to the PT coordinates used when the pan-tilt camera rotates, as the position for image acquisition of the target ship.
[0295] Optionally, the calculating module comprises:
[0296] a calculating sub-module configured to calculate a target field of view according to the first distance, a ship length of the target ship, and a preset screen ratio required when the target ship is imaged in the pan-tilt camera, using a first formula; wherein the ship length of the target ship is information detected by the radar for the target ship.
[0297] The search submodule is configured to search for a zoom ratio corresponding to the target field of view angle from a mapping table between field of view angles and zoom ratios, to obtain a zoom parameter to be used by the gimbal camera.
[0298] The first formula is:
[0299]
[0300] The fov is the target field of view angle, L is the length of the target ship, screenRatio is the preset screen ratio, and dis is the first object distance.
[0301] Optionally, the apparatus further includes:
[0302] The acquisition module is configured to, in response to a calibration condition for the radar-camera calibration conversion matrix being met, acquire a focal length value used when the gimbal camera collects an image at a position indicated by a predetermined PTZ coordinate as a current focal length value, if the collected image meets an imaging clarity requirement; the predetermined PTZ coordinate is a PTZ coordinate used when the gimbal camera collects an image based on the radar-camera calibration conversion matrix for a preset point with a specified object distance, in response to the radar-camera calibration conversion matrix being determined.
[0303] The current object distance determination module is configured to, if the current focal length value is inconsistent with a reference focal length value, determine an object distance corresponding to the current focal length value based on a second correspondence relationship between object distances and focal length values, to obtain a second object distance; the reference focal length value is a focal length value corresponding to the specified object distance in the second correspondence relationship.
[0304] The erection height determination module is configured to determine an erection height of the radar relative to a current horizontal plane based on the second object distance and a T coordinate in the predetermined PTZ coordinate.
[0305] The correction module is configured to correct the radar-camera calibration conversion matrix based on the determined erection height.
[0306] Optionally, the erection height determination module is specifically configured to:
[0307] The second formula is used to calculate the erection height of the radar relative to the current horizontal plane; the second formula is:
[0308]
[0309] The H is the erection height of the radar relative to the current horizontal plane, the D is the second object distance, the t is the T coordinate in the predetermined PTZ coordinate, and the θ is a pitch angle error existing for the erection of the radar.
[0310] Optionally, the identification module comprises:
[0311] The analysis sub-module is configured to perform image analysis processing on the image containing the target ship for ship number identification, and obtain an initial ship number identification result.
[0312] The filtering sub-module is configured to perform predetermined filtering processing on the initial ship number identification result, and obtain a ship number to be used; the predetermined filtering processing is configured to remove a ship number that already exists in a ship number history list from the ship numbers included in the initial ship number identification result, and the ship number history list stores ship numbers of historical ships that have been identified.
[0313] The ship number determination sub-module is configured to determine a ship number that has the highest similarity with the ship number to be used from a preset ship name library as the ship number of the target ship; the ship name library stores a plurality of ship numbers.
[0314] Corresponding to the above-mentioned image acquisition method embodiments, the embodiments of the present application further provide an image acquisition device, as shown in Figure 11 The device comprises:
[0315] The first determination module 1110 is configured to determine a distance of a target object relative to the radar in response to the radar detecting the target object on the water surface, and obtain a target object distance.
[0316] The second determination module 1120 is configured to determine a focal length value corresponding to the target object distance based on a first correspondence relationship between object distances and focal length values that is constructed in advance, and obtain a target focal length value; each object distance in the first correspondence relationship represents a distance relative to the radar, and the first correspondence relationship is constructed based on object distances and focal length values corresponding to a plurality of predetermined sample points; the object distance corresponding to each predetermined sample point is a distance relative to the radar, and the focal length value corresponding to each predetermined sample point is a focal length value used when the pan-tilt camera is rotated to a position for image acquisition of the predetermined sample point and an image meeting the imaging clarity requirement is acquired.
[0317] The control module 1130 is configured to control the pan-tilt camera to rotate to a position for image acquisition of the target object and perform image acquisition of the target object at the target focal length value, and obtain an image containing the target object.
[0318] Optionally, the first correspondence relationship is constructed in the following manner:
[0319] The object distances and focal length values corresponding to a plurality of predetermined sample points are obtained.
[0320] constructing a linear expression about the focal length value under each object distance range based on the object distance and the focal length value corresponding to the plurality of predetermined sample points, to obtain a segmented linear expression; wherein each object distance range contains at least two object distances corresponding to the predetermined sample points;
[0321] performing curve fitting on the constructed segmented linear expression, and taking the curve expression obtained after curve fitting as the first corresponding relationship between the object distance and the focal length value;
[0322] wherein the determination manner of the focal length value corresponding to each predetermined sample point comprises:
[0323] controlling the PTZ camera to rotate to a position for image acquisition of the predetermined sample point, performing image acquisition, and adjusting the focal length value of the PTZ camera during image acquisition to determine the focal length value used when an image meeting the imaging clarity requirement is collected, to obtain the focal length value corresponding to the predetermined sample point;
[0324] wherein the determination process of the position for image acquisition of the predetermined sample point comprises:
[0325] performing coordinate conversion on the radar coordinates of the predetermined sample point based on the radar-cloud calibration conversion matrix between the radar and the PTZ camera obtained through pre-radar-cloud calibration, to obtain the PT coordinates used when the PTZ camera rotates, as the position for image acquisition of the predetermined sample point.
[0326] Optionally, the control module is specifically configured to:
[0327] control the PTZ camera to rotate to a target PTZ coordinate, and perform image acquisition on the target object at the target focal length value to obtain an image containing the target object;
[0328] wherein the determination manner of the target PTZ coordinate comprises:
[0329] perform coordinate conversion on the radar coordinates of the target object detected by the radar based on the radar-cloud calibration conversion matrix between the radar and the PTZ camera obtained through pre-radar-cloud calibration, to obtain the PT coordinates in the target PTZ coordinate required to be used when the PTZ camera rotates;
[0330] obtain the size information of the target object detected by the radar;
[0331] based on the size information of the target object, the target object distance, and a preset screen ratio of the target object in the PTZ camera, calculate the Z coordinate in the target PTZ coordinate required to be used when the PTZ camera rotates.
[0332] Optionally, the device further comprises:
[0333] The acquisition module is configured to, in response to the calibration condition for the thundercloud calibration conversion matrix being met, acquire a focal length value used when the pan-tilt camera collects an image at a position indicated by a predetermined PTZ coordinate as a current focal length value, if an image meeting the imaging clarity requirement is collected; wherein the predetermined PTZ coordinate is a PTZ coordinate used when the pan-tilt camera collects an image at a preset point with a specified object distance based on the thundercloud calibration conversion matrix in response to the thundercloud calibration conversion matrix being determined.
[0334] The third determination module is configured to, if the current focal length value is inconsistent with a reference focal length value, determine an object distance corresponding to the current focal length value based on a second correspondence relationship between object distances and focal length values constructed in advance, to obtain a second object distance; wherein the reference focal length value is a focal length value corresponding to the specified object distance in the second correspondence relationship.
[0335] The fourth determination module is configured to determine the erection height of the radar relative to the current horizontal plane based on the second object distance and a T coordinate in the predetermined PTZ coordinate.
[0336] The correction module is configured to correct the thundercloud calibration conversion matrix by using the determined erection height.
[0337] In the technical solution of the present application, the operations of obtaining, storing, using, processing, transmitting, providing and disclosing of user personal information are all performed after the user authorization is obtained.
[0338] The present application also provides an electronic device, as shown in the accompanying drawings, comprising: Figure 12
[0339] The memory 1201 is configured to store a computer program.
[0340] The processor 1202 is configured to execute the program stored in the memory 1201 to implement the ship number recognition method or the image collection method.
[0341] The electronic device can further comprise a communication bus and / or a communication interface, and the processor 1202, the communication interface and the memory 1201 can communicate with each other through the communication bus.
[0342] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.
[0343] The communication interface is used for communication between the above electronic device and other devices.
[0344] The memory can include a Random Access Memory (RAM) and can also include a Non-Volatile Memory (NVM), for example, at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.
[0345] The processor mentioned above can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0346] In another embodiment provided in the present application, a computer readable storage medium is also provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement any of the above ship number identification methods or the steps of the image acquisition method.
[0347] In another embodiment provided in the present application, a computer program product containing instructions is also provided, and when the computer program product is run on a computer, the computer is caused to execute any of the ship number identification methods or the image acquisition method in the above embodiments.
[0348] In the embodiments described above, all or some of the steps can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, all or some of the steps can be implemented in the form of one or more computer programs or program elements. The computer programs reside (at least temporarily) in a memory of a computer during execution. The memory can be a RAM memory, a flash memory, a ROM memory, an EPROM memory, or any other suitable device. The memory can exist within a computer as a stand-alone device, or it can be provided in association with a computer as a system memory, or it can be provided in association with one or more computer processors as a processor memory. The computer programs can be written in any suitable programming language, or languages, and can be compiled or interpreted. The computer programs can be distributed over network coupled computer systems so that the computer programs are stored and executed in a distributed fashion. The computer programs can also be embodied in the form of computer readable data, which can be stored in a computer readable storage medium. The storage medium can be magnetic (e.g., a floppy disk or a hard drive), optical (e.g., a compact disc or a DVD), magneto-optical (e.g., a floptical disk), semiconductor (e.g., a solid state hard drive), or any other suitable device. The computer readable data can be tangibly embodied in an information carrier error correction code, digital signatures, firewalls, and the like, to verify or detect errors, alterations, or other manipulation of the code.
[0349] It should be noted that, in the present document, relational terms such as first and second, and the like can be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. In other words, it is contemplated that the process, method, article, or apparatus that comprises one or more elements possesses those one or more elements, but is not limited to possessing only those one or more elements.
[0350] Each of the embodiments described in the present specification is described in an associated manner, and the same or similar parts among the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for system and device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the description of the method embodiments.
[0351] The above merely provides the preferred embodiment of the present application, and not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for identifying ship numbers, characterized in that, Applied to a monitoring system, the monitoring system including radar and pan-tilt-zoom (PTZ) cameras, the method includes: In response to the radar detecting a target vessel on the water surface, the distance of the target vessel relative to the radar is determined to obtain a first object distance; Based on a pre-constructed first correspondence between object distance and focal length, the focal length corresponding to the first object distance is determined, and the focusing parameters to be used by the gimbal camera are obtained; wherein, each object distance in the first correspondence represents the distance relative to the radar, and the first correspondence is: a relationship constructed based on the object distance and focal length corresponding to multiple predetermined sample points on the water surface, wherein the object distance corresponding to each predetermined sample point is the distance relative to the radar, and the focal length corresponding to each predetermined sample point is the focal length value used when the gimbal camera rotates to the position for image acquisition of the predetermined sample point and acquires an image that meets the requirements for clear imaging. Based on the first object distance, calculate the zoom parameters to be utilized by the gimbal camera; According to the focusing parameters and the zoom parameters, the gimbal camera is controlled to adjust the focus. After the focus is adjusted, the image of the target ship is acquired to obtain an image containing the target ship. The ship number of the target ship is obtained by identifying the ship number in the image containing the target ship.
2. The method according to claim 1, characterized in that, The methods for constructing the first correspondence include: Obtain the object distance and focal length values corresponding to multiple predetermined sample points on the water surface; Based on the object distance and focal length values corresponding to multiple predetermined sample points, a linear expression for the focal length value is constructed for each object distance range, resulting in a piecewise linear expression; wherein each object distance range contains the object distance corresponding to at least two predetermined sample points. The constructed piecewise linear expression is subjected to curve fitting, and the curve expression obtained after curve fitting is used as the first correspondence between the object distance and the focal length value.
3. The method according to claim 2, characterized in that, The methods for determining the focal length value corresponding to each predetermined sample point include: Control the gimbal camera to rotate to a position for image acquisition of the predetermined sample point, perform image acquisition, and adjust the focal length of the gimbal camera during the image acquisition process to determine the focal length value used when acquiring an image that meets the requirements for clear imaging, thereby obtaining the focal length value corresponding to the predetermined sample point. The process of determining the location for image acquisition of the predetermined sample point includes: Based on the radar and the gimbal camera obtained through pre-calibrated radar cloud, the radar coordinates of the predetermined sample point are transformed to obtain the PT coordinates used by the gimbal camera when it rotates, which are used as the position for image acquisition of the predetermined sample point.
4. The method according to claim 1, characterized in that, Before acquiring an image of the target vessel, the process further includes: Control the gimbal camera to rotate to a position for acquiring images of the target vessel; The step of acquiring images of the target vessel to obtain images containing the target vessel includes: In response to the gimbal camera rotating to a position for image acquisition of the target vessel, an image of the target vessel is acquired, resulting in an image containing the target vessel; The method for determining the location for image acquisition of the target vessel includes: Based on the radar and the gimbal camera obtained through pre-calibrated radar cloud, the radar coordinates of the target vessel detected by the radar are converted into PT coordinates required for the rotation of the gimbal camera, which are used as the position for image acquisition of the target vessel.
5. The method according to claim 1, characterized in that, The step of calculating the zoom parameters to be used by the gimbal camera based on the first object distance includes: Based on the first object distance, the length of the target vessel, and the preset screen ratio required for the target vessel to be imaged in the gimbal camera, the target field of view is calculated using the first formula; wherein, the length of the target vessel is the information detected by the radar for the target vessel; From the mapping table between field of view and magnification, find the magnification corresponding to the target field of view to obtain the zoom parameters to be used by the gimbal camera; The first formula is: Where fov is the target field of view, L is the length of the target vessel, screenRatio is the preset screen ratio, and dis is the first object distance.
6. The method according to claim 3 or 4, characterized in that, The method further includes: In response to meeting the calibration conditions for the radar cloud calibration transformation matrix, the focal length value used when the gimbal camera acquires an image at the position indicated by the predetermined PTZ coordinates, if an image meeting the imaging clarity requirement is acquired, is used as the current focal length value; wherein, the predetermined PTZ coordinates are the PTZ coordinates used by the gimbal camera when acquiring an image at a preset point with a specified object distance, determined based on the radar cloud calibration transformation matrix in response to the determination of the radar cloud calibration transformation matrix; If the current focal length value is inconsistent with the reference focal length value, the object distance corresponding to the current focal length value is determined based on the pre-constructed second correspondence between object distance and focal length value, and the second object distance is obtained; wherein, the reference focal length value is the focal length value corresponding to the specified object distance in the second correspondence; Based on the second object distance and the T coordinate in the predetermined PTZ coordinates, the installation height of the radar relative to the current horizontal plane is determined; The thundercloud calibration transformation matrix is corrected using the determined erection height.
7. The method according to claim 6, characterized in that, Determining the radar's installation height relative to the current horizontal plane based on the second object distance and the predetermined T-coordinate in the PTZ coordinate system includes: The installation height of the radar relative to the current horizontal plane is calculated using the second formula; wherein, the second formula is: Where H is the installation height of the radar relative to the current horizontal plane, D is the second object distance, t is the T coordinate in the predetermined PTZ coordinates, and θ is the elevation angle error existing for the installation of the radar.
8. The method according to claim 1, characterized in that, Performing ship number identification on the image containing the target ship to obtain the ship number of the target ship includes: Image analysis processing related to ship number recognition is performed on the image containing the target ship to obtain an initial ship number recognition result; The initial ship number identification result is subjected to a predetermined filtering process to obtain the ship number to be used; wherein, the predetermined filtering process is used to remove ship numbers that already exist in the ship number history list from the ship numbers included in the initial ship number identification result, and the ship number history list stores the ship numbers of identified historical ships. The ship number with the highest similarity to the ship number to be used is determined from a preset ship name database and used as the ship number of the target ship; wherein, the ship name database stores multiple ship numbers.
9. An image acquisition method, characterized in that, The method includes: In response to the radar detecting a target object, the distance of the target object relative to the radar is determined to obtain the target object distance; Based on a pre-constructed first correspondence between object distance and focal length, the focal length corresponding to the target object distance is determined, and the target focal length is obtained. Each object distance in the first correspondence represents the distance relative to the radar, and the first correspondence is a relationship constructed based on the object distance and focal length corresponding to multiple predetermined sample points. The object distance corresponding to each predetermined sample point is the distance relative to the radar, and the focal length corresponding to each predetermined sample point is the focal length used when the gimbal camera rotates to a position for image acquisition of the predetermined sample point and acquires an image that meets the requirements for clear imaging. Control the gimbal camera to rotate to a position for image acquisition of the target object and acquire the image of the target object at the target focal length value to obtain an image containing the target object.
10. The method according to claim 1, characterized in that, The method for constructing the first correspondence includes: Obtain the object distance and focal length values corresponding to multiple predetermined sample points; Based on the object distance and focal length values corresponding to multiple predetermined sample points, a linear expression for the focal length value is constructed for each object distance range, resulting in a piecewise linear expression; wherein each object distance range contains the object distance corresponding to at least two predetermined sample points. The constructed piecewise linear expression is subjected to curve fitting, and the curve expression obtained after curve fitting is used as the first correspondence between the object distance and the focal length value. The method for determining the focal length value corresponding to each predetermined sample point includes: Control the gimbal camera to rotate to a position for image acquisition of the predetermined sample point, perform image acquisition, and adjust the focal length of the gimbal camera during the image acquisition process to determine the focal length value used when acquiring an image that meets the requirements for clear imaging, thereby obtaining the focal length value corresponding to the predetermined sample point. The process of determining the location for image acquisition of the predetermined sample point includes: Based on the radar and the gimbal camera obtained through pre-calibrated radar cloud, the radar coordinates of the predetermined sample point are transformed to obtain the PT coordinates used by the gimbal camera when it rotates, which are used as the position for image acquisition of the predetermined sample point.
11. The method according to claim 9, characterized in that, The step of controlling the gimbal camera to rotate to a position for image acquisition of the target object and acquiring an image of the target object at the target focal length value to obtain an image containing the target object includes: The gimbal camera is controlled to rotate to the target PTZ coordinates, and the target object is captured at the target focal length value to obtain an image containing the target object; The method for determining the target PTZ coordinates includes: Based on the radar and the gimbal camera obtained by pre-calibration of the radar cloud, the radar coordinates of the target object detected by the radar are transformed to obtain the PT coordinates in the target PTZ coordinates required for the rotation of the gimbal camera. Obtain the size information of the target object detected by the radar; Based on the size information of the target object, the target object distance, and the preset screen ratio required for the target object to be imaged in the gimbal camera, the Z coordinate in the target PTZ coordinate system required for the gimbal camera to rotate is calculated.
12. The method according to claim 10 or 11, characterized in that, The method further includes: In response to the calibration conditions for the radar cloud calibration transformation matrix, the focal length value used when the gimbal camera acquires an image at the position indicated by the predetermined PTZ coordinates, if an image meeting the imaging clarity requirement is acquired, is used as the current focal length value; wherein, the predetermined PTZ coordinates are the PTZ coordinates used by the gimbal camera when acquiring an image based on the radar cloud calibration transformation matrix for a preset point with a specified object distance, in response to the determination of the radar cloud calibration transformation matrix; If the current focal length value is inconsistent with the reference focal length value, the object distance corresponding to the current focal length value is determined based on the pre-constructed second correspondence between object distance and focal length value, and the second object distance is obtained; wherein, the reference focal length value is the focal length value corresponding to the first object distance in the second correspondence; Based on the second object distance and the T coordinate in the predetermined PTZ coordinates, the installation height of the radar relative to the current horizontal plane is determined; The thundercloud calibration transformation matrix is corrected using the determined erection height.
13. An image acquisition system, characterized in that, include: Radar, gimbal camera and processing unit; The radar is used for target object detection; The processing device is configured to, in response to radar detecting a target object, determine the distance of the target object relative to the radar to obtain a target object distance; based on a pre-constructed first correspondence between object distance and focal length, determine the focal length value corresponding to the target object distance to obtain a target focal length value; control the gimbal camera to rotate to a position for image acquisition of the target object and acquire an image of the target object using the target focal length value to obtain an image containing the target object; wherein, each object distance in the first correspondence represents the distance relative to the radar, and the first correspondence is a relationship constructed based on the object distance and focal length values corresponding to multiple predetermined sample points, where the object distance corresponding to each predetermined sample point is the distance relative to the radar, and the focal length value corresponding to each predetermined sample point is the focal length value used when the gimbal camera rotates to a position for image acquisition of the predetermined sample point and acquires an image that meets the imaging clarity requirements; The gimbal camera, under the control of the processing device, rotates to a position for image acquisition of the target object and acquires an image of the target object at the target focal length value, thereby obtaining an image containing the target object.
14. A ship number identification device, characterized in that, The device is used in a monitoring system, which includes radar and a pan-tilt camera, and includes: A distance determination module is used to determine the distance of the target vessel relative to the radar in response to the radar detecting a target vessel on the water surface, and to obtain a first object distance; The focal length determination module is used to determine the focal length value corresponding to the first object distance based on a pre-constructed first correspondence between object distance and focal length value, thereby obtaining the focusing parameters to be used by the gimbal camera; wherein, each object distance in the first correspondence represents the distance relative to the radar, and the first correspondence is: a relationship constructed based on the object distance and focal length values corresponding to multiple predetermined sample points on the water surface, wherein the object distance corresponding to each predetermined sample point is the distance relative to the radar, and the focal length value corresponding to each predetermined sample point is the focal length value used when the gimbal camera rotates to the position for image acquisition of the predetermined sample point and acquires an image that meets the requirements for clear imaging. The calculation module is used to calculate the zoom parameters to be utilized by the gimbal camera based on the first object distance; The focusing module is used to control the gimbal camera to focus according to the focusing parameters and the zoom parameters, and after focusing is completed, to acquire an image of the target ship and obtain an image containing the target ship. The identification module is used to identify the ship number of the image containing the target ship, and obtain the ship number of the target ship.
15. An image acquisition device, characterized in that, The device includes: The first determining module is used to determine the distance of the target object relative to the radar in response to the radar detecting a target object, thereby obtaining the target object distance; The second determining module is used to determine the focal length value corresponding to the target object distance based on a pre-constructed first correspondence between object distance and focal length value, thereby obtaining the target focal length value; wherein, each object distance in the first correspondence represents the distance relative to the radar, and the first correspondence is: a relationship constructed based on the object distance and focal length values corresponding to multiple predetermined sample points, wherein the object distance corresponding to each predetermined sample point is the distance relative to the radar, and the focal length value corresponding to each predetermined sample point is the focal length value used when the gimbal camera rotates to the position for image acquisition of the predetermined sample point and acquires an image that meets the imaging clarity requirements; The control module is used to control the gimbal camera to rotate to a position for image acquisition of the target object and acquire the image of the target object at the target focal length value, thereby obtaining an image containing the target object.
16. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-12.
17. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-12.
Citation Information
Patent Citations
Laser radar-assisted camera automatic focusing method
CN113920197A
Automatic focusing system and method for tower polling by unmanned aerial vehicle
CN114020039A