Camera occlusion detection method, device, electronic device and storage medium

By dividing the picture into a target area and a non-target area, and calculating the area ratio, it automatically detects whether the camera is blocked, and solves the problem of repeated work caused by camera blocking, saving human resources and improving work efficiency.

CN112116551BActive Publication Date: 2025-02-14TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910537620.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-06-20
Publication Date
2025-02-14
Estimated Expiration
2039-10-24

AI Technical Summary

Technical Problem

When a user takes photos or records a video, the camera may be blocked, causing the photos or video to not meet the requirements, requiring repeated work and a waste of manpower.

Method used

Through the threshold value corresponding to the characteristic information of the preset color, the picture is divided into a target area and a non-target area, and the ratio of the area of ​​the target area to the area of ​​the picture is determined. If the ratio is greater than the preset ratio, it is judged that the camera is blocked, and The color of the occluded object matches the preset color.

Benefits of technology

It realizes automatic detection of whether the camera is blocked, saves human resources and improves work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112116551B_ABST
    Figure CN112116551B_ABST
Patent Text Reader

Abstract

The present application discloses a camera occlusion detection method, device, electronic device and storage medium, the method comprising: dividing a picture into a target area and a non-target area according to a threshold value corresponding to feature information of a preset color, the target area is associated with a preset color, and the picture is acquired through a camera. Determine the ratio of the area of ​​the target area to the area of ​​the picture; if the ratio is greater than the preset ratio, determine that the camera is occluded at the moment of acquiring the picture, and the color of the object occluding the camera matches the preset color. In this way, human resources can be saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet communication technology, and in particular to a camera occlusion detection method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of computer technology, informatization plays an increasingly important role in human social life. When using a terminal (desktop computer, laptop computer, mobile phone, tablet computer), a user can use a camera to take pictures or use a camera to record videos.

[0003] However, when a user is taking photos or recording videos, a part of the user's body may block the camera, which may result in the photo not meeting the user's requirements or a certain segment in the recorded video not meeting the user's needs, ultimately causing the user to repeat work and waste manpower.

[0004] The embodiments of the present application provide a camera occlusion detection method, device, electronic device and storage medium, which can save human resources. Summary of the invention

[0005] The embodiments of the present application provide a camera occlusion detection method, device, electronic device and storage medium, which can save human resources.

[0006] On the one hand, an embodiment of the present application provides a camera occlusion detection method, the method comprising:

[0007] The image is divided into a target area and a non-target area according to a threshold value corresponding to characteristic information of a preset color; the target area is associated with the preset color, and the image is obtained through a camera;

[0008] Determine the ratio of the area of ​​the target region to the area of ​​the image;

[0009] If the ratio is greater than the preset ratio, it is determined that the camera is blocked at the moment of acquiring the image, and the color of the object blocking the camera matches the preset color.

[0010] On the other hand, a camera occlusion detection device is provided, the device comprising:

[0011] A region distinguishing module is used to divide the image into a target region and a non-target region according to a threshold value corresponding to characteristic information of a preset color; the target region is associated with the preset color, and the image is obtained through a camera;

[0012] A ratio determination module, used to determine the ratio of the area of ​​the target region to the area of ​​the image;

[0013] The judgment module is used to determine that the camera is blocked when acquiring the picture if the ratio is greater than a preset ratio, and the color of the object blocking the camera matches the preset color.

[0014] On the other hand, an electronic device is provided, characterized in that the electronic device includes a processor and a memory, and the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the camera occlusion detection method as described above.

[0015] On the other hand, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the camera occlusion detection method as described above.

[0016] The camera occlusion detection method, device, electronic device, and storage medium provided in the embodiments of the present application have the following technical effects:

[0017] The image is divided into a target area and a non-target area according to the threshold value corresponding to the characteristic information of the preset color. The target area is associated with the preset color, and the image is acquired through a camera. The ratio of the area of ​​the target area to the area of ​​the image is determined; if the ratio is greater than the preset ratio, it is determined that the camera is blocked at the time of acquiring the image, and the color of the object blocking the camera matches the preset color. In this way, human resources can be saved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0019] Figure 1 is a schematic diagram of an application environment provided by an embodiment of the present application;

[0020] Figure 2 It is a flowchart of a camera occlusion detection method provided in an embodiment of the present application;

[0021] Figure 3 It is a flowchart of a method for dividing an image into a target area and a non-target area provided in an embodiment of the present application;

[0022] Figure 4 It is a picture provided by the embodiment of the present application;

[0023] Figure 5 It is a picture provided by the embodiment of the present application;

[0024] Figure 6 It is a picture provided by the embodiment of the present application;

[0025] Figure 7 It is a flowchart of a method for determining the ratio of the area of ​​a target area to the area of ​​a picture provided in an embodiment of the present application;

[0026] Figure 8 is a schematic diagram of a camera occlusion detection display interface provided in an embodiment of the present application;

[0027] Fig. 9 It is a structural schematic diagram of a camera occlusion detection device provided in an embodiment of the present application;

[0028] Fig.10 It is a hardware structure block diagram of a server of a camera occlusion detection method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] In the embodiment of the present application, an optional application scenario is live video broadcasting. Specifically, the video host can broadcast live through the application on the terminal, and the user can watch the video through the application on the terminal. Between the terminal of the video host and the terminal of the user, there is a server that provides services for the application. After the server and the terminals of both parties establish a communication connection, the server can receive the video uploaded by the video host and forward the video to the user terminal. The server can also display the video on the display screen of the service provider that provides the application, which is convenient for the supervision of the service provider.

[0032] The video host may block the camera during the live broadcast, for example, the host unconsciously blocks the camera with his hand, which may result in a poor viewing experience for the user. In order to solve the above problems, the service provider needs to provide some manpower to monitor the video to find the video blocked by the camera and remind the video host. However, manpower is limited after all, and the videos on a video platform are massive, and it is impossible to monitor all videos at the same time. The implementation method provided in the embodiments of the present application below is an optional way to solve the problems encountered in the above-mentioned video live broadcast.

[0033] See also Figure 1 , Figure 1 1 is a schematic diagram of an application environment provided in an embodiment of the present application, including a server 101 and a terminal 102. The terminal 102 can be a device such as a desktop computer, a laptop computer, a mobile phone, a tablet computer, etc. that can be loaded with a video application. In the embodiment of the present application, the server 101 and the terminal 102 can be connected via a wireless link.

[0034] In an optional implementation, the server can be the subject of the camera occlusion detection method. After the video host uploads the video to the server, the server captures a picture from the video, divides the picture into a target area and a non-target area according to a threshold value corresponding to the characteristic information of a preset color, determines the ratio of the area of ​​the target area to the area of ​​the picture, determines whether the ratio is greater than a preset ratio, and determines whether the camera is blocked at the moment of acquiring the picture through the judgment conclusion.

[0035] In another optional implementation, the terminal can be the subject of the camera occlusion detection method. The terminal directly captures the picture from the video, divides the picture into a target area and a non-target area according to the threshold value corresponding to the characteristic information of the preset color, determines the ratio of the area of ​​the target area to the area of ​​the picture, determines whether the ratio is greater than the preset ratio, and determines whether the camera is blocked at the time of acquiring the picture through the judgment conclusion. In the above method, the program implementing the method can be regarded as a component updated to the terminal.

[0036] If the server determines that the camera is blocked when acquiring the image, it can send a prompt message to the terminal to prompt the anchor's camera to be blocked. If the terminal determines that the camera is blocked when acquiring the image, it can send a prompt message to prompt the anchor's camera to be blocked. The above two methods are both optional implementation methods. The following will use the server as the execution subject to explain the embodiments of this application.

[0037] The following describes a specific embodiment of a camera occlusion detection method of the present application. Figure 2 It is a flowchart of a camera occlusion detection method provided in an embodiment of the present application. This specification provides method operation steps such as the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or server product is executed, it can be executed in the order shown in the embodiment or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment). Specifically, Figure 2 As shown, the method may include:

[0038] S201: Divide the image into a target area and a non-target area according to a threshold value corresponding to characteristic information of a preset color; the target area is associated with the preset color, and the image is obtained through a camera.

[0039] In the embodiment of the present application, the above-mentioned pictures are pictures in the video, and optionally, are pictures obtained by the terminal through a camera on the terminal and uploaded to the server.

[0040] In an embodiment of the present application, the above-mentioned pictures can be in different formats, such as RGB format, HSV format, HSL format, etc. Based on pictures of different formats, the pixels in the pictures have different characteristic information. For example, each pixel in a picture in RGB format can be represented by red, green and blue, and different combinations of red values, green values ​​and blue values ​​constitute pixels in pictures of different colors. Therefore, the characteristic information of the picture in RGB format is red, green, and blue. For example, each pixel in a picture in HSV format can be represented by hue, saturation and brightness, and different combinations of hue values, saturation values ​​and brightness values ​​constitute pixels in pictures of different colors. Therefore, the characteristic information of the picture in HSV format is hue, saturation and brightness.

[0041] In an optional implementation, based on the format of the image being RGB format, the present application embodiment describes an optional implementation method for dividing the image into a target area and a non-target area. Figure 3 is a flow chart of a method for dividing an image into a target area and a non-target area provided in an embodiment of the present application, and specifically Figure 3As shown, the method may include:

[0042] S301: Determine the content uploaded by the terminal according to the format; if the format of the uploaded content is a video format, go to S303; otherwise, do not process.

[0043] In the embodiment of the present application, the video formats include rm, rmvb, mp4, wmv, asf, asx, 3gb, mov and m4v. If the format of the content uploaded by the terminal is any of the above formats, the uploaded content is a video.

[0044] S303: Determine that the content uploaded by the terminal is a video, and capture the video according to a preset time period to obtain a picture.

[0045] In an optional implementation of the server obtaining the image, the server obtains the video and can capture the video according to a preset time period to obtain the image. Specifically, after the terminal and the server establish a communication connection, the video can be uploaded to the server in real time during the live broadcast of the anchor. After the server receives the video in real time, it performs frame processing, that is, it can capture images from the video according to a preset time period. For example, the server can capture images from the video every 2 seconds as a basis for subsequent judgment of whether the camera is blocked.

[0046] S305: Determine the format of the image; if the format of the image is HSV format, go to S309; ​​if the format of the image is not HSV format, go to S307.

[0047] S307: Convert the non-HSV format image into the HSV format image.

[0048] Assuming that the captured image is in RGB format, the image can be converted into HSV format through format conversion.

[0049] In an optional implementation, the cv2.cvtColor function can be used to convert the RGB format to the HSV format. Specifically, hsv_frame = cv2.cvtColor (frame, COLOR_BGR2HSV), where hsv_frame is the output HSV format image, frame is the input RGB format image, and COLOR_BGR2HSV is the conversion method, from RGB format to HSV format.

[0050] S309: Determine an upper threshold value and a lower threshold value corresponding to the characteristic information of a preset color.

[0051] In the embodiment of the present application, after the server obtains the image, it does not obtain the color contained in the image. Therefore, the preset color can be any color. Assuming that the preset color is orange, the upper threshold value corresponding to the characteristic information of the orange is [25, 225, 225], and the lower threshold value is [11, 43, 46], which means: the maximum value of the orange hue is 25, the maximum value of the saturation is 225, and the maximum value of the brightness is 225. The minimum value of the orange hue is 11, the minimum value of the saturation is 43, and the minimum value of the brightness is 46. The upper threshold value and the lower threshold value of the preset color can be obtained by looking up a table. For example, the upper threshold value and the lower threshold value of each color are stored in a storage area. After the preset color is determined, the upper threshold value and the lower threshold value of the preset color are obtained from the storage area.

[0052] S311: Determine a threshold interval corresponding to a preset color according to an upper threshold value and a lower threshold value.

[0053] Based on the above preset color of orange, it is further explained that the threshold range corresponding to orange includes: the hue range is 11-25, the saturation range is 43-225, and the lightness range is 46-225.

[0054] S313: Determine whether the characteristic value corresponding to the characteristic information of the pixel point contained in the image is within the threshold range; if so, go to S315; otherwise, go to S319.

[0055] In an embodiment of the present application, it can be judged whether the characteristic value corresponding to each feature information of each pixel in the image is within the threshold interval. Assuming that the hue, saturation and brightness of the first pixel of the image are [23, 80, 80], each characteristic value of the pixel is within the threshold interval corresponding to orange; assuming that the hue, saturation and brightness of the second pixel of the image are [23, 20, 125], the saturation 20 in the pixel is not within the threshold interval of the saturation corresponding to orange.

[0056] S315: Change the color of the pixel to the first color.

[0057] In the embodiment of the present application, the first color may be white. Based on the above example, the characteristic values ​​of the hue, saturation and brightness of the first pixel are all within the threshold interval corresponding to orange, the color of the first pixel is orange, and the color of the orange first pixel is changed to white.

[0058] S317: Determine the area where the pixels of the first color are located as the target area.

[0059] In the embodiment of the present application, the area where the white pixels are located is determined as the target area, that is, the colors of all the pixels in the target area are white.

[0060] S319: Change the color of the pixel point to the second color.

[0061] In an optional implementation, the second color is black. Based on the above example, if the characteristic value of saturation among the hue, saturation and brightness of the second pixel is not within the threshold interval corresponding to the saturation of orange, the color of the second pixel is not orange, and the color of the second pixel is changed to black.

[0062] S321: Determine the area where the pixels of the second color are located as a non-target area.

[0063] In the embodiment of the present application, the area where the black pixels are located is determined as the non-target area, that is, the colors of all the pixels in the non-target area are black.

[0064] Figure 4 This is a picture provided in an embodiment of the present application. The picture is a picture of a face blocked by a finger. 401 is the finger part, and 402 is the non-finger part. The color of the picture has been converted to grayscale. In actual application, the original picture that has not been processed in grayscale is directly divided into a target area and a non-target area.

[0065] In the embodiment of the present application, the cv2.inRange function can be used to divide the image into the target area and the non-target area. Specifically, mask = cv2.inRange (hsv_frame, lower, upper), mask is the output image containing only the target area and the non-target area, hsv_frame is the input HSV format image, lower is the lower threshold value of the preset color, and upper is the upper threshold value of the preset color. Lower and upper are determined according to different preset colors. The lower threshold value of the orange mentioned above is lower, and the upper threshold value is upper.

[0066] In the embodiment of the present application, Figure 4 The picture shown is processed by the above cv2.inRange function, and the result is Figure 5 The pictures shown, Figure 5 is a picture provided in the embodiment of the present application, the preset color is the color corresponding to the finger, Figure 5 In the image, the finger part 501 is basically white, and the non-finger part is basically black. The non-finger part also contains a part of white because the part is the forehead of the person. The forehead and the fingers have similar colors, so it is also turned into white after processing. In addition, the finger part 501 also contains a small amount of black, that is, the circled area 503, which may be the noise generated during the image processing process.

[0067] In the embodiment of the present application, after the step of dividing the image into the target area and the non-target area, some noise points may appear on the image. These noise points may cause errors in the subsequent determination of the ratio of the area of ​​the target area to the area of ​​the image. In order to reduce the error, in an optional implementation, the image may be subjected to corrosion and expansion processing to process the noise points on the image. Figure 5 The picture shown can be presented as Figure 6 Pictures shown. Figure 6 is a picture provided in an embodiment of the present application. The circled area 603 included in the finger portion 601 is compared to Figure 5 In the 503 in the figure, the noise is significantly reduced. In this way, a more accurate ratio of the area of ​​the target area to the area of ​​the image can be obtained later.

[0068] In the embodiment of the present application, the image can be dilated using the cv2.dilate function. Specifically, mask1 = cv2.dilate (mask, None, iterations = 2), mask1 is the output image, mask is the input image, None identifies the convolution kernel, and iterations = 2 indicates that the number of iterations is 2 times.

[0069] S203: Determine the ratio of the area of ​​the target region to the area of ​​the picture.

[0070] In an embodiment of the present application, there are many methods for determining the ratio of the area of ​​the target area to the area of ​​the image. In an optional implementation, the server can determine the number of pixels contained in the target area, and divide the determined number by the total number of pixels in the image to obtain the ratio.

[0071] For example, the number of white pixels in the target area is 128000. Assuming the image is 640*320, that is, the width of the image is 640 pixels and the height is 320 pixels, the total number is 640*320=204800, and the ratio is 128000 / 204800=62.5%.

[0072] In another optional implementation, the ratio of the area of ​​the target area to the area of ​​the image may be determined by determining the contour of the target area. Figure 7 is a flow chart of a method for determining the ratio of the area of ​​a target region to the area of ​​a picture provided in an embodiment of the present application, and specifically Figure 7 As shown, the method may include:

[0073] S701: Determine the contour of the target area.

[0074] In the embodiment of the present application, the cv2.findContours function can be used to determine the contour of the target area. For example: contours, hierarchy = cv2.findContours (mask1_copy, mode, method), where the cv2.findContours function will output two values ​​contours and hierarchy, contours represents the contour itself, hierarchy represents the attributes of the contour, that is, the structural hierarchy. mask1_copy is a copy of the image you want to input, mode represents the retrieval mode of the contour, and method is the approximate method of the contour.

[0075] In the embodiment of the present application, the contour retrieval mode includes external contour retrieval cv2.RETR_EXTERNAL, retrieval without establishing a hierarchical relationship cv2.RETR_LIST, retrieval with two levels cv2.RETR_CCOMP and contour retrieval with a hierarchical tree structure cv2.RETR_TREE.

[0076] In the embodiment of the present application, Method includes: cv2.CHAIN_APPROX_SIMPLE compresses the elements in the horizontal, vertical, and diagonal directions, and only retains the end point coordinates in the direction, cv2.CHAIN_APPROX_None stores all contour points, and the pixel position difference between two adjacent points does not exceed 1, that is, max(abs(x1-x2), abs(y2-y1)) == 1, etc.

[0077] In this way, the server can obtain the contour of the target area.

[0078] S703: Determine the area of ​​the target region according to the pixel points corresponding to the contour line.

[0079] Determine the number of pixels in the contour line. The format of the pixel number can be an approximate number.

[0080] S705: Determine the area of ​​the picture according to the pixels included in the picture.

[0081] S707: Determine the ratio of the area of ​​the target region to the area of ​​the picture.

[0082] In the embodiment of the present application, the cv2.contourArea() function can be used to calculate the ratio of the area of ​​the target area to the area of ​​the image, that is, the coverage ratio of the preset color corresponding to the target area on the entire image.

[0083] S205: If the ratio is greater than a preset ratio, it is determined that the camera is blocked when acquiring the image, and the color of the object blocking the camera matches the preset color.

[0084] In the embodiment of the present application, the preset ratio can be set based on an empirical value, can be set based on collected data, can be set based on the quality of the picture, or can be set based on the collected data and the quality of the picture. Based on the above ratio of 62.5%, assuming that the preset ratio is 60%, it can be determined that the camera is blocked at the time of acquiring the picture, and the color of the object blocking the camera is the preset color or a color close to the preset color.

[0085] In the embodiment of the present application, since the server does not know what colors are contained in the picture, it is necessary to use multiple preset colors to determine the ratio corresponding to each preset color on the picture, and use the ratio to determine whether the camera is blocked when acquiring the picture. The embodiment of the present application can have several preset colors, such as 10 colors, red, orange, yellow, green, cyan, blue, purple, black, white and gray. The lower and upper thresholds of the 10 colors are:

[0086] Red: lower threshold [156,43,46], upper threshold [180,255,255];

[0087] Orange: lower threshold [11,43,46], upper threshold [25,255,255];

[0088] Yellow: lower threshold [26,43,46], upper threshold [34,255,255];

[0089] Green: lower threshold [35,43,46], upper threshold [77,255,255];

[0090] Cyan: lower threshold [78,43,46], upper threshold [99,255,255];

[0091] Blue: lower threshold [100,43,46], upper threshold [124,255,255];

[0092] Purple: lower threshold [125,43,46], upper threshold [155,255,255];

[0093] Black: lower threshold [0,0,0], upper threshold [180,255,46];

[0094] White: lower threshold [0,0,221], upper threshold [180,30,255];

[0095] Gray: lower threshold [0,0,46], upper threshold [180,43,220].

[0096] In an optional implementation scheme, the server can determine the ratio corresponding to each preset color on the image based on each preset color, and determine whether the camera is blocked when the camera acquires the image by the ratio. For example, after the server acquires the image, the first determination is: first, the image is divided into a target area and a non-target area based on the threshold value corresponding to the characteristic information of red, and the ratio of the area of ​​the target area corresponding to red to the area of ​​the image is determined. If the ratio is greater than the preset ratio, the server can determine that the camera was blocked at the time of acquiring the image, and the color of the object blocking the camera matches red. If the ratio is less than or equal to the preset ratio, the server makes a second determination. Second determination: first, the image is divided into a target area and a non-target area based on the threshold value corresponding to the characteristic information of orange, and the ratio of the area of ​​the target area corresponding to orange to the area of ​​the image is determined. If the ratio is greater than the preset ratio, the server can determine that the camera was blocked at the time of acquiring the image, and the color of the object blocking the camera matches orange. If the ratio is less than or equal to the preset ratio, the server makes a third determination... until a ratio corresponding to a preset color is greater than the preset ratio. If all preset colors are determined, and the ratio corresponding to no preset color is still greater than the preset ratio, it is determined that the camera is not blocked when acquiring the image.

[0097] In actual application scenarios, the ratio corresponding to the preset color may be greater than the preset ratio during the first determination, that is, it can be determined that the camera is blocked when acquiring the picture. Therefore, based on this situation, the server does not need to perform subsequent determination of the preset color, saving the server's computing resources.

[0098] In another optional implementation, the server may first divide the image into a target area and a non-target area corresponding to each color based on the threshold value corresponding to the characteristic information of each preset color, and determine the ratio corresponding to each color according to the area of ​​the target area corresponding to each color and the area of ​​the image. The ratios corresponding to each color are sorted from large to small according to the numerical value, and the ratio with the largest numerical value is compared with the preset ratio. If the ratio is greater than the preset ratio, the server can determine that the camera is blocked at the time of acquiring the image, and the color of the object blocking the camera matches the preset color corresponding to the ratio with the largest numerical value. If the ratio is less than or equal to the preset ratio, it is determined that the camera is not blocked at the time of acquiring the image.

[0099] In the embodiment of the present application, the actual application scenario may be as follows: the video anchor covers the camera with his hand for 10 seconds. After the terminal uploads the video to the server in real time, the server will capture 5 to 6 pictures within these 10 seconds. Assuming that when determining the first picture, the server obtains the result that the camera is blocked at the moment of obtaining the first picture based on the ratio corresponding to orange, and the color of the object blocking the camera matches orange. Obviously, the same result can be obtained for the subsequent pictures.

[0100] Based on the above application scenario, in an optional implementation of the present application, when the server confirms whether the camera is blocked when acquiring the current picture, the previous determination result can be used as the current reference condition.

[0101] Optionally, assuming that the result obtained by the server based on the previous picture is that the camera was blocked at the moment of acquiring the picture, and the color of the object blocking the camera matches green, then the first preset color of the current picture is green, and the current picture is divided into a target area and a non-target area based on the threshold value corresponding to the characteristic information of green, and the ratio of the area of ​​the target area corresponding to green to the area of ​​the current picture is determined. If the ratio is greater than the preset ratio, the server can determine that the camera was blocked at the moment of acquiring the picture, and the color of the object blocking the camera matches green. If the ratio is less than or equal to the preset ratio, the server uses any one of the other preset colors as the second determined color.

[0102] Optionally, assuming that the result obtained by the server based on the previous picture is that the camera is not blocked when the picture is obtained, the ratio corresponding to each preset color is sorted from large to small according to the numerical value, and the corresponding sequence of preset colors is obtained. After obtaining the current picture, the camera is detected whether it is blocked according to the sequence of the previous preset colors.

[0103] In this way, the detection of the pictures based on the entire video can reduce the amount of server computing. Furthermore, facing the massive amount of pictures generated by the massive amount of videos, the amount of server computing is also greatly reduced. At the same time, using the server to determine whether the terminal camera is blocked saves human resources and greatly improves work efficiency.

[0104] In the implementation manner of the present application, the above description uses the server as the execution subject to determine whether the camera is blocked when acquiring a picture, and the terminal as the execution subject can refer to the server to determine whether the camera is blocked when acquiring a picture.

[0105] In an optional implementation, the server determines that the camera is blocked at the time of acquiring the image, and can send a prompt message to the terminal. Generally, the terminal can upload the video to the server very quickly, and the server can use the above implementation method to determine whether the camera is blocked at the time of acquiring the image very quickly. Therefore, the time interval between the terminal uploading the video to the server and the terminal receiving the prompt message will be extremely short. The video host can be prompted by the prompt message before he realizes that he has blocked the camera, which provides a good usage environment for the host and the user.

[0106] In another optional implementation, when the terminal determines that the camera is blocked when acquiring the image, a prompt may be issued to alert the anchor.

[0107] After the terminal receives the prompt information or determines that the camera is blocked at the time of acquiring the image, the terminal can optionally vibrate slightly to prompt the host that the camera is blocked. Optionally, the light module on the terminal can be combined to slightly flash to prompt the host that the camera is blocked. In this way, the live video can be monitored by judging whether the camera is blocked, which improves the efficiency of live video monitoring and saves human resources.

[0108] Figure 8 It is a schematic diagram of a camera occlusion detection display interface provided in an embodiment of the present application, including an interface 801, which can be displayed on the screen of the terminal or on the screen connected to the server. Display interface 801 includes a project input box 802, a task name input box 803, a file input box 804, and a submit analysis click box 805. Optionally, the project name can be entered in the project input box 802. For example, the video is shot by the terminal through application A and uploaded to the server. Therefore, the input in the project input box is application A. The task name input box 803 can be the name of the video. The file input box 804 can be a video in the format of rm, rmvb, mp4, wmv, asf, asx, 3gb, mov, and m4v.

[0109] The present application also provides a camera occlusion detection device. Fig. 9 is a structural diagram of a camera occlusion detection device provided in an embodiment of the present application, such as Fig. 9 As shown, the device comprises:

[0110] The region distinguishing module 901 is used to divide the image into a target region and a non-target region according to a threshold value corresponding to characteristic information of a preset color; the target region is associated with a preset color, and the image is obtained through a camera;

[0111] The ratio determination module 902 is used to determine the ratio of the area of ​​the target region to the area of ​​the picture;

[0112] The judgment module 903 is used to determine that the camera is blocked when acquiring the image if the ratio is greater than a preset ratio, and the color of the object blocking the camera matches the preset color.

[0113] In an optional embodiment, the device further comprises:

[0114] The region distinguishing module 901 is used to determine the upper threshold value and the lower threshold value corresponding to the characteristic information of the preset color;

[0115] Determine the threshold interval corresponding to the preset color according to the upper threshold value and the lower threshold value;

[0116] If the characteristic value corresponding to the characteristic information of the pixel point contained in the image is within the threshold range, the color of the pixel point is changed to the first color; otherwise, the color of the pixel point is changed to the second color;

[0117] Determine the area where the pixels of the first color are located as the target area;

[0118] The area where the pixels of the second color are located is determined as a non-target area.

[0119] In an optional embodiment, the device further comprises:

[0120] The ratio determination module 902 is used to determine the contour line of the target area;

[0121] Determine the area of ​​the target region according to the pixel points corresponding to the contour line;

[0122] Determine the area of ​​the image according to the pixels included in the image;

[0123] Determine the ratio of the target area to the image area.

[0124] In an optional embodiment, the device further comprises:

[0125] The receiving module is used to obtain the video;

[0126] Capture the video according to the preset time period and obtain the picture.

[0127] In an optional embodiment, the device further comprises:

[0128] The region distinguishing module 901 is used to divide the image into a target region and a non-target region corresponding to each color according to a threshold value corresponding to characteristic information of each color in the preset colors;

[0129] The ratio determination module 902 is used to determine the ratio corresponding to each color according to the area of ​​the target area corresponding to each color and the area of ​​the picture; and sort the ratio corresponding to each color from large to small according to the numerical value.

[0130] The judgment module 903 is used to determine the ratio corresponding to the maximum value. If the ratio is greater than the preset ratio, it is determined that the camera is blocked when acquiring the picture.

[0131] The device and method embodiments in the application embodiments are based on the same application concepts.

[0132] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal, a server or a similar computing device. Taking running on a server as an example, Fig.10 is a hardware structure block diagram of a server of a camera occlusion detection method provided in an embodiment of the present application. Fig.10 As shown, the server 1000 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1010 (the processor 1010 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1030 for storing data, and one or more storage media 1020 (such as one or more mass storage devices) for storing application programs 1023 or data 1022. Among them, the memory 1030 and the storage medium 1020 can be short-term storage or permanent storage. The program stored in the storage medium 1020 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processing unit 1010 can be configured to communicate with the storage medium 1020 and execute a series of instruction operations in the storage medium 1020 on the server 1000. The server 1000 may also include one or more power supplies 1060, one or more wired or wireless network interfaces 1050, one or more input and output interfaces 1040, and / or one or more operating systems 1021, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0133] The input / output interface 1040 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the server 1000. In one example, the input / output interface 1040 includes a network adapter (Network Interface Controller, NIC), which may be connected to other network devices through a base station so as to communicate with the Internet. In one example, the input / output interface 1040 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0134] It can be understood by those skilled in the art that Fig.10 The structure shown is only for illustration and does not limit the structure of the above electronic device. Fig.10 More or fewer components as shown, or with Fig.10 Different configurations are shown.

[0135] An embodiment of the present application also provides a storage medium, which can be set in a server to store at least one instruction, at least one program, a code set or an instruction set related to a camera occlusion detection method in a method embodiment. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the camera occlusion detection method provided in the above method embodiment.

[0136] Optionally, in this embodiment, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0137] It can be seen from the embodiments of the camera occlusion detection method, device, electronic device or storage medium provided by the present application that in the present application, the image is divided into a target area and a non-target area according to the threshold value corresponding to the characteristic information of the preset color; the target area is associated with the preset color, and the image is obtained through the camera; the ratio of the area of ​​the target area to the area of ​​the image is determined; if the ratio is greater than the preset ratio, it is determined that the camera is blocked at the time of acquiring the image, and the color of the object blocking the camera matches the preset color. In this way, the live video can be monitored by checking whether the camera is blocked, which improves the efficiency of live video monitoring and saves human resources.

[0138] It should be noted that the above-mentioned sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above-mentioned specific embodiments of this specification are described. Other embodiments are within the scope of the attached claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0139] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0140] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0141] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A camera occlusion detection method, characterized in that: The method comprises: Dividing the image into a target area and a non-target area corresponding to each color according to a threshold value corresponding to characteristic information of each color in the preset colors; the target area is associated with the preset color, and the image is a first image captured from a video acquired by a camera; Determining a ratio corresponding to each color according to the area of ​​the target area corresponding to each color and the area of ​​the image; Sort the ratios corresponding to each color from large to small according to the numerical value; Determine the ratio corresponding to the largest value; if the ratio is greater than the preset ratio, determine that the camera is blocked at the moment of acquiring the picture, and the color of the object blocking the camera matches the preset color; perform camera occlusion detection on the second picture in the order of the preset colors of the first picture; the second picture is the first picture captured in the video and located after the first picture.

2. The method according to claim 1, characterized in that The step of dividing the image into a target area and a non-target area according to a threshold value corresponding to characteristic information of a preset color includes: Determine an upper threshold value and a lower threshold value corresponding to the characteristic information of the preset color; Determine a threshold interval corresponding to the preset color according to the upper threshold value and the lower threshold value; If the characteristic value corresponding to the characteristic information of the pixel point contained in the image is within the threshold range, the color of the pixel point is changed to the first color; otherwise, the color of the pixel point is changed to the second color; Determine the area where the pixels of the first color are located as the target area; The area where the pixels of the second color are located is determined as the non-target area.

3. The method according to claim 1, characterized in that The determining, according to the area of ​​the target region corresponding to each color and the area of ​​the picture, a ratio corresponding to each color includes: Determining a contour line of the target area; Determine the area of ​​the target area according to the pixel points corresponding to the contour line; Determining the area of ​​the picture according to the pixels included in the picture; A ratio of an area of ​​the target region to an area of ​​the picture is determined.

4. The method according to claim 1, characterized in that: The method further comprises: The characteristic information includes hue, saturation and brightness.

5. The method according to claim 1, characterized in that: The method further comprises: Get the video; The video is intercepted according to a preset time period to obtain the picture.

6. A camera occlusion detection device, characterized in that: The device comprises: A region distinguishing module, configured to divide the image into a target region and a non-target region corresponding to each color in a preset color according to a threshold value corresponding to characteristic information of each color in the preset color; the target region is associated with the preset color, and the image is a first image captured from a video acquired by a camera; A ratio determination module, used to determine the ratio corresponding to each color according to the area of ​​the target area corresponding to each color and the area of ​​the picture; and sort the ratios corresponding to each color from large to small according to the numerical value; A judgment module is used to determine the ratio corresponding to the maximum value. If the ratio is greater than a preset ratio, it is determined that the camera is blocked at the moment of acquiring the image, and the color of the object blocking the camera matches the preset color; camera blockage detection is performed on the second image in the order of the preset colors of the first image; the second image is the first image captured in the video and located after the first image.

7. The device according to claim 6, characterized in that The region distinguishing module is used to determine the upper threshold value and the lower threshold value corresponding to the characteristic information of the preset color; determine the threshold interval corresponding to the preset color according to the upper threshold value and the lower threshold value; if the characteristic value corresponding to the characteristic information of the pixel point contained in the image is within the threshold interval, change the color of the pixel point to the first color; otherwise, change the color of the pixel point to the second color; determine the region where the pixel point of the first color is located as the target region; The area where the pixels of the second color are located is determined as the non-target area.

8. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the camera occlusion detection method as described in any one of claims 1-5.

9. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the camera occlusion detection method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Method and device for preventing photographing occlusion

    CN105491289A

  • Method and device for detecting obstacles

    CN107454969A