WO2022205734A1 - Image time synchronization method and apparatus, and electronic device and storage medium - Google Patents
Image time synchronization method and apparatus, and electronic device and storage medium Download PDFInfo
- Publication number
- WO2022205734A1 WO2022205734A1 PCT/CN2021/112178 CN2021112178W WO2022205734A1 WO 2022205734 A1 WO2022205734 A1 WO 2022205734A1 CN 2021112178 W CN2021112178 W CN 2021112178W WO 2022205734 A1 WO2022205734 A1 WO 2022205734A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image
- timestamp
- sequence
- head
- frame number
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000004891 communication Methods 0.000 claims description 17
- 238000004590 computer program Methods 0.000 claims description 15
- 238000004364 calculation method Methods 0.000 claims description 9
- 230000008569 process Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008439 repair process Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/04—Synchronising
Definitions
- the present application relates to the technical field of intelligent vehicles, and in particular, to an image time synchronization method, device, electronic device and storage medium.
- the traditional method of obtaining the time stamp of the image captured by the camera is: after the system side of the industrial computer obtains the image through the driver, the current time of the system is used as the time stamp of the image. But this is not accurate enough.
- the system clock is not a high-precision clock, and secondly, the time to acquire the image from the driver is not the image exposure time. Therefore, the above method is usually applied to some systems with weak real-time requirements.
- time synchronizers in smart vehicles.
- the principle is to provide timing for each sensor through the pulse generator that comes with the time synchronizer, thereby providing high-precision time.
- the synchronizer is controlled to generate a pulse signal, and the exposure of the vehicle-mounted camera is controlled by the pulse signal, and the time stamp obtained from the serial port of the synchronizer is the high-precision exposure time of the vehicle-mounted camera.
- the serial port of the time synchronizer and the camera driver may have the problem of data frame loss, which will cause the timestamp data and image data to be unable to accurately correspond. Exposure timestamps are also not accurate enough.
- One or more embodiments of the present application provide an image time synchronization method, the method comprising:
- the timestamps in the timestamp sequence and the images in the image sequence are aligned for the first time, wherein the difference between the system time of the timestamps aligned for the first time and the system time of the images aligned for the first time satisfies all requirements the image generation time;
- each frame time stamp in the time stamp sequence is matched with each frame image in the image sequence, and the time stamp matched with the image is determined as the exposure time stamp of the frame image.
- the step of aligning the timestamps in the timestamp sequence and the images in the image sequence for the first time based on a predetermined image generation duration includes:
- the head image and the head timestamp of the image queue are respectively the first aligned image and the first aligned timestamp
- the time stamp of each frame in the time stamp sequence is matched with each frame of the image in the image sequence, and the time stamp matched with the image is determined.
- the steps for the exposure time stamp for the frame image include:
- the step of updating the head-of-line timestamp of the time-stamp sequence and the head-of-line image of the image sequence includes:
- the head image in the image sequence is discarded, and the next image of the discarded head image is determined as a new head image in the image sequence.
- the step of updating the head-of-line timestamp of the sequence of time stamps or the head-of-line image of the sequence of images includes:
- the frame number difference is greater than the standard frame number difference, discard the head image in the image sequence, and determine the next image of the discarded head image as the new head image in the image sequence image;
- the frame number difference is smaller than the standard frame number difference, discard the line head timestamp in the time stamp sequence, and determine the next time stamp of the discarded line head time stamp as the time stamp sequence The new team leader timestamp.
- the step of acquiring a sequence of time stamps for image exposure includes:
- the time stamp sequence of image exposure is obtained from the serial port of the synchronizer, wherein each frame of time stamp represents the time when the pulse signal generated by the synchronizer triggers the exposure of the camera.
- One or more embodiments of the present application also provide an image time synchronization apparatus, the apparatus comprising:
- a first acquisition module configured to acquire a timestamp sequence of image exposure, and acquire the system time of each frame timestamp from the timestamp sequence
- a second acquisition module configured to acquire an image sequence, and determine the system time of each frame of image in the image sequence
- an alignment module for aligning the timestamps in the timestamp sequence and the images in the image sequence for the first time based on a predetermined image generation duration, wherein the system time of the timestamps aligned for the first time and the system time of the aligned images for the first time The time difference satisfies the image generation duration;
- a calculation module for calculating the standard frame number difference between the first type of frame number of the time stamp of the first alignment and the second type of frame number of the first aligned image
- the matching module is configured to match each frame time stamp in the time stamp sequence with each frame image in the image sequence based on the standard frame number difference, and determine the time stamp matched with the image as the frame of the image. Exposure timestamp.
- the alignment module is specifically used for:
- the head image and the head timestamp of the image queue are respectively the first aligned image and the first aligned timestamp
- the matching module is specifically used for:
- the matching module when performing the updating of the team head timestamp of the timestamp sequence and the team head image of the image sequence, the matching module is specifically configured to:
- the head image in the image sequence is discarded, and the next image of the discarded head image is determined as a new head image in the image sequence.
- the matching module when performing the updating of the team head timestamp of the timestamp sequence or the team head image of the image sequence, the matching module is specifically configured to:
- the frame number difference is greater than the standard frame number difference, discard the head image in the image sequence, and determine the next image of the discarded head image as the new head image in the image sequence image;
- the frame number difference is smaller than the standard frame number difference, discard the line head timestamp in the time stamp sequence, and determine the next time stamp of the discarded line head time stamp as the time stamp sequence The new team leader timestamp.
- the first acquiring module when executing the time stamp sequence for acquiring image exposure, is specifically configured to:
- the time stamp sequence of image exposure is obtained from the serial port of the synchronizer, wherein each frame of time stamp represents the time when the pulse signal generated by the synchronizer triggers the exposure of the camera.
- One or more embodiments of the present application also provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.
- Memory is used to store computer programs.
- the processor is configured to execute the program stored in the memory, the method described in any of the foregoing embodiments is implemented.
- One or more embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program described in any of the foregoing embodiments is implemented. Methods.
- FIG. 1 is a schematic flowchart of an image time synchronization method according to one or more embodiments of the present invention
- FIG. 2 is a schematic flowchart of first alignment of timestamps and images according to one or more embodiments of the present invention
- FIG. 3 is a schematic flowchart of matching a timestamp sequence and an image sequence according to one or more embodiments of the present invention
- FIG. 4 is a schematic structural diagram of an image time synchronization apparatus according to one or more embodiments of the present invention.
- FIG. 5 is a schematic structural diagram of an electronic device according to one or more embodiments of the present invention.
- the image time synchronization method according to one or more embodiments of the present invention can be applied to scenarios with high real-time requirements, such as vehicle intelligent driving, high-precision map acquisition, etc.
- the exact exposure time of the image can be applied to scenarios with high real-time requirements, such as vehicle intelligent driving, high-precision map acquisition, etc. The exact exposure time of the image.
- a time synchronizer can be installed in the vehicle system.
- the principle is to use the second pulse generator to provide timing for each sensor.
- the synchronizer generates a pulse signal, which further controls the triggering of each sensor.
- the synchronizer can generate a pulse signal to trigger the vehicle-mounted camera exposure, and the time stamp when the synchronizer triggers the vehicle-mounted camera exposure is the high-precision time of the vehicle-mounted camera exposure.
- the time stamp signal that triggers the exposure of the vehicle camera must be read through the serial port of the synchronizer, but the serial port data of the synchronizer may lose frames or images, so that the image captured by the vehicle camera exposure and the time stamp that triggers the exposure of the vehicle camera cannot be exposed. Accurate correspondence, which in turn leads to the inaccurate exposure time of the final image.
- One or more embodiments of the present application provide an image time synchronization method, apparatus, electronic device, and storage medium.
- the method may include the following steps:
- S101 Acquire a time stamp sequence of image exposure, and obtain the system time of each time stamp from the time stamp sequence.
- a sequence of time stamps of image exposure can be obtained from the serial port of the synchronizer, wherein each time stamp represents the time when the pulse signal generated by the synchronizer triggers the exposure of the camera.
- the time of the system when each time stamp is obtained from the serial port of the synchronizer can be recorded as the system time of each time stamp, wherein the system can be an industrial control system.
- the acquired timestamps are sequentially arranged and combined into a timestamp sequence, and each timestamp corresponds to a system time.
- the data check digit can be set. After obtaining the data from the serial port of the synchronizer, the data is checked first according to the check digit. When the check is correct, the serial port data of the synchronizer is considered to be credible, and then the data is obtained from the serial port of the synchronizer. Parse out timestamp data. If it is not credible, data repair can be performed based on the frequency of the on-board camera and the timestamp data of the previous frame.
- the obtained timestamp sequence contains 10 timestamps, which are represented as a1, a2, a3, a4, a5, a6, a7, a8, a9, and a10 in sequence, and the corresponding system times are 10, 60, and 110 in sequence. , 160, 210, 260, 310, 360, 410, and 460 in milliseconds.
- S102 Acquire an image sequence, and determine the system time of each frame of image in the image sequence.
- a captured image may be acquired from a vehicle-mounted camera driver, and the acquired image is an image generated by a synchronizer triggering exposure of the vehicle-mounted camera.
- system time when each image is acquired from the camera driver can be recorded as the system time of each image.
- the acquired images are arranged and combined in sequence to form an image sequence, and each image corresponds to a system time.
- the acquired image sequence contains 10 images, which are denoted as b1, b2, b3, b4, b5, b6, b7, b8, b9, and b10 in sequence, and the corresponding system times are 70, 120, 170, and 220 in sequence. , 270, 320, 370, 420, 470, and 560 in milliseconds.
- S103 Based on the predetermined image generation duration, align the timestamps in the timestamp sequence with the images in the image sequence for the first time, wherein the difference between the system time of the timestamps aligned for the first time and the system time of the images aligned for the first time satisfies the image generation duration .
- the image generation duration can be understood as the duration from when the synchronizer triggers the exposure of the camera to when the camera drives to generate the image. According to one or more embodiments, the image generation duration can be predetermined.
- the image generation time is 60ms.
- the time stamps in the time stamp sequence and the images in the image sequence may be first aligned according to the image generation duration.
- time stamp of the serial port of the synchronizer may not correspond to the image driven by the camera when the industrial control system is started, it cannot be considered that the obtained time stamp sequence and the image sequence exactly match. Therefore, to complete the first alignment of the time stamp and the image, then When the data is not lost, the timestamp after the first alignment is in a one-to-one correspondence with the image.
- FIG. 2 is a schematic flowchart of the first alignment of time stamps and images according to one or more embodiments of the present invention. As shown in FIG. 2, step S103 may include the following refinement steps:
- S201 Discard the first several frames of data of the image sequence.
- S202 Calculate the system time difference between the system time of the line head image of the image queue after discarding several frames of data and the system time of the line head timestamp in the timestamp sequence.
- S204 Determine that the head image and the head timestamp of the image queue after discarding several frames of data are the first aligned image and the first aligned timestamp, respectively.
- S205 Discard the queue head timestamp, and return to the step of calculating the system time difference between the system time of the queue head image of the image queue after discarding several frames of data and the system time of the queue head timestamp in the timestamp sequence.
- the system acquisition time of image b3 is 170
- the image generation time is roughly 60 milliseconds, so it does not meet the image generation time.
- the timestamp a3 and the image b3 are determined as the timestamp of the first alignment and the image aligned for the first time, respectively.
- the timestamp after the first-aligned timestamp is the same as the first-aligned timestamp without considering the data loss and image loss of the serial port timestamp of the synchronizer.
- the images after the aligned images are in a one-to-one correspondence.
- S104 Calculate the standard frame number difference between the first-type frame number of the time stamp of the first alignment and the second-type frame number of the first-aligned image.
- the time stamp sequence further includes the frame number of each time stamp, which represents the generation sequence of the time stamps, which can be recorded as the first type of frame number; the image sequence also includes the frame number of each image, Indicates the generation order of the image, which can be recorded as the second type of frame number.
- the standard frame number difference between the first-type frame number of the first-aligned timestamp and the second-type frame number of the first-aligned image can be calculated.
- the first type frame numbers of a1-a10 in the above timestamp sequence are 21, 22, 23, 24, 25, 26, 27, 28, 29, and 30, respectively;
- the second type frame numbers of b1-b10 in the above image sequence are 11, 12, 13, 14, 15, 16, 17, 18, 19, and 20, respectively.
- S105 Based on the standard frame number difference, match the timestamp of each frame in the timestamp sequence with each frame of the image in the image sequence, and determine the timestamp matched with the image as the exposure timestamp of the frame of image.
- the standard frame number difference after the standard frame number difference is determined, there is no need to perform matching between the time stamp and the system time of the image, and only the standard frame number difference can match the time stamp and the image.
- the timestamp can be determined match this image.
- each frame of image in the image sequence may be sequentially read, and for each frame of image, the second type of frame number of the frame of image may be determined, and the sequence of time stamps may be searched for the same
- the time stamp of the frame image matching the frame number difference between the first type frame number of the time stamp and the second type frame number of the frame image is equal to the standard frame number difference.
- the time stamp can be assigned to the frame image, that is, the time stamp can be determined as the exposure time stamp of the frame image.
- the image time synchronization method first aligning the time stamp and the image for the first time, and calculating the difference between the first type frame number of the time stamp aligned for the first time and the second type frame number of the image aligned for the first time.
- the time stamp in the timestamp sequence and the image in the image sequence can be matched according to the standard frame number difference, and it can ensure that the time stamp and the image whose frame number difference is equal to the standard frame number difference are exactly matched. , and then assign the timestamp to the matching image, which can determine the high-precision exposure time of the image.
- FIG. 3 is a schematic flowchart of matching a timestamp sequence and an image sequence according to one or more embodiments of the present invention.
- the above step S105 may specifically include the following steps:
- S301 Calculate the frame number difference between the first type frame number of the queue head timestamp in the timestamp sequence and the second type frame number of the queue head image in the image sequence.
- the sequence of time stamps may be the sequence of time stamps after the time stamp of the first alignment
- the sequence of images may be the sequence of images after the first aligned image
- the first type of frame number of the first timestamp in the timestamp sequence and the second frame number of the first image in the image sequence may be based on The class frame number is matched, and after each match, regardless of whether the match is successful or not, the timestamp sequence and/or the image sequence are updated, specifically deleting the team head timestamp and/or the team head image.
- both the timestamp sequence and the image sequence may be stored in a data format in the form of a queue to follow a first-in, first-out principle.
- S303 Determine the team head timestamp as the exposure timestamp of the team head image, update the team head timestamp of the timestamp sequence and the team head image of the image sequence, and return to the step of S301.
- the team head timestamp Determine the exposure timestamp of the team head image, that is, assign the team head timestamp to the team head image.
- updating the team head timestamp of the timestamp sequence and the team head image of the image sequence specifically:
- step S301 After updating the team head timestamp of the time stamp sequence and the team head image of the image sequence, return to step S301 to re-match the new team head timestamp and the new team head image.
- S304 Update the team head timestamp of the timestamp sequence or the team head image of the image sequence, and return to the step of S301.
- the head image in the image sequence can be discarded, and the next image of the discarded head image is determined as the image
- the new team head image in the sequence is returned to the step of S301, and the new team head image and the team head timestamp are re-matched.
- the queue head timestamp in the timestamp sequence can be discarded, and the next timestamp of the discarded queue head timestamp can be determined as the timestamp sequence and return to step S301 to re-match the new team head timestamp and the team head image.
- the sequence of timestamps to be matched is a4, a6, a7, a8, a9, a10; assuming that the camera driver is unstable and the image b8 is lost, the sequence of images to be matched is b4, b5, b6, b7, b9, b10.
- the first type of frame number of each timestamp and the second type of frame number of each image continue the above example.
- the frame number difference between the first type frame number of the team head timestamp and the second type frame number of the team head image can be calculated, that is, the first type frame number of the timestamp a4 and the second type frame number of the image b4.
- the new team head time stamp becomes the time stamp a6, and its first type frame number is 26; the new team head image becomes image b5, and its second type frame number is 15.
- the calculated frame number difference is greater than the standard frame number difference, indicating that the time stamp is lost, and therefore the precise exposure time of the corresponding image cannot be obtained.
- the timestamp a6 is Exposure timestamp of image b6, and then delete timestamp a6 and image b6, respectively, to obtain a new team head timestamp and team head image.
- the calculated frame number difference is smaller than the standard frame number difference, indicating that the image is lost, so the head-of-line timestamp can be deleted, and the difference between the first type of frame number used for the calculation of the head-of-group timestamp and the head image of the lineup is returned.
- the step of the frame number difference between the second type of frame numbers is returned.
- delete the timestamp a8 continue to calculate the frame number difference between the first type frame number of the team head timestamp and the second type frame number of the team head image, until the timestamp sequence does not contain timestamps and/or images The sequence does not contain images.
- the time stamp a4 matches the image b4, that is, the exposure time stamp of the image b4 is a4; the time stamp a6 matches the image b6, that is, the exposure time stamp of the image b6 is a6; the time stamp a7 is the same as the image b7 matches, that is, the exposure timestamp of image b7 is a7; timestamp a9 matches image b9, that is, the exposure timestamp of image b9 is a9; timestamp a10 matches image b10, that is, the exposure timestamp of image b10 is a10.
- the timestamp sequence and the image sequence are matched based on the standard frame number difference, and in each matching, only the first type of frame number of the team head timestamp and the second frame number of the team head image need to be calculated.
- the frame number difference of the class frame number can be accurately matched according to the size relationship between the frame number difference and the standard frame number difference, and the accurate exposure timestamp of the image can be obtained.
- the above matching process has very low computational complexity.
- the image data and its corresponding precise exposure data can be sent to the application layer through interfaces such as ROS, CyberRT, Socket, etc., for data fusion or mapping.
- the embodiments of the present application further provide an image time synchronization apparatus.
- the apparatus may include the following modules:
- the first acquisition module 401 is used for acquiring the time stamp sequence of image exposure, and acquiring the system time of each time stamp from the time stamp sequence;
- a second acquisition module 402, configured to acquire an image sequence, and determine the system time of each frame of image in the image sequence
- the alignment module 403 is configured to align the timestamps in the timestamp sequence and the images in the image sequence for the first time based on the predetermined image generation duration, wherein the difference between the system time of the timestamps aligned for the first time and the system time of the images aligned for the first time Satisfy the image generation time;
- Calculation module 404 for calculating the standard frame number difference between the first type frame number of the time stamp aligned for the first time and the second type frame number of the image aligned for the first time;
- the matching module 405 is configured to match each frame time stamp in the time stamp sequence with each frame image in the image sequence based on the standard frame number difference, and determine the time stamp matched with the image as the exposure time stamp of the frame image.
- the matching model 405 can be specifically used for:
- the frame number difference is not equal to the standard frame number difference, update the line head timestamp of the time stamp sequence or the line head image of the image sequence, and return the result of calculating the line head time stamp in the time stamp sequence.
- the step of the frame number difference between the frame number of the first type and the frame number of the second type of the first image in the sequence of images.
- Applying the image time synchronization apparatus firstly align the timestamp and the image for the first time, and calculate the difference between the first-type frame number of the first-aligned timestamp and the second-type frame number of the first-aligned image.
- the time stamp in the timestamp sequence and the image in the image sequence can be matched according to the standard frame number difference, and it can ensure that the time stamp and the image whose frame number difference is equal to the standard frame number difference are exactly matched. , and then assign the timestamp to the matching image, which can determine the high-precision exposure time of the image.
- the method and the device are conceived based on the same application. Since the principles of the method and the device for solving the problem are similar, the implementation of the device and the method can be referred to each other, and repeated descriptions will not be repeated here.
- An embodiment of the present application further provides an electronic device, as shown in FIG. 5 , including a processor 501 , a communication interface 502 , a memory 503 and a communication bus 504 , wherein the processor 501 , the communication interface 502 , and the memory 503 pass through the communication bus 504 complete communication with each other,
- the timestamps in the timestamp sequence and the images in the image sequence are aligned for the first time, wherein the difference between the system time of the timestamps aligned for the first time and the system time of the images aligned for the first time satisfies the image generation duration;
- the time stamp of each frame in the time stamp sequence is matched with each frame of the image in the image sequence, and the time stamp matching the image is determined as the exposure time stamp of the frame image.
- the communication bus mentioned in the above electronic device may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus or the like.
- PCI peripheral component interconnect standard
- EISA Extended Industry Standard Architecture
- the communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
- the communication interface is used for communication between the above electronic device and other devices.
- the memory may include random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk storage. According to one embodiment, the memory may also be at least one storage device located remotely from the aforementioned processor.
- RAM Random Access Memory
- NVM non-Volatile Memory
- the above-mentioned processor can be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processing, DSP), dedicated integrated Circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
- CPU Central Processing Unit
- NP Network Processor
- DSP Digital Signal Processing
- ASIC Application Specific Integrated Circuit
- FPGA Field-Programmable Gate Array
- FPGA Field-Programmable Gate Array
- Applying the electronic device firstly align the timestamp and the image for the first time, and calculate the difference between the first-type frame number of the first-aligned timestamp and the second-type frame number of the first-aligned image.
- Standard frame number difference according to the standard frame number difference, the time stamp in the time stamp sequence and the image in the image sequence can be matched, and it can ensure that the time stamp and the image with the frame number difference equal to the standard frame number difference are exactly matched, and then Assigning timestamps to matching images enables highly accurate exposure times to be determined for the images.
- a computer-readable storage medium is also provided, and a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the above image time synchronization methods is implemented. step.
- a computer program product including instructions, which, when running on a computer, causes the computer to execute the steps of any of the image time synchronization methods in the above-mentioned embodiments.
- the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
- software it can be implemented in whole or in part in the form of a computer program product.
- the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated.
- the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
- the computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server, or data center is by wire (eg, coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.).
- the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media.
- the usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), and the like.
- Applying the image time synchronization method, device, electronic device, and storage medium provided by one or more embodiments of the present application firstly align the timestamp and the image for the first time, and calculate the first-type frame number of the first-aligned timestamp and the first-aligned frame number.
- the standard frame number difference between the second type of frame numbers of the image, according to the standard frame number difference, the time stamp in the time stamp sequence and the image in the image sequence can be matched, and the frame number difference can be guaranteed to be equal to the standard frame number difference. Timestamps and images are precisely matched, and by assigning timestamps to matching images, the exposure time of the images can be determined with high precision.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Studio Devices (AREA)
- Image Analysis (AREA)
Abstract
The present disclosure provides an image time synchronization method and apparatus, and an electronic device and a storage medium. The method comprises: acquiring a timestamp sequence of the exposure of images, and acquiring a system time of each timestamp from the timestamp sequence; acquiring an image sequence, and determining a system time of each image from the image sequence; on the basis of a predetermined image generation duration, performing first alignment on a timestamp in the timestamp sequence and an image in the image sequence; calculating a standard frame number difference between a first-type frame number of the timestamp which has been subjected to first alignment and a second-type frame number of the image which has been subjected to first alignment; and on the basis of the standard frame number difference, performing matching between each timestamp in the timestamp sequence and each image in the image sequence, and determining a timestamp, which matches an image, to be an exposure timestamp of the image.
Description
本申请涉及智能车辆技术领域,特别是涉及一种图像时间同步方法、装置、电子设备及存储介质。The present application relates to the technical field of intelligent vehicles, and in particular, to an image time synchronization method, device, electronic device and storage medium.
传统的获取摄像机所拍摄图像的时间戳的方法是:在工控机系统端通过驱动获取图像后,将系统当前时间作为图像的时间戳。但这样是不够准确的,首先系统时钟并非高精度时钟,其次从驱动端获取图像的时间并非图像曝光时间,因此上述方法通常应用于一些弱实时性要求的系统中。The traditional method of obtaining the time stamp of the image captured by the camera is: after the system side of the industrial computer obtains the image through the driver, the current time of the system is used as the time stamp of the image. But this is not accurate enough. First, the system clock is not a high-precision clock, and secondly, the time to acquire the image from the driver is not the image exposure time. Therefore, the above method is usually applied to some systems with weak real-time requirements.
而对于实时性要求较高的车载智能驾驶或者高精地图采集作业系统中,需要更加精确的高精度时钟来进行摄像机时间同步。For in-vehicle intelligent driving or high-precision map acquisition operation systems with high real-time requirements, a more accurate high-precision clock is required for camera time synchronization.
针对这个问题,一些自动驾驶公司在智能车辆中应用了时间同步器,其原理为通过时间同步器自带的脉冲发生器为各传感器进行授时,从而提供高精度时间。在拍摄图像时,控制同步器产生脉冲信号,由脉冲信号控制车载相机曝光,则从同步器串口获取到的时间戳即为车载相机的高精度曝光时间。In response to this problem, some autonomous driving companies have applied time synchronizers in smart vehicles. The principle is to provide timing for each sensor through the pulse generator that comes with the time synchronizer, thereby providing high-precision time. When taking an image, the synchronizer is controlled to generate a pulse signal, and the exposure of the vehicle-mounted camera is controlled by the pulse signal, and the time stamp obtained from the serial port of the synchronizer is the high-precision exposure time of the vehicle-mounted camera.
然而,由于系统存在不稳定性,时间同步器的串口以及摄像机驱动都可能存在数据丢帧的问题,会导致时间戳数据和图像数据无法较为准确对应,在这种情况下,最终确定的图像的曝光时间戳也不够精准。However, due to the instability of the system, the serial port of the time synchronizer and the camera driver may have the problem of data frame loss, which will cause the timestamp data and image data to be unable to accurately correspond. Exposure timestamps are also not accurate enough.
发明内容SUMMARY OF THE INVENTION
本申请的一个或多个实施例提供了一种图像时间同步方法,所述方法包括:One or more embodiments of the present application provide an image time synchronization method, the method comprising:
获取图像曝光的时间戳序列,并从所述时间戳序列中获取每帧时间戳的系统时间;Obtain a timestamp sequence of image exposure, and obtain the system time of each frame timestamp from the timestamp sequence;
获取图像序列,并确定所述图像序列中的每帧图像的系统时间;Acquire an image sequence, and determine the system time of each frame of image in the image sequence;
基于预先确定的图像生成时长,首次对齐所述时间戳序列中的时间戳和所述图像序列中的图像,其中,首次对齐的时间戳的系统时间和首次对齐的图像的系统时间之差满足所述图像生成时长;Based on a predetermined image generation duration, the timestamps in the timestamp sequence and the images in the image sequence are aligned for the first time, wherein the difference between the system time of the timestamps aligned for the first time and the system time of the images aligned for the first time satisfies all requirements the image generation time;
计算所述首次对齐的时间戳的第一类帧号和所述首次对齐的图像的第二类帧号之间的标准帧号差;Calculate the standard frame number difference between the first type of frame number of the time stamp of the first alignment and the second type of frame number of the first aligned image;
基于所述标准帧号差,匹配所述时间戳序列中的每帧时间戳和所述图像序列中的每帧图像,将与图像相匹配的时间戳确定为该帧图像的曝光时间戳。Based on the standard frame number difference, each frame time stamp in the time stamp sequence is matched with each frame image in the image sequence, and the time stamp matched with the image is determined as the exposure time stamp of the frame image.
根据一个或多个实施例,所述基于预先确定的图像生成时长,首次对齐所述时间戳序列中的时间戳和所述图像序列中的图像的步骤,包括:According to one or more embodiments, the step of aligning the timestamps in the timestamp sequence and the images in the image sequence for the first time based on a predetermined image generation duration includes:
丢弃所述图像序列的前若干帧数据;discarding the first several frames of data of the image sequence;
计算丢弃所述前若干帧数据后图像队列的队首图像的系统时间与所述时间戳序列中队首时间戳的系统时间的系统时间差;Calculate the system time difference between the system time of the queue head image of the image queue after discarding the first several frames of data and the system time of the queue head timestamp in the timestamp sequence;
判断所述系统时间差是否满足所述图像生成时长:Determine whether the system time difference satisfies the image generation duration:
若是,则确定丢弃所述前若干帧数据后所述图像队列的所述队首图像和所述队首时间戳分别为首次对齐的图像和首次对齐的时间戳;If so, then it is determined that after discarding the first several frames of data, the head image and the head timestamp of the image queue are respectively the first aligned image and the first aligned timestamp;
若否,丢弃所述队首时间戳,返回执行所述计算丢弃所述前若干帧数据后图像队列的队首图像的系统时间与所述时间戳序列中队首时间戳的系统时间的系统时间差的步骤。If not, discard the head-of-line timestamp, and return the system time difference between the system time of the head-of-line image of the image queue after performing the calculation and discarding the first several frames of data and the system time of the head-of-line timestamp in the timestamp sequence step.
根据一个或多个实施例,所述基于所述标准帧号差,匹配所述时间戳序列中的每帧时间戳和所述图像序列中的每帧图像,将与图像相匹配的时间戳确定为该帧图像的曝光时间戳的步骤,包括:According to one or more embodiments, based on the standard frame number difference, the time stamp of each frame in the time stamp sequence is matched with each frame of the image in the image sequence, and the time stamp matched with the image is determined. The steps for the exposure time stamp for the frame image include:
计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差,判断该帧号差是否等同于所述标准帧号差:Calculate the frame number difference between the first type of frame number of the line head timestamp in the time stamp sequence and the second type of frame number of the line head image in the image sequence, and determine whether the frame number difference is equal to the Describe the standard frame number difference:
若是,则将所述队首时间戳确定为所述队首图像的曝光时间戳,并更新所述时间戳序列的所述队首时间戳和所述图像序列的所述队首图像,返回计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差的步骤;If so, determine the team head timestamp as the exposure timestamp of the team head image, update the team head timestamp of the timestamp sequence and the team head image of the image sequence, and return to calculate The step of the frame number difference between the first type frame number of the team head timestamp in the time stamp sequence and the second type frame number of the team head image in the image sequence;
若否,则更新所述时间戳序列的队首时间戳或所述图像序列的队首图像,并返回计算所述时间戳序列中队首时间戳的第一类帧号与所述图像序列中队首图像的第二类帧号之间的帧号差的步骤。If not, update the team head timestamp of the time stamp sequence or the team head image of the image sequence, and return the frame number of the first type for calculating the team head timestamp in the time stamp sequence and the team head image of the image sequence. The step of the frame number difference between the second type of frame numbers of the image.
根据一个或多个实施例,所述更新所述时间戳序列的所述队首时间戳和所述图像序列的所述队首图像的步骤,包括:According to one or more embodiments, the step of updating the head-of-line timestamp of the time-stamp sequence and the head-of-line image of the image sequence includes:
丢弃所述时间戳序列中的所述队首时间戳,并将所丢弃的队首时间戳的下 一时间戳确定为所述时间戳序列中新的队首时间戳;Discarding the team head timestamp in the time stamp sequence, and determining the next time stamp of the discarded team head timestamp as a new team head timestamp in the timestamp sequence;
丢弃所述图像序列中的所述队首图像,并将所丢弃的队首图像的下一图像确定为所述图像序列中新的队首图像。The head image in the image sequence is discarded, and the next image of the discarded head image is determined as a new head image in the image sequence.
根据一个或多个实施例,所述更新所述时间戳序列的所述队首时间戳或所述图像序列的所述队首图像的步骤,包括:According to one or more embodiments, the step of updating the head-of-line timestamp of the sequence of time stamps or the head-of-line image of the sequence of images includes:
若所述帧号差大于所述标准帧号差,丢弃所述图像序列中的所述队首图像,并将所丢弃的队首图像的下一图像确定为所述图像序列中新的队首图像;If the frame number difference is greater than the standard frame number difference, discard the head image in the image sequence, and determine the next image of the discarded head image as the new head image in the image sequence image;
若所述帧号差小于所述标准帧号差,丢弃所述时间戳序列中的所述队首时间戳,并将所丢弃的队首时间戳的下一时间戳确定为所述时间戳序列中新的队首时间戳。If the frame number difference is smaller than the standard frame number difference, discard the line head timestamp in the time stamp sequence, and determine the next time stamp of the discarded line head time stamp as the time stamp sequence The new team leader timestamp.
根据一个或多个实施例,所述获取图像曝光的时间戳序列的步骤,包括:According to one or more embodiments, the step of acquiring a sequence of time stamps for image exposure includes:
从同步器串口获取图像曝光的所述时间戳序列,其中,每帧时间戳均表示同步器产生的脉冲信号触发相机曝光的时间。The time stamp sequence of image exposure is obtained from the serial port of the synchronizer, wherein each frame of time stamp represents the time when the pulse signal generated by the synchronizer triggers the exposure of the camera.
本申请的一个或多个实施例还提供了一种图像时间同步装置,所述装置包括:One or more embodiments of the present application also provide an image time synchronization apparatus, the apparatus comprising:
第一获取模块,用于获取图像曝光的时间戳序列,并从所述时间戳序列中获取每帧时间戳的系统时间;a first acquisition module, configured to acquire a timestamp sequence of image exposure, and acquire the system time of each frame timestamp from the timestamp sequence;
第二获取模块,用于获取图像序列,并确定所述图像序列中每帧图像的系统时间;a second acquisition module, configured to acquire an image sequence, and determine the system time of each frame of image in the image sequence;
对齐模块,用于基于预先确定的图像生成时长,首次对齐所述时间戳序列中的时间戳和所述图像序列中的图像,其中,首次对齐的时间戳的系统时间和首次对齐的图像的系统时间之差满足所述图像生成时长;an alignment module for aligning the timestamps in the timestamp sequence and the images in the image sequence for the first time based on a predetermined image generation duration, wherein the system time of the timestamps aligned for the first time and the system time of the aligned images for the first time The time difference satisfies the image generation duration;
计算模块,用于计算所述首次对齐的时间戳的第一类帧号和所述首次对齐的图像的第二类帧号之间的标准帧号差;A calculation module for calculating the standard frame number difference between the first type of frame number of the time stamp of the first alignment and the second type of frame number of the first aligned image;
匹配模块,用于基于所述标准帧号差,匹配所述时间戳序列中的每帧时间戳和所述图像序列中的每帧图像,将与图像相匹配的时间戳确定为该帧图像的曝光时间戳。The matching module is configured to match each frame time stamp in the time stamp sequence with each frame image in the image sequence based on the standard frame number difference, and determine the time stamp matched with the image as the frame of the image. Exposure timestamp.
根据一个或多个实施例,所述对齐模块具体用于:According to one or more embodiments, the alignment module is specifically used for:
丢弃所述图像序列的前若干帧数据;discarding the first several frames of data of the image sequence;
计算丢弃所述前若干帧数据后图像队列的队首图像的系统时间与所述时间戳序列中队首时间戳的系统时间的系统时间差;Calculate the system time difference between the system time of the queue head image of the image queue after discarding the first several frames of data and the system time of the queue head timestamp in the timestamp sequence;
判断所述系统时间差是否满足所述图像生成时长:Determine whether the system time difference satisfies the image generation duration:
若是,则确定丢弃所述前若干帧数据后所述图像队列的所述队首图像和所述队首时间戳分别为首次对齐的图像和首次对齐的时间戳;If so, then it is determined that after discarding the first several frames of data, the head image and the head timestamp of the image queue are respectively the first aligned image and the first aligned timestamp;
若否,丢弃所述队首时间戳,返回执行所述计算丢弃所述前若干帧数据后图像队列的队首图像的系统时间与所述时间戳序列中队首时间戳的系统时间的系统时间差的步骤。If not, discard the head-of-line timestamp, and return the system time difference between the system time of the head-of-line image of the image queue after performing the calculation and discarding the first several frames of data and the system time of the head-of-line timestamp in the timestamp sequence step.
根据一个或多个实施例,所述匹配模块具体用于:According to one or more embodiments, the matching module is specifically used for:
计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差,判断该帧号差是否等同于所述标准帧号差:Calculate the frame number difference between the first type of frame number of the line head timestamp in the time stamp sequence and the second type of frame number of the line head image in the image sequence, and determine whether the frame number difference is equal to the Describe the standard frame number difference:
若是,则将所述队首时间戳确定为所述队首图像的曝光时间戳,并更新所述时间戳序列的所述队首时间戳和所述图像序列的所述队首图像,返回计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差的步骤;If so, determine the team head timestamp as the exposure timestamp of the team head image, update the team head timestamp of the timestamp sequence and the team head image of the image sequence, and return to calculate The step of the frame number difference between the first type frame number of the team head timestamp in the time stamp sequence and the second type frame number of the team head image in the image sequence;
若否,则更新所述时间戳序列的所述队首时间戳或所述图像序列的所述队首图像,并返回计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差的步骤。If not, update the team head timestamp of the timestamp sequence or the team head image of the image sequence, and return the first type of frame number and the first type of frame number for calculating the team head timestamp in the timestamp sequence The step of the frame number difference between the second type of frame numbers of the head of line images in the sequence of images.
根据一个或多个实施例,在执行所述更新所述时间戳序列的所述队首时间戳和所述图像序列的所述队首图像时,所述匹配模块具体用于:According to one or more embodiments, when performing the updating of the team head timestamp of the timestamp sequence and the team head image of the image sequence, the matching module is specifically configured to:
丢弃所述时间戳序列中的所述队首时间戳,并将所丢弃的队首时间戳的下一时间戳确定为所述时间戳序列中新的队首时间戳;discarding the team head timestamp in the timestamp sequence, and determining the next timestamp of the discarded team head timestamp as a new team head timestamp in the timestamp sequence;
丢弃所述图像序列中的所述队首图像,并将所丢弃的队首图像的下一图像确定为所述图像序列中新的队首图像。The head image in the image sequence is discarded, and the next image of the discarded head image is determined as a new head image in the image sequence.
根据一个或多个实施例,在执行所述更新所述时间戳序列的所述队首时间戳或所述图像序列的所述队首图像时,所述匹配模块具体用于:According to one or more embodiments, when performing the updating of the team head timestamp of the timestamp sequence or the team head image of the image sequence, the matching module is specifically configured to:
若所述帧号差大于所述标准帧号差,丢弃所述图像序列中的所述队首图像,并将所丢弃的队首图像的下一图像确定为所述图像序列中新的队首图像;If the frame number difference is greater than the standard frame number difference, discard the head image in the image sequence, and determine the next image of the discarded head image as the new head image in the image sequence image;
若所述帧号差小于所述标准帧号差,丢弃所述时间戳序列中的所述队首时间戳,并将所丢弃的队首时间戳的下一时间戳确定为所述时间戳序列中新的队首时间戳。If the frame number difference is smaller than the standard frame number difference, discard the line head timestamp in the time stamp sequence, and determine the next time stamp of the discarded line head time stamp as the time stamp sequence The new team leader timestamp.
根据一个或多个实施例,在执行所述获取图像曝光的时间戳序列时,所述 第一获取模块具体用于:According to one or more embodiments, when executing the time stamp sequence for acquiring image exposure, the first acquiring module is specifically configured to:
从同步器串口获取图像曝光的所述时间戳序列,其中,每帧时间戳均表示同步器产生的脉冲信号触发相机曝光的时间。The time stamp sequence of image exposure is obtained from the serial port of the synchronizer, wherein each frame of time stamp represents the time when the pulse signal generated by the synchronizer triggers the exposure of the camera.
本申请的一个或多个实施例还提供了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信。存储器用于存放计算机程序。处理器用于执行存储器上所存放的程序时,实现上述任一实施例所述的方法。One or more embodiments of the present application also provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. Memory is used to store computer programs. When the processor is configured to execute the program stored in the memory, the method described in any of the foregoing embodiments is implemented.
本申请的一个或多个实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述任一实施例所述的方法。One or more embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program described in any of the foregoing embodiments is implemented. Methods.
为了更清楚地说明本申请的实施例,下面将对附图作简单地介绍。显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的实施例。In order to illustrate the embodiments of the present application more clearly, the accompanying drawings will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and for those of ordinary skill in the art, other embodiments can also be obtained according to these drawings without creative effort.
图1为根据本发明一个或多个实施例的图像时间同步方法的流程示意图;1 is a schematic flowchart of an image time synchronization method according to one or more embodiments of the present invention;
图2为根据本发明一个或多个实施例的时间戳和图像首次对齐的流程示意图;2 is a schematic flowchart of first alignment of timestamps and images according to one or more embodiments of the present invention;
图3为根据本发明一个或多个实施例的匹配时间戳序列和图像序列的流程示意图;3 is a schematic flowchart of matching a timestamp sequence and an image sequence according to one or more embodiments of the present invention;
图4为根据本发明一个或多个实施例的图像时间同步装置的结构示意图;4 is a schematic structural diagram of an image time synchronization apparatus according to one or more embodiments of the present invention;
图5为根据本发明一个或多个实施例的电子设备的结构示意图。FIG. 5 is a schematic structural diagram of an electronic device according to one or more embodiments of the present invention.
下面将结合本申请实施例中的附图,对本申请的实施例进行清楚、完整地描述。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员基于本申请所获得的所有其他实施例,都属于本申请保护的范围。The embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. 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 fall within the protection scope of the present application.
为了便于理解,先对本申请的应用场景进行简要介绍。For ease of understanding, the application scenarios of the present application are briefly introduced first.
根据本发明一个或多个实施例的图像时间同步方法可以应用于实时性要 求较高的场景,例如车辆智能驾驶,高精地图采集等,目的是确定车载相机所拍摄图像的精确拍摄时间,即图像的精确曝光时间。The image time synchronization method according to one or more embodiments of the present invention can be applied to scenarios with high real-time requirements, such as vehicle intelligent driving, high-precision map acquisition, etc. The exact exposure time of the image.
为了提供高精度时间,可以在车载系统安装时间同步器,其原理是通过秒脉冲发生器分别为各传感器进行授时。进而同步器产生脉冲信号,进一步控制各个传感器的触发。In order to provide high-precision time, a time synchronizer can be installed in the vehicle system. The principle is to use the second pulse generator to provide timing for each sensor. In turn, the synchronizer generates a pulse signal, which further controls the triggering of each sensor.
针对车载相机,同步器可以产生脉冲信号触发车载相机曝光,则同步器触发车载相机曝光的时间戳即为车载相机曝光的高精度时间。For the vehicle-mounted camera, the synchronizer can generate a pulse signal to trigger the vehicle-mounted camera exposure, and the time stamp when the synchronizer triggers the vehicle-mounted camera exposure is the high-precision time of the vehicle-mounted camera exposure.
然而,触发车载相机曝光的时间戳信号必须通过同步器串口读取,但可能出现同步器串口数据丢帧或图像丢失的情况,导致车载相机曝光所拍摄的图像和触发车载相机曝光的时间戳无法准确对应,进而导致最终确定的图像曝光时间不够精准。However, the time stamp signal that triggers the exposure of the vehicle camera must be read through the serial port of the synchronizer, but the serial port data of the synchronizer may lose frames or images, so that the image captured by the vehicle camera exposure and the time stamp that triggers the exposure of the vehicle camera cannot be exposed. Accurate correspondence, which in turn leads to the inaccurate exposure time of the final image.
本申请一个或多个实施例提供了一种图像时间同步方法、装置、电子设备及存储介质。参见图1,该方法可以包括以下步骤:One or more embodiments of the present application provide an image time synchronization method, apparatus, electronic device, and storage medium. Referring to Figure 1, the method may include the following steps:
S101:获取图像曝光的时间戳序列,并从时间戳序列中获取每个时间戳的系统时间。S101: Acquire a time stamp sequence of image exposure, and obtain the system time of each time stamp from the time stamp sequence.
根据一个或多个实施例,可以从同步器串口获取图像曝光的时间戳序列,其中,每一时间戳均表示同步器产生的脉冲信号触发相机曝光的时间。According to one or more embodiments, a sequence of time stamps of image exposure can be obtained from the serial port of the synchronizer, wherein each time stamp represents the time when the pulse signal generated by the synchronizer triggers the exposure of the camera.
并且,可以记下从同步器串口获取到各个时间戳时系统的时间,作为各时间戳的系统时间,其中系统可以是工控系统。In addition, the time of the system when each time stamp is obtained from the serial port of the synchronizer can be recorded as the system time of each time stamp, wherein the system can be an industrial control system.
根据一个或多个实施例,获取的时间戳依次排列组合成时间戳序列,每个时间戳都对应一个系统时间。According to one or more embodiments, the acquired timestamps are sequentially arranged and combined into a timestamp sequence, and each timestamp corresponds to a system time.
为了保证同步器串口数据真实有效,可以设置数据校验位,在从同步器串口获取数据后,先根据校验位进行数据校验,当校验无误后认为同步器串口数据可信,进而从中解析出时间戳数据。如果不可信,可以基于车载相机频率,以及上一帧时间戳数据进行数据修复。In order to ensure that the serial port data of the synchronizer is real and effective, the data check digit can be set. After obtaining the data from the serial port of the synchronizer, the data is checked first according to the check digit. When the check is correct, the serial port data of the synchronizer is considered to be credible, and then the data is obtained from the serial port of the synchronizer. Parse out timestamp data. If it is not credible, data repair can be performed based on the frequency of the on-board camera and the timestamp data of the previous frame.
作为一个示例,获取的时间戳序列包含10个时间戳,依次表示为a1、a2、a3、a4、a5、a6、a7、a8、a9和a10,其对应的系统时间依次为10、60、110、160、210、260、310、360、410和460,单位为毫秒。As an example, the obtained timestamp sequence contains 10 timestamps, which are represented as a1, a2, a3, a4, a5, a6, a7, a8, a9, and a10 in sequence, and the corresponding system times are 10, 60, and 110 in sequence. , 160, 210, 260, 310, 360, 410, and 460 in milliseconds.
S102:获取图像序列,并确定图像序列中每帧图像的系统时间。S102: Acquire an image sequence, and determine the system time of each frame of image in the image sequence.
根据一个或多个实施例,可以从车载相机驱动获取拍摄的图像,获取的图像是同步器触发车载相机曝光所生成的图像。According to one or more embodiments, a captured image may be acquired from a vehicle-mounted camera driver, and the acquired image is an image generated by a synchronizer triggering exposure of the vehicle-mounted camera.
并且,可以记下从相机驱动获取到各个图像时系统的时间,作为各图像的系统时间。In addition, the system time when each image is acquired from the camera driver can be recorded as the system time of each image.
获取的图像依次排列组合成图像序列,每个图像都对应一个系统时间。The acquired images are arranged and combined in sequence to form an image sequence, and each image corresponds to a system time.
作为一个示例,获取的图像序列包含10个图像,依次表示为b1、b2、b3、b4、b5、b6、b7、b8、b9和b10,其对应的系统时间依次为70、120、170、220、270、320、370、420、470和560,单位为毫秒。As an example, the acquired image sequence contains 10 images, which are denoted as b1, b2, b3, b4, b5, b6, b7, b8, b9, and b10 in sequence, and the corresponding system times are 70, 120, 170, and 220 in sequence. , 270, 320, 370, 420, 470, and 560 in milliseconds.
S103:基于预先确定的图像生成时长,首次对齐时间戳序列中的时间戳和图像序列中的图像,其中,首次对齐的时间戳的系统时间和首次对齐的图像的系统时间之差满足图像生成时长。S103: Based on the predetermined image generation duration, align the timestamps in the timestamp sequence with the images in the image sequence for the first time, wherein the difference between the system time of the timestamps aligned for the first time and the system time of the images aligned for the first time satisfies the image generation duration .
图像生成时长可以理解为从同步器触发相机曝光到相机驱动生成图像的时长,根据一个或多个实施例,可以预先确定图像生成时长。The image generation duration can be understood as the duration from when the synchronizer triggers the exposure of the camera to when the camera drives to generate the image. According to one or more embodiments, the image generation duration can be predetermined.
作为一个示例,图像生成时长为60毫秒。As an example, the image generation time is 60ms.
根据一个或多个实施例,可以根据图像生成时长,首次对齐时间戳序列中的时间戳和图像序列中的图像。According to one or more embodiments, the time stamps in the time stamp sequence and the images in the image sequence may be first aligned according to the image generation duration.
由于工控系统启动时,同步器串口的时间戳和相机驱动的图像可能并未对应,不能认为所获取的时间戳序列和图像序列是恰好匹配的,因此要完成时间戳和图像的首次对齐,则数据不丢帧的情况下,首次对齐后之后的时间戳和图像是一一对应的。Since the time stamp of the serial port of the synchronizer may not correspond to the image driven by the camera when the industrial control system is started, it cannot be considered that the obtained time stamp sequence and the image sequence exactly match. Therefore, to complete the first alignment of the time stamp and the image, then When the data is not lost, the timestamp after the first alignment is in a one-to-one correspondence with the image.
图2为根据本发明一个或多个实施例的时间戳和图像首次对齐的流程示意图。如图2所示,步骤S103可以包括以下细化步骤:FIG. 2 is a schematic flowchart of the first alignment of time stamps and images according to one or more embodiments of the present invention. As shown in FIG. 2, step S103 may include the following refinement steps:
S201:丢弃图像序列的前若干帧数据。S201: Discard the first several frames of data of the image sequence.
S202:计算丢弃若干帧数据后图像队列的队首图像的系统时间与时间戳序列中队首时间戳的系统时间的系统时间差。S202 : Calculate the system time difference between the system time of the line head image of the image queue after discarding several frames of data and the system time of the line head timestamp in the timestamp sequence.
作为一个示例,可以丢弃图像序列中前两帧图像b1、b2,则丢弃数据后图像序列的队首图像为b3。进而计算b3的系统时间与时间戳序列中队首时间戳a1的系统时间之差,即170-10=160。As an example, the first two frames of images b1 and b2 in the image sequence may be discarded, and the head image of the image sequence after the data is discarded is b3. Then, the difference between the system time of b3 and the system time of the queue head timestamp a1 in the timestamp sequence is calculated, that is, 170-10=160.
S203:判断系统时间差是否满足图像生成时长,若是,则执行S204;若否,则执行S205。S203: Determine whether the system time difference satisfies the image generation duration, if yes, execute S204; if not, execute S205.
S204:确定丢弃若干帧数据后图像队列的队首图像和队首时间戳分别为首次对齐的图像和首次对齐的时间戳。S204: Determine that the head image and the head timestamp of the image queue after discarding several frames of data are the first aligned image and the first aligned timestamp, respectively.
S205:丢弃队首时间戳,返回执行计算丢弃若干帧数据后图像队列的队首 图像的系统时间与时间戳序列中队首时间戳的系统时间的系统时间差的步骤。S205: Discard the queue head timestamp, and return to the step of calculating the system time difference between the system time of the queue head image of the image queue after discarding several frames of data and the system time of the queue head timestamp in the timestamp sequence.
容易理解的,计算所得的系统时间差只要与图像生成时长相差不大,均可认为系统时间差满足图像生成时长,例如图像生成时长为60,只要系统时间差处于50-70范围内,均可认为能够满足图像生成时长。It is easy to understand that as long as the calculated system time difference is not much different from the image generation time, it can be considered that the system time difference meets the image generation time. Image generation time.
承接上例,图像b3的系统获取时间为170,时间戳序列中第一个时间戳a1的系统获取时间与时间戳a1的系统获取时间为10,二者的系统时间差为170-10=160,而图像生成时长大致为60毫秒,因此不满足图像生成时长。Following the above example, the system acquisition time of image b3 is 170, the system acquisition time of the first timestamp a1 in the timestamp sequence and the system acquisition time of timestamp a1 are 10, and the system time difference between the two is 170-10=160, The image generation time is roughly 60 milliseconds, so it does not meet the image generation time.
进而与a1的下一时间戳,即a2进行比较,计算所得系统时间差为170-60=110,仍然不满足图像生成时长。Furthermore, compared with the next time stamp of a1, that is, a2, the calculated system time difference is 170-60=110, which still does not satisfy the image generation duration.
继续与时间戳a3的系统获取时间进行比较,计算所得系统时间差为170-110=60,满足图像生成时长。则将时间戳a3与图像b3分别确定为首次对齐的时间戳和首次对齐的图像。Continue to compare with the system acquisition time of timestamp a3, and the calculated system time difference is 170-110=60, which satisfies the image generation time. Then, the timestamp a3 and the image b3 are determined as the timestamp of the first alignment and the image aligned for the first time, respectively.
根据一个或多个实施例,在确定首次对齐的时间戳和首次对齐的图像之后,在不考虑同步器串口时间戳数据丢失和图像丢失的情况下,首次对齐的时间戳之后的时间戳与首次对齐的图像之后的图像是一一对应的。According to one or more embodiments, after the first-aligned timestamp and the first-aligned image are determined, the timestamp after the first-aligned timestamp is the same as the first-aligned timestamp without considering the data loss and image loss of the serial port timestamp of the synchronizer. The images after the aligned images are in a one-to-one correspondence.
S104:计算首次对齐的时间戳的第一类帧号和首次对齐的图像的第二类帧号之间的标准帧号差。S104: Calculate the standard frame number difference between the first-type frame number of the time stamp of the first alignment and the second-type frame number of the first-aligned image.
根据一个或多个实施例,时间戳序列中还包含每个时间戳的帧号,表示时间戳的生成顺序,可以记为第一类帧号;图像序列中还包含每个图像的帧号,表示图像的生成顺序,可以记为第二类帧号。According to one or more embodiments, the time stamp sequence further includes the frame number of each time stamp, which represents the generation sequence of the time stamps, which can be recorded as the first type of frame number; the image sequence also includes the frame number of each image, Indicates the generation order of the image, which can be recorded as the second type of frame number.
本步骤中,可以计算首次对齐的时间戳的第一类帧号和首次对齐的图像的第二类帧号之间的标准帧号差。In this step, the standard frame number difference between the first-type frame number of the first-aligned timestamp and the second-type frame number of the first-aligned image can be calculated.
作为一个示例,上述时间戳序列中a1-a10的第一类帧号依次分别为21、22、23、24、25、26、27、28、29和30;As an example, the first type frame numbers of a1-a10 in the above timestamp sequence are 21, 22, 23, 24, 25, 26, 27, 28, 29, and 30, respectively;
上述图像序列中b1-b10的第二类帧号依次分别为11、12、13、14、15、16、17、18、19和20。The second type frame numbers of b1-b10 in the above image sequence are 11, 12, 13, 14, 15, 16, 17, 18, 19, and 20, respectively.
则可以确定首次对齐的时间戳a3的第一类帧号与首次对齐的图像b3的第二类帧号之差为23-13=10,将其作为标准帧号差。Then, it can be determined that the difference between the first-type frame number of the time stamp a3 aligned for the first time and the second-type frame number of the image b3 aligned for the first time is 23-13=10, which is taken as the standard frame number difference.
S105:基于标准帧号差,匹配时间戳序列中每帧时间戳和图像序列中每帧图像,将与图像相匹配的时间戳确定为该帧图像的曝光时间戳。S105: Based on the standard frame number difference, match the timestamp of each frame in the timestamp sequence with each frame of the image in the image sequence, and determine the timestamp matched with the image as the exposure timestamp of the frame of image.
根据一个或多个实施例,在确定标准帧号差之后,无需再根据时间戳和图 像的系统时间进行匹配,只根据标准帧号差即可实现时间戳和图像的匹配。According to one or more embodiments, after the standard frame number difference is determined, there is no need to perform matching between the time stamp and the system time of the image, and only the standard frame number difference can match the time stamp and the image.
根据一个实施例,若时间戳序列中某个时间戳的第一类帧号与图像序列中某帧图像的第二类帧号的帧号差等同于标准帧号差,则可以确定该时间戳与该图像是匹配的。According to an embodiment, if the frame number difference between the first type of frame number of a certain timestamp in the timestamp sequence and the second type of frame number of a certain frame image in the image sequence is equal to the standard frame number difference, the timestamp can be determined match this image.
根据一个或多个实施例,在匹配过程中,可以依次读取图像序列中的每帧图像,针对每帧图像,可以确定该帧图像的第二类帧号,并从时间戳序列中查找与该帧图像匹配的时间戳,该时间戳的第一类帧号与该帧图像的第二类帧号的帧号差等同于标准帧号差。进而可以将该时间戳赋值给该帧图像,也就是将该时间戳确定为该帧图像的曝光时间戳。According to one or more embodiments, during the matching process, each frame of image in the image sequence may be sequentially read, and for each frame of image, the second type of frame number of the frame of image may be determined, and the sequence of time stamps may be searched for the same The time stamp of the frame image matching, the frame number difference between the first type frame number of the time stamp and the second type frame number of the frame image is equal to the standard frame number difference. Further, the time stamp can be assigned to the frame image, that is, the time stamp can be determined as the exposure time stamp of the frame image.
此外,如果无法从时间戳序列中查找到与图像相匹配的时间戳,表示同步器串口的时间戳数据丢失,则可以丢弃该帧图像,继续读取下一帧图像。In addition, if the time stamp that matches the image cannot be found from the time stamp sequence, indicating that the time stamp data of the serial port of the synchronizer is lost, this frame of image can be discarded and the next frame of image can be read.
应用根据本发明一个或多个实施例的图像时间同步方法,先进行时间戳和图像的首次对齐,计算首次对齐的时间戳的第一类帧号与首次对齐的图像的第二类帧号之间的标准帧号差,根据标准帧号差即可匹配时间戳序列中的时间戳和图像序列中的图像,并且能够保证帧号差等同于标准帧号差的时间戳和图像是精确匹配的,进而将时间戳赋值给相匹配的图像,能够确定图像的高精准曝光时间。Applying the image time synchronization method according to one or more embodiments of the present invention, first aligning the time stamp and the image for the first time, and calculating the difference between the first type frame number of the time stamp aligned for the first time and the second type frame number of the image aligned for the first time. According to the standard frame number difference between the two, the time stamp in the timestamp sequence and the image in the image sequence can be matched according to the standard frame number difference, and it can ensure that the time stamp and the image whose frame number difference is equal to the standard frame number difference are exactly matched. , and then assign the timestamp to the matching image, which can determine the high-precision exposure time of the image.
图3为根据本发明一个或多个实施例的匹配时间戳序列和图像序列的流程示意图。为了降低计算复杂度,进一步提高时间戳与图像的匹配效率,如图3所示,上述步骤S105具体可以包括以下步骤:FIG. 3 is a schematic flowchart of matching a timestamp sequence and an image sequence according to one or more embodiments of the present invention. In order to reduce the computational complexity and further improve the matching efficiency between the timestamp and the image, as shown in FIG. 3 , the above step S105 may specifically include the following steps:
S301:计算时间戳序列中队首时间戳的第一类帧号与图像序列中队首图像的第二类帧号之间的帧号差。S301: Calculate the frame number difference between the first type frame number of the queue head timestamp in the timestamp sequence and the second type frame number of the queue head image in the image sequence.
图3所示实施例中,时间戳序列可以是首次对齐的时间戳之后的时间戳序列,图像序列可以是首次对齐的图像之后的图像序列。In the embodiment shown in FIG. 3 , the sequence of time stamps may be the sequence of time stamps after the time stamp of the first alignment, and the sequence of images may be the sequence of images after the first aligned image.
根据一个或多个实施例,考虑到可能出现同步器串口时间戳数据丢失和图像丢失的情况,可以基于时间戳序列中队首时间戳的第一类帧号,以及图像序列中队首图像的第二类帧号进行匹配,并且,在每次匹配后,无论是否匹配成功,均更新时间戳序列和/或图像序列,具体为删除队首时间戳和/或队首图像。According to one or more embodiments, considering that the serial port timestamp data loss and image loss of the synchronizer may occur, the first type of frame number of the first timestamp in the timestamp sequence and the second frame number of the first image in the image sequence may be based on The class frame number is matched, and after each match, regardless of whether the match is successful or not, the timestamp sequence and/or the image sequence are updated, specifically deleting the team head timestamp and/or the team head image.
根据一个实施例,时间戳序列和图像序列均可以以队列形式的数据格式存储,以遵循先进先出原则。According to one embodiment, both the timestamp sequence and the image sequence may be stored in a data format in the form of a queue to follow a first-in, first-out principle.
S302:判断该帧号差是否等同于标准帧号差,若是,执行S303;若否,则 执行S304。S302: Determine whether the frame number difference is equal to the standard frame number difference, if so, execute S303; if not, execute S304.
S303:将队首时间戳确定为队首图像的曝光时间戳,并更新时间戳序列的队首时间戳和图像序列的队首图像,返回S301的步骤。S303: Determine the team head timestamp as the exposure timestamp of the team head image, update the team head timestamp of the timestamp sequence and the team head image of the image sequence, and return to the step of S301.
根据一个实施例,当队首时间戳的第一类帧号与队首图像的第二类帧号等同于标准帧号差,表示队首时间戳与队首图像匹配,则将队首时间戳确定为队首图像的曝光时间戳,也就是将队首时间戳赋值给队首图像。According to one embodiment, when the first type frame number of the team head timestamp and the second type frame number of the team head image are equal to the standard frame number difference, indicating that the team head timestamp matches the team head image, the team head timestamp Determine the exposure timestamp of the team head image, that is, assign the team head timestamp to the team head image.
根据一个实施例,在匹配成功情况下,更新时间戳序列的队首时间戳和图像序列的队首图像,具体可以为:According to an embodiment, in the case of successful matching, updating the team head timestamp of the timestamp sequence and the team head image of the image sequence, specifically:
丢弃时间戳序列中的队首时间戳,并将所丢弃的队首时间戳的下一时间戳确定为时间戳序列中新的队首时间戳;丢弃图像序列中的队首图像,并将所丢弃的队首图像的下一图像确定为图像序列中新的队首图像。Discard the team head timestamp in the timestamp sequence, and determine the next timestamp of the discarded team head timestamp as the new team head timestamp in the timestamp sequence; discard the team head image in the image sequence, and use the The next image of the discarded head image is determined to be the new head image in the image sequence.
在更新时间戳序列的队首时间戳和图像序列的队首图像,返回S301步骤,重新匹配新的队首时间戳和新的队首图像。After updating the team head timestamp of the time stamp sequence and the team head image of the image sequence, return to step S301 to re-match the new team head timestamp and the new team head image.
S304:更新时间戳序列的队首时间戳或图像序列的队首图像,并返回S301的步骤。S304: Update the team head timestamp of the timestamp sequence or the team head image of the image sequence, and return to the step of S301.
当队首时间戳的第一类帧号与队首图像的第二类帧号不等同于标准帧号差,表示队首时间戳与队首图像不匹配,则可能出现时间戳丢失或图像丢失的情况。When the first type frame number of the team head timestamp and the second type frame number of the team head image are not equal to the standard frame number difference, it means that the team head timestamp does not match the team head image, and there may be time stamp loss or image loss. Case.
根据一个实施例,若该帧号差大于标准帧号差,表示出现了时间戳丢失的情况,可以丢弃图像序列中的队首图像,并将所丢弃的队首图像的下一图像确定为图像序列中新的队首图像,并返回S301的步骤,重新匹配新的队首图像和队首时间戳。According to an embodiment, if the frame number difference is greater than the standard frame number difference, indicating that the time stamp is lost, the head image in the image sequence can be discarded, and the next image of the discarded head image is determined as the image The new team head image in the sequence is returned to the step of S301, and the new team head image and the team head timestamp are re-matched.
若该帧号差小于标准帧号差,表示出现了图像丢失的情况,可以丢弃时间戳序列中的队首时间戳,并将所丢弃的队首时间戳的下一时间戳确定为时间戳序列中新的队首时间戳,并返回S301步骤,重新匹配新的队首时间戳和队首图像。If the frame number difference is less than the standard frame number difference, it means that the image is lost, the queue head timestamp in the timestamp sequence can be discarded, and the next timestamp of the discarded queue head timestamp can be determined as the timestamp sequence and return to step S301 to re-match the new team head timestamp and the team head image.
为了便于理解,下面结合具体例子进行说明。For ease of understanding, the following description is given with reference to specific examples.
假设由于同步器串口不稳定导致时间戳a5丢失,则待匹配的时间戳序列为a4、a6、a7、a8、a9、a10;假设相机驱动不稳定导致图像b8丢失,则待匹配的图像序列为b4、b5、b6、b7、b9、b10。各时间戳的第一类帧号和各图像的第二类帧号延续上例。Assuming that the timestamp a5 is lost due to the instability of the serial port of the synchronizer, the sequence of timestamps to be matched is a4, a6, a7, a8, a9, a10; assuming that the camera driver is unstable and the image b8 is lost, the sequence of images to be matched is b4, b5, b6, b7, b9, b10. The first type of frame number of each timestamp and the second type of frame number of each image continue the above example.
则可以计算队首时间戳的第一类帧号与队首图像的第二类帧号之间的帧号差,也就是时间戳a4的第一类帧号与图像b4的第二类帧号之间的帧号差,具体为:24-14=10,等同于标准帧号差,因此时间戳a4和图像b4是匹配的,将时间戳a4确定为图像b4的曝光时间戳。并丢弃队首时间戳a4,且丢失队首图像b4。Then the frame number difference between the first type frame number of the team head timestamp and the second type frame number of the team head image can be calculated, that is, the first type frame number of the timestamp a4 and the second type frame number of the image b4. The frame number difference between them, specifically: 24-14=10, is equivalent to the standard frame number difference, so the timestamp a4 and the image b4 are matched, and the timestamp a4 is determined as the exposure timestamp of the image b4. And discard the team head timestamp a4, and lose the team head image b4.
由于时间戳a5丢失,因此新的队首时间戳变为时间戳a6,其第一类帧号为26;新的队首图像变为图像b5,其第二类帧号为15。Because the time stamp a5 is lost, the new team head time stamp becomes the time stamp a6, and its first type frame number is 26; the new team head image becomes image b5, and its second type frame number is 15.
重新计算队首时间戳的第一类帧号与队首图像的第二类帧号之间的帧号差,得到26-15=11,大于标准帧号差。Recalculate the frame number difference between the first type frame number of the team head timestamp and the second type frame number of the team head image, and obtain 26-15=11, which is greater than the standard frame number difference.
根据一个或多个实施例,所计算的帧号差大于标准帧号差,表示时间戳丢失,因此无法得到对应图像的精准曝光时间,可以删除队首图像,并返回计算队首时间戳的第一类帧号与队首图像的第二类帧号之间的帧号差的步骤。According to one or more embodiments, the calculated frame number difference is greater than the standard frame number difference, indicating that the time stamp is lost, and therefore the precise exposure time of the corresponding image cannot be obtained. The step of the frame number difference between the first-class frame number and the second-class frame number of the head image.
承接上例,丢弃图像b5,计算当前队首时间戳a6的第一类帧号与队首图像b6的第二类帧号的帧号差,等同于标准帧号差,因此时间戳a6即为图像b6的曝光时间戳,随后分别删除时间戳a6和图像b6,得到新的队首时间戳和队首图像。Continuing the above example, discard the image b5, and calculate the frame number difference between the first type frame number of the current team head timestamp a6 and the second type frame number of the team head image b6, which is equivalent to the standard frame number difference, so the timestamp a6 is Exposure timestamp of image b6, and then delete timestamp a6 and image b6, respectively, to obtain a new team head timestamp and team head image.
同理,时间戳a7和图像b7匹配,分别删除时间戳a7和图像b7,新的队首时间戳为a8,但由于相机驱动不稳定导致图像b8丢失,则新的队首图像为b9,计算a8的第一类帧号与b9的第二类帧号的帧号差为28-19=9,小于标准帧号差。In the same way, the timestamp a7 matches the image b7, delete the timestamp a7 and the image b7 respectively, the new team head timestamp is a8, but the image b8 is lost due to the unstable camera driver, the new team head image is b9, calculate The frame number difference between the first type frame number of a8 and the second type frame number of b9 is 28-19=9, which is smaller than the standard frame number difference.
根据一个或多个实施例,所计算的帧号差小于标准帧号差,表示图像丢失,因此可以删除队首时间戳,并返回计算队首时间戳的第一类帧号与队首图像的第二类帧号之间的帧号差的步骤。According to one or more embodiments, the calculated frame number difference is smaller than the standard frame number difference, indicating that the image is lost, so the head-of-line timestamp can be deleted, and the difference between the first type of frame number used for the calculation of the head-of-group timestamp and the head image of the lineup is returned. The step of the frame number difference between the second type of frame numbers.
承接上例,删除时间戳a8,继续计算队首时间戳的第一类帧号与队首图像的第二类帧号之间的帧号差,直到时间戳序列不包含时间戳和/或图像序列不包含图像。Continue the above example, delete the timestamp a8, continue to calculate the frame number difference between the first type frame number of the team head timestamp and the second type frame number of the team head image, until the timestamp sequence does not contain timestamps and/or images The sequence does not contain images.
经过上述计算,可以得到:时间戳a4与图像b4匹配,即图像b4的曝光时间戳即为a4;时间戳a6与图像b6匹配,即图像b6的曝光时间戳即为a6;时间戳a7与图像b7匹配,即图像b7的曝光时间戳即为a7;时间戳a9与图像b9匹配,即图像b9的曝光时间戳即为a9;时间戳a10与图像b10匹配,即图像b10的曝光时间戳即为a10。After the above calculation, it can be obtained: the time stamp a4 matches the image b4, that is, the exposure time stamp of the image b4 is a4; the time stamp a6 matches the image b6, that is, the exposure time stamp of the image b6 is a6; the time stamp a7 is the same as the image b7 matches, that is, the exposure timestamp of image b7 is a7; timestamp a9 matches image b9, that is, the exposure timestamp of image b9 is a9; timestamp a10 matches image b10, that is, the exposure timestamp of image b10 is a10.
可见,根据一个或多个实施例,基于标准帧号差来匹配时间戳序列和图像序列,在每次匹配时,仅需计算队首时间戳的第一类帧号和队首图像的第二类帧号的帧号差,根据帧号差与标准帧号差的大小关系即可完成精准匹配,得到 图像的精准的曝光时间戳。上述匹配过程计算复杂度很低。It can be seen that, according to one or more embodiments, the timestamp sequence and the image sequence are matched based on the standard frame number difference, and in each matching, only the first type of frame number of the team head timestamp and the second frame number of the team head image need to be calculated. The frame number difference of the class frame number can be accurately matched according to the size relationship between the frame number difference and the standard frame number difference, and the accurate exposure timestamp of the image can be obtained. The above matching process has very low computational complexity.
并且,能够考虑到同步器串口时间戳丢失和相机驱动图像丢失的情况,即使出现上述情况,也能很好的处理不影响后续匹配,具有较强的鲁棒性和实用性。Moreover, it can take into account the loss of the serial port timestamp of the synchronizer and the loss of the camera-driven image. Even if the above situation occurs, it can be handled well without affecting the subsequent matching, and has strong robustness and practicability.
根据一个或多个实施例,在确定图像的精准曝光时间之后,可以通过ROS、CyberRT、Socket等接口将图像数据及与其对应的精准曝光数据发送至应用层,以进行数据融合或建图等。According to one or more embodiments, after the precise exposure time of the image is determined, the image data and its corresponding precise exposure data can be sent to the application layer through interfaces such as ROS, CyberRT, Socket, etc., for data fusion or mapping.
相应于根据本发明一个或多个实施例的图像时间同步方法实施例,本申请实施例还提供了一种图像时间同步装置。参见图4,装置可以包括以下模块:Corresponding to the image time synchronization method embodiments according to one or more embodiments of the present invention, the embodiments of the present application further provide an image time synchronization apparatus. Referring to Figure 4, the apparatus may include the following modules:
第一获取模块401,用于获取图像曝光的时间戳序列,并从时间戳序列中获取每个时间戳的系统时间;The first acquisition module 401 is used for acquiring the time stamp sequence of image exposure, and acquiring the system time of each time stamp from the time stamp sequence;
第二获取模块402,用于获取图像序列,并确定图像序列中每帧图像的系统时间;A second acquisition module 402, configured to acquire an image sequence, and determine the system time of each frame of image in the image sequence;
对齐模块403,用于基于预先确定的图像生成时长,首次对齐时间戳序列中的时间戳和图像序列中的图像,其中,首次对齐的时间戳的系统时间和首次对齐的图像的系统时间之差满足图像生成时长;The alignment module 403 is configured to align the timestamps in the timestamp sequence and the images in the image sequence for the first time based on the predetermined image generation duration, wherein the difference between the system time of the timestamps aligned for the first time and the system time of the images aligned for the first time Satisfy the image generation time;
计算模块404,用于计算首次对齐的时间戳的第一类帧号和首次对齐的图像的第二类帧号之间的标准帧号差; Calculation module 404, for calculating the standard frame number difference between the first type frame number of the time stamp aligned for the first time and the second type frame number of the image aligned for the first time;
匹配模块405,用于基于标准帧号差,匹配时间戳序列中每帧时间戳和图像序列中每帧图像,将与图像相匹配的时间戳确定为该帧图像的曝光时间戳。The matching module 405 is configured to match each frame time stamp in the time stamp sequence with each frame image in the image sequence based on the standard frame number difference, and determine the time stamp matched with the image as the exposure time stamp of the frame image.
根据一个实施例,匹配模型405,具体可以用于:According to one embodiment, the matching model 405 can be specifically used for:
计算所述时间戳序列中队首时间戳的第一类帧号与所述图像序列中队首图像的第二类帧号之间的帧号差,判断该帧号差是否等同于所述标准帧号差,若是,则将所述队首时间戳确定为所述队首图像的曝光时间戳,并更新所述时间戳序列的队首时间戳和所述图像序列的队首图像,返回计算所述时间戳序列中队首时间戳的第一类帧号与所述图像序列中队首图像的第二类帧号之间的帧号差的步骤;Calculate the frame number difference between the first type frame number of the queue head timestamp in the time stamp sequence and the second type frame number of the queue head image in the image sequence, and determine whether the frame number difference is equal to the standard frame number If it is bad, if so, determine the team head timestamp as the exposure timestamp of the team head image, update the team head timestamp of the timestamp sequence and the team head image of the image sequence, and return to calculate the The step of the frame number difference between the first type frame number of the queue head timestamp in the time stamp sequence and the second type frame number of the queue head image in the image sequence;
若该帧号差不等同于所述标准帧号差,则更新所述时间戳序列的队首时间戳或所述图像序列的队首图像,并返回计算所述时间戳序列中队首时间戳的第一类帧号与所述图像序列中队首图像的第二类帧号之间的帧号差的步骤。If the frame number difference is not equal to the standard frame number difference, update the line head timestamp of the time stamp sequence or the line head image of the image sequence, and return the result of calculating the line head time stamp in the time stamp sequence. The step of the frame number difference between the frame number of the first type and the frame number of the second type of the first image in the sequence of images.
应用根据本发明一个或多个实施例的图像时间同步装置,先进行时间戳和 图像的首次对齐,计算首次对齐的时间戳的第一类帧号与首次对齐的图像的第二类帧号之间的标准帧号差,根据标准帧号差即可匹配时间戳序列中的时间戳和图像序列中的图像,并且能够保证帧号差等同于标准帧号差的时间戳和图像是精确匹配的,进而将时间戳赋值给相匹配的图像,能够确定图像的高精准曝光时间。Applying the image time synchronization apparatus according to one or more embodiments of the present invention, firstly align the timestamp and the image for the first time, and calculate the difference between the first-type frame number of the first-aligned timestamp and the second-type frame number of the first-aligned image. According to the standard frame number difference between the two, the time stamp in the timestamp sequence and the image in the image sequence can be matched according to the standard frame number difference, and it can ensure that the time stamp and the image whose frame number difference is equal to the standard frame number difference are exactly matched. , and then assign the timestamp to the matching image, which can determine the high-precision exposure time of the image.
其中,方法和装置是基于同一申请构思的,由于方法和装置解决问题的原理相似,因此装置和方法的实施可以相互参见,重复之处不再赘述。The method and the device are conceived based on the same application. Since the principles of the method and the device for solving the problem are similar, the implementation of the device and the method can be referred to each other, and repeated descriptions will not be repeated here.
本申请实施例还提供了一种电子设备,如图5所示,包括处理器501、通信接口502、存储器503和通信总线504,其中,处理器501,通信接口502,存储器503通过通信总线504完成相互间的通信,An embodiment of the present application further provides an electronic device, as shown in FIG. 5 , including a processor 501 , a communication interface 502 , a memory 503 and a communication bus 504 , wherein the processor 501 , the communication interface 502 , and the memory 503 pass through the communication bus 504 complete communication with each other,
存储器503,用于存放计算机程序;a memory 503 for storing computer programs;
处理器501,用于执行存储器503上所存放的程序时,实现如下步骤:When the processor 501 is used to execute the program stored in the memory 503, the following steps are implemented:
获取图像曝光的时间戳序列,并从时间戳序列中获取每个时间戳的系统时间;Get a sequence of timestamps for image exposure, and get the system time for each timestamp from the sequence of timestamps;
获取图像序列,并确定图像序列中每帧图像的系统时间;Acquire an image sequence and determine the system time of each frame in the image sequence;
基于预先确定的图像生成时长,首次对齐时间戳序列中的时间戳和图像序列中的图像,其中,首次对齐的时间戳的系统时间和首次对齐的图像的系统时间之差满足图像生成时长;Based on the predetermined image generation duration, the timestamps in the timestamp sequence and the images in the image sequence are aligned for the first time, wherein the difference between the system time of the timestamps aligned for the first time and the system time of the images aligned for the first time satisfies the image generation duration;
计算首次对齐的时间戳的第一类帧号和首次对齐的图像的第二类帧号之间的标准帧号差;Calculate the standard frame number difference between the first-type frame number of the first-aligned timestamp and the second-type frame number of the first-aligned image;
基于标准帧号差,匹配时间戳序列中每帧时间戳和图像序列中每帧图像,将与图像相匹配的时间戳确定为该帧图像的曝光时间戳。Based on the standard frame number difference, the time stamp of each frame in the time stamp sequence is matched with each frame of the image in the image sequence, and the time stamp matching the image is determined as the exposure time stamp of the frame image.
上述电子设备提到的通信总线可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned in the above electronic device may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
通信接口用于上述电子设备与其他设备之间的通信。The communication interface is used for communication between the above electronic device and other devices.
存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。根据一个实施例,存储器还可以是至少一个位于远离前述处理器的存 储装置。The memory may include random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk storage. According to one embodiment, the memory may also be at least one storage device located remotely from the aforementioned processor.
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processing,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor can be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processing, DSP), dedicated integrated Circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
应用根据本发明一个或多个实施例的电子设备,先进行时间戳和图像的首次对齐,计算首次对齐的时间戳的第一类帧号与首次对齐的图像的第二类帧号之间的标准帧号差,根据标准帧号差即可匹配时间戳序列中的时间戳和图像序列中的图像,并且能够保证帧号差等同于标准帧号差的时间戳和图像是精确匹配的,进而将时间戳赋值给相匹配的图像,能够确定图像的高精准曝光时间。Applying the electronic device according to one or more embodiments of the present invention, firstly align the timestamp and the image for the first time, and calculate the difference between the first-type frame number of the first-aligned timestamp and the second-type frame number of the first-aligned image. Standard frame number difference, according to the standard frame number difference, the time stamp in the time stamp sequence and the image in the image sequence can be matched, and it can ensure that the time stamp and the image with the frame number difference equal to the standard frame number difference are exactly matched, and then Assigning timestamps to matching images enables highly accurate exposure times to be determined for the images.
在本申请提供的又一实施例中,还提供了一种计算机可读存储介质,该计算机可读存储介质内存储有计算机程序,计算机程序被处理器执行时实现上述任一图像时间同步方法的步骤。In another embodiment provided by the present application, a computer-readable storage medium is also provided, and a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the above image time synchronization methods is implemented. step.
在本申请提供的又一实施例中,还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述实施例中任一图像时间同步方法的步骤。In yet another embodiment provided by the present application, there is also provided a computer program product including instructions, which, when running on a computer, causes the computer to execute the steps of any of the image time synchronization methods in the above-mentioned embodiments.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server, or data center is by wire (eg, coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), and the like.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个......”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element defined by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于图像曝光时间确定装置、电子设备、计算机可读存储介质及计算机程序产品实施例而言,由于其基本相似于图像曝光时间确定方法实施例,所以描述的比较简单,相关之处参见图像曝光时间确定方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the image exposure time determination apparatus, electronic equipment, computer-readable storage medium and computer program product, since they are basically similar to the image exposure time determination method embodiments, the description is relatively simple. Part of the description of the embodiment of the exposure time determination method is sufficient.
本申请的一个或多个实施例可以具有以下一个或多个有益效果:One or more embodiments of the present application may have one or more of the following beneficial effects:
应用本申请一个或多个实施例提供的图像时间同步方法、装置、电子设备及存储介质,先进行时间戳和图像的首次对齐,计算首次对齐的时间戳的第一类帧号与首次对齐的图像的第二类帧号之间的标准帧号差,根据标准帧号差即可匹配时间戳序列中的时间戳和图像序列中的图像,并且能够保证帧号差等同于标准帧号差的时间戳和图像是精确匹配的,进而将时间戳赋值给相匹配的图像,能够确定图像的高精准曝光时间。Applying the image time synchronization method, device, electronic device, and storage medium provided by one or more embodiments of the present application, firstly align the timestamp and the image for the first time, and calculate the first-type frame number of the first-aligned timestamp and the first-aligned frame number. The standard frame number difference between the second type of frame numbers of the image, according to the standard frame number difference, the time stamp in the time stamp sequence and the image in the image sequence can be matched, and the frame number difference can be guaranteed to be equal to the standard frame number difference. Timestamps and images are precisely matched, and by assigning timestamps to matching images, the exposure time of the images can be determined with high precision.
尽管已经针对有限数量的实施例描述了本发明,但是受益于本公开的本领域技术人员将理解,可以设计其他实施例而不脱离本文所公开的本发明的范围。因此,本发明的范围应仅由所附权利要求书限制。While the present invention has been described with respect to a limited number of embodiments, those skilled in the art having the benefit of this disclosure will appreciate that other embodiments can be devised without departing from the scope of the invention disclosed herein. Accordingly, the scope of the present invention should be limited only by the appended claims.
Claims (14)
- 一种图像时间同步方法,包括:An image time synchronization method, comprising:获取图像曝光的时间戳序列,并从所述时间戳序列中获取每帧时间戳的系统时间;Obtain a timestamp sequence of image exposure, and obtain the system time of each frame timestamp from the timestamp sequence;获取图像序列,并确定所述图像序列中的每帧图像的系统时间;Acquire an image sequence, and determine the system time of each frame of image in the image sequence;基于预先确定的图像生成时长,首次对齐所述时间戳序列中的时间戳和所述图像序列中的图像,其中,首次对齐的时间戳的系统时间和首次对齐的图像的系统时间之差满足所述图像生成时长;Based on a predetermined image generation duration, the timestamps in the timestamp sequence and the images in the image sequence are aligned for the first time, wherein the difference between the system time of the timestamps aligned for the first time and the system time of the images aligned for the first time satisfies all requirements the image generation time;计算所述首次对齐的时间戳的第一类帧号和所述首次对齐的图像的第二类帧号之间的标准帧号差;Calculate the standard frame number difference between the first type of frame number of the time stamp of the first alignment and the second type of frame number of the first aligned image;基于所述标准帧号差,匹配所述时间戳序列中的每帧时间戳和所述图像序列中的每帧图像,将与图像相匹配的时间戳确定为该帧图像的曝光时间戳。Based on the standard frame number difference, each frame time stamp in the time stamp sequence is matched with each frame image in the image sequence, and the time stamp matched with the image is determined as the exposure time stamp of the frame image.
- 根据权利要求1所述的方法,其中,所述基于预先确定的图像生成时长,首次对齐所述时间戳序列中的时间戳和所述图像序列中的图像的步骤,包括:The method of claim 1, wherein the step of first aligning the time stamps in the time stamp sequence and the images in the image sequence based on a predetermined image generation duration comprises:丢弃所述图像序列的前若干帧数据;discarding the first several frames of data of the image sequence;计算丢弃所述前若干帧数据后图像队列的队首图像的系统时间与所述时间戳序列中队首时间戳的系统时间的系统时间差;Calculate the system time difference between the system time of the queue head image of the image queue after discarding the first several frames of data and the system time of the queue head timestamp in the timestamp sequence;判断所述系统时间差是否满足所述图像生成时长:Determine whether the system time difference satisfies the image generation duration:若是,则确定丢弃所述前若干帧数据后所述图像队列的所述队首图像和所述队首时间戳分别为首次对齐的图像和首次对齐的时间戳;If so, then it is determined that after discarding the first several frames of data, the head image and the head timestamp of the image queue are respectively the first aligned image and the first aligned timestamp;若否,丢弃所述队首时间戳,返回执行所述计算丢弃所述前若干帧数据后图像队列的队首图像的系统时间与所述时间戳序列中队首时间戳的系统时间的系统时间差的步骤。If not, discard the head-of-line timestamp, and return the system time difference between the system time of the head-of-line image of the image queue after performing the calculation and discarding the first several frames of data and the system time of the head-of-line timestamp in the timestamp sequence step.
- 根据权利要求1所述的方法,其中,所述基于所述标准帧号差,匹配所述时间戳序列中的每帧时间戳和所述图像序列中的每帧图像,将与图像相匹配的时间戳确定为该帧图像的曝光时间戳的步骤,包括:The method according to claim 1, wherein, based on the standard frame number difference, matching each frame time stamp in the time stamp sequence with each frame image in the image sequence, the matching image The steps of determining the time stamp as the exposure time stamp of the frame image include:计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差,判断所述帧号差是否等同于所述标准帧号差:Calculate the frame number difference between the first type of frame number of the line head timestamp in the time stamp sequence and the second type of frame number of the line head image in the image sequence, and determine whether the frame number difference is equal to The standard frame number difference:若是,则将所述队首时间戳确定为所述队首图像的曝光时间戳,并更新所述时间戳序列的所述队首时间戳和所述图像序列的所述队首图像,返 回计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差的步骤;If so, determine the team head timestamp as the exposure timestamp of the team head image, update the team head timestamp of the timestamp sequence and the team head image of the image sequence, and return to calculate The step of the frame number difference between the first type frame number of the team head timestamp in the time stamp sequence and the second type frame number of the team head image in the image sequence;若否,则更新所述时间戳序列的所述队首时间戳或所述图像序列的所述队首图像,并返回计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差的步骤。If not, update the team head timestamp of the timestamp sequence or the team head image of the image sequence, and return the first type of frame number and the first type of frame number for calculating the team head timestamp in the timestamp sequence The step of the frame number difference between the second type of frame numbers of the head of line images in the sequence of images.
- 根据权利要求3所述的方法,其中,所述更新所述时间戳序列的所述队首时间戳和所述图像序列的所述队首图像的步骤,包括:The method of claim 3, wherein the step of updating the head-of-line timestamp of the time-stamp sequence and the head-of-line image of the image sequence comprises:丢弃所述时间戳序列中的所述队首时间戳,并将所丢弃的队首时间戳的下一时间戳确定为所述时间戳序列中新的队首时间戳;discarding the team head timestamp in the timestamp sequence, and determining the next timestamp of the discarded team head timestamp as a new team head timestamp in the timestamp sequence;丢弃所述图像序列中的所述队首图像,并将所丢弃的队首图像的下一图像确定为所述图像序列中新的队首图像。The head image in the image sequence is discarded, and the next image of the discarded head image is determined as a new head image in the image sequence.
- 根据权利要求3所述的方法,其中,所述更新所述时间戳序列的所述队首时间戳或所述图像序列的所述队首图像的步骤,包括:The method according to claim 3, wherein the step of updating the head-of-line timestamp of the time-stamp sequence or the head-of-line image of the image sequence comprises:若所述帧号差大于所述标准帧号差,丢弃所述图像序列中的所述队首图像,并将所丢弃的队首图像的下一图像确定为所述图像序列中新的队首图像;If the frame number difference is greater than the standard frame number difference, discard the head image in the image sequence, and determine the next image of the discarded head image as the new head image in the image sequence image;若所述帧号差小于所述标准帧号差,丢弃所述时间戳序列中的所述队首时间戳,并将所丢弃的队首时间戳的下一时间戳确定为所述时间戳序列中新的队首时间戳。If the frame number difference is smaller than the standard frame number difference, discard the line head timestamp in the time stamp sequence, and determine the next time stamp of the discarded line head time stamp as the time stamp sequence The new team leader timestamp.
- 根据权利要求1所述的方法,其中,所述获取图像曝光的时间戳序列的步骤,包括:The method according to claim 1, wherein the step of obtaining a timestamp sequence of image exposures comprises:从同步器串口获取图像曝光的所述时间戳序列,其中,每帧时间戳均表示同步器产生的脉冲信号触发相机曝光的时间。The time stamp sequence of image exposure is obtained from the serial port of the synchronizer, wherein each frame of time stamp represents the time when the pulse signal generated by the synchronizer triggers the exposure of the camera.
- 一种图像时间同步装置,包括:An image time synchronization device, comprising:第一获取模块,用于获取图像曝光的时间戳序列,并从所述时间戳序列中获取每帧时间戳的系统时间;a first acquisition module, configured to acquire a timestamp sequence of image exposure, and acquire the system time of each frame timestamp from the timestamp sequence;第二获取模块,用于获取图像序列,并确定所述图像序列中每帧图像的系统时间;a second acquisition module, configured to acquire an image sequence, and determine the system time of each frame of image in the image sequence;对齐模块,用于基于预先确定的图像生成时长,首次对齐所述时间戳序列中的时间戳和所述图像序列中的图像,其中,首次对齐的时间戳的系统时间和首次对齐的图像的系统时间之差满足所述图像生成时长;an alignment module for aligning the timestamps in the timestamp sequence and the images in the image sequence for the first time based on a predetermined image generation duration, wherein the system time of the timestamps aligned for the first time and the system time of the aligned images for the first time The time difference satisfies the image generation duration;计算模块,用于计算所述首次对齐的时间戳的第一类帧号和所述首次对齐 的图像的第二类帧号之间的标准帧号差;A calculation module for calculating the standard frame number difference between the first type frame number of the time stamp of the first alignment and the second type frame number of the image aligned for the first time;匹配模块,用于基于所述标准帧号差,匹配所述时间戳序列中的每帧时间戳和所述图像序列中的每帧图像,将与图像相匹配的时间戳确定为该帧图像的曝光时间戳。The matching module is configured to match each frame time stamp in the time stamp sequence with each frame image in the image sequence based on the standard frame number difference, and determine the time stamp matched with the image as the frame of the image. Exposure timestamp.
- 根据权利要求7所述的装置,其中,所述对齐模块具体用于:The apparatus of claim 7, wherein the alignment module is specifically configured to:丢弃所述图像序列的前若干帧数据;discarding the first several frames of data of the image sequence;计算丢弃所述前若干帧数据后图像队列的队首图像的系统时间与所述时间戳序列中队首时间戳的系统时间的系统时间差;Calculate the system time difference between the system time of the queue head image of the image queue after discarding the first several frames of data and the system time of the queue head timestamp in the timestamp sequence;判断所述系统时间差是否满足所述图像生成时长:Determine whether the system time difference satisfies the image generation duration:若是,则确定丢弃所述前若干帧数据后所述图像队列的所述队首图像和所述队首时间戳分别为首次对齐的图像和首次对齐的时间戳;If so, then it is determined that after discarding the first several frames of data, the head image and the head timestamp of the image queue are respectively the first aligned image and the first aligned timestamp;若否,丢弃所述队首时间戳,返回执行所述计算丢弃所述前若干帧数据后图像队列的队首图像的系统时间与所述时间戳序列中队首时间戳的系统时间的系统时间差的步骤。If not, discard the head-of-line timestamp, and return the system time difference between the system time of the head-of-line image of the image queue after performing the calculation and discarding the first several frames of data and the system time of the head-of-line timestamp in the timestamp sequence step.
- 根据权利要求7所述的装置,其中,所述匹配模块具体用于:The device according to claim 7, wherein the matching module is specifically used for:计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差,判断所述帧号差是否等同于所述标准帧号差:Calculate the frame number difference between the first type of frame number of the line head timestamp in the time stamp sequence and the second type of frame number of the line head image in the image sequence, and determine whether the frame number difference is equal to The standard frame number difference:若是,则将所述队首时间戳确定为所述队首图像的曝光时间戳,并更新所述时间戳序列的所述队首时间戳和所述图像序列的所述队首图像,返回计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差的步骤;If so, determine the team head timestamp as the exposure timestamp of the team head image, update the team head timestamp of the timestamp sequence and the team head image of the image sequence, and return to calculate The step of the frame number difference between the first type frame number of the team head timestamp in the time stamp sequence and the second type frame number of the team head image in the image sequence;若否,则更新所述时间戳序列的所述队首时间戳或所述图像序列的所述队首图像,并返回计算所述时间戳序列中的队首时间戳的第一类帧号与所述图像序列中的队首图像的第二类帧号之间的帧号差的步骤。If not, update the team head timestamp of the timestamp sequence or the team head image of the image sequence, and return the first type of frame number and the first type of frame number for calculating the team head timestamp in the timestamp sequence The step of the frame number difference between the second type of frame numbers of the head of line images in the sequence of images.
- 根据权利要求9所述的装置,其中,在执行所述更新所述时间戳序列的所述队首时间戳和所述图像序列的所述队首图像时,所述匹配模块具体用于:The apparatus according to claim 9, wherein, when performing the updating of the team head timestamp of the timestamp sequence and the team head image of the image sequence, the matching module is specifically configured to:丢弃所述时间戳序列中的所述队首时间戳,并将所丢弃的队首时间戳的下一时间戳确定为所述时间戳序列中新的队首时间戳;discarding the team head timestamp in the timestamp sequence, and determining the next timestamp of the discarded team head timestamp as a new team head timestamp in the timestamp sequence;丢弃所述图像序列中的所述队首图像,并将所丢弃的队首图像的下一图像确定为所述图像序列中新的队首图像。The head image in the image sequence is discarded, and the next image of the discarded head image is determined as a new head image in the image sequence.
- 根据权利要求9所述的装置,其中,在执行所述更新所述时间戳序列的所述队首时间戳或所述图像序列的所述队首图像时,所述匹配模块具体用于:The apparatus according to claim 9, wherein, when performing the updating of the team head timestamp of the timestamp sequence or the team head image of the image sequence, the matching module is specifically configured to:若所述帧号差大于所述标准帧号差,丢弃所述图像序列中的所述队首图像,并将所丢弃的队首图像的下一图像确定为所述图像序列中新的队首图像;If the frame number difference is greater than the standard frame number difference, discard the head image in the image sequence, and determine the next image of the discarded head image as the new head image in the image sequence image;若所述帧号差小于所述标准帧号差,丢弃所述时间戳序列中的所述队首时间戳,并将所丢弃的队首时间戳的下一时间戳确定为所述时间戳序列中新的队首时间戳。If the frame number difference is smaller than the standard frame number difference, discard the line head timestamp in the time stamp sequence, and determine the next time stamp of the discarded line head time stamp as the time stamp sequence The new team leader timestamp.
- 根据权利要求7所述的装置,其中,在执行所述获取图像曝光的时间戳序列时,所述第一获取模块具体用于:The apparatus according to claim 7, wherein, when executing the time stamp sequence for obtaining image exposure, the first obtaining module is specifically configured to:从同步器串口获取图像曝光的所述时间戳序列,其中,每帧时间戳均表示同步器产生的脉冲信号触发相机曝光的时间。The time stamp sequence of image exposure is obtained from the serial port of the synchronizer, wherein each frame of time stamp represents the time when the pulse signal generated by the synchronizer triggers the exposure of the camera.
- 一种电子设备,包括:An electronic device comprising:通信接口;Communication Interface;存储器,用于存放计算机程序;memory for storing computer programs;通信总线;communication bus;处理器,用于执行所述存储器上所存放的程序时,实现根据权利要求1-6中任一项所述的方法,The processor, when executing the program stored on the memory, realizes the method according to any one of claims 1-6,其中,所述处理器、所述通信接口、所述存储器通过所述通信总线完成相互间的通信。Wherein, the processor, the communication interface, and the memory communicate with each other through the communication bus.
- 一种计算机可读存储介质,其中,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现根据权利要求1-6中任一项所述的方法。A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method according to any one of claims 1-6 is implemented.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110359538.1 | 2021-04-02 | ||
CN202110359538.1A CN112751983B (en) | 2021-04-02 | 2021-04-02 | Image time synchronization method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022205734A1 true WO2022205734A1 (en) | 2022-10-06 |
Family
ID=75651704
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/112178 WO2022205734A1 (en) | 2021-04-02 | 2021-08-12 | Image time synchronization method and apparatus, and electronic device and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112751983B (en) |
WO (1) | WO2022205734A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116709004A (en) * | 2022-11-21 | 2023-09-05 | 荣耀终端有限公司 | Image processing method and electronic equipment |
WO2024193278A1 (en) * | 2023-03-20 | 2024-09-26 | 先临三维科技股份有限公司 | Data synchronization method and apparatus, and device and storage medium |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112751983B (en) * | 2021-04-02 | 2021-06-18 | 湖北亿咖通科技有限公司 | Image time synchronization method and device, electronic equipment and storage medium |
CN113784118A (en) * | 2021-09-14 | 2021-12-10 | 广州博冠信息科技有限公司 | Video quality evaluation method and device, electronic equipment and storage medium |
CN114710228B (en) * | 2022-05-31 | 2022-09-09 | 杭州闪马智擎科技有限公司 | Time synchronization method and device, storage medium and electronic device |
CN116156074B (en) * | 2022-11-21 | 2024-03-15 | 辉羲智能科技(上海)有限公司 | Multi-camera acquisition time synchronization method |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104270567A (en) * | 2014-09-11 | 2015-01-07 | 深圳市南航电子工业有限公司 | High-precision synchronous multi-channel image acquisition system and time synchronization method thereof |
CN107613159A (en) * | 2017-10-12 | 2018-01-19 | 北京工业职业技术学院 | Image temporal calibration method and system |
CN109587405A (en) * | 2018-10-24 | 2019-04-05 | 科大讯飞股份有限公司 | Method for synchronizing time and device |
US20200099824A1 (en) * | 2018-09-26 | 2020-03-26 | Zoox, Inc. | Image scan line timestamping |
US20210084362A1 (en) * | 2019-09-12 | 2021-03-18 | Shanghai Bilibili Technology Co., Ltd. | Method and system of processing information flow and method of displaying comment information |
CN112751983A (en) * | 2021-04-02 | 2021-05-04 | 湖北亿咖通科技有限公司 | Image time synchronization method and device, electronic equipment and storage medium |
Family Cites Families (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8189690B2 (en) * | 2009-10-19 | 2012-05-29 | Intergraph Technologies Company | Data search, parser, and synchronization of video and telemetry data |
ES2586946T3 (en) * | 2010-07-30 | 2016-10-19 | Deutsche Telekom Ag | Method and apparatus for evaluating the quality of a video sequence by temporarily synchronizing the encrypted bit stream of a video encoder with the processed video sequence obtained by an external video decoder |
US20140185610A1 (en) * | 2013-01-03 | 2014-07-03 | Qualcomm Incorporated | Selectively patching erasures in circiut-switched calls whose frame erasure rate rises above a threshold by establishing and synchronizing a voip stream |
US9258193B2 (en) * | 2014-01-14 | 2016-02-09 | Nokia Technologies Oy | Method, apparatus, and computer program product for wireless network cluster discovery and concurrency management |
US9984354B1 (en) * | 2014-09-30 | 2018-05-29 | Amazon Technologies, Inc. | Camera time synchronization system |
JP2016123009A (en) * | 2014-12-25 | 2016-07-07 | ルネサスエレクトロニクス株式会社 | Semiconductor device, electronic device module, and network system |
US9813783B2 (en) * | 2016-04-01 | 2017-11-07 | Intel Corporation | Multi-camera dataset assembly and management with high precision timestamp requirements |
CN106851044B (en) * | 2016-12-13 | 2020-01-03 | 深圳英飞拓科技股份有限公司 | Video synchronous playback method and device |
KR101846386B1 (en) * | 2017-08-02 | 2018-04-06 | 주식회사 비바엔에스 | Method and system for checking video call quality of mobile device |
US10841496B2 (en) * | 2017-10-19 | 2020-11-17 | DeepMap Inc. | Lidar to camera calibration based on edge detection |
US10474916B2 (en) * | 2017-11-20 | 2019-11-12 | Ashok Krishnan | Training of vehicles to improve autonomous capabilities |
CN108174242A (en) * | 2018-01-09 | 2018-06-15 | 武汉斗鱼网络科技有限公司 | Live data multiplexing method, device, storage medium and equipment |
CN108924461B (en) * | 2018-06-20 | 2021-08-13 | 斑马网络技术有限公司 | Video image processing method and device |
CN108989606B (en) * | 2018-08-22 | 2021-02-09 | Oppo广东移动通信有限公司 | Image processing method and device, electronic equipment and computer readable storage medium |
CN111372111A (en) * | 2018-12-25 | 2020-07-03 | 北京初速度科技有限公司 | Data determination method and device and vehicle-mounted terminal |
CN109873921B (en) * | 2019-02-14 | 2023-04-07 | 魔门塔(苏州)科技有限公司 | Image timestamp transmission method, image timestamp analysis method and image timestamp analysis device |
CN110460824B (en) * | 2019-07-03 | 2022-10-11 | 青岛小鸟看看科技有限公司 | Frame synchronization method of image data and camera |
CN110740227B (en) * | 2019-10-25 | 2021-08-10 | 武汉大学 | Camera time synchronization device and method based on GNSS time service and image display information coding mode |
CN111949237A (en) * | 2020-07-20 | 2020-11-17 | 西安万像电子科技有限公司 | Image display method and device |
CN112153372B (en) * | 2020-09-04 | 2022-04-29 | 合肥富煌君达高科信息技术有限公司 | Precision-controllable synchronous error measurement system for multiple high-speed cameras |
-
2021
- 2021-04-02 CN CN202110359538.1A patent/CN112751983B/en active Active
- 2021-08-12 WO PCT/CN2021/112178 patent/WO2022205734A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104270567A (en) * | 2014-09-11 | 2015-01-07 | 深圳市南航电子工业有限公司 | High-precision synchronous multi-channel image acquisition system and time synchronization method thereof |
CN107613159A (en) * | 2017-10-12 | 2018-01-19 | 北京工业职业技术学院 | Image temporal calibration method and system |
US20200099824A1 (en) * | 2018-09-26 | 2020-03-26 | Zoox, Inc. | Image scan line timestamping |
CN109587405A (en) * | 2018-10-24 | 2019-04-05 | 科大讯飞股份有限公司 | Method for synchronizing time and device |
US20210084362A1 (en) * | 2019-09-12 | 2021-03-18 | Shanghai Bilibili Technology Co., Ltd. | Method and system of processing information flow and method of displaying comment information |
CN112751983A (en) * | 2021-04-02 | 2021-05-04 | 湖北亿咖通科技有限公司 | Image time synchronization method and device, electronic equipment and storage medium |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116709004A (en) * | 2022-11-21 | 2023-09-05 | 荣耀终端有限公司 | Image processing method and electronic equipment |
CN116709004B (en) * | 2022-11-21 | 2024-04-05 | 荣耀终端有限公司 | Image processing method and electronic equipment |
WO2024193278A1 (en) * | 2023-03-20 | 2024-09-26 | 先临三维科技股份有限公司 | Data synchronization method and apparatus, and device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112751983B (en) | 2021-06-18 |
CN112751983A (en) | 2021-05-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022205734A1 (en) | Image time synchronization method and apparatus, and electronic device and storage medium | |
US9813783B2 (en) | Multi-camera dataset assembly and management with high precision timestamp requirements | |
US20180003822A1 (en) | Environmental sensing device and information acquiring method applied to environmental sensing device | |
US8203958B2 (en) | Frame counter correction apparatus, opposing apparatus, and frame counter correction method | |
CN108920257B (en) | Transaction processing method, device, equipment and storage medium | |
CN111585682A (en) | Sensor time synchronization method and device and terminal equipment | |
WO2022077224A1 (en) | Clock synchronization method and apparatus, chip system, unmanned aerial vehicle, and terminal | |
CN112291024A (en) | Information synchronization method, information synchronization device and electronic equipment | |
WO2018166418A1 (en) | Network timing method and device | |
US8793402B2 (en) | Synchronizing time across a plurality of devices connected to a network | |
CN114528940A (en) | Multi-sensor target fusion method and device | |
WO2022179120A1 (en) | Gateway interception method and apparatus, electronic device and storage medium | |
US9588884B2 (en) | Systems and methods for in-place reorganization of device storage | |
CN118276481A (en) | Intelligent driving debugging method, device, system, electronic equipment and storage medium | |
WO2024159982A1 (en) | Parking space detection effect evaluation method and apparatus, and related device | |
WO2024146096A1 (en) | Determination method for current time, and mobile device and medium | |
CN116185133B (en) | Chip clock calibration method and device, chip, electronic equipment and storage medium | |
JP2010045592A (en) | Time stamp adding device, time stamp adding method, and time stamp adding program | |
CN114448547A (en) | Time synchronization method and device, electronic equipment and storage medium | |
US11546171B2 (en) | Systems and methods for synchronizing anonymized linked data across multiple queues for secure multiparty computation | |
WO2016180167A1 (en) | Method, device and system for associating events between computing devices | |
CN117492935B (en) | Mirror image data synchronization method, device, terminal and storage medium | |
US20230126583A1 (en) | Timestamp issuing method | |
US20230276301A1 (en) | System and method for gpu-initiated communication | |
US20230102907A1 (en) | Device with time stamp synchronizing and related method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21934378 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21934378 Country of ref document: EP Kind code of ref document: A1 |