Image processing method, device, equipment and storage medium
By acquiring and adjusting the picture parameters and network transmission parameters of the network camera in real time, the blur problem when the picture changes are large is solved, and the clarity and transmission efficiency of the image are improved.
Patent Information
- Application Number
- CN202211421264.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-14
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2042-11-14
AI Technical Summary
When the picture changes greatly, the long exposure time of existing network cameras leads to blurred image drag and ghosting, and the long H.264/H.265 encoding compression time interval leads to a degradation of picture quality during image decoding.
By obtaining the current picture parameters and network transmission parameters in real time, if the picture change rate is greater than the preset value, adjust the quality code rate, exposure parameters and keyframe transmission time interval of the image encoding to optimize video data acquisition and transmission.
When the picture changes greatly, adjust the internal parameters to improve the clarity of the picture, avoid the destruction of the shadows and image quality, and reduce storage costs.
Smart Images

Figure CN115767284B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to an image processing method, device, equipment and storage medium. Background Art
[0002] At present, the image of the network camera is processed by the image signal processing (ISP). During the ISP image signal processing, if the image changes greatly, the long exposure time will cause image smear and ghosting, making the captured image blurred. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention provides an image processing method that can adjust the internal parameters to improve the clarity of the picture when the picture changes greatly.
[0004] The invention also provides an image processing device.
[0005] The invention also provides an image processing device.
[0006] The present invention also provides a computer-readable storage medium.
[0007] In a first aspect, an embodiment of the present invention provides an image processing method, which is applied to a network camera. The image processing method includes:
[0008] Acquire current picture parameters and network transmission parameters; wherein the picture parameters include: picture change rate, picture motion-static ratio; the network transmission parameters include: network bandwidth data;
[0009] If the picture change rate is greater than the preset change rate, obtain the current environment brightness, current exposure parameters, current quality bit rate and current time interval of key frame transmission;
[0010] Adjusting the current quality bit rate of the image encoding according to the motion-to-still ratio of the picture to obtain a target quality bit rate;
[0011] Adjust the current exposure parameter according to the current ambient brightness to obtain a target exposure parameter;
[0012] Collecting video data according to the target exposure parameter and the target quality bit rate to obtain target video data;
[0013] Adjust the current time interval of key frame transmission of the target video data according to the network bandwidth data to obtain a target time interval;
[0014] The target video data is transmitted to a target device according to the target time interval.
[0015] The image processing method of the embodiment of the present invention has at least the following beneficial effects: obtaining the current picture parameters in real time, and the picture parameters include the picture change rate and the picture motion-still ratio at the current moment, obtaining the current network transmission parameters in real time, and the network transmission parameters include the network bandwidth data at the current moment, comparing the picture change rate with the preset change rate, if the picture change rate is greater than the preset change rate, obtaining the current ambient brightness, obtaining the current ambient brightness, obtaining the current exposure parameters, obtaining the current exposure parameters, obtaining the current quality bit rate, obtaining the current quality bit rate, obtaining the current time interval of key frame transmission, obtaining the current time interval, adjusting the current quality bit rate of image encoding to a corresponding quality bit rate value according to the picture motion-still ratio, obtaining the target quality bit rate, adjusting the current exposure parameters to a corresponding exposure parameter value according to the current ambient brightness, obtaining the target exposure parameters, collecting video data frame by frame according to the target exposure parameters and the target quality bit rate, obtaining the target video data, adjusting the key frame transmission of the target video data according to the network bandwidth data to adjust the current time interval of the key frame transmission to a corresponding time interval value, obtaining the target time interval, and transmitting the target video data to the target device according to the target time interval. By acquiring the current picture parameters and network transmission parameters, adjusting the current exposure parameters according to the current picture parameters to obtain the target exposure parameters, adjusting the current quality bit rate according to the current picture parameters to obtain the target quality bit rate, collecting video data according to the target exposure parameters and the target quality bit rate to obtain the target video data, adjusting the current time interval for key frame transmission of the target video data according to the network transmission parameters to obtain the target time interval, and transmitting the target video data to the target device according to the target time interval, the built-in parameters can be adjusted to improve the clarity of the picture when the picture changes greatly.
[0016] According to the image processing method of some other embodiments of the present invention, if the picture parameter is the picture motion-to-still ratio, obtaining the current picture parameter includes:
[0017] A reference binary image is selected from pre-stored binary images according to a preset binary image threshold;
[0018] The motion-to-still ratio of the reference binary image is calculated according to a preset motion-to-still ratio acquisition rule to obtain the motion-to-still ratio of the picture.
[0019] According to the image processing method of some other embodiments of the present invention, if the picture change rate is greater than a preset change rate, obtaining the current environment brightness includes:
[0020] If the picture change rate is greater than a preset change rate, obtaining an image histogram of the current picture;
[0021] Performing pixel calculation on the image histogram to obtain image pixel data;
[0022] The brightness is calculated according to the image pixel data to obtain the current environment brightness.
[0023] According to some other embodiments of the image processing method of the present invention, the step of adjusting the current exposure parameter according to the current ambient brightness to obtain the target exposure parameter includes:
[0024] If the current ambient brightness is lower than a lower limit of a preset ambient brightness range, the current exposure parameter is increased according to the preset ambient brightness range to obtain the target exposure parameter;
[0025] If the current ambient brightness is higher than the upper limit of the ambient brightness range, the current exposure parameter is reduced according to the ambient brightness range to obtain the target exposure parameter.
[0026] According to some other embodiments of the image processing method of the present invention, the current quality bit rate of image encoding is adjusted according to the motion-to-still ratio of the picture to obtain a target quality bit rate, including:
[0027] If the picture motion-to-still ratio is greater than a preset motion-to-still ratio threshold, increasing the current quality bit rate according to a preset motion-to-still ratio adjustment range to obtain the target quality bit rate;
[0028] If the picture motion-to-still ratio is less than the motion-to-still ratio threshold, the current quality bit rate is reduced according to the motion-to-still ratio adjustment range to obtain the target quality bit rate.
[0029] According to some other embodiments of the image processing method of the present invention, the step of adjusting the current time interval of key frame transmission of the target video data according to the network bandwidth data to obtain the target time interval includes:
[0030] Calculate the network bandwidth usage based on the network bandwidth data to obtain the network bandwidth usage rate;
[0031] If the network bandwidth usage is within a preset usage threshold range, the current time interval is adjusted to a preset time interval value to obtain the target time interval.
[0032] According to some other embodiments of the image processing method of the present invention, the image processing method further includes:
[0033] If the motion-to-still ratio of the picture is less than a preset setting recovery threshold, the current exposure parameter is set to the pre-stored initial exposure parameter, the current quality bit rate is set to the pre-stored initial quality bit rate, and the current time interval is set to the pre-stored initial time interval.
[0034] In a second aspect, an embodiment of the present invention provides an image processing device, which is applied to a network camera, and the image processing device includes:
[0035] The initial data acquisition module is used to acquire the current picture parameters and network transmission parameters; wherein the picture parameters include: picture change rate, picture dynamic-static ratio; the network transmission parameters include: network bandwidth data and current time interval of key frame transmission;
[0036] An initial parameter acquisition module, used to acquire the current environment brightness and the current exposure parameters if the picture change rate is greater than a preset change rate;
[0037] A quality bit rate adjustment module, used for adjusting the current quality bit rate of the image encoding according to the motion-to-still ratio of the picture to obtain a target quality bit rate;
[0038] An exposure parameter adjustment module, used to adjust the current exposure parameter according to the current ambient brightness to obtain a target exposure parameter;
[0039] A video data acquisition module, used to acquire video data according to the target exposure parameter and the target quality bit rate to obtain target video data;
[0040] A time interval adjustment module, used for adjusting the current time interval of the key frame transmission of the target video data according to the network bandwidth data to obtain a target time interval;
[0041] The video data transmission module is used to transmit the target video data to the target device according to the target time interval.
[0042] The image processing device of the embodiment of the present invention has at least the following beneficial effects: the initial data acquisition module acquires the current picture parameters in real time, and the picture parameters include the picture change rate and the picture motion-static ratio at the current moment, and the current network transmission parameters are acquired in real time, and the network transmission parameters include the network bandwidth data at the current moment, the initial parameter acquisition module compares the picture change rate with the preset change rate, and if the picture change rate is greater than the preset change rate, the current ambient brightness is acquired, the current ambient brightness is obtained, the current exposure parameters are acquired, the current exposure parameters are acquired, the current quality bit rate is acquired, the current quality bit rate is acquired, the current time interval of key frame transmission is acquired, the current time interval, the quality bit rate is acquired The rate adjustment module adjusts the current quality bit rate of the image encoding to the corresponding quality bit rate value according to the image motion-static ratio to obtain the target quality bit rate. The exposure parameter adjustment module adjusts the current exposure parameter to the corresponding exposure parameter value according to the current ambient brightness to obtain the target exposure parameter. The video data acquisition module acquires video data frame by frame according to the target exposure parameter and the target quality bit rate to obtain the target video data. The time interval adjustment module adjusts the key frame transmission of the target video data according to the network bandwidth data to adjust the current time interval of the key frame transmission to the corresponding time interval value to obtain the target time interval. The video data transmission module transmits the target video data to the target device according to the target time interval. By obtaining the current picture parameters and network transmission parameters, adjusting the current exposure parameters according to the current picture parameters to obtain the target exposure parameters, adjusting the current quality bit rate according to the current picture parameters to obtain the target quality bit rate, acquiring video data according to the target exposure parameters and the target quality bit rate to obtain the target video data, adjusting the current time interval of the key frame transmission of the target video data according to the network transmission parameters to obtain the target time interval, and transmitting the target video data to the target device according to the target time interval, the built-in parameters can be adjusted to improve the clarity of the picture when the picture changes greatly.
[0043] In a third aspect, an embodiment of the present invention provides an image processing device, comprising:
[0044] at least one processor, and
[0045] a memory communicatively connected to the at least one processor; wherein,
[0046] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the image processing method as described in the first aspect.
[0047] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the image processing method as described in the first aspect.
[0048] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained through the structures particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a flowchart of a specific embodiment of the image processing method in an embodiment of the present invention;
[0050] Figure 2 yes Figure 1 A schematic flow chart of a specific embodiment of step S101;
[0051] Figure 3 yes Figure 1 A schematic flow chart of a specific embodiment of step S102;
[0052] Figure 4 yes Figure 1 A schematic flow chart of a specific embodiment of step S103;
[0053] Figure 5 yes Figure 1 A schematic flow chart of a specific embodiment of step S104;
[0054] Figure 6 yes Figure 1 A schematic flow chart of a specific embodiment of step S106;
[0055] Figure 7 is a flowchart of another specific embodiment of the image processing method in an embodiment of the present invention;
[0056] Figure 8 It is a module block diagram of a specific embodiment of the image processing device in the embodiment of the present invention.
[0057] Description of reference numerals:
[0058] Initial data acquisition module 801 , initial parameter acquisition module 802 , quality bit rate adjustment module 803 , exposure parameter adjustment module 804 , video data acquisition module 805 , time interval adjustment module 806 , and video data transmission module 807 . DETAILED DESCRIPTION
[0059] The following will be combined with the embodiments to clearly and completely describe the concept of the present invention and the technical effects produced, so as to fully understand the purpose, characteristics and effects of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, other embodiments obtained by those skilled in the art without creative work are all within the scope of protection of the present invention.
[0060] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0061] It should be noted that although the system diagram is divided into functional modules and the flow chart shows a logical order, in some cases, the steps shown or described may be performed in a manner different from the module division in the system or the order in the flow chart.
[0062] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0063] In the description of the embodiments of the present invention, if "several" is involved, it means more than one, if "multiple" is involved, it means more than two, if "greater than", "less than" or "exceed" is involved, it should be understood as not including the number itself, if "above", "below" or "within" is involved, it should be understood as including the number itself. If "first" or "second" is involved, it should be understood as being used to distinguish technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0064] At present, the image of the network camera is processed by the image ISP (Image Signal Processing), encoded and compressed by the H.264 / H.265 compression technology, and then transmitted to the storage device for storage through the network transmission, or transmitted to the display device for decryption and display. When the ISP image signal is processed, if the picture changes greatly and the exposure time is long, it will cause the picture to be smeared, ghosted and blurred. In addition, when H.264 / H.265 is encoded and compressed, the reference frame with a long interval time will cause the image quality to be seriously degraded during decoding. In addition, the image codec CRF (quality bit rate control) and QP CRF are the default quality / bit rate control settings in H.264 and H.265. The lower codec CRF and QP CRF have a serious impact on the image clarity and mosaic phenomenon, while the higher codec CRF and QP CRF images require a large storage space, increasing the storage cost.
[0065] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention provides an image processing method that can adjust the internal parameters to improve the clarity of the picture when the picture changes greatly.
[0066] Please refer to Figure 1 , Figure 1 The flowchart of the image processing method in the embodiment of the present invention is shown. In some embodiments, the image processing method is applied to a network camera, and the image processing method specifically includes but is not limited to steps S101 to S107.
[0067] Step S101, obtaining current picture parameters and network transmission parameters; wherein the picture parameters include: picture change rate, picture motion ratio; network transmission parameters include: network bandwidth data;
[0068] Step S102, if the picture change rate is greater than the preset change rate, obtain the current environment brightness, current exposure parameters, current quality bit rate and current time interval of key frame transmission;
[0069] Step S103, adjusting the current quality bit rate of the image encoding according to the still-motion ratio of the picture to obtain a target quality bit rate;
[0070] Step S104, adjusting the current exposure parameters according to the current environment brightness to obtain the target exposure parameters;
[0071] Step S105, collecting video data according to target exposure parameters and target quality bit rate to obtain target video data;
[0072] Step S106, adjusting the current time interval of key frame transmission of the target video data according to the network bandwidth data to obtain the target time interval;
[0073] Step S107: transmitting the target video data to the target device according to the target time interval.
[0074] In steps S101 to S107 shown in this embodiment, the current picture parameters are obtained in real time, and the picture parameters include the picture change rate and the picture motion-to-still ratio at the current moment, and the current network transmission parameters are obtained in real time, and the network transmission parameters include the network bandwidth data at the current moment. The picture change rate is compared with the preset change rate. If the picture change rate is greater than the preset change rate, the current ambient brightness is obtained to obtain the current ambient brightness, the current exposure parameter is obtained to obtain the current exposure parameter, the current quality bit rate is obtained to obtain the current quality bit rate, and the current time interval of key frame transmission is obtained to obtain the current time interval. The current quality bit rate of image encoding is adjusted to a corresponding quality bit rate value according to the picture motion-to-still ratio to obtain the target quality bit rate, and the current exposure parameter is adjusted to a corresponding exposure parameter value according to the current ambient brightness to obtain the target exposure parameter. Video data is collected frame by frame according to the target exposure parameter and the target quality bit rate to obtain the target video data, and the key frame transmission of the target video data is adjusted according to the network bandwidth data to adjust the current time interval of key frame transmission to a corresponding time interval value to obtain the target time interval, and the target video data is transmitted to the target device according to the target time interval. By acquiring the current picture parameters and network transmission parameters, adjusting the current exposure parameters according to the current picture parameters to obtain the target exposure parameters, adjusting the current quality bit rate according to the current picture parameters to obtain the target quality bit rate, collecting video data according to the target exposure parameters and the target quality bit rate to obtain the target video data, adjusting the current time interval for key frame transmission of the target video data according to the network transmission parameters to obtain the target time interval, and transmitting the target video data to the target device according to the target time interval, the built-in parameters can be adjusted to improve the clarity of the picture when the picture changes greatly.
[0075] Please refer to Figure 2 , Figure 2 The flowchart of the image processing method in the embodiment of the present invention is shown. In some embodiments, if the picture parameter is the picture motion-to-still ratio, obtaining the current picture parameter specifically includes but is not limited to steps S201 to S202.
[0076] Step S201, filtering out a reference binary image from pre-stored binary images according to a preset binary image threshold;
[0077] Step S202 , calculating the motion-to-still ratio of the reference binary image according to a preset motion-to-still ratio acquisition rule to obtain the motion-to-still ratio of the picture.
[0078] In step S201 to step S202 shown in the present embodiment, a pre-stored binary image is screened according to a preset binary image threshold to screen out a corresponding reference binary image, the reference binary image is detected according to a preset static-motion ratio acquisition rule, and the static-motion ratio of the reference binary image is calculated to obtain the static-motion ratio of the picture. The reference binary image is obtained by screening the binary image threshold, and the reference binary image is detected and calculated according to the static-motion ratio acquisition rule to obtain the static-motion ratio of the picture, which can accurately detect the change of the picture and calculate the static-motion ratio of the picture.
[0079] In step S201 of some embodiments, after capturing a video image, the network camera converts each frame of the image into a binary image for storage, and then selects a corresponding reference binary image according to a binary image threshold.
[0080] In step S202 of some embodiments, the motion-to-static ratio acquisition rule is set based on the frame difference method or the background method, and the reference binary image is detected according to the motion-to-static ratio acquisition rule to obtain image motion macroblocks and image static macroblocks, wherein the image motion macroblocks represent the number of image macroblocks that change, and the image static macroblocks represent the number of image macroblocks that are static. The picture motion-to-static ratio is calculated as follows: the image motion macroblocks are added to the image static macroblocks to obtain the total number of image macroblocks, and the image motion macroblocks are divided by the total number of image macroblocks to obtain the picture motion-to-static ratio. For example, the picture motion-to-static ratio is shown in Table 1 below, wherein 1 represents that the macroblock is changing, and 0 represents that the macroblock is static.
[0081] Table 1
[0082]
[0083]
[0084] In some embodiments, a method for calculating the motion-still ratio of a picture includes: selecting a reference binary image by using a frame difference method or a background method and a binary image threshold; performing denoising on the reference binary image to remove blocks with smaller areas to remove noise points; calculating the percentage of the remaining block areas to the area of the entire frame of the reference binary image to determine whether motion detection has occurred; and then processing the image by using a motion connectivity detection method such as blob analysis to obtain the motion-still ratio of the picture.
[0085] In step S101 of some embodiments, the picture change rate is used to indicate the degree of picture change.
[0086] In addition, the network camera is internally provided with a communication connection between the network camera and the network adapter. The network camera obtains network bandwidth data from the network adapter and stores the network bandwidth data in a preset storage area. The network camera reads the data flow of the network adapter every second, calculates the rate according to the data flow, and obtains the network bandwidth data.
[0087] Please refer to Figure 3 , Figure 3 The flowchart of the image processing method in the embodiment of the present invention is shown. In some embodiments, if the image change rate is greater than the preset change rate, obtaining the current environment brightness specifically includes but is not limited to steps S301 to S303.
[0088] Step S301, if the picture change rate is greater than a preset change rate, obtaining an image histogram of the current picture;
[0089] Step S302, performing pixel calculation on the image histogram to obtain image pixel data;
[0090] Step S303, performing brightness calculation according to the image pixel data to obtain the current environment brightness.
[0091] In steps S301 to S303 shown in this embodiment, the picture change rate is compared with the preset change rate. If the picture change rate is greater than the preset change rate, the degree of picture change is large and the picture change is obvious. The current picture is subjected to histogram calculation to obtain the image histogram of the current picture, and the image histogram is subjected to pixel calculation to calculate the pixel information of the current picture to obtain the image pixel data. The pixel statistics are performed based on the image pixel data to obtain the number of pixels of each color level, and the proportion of each color level pixel in the current picture is calculated to obtain the current ambient brightness corresponding to the current picture. If the degree of change of the current picture is large, by obtaining the image histogram of the current picture, the image histogram is subjected to pixel calculation to obtain the image pixel data, and the number and proportion of pixels in the image pixel data are counted to obtain the current ambient brightness, so that the picture can be detected to be in a state of change, and the ambient brightness of the current picture can be obtained according to the change.
[0092] In step S303 of some embodiments, for example, the image pixel data is an 8x8 matrix, and the grayscale level of the pixel ranges from 0 to 14. The number of occurrences of each grayscale level is counted to obtain a grayscale level table, and finally the brightness is calculated according to the grayscale level table to obtain the current environment brightness. The image pixel data is shown in Table 2 below, and the grayscale level table is shown in Table 3 below.
[0093] Table 2
[0094] 1 2 3 5 6 7 9 4 2 3 4 1 0 0 0 9 3 3 3 9 1 11 3 3 8 8 8 9 11 13 8 8 8 8 8 9 1 6 8 8 7 7 7 9 4 5 7 7 9 9 9 9 14 9 9 9 9 9 9 9 9 11 9 9
[0095] Table 3
[0096] Pixel level 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Occurrence 3 4 2 7 3 2 2 6 10 20 0 3 0 1 1
[0097] In step S102 of some embodiments, an ISP image processing chip and a video encoding processing chip are also provided inside the network camera, and the current exposure time and the current exposure gain are obtained in the ISP image processing chip to obtain the current exposure parameters, which include the current exposure time and the current exposure gain, and the current exposure time and the current exposure gain are stored in a preset storage area. Among them, the exposure gain includes the ISP gain and the photosensitive device gain. In addition, the network camera obtains the current time interval of key frame transmission in the video encoding processing chip, and stores the current time interval in the preset storage area.
[0098] Please refer to Figure 4 , Figure 4 The flowchart of the image processing method in the embodiment of the present invention is shown. In some embodiments, the current exposure parameter is adjusted according to the current environment brightness to obtain the target exposure parameter, which specifically includes but is not limited to steps S401 to S402.
[0099] Step S401, if the current environment brightness is lower than the lower limit of the preset environment brightness range, the current exposure parameter is increased according to the preset environment brightness range to obtain the target exposure parameter;
[0100] Step S402: if the current environment brightness is higher than the upper limit of the environment brightness range, the current exposure parameter is reduced according to the environment brightness range to obtain a target exposure parameter.
[0101] In steps S401 to S402 shown in this embodiment, the current environment brightness is compared with the preset environment brightness range. If the current environment brightness is lower than the lower limit of the environment brightness range, the current exposure parameter is increased to a corresponding parameter value according to the preset environment brightness range to obtain the target exposure parameter; or if the current environment brightness is higher than the upper limit of the environment brightness range, the current exposure parameter is decreased to a corresponding parameter value according to the environment brightness range to obtain the target exposure parameter. By judging according to the current environment brightness and the environment brightness range, the current exposure parameter is increased or decreased to adjust the current exposure parameter to the target exposure parameter, and the current exposure parameter can be adjusted when the picture changes greatly to improve the clarity of the picture.
[0102] It should be noted that the ambient brightness range is adjusted according to the preset exposure parameter adjustment formula, which includes: target exposure parameter = exposure time * exposure gain. For example, if the current ambient brightness is low and the target brightness value of the network camera's image is required to remain consistent, increase the exposure time or exposure gain. However, if the exposure time is too long, moving objects or moving images will be blurred. Therefore, if you want to make the image and the moving image clear, you need to shorten the exposure time and increase the exposure gain.
[0103] Please refer to Figure 5 , Figure 5 In some embodiments, the current quality bit rate of image coding is adjusted according to the still-motion ratio of the picture to obtain the target quality bit rate, including but not limited to steps S501 to S502.
[0104] Step S501, if the image motion-to-still ratio is greater than a preset motion-to-still ratio threshold, the current quality bit rate is increased according to a preset motion-to-still ratio adjustment range to obtain a target quality bit rate;
[0105] Step S502: if the motion-to-still ratio of the picture is less than the motion-to-still ratio threshold, the current quality bit rate is reduced according to the motion-to-still ratio adjustment range to obtain the target quality bit rate.
[0106] In step S501 to step S502 shown in this embodiment, the image motion-to-still ratio is compared with a preset motion-to-still ratio threshold. If the image motion-to-still ratio is greater than the motion-to-still ratio threshold, the current quality bitrate is increased to a corresponding quality bitrate value according to a preset motion-to-still ratio adjustment range to obtain a target quality bitrate; or, if the image motion-to-still ratio is less than the motion-to-still ratio threshold, the current quality bitrate is reduced to a corresponding quality bitrate value according to the motion-to-still ratio adjustment range to obtain a target quality bitrate. By judging according to the current image motion-to-still ratio and the motion-to-still ratio threshold, the current quality bitrate is increased or reduced to adjust the current quality bitrate to the target quality bitrate, and the current quality bitrate can be adjusted to improve the clarity of the image when the image changes greatly.
[0107] It should be noted that the network camera obtains the image quality parameters of the encoding in the video encoding processing chip. The image quality parameters include the current quality bit rate, and the current quality bit rate includes CRF and QP CRF. If the proportion of picture changes is large, it is necessary to increase the larger CRF and QP CRF values; if the proportion of picture changes is small, it is necessary to increase the smaller CRF and QPCRF values. For example, the range of QP CRF is between 1 and 51. If the proportion of picture changes is 80%, the QP CRF that needs to be increased is: 51*80%=40, that is, the QP CRF value of 40 is increased, then the current quality bit rate is also increased according to the corresponding ratio.
[0108] In step S105 of some embodiments, the network camera adjusts the current exposure parameter to the target exposure parameter, and adjusts the current quality bit rate to the target quality bit rate, and collects video data after the adjustment to obtain the target video data.
[0109] Please refer to Figure 6 , Figure 6 The flowchart of the image processing method in the embodiment of the present invention is shown. In some embodiments, adjusting the current time interval of the key frame transmission of the target video data according to the network bandwidth data to obtain the target time interval specifically includes but is not limited to steps S601 to S602.
[0110] Step S601, calculating the utilization rate according to the network bandwidth data to obtain the network bandwidth utilization rate;
[0111] Step S602: If the network bandwidth usage is within a preset usage threshold range, the current time interval is adjusted to a preset time interval value to obtain a target time interval.
[0112] In steps S601 to S602 shown in this embodiment, the network bandwidth data is substituted into the existing network bandwidth usage calculation formula to calculate the usage, and the network bandwidth usage is obtained. The network bandwidth usage is compared with the preset usage threshold range. If the network bandwidth usage is within the usage threshold range, the network camera adjusts the current time interval of key frame transmission to the preset time interval value to obtain the target time interval. The network bandwidth usage is calculated according to the network bandwidth data and the network bandwidth usage calculation formula, and the current time interval is adjusted according to the network bandwidth usage and the usage threshold range to obtain the target time interval. When the picture changes greatly, the current time interval can be adjusted to adjust the time interval of picture transmission.
[0113] It should be noted that the data volume of the key frame of the image captured by the network camera is relatively large, and the decoded picture will be clearer. The data volume of the non-key frame of the image captured by the network camera is very small. The longer the time interval between the key frame image and the non-key frame image is, the worse and more blurred the decoded picture will be. For example, the network camera shoots 25 frames per second. Under normal circumstances, a key frame is set every 4 seconds. If the network bandwidth utilization rate is greater than 10%, the current time interval of the key frame can be modified to 1 second, or less; if the network bandwidth utilization rate is less than 10%, the current time interval of the key frame can be modified to 4 seconds. Among them, the network camera encodes and decodes according to H.265 / H.264.
[0114] Please refer to Figure 7 , Figure 7The flowchart of the image processing method in the embodiment of the present invention is shown. In some embodiments, the image processing method specifically includes but is not limited to step S701.
[0115] Step S701, if the image motion-to-still ratio is less than a preset setting recovery threshold, the current exposure parameters are set to the pre-stored initial exposure parameters, the current quality bit rate is set to the pre-stored initial quality bit rate, and the current time interval is set to the pre-stored initial time interval.
[0116] In step S701 of some embodiments, the image motion-to-still ratio is compared with a preset setting recovery threshold in real time. If the image motion-to-still ratio is less than the preset setting recovery threshold, the image changes little and there is no change in the image. The current exposure parameter, the current quality bit rate and the current time interval are adjusted respectively. The current exposure parameter is set to the pre-stored initial exposure parameter, the current quality bit rate is set to the pre-stored initial quality bit rate, and the current time interval is set to the pre-stored initial time interval. If the current image changes little, the current exposure parameter, the current quality bit rate and the current time interval are adjusted to the pre-stored initial values respectively, so that it can be detected that the image is still, and the current exposure parameter, the current quality bit rate and the current time interval are adjusted to the initial values according to the still situation.
[0117] For example, when the proportion of picture changes is 0 or less than 5%, the current exposure parameter, the current quality bit rate and the current time interval are restored to the parameter configuration before the picture quality is improved.
[0118] It should be noted that the network camera controls the zoom or pan / tilt control, which causes the video data captured by the network camera to change. When it is detected that the zoom and pan / tilt rotation cause a large change in the picture, the ISP image signal processing is used to shorten the current exposure time and increase the exposure gain to obtain a clear image. At the same time, the values of the image codec CRF and QP CRF are determined and adjusted according to the motion-static ratio of the picture. In addition, the quality of the acquired image is improved by reducing the current interval time of the key frame encoded by H.264 / H.265. Finally, after the picture stabilizes, the adjusted parameters are restored to the initial parameters, which can solve the problem of blurred shooting pictures and reduced image quality when the network camera picture changes greatly, and the problem that the user cannot see the picture clearly. In addition, it can reduce the cost of storing the captured images.
[0119] In addition, the present application also discloses an image processing device, please refer to Figure 8 , Figure 8An embodiment of the present invention discloses a module block diagram of an image processing device. Applied to a network camera, and capable of implementing the above-mentioned image processing method, the image processing device comprises: an initial data acquisition module 801, an initial parameter acquisition module 802, a quality bit rate adjustment module 803, an exposure parameter adjustment module 804, a video data acquisition module 805, a time interval adjustment module 806, and a video data transmission module 807. The initial data acquisition module 801, the initial parameter acquisition module 802, the exposure parameter adjustment module 804, the quality bit rate adjustment module 803, the video data acquisition module 805, the time interval adjustment module 806, and the video data transmission module 807 are all communication connected.
[0120] The initial data acquisition module 801 acquires the current picture parameters and network transmission parameters; wherein the picture parameters include: picture change rate, picture motion-to-still ratio; the network transmission parameters include: network bandwidth data and the current time interval of key frame transmission. The initial parameter acquisition module 802 acquires the current environment brightness and the current exposure parameters if the picture change rate is greater than the preset change rate. The quality bit rate adjustment module 803 adjusts the current quality bit rate of the image encoding according to the picture motion-to-still ratio to obtain the target quality bit rate. The exposure parameter adjustment module 804 adjusts the current exposure parameters according to the current environment brightness to obtain the target exposure parameters. The video data acquisition module 805 acquires video data according to the target exposure parameters and the target quality bit rate to obtain the target video data. The time interval adjustment module 806 adjusts the current time interval of the key frame transmission of the target video data according to the network bandwidth data to obtain the target time interval. The video data transmission module 807 transmits the target video data to the target device according to the target time interval.
[0121] The initial data acquisition module 801 acquires the current picture parameters in real time, and the picture parameters include the picture change rate and the picture motion-to-still ratio at the current moment, and acquires the current network transmission parameters in real time, and the network transmission parameters include the network bandwidth data at the current moment. The initial parameter acquisition module 802 compares the picture change rate with the preset change rate. If the picture change rate is greater than the preset change rate, the current ambient brightness is acquired to obtain the current ambient brightness, the current exposure parameters are acquired to obtain the current exposure parameters, the current quality bit rate is acquired to obtain the current quality bit rate, and the current time interval of key frame transmission is acquired to obtain the current time interval. The quality bit rate adjustment module 803 adjusts the current quality bit rate of image encoding to the corresponding quality bit rate value according to the picture motion-to-still ratio to obtain the target quality bit rate. The exposure parameter adjustment module 804 adjusts the current exposure parameter to the corresponding exposure parameter value according to the current ambient brightness to obtain the target exposure parameter. The video data acquisition module 805 acquires video data frame by frame according to the target exposure parameter and the target quality bit rate to obtain the target video data. The time interval adjustment module 806 adjusts the key frame transmission of the target video data according to the network bandwidth data to adjust the current time interval of the key frame transmission to the corresponding time interval value to obtain the target time interval. The video data transmission module 807 transmits the target video data to the target device according to the target time interval. By acquiring the current picture parameters and network transmission parameters, adjusting the current exposure parameters according to the current picture parameters to obtain the target exposure parameters, adjusting the current quality bit rate according to the current picture parameters to obtain the target quality bit rate, acquiring video data according to the target exposure parameters and the target quality bit rate to obtain the target video data, adjusting the current time interval of the key frame transmission of the target video data according to the network transmission parameters to obtain the target time interval, and transmitting the target video data to the target device according to the target time interval, the built-in parameters can be adjusted to improve the clarity of the picture when the picture changes greatly.
[0122] The operation process of the image processing device of this embodiment is specifically described as above. Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 , Figure 6 and Figure 7 The image processing method steps S101 to S107, steps S201 and S202, steps S301 to S303, steps S401 and S402, steps S501 and S502, steps S601 and S602 and step S701 are not repeated here.
[0123] Another embodiment of the present invention discloses an image processing device, comprising: at least one processor, and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the following steps: Figure 1 The control method steps S101 to S107, Figure 2 The control method steps S201 and S202, Figure 3 The control method steps S301 to S303, Figure 4 The control method steps S401 and S402, Figure 5 The control method steps S501 and S502, Figure 6 The control method steps S601 and S602 and Figure 7 The image processing method of step S701 of the control method.
[0124] Another embodiment of the present invention discloses a storage medium, the storage medium comprising: the storage medium stores computer executable instructions, the computer executable instructions are used to enable a computer to execute Figure 1 The control method steps S101 to S107, Figure 2 The control method steps S201 and S202, Figure 3 The control method steps S301 to S303, Figure 4 The control method steps S401 and S402, Figure 5 The control method steps S501 and S502, Figure 6 The control method steps S601 and S602 and Figure 7 The image processing method of step S701 of the control method.
[0125] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0126] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0127] The embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments. Various changes can be made within the knowledge of ordinary technicians in the relevant technical field without departing from the purpose of the present invention. In addition, the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
Claims
1. An image processing method, characterized in that: Applied to a network camera, the image processing method comprises: Acquire current picture parameters and network transmission parameters; wherein the picture parameters include: picture change rate, picture motion-static ratio; the network transmission parameters include: network bandwidth data; If the picture change rate is greater than the preset change rate, obtain the current environment brightness, current exposure parameters, current quality bit rate and current time interval of key frame transmission; Adjusting the current quality bit rate of the image encoding according to the motion-to-still ratio of the picture to obtain a target quality bit rate; Adjust the current exposure parameter according to the current ambient brightness to obtain a target exposure parameter; Collecting video data according to the target exposure parameter and the target quality bit rate to obtain target video data; Adjust the current time interval of key frame transmission of the target video data according to the network bandwidth data to obtain a target time interval; transmitting the target video data to a target device according to the target time interval; If the picture parameter is the picture motion-to-still ratio, obtaining the current picture parameter includes: A reference binary image is selected from pre-stored binary images according to a preset binary image threshold; The motion-to-still ratio of the reference binary image is calculated according to a preset motion-to-still ratio acquisition rule to obtain the motion-to-still ratio of the picture; wherein the motion-to-still ratio acquisition rule is set based on a frame difference method or a background method, and the reference binary image is detected according to the motion-to-still ratio acquisition rule to obtain image motion macroblocks and image static macroblocks, wherein the image motion macroblocks are used to indicate the number of image macroblock changes, and the image static macroblocks are used to indicate the number of image macroblocks that are static; the calculation process of the motion-to-still ratio of the picture includes: adding the image motion macroblocks to the image static macroblocks to obtain the total number of image macroblocks; and dividing the image motion macroblocks by the total number of image macroblocks to obtain the motion-to-still ratio of the picture; If the picture change rate is greater than a preset change rate, obtaining the current environment brightness includes: If the picture change rate is greater than a preset change rate, obtaining an image histogram of the current picture; Performing pixel calculation on the image histogram to obtain image pixel data; The brightness is calculated according to the image pixel data to obtain the current environment brightness.
2. The image processing method according to claim 1, characterized in that: The step of adjusting the current exposure parameter according to the current ambient brightness to obtain a target exposure parameter includes: If the current ambient brightness is lower than a lower limit of a preset ambient brightness range, the current exposure parameter is increased according to the preset ambient brightness range to obtain the target exposure parameter; If the current ambient brightness is higher than the upper limit of the ambient brightness range, the current exposure parameter is reduced according to the ambient brightness range to obtain the target exposure parameter.
3. The image processing method according to claim 1, characterized in that: The step of adjusting the current quality bit rate of the image encoding according to the motion-to-still ratio of the picture to obtain the target quality bit rate includes: If the picture motion-to-still ratio is greater than a preset motion-to-still ratio threshold, increasing the current quality bit rate according to a preset motion-to-still ratio adjustment range to obtain the target quality bit rate; If the picture motion-to-still ratio is less than the motion-to-still ratio threshold, the current quality bit rate is reduced according to the motion-to-still ratio adjustment range to obtain the target quality bit rate.
4. The image processing method according to claim 1, characterized in that: The step of adjusting the current time interval for transmitting the key frames of the target video data according to the network bandwidth data to obtain the target time interval includes: Calculate the network bandwidth usage based on the network bandwidth data to obtain the network bandwidth usage rate; If the network bandwidth usage is within a preset usage threshold range, the current time interval is adjusted to a preset time interval value to obtain the target time interval.
5. The image processing method according to any one of claims 1 to 4, characterized in that: The image processing method further comprises: If the motion-to-still ratio of the picture is less than a preset setting recovery threshold, the current exposure parameter is set to the pre-stored initial exposure parameter, the current quality bit rate is set to the pre-stored initial quality bit rate, and the current time interval is set to the pre-stored initial time interval.
6. An image processing device, characterized in that: Applied to a network camera, the image processing device comprises: The initial data acquisition module is used to acquire the current picture parameters and network transmission parameters; wherein the picture parameters include: picture change rate, picture motion-static ratio; the network transmission parameters include: network bandwidth data and current time interval of key frame transmission; The initial parameter acquisition module is used to obtain the current environment brightness, current exposure parameters, current quality bit rate and current time interval of key frame transmission if the picture change rate is greater than the preset change rate; A quality bit rate adjustment module, used for adjusting the current quality bit rate of image encoding according to the motion-to-still ratio of the picture to obtain a target quality bit rate; An exposure parameter adjustment module, used to adjust the current exposure parameter according to the current ambient brightness to obtain a target exposure parameter; A video data acquisition module, used to acquire video data according to the target exposure parameter and the target quality bit rate to obtain target video data; A time interval adjustment module, used for adjusting the current time interval of the key frame transmission of the target video data according to the network bandwidth data to obtain a target time interval; A video data transmission module, used to transmit the target video data to a target device according to the target time interval; If the picture parameter is the picture motion-to-still ratio, obtaining the current picture parameter includes: A reference binary image is selected from pre-stored binary images according to a preset binary image threshold; The motion-to-still ratio of the reference binary image is calculated according to a preset motion-to-still ratio acquisition rule to obtain the motion-to-still ratio of the picture; wherein the motion-to-still ratio acquisition rule is set based on a frame difference method or a background method, and the reference binary image is detected according to the motion-to-still ratio acquisition rule to obtain image motion macroblocks and image static macroblocks, wherein the image motion macroblocks are used to indicate the number of image macroblock changes, and the image static macroblocks are used to indicate the number of image macroblocks that are static; the calculation process of the motion-to-still ratio of the picture includes: adding the image motion macroblocks to the image static macroblocks to obtain the total number of image macroblocks; and dividing the image motion macroblocks by the total number of image macroblocks to obtain the motion-to-still ratio of the picture; If the picture change rate is greater than a preset change rate, obtaining the current environment brightness includes: If the picture change rate is greater than a preset change rate, obtaining an image histogram of the current picture; Performing pixel calculation on the image histogram to obtain image pixel data; The brightness is calculated according to the image pixel data to obtain the current environment brightness.
7. An image processing device, characterized in that: include: at least one processor, and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the image processing method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the image processing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Automatic exposure control method and device and storage medium
CN111614909A
Video transmission method and device, electronic equipment and storage medium
CN112312137A