Nighttime imaging control method and apparatus, electronic device, and storage medium
By acquiring parameter information of moving targets and adjusting EVS parameters in the camera's EVS mode, the problems of trailing and background blending in low light at night are solved, improving image quality and AI recognition performance.
Patent Information
- Application Number
- CN202311059278.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-21
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2043-08-21
AI Technical Summary
In low-light conditions at night, when the brightness of a moving target is similar to or the same as the background, it can cause the image to appear to have a trailing effect or blend into the background, affecting the AI recognition effect and image quality.
By acquiring parameter information of moving targets when the camera is shooting in EVS mode, determining the motion blur area, and adjusting the EVS parameters according to the grayscale value of the pixels until the motion blur length is less than the preset length, the imaging process is optimized.
It improves the imaging quality of moving targets at night, ensures accurate detection of moving targets in low-light environments, reduces trailing and background blending, and enhances the accuracy of AI recognition.
Smart Images

Figure CN119496990B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a night imaging control method, apparatus, electronic device, and storage medium. Background Technology
[0002] With societal development, nighttime video surveillance has become a crucial component of video monitoring. Due to poor lighting at night, the image quality of cameras is lower compared to daytime. When the color of a moving target is similar to or the same as the background, coupled with noise interference, it becomes difficult to accurately determine the target's direction and trajectory from the captured image. This results in issues such as motion blur, blending into the background, and increased noise in the image, which in turn affects AI's (Artificial Intelligence) recognition of faces, license plates, vehicle models, and also impacts the subjective visual experience.
[0003] Furthermore, due to poor lighting conditions at night, it is impossible to accurately determine the direction and trajectory of moving targets. This leads to the inability to use the most appropriate strategy to ensure image quality for moving targets during encoding. Consequently, when there are many moving targets, the encoding effect is usually poor, further reducing the imaging quality of moving targets at night. Therefore, improving the imaging quality of moving targets at night has become an urgent problem to be solved.
[0004] Most nighttime imaging technologies rely on changes between image frames to determine target motion. However, when the brightness of a moving target is similar to or the same as the background, the target's image can exhibit significant trailing or blending into the background, leading to lower accuracy. Some technologies use AI ISP (Artificial Intelligence Image Signal Processing) to address this issue. However, AI models have long training cycles, low iteration efficiency, and may require multiple training iterations to achieve the desired results. Summary of the Invention
[0005] This invention aims to at least partially solve one of the technical problems in related technologies. To this end, this invention provides a nighttime imaging control method, apparatus, electronic device, and storage medium to address the problem of large trailing or blending into the background caused by low ambient light and moving targets having similar or identical brightness to the background, thereby improving the imaging quality of moving targets at night.
[0006] This invention provides a nighttime imaging control method, comprising:
[0007] When a moving target is present in the target video captured by the camera in Event Vision Sensor (EVS) mode, the parameter information of the moving target is obtained, and the motion blur region is determined in the target image where the moving target is located based on the parameter information.
[0008] Obtain the grayscale value of each pixel in the trailing region, and determine the trailing length based on the grayscale value of each pixel;
[0009] If the trailing shadow length is greater than or equal to the preset length, adjust the EVS parameters of the EVS mode until the trailing shadow length is less than the preset length to obtain the target EVS parameters, and control the camera to perform night shooting imaging with the target EVS parameters.
[0010] In some possible implementations, the parameter information includes the motion position and motion direction; determining the trailing region in the target image where the moving target is located based on the parameter information includes: performing filtering and edge extraction processing on the target image to obtain a target sub-image; and determining the trailing region based on the motion position and the motion direction on the opposite side of the motion direction.
[0011] In some possible implementations, determining the trailing length based on the grayscale value of each pixel includes: taking the first pixel of the trailing region as the starting point and moving in the opposite direction of the movement direction, sequentially comparing the grayscale value of each pixel with a preset grayscale value; if the grayscale value of the first pixel is greater than or equal to the preset grayscale value, determining the pixel as a first target pixel; if the grayscale value of the pixel and the grayscale values of a preset number of pixels longitudinally adjacent to the pixel are less than the preset grayscale value, determining the pixel as a second target pixel; and determining the trailing length based on the first target pixel and the second target pixel.
[0012] In some possible implementations, determining the trail length based on the first target pixel and the second target pixel includes: acquiring first coordinate data of the first target pixel in the image and second coordinate data of the second target pixel in the image; and determining the trail length based on the first coordinate data and the second coordinate data.
[0013] In some possible implementations, the step of filtering and edge extraction of the target image to obtain a target sub-image includes: cropping the target image according to the motion position and the motion direction; and filtering and edge extraction of the cropped target image to obtain the target sub-image.
[0014] In some possible implementations, the method further includes: acquiring the gain value of the camera; and controlling the camera to shoot in the EVS mode if the gain value is greater than or equal to a preset gain value.
[0015] In some possible implementations, the method further includes: acquiring an initial video captured by the camera in the EVS mode, the initial video including the moving target; acquiring contour information of the moving target; if the contour information determines that the moving target includes a human body, adjusting the shutter speed of the camera to a first preset value; if the contour information determines that the moving target includes a vehicle, adjusting the shutter speed of the camera to a second preset value, the second preset value being less than the first preset value; and controlling the camera to capture the target video at the adjusted shutter speed.
[0016] The present invention also provides a night imaging control device, comprising: a moving target detection module, configured to acquire parameter information of the moving target when a moving target is present in a target video captured by a camera in EVS mode, and determine a trailing shadow region in the target image where the moving target is located based on the parameter information; a trailing shadow length determination module, configured to acquire the grayscale value of each pixel in the trailing shadow region, and determine the trailing shadow length based on the grayscale value of each pixel; and an adjustment module, configured to adjust the EVS parameters of the EVS mode when the trailing shadow length is greater than or equal to a preset length, until the trailing shadow length is less than the preset length, thereby obtaining target EVS parameters, and controlling the camera to perform night imaging with the target EVS parameters.
[0017] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the night imaging control method as described above.
[0018] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the night imaging control method as described above.
[0019] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements any of the night imaging control methods described above.
[0020] The present invention provides a nighttime imaging control method, device, electronic device, and storage medium. By controlling a camera to shoot in EVS mode at night, when a moving target is present in the target video captured by the camera in EVS mode, the method acquires the parameter information of the moving target and determines the trailing area in the target image where the moving target is located based on the parameter information. Then, it acquires the grayscale value of each pixel in the trailing area and determines the trailing length based on the grayscale value of each pixel. When the trailing length is greater than or equal to a preset length, the EVS parameters of the EVS mode are adjusted until the trailing length is less than the preset length. By adjusting the EVS parameters, the camera becomes more sensitive to the detection of moving targets. Even when the brightness of the moving target is similar to or the same as the background, the camera can still accurately detect the moving target. This solves the problem of large trailing or blending into the background caused by low ambient light and the brightness of the moving target being similar to or the same as the background, thus improving the imaging quality of moving targets at night. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0022] Figure 1 This is one of the flowcharts of the night imaging control method according to an embodiment of the present invention;
[0023] Figure 2 This is the second flowchart of the night imaging control method according to an embodiment of the present invention;
[0024] Figure 3 This is a schematic diagram of the target image and target sub-images in a specific example of the present invention;
[0025] Figure 4 This is the third flowchart of the night imaging control method according to an embodiment of the present invention;
[0026] Figure 5 This is the fourth flowchart of the night imaging control method according to an embodiment of the present invention;
[0027] Figure 6 This is the fifth flowchart of the night imaging control method according to an embodiment of the present invention;
[0028] Figure 7 This is the sixth flowchart of the night imaging control method according to an embodiment of the present invention;
[0029] Figure 8 This is a flowchart of a specific example of a night imaging control method according to the present invention;
[0030] Figure 9 This is a block diagram of a night imaging control device according to an embodiment of the present invention;
[0031] Figure 10 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0033] Figure 1 This is one of the flowcharts for the night imaging control method according to an embodiment of the present invention. For example... Figure 1 As shown, the night imaging control method may include the following steps:
[0034] Step 110: If there is a moving target in the target video captured by the camera in Event Vision Sensor (EVS) mode, obtain the parameter information of the moving target, and determine the trailing area in the target image where the moving target is located based on the parameter information.
[0035] First, it should be noted that the execution entity of the night imaging control method in this embodiment of the invention can be the processing chip in a camera, which can be a surveillance camera supporting EVS technology. Specifically, the camera is equipped with an EVS (Event Vision Sensor), which can detect changes in the brightness of each pixel and, combined with "coordinates" and "time information," output only the data corresponding to the changed pixels, thereby achieving high-efficiency, high-speed, and low-latency data output.
[0036] In this embodiment, the camera includes two shooting modes: a regular shooting mode and an EVS mode. During the daytime when there is sufficient natural light, the camera can be controlled to record or capture images in regular mode. This is because in well-lit environments, the direction, trajectory, and speed of moving targets can be accurately determined from the images, ensuring high-quality output images. In this case, the regular shooting mode is sufficient for the application.
[0037] When in low light conditions at night, the camera can be controlled to record or capture images in EVS mode. As ambient light decreases, noise increases, and image brightness decreases, it becomes extremely difficult to accurately determine the motion state of a moving target when its brightness is similar to or the same as the background. In this case, EVS is needed to output image or video data to the processing chip in the camera.
[0038] When a camera shoots video in EVS mode, if a moving target is present in the video, EVS will output not only the video data to the processing chip, but also the moving target's position, orientation, and outline information within the image. Therefore, when a moving target is present in the video captured by the camera, its parameter information can be obtained through EVS.
[0039] It should be noted that the moving target can be any moving object such as a pedestrian or vehicle, the target video can be video data of a moving target, and the parameter information can be the position, direction, and outline information of the moving target, etc.
[0040] After obtaining the parameter information of the moving target, the motion blur region in the target image can be determined based on this information. It should be noted that the target image can be any frame from the target video containing the moving target, and the motion blur region refers to the blur effect caused by the camera capturing the moving target. Obviously, in the image, the motion blur region is generally located behind the moving target. Therefore, the position behind the moving target can be determined based on its location and direction of movement, thus identifying the motion blur region.
[0041] Step 120: Obtain the grayscale value of each pixel in the trailing region, and determine the trailing length based on the grayscale value of each pixel.
[0042] Once the target image is determined, it can first be converted into a grayscale image. After identifying the trailing area, the grayscale values of each pixel in the target image can be collected. Then, the length of the trailing image in the target image can be determined based on the grayscale values of each pixel in the trailing area. The larger the trailing length value, the worse the image quality of the moving target captured by the camera; the smaller the trailing length value, the better the image quality of the moving target captured by the camera.
[0043] Step 130: If the trailing shadow length is greater than or equal to the preset length, adjust the EVS parameters of the EVS mode until the trailing shadow length is less than the preset length to obtain the target EVS parameters, and control the camera to perform night shooting imaging with the target EVS parameters.
[0044] It should be noted that the preset length can be set manually by staff according to actual needs, and there are no specific restrictions here.
[0045] After obtaining the trailing length in the target image, it can be compared with a preset length. If the trailing length is less than the preset length, the target image is considered to meet the standard and have good image quality; if the trailing length is greater than or equal to the preset length, the target image is considered to not meet the standard and have poor image quality. Therefore, when the trailing length is greater than or equal to the preset length, the EVS parameters of the EVS mode are adjusted to make the camera more sensitive to the detection of moving targets, thereby reducing the degree of trailing. In this embodiment, the EVS parameters can be the voltage value, current value, etc. of the EVS.
[0046] After adjusting the EVS parameters, a new target image is acquired, and the trailing area in the target image is determined. The target image is then converted into a grayscale image. Finally, the trailing length of the new target image is determined based on the grayscale value of the trailing area. If the trailing length is still greater than or equal to the preset length, the EVS parameters of the EVS mode are adjusted again, and the above steps are repeated until the trailing length is less than the preset length. The EVS parameters at this time can be used as the target EVS parameters, and the camera is controlled to monitor the video using the target EVS parameters.
[0047] In this embodiment, if the trailing shadow length is greater than or equal to a preset length, not only can the EVS parameters of the EVS mode be adjusted, but different spatiotemporal noise reduction methods can also be used for moving and stationary targets respectively to denoise the video data. For example, when denoising moving targets, 3D noise reduction can be used less or even not at all, and 2D noise reduction can be used more to improve the problem of moving targets trailing or blending into the background. In addition, other camera parameters can be adjusted to improve nighttime image quality, such as sharpness, brightness, etc.
[0048] Therefore, by calculating the length of the trailing shadow in the image and continuously adjusting the EVS parameters, the captured video or image data can meet the required standards. This solves the problem of large trailing shadows or blending into the background when the ambient light is low and the brightness of the moving target is similar to or the same as the background, effectively improving the imaging quality of moving targets at night.
[0049] In some implementations, the parameter information includes the position and direction of motion. Figure 2 This is the second flowchart of the night imaging control method according to an embodiment of the present invention. Figure 2 As shown, step 110, which involves determining the trailing region in the target image based on parameter information, may include the following steps:
[0050] Step 210: Filter and extract edges from the target image to obtain the target sub-image.
[0051] Step 220: On the opposite side of the direction of motion, determine the trailing area based on the position and direction of motion.
[0052] It should be noted that the position of a moving target can be its coordinates in the target image.
[0053] In this embodiment, the target image can be filtered and edge extracted first to remove most of the noise in the target image and obtain a target sub-image with strong edges, thereby improving the accuracy of subsequent calculation and detection. Figure 3 This is a schematic diagram of the target image and target sub-images as a specific example of the present invention, as shown below. Figure 3 As shown, after the target image is filtered and edge extraction is performed, the outline, position, etc. of the moving target can be clearly determined.
[0054] Filtering methods for a target image include Gaussian filtering, mean filtering, and median filtering, among others. For example, Gaussian filtering involves calculating a weighted average of the target image values; each pixel's value is obtained by weighted averaging of its own value and the values of its neighboring pixels. No specific restrictions are placed on the filtering method here.
[0055] Edges in an image are locations where pixel values transition, and are one of the image's salient features, playing an important role in image feature extraction and object detection. Changes in grayscale values in an image create gradients, resulting in edges, where the intensity and direction of these changes are evident.
[0056] Edge extraction of a target image can be performed by using the first or second derivative to calculate the gradient, and then extracting edges based on the gradient. In this embodiment, the choice between using the first or second derivative to calculate the gradient can be determined based on the edge features of the target image. Calculating the first or higher derivatives of the target image will yield some peaks. When these peaks exceed a specified threshold, the pixels corresponding to these peaks are considered edges. After determining the edges, they can be extracted. The specific edge extraction process can be found in existing image edge extraction procedures, which will not be elaborated here.
[0057] Understandably, the trailing shadow region is usually located behind the moving target. After obtaining the target sub-image, the location of the trailing shadow region can be determined based on the movement position and direction of the moving target within the sub-image. As an example, please refer to... Figure 3 , Figure 3 If the moving target's direction of motion is to the left, the right-hand region of the moving target in the target sub-image (excluding the moving target itself) can be considered as the trailing shadow region. Figure 3 The area where the white box 301 is located.
[0058] In some implementations, the contour information of the moving target can also be obtained, i.e., the coordinate values of the contour of the moving target in the target sub-image. Based on the contour coordinate values and the direction of movement, a boundary line is first determined, and then the shadow region is determined based on the boundary line. As an example, please refer to [reference needed]. Figure 3 , Figure 3 If the moving target is moving to the left, then the outline on the right side of the moving target can be used as the boundary line. Then, using the boundary line as a reference, the area to the right of the boundary line can be considered the trailing shadow area. Figure 3 The white box 301 in the middle is the motion blur.
[0059] In some implementations, step 210, which involves filtering and edge extraction of the target image to obtain a target sub-image, may include: cropping the target image based on its motion position and direction; and then filtering and edge extraction of the cropped target image to obtain the target sub-image.
[0060] Specifically, when a moving target moves into a simple background lacking complex details, the moving target can be cropped first. Cropping can select the moving target itself and a region behind it with a width of x pixels, where x can be a large value to ensure the cropped image includes the complete motion blur. Further, the cropped target image is filtered and edge-extracted to obtain a target sub-image. This reduces the processing time for filtering and edge extraction, accelerating motion blur detection.
[0061] Figure 4 This is the third flowchart of the night imaging control method according to an embodiment of the present invention. Figure 4 As shown, in some embodiments, determining the trailing length based on the grayscale value of each pixel in step 120 may include the following steps:
[0062] Step 410: Starting from the first pixel in the trailing area and moving in the opposite direction of the motion, compare the grayscale value of each pixel with the preset grayscale value.
[0063] Step 420: If the grayscale value of the first pixel is greater than or equal to the preset grayscale value, determine the pixel as the first target pixel.
[0064] Step 430: If the gray value of a pixel and the gray values of a preset number of pixels that are vertically adjacent to the pixel are less than a preset gray value, then the pixel is determined as the second target pixel.
[0065] Step 440: Determine the trail length based on the first target pixel and the second target pixel.
[0066] It should be noted that the preset grayscale values can be manually set by staff according to actual needs, and there are no specific restrictions here.
[0067] Specifically, detection can begin from the first pixel in the trailing shadow region. Here, the first pixel can be the pixel closest to the moving target and located on top of the target sub-image. Further, along the opposite direction of the moving target's movement, the grayscale value of each pixel is sequentially checked to see if it is greater than a preset grayscale value. If the grayscale value of a pixel is less than the preset grayscale value, it indicates that the pixel is not a trailing shadow point; if the grayscale value of a pixel is greater than or equal to the preset grayscale value, it indicates that the pixel is a trailing shadow point.
[0068] In this embodiment, a coordinate system can be established with any point in the target sub-image as the origin, and each pixel has a corresponding coordinate value. This is so that the shadow length can be calculated later based on the coordinates.
[0069] When a pixel's grayscale value is detected to be greater than or equal to a preset grayscale value for the first time, its coordinates P(p, q) are recorded, and this pixel becomes the first target pixel. Then, along the horizontal axis in the opposite direction of the movement, the detection continues to check if any pixel is a trailing point. If the grayscale values of all subsequent pixels are greater than or equal to the preset grayscale value, the detection continues horizontally. If a pixel's grayscale value is less than the preset grayscale value, its coordinates M(m, n) are recorded, and the detection continues vertically from pixel M.
[0070] When performing detection along the vertical direction starting from this pixel, the detection range can be n±α, where α can be set manually according to actual needs. Specifically, α pixels above point M and α pixels below point M are detected. If a pixel with a grayscale value greater than or equal to a preset grayscale value is detected again, the coordinate value F(f, t) of that pixel can be recorded, and detection is performed again along the opposite horizontal direction of the movement, starting from point W.
[0071] Repeat the above process until a pixel is found whose grayscale value is less than a preset grayscale value, and whose grayscale values are also less than the preset grayscale value for the pixels above and below it (α pixels). This pixel can then be considered the end point of the trail (i.e., the second target pixel), and its coordinates W(w, v) can be recorded. Finally, the length of the trail in the target sub-image can be determined based on the first and second target pixels.
[0072] Figure 5 This is the fourth flowchart of the night imaging control method according to an embodiment of the present invention. Figure 5As shown, in some embodiments, determining the trail length based on the first target pixel and the second target pixel in step 440 may include the following steps:
[0073] Step 510: Obtain the first coordinate data of the first target pixel in the image and the second coordinate data of the second target pixel in the image.
[0074] Step 520: Determine the trail length based on the first coordinate data and the second coordinate data.
[0075] Specifically, the straight-line distance between the first coordinate data of the first target pixel and the second coordinate data of the second target pixel in the image can be calculated, and this straight-line distance can be used as the trailing shadow length. Alternatively, the trailing shadow length can be calculated based on the abscissas in the first and second coordinate data. In this embodiment, the abscissas in the first and second coordinate data are mainly used to calculate the trailing shadow length.
[0076] During the motion blur detection process, the coordinates of the first and second target pixels are recorded. At this point, the coordinates P(p, q) of the first target pixel can be retrieved as the first coordinate data, and the coordinates W(w, v) of the second target pixel can be retrieved as the second coordinate data. After obtaining the first and second coordinate data, the motion blur length can be calculated using the following formula:
[0077] L = |wp|
[0078] Where L is the trail length, w is the x-coordinate of the second target pixel, and p is the x-coordinate of the first target pixel.
[0079] After obtaining the trailing shadow length using the above method, you can adjust the EVS parameters, noise reduction, and other parameters of the EVS mode according to the trailing shadow length.
[0080] Figure 6 This is the fifth flowchart of the night imaging control method according to an embodiment of the present invention. Figure 6 As shown, in some implementations, the camera can be controlled to switch shooting modes via the following steps:
[0081] Step 610: Obtain the camera's gain value.
[0082] Step 620: When the gain value is greater than or equal to the preset gain value, control the camera to shoot in EVS mode.
[0083] It should be noted that gain refers to a technique used during camera shooting to increase image brightness by increasing the signal amplification of the camera. A higher gain indicates lower ambient light intensity. Furthermore, preset gain values can be manually set by staff according to actual needs; no specific restrictions are imposed here.
[0084] Specifically, you can first control the camera to shoot in normal mode. During shooting, the current gain value can be obtained from the camera's processing chip in real time. After obtaining the gain value, compare it with the preset gain value. If the detected gain value is less than the preset gain value, it indicates that the ambient lighting around the camera is good and does not affect the image quality. If the detected gain value is greater than or equal to the preset gain value, it indicates that the ambient lighting around the camera is low and has affected the image quality. In this case, you need to control the camera to switch from normal shooting mode to EVS mode for subsequent shooting.
[0085] Similarly, when the camera is shooting in EVS mode, it still acquires the current gain value in real time. When the gain value is detected to be less than the preset gain value, the camera can be controlled to switch from EVS mode to normal shooting mode.
[0086] Figure 7 This is the sixth flowchart of the night imaging control method according to an embodiment of the present invention. Figure 7 As shown, in some implementations, the imaging quality of the camera can also be improved through the following steps:
[0087] Step 710: Acquire the initial video captured by the camera in EVS mode. The initial video includes a moving target. Obtain the contour information of the moving target.
[0088] Step 720: If the moving target is determined to include a human body based on the contour information, adjust the camera shutter speed to the first preset value.
[0089] Step 730: If the moving target is determined to include a vehicle based on the contour information, adjust the camera shutter speed to a second preset value, which is less than the first preset value.
[0090] Step 740: Control the camera to capture the target video at the adjusted shutter speed.
[0091] It should be noted that the first and second preset values can be set by staff based on experience.
[0092] Specifically, when the camera shoots in EVS mode, if there is a moving target in the initial video, EVS will output the moving target's position, orientation, and contour information in the image to the processing chip along with the video data. It should be noted that the contour information can be the coordinate values of the moving target's contour in the image.
[0093] After obtaining the contour information, the type of moving target can be determined based on the contour information. The type can be a human body, a vehicle, etc. Then, the shutter speed is adjusted according to the type of moving target to prevent the problem of ghosting caused by a slow shutter speed. Since different moving targets have different speeds, this embodiment adjusts the shutter speed according to the type of moving target, which can more quickly and accurately adjust the shutter speed to the required speed.
[0094] In this embodiment, an existing contour recognition model can be used to determine the type of moving target. Specifically, contour information can be input into a trained contour recognition model, and the contour recognition model can classify the contour information to obtain the type of moving target.
[0095] When the moving target is determined to include a human body, the shutter speed can be initially adjusted to a first preset value, and then continuously adjusted based on the first preset value until the camera produces no ghosting when capturing the moving target. Similarly, when the moving target is determined to include a vehicle, the shutter speed can be initially adjusted to a second preset value, and then continuously adjusted based on the second preset value until the camera produces no ghosting when capturing the moving target.
[0096] If there are no moving targets in the initial video, the shutter speed can be restored to the normal value to ensure image brightness and image quality.
[0097] Therefore, the type of moving target is first determined based on its outline information. Then, the shutter speed is adjusted to a preset speed based on the target type. This speed is then continuously adjusted to reach a suitable shutter speed more quickly. Furthermore, adjusting the shutter speed effectively prevents ghosting when shooting moving targets, further improving the image quality of the camera's output.
[0098] In some implementations, improving camera image quality can also include: the camera can detect in real time whether mosaic is present in the captured video; if mosaic is present, encoding-related parameters, such as code control strategies, can be adjusted to further improve the image quality of the camera's output. Existing detection methods can be used to detect the presence of mosaic in the video, and will not be elaborated upon here.
[0099] To facilitate understanding, the night imaging control method of this invention will be further described below with a specific example. Figure 8 This is a flowchart of a nighttime imaging control method, a specific example of the present invention. For example... Figure 8 As shown, the night imaging control method may further include the following steps:
[0100] Step 810: When the camera is operating in normal shooting mode, acquire the camera's gain value in real time.
[0101] Step 820: Determine whether the gain value is greater than or equal to the preset gain value. If not, continue working in the normal shooting mode. If yes, proceed to step 830.
[0102] Step 830: Control the camera to work in EVS mode.
[0103] Step 840: Determine whether a moving target is detected. If not, do nothing. If yes, obtain the contour information of the moving target and adjust the shutter speed according to the contour information.
[0104] Step 850: Calculate the trailing shadow length and determine whether the trailing shadow length is greater than or equal to the preset length. If not, proceed to step 840; if yes, proceed to step 860.
[0105] Step 860: Adjust EVS parameters, spatiotemporal noise reduction, and other image-related parameters.
[0106] Step 870: Determine whether mosaic is detected. If not, proceed to step 850; if yes, proceed to step 880.
[0107] Step 880: Adjust encoding-related parameters.
[0108] Step 890: Determine whether the gain value is less than the preset gain value. If not, proceed to step 840; if yes, proceed to step 810.
[0109] Therefore, in low-light conditions where the brightness of the moving target is similar to or the same as the background, adjusting the shutter speed when a moving target is detected prevents motion blur and improves the image quality of the night camera output. By determining the length of the target image's trail, it is possible to determine whether there is trailing or blending into the background in the captured image. When the trail length is greater than or equal to a preset length, EVS parameters, spatiotemporal noise reduction, and other image-related parameters are adjusted to improve the camera's sensitivity to moving targets, thereby further improving the image quality of the night camera output. By detecting whether there is mosaic in the captured image, and adjusting encoding-related parameters when mosaic is present, the image quality of the night camera output is improved once again.
[0110] Figure 9 This is a block diagram of a night imaging control device according to an embodiment of the present invention. Figure 9 As shown, the night imaging control device 900 may include:
[0111] The moving target detection module 910 is used to acquire parameter information of the moving target when there is a moving target in the target video captured by the camera in EVS mode, and to determine the trailing area in the target image where the moving target is located based on the parameter information.
[0112] The trailing length determination module 920 is used to obtain the grayscale value of each pixel in the trailing area and determine the trailing length based on the grayscale value of each pixel.
[0113] The adjustment module 930 is used to adjust the EVS parameters of the EVS mode when the trailing shadow length is greater than or equal to the preset length, until the trailing shadow length is less than the preset length, to obtain the target EVS parameters, and control the camera to perform night shooting imaging with the target EVS parameters.
[0114] Therefore, by controlling the camera to shoot in EVS mode at night, when there is a moving target in the target video captured by the camera in EVS mode, the moving target detection module 910 obtains the parameter information of the moving target and determines the trailing area in the target image where the moving target is located based on the parameter information; the trailing length determination module 920 then obtains the gray value of each pixel in the trailing area and determines the trailing length based on the gray value of each pixel; when the trailing length is greater than or equal to the preset length, the adjustment module 930 adjusts the EVS parameters of the EVS mode until the trailing length is less than the preset length. By adjusting the EVS parameters, the camera becomes more sensitive to the detection of moving targets. When the brightness of the moving target is similar to or the same as the background, the camera can still detect the moving target, thereby solving the problem of large trailing or blending into the background caused by low ambient light and the brightness of the moving target being similar to or the same as the background, and improving the imaging quality of moving targets at night.
[0115] Based on any of the above embodiments, the parameter information includes the motion position and motion direction; the moving target detection module 910 is specifically used for:
[0116] The target image is filtered and edge-extracted to obtain a target sub-image;
[0117] On the opposite side of the direction of motion, the trailing area is determined based on the position and direction of motion.
[0118] Based on any of the above embodiments, the trailing shadow length determination module 920 is specifically used for:
[0119] Starting from the first pixel in the trailing region and moving in the opposite direction of the motion direction, the grayscale value of each pixel is compared with a preset grayscale value in sequence.
[0120] If the grayscale value of the first pixel is greater than or equal to the preset grayscale value, the pixel is determined to be the first target pixel.
[0121] If the gray value of the pixel and the gray value of a preset number of pixels that are vertically adjacent to the pixel are less than the preset gray value, the pixel is determined to be the second target pixel.
[0122] The trail length is determined based on the first target pixel and the second target pixel.
[0123] Based on any of the above embodiments, the trailing shadow length determination module 920 is further specifically used for:
[0124] Obtain the first coordinate data of the first target pixel in the image and the second coordinate data of the second target pixel in the image;
[0125] The length of the trail is determined based on the first coordinate data and the second coordinate data.
[0126] Based on any of the above embodiments, the moving target detection module 910 is further specifically used for:
[0127] The target image is cropped according to the motion position and the motion direction;
[0128] The cropped target image is filtered and edge-extracted to obtain the target sub-image.
[0129] Based on any of the above embodiments, the night imaging control device 900 further includes:
[0130] Gain value acquisition module, used to acquire the gain value of the camera;
[0131] The shooting module is used to control the camera to shoot in the EVS mode when the gain value is greater than or equal to the preset gain value.
[0132] Based on any of the above embodiments, the night imaging control device 900 further includes:
[0133] The video acquisition module is used to acquire the initial video captured by the camera in the EVS mode, wherein the initial video includes the moving target, and to acquire the contour information of the moving target;
[0134] An adjustment module is used to adjust the shutter speed of the camera to a first preset value when it is determined from the contour information that the moving target includes a human body.
[0135] The adjustment module is further configured to adjust the shutter speed of the camera to a second preset value when it is determined from the contour information that the moving target includes a vehicle, wherein the second preset value is less than the first preset value;
[0136] The control module is used to control the camera to capture the target video at an adjusted shutter speed.
[0137] It should be noted that for details not disclosed in the night imaging control device of this embodiment, please refer to the details disclosed in the embodiments of the night imaging control method in this specification, which will not be repeated here.
[0138] Figure 10 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 10 As shown, the electronic device may include a processor 1010, a communications interface 1020, a memory 1030, and a communication bus 1040, wherein the processor 1010, the communications interface 1020, and the memory 1030 communicate with each other via the communication bus 1040. The processor 1010 can call logic instructions in the memory 1030 to execute a night imaging control method, which includes: when a moving target is present in the target video captured by the camera in Event Vision Sensor (EVS) mode, acquiring parameter information of the moving target, and determining a trailing shadow region in the target image where the moving target is located based on the parameter information; acquiring the grayscale value of each pixel in the trailing shadow region, and determining the trailing shadow length based on the grayscale value of each pixel; when the trailing shadow length is greater than or equal to a preset length, adjusting the EVS parameters of the EVS mode until the trailing shadow length is less than the preset length, obtaining the target EVS parameters, and controlling the camera to perform night imaging with the target EVS parameters.
[0139] Furthermore, the logical instructions in the aforementioned memory 1030 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0140] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the night imaging control method provided by the above methods. The method includes: when there is a moving target in the target video captured by the camera in Event Vision Sensor (EVS) mode, acquiring parameter information of the moving target, and determining a trailing shadow region in the target image where the moving target is located based on the parameter information; acquiring the grayscale value of each pixel in the trailing shadow region, and determining the trailing shadow length based on the grayscale value of each pixel; when the trailing shadow length is greater than or equal to a preset length, adjusting the EVS parameters of the EVS mode until the trailing shadow length is less than the preset length, obtaining the target EVS parameters, and controlling the camera to perform night imaging with the target EVS parameters.
[0141] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the night imaging control method provided by the above methods. The method includes: when a moving target is present in a target video captured by a camera in Event Vision Sensor (EVS) mode, acquiring parameter information of the moving target, and determining a trailing region in the target image where the moving target is located based on the parameter information; acquiring the grayscale value of each pixel in the trailing region, and determining the trailing length based on the grayscale value of each pixel; when the trailing length is greater than or equal to a preset length, adjusting the EVS parameters of the EVS mode until the trailing length is less than the preset length, obtaining target EVS parameters, and controlling the camera to perform night imaging with the target EVS parameters.
[0142] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0143] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A nighttime imaging control method, characterized in that, include: When a moving target is present in the target video captured by the camera in Event Vision Sensor (EVS) mode, parameter information of the moving target is acquired, and a motion blur region is determined in the target image where the moving target is located based on the parameter information; the parameter information includes the direction of motion. Obtain the grayscale value of each pixel in the trailing region, and determine the trailing length based on the grayscale value of each pixel; If the trailing shadow length is greater than or equal to the preset length, adjust the EVS parameters of the EVS mode until the trailing shadow length is less than the preset length to obtain the target EVS parameters, and control the camera to perform night shooting imaging with the target EVS parameters; Determining the trail length based on the grayscale value of each pixel includes: Starting from the first pixel in the trailing region and moving in the opposite direction of the motion direction, the grayscale value of each pixel is compared with a preset grayscale value in sequence. If the grayscale value of the first pixel is greater than or equal to the preset grayscale value, the pixel is determined to be the first target pixel. If the gray value of the pixel and the gray value of a preset number of pixels that are vertically adjacent to the pixel are less than the preset gray value, the pixel is determined to be the second target pixel. The trail length is determined based on the first target pixel and the second target pixel.
2. The night imaging control method according to claim 1, characterized in that, The parameter information also includes the motion position; Determining the motion shadow region in the target image where the moving target is located based on the parameter information includes: The target image is filtered and edge-extracted to obtain a target sub-image; On the opposite side of the direction of motion, the trailing area is determined based on the position and direction of motion.
3. The night imaging control method according to claim 1, characterized in that, Determining the trail length based on the first target pixel and the second target pixel includes: Obtain the first coordinate data of the first target pixel in the image and the second coordinate data of the second target pixel in the image; The length of the trail is determined based on the first coordinate data and the second coordinate data.
4. The night imaging control method according to claim 2, characterized in that, The step of filtering and edge extraction of the target image to obtain a target sub-image includes: The target image is cropped according to the motion position and the motion direction; The cropped target image is filtered and edge-extracted to obtain the target sub-image.
5. The night imaging control method according to any one of claims 1-4, characterized in that, The method further includes: Obtain the gain value of the camera; When the gain value is greater than or equal to the preset gain value, the camera is controlled to shoot in the EVS mode.
6. The night imaging control method according to any one of claims 1-4, characterized in that, The method further includes: Acquire the initial video captured by the camera in the EVS mode, the initial video including the moving target, and acquire the contour information of the moving target; If the moving target is determined to include a human body based on the contour information, the shutter speed of the camera is adjusted to a first preset value; If the moving target is determined to include a vehicle based on the contour information, the shutter speed of the camera is adjusted to a second preset value, which is less than the first preset value. Control the camera to capture the target video at the adjusted shutter speed.
7. A night imaging control device, characterized in that, include: A moving target detection module is used to acquire parameter information of a moving target in a target video captured by a camera in EVS mode, and to determine a motion shadow region in the target image where the moving target is located based on the parameter information; the parameter information includes the direction of motion. The trailing shadow length determination module is used to obtain the grayscale value of each pixel in the trailing shadow area and determine the trailing shadow length based on the grayscale value of each pixel. The adjustment module is used to adjust the EVS parameters of the EVS mode when the trailing shadow length is greater than or equal to the preset length, until the trailing shadow length is less than the preset length, to obtain the target EVS parameters, and control the camera to perform night shooting imaging with the target EVS parameters. The trail length determination module is specifically used for: Starting from the first pixel in the trailing region and moving in the opposite direction of the motion direction, the grayscale value of each pixel is compared with a preset grayscale value in sequence. If the grayscale value of the first pixel is greater than or equal to the preset grayscale value, the pixel is determined to be the first target pixel. If the gray value of the pixel and the gray value of a preset number of pixels that are vertically adjacent to the pixel are less than the preset gray value, the pixel is determined to be the second target pixel. The trail length is determined based on the first target pixel and the second target pixel.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the night imaging control method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the night imaging control method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Image smear processing method and device, equipment and medium
CN112330544A
Smear detecting method and image processor employing the smear detecting method
JP2003174642A