IMAGE PROCESSING METHOD, IMAGE PROCESSING APPARATUS AND NON-TRANSITORY STORAGE MEDIUM

The image processing method addresses the challenge of video screen deformation in classroom teaching by automatically detecting and correcting board writing areas with a fixed camera, eliminating the need for manual calibration and expensive hardware, thus enhancing educational video quality.

JP7564962B2Active Publication Date: 2024-10-09NEW ORIENTAL EDUCATION & TECH GRP CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2023541634
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2021-01-07
Filing Date
2021-12-03
Publication Date
2024-10-09
Estimated Expiration
2041-12-03

AI Technical Summary

Technical Problem

Existing methods for correcting video screen deformation in classroom teaching environments, such as screen marking and camera calibration, require significant manual labor and expensive hardware, and are not adaptable to changes in camera positioning due to environmental factors.

Method used

An image processing method that uses a fixed camera to detect and correct the board writing area by determining a rectangular detection area, performing analysis to identify the target area, and applying coordinate transformation to obtain a corrected board writing image, without the need for manual data marking or additional equipment.

Benefits of technology

The method effectively calibrates and corrects deformed board writing areas in input images using a low-cost setup, reducing labor costs and enabling automatic area specification, suitable for widespread use in educational settings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007564962000008
    Figure 0007564962000008
  • Figure 0007564962000009
    Figure 0007564962000009
  • Figure 0007564962000010
    Figure 0007564962000010
Patent Text Reader

Abstract

The present invention provides an image processing method, an image processing device, and a non-transitory storage medium, which includes: acquiring an input image of a teaching scene; performing a detection process on the input image to determine a rectangular detection area including a blackboard area; performing an analysis process on the rectangular detection area to determine a target area corresponding to the blackboard area; determining four vertices of the target area; and performing coordinate transformation on the target area based on the four vertices of the target area to obtain a corrected blackboard area image.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0002] SUMMARY OF THE DISCLOSURE Embodiments of the present disclosure relate to an image processing method, an image processing device, and a non-transitory storage medium. [Background technology]

[0003] With the development of educational information technology, the application of video courses in teaching processes is becoming more and more widespread. For example, when conducting face-to-face teaching, the video recording system can be used to record the teaching content to form teaching videos, so that students can watch the teaching videos online to supplement and review the relevant teaching content. In addition, teaching videos can be widely used in teaching evaluation, model lesson recording, teaching observation, distance learning, etc. Summary of the Invention [Means for solving the problem]

[0004] At least some embodiments of the present disclosure provide an image processing method, which includes obtaining an input image of a teaching scene, performing a detection process on the input image to determine a rectangular detection area including a blackboard area, performing an analysis process on the rectangular detection area to determine a target area corresponding to the blackboard area, determining four vertices of the target area, and performing coordinate transformation on the target area based on the four vertices of the target area to obtain a corrected blackboard area image.

[0005] For example, in an image processing method according to some embodiments of the present disclosure, determining the four vertices of the target area includes performing a contour detection process on the target area using a contour detection algorithm to obtain at least one contour, performing a screening process on the at least one contour to obtain at least one preliminary contour, determining a preliminary set of corner points based on the at least one preliminary contour, and determining the four vertices of the target area based on the preliminary set of corner points.

[0006] For example, in an image processing method according to some embodiments of the present disclosure, determining the preliminary corner point set based on the at least one preliminary contour includes calculating an angle value of an apex angle corresponding to each corner point of the at least one preliminary contour, and screening each corner point of the at least one preliminary contour based on the angle value of the apex angle corresponding to each corner point of the at least one preliminary contour to obtain a plurality of first preliminary corner points, wherein the preliminary corner point set includes the plurality of first preliminary corner points.

[0007] For example, in an image processing method according to some embodiments of the present disclosure, determining the preliminary corner point set based on the at least one preliminary contour includes: screening the at least one preliminary contour based on a number threshold of corner points to obtain at least one preliminarily selected contour; performing a broken line fitting for each of the preliminarily selected contours according to a fitting accuracy, discarding corner points in each of the preliminarily selected contours whose distance is greater than the fitting accuracy, and retaining corner points whose distance is less than the fitting accuracy to obtain a closed fitting graphic; calculating the area and number of corner points of the fitting graphic, discarding preliminarily selected contours corresponding to the fitting graphic whose area is less than the area threshold and whose number of corner points is less than 4; if not, improving the value of the fitting accuracy and performing a next broken line fitting until finding a fitting graphic whose area is greater than or equal to the area threshold and whose number of corner points is equal to 4; and taking the four vertices of the finally determined fitting image as second preliminary corner points, wherein the preliminary corner point set includes a plurality of the second preliminary corner points.

[0008] For example, in an image processing method according to some embodiments of the present disclosure, determining the preliminary corner point set based on the at least one preliminary contour includes calculating an angle value of an apex angle corresponding to each corner point of the at least one preliminary contour; screening each corner point of the at least one preliminary contour based on the angle value of the apex angle corresponding to each corner point of the at least one preliminary contour to obtain a plurality of first preliminary corner points; screening the at least one preliminary contour based on a corner point number threshold to obtain at least one preliminarily selected contour; performing polygonal line fitting on each of the preliminarily selected contours according to a fitting accuracy, and discarding corner points in each of the preliminarily selected contours whose distance is greater than the fitting accuracy. the fitting accuracy is increased and a next polygonal fitting is performed until a fitting graphic whose area is equal to or greater than the area threshold and whose number of corner points is equal to four is found; and the four vertices of the finally determined fitting image are set as second preliminary corner points, wherein the preliminary corner point set includes the plurality of first preliminary corner points and the plurality of second preliminary corner points.

[0009] For example, in an image processing method according to some embodiments of the present disclosure, determining four vertices of the target area based on the preliminary corner point set includes performing a clustering operation on corner points in the preliminary corner point set to obtain four cluster centers, and setting the four cluster centers as the four vertices of the target area.

[0010] For example, in an image processing method according to some embodiments of the present disclosure, performing the clustering operation on the salient points in the preliminary salient point set includes performing the first clustering operation using a K-means clustering algorithm (where K=4).

[0011] For example, in an image processing method according to some embodiments of the present disclosure, performing the analysis process on the rectangle detection area to determine the target area corresponding to the blackboard area includes performing a filtering process on the rectangle detection area to obtain a filtered image corresponding to the rectangle detection area and obtaining a first gradation image based on the filtered image, performing a saliency area detection process on the first gradation image to obtain a second gradation image, performing an edge detection process and a binarization process on the second gradation image to obtain a binary image, and performing a connected area analysis process on the binary image to determine the target area corresponding to the blackboard area.

[0012] For example, in an image processing method according to some embodiments of the present disclosure, performing the filtering process on the rectangular detection region to obtain the filtered image corresponding to the rectangular detection region includes performing the filtering process on the rectangular detection region using a median filtering method to obtain the filtered image corresponding to the rectangular detection region.

[0013] For example, in an image processing method according to some embodiments of the present disclosure, performing the saliency region detection process on the first gradation image to obtain the second gradation image includes calculating a global contrast on the first gradation image as a saliency value of each pixel on the first gradation image, and obtaining a second gradation image based on the saliency values ​​of all pixels on the first gradation image, wherein the gradation value of any pixel on the second gradation image is the saliency value of a pixel corresponding to any one of the pixels on the first gradation image.

[0014] For example, in an image processing method according to some embodiments of the present disclosure, performing the edge detection process and the binarization process on the second grayscale image to obtain the binary image includes calculating the grayscale gradients of all pixels on the second grayscale image to determine initial selected edge pixels, performing a non-maximum suppression operation on the initial selected edge pixels to determine secondary selected edge pixels, performing a double threshold screening operation on the secondary selected edge pixels to obtain final selected edge pixels, and performing the binarization process on the second grayscale image based on the final selected edge pixels to obtain the binary image.

[0015] For example, in an image processing method according to some embodiments of the present disclosure, performing a connected region analysis process on the binary image to determine the target region corresponding to the blackboard area includes determining all connected regions on the binary image and the circumscribing rectangular frames of each of the connected regions, selecting the second to Nth (N is an integer greater than or equal to 2) connected regions in order of the areas of the circumscribing rectangular frames as regions to be selected, and authenticating the region to be selected based on second prior knowledge of the blackboard area to determine the target region corresponding to the blackboard area.

[0016] For example, in an image processing method according to some embodiments of the present disclosure, the second prior knowledge includes that the distance between the center coordinates of the blackboard area and the center coordinates of the binary image is smaller than a distance threshold, and that the aspect ratio of the blackboard area is within a second range.

[0017] For example, in an image processing method according to some embodiments of the present disclosure, performing the detection process on the input image to determine the rectangular detection area including the blackboard area includes authenticating the rectangular detection area based on first prior knowledge of the blackboard area.

[0018] For example, in an image processing method according to some embodiments of the present disclosure, the first prior knowledge includes that the center coordinates of the blackboard area are located in the upper half of the input image and that the aspect ratio of the blackboard area is within a first range.

[0019] For example, in some embodiments of the image processing method of the present disclosure, performing the coordinate transformation on the target area based on four vertices of the target area to obtain the corrected blackboard area image includes performing the coordinate transformation based on constraint conditions, such as that the corrected blackboard area image is a rectangle and that the four vertices of the target area correspond to the four vertices of the rectangle after the coordinate transformation.

[0020] For example, an image processing method according to some embodiments of the present disclosure further includes obtaining a video sequence of the teaching scene, extracting multi-frame images from the video sequence as the input images, respectively, to obtain four vertices on each frame image of the multi-frame images of the target area, determining four final predicted vertices of the target area based on the predicted vertices, using the four vertices on each frame image of the multi-frame images of the target area as predicted vertices, and performing coordinate transformation on the target area in the image of each frame of the video sequence based on the four final predicted vertices of the target area to obtain a corrected blackboard area image corresponding to the image of each frame of the video sequence.

[0021] For example, in an image processing method according to some embodiments of the present disclosure, four vertices on an image of each frame of the multi-frame image of the target area are set as the predicted vertices, and determining four final predicted vertices of the target area based on the predicted vertices includes performing a second clustering operation on the predicted vertices corresponding to each vertex of the target area based on coordinates of the predicted vertices corresponding to each vertex of the target area to obtain at least one predicted subclass corresponding to each vertex, and setting the center coordinates of the prediction subclass including the currently most frequent predicted vertex corresponding to each vertex as the current predicted coordinates of each vertex; determining a first included angle value between a line connecting the current predicted coordinates of any two adjacent vertices and a horizontal line based on the current predicted coordinates of the four vertices of the target area; and determining the current predicted coordinates of the any two adjacent vertices as the current predicted coordinates of each vertex. determining a predicted rectangular area in an image of a certain frame among the images of the multi-frame based on the above, the image of the certain frame having been subjected to filtering, saliency area detection, edge detection and binarization, a line connecting current predicted coordinates of any two adjacent vertices is a diagonal of the predicted rectangular area, and each side of the predicted rectangular area is parallel or perpendicular to the horizon; searching for straight lines in the predicted rectangular area to determine a curved line including a plurality of line segments, determining a slope of an average tangent of the curved line segment based on the plurality of line segments, and determining a second included angle value between the average tangent and the horizon based on the slope of the average tangent; and determining final predicted coordinates of any two adjacent vertices based on the first included angle value and the second included angle value.

[0022] For example, in an image processing method according to some embodiments of the present disclosure, determining final predicted coordinates of any two adjacent vertices based on the first included angle value and the second included angle value includes setting the current predicted coordinates of any two adjacent vertices as the final predicted coordinates of any two adjacent vertices in response to a difference between the first angle value and the second angle value being less than or equal to a first threshold.

[0023] For example, in an image processing method according to some embodiments of the present disclosure, determining final predicted coordinates of the two adjacent vertices based on the first included angle value and the second included angle value includes determining whether a minimum distance between a current predicted coordinate of the two adjacent vertices and the curve segment is equal to or less than a second threshold in response to a difference between the first angle value and the second angle value being greater than the first threshold, and determining a first straight line passing through the current predicted coordinate of one of the two adjacent vertices based on a slope of the average tangent in response to a minimum distance between the current predicted coordinate of one of the two adjacent vertices and the curve segment being equal to or less than the second threshold and a minimum distance between the current predicted coordinate of the other of the two adjacent vertices and the curve segment being greater than the second threshold. determining a second straight line based on current predicted coordinates of the other of any two adjacent vertices, setting the current predicted coordinates of one of the any two adjacent vertices as final predicted coordinates of one of the any two adjacent vertices, and setting coordinates of an intersection of the first straight line and the second straight line as final predicted coordinates of the other of the any two adjacent vertices; and in response to a minimum distance between the current predicted coordinates of the any two adjacent vertices and the curve segment being both greater than the second threshold, discarding a prediction subclass including a currently most predicted vertex corresponding to each vertex of any two adjacent vertices, and setting center coordinates of another prediction subclass including a most predicted vertex corresponding to each vertex of any two adjacent vertices as current predicted coordinates of each vertex of any two adjacent vertices.

[0024] For example, in an image processing method according to some embodiments of the present disclosure, determining final predicted coordinates of the any two adjacent vertices based on the first included angle value and the second included angle value may include, in response to discarding all predicted subclasses corresponding to the any two adjacent vertices, determining an average tangent of the curve segment corresponding to the any two adjacent vertices based on a slope of an average tangent of the curve segment corresponding to the any two adjacent vertices, determining a third straight line based on a current predicted coordinate of a vertex facing one of the any two adjacent vertices and a current predicted coordinate of the other of the any two adjacent vertices, determining a fourth straight line based on a current predicted coordinate of a vertex facing the other of the any two adjacent vertices and a current predicted coordinate of one of the any two adjacent vertices, setting coordinates of an intersection of the average tangent and the third straight line as final predicted coordinates of one of the any two adjacent vertices, and determining a fourth straight line based on a slope of an average tangent of the curve segment corresponding to the any two adjacent vertices. 4 The method further includes determining the coordinates of the intersection point with the line as the final predicted coordinates of the other of the two adjacent vertices.

[0025] At least some embodiments of the present disclosure further provide an image processing device, the image processing device including a memory for non-temporarily storing computer readable commands, and a processor for executing the computer readable commands, the processor performing an image processing method according to any of the embodiments of the present disclosure when the computer readable commands are executed by the processor.

[0026] At least some embodiments of the present disclosure further provide a non-transitory storage medium that non-transitory stores computer-readable instructions that, when executed by a computer, perform an image processing method according to any of the embodiments of the present disclosure.

[0027] In order to more clearly describe the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments are briefly described below. Obviously, the drawings described below are not the limitations of the present disclosure, but are only related to some embodiments of the present disclosure. [Brief description of the drawings]

[0028] [Figure 1] 1 is a flowchart of an image processing method in accordance with at least some embodiments of the present disclosure. [Diagram 2] FIG. 2 is a schematic diagram of a rectangular detection region in an input image in accordance with at least some embodiments of the present disclosure. [Diagram 3] 2 is an example flowchart corresponding to step S300 shown in FIG. 1 in accordance with at least some embodiments of the present disclosure. [Figure 4] 4 is an example flowchart corresponding to step S320 shown in FIG. 3 in accordance with at least some embodiments of the present disclosure. [Diagram 5] 4 is an example flowchart corresponding to step S330 shown in FIG. 3 in accordance with at least some embodiments of the present disclosure. [Figure 6] 4 is an example flowchart corresponding to step S340 shown in FIG. 3 in accordance with at least some embodiments of the present disclosure. [Figure 7] 1 is a schematic diagram illustrating a result of a connected region analysis process in accordance with at least some embodiments of the present disclosure. [Figure 8] 2 is an example flowchart corresponding to step S400 shown in FIG. 1 in accordance with at least some embodiments of the present disclosure. [Figure 9A] 9 is an example flowchart corresponding to step S430 shown in FIG. 8 in accordance with at least some embodiments of the present disclosure. [Figure 9B] 9 is another example flowchart corresponding to step S430 shown in FIG. 8 in accordance with at least some embodiments of the present disclosure. [Figure 10A] FIG. 2 is a schematic diagram of an input image in accordance with at least some embodiments of the present disclosure. [Figure 10B]10B is a schematic diagram of a corrected image of a board area obtained by processing the input image shown in FIG. 10A based on the image processing method shown in FIG. 1; FIG. [Figure 11] 1 is a flowchart of another image processing method in accordance with at least some embodiments of the present disclosure. [Figure 12] 12 is another example flowchart corresponding to step S800 shown in FIG. 11 in accordance with at least some embodiments of the present disclosure. [Figure 13A] FIG. 1 is a schematic block diagram of an input image in accordance with at least some embodiments of the present disclosure. [Figure 13B] FIG. 13B is a schematic diagram of a rectangular boundary of a target region in the input image shown in FIG. 13A. [Figure 13C] FIG. 13B is a schematic diagram of four vertices of a target region in the input image shown in FIG. 13A. [Figure 14] FIG. 1 is a schematic block diagram of an image processing device in accordance with at least some embodiments of the present disclosure. [Figure 15] FIG. 1 is a schematic diagram of a non-transitory storage medium in accordance with at least some embodiments of the present disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0029] In order to make the objectives, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions of the embodiments of the present disclosure will be described below in a clear and complete manner in conjunction with the drawings of the embodiments of the present disclosure. Obviously, the described embodiments are only some embodiments of the present disclosure, but not all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without requiring creative labor belong to the scope of protection of the present disclosure.

[0030] Unless otherwise defined, technical or scientific terms used in this disclosure should have the common meaning understood by a person of ordinary skill in the field to which this disclosure belongs. The terms "first", "second" and similar terms used in this disclosure do not denote any order, number, or importance, but are merely used to distinguish different components. Similar terms such as "comprise" or "include" mean that the element or object appearing before the term covers the elements or objects listed after the term and their equivalents without excluding other elements or objects. Similar terms such as "connected" or "coupled" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Top", "bottom", "left", "right", etc. are used only to indicate relative positional relationships, and when the absolute positions of the described objects are changed, the relative positional relationships may change accordingly.

[0031] The present disclosure will be described below by means of some specific embodiments. In order to maintain the following description of the embodiments of the present disclosure clear and concise, the present disclosure will omit detailed descriptions of known functions and known parts. When any element of the embodiments of the present disclosure appears in more than one drawing, the element is represented by the same or similar reference numerals in each drawing.

[0032] Currently, when recording teaching videos, cameras are generally used to collect videos in the direction of the podium in face-to-face classrooms. In actual teaching situations, the camera placement is very complicated, and different degrees of pitch and yaw angles are inevitably generated depending on the placement, and in some cases, the placement may be unreasonable, resulting in a certain degree of roll, all of which will cause obvious deformation of the video image.

[0033] There are mainly two methods currently used to solve the above problem of video screen deformation. The first method (abbreviated as "screen marking method") is to manually mark data on collected video images to obtain multiple known 2D point coordinates, obtain a homography matrix based on the relationship between the 2D coordinates and the 3D coordinates, and finally correct the screen deformation based on the homography matrix. The second method (abbreviated as "on-site calibration method") is to use multiple cameras or depth cameras, perform camera calibration by a calibration plate placed on-site, and then correct the screen deformation based on the obtained camera parameters. However, this method requires high hardware costs (using multiple cameras or high depth cameras) and is not versatile.

[0034] However, both of the above methods require a large amount of manual labor, and the angle, position, focal length, etc. of cameras placed in actual classrooms often change due to various environmental factors (e.g., vibrations caused by construction work, etc.), and considering that screen marking or on-site calibration must be performed again every time a change occurs, the labor costs are even more immeasurable.

[0035] At least some embodiments of the present disclosure provide an image processing method, which includes: obtaining an input image of a teaching scene, performing a detection process on the input image to determine a rectangular detection area including a blackboard area, performing an analysis process on the rectangular detection area to determine a target area corresponding to the blackboard area, determining four vertices of the target area, and performing coordinate transformation on the target area based on the four vertices of the target area to obtain a corrected blackboard area image.

[0036] Some embodiments of the present disclosure further provide an image processing device and a non-transitory storage medium corresponding to the above image processing method.

[0037] The image processing method according to the embodiment of the present disclosure can calibrate and correct the deformed blackboard area in the input image to obtain a corrected blackboard area image. The image processing method can use a low-cost fixed camera without disposing any additional devices, and is highly practical and suitable for widespread use. In addition, there is no need to manually mark data on the input image, and there is no need to place a calibration plate in the teaching scene and perform camera calibration, which can greatly reduce labor costs. Furthermore, based on the automatic marking and correction results of the blackboard area, it can assist in the identification process of the corresponding area, for example, to help students focus on the areas of interest they see on the blackboard area.

[0038] Hereinafter, some embodiments and examples of the present disclosure will be described in detail with reference to the drawings. It should be understood that the specific embodiments described herein are only used to explain and interpret the present disclosure, and are not used to limit the present disclosure.

[0039] 1 is a flowchart of an image processing method according to at least some embodiments of the present disclosure. For example, the image processing method can be applied to a computing device, which includes any electronic device having a computing function, and the electronic device may be, for example, a smartphone, a laptop, a tablet computer, a desktop computer, a server, etc., and the embodiments of the present disclosure are not limited thereto. For example, the computing device has a central processing unit (CPU) or a graphics processing unit (GPU), and the computing device further includes a memory. The memory is, for example, a non-volatile memory (e.g., a read only memory (ROM)) in which an operating system code is stored. For example, the memory further stores code or commands, and the image processing method according to the embodiments of the present disclosure can be realized by executing these codes or commands.

[0040] For example, as shown in FIG. 1, the image processing method includes the following steps S100 to S500.

[0041] Step S100: An input image of a teaching scene is obtained.

[0042] For example, in a typical teaching scene, a teacher teaches at a podium and supports it with various board writings. For example, in the embodiment of the present disclosure, board writing refers to a carrier that can be used to display the teacher's teaching content, including a blackboard, a whiteboard, a PPT projection area, etc., for example, in the board writing, the teacher can explain the teaching content by the board writing content such as characters, figures, symbols, etc. It should be understood that the board writing on the blackboard, whiteboard, PPT projection area, etc. is considered as board writing regardless of whether there is a specific board writing content on it.

[0043] For example, the input image of the teaching scene may include a photograph and a video image obtained by capturing the podium direction of the teaching scene with a camera (e.g., a camera lens of a video camera, a camera of a smartphone, etc.). For example, the screen of the input image of the teaching scene generally includes the screen of the board writing (i.e., the board writing area).

[0044] For example, in some embodiments, the input image may be a color image. For example, the color image may include, but is not limited to, a color image having three color channels. For example, the three color channels may include a first color channel, a second color channel, and a third color channel. For example, the three color channels may correspond to three primary colors. For example, in some embodiments, the first color channel may be a red (R) channel, the second color channel may be a green (G) channel, and the third color channel may be a blue (B) channel, i.e., the color image may be a color image in RGB format, and the embodiments of the present disclosure include, but are not limited to this. For example, in another embodiment, the input image may be a grayscale image.

[0045] Step S200: A detection process is performed on the input image to determine a rectangular detection area including the board writing area.

[0046] For example, in some embodiments, a general target detection algorithm may be used to detect the board area in the input image. For example, the general target detection algorithm includes R-CNN (Region-based Convolutional Neural Networks), SPP-net (Spatial Pyramid Pooling-net), Fast R-CNN, Faster R-CNN, R-FCN (Region-based Fully Convolutional Networks), YOLO (You Only Look Once), SSD (Single Shot MultiBox Detector), etc. For example, the detection result of the above target detection algorithm may include the type and position of a target object contained in the input image, and based on the type of the target object, it can be determined whether a board area exists in the input image, and based on the position of the target object, the position of the board area can be determined. For example, the above target detection algorithm generally determines the position of the target object by returning a bounding box of the target object (e.g., the upper left corner coordinate and the lower right corner coordinate of the bounding box). Before performing step S200 using the above target detection algorithm, it is generally necessary to train a target detection model, and the training process can refer to general training methods and will not be further described here, but it should be understood that a pre-trained target detection model may of course be used.

[0047] For example, step S200 is used to detect whether a board region exists in the input image and return the bounding box of the board region. Since the scene complexities of different teaching scenes (e.g., classrooms) are different, the difficulty of extracting the board region from the input image of different teaching scenes is also different. When extracting the board region based on the entire scene of the input image, it is greatly interfered with by complex background, human occlusion, or natural scene changes, and the computational cost increases and the execution speed decreases when operating on the input image of the entire scene. In order to better detect the board region, the computational resources can be concentrated on a specific small region, for example, in some embodiments, the YOLOv5 model may be used to segment a specific region from the entire scene image. The YOLOv5 model is much more flexible than other models, extremely strong in rapid deployment of the model, and combines the lightweight and fast characteristics of the model. The YOLOv5 model can output bounding box regression results and classification results, so that the classification can obtain the bounding box of the board area, for example, the top left corner coordinates (X_leftTop, Y_leftTop) and bottom right corner coordinates (X_rightBottom, Y_rightBottom) of the bounding box of the board area. The YOLOv5 model can narrow the detection range in the input image and eliminate part of the background interference for subsequent detection.

[0048] For example, in some embodiments, the bounding box of the board area output by the target detection model (e.g., YOLOv5 model) is the minimum circumscribing rectangular frame of the detected board area, and the rectangular area enclosed by the minimum circumscribing rectangular frame is the rectangular detection area in step S200. For example, in another embodiment, in order to facilitate subsequent processing, the minimum circumscribing rectangular frame may be expanded outward by a plurality of pixels (e.g., 10 to 20 pixels, e.g., 15 pixels) in each of the four directions, up, down, left, and right, to obtain a new rectangular frame, the area of ​​which is slightly larger than the area of ​​the minimum circumscribing rectangular frame, and in this case, the rectangular area enclosed by the new rectangular frame may be the rectangular detection area in step S200.

[0049] For example, in some embodiments, in order to eliminate possible false positives, the original features of the board area can be used as the first prior knowledge to authenticate the rectangular detection area, thereby eliminating erroneous classification of the target detection model, and thereby improving the accuracy rate of the target detection model. Figure 2 is a schematic diagram of a rectangular detection area in an input image according to at least some embodiments of the present disclosure. Illustratively, the input image in Figure 2 shows two deformed board areas (PPT areas that are deformed and therefore deviate from a rectangular shape) and their corresponding two rectangular detection areas (shown in black rectangular frames in Figure 2). It should be understood that Figure 2 is schematic and should not be considered as a limitation on the embodiments of the present disclosure.

[0050] For example, in some embodiments, the first prior knowledge includes that the center coordinate of the blackboard region is generally located in the upper half of the input image. Therefore, the center coordinate of the rectangle detection region is generally located in the upper half of the input image. For example, the center coordinate of the rectangle detection region may be calculated based on the upper left corner coordinate and the lower right corner coordinate of the bounding box of the blackboard region, for example, the center coordinate of the rectangle detection region is ((X_leftTop+X_rightBottom) / 2, (Y_leftTop+Y_rightBottom) / 2).

[0051] For example, in some embodiments, the first prior knowledge further includes that the aspect ratio of the board area is within a first range. In the real world, the aspect ratio of the board area is generally known, for example, the aspect ratio of the PPT area is generally 4:3 or 16:9, the aspect ratio of the whiteboard area is generally 1.5:1, and the aspect ratio of the blackboard area is generally 3:1 to 4:1. Considering that the deformation of the board area in the input image is generally not severe, the aspect ratio of the rectangular detection area should be close to the aspect ratio of the board area. For example, in some embodiments, the aspect ratio requirement of the rectangular detection area can be set as follows:

number

[0052] Theoretically, for a board area that is not deformed, the specific position of the board area can be directly obtained through the detection process in step S200. However, in actual applications, cameras in teaching scenes have different degrees of distortion, and the board area in the input image will have different degrees of deformation (there are almost no board areas in the input image that are exactly rectangular), which will have a certain impact on the calibration of the board area. As a result, it is difficult to directly determine the specific position of the board area through step S200, so the rectangular detection area obtained in step S200 needs to be further processed.

[0053] Step S300: An analysis process is performed on the rectangular detection area to determine a target area corresponding to the writing area on the board.

[0054] For example, step S300 can eliminate most or all of the pixels in the rectangular detection region that do not belong to the board region, thereby determining the specific location of the board region (ie, the target region).

[0055] 3 is an exemplary flowchart corresponding to step S300 shown in FIG 1 according to at least some embodiments of the present disclosure. For example, as shown in FIG 3, step S300 may include the following steps S310 to S340.

[0056] Step S310: A filtering process is performed on the rectangular detection region to obtain a filtered image corresponding to the rectangular detection region, and a first grayscale image is obtained based on the filtered image.

[0057] For example, in some embodiments, a filtering process is performed on the rectangular detection region (a rectangular detection region in an input image is regarded as one image) using a median filtering method. For example, the median filtering method is a nonlinear smoothing technique, and the principle of the median filtering method is to replace the gradation value of each pixel with the median value of all pixel gradation values ​​in a neighborhood window of the pixel (for example, an 8-neighborhood window consisting of 8 pixels other than the pixel in a 3×3 window centered on the pixel), to make the surrounding pixel values ​​closer to the true value, to suppress unnecessary noise points, and to eliminate redundant interference. Note that the embodiments of the present disclosure do not limit the method used for the filtering process. Note also that in an image, the position where the noise point is located is generally a place where the gradation change is large, and the position where the noise point is located is easily identified as a pseudo edge, so the filtering process in step S310 can improve the effect of the edge detection process in the subsequent step S330.

[0058] For example, in some embodiments, the input image is a color image (e.g., a color image in RGB format), and the filtered image is also a color image correspondingly, in which case the color image (e.g., the filtered image) can be converted into a grayscale image (e.g., a first grayscale image) by a general conversion formula. Taking the conversion of a color image in RGB format into a grayscale image as an example, the conversion can be performed by the following conversion formula: Gray=R*0.299+G*0.587+B*0.114 Here, Gray represents the brightness information of a gray scale image, and R, G, and B represent the red information (i.e., data information of the red channel), green information (i.e., data information of the green channel), and blue information (i.e., data information of the blue channel) of a color image in RGB format, respectively.

[0059] For example, in another embodiment, the input image is a gradient image and correspondingly, the filtered image is also a gradient image, in which case the directly filtered image can be the first gradient image.

[0060] Step S320: A saliency region detection process is performed on the first grayscale image to obtain a second grayscale image.

[0061] For example, in some embodiments, a saliency detection method based on global contrast may be used to perform saliency region detection on the first grayscale image. For example, in some embodiments, as shown in FIG. 4, step S320 may include the following steps S321 and S322.

[0062] Step S321: Calculate the global contrast of each pixel on the first grayscale image as the saliency value of the pixel.

[0063] For example, the saliency detection method based on global contrast may calculate the global contrast of each pixel over the entire image (i.e., the first grayscale image) as the saliency value of the pixel, i.e., the sum of the distances of each pixel to other pixels in the image in grayscale values ​​may be used as the saliency value of the pixel. For example, the saliency value of any pixel in the image may be calculated by the following formula:

number

[0064] Step S322: A second gradient image is obtained based on the saliency values ​​of all pixels on the first gradient image, and the gradation value of any pixel on the second gradient image is the saliency value of a pixel corresponding to the any pixel on the first gradient image.

[0065] For example, in some embodiments, the second gradient image may be obtained by replacing the gradient value of each pixel in the first gradient image with the saliency value of each pixel.

[0066] Step S330: An edge detection process and a binarization process are performed on the second gradation image to obtain a binary image.

[0067] For example, in some embodiments, the second gradation image may be subjected to edge detection processing using any one of edge detection algorithms such as a Sobel algorithm, a Canny algorithm, and a Laplacian algorithm. For example, in some embodiments, as shown in FIG. 5, step S330 may include the following steps S331 to S334.

[0068] Step S331: Calculate the gradient of all pixels on the second gradient image to determine the initial selected edge pixels.

[0069] For example, the gradient of the gray scale can represent the area where the gray scale change is obvious, and the edge of the object is also the area where the gray scale change is obvious, so the edge of the object in the image can be determined by calculating the gradient of the gray scale. Of course, the area where the gray scale change is large may be the edge of the object, but may not be the edge of the object, so only possible edges of the object (i.e., the initial selected edge pixels) can be obtained in step S331. Based on step S331, a set of the initial selected edge pixels is obtained.

[0070] Step S332: A non-maximum suppression operation is performed on the initial selected edge pixels to determine secondary selected edge pixels.

[0071] For example, where tone changes are generally evident, they are concentrated, and in the gradient directions within a local range, those with the largest tone changes (i.e., the largest gradient values) are kept, while others are not, thus removing most of the initially selected edge pixels, thereby turning object edges having a width of multiple pixels into object edges having a width of a single pixel. Falsely detected edges can be removed by the non-maximum suppression operation.

[0072] Step S333: Perform a double threshold screening operation on the secondary selected edge pixels to obtain the final selected edge pixels.

[0073] For example, after the non-maximal suppression operation, there may be many secondary selected edge pixels that do not belong to the true object edge. A double threshold, i.e., a high threshold and a low threshold, can be further set to perform a double threshold screening operation. If the gradient value of a pixel is higher than the high threshold, keep it and set it as a strong edge pixel; if the gradient value of a pixel is lower than the low threshold, discard it; if the gradient value of a pixel is between the high and low thresholds, set it as a weak edge pixel; look for the gradient value in the neighborhood window (e.g., 8 neighborhoods) of the pixel; if there is a gradient value higher than the high threshold, keep it; otherwise, discard it. The purpose of doing so is that if only the strong edge pixels are kept, the edge may not be closed, and it is necessary to fill in from the weak edge pixels so that the edge is as closed as possible.

[0074] Because the selection of the double threshold has a great influence on the result of the edge detection process, the embodiment of the present disclosure provides a method that can automatically determine the high and low thresholds based on different images, first determining the median value v of the image (e.g., the second grayscale image) gradient, setting a fixed parameter a0 (a0>0 and a0<1), and calculating to obtain the low threshold (1-a0)*v and the high threshold (1+a0)*v. This can perform more reasonable edge detection processing for different images of different scenes, and display the contour of the object (e.g., the contour of the blackboard area) more clearly. For example, the value of a0 can be set according to actual needs, and the embodiment of the present disclosure does not limit this. For example, in some embodiments, the value range of a0 can be set to [0.28, 0.37], for example, a0 can be set to 0.33, but is not limited thereto.

[0075] Step S334: Based on the final selected edge pixels, perform binarization processing on the second grayscale image to obtain a binary image.

[0076] For example, in some embodiments, the average gray level value of all the final selected edge pixels in the second gray level image may be used as a threshold value, and a binarization process may be performed on the second gray level image to obtain a binary image. Note that the present disclosure includes but is not limited to this. For example, in practical applications, the threshold value in the binarization process may be determined using any other feasible method.

[0077] Step S340: A connected region analysis process is performed on the binary image to determine a target region corresponding to the writing area on the board.

[0078] For example, in some embodiments, as shown in FIG. 6, step S340 may include the following steps S341 to S343.

[0079] Step S341: All connected regions on the binary image and the circumscribing rectangular frame of each connected region are determined.

[0080] For example, a connected region refers to an image region consisting of foreground pixels that have the same pixel value and are adjacent in position in an image. For example, a common algorithm such as a Two-Pass method or a Seed-Filling method or the connectedComponentsWithStates function of OpenCV may be used to find connected regions in a binary image, and then a minimum bounding rectangle algorithm (e.g., including but not limited to the minAreaRect function of OpenCV) may be used to determine the bounding rectangle of each connected region. For example, in some embodiments, the top left corner coordinates (x1, y1) and the bottom right corner coordinates (x2, y2) of the bounding rectangle of each connected region may be obtained.

[0081] Step S342: The second through N-th (N is an integer of 2 or more) connected regions are selected in descending order of the area of ​​the circumscribing rectangular frame as regions to be selected.

[0082] For example, in some embodiments, the area of ​​the circumscribing rectangle of each connected region may be calculated based on the upper left corner coordinate (x1, y1) and the lower right corner coordinate (x2, y2), for example, the calculation formula may be expressed as follows: Area=|x1-x2|*|y1-y2| Here, Area represents the area of ​​the circumscribing rectangular frame.

[0083] For example, in a binary image, background pixels are generally connected, and the area of ​​the circumscribing rectangular frame corresponding to the background region (i.e., the connected region formed by the background pixels) is often the largest. Therefore, in step S342, the connected region having the largest area of ​​the circumscribing rectangular frame can be directly excluded, i.e., the background region can be directly excluded.

[0084] For example, N may be set according to actual needs, and the embodiments of the present disclosure do not limit this. For example, in some embodiments, the value range of N may be set to [2, 5], such as N=2, and also such as N=5.

[0085] Step S343: Based on the second prior knowledge of the board region, the region to be selected is recognized to determine a target region corresponding to the board region.

[0086] For example, in some embodiments, the second prior knowledge includes that the distance between the center coordinates of the blackboard region and the center coordinates of the binary image is smaller than a distance threshold. Correspondingly, the distance between the center coordinates of the circumscribing rectangular frame of the blackboard region and the center coordinates of the binary image is also smaller than the distance threshold. For example, the center coordinates of the circumscribing rectangular frame of each connected region may be calculated based on the upper left corner coordinate and the lower right corner coordinate of the circumscribing rectangular frame of each connected region, for example, the center coordinates of the circumscribing rectangular frame of each connected region are ((x1+x2) / 2, (y1+y2) / 2), and then the distance between the center coordinates of the circumscribing rectangular frame of each connected region and the center coordinates of the binary image may be calculated, and the connected region whose distance is smaller than the distance threshold is likely to be the target region corresponding to the blackboard region. For example, in some examples, the distance between the center coordinates of the circumscribing rectangular frame of each connected region and the center coordinates of the binary image includes a first distance in the width direction of the binary image and a second distance in the height direction of the binary image, and correspondingly, the distance threshold includes a first distance threshold in the width direction of the binary image and a second distance in the height direction of the binary image, the first distance should be smaller than the first distance threshold, and the second distance should be smaller than the second distance threshold. For example, the first distance threshold may be set to 5% to 30% of the width of the binary image or other suitable ratio, and similarly, the second distance threshold may be set to 5% to 30% of the height of the binary image or other suitable ratio.

[0087] For example, in some embodiments, the second prior knowledge further includes that the aspect ratio of the blackboard area is within a second range. For example, the second range may be set to [(1-y)*R0,(1+y)*R0)], where R0 represents the aspect ratio of the blackboard area, and y represents the percentage of the tolerance. For example, the value of y may be set according to actual needs, and the embodiments of the present disclosure do not limit this. For example, in some embodiments, the value range of y may be set to [5%, 15%], for example, y may be set to 10%, but is not limited thereto. For example, the second range may be the same as the first range, and of course, the two may be different.

[0088] FIG. 7 is a schematic diagram of the result of the connected region analysis process according to at least some embodiments of the present disclosure. Illustratively, as shown in FIG. 7, when the connected region analysis process is performed on a binary image, a plurality of connected regions (including a background region, a blackboard region, and other unmarked connected regions, shown as regions of different gradations in FIG. 7) can be obtained, and among the circumscribing rectangular frames of all the connected regions, the order of the size of the area of ​​the circumscribing rectangular frame of the background region is generally first, and the order of the size of the area of ​​the circumscribing rectangular frame of the blackboard region is generally second. Note that for the sake of simplicity, the circumscribing rectangular frames of each connected region are omitted in FIG. 7, and different gradations are used to indicate different connected regions in order to distinguish different connected regions, so that FIG. 7 is different from the original binary image. It should be understood that FIG. 7 is schematic and should not be considered as a limitation on the embodiments of the present disclosure.

[0089] Step S400: Determine the four vertices of the target area.

[0090] For example, in some embodiments, as shown in FIG. 8, step S400 may include the following steps S410 to S440.

[0091] Step S410: Perform a contour detection process on the target region using a contour detection algorithm to obtain at least one contour.

[0092] For example, in some embodiments, a contour detection process may be performed on the target area using a contour detection algorithm such as OpenCV's findContours function to extract at least one contour. For example, in some embodiments, a contour detection process may be performed on the binary image (including the target area). For example, in some embodiments, when performing the contour detection process, the contours of contents such as characters or images in the target area (i.e., the blackboard area) may also be extracted.

[0093] For example, each contour includes a corresponding contour list, which includes information of all corner points of the contour to be selected (eg, coordinate positions of the corner points).

[0094] Step S420: Perform a screening process on the at least one contour to obtain at least one preliminary contour.

[0095] For example, in some embodiments, a screening process may be performed on at least one contour based on the following screening principle: (1) The area of ​​the contoured region is large. (2) The perimeter of the contoured region is long. The principle is that contours with large areas or long perimeters in the target region are generally associated with edges and corners of the board region.

[0096] Step S430: Based on the at least one preliminary contour, a preliminary set of corner points is determined.

[0097] For example, in some embodiments, based on the contour list of the at least one preliminary contour, the angle value of the apex angle corresponding to each corner point may be calculated and screened to obtain a preliminary corner point set. In practical application, each contour list generally consists of multiple corner points, but it is not possible to determine which corner point corresponds to the vertex of the writing area. Considering that the background edge information is messy, a corner point that does not belong to the writing area may appear in the contour list. For example, for the vertices of the writing area (where the writing area includes four vertices), a prior information may be determined that, in general, the angle change at the vertex of the writing area is larger than the angle change of the corner point on the parallel line.

[0098] 9A is an example flowchart corresponding to step S430 shown in FIG 8 according to at least some embodiments of the present disclosure. For example, in some embodiments, as shown in FIG 9A, step S430 may include the following steps S431 to S432.

[0099] Step S431: Calculate the angle value of the apex angle corresponding to each corner point of at least one preliminary contour.

[0100] For example, in some embodiments, the coordinate position of each corner point and the coordinate positions of two corner points adjacent to the corner point may be determined based on the contour list of each preliminary contour. Take corner point B as an example, the two corner points adjacent to corner point B are corner point A and corner point C, and the coordinates of corner points A, B, and C are (x A ,y A ), (x B ,y B ), (x C ,y C ) and the vertex angle corresponding to corner point B is ∠ABC. Then the sizes of the three sides a, b, and c of the triangle formed by corner points A, B, and C are as follows:

number

number

[0101] Step S432: Screening each corner point of the at least one preliminary contour based on the angle value of the apex angle corresponding to each corner point of the at least one preliminary contour to obtain a plurality of first preliminary corner points, and the preliminary corner point set includes the plurality of first preliminary corner points.

[0102] For example, for a theoretically undeformed blackboard region, the apex angles corresponding to the four vertices are all right angles. However, taking into account the deformation of the screen, the apex angles corresponding to each vertex of the blackboard region in the input image may deviate slightly from a right angle. For example, in some embodiments, a corner point whose apex angle value is within a preset angle range may be set as the first preliminary corner point. For example, the preset angle range may be set according to actual needs, and the embodiments of the present disclosure do not limit this. For example, in some embodiments, the preset angle range may be set to 60° to 135° or 75° to 125°, etc. As a result, the corner points (i.e., the multiple first preliminary corner points) in the preliminary corner point set obtained by screening are likely to be near a certain vertex of the blackboard region (including the case where a certain corner point itself is a certain vertex of the blackboard region).

[0103] For example, in another embodiment, a preliminary corner point set may be obtained by performing quadrangle fitting on each preliminary contour based on the contour list of the at least one preliminary contour. For example, the preliminary contours obtained in step S420 are generally polygons with different shapes, and by performing quadrangle fitting on each preliminary contour and setting the four vertices of the quadrangle obtained by fitting as preliminary corner points (e.g., second preliminary corner points), the data size of the preliminary corner point set can be reduced, which is advantageous in improving the execution speed of the image processing method.

[0104] 9B is another exemplary flowchart corresponding to step S430 shown in FIG 8 according to at least some embodiments of the present disclosure. For example, in some embodiments, as shown in FIG 9B, step S430 may include the following steps S433 to S435.

[0105] Step S433: Screen at least one preliminary contour based on a corner point number threshold to obtain at least one pre-selected contour.

[0106] For example, even when considering the deformation of the screen, the number of corner points included in the contour corresponding to the blackboard region in the input image is generally not very large, so it is considered that the preliminary contour with the number of corner points larger than the corner point number threshold is likely not to include the vertices of the blackboard region. For example, the corner point number threshold may be set according to actual needs, and the embodiments of the present disclosure do not limit this. For example, in some embodiments, the value range of the corner point number threshold may be set to [6, 10], for example, the corner point number threshold may be set to 8, but is not limited thereto.

[0107] Step S434: Perform line fitting for each preliminarily selected contour according to the fitting precision, discard corner points in each preliminarily selected contour whose distance is greater than the fitting precision, and keep corner points whose distance is less than the fitting precision to obtain a closed fitting graphic.

[0108] For example, in some embodiments, the fitting accuracy in the first broken line fitting process (i.e., the initial value of the fitting accuracy) may be set to b0*Length, where b0>0 and b0<1, and Length represents the contour perimeter of the corresponding pre-selected contour. For example, in some embodiments, the value range of b0 may be set to [0.005, 0.02], for example, b0 may be set to 0.01, but is not limited thereto.

[0109] Step S435: Calculate the area and number of corner points of the fitting graphic, and discard the pre-selected contour corresponding to the fitting graphic whose area is smaller than the area threshold and whose number of corner points is smaller than 4; if not, improve the fitting accuracy value and perform the next broken line fitting until finding a fitting graphic whose area is greater than or equal to the area threshold and whose number of corner points is equal to 4, and take the four vertices of the finally determined fitting image as second preliminary corner points, and the preliminary corner point set includes a plurality of second preliminary corner points.

[0110] For example, the area threshold may be set according to actual needs, and the embodiments of the present disclosure do not limit this. For example, in some embodiments, a fixed parameter c0 (c0>0 and c0<1) may be set, and the area S0 of the target area may be calculated based on the target area determined in step S300 (e.g., specifically, the target area determined in step S343), and the area threshold c0*S0 may be calculated. For example, the value of c0 may be set according to actual needs, and the embodiments of the present disclosure do not limit this. For example, in some embodiments, the value range of c0 may be set to [0.1, 0.3], for example, c0 may be set to 0.2, but is not limited thereto. Of course, in some embodiments, the area S0 of the target area may be replaced by the area of ​​the circumscribing rectangle of the target area in order to improve the execution speed.

[0111] For example, in some embodiments, if the initial fitting accuracy is set to b0*Length, the fitting accuracy in each subsequent broken line fitting process may be increased by, for example, 0.5*b0*Length from the fitting accuracy in the previous broken line fitting process.

[0112] For example, in some embodiments, the operation of step S430 may be realized using the above two methods simultaneously, that is, step S430 may include the above steps S431 to S435, in which case the preliminary corner point set includes a plurality of first preliminary corner points and a plurality of second preliminary corner points, thereby improving the accuracy of the four vertices of the target area determined in the subsequent step S440.

[0113] For example, the preliminary set of corner points obtained in step S430 includes a plurality of corner points distributed near each vertex of the board region.

[0114] Step S440: Determine four vertices of the target area based on the preliminary corner point set.

[0115] For example, in some embodiments, a first clustering operation may be performed on the corner points in the preliminary corner point set (i.e., the first preliminary corner point and / or the second preliminary corner point) to obtain four cluster centers, and the four cluster centers may be set as the four vertices of the target region. For example, in some embodiments, the first clustering operation may be performed using a K-means clustering algorithm.

[0116] For example, the main steps of the K-means clustering algorithm include dividing the prediction data (i.e., the preliminary corner set) into K groups, randomly selecting K objects (the objects are the corner points in the preliminary corner set) as initial cluster centers, then calculating the distance between each object and each seed cluster center, and assigning each object to its closest cluster center. The cluster centers and their assigned objects represent a cluster. After each sample assignment, the cluster centers of the clusters are recalculated based on the existing objects in the cluster. This process is repeated until certain termination conditions are met. The termination conditions are: 0 (or a minimum number) objects are reassigned to different clusters, 0 (or a minimum number) cluster centers change, and the error sum of squares is locally minimum.

[0117] For example, in the embodiment of the present disclosure, the K value is set to 4, all corner points in the preliminary corner point set are classified into four types, and the distance used in the clustering process is the Euclidean distance (specifically, the Euclidean distance in a two-dimensional space). For example, the Euclidean distance between the coordinate position of the sample to be classified and the coordinate position of the cluster center may be calculated based on the coordinate positions of the sample to be classified and the cluster center, and the above coordinate positions are all coordinate positions under the image coordinate system. Finally, the four cluster centers may be obtained as the four vertices of the target area, that is, the four vertices of the board area are predicted. That is, the calibration for the deformed board area in the input image is realized.

[0118] Step S500: Based on the four vertices of the target area, coordinate transformation is performed on the target area to obtain a corrected blackboard area image.

[0119] For example, the corrected blackboard image corresponds to the actual blackboard area and is generally rectangular. For example, in some embodiments, the coordinate transformation operation in step S500 may be performed based on constraints, including that the corrected blackboard image is rectangular and the four vertices of the target area correspond to the four vertices of the rectangle after the coordinate transformation.

[0120] For example, in some examples, based on the above constraints, a coordinate transformation matrix may be calculated according to the following coordinate transformation formula:

number

[0121] FIG. 10A is a schematic diagram of an input image according to at least some embodiments of the present disclosure, and FIG. 10B is a schematic diagram of a corrected blackboard area image obtained by processing the input image shown in FIG. 10A using the image processing method shown in FIG. 1. Note that FIG. 10B exemplarily illustrates a corrected blackboard area image obtained by processing the blackboard area on the right side of the input image shown in FIG. 10A (i.e., the PPT area shown in the block of FIG. 10A) using the image processing method shown in FIG. 1. For example, compared to the input image shown in FIG. 10A, the corrected blackboard area image shown in FIG. 10B can help students focus on the blackboard area they see, thereby contributing to improving study efficiency.

[0122] In addition, for teaching videos that contain multi-frame images, factors such as human occlusion or light changes may cause the output results (i.e., the vertex coordinates of the calibrated blackboard area) corresponding to images in different frames to be inconsistent. To solve the above problem, a two-time authentication method can be used to reconfirm the coordinates of the four vertices of the target area (i.e., the blackboard area).

[0123] 11 is a flowchart of another image processing method according to at least some embodiments of the present disclosure. For example, as shown in FIG 11, the image processing method includes the following steps S600 to S900.

[0124] Step S600: Obtain a video sequence of a teaching scene.

[0125] For example, similar to the operation in step S100, a video sequence may be obtained by shooting the direction of the podium in a teaching scene with a camera. For example, a video sequence generally includes images of multiple frames, and some of the images of the frames may have a problem that the vertices of the blackboard area are occluded by a person (e.g., a teacher, etc.), so that when the blackboard area is calibrated for the images of the some of the frames, the positions of the vertices of the blackboard area cannot be accurately calibrated (i.e., there are inaccurate predicted vertices), and further, when the blackboard area is corrected based on the inaccurate predicted vertices, there may be deformation on the screen of the corrected blackboard area image, which is detrimental to the improvement of the viewing effect.

[0126] Step S700: Extract multi-frame images from a video sequence as input images respectively, and obtain four vertices on each frame image of the multi-frame images of a target region.

[0127] For example, in some embodiments, for example, 10-20 frame images may be randomly extracted from a video sequence as input images, and the present disclosure includes but is not limited to this.

[0128] For example, after the images of each extracted frame are used as input images, the operation of step S700 can be realized using the above steps S100 to S500. For specific implementation processes and details, please refer to the above related descriptions, and no further description will be given here.

[0129] Step S800: Four vertices on the image of each frame of the multi-frame image of the target area are set as predicted vertices, and four final predicted vertices of the target area are determined based on the predicted vertices.

[0130] For example, in some embodiments, as shown in FIG. 12, step S800 may include the following steps S810 to S850.

[0131] Step S810: Based on the coordinates of the predicted vertices corresponding to each vertex of the target area, perform a second clustering operation on the predicted vertices corresponding to each vertex to obtain at least one predicted subclass corresponding to each vertex, and set the center coordinates of the predicted subclass including the currently most predicted vertices corresponding to each vertex as the current predicted coordinates of each vertex.

[0132] For example, in some embodiments, the Euclidean distance between any two of the multiple predicted vertices corresponding to each vertex is calculated, a certain predicted vertex and its neighboring predicted vertices, for example, three pixels or less, are grouped into one predicted subclass, the center point of the predicted subclass is set as the predicted vertex of the next step, and the above operation is repeated until the predicted vertex is not reassigned to a different predicted subclass, the center coordinate of the predicted subclass is not changed, or the error square sum is locally minimized, thereby realizing the second clustering operation.

[0133] Step S820: Based on the current predicted coordinates of the four vertices of the target area, a first included angle value between a line connecting the current predicted coordinates of any two adjacent vertices and a horizontal line is determined.

[0134] For example, in some embodiments, the slope of the line connecting the current predicted coordinates of any two adjacent vertices may be calculated, and then the first included angle between the connecting line and a horizontal line may be determined based on the slope and a trigonometric function, where when the slope is infinite, it indicates that the connecting line is perpendicular to the horizontal line, that is, the first included angle between the connecting line and the horizontal line is 90°.

[0135] For example, in another embodiment, an arbitrary pixel point coordinate in a direction parallel to the horizontal line of the current predicted coordinates of a vertex is selected, and based on the above-mentioned triangular cosine theorem, the included angle value between the line connecting the current predicted coordinates of two adjacent vertices and the line connecting the current predicted coordinates of the vertex and the pixel point coordinate is calculated, thereby obtaining a first included angle value between the line connecting the current predicted coordinates of the two adjacent vertices and the horizontal line.

[0136] Step S830: Based on the current predicted coordinates of any two adjacent vertices, a predicted rectangular area is determined in an image of a certain frame of the multi-frame images, the image of the certain frame having been subjected to filtering processing, salient area detection processing, edge detection processing and binarization processing, the line connecting the current predicted coordinates of any two adjacent vertices is a diagonal of the predicted rectangular area, and each side of the predicted rectangular area is parallel to or perpendicular to the horizontal line.

[0137] For example, the filtering process, salient area detection process, edge detection process and binarization process in step S830 can be referred to the relevant description of steps S310, S320 and S330. The specific implementation process and details are not further described here. For example, after the above process, a binary image can be obtained based on the image of a certain frame, so that a predicted rectangular area can be determined in the binary image, and the predicted rectangular area includes edge pixel (e.g., final selection edge pixel) information of the target area (i.e., the blackboard area). Considering the deformation of the screen, in the predicted rectangular area, the boundary of the blackboard area is represented as a curved arc line segment, rather than a horizontal or vertical boundary.

[0138] Step S840: Search for straight lines in the predicted rectangular region, determine a curve segment including a plurality of line segments, determine a slope of an average tangent of the curve segment based on the plurality of line segments, and determine a second included angle value between the average tangent and a horizontal line based on the slope of the average tangent.

[0139] For example, in some embodiments, step S840 may include the following steps S841 to S843.

[0140] Step S841: Line segments formed by edge pixels in the predicted rectangular region are transformed from the Cartesian coordinate system to Hough space to determine a number of line segments.

[0141] For example, a straight line in the Cartesian coordinate system corresponds to a point in the Hough space, and when the points under the Cartesian coordinate system are collinear, the straight lines corresponding to these points in the Hough space intersect at a point. Therefore, based on this characteristic, a straight line can be detected in the Cartesian coordinate system. Compared with other methods of searching for straight lines, this method can better reduce noise interference. Note that, based on step (1), many discontinuous line segments can generally be obtained in the predicted rectangular area.

[0142] Step S842: Based on whether the start and end points of the line segments overlap or are close to each other, it is determined whether the line segments belong to the same curve, and one curve segment is determined.

[0143] For example, in step S842, the threshold for determining whether the two lines overlap or are close to each other may be set according to actual needs. For example, the threshold may be set to 5 pixels, i.e., if the distance between an end point of one line segment and an end point of another line segment is 5 pixels or less, the positions of the start and end points of the two line segments are considered to overlap or be close to each other. Based on step (2), a curve segment corresponding to the boundary of the blackboard area in the input image can be determined.

[0144] Step S843: Calculate the average value of the slopes of all line segments in the curve segment as the slope of an average tangent to the curve segment, and determine a second included angle value between the average tangent and the horizontal line based on the slope of the average tangent.

[0145] For example, the average slope of all line segments in the curve segment may be calculated according to the following formula:

number

number

[0146] Step S850: Determine final predicted coordinates of the two arbitrary adjacent vertices based on the first included angle value and the second included angle value.

[0147] For example, in some embodiments, step S850 may include the following step (1).

[0148] (1) In response to the difference between the first angle value and the second angle value being equal to or less than a first threshold, the current predicted coordinates of the two adjacent vertices are set as the final predicted coordinates of the two adjacent vertices. For example, the first threshold may be set according to actual needs, and the embodiments of the present disclosure are not limited thereto. For example, in some embodiments, the first threshold may be set to, for example, 3°, but is not limited thereto.

[0149] For example, in some embodiments, step S850 may further include the following steps (2)-(4).

[0150] (2) In response to the difference between the first angle value and the second angle value being greater than a first threshold, determine whether the minimum distance between the current predicted coordinates of the two adjacent vertices and the curve segment is equal to or less than a second threshold. For example, if the difference between the first angle value and the second angle value is greater than the first threshold, it indicates that a prediction error exists in the current predicted coordinates of at least one of the two adjacent vertices, and the current predicted coordinates are not suitable as final predicted coordinates. There are two cases. One is that a prediction error exists in the current predicted coordinates of only one vertex. The other is that a prediction error exists in the current predicted coordinates of both vertices. The following steps (3) and (4) can handle the above two cases based on the determination results. For example, the minimum distance between the current predicted coordinates of each vertex and the curve segment is the minimum of the distances between the current predicted coordinates of each vertex and all line segments in the curve segment, and for example, the distance between the current predicted coordinates of each vertex and each line segment may be calculated using Euclidean distance.

[0151] (3) In response to the minimum distance between the current predicted coordinate of one of the two adjacent vertices and the curved line being equal to or less than the second threshold value and the minimum distance between the current predicted coordinate of the other of the two adjacent vertices and the curved line being greater than the second threshold value, a first straight line is determined that passes through the current predicted coordinate of one of the two adjacent vertices based on the slope of the average tangent, and a second straight line is determined based on the current predicted coordinate of a vertex opposite to the one of the two adjacent vertices and the current predicted coordinate of the other of the two adjacent vertices, and the current predicted coordinate of the one of the two adjacent vertices is set as the final predicted coordinate of the one of the two adjacent vertices, and the coordinate of the intersection of the first straight line and the second straight line is set as the final predicted coordinate of the other of the two adjacent vertices. It should be understood that the vertex opposite to one of the two adjacent vertices is a vertex that is adjacent to the other of the two adjacent vertices and is different from the one of the two adjacent vertices.

[0152] (4) In response to the minimum distances between the current predicted coordinates of any two adjacent vertices and the curve segment being both greater than a second threshold, discard the prediction subclass including the currently most predicted vertex corresponding to each of the any two adjacent vertices, and set the center coordinates of the other prediction subclass including the most predicted vertex corresponding to each of the any two adjacent vertices as the current predicted coordinates of each of the any two adjacent vertices, until final predicted coordinates of each of the any two adjacent vertices are determined.

[0153] For example, in rare cases, even if the above steps (1)-(4) are followed, the final predicted coordinates of the four vertices of the target area (i.e., the four final predicted vertices of the target area) may not be determined. Therefore, in some embodiments, step S850 may further include the following step (5).

[0154] (5) in response to all of the predicted subclasses corresponding to the any two adjacent vertices being discarded, determine an average tangent to the curve segments corresponding to the any two adjacent vertices based on a slope of the average tangent to the curve segments corresponding to the any two adjacent vertices, determine a third straight line based on the current predicted coordinates of a vertex opposite one of the any two adjacent vertices and the current predicted coordinates of the other of the any two adjacent vertices, determine a fourth straight line based on the current predicted coordinates of a vertex opposite the other of the any two adjacent vertices and the current predicted coordinates of one of the any two adjacent vertices, and set the coordinates of an intersection of the average tangent and the third straight line as the final predicted coordinates of one of the any two adjacent vertices.

[0155] It should be understood that the method of determining the second line in step (3) can be referred to the relevant description of steps (1)-(5), and will not be described again here. Similarly, the method of determining the third line and the fourth line in step (5) can be referred to the relevant description of steps (1)-(5), and will not be described again here. Furthermore, in step (4), when the center coordinates of another prediction subclass that includes the most prediction vertices corresponding to each vertex of the two adjacent vertices are taken as the current prediction coordinates of each vertex of the two adjacent vertices, it should be understood that the process of re-determining the final prediction coordinates of each vertex of the two adjacent vertices can be referred to the relevant description of steps S820 and S850 (e.g., steps (1)-(5)). Furthermore, it should be understood that in this process, the second included angle value previously determined based on steps S830 and S840 can be directly used, and thus there is no need to repeatedly perform steps S830 and S840.

[0156] It should be understood that based on the above steps S810 to S850, the final predicted coordinates of the four vertices of the target area can be determined, that is, the four final predicted vertices of the target area can be determined.

[0157] Step S900: According to the four final predicted vertices of the target area, perform coordinate transformation on the target area in the image of each frame of the video sequence to obtain a corrected blackboard area image corresponding to the image of each frame of the video sequence.

[0158] For example, the operation of step S900 can be referred to the relevant description of step S500 above, and the specific implementation process and details will not be described repeatedly here. For example, in some embodiments, a corrected video sequence may be obtained based on a corrected blackboard area image corresponding to each frame image of the video sequence.

[0159] FIG. 13A is a schematic block diagram of an input image according to at least some embodiments of the present disclosure, FIG. 13B is a schematic diagram of a rectangular boundary of a target area (i.e., a board area) in the input image shown in FIG. 13A, and FIG. 13C is a schematic diagram of four vertices of the target area (i.e., a board area) in the input image shown in FIG. 13A. For example, FIG. 13A shows four vertices (shown as black dots in FIG. 13A) of a target area determined using the image processing method shown in FIG. 1, and the vertex in the lower left corner in FIG. 13A is obviously shifted from its true position due to human occlusion. For example, FIG. 13A shows an image of one frame in a video sequence, and images of other frames in the video sequence are not shown. For example, FIG. 13B shows a rectangular boundary of a target area determined using the image processing method shown in FIG. 11, and each side of the rectangular boundary is one of the lines connecting two adjacent vertices, the first straight line, the second straight line, the third straight line, and the fourth straight line. For example, Fig. 13C shows four vertices (i.e., four final predicted vertices, shown by black dots in Fig. 13C) of the target area determined using the image processing method shown in Fig. 11, and the vertex in the lower left corner in Fig. 13C is closer to its true position than that in Fig. 13A. Therefore, the image processing method shown in Fig. 11 can overcome the problem that the output results (i.e., the vertex coordinates of the calibrated board area) corresponding to images of different frames do not match due to factors such as human occlusion or light changes.

[0160] It should be noted that in the embodiments of the present disclosure, the process of the image processing method may include more or less operations that can be performed sequentially or in parallel. Although the process of the image processing method described above includes multiple operations that appear in a specific order, it should be clearly understood that the order of the multiple operations is not limited. The image processing method described above may be performed once or multiple times under a predetermined condition.

[0161] The image processing method according to the embodiment of the present disclosure can calibrate and correct the deformed blackboard area in the input image to obtain a corrected blackboard area image. The image processing method can use a low-cost fixed camera without disposing any additional devices, and is highly practical and suitable for widespread use. In addition, there is no need to manually mark data on the input image, and there is no need to place a calibration plate in the teaching scene and perform camera calibration, which can greatly reduce labor costs. Furthermore, based on the automatic marking and correction results of the blackboard area, it can assist in the identification process of the corresponding area, for example, to help students focus on the areas of interest they see on the blackboard area.

[0162] At least some embodiments of the present disclosure further provide an image processing device. Figure 14 is a schematic block diagram of an image processing device according to at least some embodiments of the present disclosure. For example, as shown in Figure 14, the image processing device 100 includes a memory 110 and a processor 120.

[0163] For example, memory 110 may be used to non-temporarily store computer-readable instructions and processor 120 may be used to execute the computer-readable instructions, which, when executed by processor 120, perform an image processing method according to any embodiment of the present disclosure.

[0164] For example, the memory 110 and the processor 120 can communicate with each other directly or indirectly. For example, in some examples, as shown in FIG. 2, the image processing device 100 may further include a system bus 130, and the memory 110 and the processor 120 can communicate with each other via the system bus 130, for example, the processor 120 can access the memory 110 via the system bus 130. For example, in another example, components such as the memory 110 and the processor 120 can communicate with each other via a network connection. The network may include a wireless network, a wired network, and / or any combination of a wireless network and a wired network. The network may include a local area network, the Internet, a telecommunication network, a ubiquitous network based on the Internet and / or a telecommunication network (Internet of Things), and / or any combination of the above networks. The wired network can communicate using a method such as twisted pair, coaxial cable, or optical fiber transmission, and the wireless network can use a communication method such as 3G / 4G / 5G mobile communication network, Bluetooth, Zigbee, or WiFi. This disclosure does not limit the type and function of the network herein.

[0165] For example, the processor 120 can control other components in the image processing device to perform desired functions. The processor 120 may be a device having data processing capabilities and / or program execution capabilities, such as a central processing unit (CPU), a tensor processor (TPU) or a graphics processor GPU. The central processor (CPU) may be of X86 or ARM architecture, etc. The GPU may be directly integrated on the motherboard by itself, or may be integrated into the northbridge chip of the motherboard. The GPU may also be integrated into the central processor (CPU).

[0166] For example, the memory 110 may include any combination of one or more computer program products, which may include various forms of computer readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or high speed cache, etc. Non-volatile memory may include, for example, read only memory (ROM), hard disk, erasable programmable read only memory (EPROM), portable compact disk read only memory (CD-ROM), USB memory, flash memory, etc.

[0167] For example, one or more computer commands can be stored on the memory 110, and the processor 120 can execute the computer commands to realize various functions. The computer-readable storage medium may further store various application programs and various data, such as input images, video sequences, corrected board area images, and various data generated and / or used by the application programs.

[0168] For example, some computer commands stored in memory 110 may be executed by processor 120 to perform one or more steps in the image processing methods described above.

[0169] For example, as shown in FIG. 14, the image processing device 100 may further include an input interface 140 that enables communication between an external device and the image processing device 100. For example, the input interface 140 may be used to receive commands or data (e.g., input images, video sequences, etc.) from an external computer device, a user, etc. The image processing device 100 may further include an output interface 150 that interconnects the image processing device 100 and one or more external devices. For example, the image processing device 100 can output image processing results (e.g., a corrected board area image) and the like via the output interface 150. The external devices that communicate with the image processing device 100 via the input interface 140 and the output interface 150 may be included in an environment that provides a user interface with which any type of user can interact. Examples of user interface types include graphical user interfaces, natural user interfaces, etc. For example, a graphical user interface can receive input from a user using an input device such as a keyboard, a mouse, a remote control, etc., and provide output on an output device such as a display. A natural user interface also allows a user to interact with the imaging device 100 without constraints imposed by input devices such as a keyboard, mouse, remote control, etc. In contrast, a natural user interface may rely on voice recognition, touch and stylus pen recognition, on-screen and near-screen gesture recognition, in-air gestures, head and eye tracking, voice and semantics, vision, touch, gestures, and device intelligence, etc.

[0170] Also, although the image processing device 100 is shown as a single system in FIG. 14, it is understood that the image processing device 100 may be a distributed system or a cloud facility (including a public cloud or a private cloud). Thus, for example, multiple devices can communicate via a network connection and jointly perform the tasks that the image processing device 100 is described to perform. For example, in some embodiments, an input image or video sequence can be obtained through a client and the input image or video sequence can be uploaded to a server, and the server performs a process of image processing based on the received input image or video sequence, and then returns a corrected board area image or a corrected board area image sequence (i.e., a corrected board area image corresponding to an image of each frame of the video sequence) to the client for providing to the user.

[0171] For example, for a detailed description of the implementation process of the image processing method, please refer to the relevant description in the embodiment of the image processing method above, and the repetition will not be described further here.

[0172] For example, in some examples, the image processing device may include, but is not limited to, a smartphone, a tablet computer, a personal computer, a personal digital assistant (PDA), a wearable device, a head-mounted display device, a server, and the like.

[0173] In addition, the image processing device according to the embodiments of the present disclosure is illustrative and not limiting. According to actual application needs, the image processing device may further include other common components or structures, for example, functions required to realize the image processing device. Those skilled in the art can configure other conventional components or structures based on specific application scenes, and the embodiments of the present disclosure are not limited thereto.

[0174] For the technical effects of the image processing device according to the embodiments of the present disclosure, please refer to the corresponding descriptions regarding the image processing method in the above embodiments, and no further description will be given here.

[0175] At least one embodiment of the present disclosure further provides a non-transitory storage medium. Figure 15 is a schematic diagram of a non-transitory storage medium according to one embodiment of the present disclosure. For example, as shown in Figure 15, the non-transitory storage medium 200 non-transitory stores computer-readable commands 201, which, when executed by a computer (including a processor), can perform an image processing method according to any embodiment of the present disclosure.

[0176] For example, one or more computer commands may be stored on the non-transitory storage medium 200. Some computer commands stored on the non-transitory storage medium 200 may be, for example, commands for implementing one or more steps in the image processing method described above.

[0177] For example, the non-transitory storage medium may include a storage member of a tablet computer, a hard disk of a personal computer, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an optical disk read-only memory (CD-ROM), a flash memory, or any combination of the above storage media, or may be other applicable storage media.

[0178] For the technical effects of the non-transitory storage medium according to the embodiments of the present disclosure, please refer to the corresponding description of the image processing method in the above embodiments, and no further description will be given here.

[0179] Regarding this disclosure, the following points need to be explained.

[0180] (1) The drawings of the embodiments of the present disclosure only relate to the configurations related to the embodiments of the present disclosure, and other configurations may generally refer to the design.

[0181] (2) If not in conflict, the embodiments and features of the embodiments of the present disclosure may be combined with each other to obtain new embodiments.

[0182] The above are merely specific embodiments of the present disclosure, but the scope of protection of the present disclosure is not limited thereto, and any modifications or replacements that any skilled artisan in the technical field of the present disclosure can easily think of within the technical scope of the present disclosure should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be in accordance with the scope of protection of the claims.

Claims

1. 1. A computer-implemented image processing method, comprising the steps of: Obtaining an input image of a teaching scene; performing a detection process on the input image to determine a rectangular detection area including a board writing area; performing an analysis process on the rectangular detection area to determine a target area corresponding to the writing area on the board; determining four vertices of the target area; and performing coordinate transformation on the target area based on the four vertices of the target area to obtain a corrected blackboard area image; Determining four vertices of the target area includes: performing a contour detection process on the target region using a contour detection algorithm to obtain at least one contour; performing a screening process on the at least one contour to obtain at least one preliminary contour; determining a preliminary set of corner points based on the at least one preliminary contour; determining four vertices of the target area based on the preliminary corner point set; The step of performing the analysis process on the rectangular detection area to determine the target area corresponding to the board writing area includes: performing a filtering process on the rectangle detection region to obtain a filtered image corresponding to the rectangle detection region, and obtaining a first gradation image based on the filtered image; performing a saliency region detection process on the first grayscale image to obtain a second grayscale image; performing edge detection and binarization on the second gradation image to obtain a binary image; performing a connected region analysis process on the binary image to determine the target region corresponding to the writing region on the board; performing the edge detection process and the binarization process on the second gradation image to obtain the binary image, calculating a gradient of all pixels on the second gradient image to determine an initial selection of edge pixels; performing a non-maximum suppression operation on the initially selected edge pixels to determine secondary selected edge pixels; performing a double threshold screening operation on the secondary selected edge pixels to obtain final selected edge pixels; performing the binarization process on the second grayscale image based on the final selected edge pixels to obtain the binary image.

2. Determining the preliminary set of corner points based on the at least one preliminary contour comprises: calculating an angle value of an apex angle corresponding to each corner point of said at least one preliminary contour; and screening each corner point of the at least one preliminary contour based on an angle value of an apex angle corresponding to each corner point of the at least one preliminary contour to obtain a plurality of first preliminary corner points; The image processing method according to claim 1 , wherein the preliminary corner point set includes the first preliminary corner points.

3. Determining the preliminary set of corner points based on the at least one preliminary contour comprises: screening the at least one preliminary contour based on a corner point number threshold to obtain at least one preselected contour; performing a polygonal fitting for each of the pre-selected contours according to a fitting precision, discarding corner points in each of the pre-selected contours whose distance is greater than the fitting precision, and keeping corner points whose distance is less than the fitting precision, to obtain a closed fitting graphic; calculating the area and the number of corner points of the fitting graphic, discarding the pre-selected contour corresponding to the fitting graphic whose area is less than the area threshold and whose number of corner points is less than four, otherwise improving the value of the fitting accuracy and performing the next polygonal fitting until finding a fitting graphic whose area is equal to or greater than the area threshold and whose number of corner points is equal to four, and taking the four vertices of the finally determined fitting image as second pre-selected corner points; The image processing method according to claim 1 , wherein the preliminary corner point set includes a plurality of the second preliminary corner points.

4. Determining the preliminary set of corner points based on the at least one preliminary contour comprises: calculating an angle value of an apex angle corresponding to each corner point of said at least one preliminary contour; screening each corner point of the at least one preliminary contour based on an angle value of an apex angle corresponding to each corner point of the at least one preliminary contour to obtain a plurality of first preliminary corner points; screening the at least one preliminary contour based on a corner point number threshold to obtain at least one preselected contour; performing a polygonal fitting for each of the pre-selected contours according to a fitting precision, discarding corner points in each of the pre-selected contours whose distance is greater than the fitting precision, and keeping corner points whose distance is less than the fitting precision, to obtain a closed fitting graphic; calculating the area and the number of corner points of the fitting graphic, discarding the pre-selected contour corresponding to the fitting graphic whose area is less than the area threshold and whose number of corner points is less than four, otherwise improving the value of the fitting accuracy and performing the next polygonal fitting until finding a fitting graphic whose area is equal to or greater than the area threshold and whose number of corner points is equal to four, and taking the four vertices of the finally determined fitting image as second pre-selected corner points; The image processing method according to claim 1 , wherein the preliminary corner point set includes the plurality of first preliminary corner points and a plurality of the second preliminary corner points.

5. Determining four vertices of the target area based on the preliminary corner point set includes: The image processing method of claim 1 , further comprising: performing a clustering operation on the salient points in the preliminary set of salient points to obtain four cluster centers, and setting the four cluster centers as four vertices of the target region.

6. performing the filtering process on the rectangle detection region to obtain the filtered image corresponding to the rectangle detection region, The image processing method according to claim 1 , further comprising: performing the filtering process on the rectangular detection region using a median filtering method to obtain the filtered image corresponding to the rectangular detection region.

7. performing the saliency region detection process on the first gradation image to obtain the second gradation image, Calculating a global contrast of each pixel on the first grayscale image as a saliency value of the pixel; 2. The image processing method of claim 1, further comprising obtaining a second gradient image based on the saliency values ​​of all pixels on the first gradient image, the gradation value of any pixel on the second gradient image being the saliency value of a pixel corresponding to the any pixel on the first gradient image.

8. performing a connected region analysis process on the binary image to determine the target region corresponding to the blackboard region; determining all connected regions on the binary image and a circumscribing rectangular frame for each of the connected regions; selecting second to Nth (N is an integer of 2 or more) connected regions in descending order of area of ​​the circumscribing rectangular frame as regions to be selected; and authenticating the region to be selected based on a second prior knowledge of the board region to determine the target region corresponding to the board region; 2. The image processing method of claim 1, wherein the second prior knowledge includes that a distance between a center coordinate of the blackboard area and a center coordinate of the binary image is smaller than a distance threshold, and that an aspect ratio of the blackboard area is within a second range.

9. performing the detection process on the input image to determine the rectangular detection area including the board writing area, authenticating the rectangular detection region based on a first prior knowledge of the board region; The image processing method according to claim 1 , wherein the first prior knowledge includes that a center coordinate of the blackboard writing area is located in an upper half portion of the input image, and that an aspect ratio of the blackboard writing area is within a first range.

10. performing the coordinate transformation on the target area based on the four vertices of the target area to obtain the corrected blackboard writing area image; performing the coordinate transformation based on a constraint; The constraint is:

2. The image processing method according to claim 1, wherein the corrected image of the board area is rectangular, and four vertices of the target area correspond to four vertices of the rectangle after the coordinate transformation.

11. acquiring a video sequence of the teaching scene; extracting multi-frame images from the video sequence as the input images, respectively, to obtain four vertices on each frame image of the multi-frame images of the target area; determining four final predicted vertices of the target area based on four vertices on each frame image of the multi-frame image of the target area as predicted vertices; The image processing method according to any one of claims 1 to 10, further comprising: performing coordinate transformation on the target area in the image of each frame of the video sequence based on the four final predicted vertices of the target area to obtain a corrected blackboard area image corresponding to the image of each frame of the video sequence.

12. determining four vertices on an image of each frame of the multi-frame image of the target area as the predicted vertices, and determining four final predicted vertices of the target area based on the predicted vertices; According to the coordinates of the predicted vertices corresponding to each vertex of the target area, a second clustering operation is performed on the predicted vertices corresponding to each vertex to obtain at least one predicted subclass corresponding to each vertex, and the central coordinates of the predicted subclass including the most currently predicted vertices corresponding to each vertex are set as the current predicted coordinates of each vertex; determining a first angle value between a line connecting the current predicted coordinates of any two adjacent vertices and a horizontal line based on the current predicted coordinates of the four vertices of the target area; determining a prediction rectangular area in an image of a certain frame of the multi-frame images based on current prediction coordinates of the two adjacent vertices, the image of the certain frame having been subjected to filtering, saliency area detection, edge detection and binarization, a line connecting the current prediction coordinates of the two adjacent vertices is a diagonal of the prediction rectangular area, and each side of the prediction rectangular area is parallel or perpendicular to the horizontal line; searching for straight lines in the predicted rectangular region to determine a curved line segment including a plurality of line segments; determining a slope of an average tangent of the curved line segment based on the plurality of line segments; and determining a second included angle value between the average tangent and the horizontal line based on the slope of the average tangent; and determining final predicted coordinates of any two adjacent vertices based on the first included angle value and the second included angle value.

13. Determining final predicted coordinates of any two adjacent vertices based on the first included angle value and the second included angle value includes:

13. The image processing method of claim 12, further comprising: in response to a difference between the first included angle value and the second included angle value being less than or equal to a first threshold, setting current predicted coordinates of any two adjacent vertices as final predicted coordinates of any two adjacent vertices.

14. Determining final predicted coordinates of any two adjacent vertices based on the first included angle value and the second included angle value includes: in response to a difference between the first included angle value and the second included angle value being greater than the first threshold, determining whether a minimum distance between current predicted coordinates of any two adjacent vertices and the curve segment is less than or equal to a second threshold; in response to a minimum distance between a current predicted coordinate of one of the two adjacent vertices and the curved line segment being equal to or smaller than the second threshold value and a minimum distance between a current predicted coordinate of the other of the two adjacent vertices and the curved line segment being greater than the second threshold value, determining a first straight line passing through a current predicted coordinate of one of the two adjacent vertices based on a slope of the average tangent, and determining a second straight line based on a current predicted coordinate of a vertex opposite to one of the two adjacent vertices and a current predicted coordinate of the other of the two adjacent vertices, the current predicted coordinate of one of the two adjacent vertices being set as a final predicted coordinate of one of the two adjacent vertices, and a coordinate of an intersection of the first straight line and the second straight line being set as a final predicted coordinate of the other of the two adjacent vertices; 14. The image processing method according to claim 13, further comprising, in response to the minimum distance between the current predicted coordinates of any two adjacent vertices and the curve portion being both greater than the second threshold, discarding a prediction subclass including a currently most frequently predicted vertex corresponding to each of the any two adjacent vertices, and setting center coordinates of another prediction subclass including a most frequently predicted vertex corresponding to each of the any two adjacent vertices as the current predicted coordinates of each of the any two adjacent vertices, until final predicted coordinates of each of the any two adjacent vertices are determined.

15. Determining final predicted coordinates of any two adjacent vertices based on the first included angle value and the second included angle value includes:

15. The image processing method of claim 14, further comprising: in response to all of the predicted subclasses corresponding to any two adjacent vertices being discarded, determining an average tangent to the curve segment corresponding to any two adjacent vertices based on a slope of the average tangent to the curve segment corresponding to any two adjacent vertices; determining a third straight line based on a current predicted coordinate of a vertex facing one of the any two adjacent vertices and the current predicted coordinate of the other of the any two adjacent vertices; determining a fourth straight line based on the current predicted coordinate of a vertex facing the other of the any two adjacent vertices and the current predicted coordinate of one of the any two adjacent vertices; setting coordinates of an intersection of the average tangent and the third straight line as final predicted coordinates of one of the any two adjacent vertices; and setting coordinates of an intersection of the average tangent and the third straight line as final predicted coordinates of the other of the any two adjacent vertices.

16. An image processing device, a memory for non-transiently storing computer readable instructions; An image processing apparatus comprising a processor for executing said computer readable instructions, the processor performing the image processing method of any one of claims 1 to 15 when said computer readable instructions are executed by said processor.

17. A non-transitory storage medium for non-transitoryly storing computer readable commands, the non-transitory storage medium performing an image processing method according to any one of claims 1 to 15 when the computer readable commands are executed by a computer.

Citation Information

Patent Citations

  • A distortion image correction method and device based on corner detection

    CN109409366A

  • Corner point detection method and device, electronic equipment and storage medium

    CN111681284A

  • Multi-scale pixel-level depth optimization image restoration method

    CN111861943A

  • Object retrieval system and method

    JP2006221525A