CN111818295B - Image acquisition method and device - Google Patents

Image acquisition method and device Download PDF

Info

Publication number
CN111818295B
CN111818295B CN201910283294.6A CN201910283294A CN111818295B CN 111818295 B CN111818295 B CN 111818295B CN 201910283294 A CN201910283294 A CN 201910283294A CN 111818295 B CN111818295 B CN 111818295B
Authority
CN
China
Prior art keywords
image
track
preset
image data
tracks
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910283294.6A
Other languages
Chinese (zh)
Other versions
CN111818295A (en
Inventor
王厚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201910283294.6A priority Critical patent/CN111818295B/en
Priority to PCT/CN2020/083707 priority patent/WO2020207403A1/en
Publication of CN111818295A publication Critical patent/CN111818295A/en
Application granted granted Critical
Publication of CN111818295B publication Critical patent/CN111818295B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/18Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast
    • H04N7/181Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast for receiving images from a plurality of remote sources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • H04N5/265Mixing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/18Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

The embodiment of the application provides an image acquisition method and device, comprising the following steps: the method comprises the steps of obtaining a data packet of a picture to be captured through a preset transmission channel, obtaining image data corresponding to code streams of all tracks, and storing the obtained image data of all tracks to cache regions corresponding to all tracks according to the corresponding relation between the tracks and the cache regions to obtain images of the picture to be captured. According to the scheme, the code streams of the preset frames of the camera equipment are transmitted in the same data packet through the preset transmission channel, and the image data corresponding to the code streams of the tracks are obtained in the preset transmission channel, so that the image of the picture to be captured is obtained. The process is completed in one transmission channel, and even if the number of the camera devices is increased, the transmission channel does not need to be increased, so that the transmission channel resource is saved. Image data are obtained in one transmission channel, image splicing processing is not needed, and image splicing resources are saved.

Description

Image acquisition method and device
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an image acquisition method and apparatus.
Background
In a real-time code stream or a stored video that is shot and transmitted by a camera, when a target object, or a preset event occurs, it is necessary to acquire one or more frames of images of the target object, or the preset event, so as to perform subsequent processing on the acquired images.
At present, a mode of acquiring a frame of image from a real-time code stream or a video is acquired by a grab picture, and the grab picture is used for grabbing complete YUV data of the frame of image from the real-time code stream or the video, wherein Y represents brightness, U represents chroma, and V represents concentration. And then the captured YUV data is encoded into a required image format, such as JPEG format, RGB format, and the like.
When a plurality of cameras simultaneously acquire video data, each camera corresponds to one transmission channel, and the shot video data can be transmitted in a code stream form through the transmission channels. The captured image can be captured in only one transmission channel, so that when a plurality of cameras shoot simultaneously, images need to be captured from the video shot by each camera, and then a plurality of captured images are spliced into a complete image by using a large-screen splicing technology.
Specifically, there is one decoder for each transmission channel and one display channel for each decoder. And each camera transmits shot video data to a decoder through a transmission channel, the decoder decodes the video data in the transmission channel and transmits the decoded data to a large display screen through a display channel, and at the moment, an image represented by the data in each display channel is only a partial image in the image to be captured. And (3) the large display screen splices the images of all the parts through a large screen splicing technology to obtain spliced images, and screenshot the spliced images to obtain the images to be captured.
However, in the current scheme for realizing the capture of the image, each camera needs to correspond to one transmission channel, when the number of cameras is increased, the number of transmission channels needs to be increased correspondingly, and the more cameras, the more transmission channel resources are required.
Disclosure of Invention
An object of the embodiments of the present application is to provide an image acquisition method and an image acquisition device, so as to solve the problem of resource waste of a transmission channel in the case of multiple image capturing apparatuses. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an image acquisition method, where the method includes:
acquiring a data packet of a picture to be captured through a preset transmission channel, wherein the data packet carries a code stream of preset frames of a plurality of tracks, each track corresponds to at least one camera device, and the preset frames are frames of the same frame or frames of the same time;
acquiring image data corresponding to the code stream of each track;
and storing the acquired image data of each track to the cache region corresponding to each track according to the corresponding relation between the tracks and the cache region to obtain the image of the picture to be captured.
Optionally, the data packet further carries track number information; after the step of obtaining the data packet of the picture to be grabbed, the method further comprises the following steps:
determining the number of cache regions required to be allocated based on the track number information;
and allocating a corresponding buffer area for each track, wherein the buffer area is used for storing the image data in the track corresponding to the buffer area.
Optionally, the allocating a corresponding buffer area for each track includes:
allocating a total cache region with an available storage space not smaller than a target data volume, a width not smaller than a preset width and a height not smaller than a preset height, wherein the target data volume is the data volume of an image generated by the picture to be captured, and the preset width and the preset height are respectively the width and the height of the image generated by the picture to be captured;
averagely dividing the preset width of the total cache area to obtain a plurality of sub-widths with the same length, wherein the number of the sub-widths is the same as that of the tracks;
determining an area formed by each sub-width and the preset height as a cache area, wherein the determined cache areas and the tracks are in one-to-one correspondence;
the storing the acquired image data of each track to the cache region corresponding to each track according to the corresponding relationship between the track and the cache region includes:
obtaining image data with the image width as the sub-width and the image height as the preset height based on the obtained image data of each track;
respectively storing the obtained image data of each track to the cache region corresponding to each track according to the one-to-one correspondence relationship between the cache regions and the tracks;
and after the image data of each track is stored, combining the image data stored in each cache region to obtain the image of the picture to be captured.
Optionally, the method further comprises:
and after the image data of each track is stored, encoding the stored image data to obtain an image in a preset format.
In a second aspect, an embodiment of the present application provides an image capturing apparatus, including:
the first acquisition module is used for acquiring a data packet of a picture to be captured through a preset transmission channel, wherein the data packet carries a code stream of preset frames of a plurality of tracks, each track corresponds to at least one camera device, and the preset frames are frames of the same frame or frames of the same time;
the second acquisition module is used for acquiring image data corresponding to the code stream of each track;
and the storage module is used for storing the acquired image data of each track to the cache region corresponding to each track according to the corresponding relation between the track and the cache region to obtain the image of the picture to be captured.
Optionally, the apparatus further comprises:
the determining module is used for determining the number of the cache regions required to be allocated based on the track number information;
the allocation module is used for allocating a corresponding buffer area for each track, wherein the buffer area is used for storing the image data of the track corresponding to the buffer area.
Optionally, the allocation module is specifically configured to:
allocating a total cache area with an available storage space not smaller than a target data volume, a width not smaller than the preset width and a height not smaller than the preset height, wherein the target data volume is the data volume of an image generated by the picture to be captured, and the preset width and the preset height are respectively the width and the height of the image generated by the picture to be captured;
averagely dividing the preset width of the total cache area to obtain a plurality of sub-widths with the same length, wherein the number of the sub-widths is the same as that of the tracks;
determining an area formed by each sub-width and the preset height as a cache area, wherein the determined cache areas and the tracks are in one-to-one correspondence;
the storage module is specifically configured to:
obtaining image data with the image width as the sub-width and the image height as the preset height based on the obtained image data of each track;
respectively storing the obtained image data of each track to the cache region corresponding to each track according to the one-to-one correspondence relationship between the cache regions and the tracks;
and after the image data of each track is stored, combining the image data stored in each cache region to obtain the image of the picture to be captured.
Optionally, the apparatus further comprises:
and the coding module is used for coding the stored image data after the image data of each track is stored, so as to obtain an image with a preset format.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
and a processor for implementing any of the above-described image acquisition method steps when executing the program stored in the memory.
In a fourth aspect, the present application provides a machine-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements any of the image acquisition method steps described above.
According to the technical scheme, a data packet of the picture to be captured is acquired through a preset transmission channel, wherein the data packet carries code streams of preset frames of a plurality of tracks, each track corresponds to at least one camera device, image data corresponding to the code streams of the tracks are acquired, and the acquired image data of the tracks are stored in cache regions corresponding to the tracks according to the corresponding relation between the tracks and the cache regions, so that the image of the picture to be captured is acquired. According to the technical scheme provided by the embodiment of the application, the code streams of the preset frames of the camera equipment are transmitted in the same data packet through the preset transmission channel, and the image data corresponding to the code streams of the tracks are obtained in the preset transmission channel, so that the image of the picture to be captured is obtained. The process is completed in one transmission channel, and even if the number of the camera devices is increased, the transmission channel does not need to be increased, so that the transmission channel resource is saved. And moreover, image data are obtained in a transmission channel, and the image data are correspondingly stored in a cache region, so that the image of the picture to be captured can be obtained in a display channel, image splicing processing is not needed, and image splicing resources are saved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of an image acquisition method according to an embodiment of the present application;
FIG. 2(a) is a schematic diagram of the determined buffer;
fig. 2(b) is an image of a picture to be captured obtained based on the determined buffer area;
FIG. 2(c) is a schematic diagram of a frame to be captured based on the determined buffer area;
FIG. 3(a) is another schematic diagram of the determined buffer;
FIG. 3(b) is another schematic diagram of the determined buffer;
fig. 4 is a schematic structural diagram of an image capturing apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to solve the problem of resource waste of a transmission channel under the condition of a plurality of camera devices, an embodiment of the application provides an image acquisition method and an image acquisition device, wherein the image acquisition method comprises the following steps:
acquiring a data packet of a picture to be captured through a preset transmission channel, wherein the data packet carries a code stream of preset frames of a plurality of tracks, each track corresponds to at least one camera device, and the preset frames are frames of the same frame or frames of the same time;
acquiring image data corresponding to the code stream of each track;
and storing the acquired image data of each track to a cache region according to the corresponding relation between the track and the cache region to obtain an image of the picture to be captured.
According to the technical scheme provided by the embodiment of the application, the code streams of the preset frames of the camera equipment are transmitted in the same data packet through the preset transmission channel, and the image data corresponding to the code streams of the tracks are obtained in the preset transmission channel, so that the image of the picture to be captured is obtained. The process is completed in one transmission channel, and even if the number of the camera devices is increased, the transmission channel does not need to be increased, so that the transmission channel resource is saved. And moreover, image data are obtained in a transmission channel, and the image data are correspondingly stored in a cache region, so that the image of the picture to be captured can be obtained in a display channel, image splicing processing is not needed, and image splicing resources are saved.
First, an image acquisition method provided in an embodiment of the present application is described below. The image acquisition method provided by the embodiment of the application can be applied to video processing equipment, the video processing equipment can be connected with one or more image pickup equipment, and each image pickup equipment can send shot video data to the video processing equipment for processing. In addition, when the video processing device receives the code stream sent by the image pickup device, the received code stream can be decoded to obtain a video image shot by the image pickup device.
As shown in fig. 1, an image acquiring method provided in an embodiment of the present application includes the following steps.
S101, acquiring a data packet of a picture to be captured through a preset transmission channel.
The data packet carries a code stream of preset frames of a plurality of tracks, and each track corresponds to at least one camera device. For example, the track corresponding to the image pickup apparatus 1 is the track 1, and the code stream output by the image pickup apparatus 1 is the code stream of the track 1.
The preset frames are the same frames or frames at the same time.
When the preset frames are the same frames, the code stream included in one data packet is the code stream of the same frame of each camera device. For example, the image pickup apparatus includes an image pickup apparatus 1, an image pickup apparatus 2, and an image pickup apparatus 3, and a code stream of the first frame image of the image pickup apparatus 1, a code stream of the first frame image of the image pickup apparatus 2, and a code stream of the first frame image of the image pickup apparatus 3 are packed into one data packet.
When the preset frames are frames at the same time, the code stream included in one data packet is the code stream of the frames at the same time of each camera device. For example, the code stream of the image pickup apparatus 1 at the time of 12 dots, the code stream of the image pickup apparatus 2 at the time of 12 dots, and the code stream of the image pickup apparatus 3 at the time of 12 dots are packed into one packet.
In one implementation, the code stream included in one data packet may be a code stream of only one frame of image, for example, a first data packet includes a code stream of a first frame of image of each camera, and a second data packet includes a code stream of a second frame of image of each camera. The code streams of different cameras in a data packet can be distinguished by using a preset start mark and an end mark.
In another implementation, the code stream included in one data packet may further include code streams of multiple frames of images, and in this case, the data packet may have a mark for marking the start and the end of each frame of code stream, so as to distinguish the code stream of each frame.
The preset transmission channel can be set by a user, and is used for transmitting the code streams of the connected multiple camera devices, namely, the multiple camera devices transmit the code streams through the preset transmission channel.
In one implementation, a transmission protocol is customized in advance, each camera device encodes the acquired image information into a code stream according to the transmission protocol, and packages the code stream obtained by encoding and the code streams of other camera devices into a data packet, and transmits the data packet through a preset transmission channel.
The description is given by taking a self-defined protocol as a multi-track stream protocol as an example, the multi-track stream protocol is a code stream protocol for code stream coding and decoding, transmission, preview, video storage and the like, the multi-track stream code stream comprises a plurality of track code streams coded based on image information of a plurality of camera devices, code stream images of different tracks can be spliced and combined into one image, and the code streams of the plurality of tracks can be transmitted, previewed, stored in a transmission channel and the like. The protocol header of the multi-track stream protocol may include information such as the number of tracks, start and end markers of the code stream of each track in the data packet, and the like.
In another implementation manner, each image capturing device may be connected to one processing device, and each image capturing device may send the image information acquired by each image capturing device to the processing device. After receiving the image information sent by each camera device, the processing device can encode the image information into a code stream, and pack the code stream belonging to the same frame of image into a data packet, and transmit the data packet through a preset transmission channel.
For example, the processing device is connected to the image pickup device 1, the image pickup device 2, and the image pickup device 3, respectively, the image pickup device 1, the image pickup device 2, and the image pickup device 3 transmit first frame image information acquired by the respective image pickup devices to the processing device, the processing device encodes the received first frame image information into a code stream for the first frame image, and packages the code stream for the first frame image of the image pickup device 1, the code stream for the first frame image of the image pickup device 2, and the code stream for the first frame image of the image pickup device 3 into one data packet, and transmits the data packet through a preset transmission channel. In this way, it is ensured that the first frame images captured by the image capturing apparatus 1, the image capturing apparatus 2, and the image capturing apparatus 3 are synchronized.
By any of the above implementation manners, the code streams belonging to the same frame of image can be transmitted in the same data packet, and synchronization between the camera devices is further ensured.
The frame to be captured can be set by self-definition. For example, in a scene in which a video picture taken by the image pickup apparatus is played in real time, a currently displayed picture may be taken as a picture to be captured. In a scenario of playing back a stored video, a currently displayed picture may be taken as a picture to be grabbed during the playback process. The picture of the first frame image of the currently played video can also be determined as the picture to be grabbed.
In a scene of playing back the stored video, a picture of any frame in the video can be determined as a picture to be grabbed, so that the picture to be grabbed can be determined according to a user instruction, and an image of the picture to be grabbed can be acquired from the played back video.
The data packet may further include MFI (Multiple Frame Indicator) information, where the MFI information may include the number of tracks, information of each code stream in the data packet, and identifiers of the start and end of each code stream of each track.
And S102, acquiring image data corresponding to the code stream of each track.
If the code stream transmitted in the track is decoded image data, the image data can be directly acquired from each track. If the code stream transmitted in the track is the encoded image data, the code stream of each track can be decoded to obtain the image data of the track.
After the data packet is obtained, the code stream carried by the data packet may be obtained, where the obtained code stream includes the code stream of each track, that is, the code stream output by each image capture device. And after the code stream of each track is obtained, decoding the code stream of each track respectively.
In an implementation manner of decoding the code stream of each track, each track corresponds to a decoder, the decoder can decode the code stream on the corresponding track, and the decoder corresponding to each track does not decode the code streams of other tracks except the track.
For example, the image pickup apparatus 1 corresponds to the track 1, the image pickup apparatus 2 corresponds to the track 2, and the image pickup apparatus 3 corresponds to the track 3, wherein the track 1 corresponds to the decoder 1, the track 2 corresponds to the decoder 2, and the track 3 corresponds to the decoder 3. Then, the decoder 1 performs decoding processing on the code stream of the track 1, the decoder 2 performs decoding processing on the code stream of the track 2, and the decoder 3 performs decoding processing on the code stream of the track 3.
The image data is data for representing an image, and the image data may be YUV data, RGB data, or the like. In the embodiment of the present application, YUV data is taken as an example for description. That is, if the acquired image data is YUV data, the YUV data can be used to represent an image. For example, when the YUV data is derived from the image pickup apparatus 1, an image represented by the YUV data is an image picked up by the image pickup apparatus 1.
S103, storing the acquired image data of each track to the cache region corresponding to each track according to the corresponding relation between the tracks and the cache region, and obtaining the image of the picture to be captured.
The corresponding relationship between the track and the cache region may be preset, or may be determined according to a code stream carried by the data packet, which is not limited herein. The correspondence between the tracks and the buffer area is used to determine the storage location of the image data of each track. After the image data of each track is stored in the corresponding buffer area, that is, after the corresponding image data is stored in each buffer area, all the stored image data are combined to form an image, which is the image of the picture to be captured.
For example, the image pickup apparatus includes an image pickup apparatus 1, an image pickup apparatus 2, and an image pickup apparatus 3, and the cache region includes a cache region 1, a cache region 2, and a cache region 3, as shown in fig. 2(a), in which the image pickup apparatus 1 corresponds to the cache region 1, the image pickup apparatus 2 corresponds to the cache region 2, and the image pickup apparatus 3 corresponds to the cache region 3. YUV data obtained after decoding processing of a code stream output by the camera device 1 is stored in the cache region 1, YUV data obtained after decoding processing of the code stream output by the camera device 2 is stored in the cache region 2, and YUV data obtained after decoding processing of the code stream output by the camera device 3 is stored in the cache region 3. After the 3 buffer areas store the YUV data of the corresponding image pickup devices, the YUV data in the 3 buffer areas are combined together to obtain a combined image, as shown in fig. 2(b), two vertical lines in the figure are added for comparison with fig. 2(a), and finally an image, that is, an image of a picture to be captured is obtained, as shown in fig. 2 (c).
In one embodiment, the buffer is predetermined. The number of cache regions is consistent with the number of tracks, and each track corresponds to one cache region, which may be in a one-to-one correspondence. In the case of cache region determination, the correspondence of each track to the cache region is determined in advance. In the subsequent image acquisition process, the corresponding relationship is kept unchanged, that is, the image data transmitted in each track is fixedly stored in the corresponding buffer area.
For example, the buffer area 1 and the buffer area 2 are preset, and it is preset that the track 1 corresponds to the buffer area 1 and the track 2 corresponds to the buffer area 2, so that when image acquisition is performed, the image data transmitted in the track 1 is stored in the buffer area 1, and the image data transmitted in the track 2 is stored in the buffer area 2.
In this embodiment, the cache region may be adjusted, and the corresponding relationship between the track and the cache region may be adjusted again.
In an embodiment, the cache region corresponding to each track may be a custom-set cache region, and the cache regions corresponding to the tracks may be continuous or discontinuous. Based on the correspondence between the tracks and the cache regions, the image data in each track may be stored into the corresponding cache region. When an image needs to be generated, the stored image data can be acquired from each buffer area, and the acquired image data are combined according to a preset arrangement rule, so that an image of a picture to be captured can be obtained. After the image data are combined, format conversion, scaling processing and the like can be performed, and then the image of the to-be-captured picture meeting the requirements is obtained.
The preset arrangement rule may be self-defined. For example, the image data in the track 1 is captured by the image capturing apparatus 1, the image data in the track 2 is captured by the image capturing apparatus 2, the image data in the track 3 is captured by the image capturing apparatus 3, and the preset arrangement rule is: the image data in the track 1 is located at the leftmost side, the image data in the track 2 is located in the middle, and the image data in the track 3 is located at the rightmost side, so that the picture taken by the image pickup apparatus 1, the picture taken by the image pickup apparatus 2, and the picture taken by the image pickup apparatus 3 are located at the leftmost side, in the obtained image of the picture to be captured.
In one embodiment, after the step (S101) of acquiring the data packet of the picture to be captured, the method may further include the following steps: determining the number of cache regions required to be allocated based on the track number information; and allocating a cache region for each track according to the data volume of the code stream of each track in the data packet.
The data packet may carry track number information, where the track number information is used to indicate the number of tracks to which each code stream carried in the data packet belongs. Based on the track number information, the number of buffers can be determined, which is consistent with the number of tracks. For example, if the track number information carried by the data packet is 4, it indicates that the data packet carries a code stream with 4 tracks, and it may be determined that the number of the buffer area is 4.
After the number of the cache regions is determined, the available storage space of each cache region may be allocated, and the available storage space of each cache region may be set by a user. That is, the available storage space of each buffer may be greater than or equal to the data amount of the image data in the track corresponding to the buffer, in which case, the image data in the track may be directly stored into the corresponding buffer. In this case, before storage, scaling processing may be performed on the image data in the track, so that the data amount of the image data is less than or equal to the available storage space of the corresponding buffer area.
In one implementation, in order to ensure that each cache region has enough available storage space to store the image data of the corresponding track, when performing cache region allocation, the available storage space allocated to each cache region may be greater than or equal to the data amount of the image data of the track corresponding to the cache region, that is, the available storage space of each cache region may be considered to be greater than or equal to the data amount of the code stream of the track corresponding to the cache region. In this way, even if the image data of the track is not scaled, it can be stored in the corresponding buffer.
In one embodiment, the data packet may carry a target amount of data for the image generated for the frame to be captured. The target data amount of the image can be set by self, that is, the size of the generated image is set, for example, if the target data amount is set to 5M, it means that the generated image of the screen to be captured is 5M.
In addition, the data packet may also carry width and height information of an image generated for the picture to be captured, where the width and height information includes a preset width and a preset height, that is, the width of the image generated for the picture to be captured is the preset width, and the height is the preset height. The preset width and the preset height may be set by a user, for example, if the preset width is 800 pixels and the preset height is 480 pixels, the preset width and the preset height indicate that the resolution width of an image generated by the to-be-captured image is 800 pixels and the resolution height is 480 pixels.
On the basis of the foregoing embodiment, the step of allocating a buffer area for each track may specifically include the following steps.
A total buffer area may be allocated first, and the total buffer area is used to store image data after decoding processing of the code stream of each track in the data packet. The available storage space of the total buffer area may be self-defined and allocated according to a target data size of an image generated for a picture to be captured, that is, the available storage space of the total buffer area should be at least not less than the target data size. In addition, the width of the total cache area is not less than the preset width, and the height is not less than the preset height. The preset width and the preset height are the width and the height of an image generated aiming at a picture to be captured, and can be set by a user.
After the total buffer area is allocated, the preset width of the total buffer area may be divided equally to obtain a plurality of sub-widths with the same length. Wherein the number of divided sub-widths is the same as the number of tracks. For example, when the number of image capturing apparatuses is 4, the number of tracks is also 4, and when the preset width of the total buffer area is 800 pixels, the preset width may be divided into 4 sub-widths on average, each sub-width being 200 pixels.
The area formed by each sub-width and the preset height is determined as a buffer area, that is, the total buffer area comprises a plurality of buffer areas with the same size. The width of each buffer area is the sub-width, and the height is the preset height. As shown in fig. 3(a), if the total buffer area has a predetermined width W, a predetermined height H and T1 tracks, the predetermined width W is divided into T1 equal parts on average, and each sub-width is W/T1. The area formed by each sub-width W/T1 and the predetermined height H is determined as a buffer, such as the first buffer … …, the T1 buffer in the figure.
The determined cache regions and the tracks may be in a one-to-one correspondence relationship, that is, each cache region corresponds to one track, and the image data of the track is stored in the cache region corresponding to the track.
After the buffer is determined, the step (S103) of storing the obtained image data of each track in the buffer corresponding to each track according to the correspondence between the track and the buffer may include the following steps.
Based on the obtained image data of each track, image data having an image width of a sub-width and an image height of a preset height can be obtained. When the width and height of the image data in the track are not consistent with the width and height of the corresponding buffer area, the image data in the track may be scaled first, so that the width and height of the image data after scaling is consistent with the width and height of the corresponding buffer area. In one implementation, the image data of each track may be compressed by using a VGS (Video Graphics Sub-System), where the VGS may perform processing such as scaling, format conversion, and decoding on the image.
After the image data of each track is scaled into image data of a sub-width and a preset height, the scaled image data of each track can be stored in the corresponding buffer area of each track according to the one-to-one correspondence relationship between the buffer areas and the tracks.
Taking fig. 3(a) as an example, there are T1 tracks, where the first track corresponds to the first buffer, the second track corresponds to the … … th track corresponding to the T1 th track corresponding to the T1 th buffer, the image data of the first track after scaling processing is stored in the first buffer, the image data of the second track after scaling processing is stored in the second buffer, and the image data of the T1 th track after scaling processing is stored in the T1 th buffer.
Based on the fact that the image data after the scaling processing is the same as the width and the height of the buffer area, after the image data is stored in the buffer area, the whole buffer area is filled with the image data, and then the image data in the buffer area can represent an image.
The image data of each track after the scaling processing is stored in the cache area corresponding to each track, the image data can be stored simultaneously for a plurality of cache areas, and the image data can be stored sequentially according to a user-defined sequence. For example, in fig. 3(a), the storage is performed in the order from small to large according to the identifier, that is, the storage is performed on the first buffer, then the storage is performed on the second buffer, and finally the storage is performed on the T1-th buffer, and when the storage on the T1-th buffer is completed, the storage on the entire total buffer is completed.
After the image data of each track is stored, the image data stored in each buffer area are combined, and an image of a picture to be captured can be obtained. The combination mode can be that an image is directly obtained from the image data stored in each buffer area, and the image is the image of the picture to be captured. For example, the image of the picture to be captured is a YUV image, and the three parts of the buffer area Y, U, V are stored respectively, so that a YUV image, that is, the image of the picture to be captured, can be directly obtained at this time. For another example, if the image of the picture to be captured is a bit image and the buffer area is continuous, the image of the picture to be captured can be directly obtained. In addition, the combined mode can also perform data conversion processing on the image data in each buffer area to obtain image data meeting requirements of image formats and the like, and an image obtained by the image data after the data conversion processing is an image of a picture to be captured.
In one implementation, the total buffer is divided into T1 buffers on average, the divided T1 buffers are shown in fig. 3(a), and after each buffer is determined, the initial address of each buffer is determined, as shown in fig. 3 (b). Two adjacent buffers are contiguous, that is, the first address of a buffer is consecutive to the last address of the last buffer adjacent to the buffer. For example, the first address of the second cache region is the last address of the first cache region.
And (c) sequentially storing the cache regions in fig. 3(b) according to the sequence from small to large identifiers, namely, storing the image data in the first cache region, then storing the image data in the second cache region, and finally storing the image data in the T1-th cache region, wherein when the image data is detected to be stored in the T1-th cache region, it indicates that the image data has been stored in all the current T1 cache regions, and at this time, combining the image data stored in each cache region to obtain the image of the picture to be captured.
In one embodiment, the image format setting may be performed for the image of the picture to be captured. And after the image data of each track is stored, encoding the stored image data to obtain an image in a preset format.
It is considered that the encoding process includes data processing on image data, and the stored image data may be scaled so that the width and height of the obtained image are the preset width and height.
The preset format may be set by a user, for example, the preset format may be a JPEG (Joint Photographic Experts Group) format, a PNG (Portable Network Graphics) format, or the like.
The preset format may be set by a user. In one implementation, the data packet may carry information in a predetermined format. After the data packet is acquired, preset format information may be acquired, and an encoder for the preset format may be created according to the preset format information, where the encoder is configured to convert an image input to the encoder into an image in the preset format. After the image data of each track is stored, inputting the image data stored in the buffer area into an encoder, generating an image with a preset format through the encoder, and storing and displaying the generated image with the preset format.
For example, if the preset format is JPEG format, the data packet carries JPEG format information, and the JPEG format information indicates that the format of the image to be generated is JPEG format. And the encoder established according to the JPEG format information is a JPEG encoder, and after the image data of each track is stored, the image data stored in the cache region is input into the JPEG encoder to generate an image in the JPEG format.
In an implementation manner, if the preset format is an RGB format, the image data stored in the buffer area may be subjected to image processing by using a TDE (Two Dimensional data processing tool), so as to obtain an image in the RGB format. Among them, the TDE device can provide a graphic drawing function in the aspects of OSD (On Screen Display) and GUI (Graphical User Interface).
According to the technical scheme provided by the embodiment of the application, the code streams of the preset frames of the camera equipment are transmitted in the same data packet through the preset transmission channel, and the image data corresponding to the code streams of the tracks are obtained in the preset transmission channel, so that the image of the picture to be captured is obtained. The process is completed in one transmission channel, and even if the number of the camera devices is increased, the transmission channel does not need to be increased, so that the transmission channel resource is saved. And moreover, image data are obtained in a transmission channel, and the image data are correspondingly stored in a cache region, so that the image of the picture to be captured can be obtained in a display channel, image splicing processing is not needed, and image splicing resources are saved.
Corresponding to the above image acquiring method embodiment, an embodiment of the present application further provides an image acquiring apparatus, as shown in fig. 4, the image acquiring apparatus includes:
a first obtaining module 410, configured to obtain, through a preset transmission channel, a data packet of a picture to be captured, where the data packet carries a code stream of preset frames of multiple tracks, each track corresponds to at least one image capturing device, and the preset frames are frames of the same frame or frames of the same time;
a second obtaining module 420, configured to obtain image data corresponding to the code stream of each track;
the storage module 430 is configured to store the acquired image data of each track to the cache area corresponding to each track according to the corresponding relationship between the track and the cache area, so as to obtain an image of the picture to be captured.
In one embodiment, the image capturing apparatus may further include:
the determining module is used for determining the number of the cache regions required to be allocated based on the track number information;
and the allocation module is used for allocating a corresponding buffer area for each track, wherein the buffer area is used for storing the image data of the track corresponding to the buffer area.
In one embodiment, the allocation module is specifically configured to:
allocating a total cache region with an available storage space not smaller than a target data volume, a width not smaller than the preset width and a height not smaller than the preset height, wherein the target data volume is the data volume of an image generated by a picture to be captured, and the preset width and the preset height are the width and the height of the image generated by the picture to be captured;
averagely dividing the preset width of the total cache area to obtain a plurality of sub-widths with the same length, wherein the number of the sub-widths is the same as that of the tracks;
determining an area formed by each sub-width and a preset height as a cache area, wherein the determined cache areas and the tracks are in one-to-one correspondence;
the storage module 430 is specifically configured to:
obtaining image data with the image width as the sub-width and the image height as the preset height based on the obtained image data of each track;
respectively storing the obtained image data of each track to the cache region corresponding to each track according to the one-to-one correspondence relationship between the cache regions and the tracks;
and after the image data of each track is stored, combining the image data stored in each cache region to obtain the image of the picture to be captured.
In one embodiment, the image capturing apparatus may further include:
and the coding module is used for coding the stored image data after the image data of each track is stored, so as to obtain the image with the preset format.
According to the technical scheme provided by the embodiment of the application, the code streams of the preset frames of the camera equipment are transmitted in the same data packet through the preset transmission channel, and the image data corresponding to the code streams of the tracks are obtained in the preset transmission channel, so that the image of the picture to be captured is obtained. The process is completed in one transmission channel, and even if the number of the camera devices is increased, the transmission channel does not need to be increased, so that the transmission channel resource is saved. And moreover, image data are obtained in a transmission channel, and the image data are correspondingly stored in a cache region, so that the image of the picture to be captured can be obtained in a display channel, image splicing processing is not needed, and image splicing resources are saved.
Corresponding to the above image obtaining method embodiment, an embodiment of the present application further provides an electronic device, as shown in fig. 5, including a processor 510, a communication interface 520, a memory 530 and a communication bus 540, where the processor 510, the communication interface 520, and the memory 530 complete mutual communication through the communication bus 540;
a memory 530 for storing a computer program;
the processor 510, when executing the program stored in the memory 530, implements the following steps:
acquiring a data packet of a picture to be captured through a preset transmission channel, wherein the data packet carries a code stream of preset frames of a plurality of tracks, each track corresponds to at least one camera device, and the preset frames are the same frames or frames at the same moment;
acquiring image data corresponding to the code stream of each track;
and storing the acquired image data of each track to the cache region corresponding to each track according to the corresponding relation between the tracks and the cache region to obtain the image of the picture to be captured.
According to the technical scheme provided by the embodiment of the application, the code streams of the preset frames of the camera equipment are transmitted in the same data packet through the preset transmission channel, and the image data corresponding to the code streams of the tracks are obtained in the preset transmission channel, so that the image of the picture to be captured is obtained. The process is completed in one transmission channel, and even if the number of the camera devices is increased, the transmission channel does not need to be increased, so that the transmission channel resource is saved. And moreover, image data are obtained in a transmission channel, and the image data are correspondingly stored in a cache region, so that the image of the picture to be captured can be obtained in a display channel, image splicing processing is not needed, and image splicing resources are saved.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
Corresponding to the above-mentioned image acquisition method embodiments, a machine-readable storage medium having stored therein a computer program for implementing any of the above-mentioned image acquisition method steps when executed by a processor.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the embodiments of the image capturing apparatus, the electronic device and the machine-readable storage medium, since they are substantially similar to the embodiments of the image capturing method, the description is simple, and the relevant points can be referred to the partial description of the embodiments of the method.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (6)

1. An image acquisition method, characterized in that the method comprises:
acquiring a multi-track protocol-based data packet of a picture to be captured through a preset transmission channel, wherein the data packet carries code streams of preset frames of a plurality of tracks, each track corresponds to at least one camera device, the preset frames are frames of the same frame or the same time, the data packet further comprises MFI information, and the MFI information comprises the number of the tracks, information of each code stream in the data packet, and marks of the start and the end of each code stream of each track;
determining the number of cache regions required to be allocated based on the track number information;
allocating a total cache region with an available storage space not smaller than a target data volume, a width not smaller than a preset width and a height not smaller than a preset height, wherein the target data volume is the data volume of an image generated by the picture to be captured, and the preset width and the preset height are respectively the width and the height of the image generated by the picture to be captured;
averagely dividing the preset width of the total cache area to obtain a plurality of sub-widths with the same length, wherein the number of the sub-widths is the same as that of the tracks;
determining an area formed by each sub-width and the preset height as a cache area, wherein the determined cache areas and the tracks are in one-to-one correspondence, and the cache areas are used for storing image data in the tracks corresponding to the cache areas;
acquiring image data corresponding to the code stream of each track;
obtaining image data with the image width as the sub-width and the image height as the preset height based on the obtained image data of each track;
respectively storing the obtained image data of each track to the cache region corresponding to each track according to the one-to-one correspondence relationship between the cache regions and the tracks;
and after the image data of each track is stored, combining the image data stored in each cache region to obtain the image of the picture to be captured.
2. The method of claim 1, further comprising:
and after the image data of each track is stored, encoding the stored image data to obtain an image in a preset format.
3. An image acquisition apparatus, characterized in that the apparatus comprises:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a multi-track-stream-protocol-based data packet of a picture to be captured through a preset transmission channel, the data packet carries code streams of preset frames of a plurality of tracks, each track corresponds to at least one camera device, the preset frames are frames of the same frame or the same time, the data packet further comprises MFI information, and the MFI information comprises the number of the tracks, information of each code stream in the data packet and marks of the start and the end of each code stream of each track;
the determining module is used for determining the number of the cache regions required to be allocated based on the track number information;
the distribution module is used for distributing a total cache region with available storage space not smaller than a target data volume, width not smaller than a preset width and height not smaller than a preset height, wherein the target data volume is the data volume of an image generated by the picture to be captured, and the preset width and the preset height are respectively the width and the height of the image generated by the picture to be captured; averagely dividing the preset width of the total cache area to obtain a plurality of sub-widths with the same length, wherein the number of the sub-widths is the same as that of the tracks; determining an area formed by each sub-width and the preset height as a cache area, wherein the determined cache areas and the tracks are in one-to-one correspondence, and the cache areas are used for storing image data of the tracks corresponding to the cache areas;
the second acquisition module is used for acquiring image data corresponding to the code stream of each track;
the storage module is used for obtaining image data with the image width as the sub-width and the image height as the preset height based on the obtained image data of each track; respectively storing the obtained image data of each track to the cache region corresponding to each track according to the one-to-one correspondence relationship between the cache regions and the tracks; and after the image data of each track is stored, combining the image data stored in each cache region to obtain the image of the picture to be captured.
4. The apparatus of claim 3, further comprising:
and the coding module is used for coding the stored image data after the image data of each track is stored, so as to obtain an image with a preset format.
5. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-2 when executing a program stored in the memory.
6. A machine readable storage medium, characterized in that a computer program is stored in the machine readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-2.
CN201910283294.6A 2019-04-10 2019-04-10 Image acquisition method and device Active CN111818295B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910283294.6A CN111818295B (en) 2019-04-10 2019-04-10 Image acquisition method and device
PCT/CN2020/083707 WO2020207403A1 (en) 2019-04-10 2020-04-08 Image acquisition method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910283294.6A CN111818295B (en) 2019-04-10 2019-04-10 Image acquisition method and device

Publications (2)

Publication Number Publication Date
CN111818295A CN111818295A (en) 2020-10-23
CN111818295B true CN111818295B (en) 2022-02-01

Family

ID=72752131

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910283294.6A Active CN111818295B (en) 2019-04-10 2019-04-10 Image acquisition method and device

Country Status (2)

Country Link
CN (1) CN111818295B (en)
WO (1) WO2020207403A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112565627B (en) * 2020-11-30 2023-02-03 天津津航计算技术研究所 Multi-channel video centralized display design method based on bitmap superposition
CN113068024B (en) * 2021-03-19 2024-04-16 瑞芯微电子股份有限公司 Real-time capture analysis method and storage medium
CN114928730B (en) * 2022-06-23 2023-08-22 湖南国科微电子股份有限公司 Image processing method and image processing apparatus
CN117499601B (en) * 2024-01-02 2024-04-05 上海励驰半导体有限公司 Method for calling multi-camera data for SoC

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4384607B2 (en) * 2005-01-25 2009-12-16 株式会社日立国際電気 Image processing device
US20070022215A1 (en) * 2005-07-19 2007-01-25 Singer David W Method and apparatus for media data transmission
US20070056001A1 (en) * 2005-08-24 2007-03-08 Hules Frank J Dual channel video and audio data for DBS receivers
TWI323128B (en) * 2006-10-03 2010-04-01 Quanta Comp Inc Image processing apparatus and method
WO2008048066A1 (en) * 2006-10-19 2008-04-24 Lg Electronics Inc. Encoding method and apparatus and decoding method and apparatus
CN102497527B (en) * 2011-12-16 2013-11-27 杭州海康威视数字技术股份有限公司 Multi-processor video processing system and video image synchronous transmission and display method thereof
CN104050092B (en) * 2013-03-15 2018-05-01 上海芯豪微电子有限公司 A kind of data buffering system and method
CN103260011A (en) * 2013-05-16 2013-08-21 杭州巨峰科技有限公司 System and method for achieving monitoring of more paths by utilization of net-harddisk video recorder
US10708328B2 (en) * 2014-03-17 2020-07-07 Intel Corporation Hardware assisted media playback and capture synchronization
KR101560727B1 (en) * 2014-04-07 2015-10-15 네이버 주식회사 Service method and system for providing multi-track video contents
CN105306837A (en) * 2015-10-27 2016-02-03 浙江宇视科技有限公司 Multi-image splicing method and device
CN109429037B (en) * 2017-09-01 2021-06-29 杭州海康威视数字技术股份有限公司 Image processing method, device, equipment and system
CN109120867A (en) * 2018-09-27 2019-01-01 乐蜜有限公司 Image synthesizing method and device

Also Published As

Publication number Publication date
WO2020207403A1 (en) 2020-10-15
CN111818295A (en) 2020-10-23

Similar Documents

Publication Publication Date Title
CN111818295B (en) Image acquisition method and device
CN110868600B (en) Target tracking video plug-flow method, display method, device and storage medium
CN107040794A (en) Video broadcasting method, server, virtual reality device and panoramic virtual reality play system
US20140146877A1 (en) Method for dynamically adapting video image parameters for facilitating subsequent applications
CN107155093B (en) Video preview method, device and equipment
CN104243920A (en) Image stitching method and device based on basic stream video data packaging
CN107690074A (en) Video coding and restoring method, audio/video player system and relevant device
CN104918123A (en) Method and system for playback of motion video
CN112565224B (en) Video processing method and device
CN112511896A (en) Video rendering method and device
US20070086519A1 (en) Apparatus for managing multipurpose video streaming and method of the same
CN108174084A (en) panoramic video processing method and terminal device
CN107580228B (en) Monitoring video processing method, device and equipment
WO2011134373A1 (en) Method, device and system for synchronous transmmision of multi-channel videos
CN114615458B (en) Method and device for real-time screen closing and rapid drawing in cloud conference, storage medium and server
KR100746463B1 (en) Apparatus and method for video transmission in video conferencing system
CN115941958A (en) Video coding method and device, electronic equipment and storage medium
CN112911299B (en) Video code rate control method and device, electronic equipment and storage medium
CN111314629B (en) OSD information superposition method and device
CN107483876A (en) Video data handling procedure, storage device, straight recorded broadcast interactive terminal
CN109862385B (en) Live broadcast method and device, computer readable storage medium and terminal equipment
CN114830674A (en) Transmitting apparatus and receiving apparatus
JPH01162480A (en) Method for encoding
CN111225238A (en) Information processing method and related equipment
CN113473045A (en) Subtitle adding method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant