Image storage method and device, computer equipment and storage medium

文档序号:107616 发布日期:2021-10-15 浏览:41次 中文

阅读说明:本技术 图像存储方法、装置、计算机设备和存储介质 (Image storage method and device, computer equipment and storage medium ) 是由 杨卫民 陈杰 眭建仔 孙廷辉 沈小勇 吕江波 贾佳亚 于 2021-09-09 设计创作,主要内容包括:本申请涉及一种图像存储方法、装置、计算机设备和存储介质。所述方法包括:获取智慧安防监控终端上传的视频流;提取所述视频流中的目标视频帧;所述目标视频帧为所述视频流中的每单位时长的视频中的图像质量最高的视频帧;对所述目标视频帧进行压缩处理,得到所述目标视频帧的压缩图像;所述压缩图像的画质增强图像的图像画质与所述目标视频帧相同;将所述压缩图像进行存储。采用本方法,能够降低与智慧安防监控终端关联的智慧安防系统的存储成本。(The application relates to an image storage method, an image storage device, a computer device and a storage medium. The method comprises the following steps: acquiring a video stream uploaded by the intelligent security monitoring terminal; extracting a target video frame in the video stream; the target video frame is a video frame with the highest image quality in the video of each unit time length in the video stream; compressing the target video frame to obtain a compressed image of the target video frame; the image quality of the image with enhanced quality of the compressed image is the same as that of the target video frame; and storing the compressed image. By adopting the method, the storage cost of the intelligent security system associated with the intelligent security monitoring terminal can be reduced.)

1. An image storage method, characterized in that the method comprises:

acquiring a video stream uploaded by the intelligent security monitoring terminal;

extracting a target video frame in the video stream; the target video frame is a video frame with the highest image quality in the video of each unit time length in the video stream;

compressing the target video frame to obtain a compressed image of the target video frame; the image quality of the image with enhanced quality of the compressed image is the same as that of the target video frame;

and storing the compressed image.

2. The method of claim 1, wherein the extracting the target video frame from the video stream comprises:

decoding each unit frame in the video stream to obtain a decoded video frame of the video stream;

and respectively taking the decoded video frame with the highest image quality in the video of each unit time length in the video stream as the target video frame.

3. The method according to claim 2, wherein the respectively using, as the target video frame, a decoded video frame with highest image quality in a video per unit time length in the video stream comprises:

acquiring image quality influence factors of a decoded video frame in a video per unit time length; the image quality influencing factor comprises at least one of definition, contrast, saturation and noise;

calculating the image quality scores of the decoded video frames according to the image quality influence factors and the preset weights of the image quality influence factors;

and respectively taking the decoded video frame with the highest image quality score in the video of each unit time length in the video stream as a target video frame.

4. The method according to claim 2, further comprising, after respectively taking decoded video frames with highest image quality in videos per unit time length in the video stream as the target video frames:

carrying out image identification processing on the target video frame to obtain a target local image in the target video frame;

and performing feature extraction processing on the local target video frame to obtain the image features of the target local image, and storing the image features.

5. The method according to claim 1, wherein said compressing the target video frame to obtain a compressed image of the target video frame comprises:

compressing the target video frame to obtain an initial compressed image of the target video frame; the code rate of the initial compressed image is a preset proportion range of the code rate of the target video frame;

and performing preset format conversion processing on the initial compressed image to obtain a compressed image of the target video frame.

6. The method of claim 4, further comprising, after storing the compressed image:

acquiring a retrieval image input by a user terminal and an image request corresponding to the retrieval image;

if the image request is a compressed image request corresponding to the retrieval image, acquiring a compressed image corresponding to the retrieval image from the stored compressed image, and returning the compressed image to the user terminal;

if the image request is a target video frame request corresponding to the retrieval image, acquiring a compressed image corresponding to the retrieval image from the stored compressed images, and returning an image quality enhancement image of the compressed image to the user terminal; the image quality of the enhanced quality image of the compressed image is the same as the target video frame of the compressed image.

7. The method according to claim 6, wherein the obtaining of the compressed image corresponding to the retrieval image from the stored compressed images comprises:

extracting image features of the retrieval image;

searching a target image characteristic matched with the image characteristic of the retrieval image from the stored image characteristics;

and acquiring a compressed image matched with the target image characteristic from the stored compressed images as a compressed image corresponding to the retrieval image.

8. An image storage apparatus, characterized in that the apparatus comprises:

the acquisition module is used for acquiring a video stream uploaded by the intelligent security monitoring terminal;

the extraction module is used for extracting a target video frame in the video stream; the target video frame is a video frame with the highest image quality in the video of each unit time length in the video stream;

the compression module is used for compressing the target video frame to obtain a compressed image of the target video frame; the image quality of the image with enhanced quality of the compressed image is the same as that of the target video frame;

and the storage module is used for storing the compressed image.

9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.

10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.

Technical Field

The application relates to the technical field of intelligent security and protection, in particular to an image storage method and device, computer equipment and a storage medium.

Background

In recent years, artificial intelligence technology has penetrated all walks of life, and especially under the construction of smart cities, people have more prominent demand for smart security systems, and user demands for smart security systems are gradually changed from "clear to understand". For user requirements of understanding, the existing intelligent security system usually adopts a video structuring technology, but the intelligent security system mainly based on the video structuring technology can generate a large amount of images.

High-definition videos in the existing intelligent security system are already in standard allocation, and high-definition images generated by video structuring occupy huge storage space, so that the traditional intelligent security system needs high storage space when storing the images, but the high-definition images are rarely used in an actual scene, so that huge storage space is wasted, and the storage cost required by the intelligent security system is high.

Disclosure of Invention

In view of the above, it is necessary to provide an image storage method, an apparatus, a computer device, and a storage medium capable of saving the storage cost required by the smart security system in view of the above technical problems.

An image storage method, the method comprising:

acquiring a video stream uploaded by the intelligent security monitoring terminal;

extracting a target video frame in the video stream; the target video frame is a video frame with the highest image quality in the video of each unit time length in the video stream;

compressing the target video frame to obtain a compressed image of the target video frame; the image quality of the image with enhanced quality of the compressed image is the same as that of the target video frame;

and storing the compressed image.

In one embodiment, extracting a target video frame in the video stream includes:

decoding each unit frame in the video stream to obtain a decoded video frame of the video stream;

and respectively taking the decoded video frame with the highest image quality in the video of each unit time length in the video stream as the target video frame.

In one embodiment, the respectively taking, as the target video frames, decoded video frames with highest image quality in videos of each unit time length in the video stream includes:

acquiring image quality influence factors of a decoded video frame in a video per unit time length; the image quality influencing factor comprises at least one of definition, contrast, saturation and noise;

calculating the image quality scores of the decoded video frames according to the image quality influence factors and the preset weights of the image quality influence factors;

and respectively taking the decoded video frame with the highest image quality score in the video of each unit time length in the video stream as a target video frame.

In one embodiment, after the decoding video frames with the highest image quality in the video of each unit time length in the video stream are respectively used as the target video frames, the method further includes:

carrying out image identification processing on the target video frame to obtain a target local image in the target video frame;

and performing feature extraction processing on the local target video frame to obtain the image features of the target local image, and storing the image features.

In one embodiment, compressing the target video frame to obtain a compressed image of the target video frame includes:

compressing the target video frame to obtain an initial compressed image of the target video frame; the code rate of the initial compressed image is a preset proportion range of the code rate of the target video frame;

and performing preset format conversion processing on the initial compressed image to obtain a compressed image of the target video frame.

In one embodiment, the method further comprises:

acquiring a retrieval image input by a user terminal and an image request corresponding to the retrieval image;

if the image request is a compressed image request corresponding to the retrieval image, acquiring a compressed image corresponding to the retrieval image from the stored compressed image, and returning the compressed image to the user terminal;

if the image request is a target video frame request corresponding to the retrieval image, acquiring a compressed image corresponding to the retrieval image from the stored compressed images, and returning an image quality enhancement image of the compressed image to the user terminal; the image quality of the enhanced quality image of the compressed image is the same as the target video frame of the compressed image.

In one embodiment, obtaining a compressed image corresponding to the retrieved image from the stored compressed images comprises:

extracting image features of the retrieval image;

searching a target image characteristic matched with the image characteristic of the retrieval image from the stored image characteristics;

and acquiring a compressed image matched with the target image characteristic from the stored compressed images as a compressed image corresponding to the retrieval image.

An image storage device, the device comprising:

the acquisition module is used for acquiring a video stream uploaded by the intelligent security monitoring terminal;

the extraction module is used for extracting a target video frame in the video stream; the target video frame is a video frame with the highest image quality in the video of each unit time length in the video stream;

the compression module is used for compressing the target video frame to obtain a compressed image of the target video frame; the image quality of the image with enhanced quality of the compressed image is the same as that of the target video frame;

and the storage module is used for storing the compressed image.

A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:

acquiring a video stream uploaded by the intelligent security monitoring terminal;

extracting a target video frame in the video stream; the target video frame is a video frame with the highest image quality in the video of each unit time length in the video stream;

compressing the target video frame to obtain a compressed image of the target video frame; the image quality of the image with enhanced quality of the compressed image is the same as that of the target video frame;

and storing the compressed image.

A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:

acquiring a video stream uploaded by the intelligent security monitoring terminal;

extracting a target video frame in the video stream; the target video frame is a video frame with the highest image quality in the video of each unit time length in the video stream;

compressing the target video frame to obtain a compressed image of the target video frame; the image quality of the image with enhanced quality of the compressed image is the same as that of the target video frame;

and storing the compressed image.

According to the image storage method, the device, the computer equipment and the storage medium, the video stream uploaded by the intelligent security monitoring terminal is obtained, then the video frame with the highest image quality is extracted from the video of each unit time length in the video stream to serve as the target video frame, the target video frame is further compressed, so that the compressed image of the target video frame is obtained, and finally the compressed image is stored. By adopting the method, only the compressed image corresponding to the target video frame in the video of each unit time length in the video stream is stored without storing the whole video stream, so that the storage space of the image is greatly reduced while the image with the original image quality uploaded by the intelligent security monitoring terminal can be checked, and the storage cost of the intelligent security system associated with the intelligent security monitoring terminal is reduced.

Drawings

FIG. 1 is a diagram of an exemplary environment in which an image storage method may be implemented;

FIG. 2 is a flow diagram illustrating an image storage method according to one embodiment;

FIG. 3 is a flow diagram illustrating the steps of extracting a target video frame in a video stream in one embodiment;

FIG. 4 is a flowchart illustrating the steps of obtaining a target video frame in one embodiment;

FIG. 5 is a flowchart illustrating steps of performing an image recognition process and a feature extraction process in one embodiment;

FIG. 6 is a flowchart illustrating the steps for obtaining a compressed image of a target video frame in one embodiment;

FIG. 7 is a flowchart illustrating the steps of retrieving a retrieval image input by a user terminal in one embodiment;

FIG. 8 is a flowchart illustrating the steps of retrieving a compressed image corresponding to a retrieved image from a stored compressed image in one embodiment;

FIG. 9 is a flowchart illustrating an image storing method according to another embodiment;

FIG. 10 is a flowchart illustrating an image storing method according to still another embodiment;

FIG. 11 is a block diagram showing the configuration of an image storage apparatus according to an embodiment;

FIG. 12 is a diagram illustrating an internal structure of a computer device according to an embodiment.

Detailed Description

In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.

The image storage method provided by the application can be applied to the application environment shown in fig. 1. The intelligent security monitoring terminal 102 communicates with the server 104 through a network, the server is further connected with a user terminal 106, and the user terminal 106 is used for sending an image to be retrieved to the server 104 and also receiving a compressed image and an image quality enhancement image returned by the server 104. Specifically, referring to fig. 1, in a smart security monitoring scene, the smart security monitoring terminal uploads a collected video stream to the server 104, the server 104 obtains the video stream uploaded by the smart security monitoring terminal, then extracts a video frame with the highest image quality from a video of each unit duration in the video stream as a target video frame, and the server 104 obtains a compressed image of the target video frame by compressing the target video frame, and then stores the compressed image. The smart security monitoring terminal 102 is a security monitoring device having an intelligent recognition mobile detection technology, the smart security monitoring terminal includes but is not limited to a monitoring camera and a video monitoring platform, the server 104 may be implemented by an independent server or a server cluster composed of a plurality of servers, and the user terminal 106 may be but is not limited to various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices.

In one embodiment, as shown in fig. 2, an image storage method is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps:

step S201, acquiring a video stream uploaded by the intelligent security monitoring terminal.

The video stream refers to the transmission of video data in a streaming format.

Specifically, the intelligent security monitoring terminal encodes video data according to an encoding standard, uploads the encoded video data to the server in a video stream format according to a security video information transmission standard, and the server receives the encoded video data uploaded by the intelligent security monitoring terminal. The security and protection video information transmission standard (Technical requirements for information transmission, switching and control in video surveillance network system for public security, safety and protection video monitoring networking system information transmission, switching and control) is GB/T28181. Coding standards for video data include h.264, h.265.

For example, a monitoring camera installed in an elevator security monitoring scene shoots an in-elevator picture, the monitoring camera encodes shot video data according to an H.264 coding standard, the encoded video data is uploaded to a server in a video stream mode according to a security video information transmission standard of GB/T28181, and the server receives the encoded video data transmitted by the monitoring camera.

Step S202, extracting a target video frame in a video stream; the target video frame is a video frame with the highest image quality in the video per unit time length in the video stream.

The unit time length may be 1 second, 2 seconds, etc., and may be adjusted according to actual conditions, which is not specifically limited herein. The number of video frames included in the video per unit time length is at least 2 frames, such as 15 frames, 30 frames, etc., and may be adjusted according to the actual situation, which is not specifically limited herein. A video frame refers to a single image of the smallest unit in a video.

The image quality of the video frame is determined by the various image quality influencing factors of the video frame.

Specifically, the server respectively obtains the image quality of the video frames included in the video of each unit time length in the video stream, and then extracts the video frame with the highest image quality from the video of each unit time length in the video stream as the target video frame. Thus, after acquiring the target video frame, the server executes the subsequent image compression step with the target video frame as a processing object.

For example, each second of video contains 30 frames of video frames, the server obtains the image quality of the 30 frames of video frames respectively, and then selects the video frame with the highest image quality from the 30 frames as the target video frame.

Step S203, compressing the target video frame to obtain a compressed image of the target video frame; the image quality of the enhanced quality image of the compressed image is the same as the target video frame.

The compression processing means that the code rate of the target video frame is reduced through an image compression algorithm. Image compression algorithms include, but are not limited to, downsampling. The image quality enhancement image is an image obtained by performing image quality enhancement processing on a compressed image by using a plurality of image hyper-segmentation algorithms based on depth learning. The image hyper-resolution algorithm based on the deep learning includes but is not limited to an image region enhancement algorithm, a color gamut enhancement algorithm, a color enhancement algorithm and a super-resolution algorithm.

Specifically, the server performs compression processing on the target video frame through an image compression algorithm, and takes the compressed image as a compressed image of the target video frame until the image quality of the image quality enhancement image of the compressed image obtained after the compression processing is the same as that of the target video frame. The compression processing is lossless compression processing, the server carries out image quality enhancement on the compressed image of the target video frame through an image hyper-segmentation algorithm based on deep learning to obtain an image quality enhanced image, and the image quality of the image quality enhanced image is the same as that of the target video frame.

Step S204, storing the compressed image.

Specifically, the server stores the compressed image to a preset image storage location, so that the compressed image can be conveniently viewed by a user. The predetermined image storage location includes, but is not limited to, various file systems and databases storing image storage paths. Thus, after storing the compressed image, the server performs subsequent image storing and image retrieving steps using the stored compressed image as a basis for storage and retrieval.

According to the image storage method, the video stream uploaded by the intelligent security monitoring terminal is obtained, then the video frame with the highest image quality is extracted from the video of each unit time length in the video stream to serve as the target video frame, the target video frame is compressed, and therefore the compressed image of the target video frame is obtained, and finally the compressed image is stored and is convenient for a user to check. By adopting the method, only the compressed image corresponding to the target video frame in the video of each unit time length in the video stream is stored without storing the whole video stream, so that the storage space of the image is greatly reduced while the image of the original image quality uploaded by the intelligent security monitoring terminal can be checked, the storage cost of the intelligent security system associated with the intelligent security monitoring terminal is reduced, and the storage cost required for building intelligent city projects is saved.

In an embodiment, as shown in fig. 3, the step S202 of extracting a target video frame in a video stream specifically includes the following steps:

step S301, decode each unit frame in the video stream to obtain a decoded video frame of the video stream.

The decoded video frame refers to a video frame obtained by decoding encoded video data by a video decoding technique. Video decoding techniques include decoding programs or decoding devices.

Specifically, the server performs decoding processing on video per unit frame in the encoded video stream by using a decoding program or a decoding device, and then the server obtains a decoded video frame of the video stream. Decoding programs or devices include, but are not limited to, decoding software based on h.264 or h.265.

For example, the server acquires a coded video stream from a monitoring camera installed in an elevator security monitoring scene, then decodes each frame of the coded video stream through decoding software based on H.265, and then the server obtains the decoded video frame of the video stream.

Step S302, the decoded video frame with the highest image quality in the video of each unit time length in the video stream is respectively used as the target video frame.

The target video frame is a video frame used for compression processing. The video per unit time length includes a plurality of video frames.

Specifically, the video stream includes videos of a plurality of unit time lengths, the image quality in the decoded video frame in the video of each unit time length is calculated respectively, the size of the image quality in the video of each unit time length is judged, and the decoded video frame with the highest image quality in the video of each unit time length is selected as the target video frame in the video of the unit time length. Thus, after obtaining the target video frame, the server performs the subsequent image compression step with the target video frame as the processing basis.

For example, in an actual smart security scene, if a video stream has 50 seconds of video and each second of video has 30 frames of video frames, in order to save the construction cost of the smart security system, the server selects one target video frame for the 50 seconds of video, first calculates the image quality of each video frame for each of the 30 frames of the 1 second of video, then selects one video frame with the highest image quality from the 30 frames of video as the target video frame, obtains corresponding target video frames in the same manner for the videos of other seconds, finally obtains 50 frames of target video frames, and stores the 50 frames of target video frames.

In this embodiment, the server performs decoding processing on the video per unit frame in the encoded video stream through a decompression program or device, so as to obtain decoded video frames of the video stream, and then respectively uses the decoded video frames with the highest image quality in the video per unit time length in the video stream as target video frames. By adopting the method, only the video frame with the highest image quality is stored, and all video frames in the video with the time per unit do not need to be stored, so that the storage space of the image is greatly reduced, the total storage space of the intelligent security system is further reduced, the storage cost required for building the intelligent city project is further saved, and the storage cost required for building the intelligent city project is further saved.

In an embodiment, as shown in fig. 4, the step S302, taking a decoded video frame with the highest image quality in a video of each unit duration in a video stream as a target video frame, specifically includes the following steps:

step S401, acquiring image quality influence factors of a decoded video frame in a video of each unit time length; the image quality influencing factor includes at least one of sharpness, contrast, saturation, and noise.

Step S402, calculating the image quality scores of the decoded video frames according to the image quality influence factors and the preset weights of the image quality influence factors.

Step S403, respectively taking the decoded video frame with the highest image quality score in the video of each unit time length in the video stream as the target video frame.

The image quality influencing factor refers to an index for judging the image quality of the decoded video frame. The preset weight refers to a weight which is preset in an image quality score weighted summation algorithm of the server for each image quality influence factor according to the importance degree of each image quality influence factor in image quality judgment, and is used for calculating the image quality score of the decoded video frame.

Specifically, the server obtains numerical values of all image quality influence factors of all decoded video frames in a video of each unit time length, then obtains preset weights of all the image quality influence factors, further performs weighted summation calculation on all the image quality influence factors of all the decoded video frames and the preset weights of all the image quality influence factors through an image quality score weighted summation algorithm to obtain image quality scores of all the decoded video frames, and selects the decoded video frame with the highest image quality score as a target video frame. Thus, after obtaining the target video frame, the server executes the subsequent image compression step with the target video frame as the processing object.

For example, the server obtains image quality influencing factors of a certain decoded video frame in a video per unit time length, the image quality influencing factors comprise definition a, contrast B, saturation C and noise D, the preset weights of the image quality influencing factors comprise definition weight a, contrast weight B, saturation weight C and noise weight D, and then calculates an image quality score Q of the decoded video frame according to an image quality score weighting algorithm, wherein the calculation formula of the image quality score Q is as follows:

then the server calculates the image quality scores Q of the other decoded video frames in the video of each unit time length according to the formula, further obtains the image quality scores of all the decoded video frames in the video of each unit time length, and accordingly selects the decoded video frame with the highest image quality score as the target video frame.

In this embodiment, the server obtains the numerical values of the image quality influencing factors of all decoded video frames in the video per unit time length, then calculates the image quality scores of all decoded video frames through an image quality score weighting algorithm according to the image quality influencing factors and the preset weights of the image quality influencing factors, and finally selects the decoded video frame with the highest image quality score as the target video frame. By adopting the method, only the video frame with the highest image quality is stored, and all video frames in the video with the time per unit do not need to be stored, so that the storage space of the image is greatly reduced, the total storage space of the intelligent security system is further reduced, and the storage cost required for building an intelligent city project is saved.

In an embodiment, as shown in fig. 5, in step S403, after the decoded video frame with the highest image quality score in the video of each unit duration in the video stream is respectively used as the target video frame, the method further includes the steps of performing image recognition processing and feature extraction processing, and specifically includes the following steps:

step S501, image recognition processing is carried out on the target video frame, and a target local image in the target video frame is obtained.

The image recognition processing refers to processing the image by an image recognition technology, and is used for recognizing the target and the object of the image. Image recognition techniques include, but are not limited to, deep learning based object detection algorithms and/or object recognition algorithms. The target local image refers to a local image in the target video frame.

Specifically, after obtaining the target video frame, the server identifies the target and the object in the target video frame through an image recognition technology, where the target and the object may be a human figure, a car, an animal, or the like in the target video frame, and may also be adjusted according to an actual image recognition processing task, and is not limited specifically herein. And the server takes the identified target and the identified object as a target local image in the target video frame, and then stores the target local image to a preset image storage position. Thus, after obtaining the target partial image, the server performs the subsequent feature extraction step using the obtained target partial image as a processing basis.

For example, the server wants to acquire the portrait and the car in the target video frame, so the server performs image recognition processing on the target video frame through a target detection and target recognition algorithm based on deep learning, identifies all the portraits and the cars in the target video frame based on the target detection and target recognition algorithm based on the deep learning, and further the server obtains the portrait and the cars in the target video frame as a target local image, and stores the target local image in a file system.

Step S502, the local target video frame is subjected to feature extraction processing to obtain the image features of the target local image, and the image features are stored.

The feature extraction processing is to extract information that is characteristic in an image by using a feature extraction technique. The feature extraction techniques include color-based feature extraction algorithms, texture-based feature extraction algorithms, and deep neural network-based feature extraction algorithms. The image features include color features, texture features, shape features, and spatial relationship features of the image.

Specifically, after the server obtains the target local image, the server processes the target local image through a feature extraction technology to obtain an image feature of the target local image, and the server stores the image feature to a preset image feature storage position. The preset image feature storage location includes, but is not limited to, a vector database. Thus, after storing the image features, the server executes the subsequent image retrieval step using the stored image features as a retrieval basis.

For example, after the server obtains the target local image, the server needs to obtain color features of the target local image, and then the server extracts the color features of the target local image through a feature extraction algorithm based on a deep neural network, so that the server obtains the color features of the target local image, and finally the server stores the color features in a vector database.

In this embodiment, the server processes the target video frame through an image recognition technology to obtain a target local image in the target video frame, and then processes the local target video frame through a feature extraction technology to obtain an image feature of the target local image, and stores the image feature. By adopting the method, only the image characteristics of the retrieval image and the stored image characteristics are matched, the compressed image corresponding to the retrieval image can be inquired through the target image characteristics obtained by matching, the retrieval image does not need to be matched with all the stored compressed images, and the time cost of image retrieval is further reduced.

In an embodiment, as shown in fig. 6, in the step S203, the compressing the target video frame to obtain a compressed image of the target video frame specifically includes the following steps:

step S601, compressing the target video frame to obtain an initial compressed image of the target video frame; the code rate of the initial compressed image is within a preset proportion range of the code rate of the target video frame.

Step S602, performing preset format conversion processing on the initial compressed image to obtain a compressed image of the target video frame.

Here, the compression processing refers to reducing the size of an image by a picture compression algorithm. The preset ratio range of the code rate includes an interval (20%, 70%) and a ratio of 50%. The preset format conversion processing refers to converting the format of an image into an image of a preset format. The preset format includes JPEG format and PNG format of an image.

Specifically, after the server obtains the target video frame, the server compresses the code rate of the target video frame to a preset ratio range of the code rate of the target video frame through a picture compression algorithm, so as to obtain an image with the code rate being a preset proportion of the target video frame, and the server takes the image as an initial compressed image of the target video frame. The picture Compression Algorithm is a lossless picture Compression Algorithm, and comprises a Huffman Compression Algorithm and an LZ77 Algorithm (A Universal Algorithm for Sequential Data Compression). After the server obtains the initial compressed image, whether the format of the initial compressed image is the same as the preset format or not is judged, if the format of the initial compressed image is different from the preset format, the format of the initial compressed image is firstly converted into the image with the preset format, and then the server obtains the compressed image with the converted preset format. Therefore, after the server obtains the compressed image of the target video frame, the server executes the subsequent image storage step by taking the compressed image as the processing basis.

For example, the image compression task is to compress the code rate of the target video frame by 50%, and the server compresses the code rate of the target video frame by 50% through a picture compression algorithm, so as to obtain an image with the code rate of 50% of the target video frame, and thus the image is used as an initial compressed image of the target video frame. And then the server checks whether the format of the initial compressed image is the same as the preset JPEG image format, and if the image format of the initial compressed image is not the JPEG format, the server converts the image format of the initial compressed image into the JPEG format, and then the server obtains the compressed image in the JPEG format.

In this embodiment, the server compresses the target video frame according to the preset ratio range of the code rate of the target video frame to obtain an initial compressed image of the target video frame, then performs format conversion on the initial compressed image according to a preset format, and then the server obtains a compressed image after format conversion. By adopting the method, the initial compressed image obtained by compressing the target video frame is stored without storing the target video frame with larger image size, so that the storage space of the image is greatly reduced, further, the compressed image obtained by converting the preset format of the initial compressed image is stored without storing the initial compressed image with larger image size, so that the storage space of the image is further reduced, the storage cost of the intelligent security system associated with the intelligent security monitoring terminal is reduced, and the storage cost required for building intelligent city projects is further saved.

In an embodiment, as shown in fig. 7, after storing the compressed image, retrieving the retrieved image input by the user terminal, further includes the following steps:

step S701, acquiring a search image input by a user terminal and an image request corresponding to the search image.

The search image is an image related to a user target search task. The image request corresponding to the retrieval image refers to the type of the image corresponding to the target retrieval task that the user needs to obtain. The image request includes a compressed image request corresponding to the retrieved image and a target video frame request corresponding to the retrieved image.

Specifically, the user terminal sends a search image and an image request corresponding to the search image to the server, and the server receives the search image and the image request corresponding to the search image.

Step S702, if the image request is a compressed image request corresponding to the search image, acquires a compressed image corresponding to the search image from the stored compressed images, and returns the compressed image to the user terminal.

Specifically, after the server receives a retrieval image input by the user terminal and an image request corresponding to the retrieval image, the server judges the type of the image request, if the image request is a compressed image request corresponding to the retrieval image, the server matches the image characteristics of the compressed image corresponding to the retrieval image with the image characteristics of the stored compressed image, so as to find the compressed image corresponding to the retrieval image, and then the server returns the compressed image to the user terminal, and the user terminal receives and displays the compressed image, so that the compressed image is convenient for the user to view.

Step S703, if the image request is a target video frame request corresponding to the retrieval image, acquiring a compressed image corresponding to the retrieval image from the stored compressed image, and returning the image quality enhanced image of the compressed image to the user terminal; the enhanced-quality image of the compressed image has the same image quality as the target video frame of the compressed image.

Specifically, after a server receives a retrieval image input by a user terminal and an image request corresponding to the retrieval image, the server judges the type of the image request, if the image request is a target video frame request corresponding to the retrieval image, the server matches the image characteristics of a compressed image corresponding to the retrieval image with the image characteristics of a stored compressed image so as to find the compressed image corresponding to the retrieval image, then performs image quality enhancement on the compressed image through a plurality of depth learning-based image hyper-resolution algorithms to obtain an image quality enhanced image of the compressed image, and then returns the image quality enhanced image to the user terminal, and the user terminal receives and displays the image quality enhanced image so as to be convenient for a user to view. The enhanced-quality image of the compressed image has the same image quality as the target video frame of the compressed image.

In this embodiment, the server obtains a search image input by the user terminal and an image request corresponding to the search image, and if the image request is a compressed image request corresponding to the search image, the server obtains a compressed image corresponding to the search image from the stored compressed image, and then the server returns the compressed image to the user terminal; if the image request is a target video frame request corresponding to the retrieval image, the server acquires a compressed image corresponding to the retrieval image from the stored compressed image, and then the server returns the image quality enhanced image of the compressed image to the user terminal; and the user terminal receives and displays the image returned by the server. By adopting the method, only the image characteristics of the retrieval image are matched with the stored image characteristics, the compressed image corresponding to the retrieval image can be inquired through the target image characteristics obtained by matching, the retrieval image does not need to be matched with all the stored compressed images, and the time cost of image retrieval is further reduced.

In an embodiment, as shown in fig. 8, the step S702 of obtaining a compressed image corresponding to the retrieval image from the stored compressed images specifically includes the following steps:

in step S801, image features of the search image are extracted.

Step S802, searching a target image characteristic matched with the image characteristic of the retrieval image from the stored image characteristics;

in step S803, a compressed image matching the target image feature is acquired from the stored compressed images as a compressed image corresponding to the search image.

Specifically, after receiving a retrieval image sent by a user terminal, the server processes the retrieval image through a feature extraction technology, and then the server obtains all image features of the retrieval image; then comparing all the image characteristics with the image characteristics in a preset image characteristic storage position respectively, so as to find out the image characteristics which correspond to the image characteristics of the retrieval image from the stored image characteristics, and taking the image characteristics as target image characteristics; and the server compares the target image characteristics with the compressed image in the preset image storage position, so that the compressed image matched with the target image characteristics is found out from the stored compressed image and is used as the compressed image corresponding to the retrieval image. Thus, after obtaining the compressed image, the server executes the subsequent image quality enhancement step using the compressed image as a processing basis.

For example, after receiving a retrieval image sent by a user terminal, the server extracts image features of the retrieval image through a feature extraction algorithm based on a deep neural network, and then the server obtains color features, texture features, shape features and spatial relationship features of the retrieval image; then the server compares each feature of the obtained retrieval image with the features stored in the vector database respectively, so as to find out the image feature which corresponds to the same feature of the retrieval image and take the image feature as the target image feature; the server compares the target image features with compressed images stored in the file system, and finds out a compressed image matching the target image features as a compressed image corresponding to the retrieval image.

In this embodiment, the server extracts the image features of the search image, then searches for target image features matching the image features of the search image from the stored image features, and further acquires a compressed image matching the target image features from the stored compressed image as a compressed image corresponding to the search image. By adopting the method, only the image characteristics of the retrieval image are matched with the stored image characteristics, the compressed image corresponding to the retrieval image can be inquired through the target image characteristics obtained by matching, the retrieval image does not need to be matched with all the stored compressed images, and the time cost of image retrieval is further reduced.

In one embodiment, as shown in fig. 9, another image storage method is provided, which is described by taking the application of the method to the server in fig. 1 as an example, and includes the following steps:

step S901, obtaining a video stream uploaded by the smart security monitoring terminal.

Step S902, decode each unit frame in the video stream to obtain a decoded video frame of the video stream.

Step S903, acquiring image quality influence factors of a decoded video frame in a video of each unit time length; the image quality influencing factor includes at least one of sharpness, contrast, saturation, and noise.

Step S904, calculating an image quality score of the decoded video frame according to each image quality influencing factor and a preset weight of each image quality influencing factor.

Step S905, using the decoded video frame with the highest image quality score in the video of each unit time length in the video stream as the target video frame.

Step S906, image recognition processing is carried out on the target video frame, and a target local image in the target video frame is obtained.

Step 907, performing feature extraction processing on the local target video frame to obtain image features of the target local image, and storing the image features.

Step 908, compressing the target video frame to obtain an initial compressed image of the target video frame; the code rate of the initial compressed image is within a preset proportion range of the code rate of the target video frame.

In step S909, a preset format conversion process is performed on the initial compressed image, and a compressed image of the target video frame is obtained.

Step S910, storing the compressed image.

The space analysis method can keep the images of the original image quality of the intelligent security system, greatly reduces the storage space of the images, reduces the total storage space of the intelligent security system, and saves the storage cost required for building intelligent city projects.

In order to clarify the spatial analysis method provided by the embodiments of the present disclosure more clearly, the following describes the image storage method in a specific embodiment. In an embodiment, as shown in fig. 10, the present disclosure further provides an image storage method, which specifically includes the following steps:

step S1001, video decoding: the method comprises the steps that a server receives video streams coded through H.264 and H.265 coding standards, the video streams come from intelligent security monitoring terminals such as a monitoring camera or a video monitoring platform, the intelligent security monitoring terminals send the video streams to the server in a video data transmission format of GB/T28181, the server decodes each frame of the video streams to obtain decoded video frames, the image quality of all the decoded video frames is calculated through an image quality score weighted sum algorithm, the decoded video frames with the highest image quality scores are selected as target video frames, and the image quality of the target video frames is the same as the original image quality of the video streams from the intelligent security monitoring terminals. Because the target video frame reserves the omnibearing details of the scene shot by the intelligent security monitoring terminal, the target video frame needs to be stored for a long time in business requirements.

Step S1002, structuring a picture: a target detection algorithm and a target recognition algorithm based on deep learning are integrated in the server, and image recognition targets in a target video frame comprise people, vehicles and the like; the server extracts a target local image from the target video frame through a target detection algorithm, and then extracts image features from the target local image through a feature extraction algorithm. The image features are used as a basis for feature matching in subsequent retrieval services.

Step S1003, picture compression: the server reduces the 50% code rate of the target video frame through a down-sampling technology, so that the size of the image of the target video frame is reduced, an initial compressed image of the target video frame is obtained, and the initial compressed image is finally output to a compressed image in a JPEG format. The image quality of the enhanced quality image of the compressed image is the same as the target video frame.

Step S1004, data storage: and the server stores the compressed image output after the image compression processing and the target local image output after the image recognition processing in a file system, and stores the image characteristics obtained after the characteristic extraction processing in a vector database. Because the compressed image stored at this time is reduced by a half of the code rate compared with the target video frame, the storage space of the image is greatly reduced.

Step S1005, super-dividing the pictures: the server is integrated with an image hyper-segmentation algorithm based on deep learning, and comprises image quality enhancement algorithms such as an image region enhancement algorithm, a color gamut enhancement algorithm, a color enhancement algorithm, a super-resolution algorithm and the like, so that the server can enhance the image quality of a compressed image through the image hyper-segmentation algorithm based on the deep learning.

Step S1006, displaying a picture: the user terminal is a terminal used by a user and comprises a mobile phone end, a large screen end and a browser end. The server responds to a target video frame request which is sent by the user terminal and corresponds to the search image, acquires a compressed image corresponding to the search image from the stored compressed image, and performs image quality enhancement on the compressed image through an image quality enhancement algorithm to obtain an image quality enhanced image of the compressed image, wherein the image quality of the image quality enhanced image of the compressed image is the same as that of the target video frame.

In the embodiment, only the compressed image corresponding to the target video frame in the video of each unit time length in the video stream is stored, and the whole video stream does not need to be stored, so that the storage space of the image is greatly reduced, the storage cost of the intelligent security system is reduced, and the storage cost required for building an intelligent city project is saved. In addition, the server enhances the image quality of the compressed image through an image hyper-resolution algorithm based on deep learning, so that the user terminal can also check the image with original image quality uploaded by the intelligent security monitoring terminal.

It should be understood that although the various steps in the flow charts of fig. 2-10 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-10 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.

In one embodiment, as shown in fig. 11, there is provided an image storage apparatus 1100 including: an obtaining module 1101, an extracting module 1102, a compressing module 1103 and a storing module 1104, wherein:

the obtaining module 1101 is configured to obtain a video stream uploaded by the intelligent security monitoring terminal.

An extracting module 1102, configured to extract a target video frame in a video stream; the target video frame is a video frame with the highest image quality in the video per unit time length in the video stream.

A compression module 1103, configured to perform compression processing on the target video frame to obtain a compressed image of the target video frame; the image quality of the enhanced quality image of the compressed image is the same as the target video frame.

And a storage module 1104 for storing the compressed image.

In an embodiment, the extracting module 1102 is further configured to perform decoding processing on each unit frame in the video stream to obtain a decoded video frame of the video stream; and respectively taking the decoded video frame with the highest image quality in the video of each unit time length in the video stream as a target video frame.

In one embodiment, the image storage device 1100 further comprises an image quality calculation module for obtaining image quality influencing factors of decoded video frames in the video per unit time length; the image quality influencing factor includes at least one of sharpness, contrast, saturation and noise; calculating the image quality scores of the decoded video frames according to the image quality influence factors and the preset weights of the image quality influence factors; and respectively taking the decoded video frame with the highest image quality score in the video of each unit time length in the video stream as a target video frame.

In one embodiment, the image storage device 1100 further includes an image recognition module, configured to perform image recognition processing on the target video frame to obtain a target local image in the target video frame; and performing feature extraction processing on the local target video frame to obtain the image features of the target local image, and storing the image features.

In an embodiment, the compressing module 1103 is further configured to perform compression processing on the target video frame to obtain an initial compressed image of the target video frame; the code rate of the initial compressed image is within a preset proportion range of the code rate of the target video frame; and performing preset format conversion processing on the initial compressed image to obtain a compressed image of the target video frame.

In one embodiment, the image storage device 1100 further comprises an image retrieval module for obtaining a retrieval image input by the user terminal and an image request corresponding to the retrieval image; if the image request is a compressed image request corresponding to the retrieval image, acquiring a compressed image corresponding to the retrieval image from the stored compressed image, and returning the compressed image to the user terminal; if the image request is a target video frame request corresponding to the retrieval image, acquiring a compressed image corresponding to the retrieval image from the stored compressed images, and returning the image quality enhancement image of the compressed image to the user terminal; the enhanced-quality image of the compressed image has the same image quality as the target video frame of the compressed image.

In one embodiment, the image storage device 1100 further comprises a feature matching module for extracting image features of the retrieval image; searching a target image characteristic matched with the image characteristic of the retrieval image from the stored image characteristics; and acquiring a compressed image matched with the target image characteristic from the stored compressed images as a compressed image corresponding to the retrieval image.

For specific limitations of the image storage device, reference may be made to the above limitations of the image storage method, which are not described herein again. The respective modules in the image storage device may be wholly or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.

In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 12. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing video data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement an image storage method.

Those skilled in the art will appreciate that the architecture shown in fig. 12 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.

In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.

In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.

It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.

The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.

The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

22页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:视频处理方法和装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类