A text recognition method and system for campus smart paper and pen
Through connected domain detection and contour detection algorithms, the text recognition problem of campus smart paper and pen under low-precision cameras and poor lighting conditions is solved, the recognition accuracy and efficiency are improved, the recognition process is adapted to complex writing characteristics, and the recognition process is simplified.
Patent Information
- Application Number
- CN202410070088.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-18
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-01-18
AI Technical Summary
The existing campus smart paper and pen text recognition technology has low image data quality under low-precision cameras and poor lighting conditions, resulting in low character recognition accuracy. It also has poor adaptability to the characteristics of continuous strokes and slanted writing, which can easily lead to recognition errors.
Use connected domain detection algorithm and contour detection algorithm to convert behavioral data into image data, identify character areas and segment them, identify character content through feature extraction and matching, and integrate it into text information through preset synthesis methods to adapt to low-precision conditions and complex writing characteristics.
It improves the quality of image data under low-precision cameras and poor lighting conditions, reduces character recognition errors, achieves real-time and efficient text recognition, and simplifies the character recognition process, and is suitable for a variety of text recognition scenarios.
Smart Images

Figure CN117894030B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of text recognition technology, and in particular to a text recognition method and system for campus smart paper and pen. Background Art
[0002] With the development of information technology, campus smart pen and paper, as a new type of intelligent education tool, has gradually attracted the attention of the education industry. Campus smart pen and paper can convert students' writing on paper into electronic text in real time, making it convenient for teachers to monitor and analyze students' learning in real time. At present, the text recognition technology of campus smart pen and paper is mainly based on image processing and machine learning algorithms.
[0003] In the prior art, in the process of converting behavioral data into image data, the prior art often relies on high-precision cameras and good lighting conditions to ensure that clear image data is obtained. However, in actual application scenarios, due to the limitations of camera quality, lighting conditions and other factors, the image data quality is not high, which in turn affects the subsequent character recognition accuracy; secondly, the prior art often relies on edge detection algorithms, such as the Canny operator. However, these algorithms have poor adaptability to the writing characteristics of characters such as connected strokes and tilts, which easily leads to character recognition errors.
[0004] Therefore, the prior art has defects and needs to be improved. Summary of the invention
[0005] In order to solve one or several problems in the prior art, the main purpose of this application is to provide a text recognition method and system for campus smart paper and pen.
[0006] In order to achieve the above-mentioned invention object, the present application proposes a text recognition method for campus smart paper and pen, the method comprising:
[0007] Obtaining the execution instructions of the paper and pen in real time;
[0008] When the execution instruction is received, the behavior data of the paper and pen during the writing process is obtained;
[0009] Converting the behavior data into image data, and obtaining the character region of the image data by a connected domain detection algorithm;
[0010] Detecting the boundary of the character area by contour, segmenting the characters in the image data according to the boundary, and obtaining a text area;
[0011] Identify the characters that distinguish the text, perform feature extraction and matching, and identify the character content;
[0012] Based on the character contents, the character contents are integrated into text information through a preset synthesis method.
[0013] Furthermore, the converting the behavior data into image data and obtaining the character region of the image data by a connected domain detection algorithm includes:
[0014] Receiving behavior data of the paper and pen, wherein the behavior data includes movement trajectory, speed and pressure information of the pen on the paper;
[0015] Preprocessing the behavior data and converting it into a feature vector;
[0016] Inputting the feature vector into a preset model, identifying the feature vector through the preset model and outputting image data, wherein the image data includes mapping the movement trajectory to a specific pixel value;
[0017] Identify a single character region and / or multiple character regions in the image data by a connected domain detection algorithm;
[0018] Based on the single character region and / or the multiple character regions, character data is obtained.
[0019] Furthermore, detecting the boundary of the character area by contour, segmenting the characters in the image data according to the boundary, and obtaining the text area includes:
[0020] Identify the character boundaries of each character area through a contour detection algorithm;
[0021] Identifying the boundary coordinates of the character boundary;
[0022] According to the boundary coordinates, segmenting the character boundary along the boundary coordinates to obtain segmented individual character images;
[0023] Each character image is identified, and each character image is combined according to a preset sorting method to obtain a text area.
[0024] Furthermore, the identifying the boundary coordinates of the character boundary includes:
[0025] Tracking the extracted contours to identify the boundaries of characters;
[0026] Determine whether the boundary of the character is closed;
[0027] When the boundary of the character is not closed, identifying the unclosed endpoints of the boundary of the character;
[0028] Filling the unclosed endpoints with a preset tool, and then performing denoising and smoothing processing on the closed character boundaries;
[0029] Based on the processed character boundary, the boundary point mark coordinates are obtained.
[0030] Furthermore, the step of integrating the character contents into text information by a preset synthesis method based on the character contents includes:
[0031] Extract features from each character content, and normalize each extracted feature to control each feature within a preset value range;
[0032] Each normalized eigenvector is multiplied element by element to obtain a new eigenvector;
[0033] All the new feature vectors are concatenated and fused, and input into the trained text generation model to obtain the final text information.
[0034] Furthermore, mapping the movement trajectory to a specific pixel value includes:
[0035] Obtaining a coordinate system of the moving trajectory on paper;
[0036] Identify the coordinate system of the moving track on the paper, and construct a virtual space coordinate system according to the identification result;
[0037] The movement trajectory is mapped to a specific pixel value according to the virtual space coordinate system.
[0038] Further, the identifying a single character region and / or multiple character regions in the image data by a connected domain detection algorithm includes:
[0039] Identify brightness information in the image data, and segment the image in the image data whose brightness is greater than the first threshold as background according to a preset first threshold;
[0040] According to a preset second threshold, images whose brightness is less than the second threshold in the image data are segmented into character areas;
[0041] Extracting the character region, marking the connected domain of the character region, and forming adjacent pixels into a connected domain;
[0042] All the connected domains are screened according to a preset screening method to obtain a final single character region and / or multiple character regions, wherein the screening method includes screening based on the size, aspect ratio and compactness of the connected domain.
[0043] The present application embodiment also provides a text recognition system for campus smart paper and pen, including:
[0044] A first acquisition module, used for acquiring the execution instruction of the paper and pen in real time;
[0045] A second acquisition module is used to acquire the behavior data of the paper and pen during the writing process when receiving the execution instruction;
[0046] A conversion module, used to convert the behavior data into image data, and obtain the character region of the image data by a connected domain detection algorithm;
[0047] A detection module, used for detecting the boundary of the character area through the contour, and performing character segmentation on the characters in the image data according to the boundary to obtain a text area;
[0048] A recognition module, used to recognize the characters distinguished by the text, perform feature extraction and matching, and recognize the character content;
[0049] The integration module is used to integrate the character contents into text information based on the character contents through a preset synthesis method.
[0050] The present application also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0051] The present application also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.
[0052] The text recognition method and system of the campus smart pen and paper of the embodiment of the present application, by converting behavioral data into image data, and adopting a connected domain detection algorithm and a contour detection algorithm, can obtain higher quality image data under low-precision cameras and poor lighting conditions. The contour detection technology is used to detect and segment the character area, and the complex image data can be segmented into a single character or multiple characters, adapting to the writing characteristics of the characters such as connected strokes and inclinations, and effectively reducing character recognition errors. Real-time acquisition and processing of behavioral data during the writing process makes text recognition more efficient. Campus smart pen and paper can also be applied to other scenarios that require text recognition, such as electronic signatures, handwriting input, etc. Through a preset synthesis method, the recognized character content is integrated into text information, which simplifies the character recognition process and improves recognition efficiency. By acquiring the character area of the image data through the connected domain detection algorithm, the text can be effectively distinguished from other backgrounds and the position of the text can be accurately located. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A flowchart of a method for text recognition of a campus smart pen and paper according to an embodiment of the present application;
[0054] Figure 2A flowchart of a method for text recognition of a campus smart pen and paper according to an embodiment of the present application;
[0055] Figure 3 A schematic block diagram of the structure of a text recognition system for campus smart paper and pen according to an embodiment of the present application;
[0056] Figure 4 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.
[0057] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0059] Reference Figure 1 In an embodiment of the present application, a text recognition method for a campus smart pen and paper is provided, including a heat exchanger, and the method includes:
[0060] S1, obtaining the execution instruction of the paper and pen in real time;
[0061] S2. when receiving the execution instruction, obtaining the behavior data of the paper and pen during the writing process;
[0062] S3, converting the behavior data into image data, and obtaining the character region of the image data by a connected domain detection algorithm;
[0063] S4, detecting the boundary of the character area by contour, and segmenting the characters in the image data according to the boundary to obtain a text area;
[0064] S5, identifying the characters distinguished by the text, performing feature extraction and matching, and identifying the character content;
[0065] S6. Based on the character content, the character content is integrated into text information by a preset synthesis method.
[0066] As described in the above steps S1-S2, the user issues a command to start writing through the button or touch screen on the campus smart pen, or receives the user's voice command through the voice recognition system, and the user's operation command, such as start writing, stop writing, etc., is captured in real time through the built-in sensors or buttons of the campus smart pen. For example: buttons, touch screens, voice recognition systems; sensors built into the pen (such as accelerometers, gyroscopes, pressure sensors) collect motion data and pressure changes during the writing process in real time. After capturing the execution command, the behavioral data during the writing process, such as the pen tip motion trajectory, writing pressure, etc., are collected in real time through the built-in sensors of the pen, such as accelerometers, pressure sensors, etc.
[0067] As described in step S3 above, the collected behavior data is converted into image data through a certain algorithm, and then the image data is processed using a connected domain detection algorithm to obtain the character area in the image; the sensor data is converted into image data through a machine learning model, and then a connected domain detection algorithm (such as eight connected domain detection) is used to identify closed areas in the image, which correspond to written characters. The use of a connected domain detection algorithm and a contour detection algorithm can obtain higher quality image data under lower precision cameras and poor lighting conditions, thereby improving the accuracy of character recognition. By obtaining the character area of the image data through a connected domain detection algorithm, the text can be effectively distinguished from other backgrounds and the position of the text can be accurately located. This can provide accurate input for subsequent character segmentation and recognition.
[0068] As described in step S4 above, the acquired character area is subjected to contour detection to determine the boundaries of the characters, and then the characters in the image data are segmented according to the boundaries to obtain the text area of the single character. Image processing technology (such as contour detection algorithm) is used to identify the edges of the character area, and then the characters are segmented from the image according to these edges. For example: contour detection algorithm (such as Canny edge detection, Sobel edge detection). By performing boundary detection and segmentation on the character area through contour detection technology, complex image data can be segmented into single characters, providing accurate input for subsequent recognition and feature extraction. This can improve the accuracy and efficiency of character recognition.
[0069] As described in the above steps S5-S6, feature extraction and matching are performed on the single character text area obtained by segmentation to identify the character content. This step can use algorithms such as deep learning and template matching. The identified character content is synthesized according to a certain order and rules to obtain complete text information. By extracting and matching the characters in the text area, the character content can be accurately identified. In this way, automatic recognition and processing of text written on paper and pen can be achieved, thereby improving the utilization value of text information. Based on the character content, the character content is integrated into text information through a preset synthesis method, and the complete text information written on paper and pen can be easily obtained. In this way, digital processing and storage of paper documents can be achieved, thereby improving document management efficiency and information retrieval speed.
[0070] Specifically, by converting behavioral data into image data and using connected domain detection algorithms and contour detection algorithms, higher quality image data can be obtained under low-precision cameras and poor lighting conditions. By using contour detection technology to detect and segment character areas, complex image data can be segmented into single characters or multiple characters, adapting to the writing characteristics of characters such as connected strokes and inclinations, and effectively reducing character recognition errors. Real-time acquisition and processing of behavioral data during the writing process makes text recognition more efficient. Campus smart paper and pen can also be applied to other scenarios that require text recognition, such as electronic signatures and handwriting input. Through a preset synthesis method, the recognized character content is integrated into text information, which simplifies the character recognition process and improves recognition efficiency. By using a connected domain detection algorithm to obtain the character area of the image data, the text can be effectively distinguished from other backgrounds and the position of the text can be accurately located.
[0071] In a feasible embodiment, suppose that in a school, teachers often need to correct students' homework and evaluate students' writing and expression skills. Utilize smart paper and pen technology. When teachers correct students' homework, by using smart paper and pen, the system can obtain the teacher's correction behavior data in real time, such as circling, ticking, adding instructions and other operations. Smart paper and pen converts the teacher's correction behavior data into image data, including information such as annotations, scores and comments, for subsequent processing and storage. The system uses a connected domain detection algorithm to extract text areas in students' homework and accurately locate the students' writing content. The text areas in students' homework are segmented by contour detection technology to provide accurate input for subsequent text recognition and scoring. The system uses character recognition technology to automatically recognize the text in students' homework, including words, sentences and paragraphs. Based on the character content, the system integrates the text content in students' homework to form a complete electronic version of the homework, which is convenient for teachers to archive, analyze and feedback to students. In this scenario, smart paper and pen technology can help teachers correct students' homework more efficiently, provide real-time feedback and evaluation, and also provide a digital means for the management and analysis of students' homework, which can improve teaching efficiency.
[0072] In one embodiment, the converting the behavior data into image data and obtaining the character region of the image data by a connected domain detection algorithm includes:
[0073] Receiving behavior data of the paper and pen, wherein the behavior data includes movement trajectory, speed and pressure information of the pen on the paper;
[0074] Preprocessing the behavior data and converting it into a feature vector;
[0075] Inputting the feature vector into a preset model, identifying the feature vector through the preset model and outputting image data, wherein the image data includes mapping the movement trajectory to a specific pixel value;
[0076] Identify a single character region and / or multiple character regions in the image data by a connected domain detection algorithm;
[0077] Based on the single character region and / or the multiple character regions, character data is obtained.
[0078] As mentioned above, the behavioral data of handwriting can be captured by sensors or cameras. This data includes the movement trajectory of the pen tip on the paper, the writing speed, and the pressure applied to the pen tip. The collected behavioral data needs to be preprocessed to adapt to the input requirements of the machine learning model. This may include normalization, segmentation, and conversion of time series data into vectors that can represent the handwriting features. These feature vectors will be used in the model training and recognition process. The preprocessed feature vectors are fed into a trained machine learning model. The model may be based on a neural network, which can recognize the input feature vectors and output the corresponding image data. The output image data is the mapping of the original handwriting trajectory to pixel values to form a visual image. The connected domain detection algorithm is used to identify a single character or multiple character regions in the image. This process is crucial for subsequent character segmentation and recognition. A connected domain refers to a group of interconnected pixels in an image that have the same value in a certain attribute. When a character region is detected, the image data of a single character can be extracted, which can be used in the subsequent character recognition step. These character data will be further processed to identify the specific text content. This process has a wide range of applications in handwritten text recognition, digital notes, and human-computer interaction. Through such a system, handwritten text can be quickly and accurately converted into digital text, improving work efficiency and facilitating the digital storage of information.
[0079] Reference Figure 2 In one embodiment, the step of detecting the boundary of the character area by contour and segmenting the characters in the image data according to the boundary to obtain the text area includes:
[0080] S41, identifying the character boundary of each character area by a contour detection algorithm;
[0081] S42, identifying the boundary coordinates of the character boundary;
[0082] S43, segmenting the character boundary along the boundary coordinates according to the boundary coordinates to obtain segmented individual character images;
[0083] S44, identifying each character image, and combining each character image according to a preset sorting method to obtain a text area.
[0084] As described in the above steps, contour detection algorithms are used to identify the boundaries of each character region in the image. These algorithms can be based on edge detection, such as the Canny edge detector, or based on image shape, such as the Hough transform. The purpose of contour detection is to find the shape and boundaries of the characters. Once the outlines of the characters are detected, the next step is to identify the specific coordinates of these boundaries. These coordinates are the basis for character segmentation, and the combination of all coordinates defines the exact position and shape of the character in the image. Based on the identified boundary coordinates, the image of each character is segmented along its boundaries. This process may involve cutting, filling, and edge smoothing of the image to ensure that each segmented character image is complete and clear. The segmented character images can identify each character and can be recognized by a model, such as a convolutional neural network (CNN) or other deep learning architecture. According to a preset sorting method (such as from left to right, from top to bottom), the recognized character images are combined to form a complete text region. This process may take into account the spacing between characters and typesetting rules in order to generate formatted text. Through the contour detection algorithm, the system can accurately identify the character boundaries of each character region. This ensures the accuracy of character segmentation and avoids segmenting characters that are too large or too small. The system can identify the boundary coordinates of the character boundary and determine the position and size of each character area. This can provide accurate input for subsequent character segmentation and sorting. According to the boundary coordinates, the system can segment the character boundary along the boundary coordinates to obtain separate character images after segmentation. This ensures the accuracy and reliability of character segmentation, so that each character can be segmented correctly.
[0085] In one embodiment, the identifying the boundary coordinates of the character boundary includes:
[0086] Tracking the extracted contours to identify the boundaries of characters;
[0087] Determine whether the boundary of the character is closed;
[0088] When the boundary of the character is not closed, identifying the unclosed endpoints of the boundary of the character;
[0089] Filling the unclosed endpoints with a preset tool, and then performing denoising and smoothing processing on the closed character boundaries;
[0090] Based on the processed character boundary, the boundary point mark coordinates are obtained.
[0091] As mentioned above, by tracking the extracted contour, the character boundary can be accurately identified. This step is the key to understanding the structure of handwritten text. Determining whether the character boundary is closed helps to distinguish the internal structure and external boundary of the character and ensure the integrity of the character. When the character boundary is not closed, identifying these endpoints is to enable effective filling processing in the future. Filling the unclosed endpoints through preset tools or algorithms to ensure the closure of the character boundary is the basis for the accuracy of subsequent character recognition. Denoising and smoothing the closed character boundary can improve the accuracy of character recognition and reduce misrecognition caused by uneven boundaries. Filling and denoising can reduce misrecognition of characters caused by boundary problems. Specifically, suppose we have a character boundary contour, which consists of a series of points arranged in a clockwise or counterclockwise direction. If the contour is closed, the first point and the last point should be the same point. If the contour is not closed, the last point will not coincide with the first point. First, we need to detect the last point of the contour to determine whether it coincides with the first point. If not, then this point is an unclosed endpoint. Depending on the direction of rotation of the outline (clockwise or counterclockwise), the direction of the fill is determined. For example, if the outline rotates clockwise, we start from the unclosed endpoint and fill in the counterclockwise direction of the outline. Using a small, preset fill area (for example, a small circle or ellipse), start from the unclosed endpoint and move in the counterclockwise direction of the outline until you return to the starting point. The size and shape of the fill area can be adjusted as needed to better suit the style and structure of the character.
[0092] In one embodiment, the step of integrating the character content into text information by a preset synthesis method based on the character content includes:
[0093] Extract features from each character content, and normalize each extracted feature to control each feature within a preset value range;
[0094] Each normalized eigenvector is multiplied element by element to obtain a new eigenvector;
[0095] All the new feature vectors are concatenated and fused, and input into the trained text generation model to obtain the final text information.
[0096] As mentioned above, in feature extraction, characters or words can be converted into numerical forms that can capture certain attributes or features of characters or words. For example, when processing Chinese characters, the strokes, radicals, pinyin, semantics and other information of each Chinese character can be extracted as features. Normalization is a commonly used data preprocessing method in machine learning. Its purpose is to reduce the dimensional influence between different features and make them at the same order of magnitude for easy model processing. For example, the feature value can be scaled to between 0 and 1 by dividing by the maximum or minimum value of the feature. The element multiplication step is to perform element-by-element multiplication on the normalized feature vector, which is used to strengthen certain features or to combine information from different sources in a synthetic feature representation. All feature vectors processed by element multiplication are concatenated to form a more comprehensive feature representation. This step can be regarded as a process of weighted summation of multiple feature vectors, and the weight is the element value in each feature vector. The concatenated feature vector is input into a trained text generation model. The comprehensive feature vector is converted into a text sequence and the final text information is output.
[0097] In one feasible embodiment, the step of performing element-by-element multiplication on each normalized feature vector to obtain a new feature vector includes:
[0098] Identify the elements of each feature vector;
[0099] The two adjacent elements are calculated according to the element multiplication formula to obtain a new feature vector.
[0100] The element multiplication formula is: c=(a1×b1,a2×b2,…,an×bn), where a1 is a vector element, b1 is another vector element, and c is a new feature vector.
[0101] As described in the above steps, there are two eigenvectors a and b, and the elements of a are (a1, a2, ...., an). First, it is necessary to identify the elements in each eigenvector. The eigenvector a contains n elements, namely (a1, a2, ..., an). Then, the adjacent elements in each eigenvector will be multiplied. This means multiplying each element in a with the corresponding element in another eigenvector b. The eigenvector b also contains n elements, namely (b1, b2, ..., bn). Use the provided element multiplication formula c = (a1×b1, a2×b2, ..., an×bn), where c is the result of the new eigenvector. This formula shows that each element of the new eigenvector c is the product of the corresponding elements in the original eigenvectors a and b. For example, if the feature vector a=(1,2,3) and b=(4,5,6), then following the above steps, you will get a new feature vector c: c=(a1×b1,a2×b2,an×bn)c=(1×4,2×5,3×6)c=(4,10,18). Therefore, the new feature vector c will be (4,10,18). Element-wise multiplication can be seen as a weighted combination of the original features, where the weight of each element is the corresponding element of another feature vector. This approach can enhance certain features and make them more prominent during model training. Unlike traditional linear combinations, element-wise multiplication can capture nonlinear relationships between features because the multiplication operation can amplify or reduce the value of the element, which may lead to more complex and rich feature representations. By multiplying the features element-by-element, the model's dependence on a single feature or a specific combination can be reduced, thereby reducing the risk of overfitting. Since the multiplication operation can introduce new feature combinations, this helps the model learn more generalized feature representations, thereby improving the performance of the model on different data sets.
[0102] In one embodiment, mapping the movement trajectory to a specific pixel value includes:
[0103] Obtaining a coordinate system of the moving trajectory on paper;
[0104] Identify the coordinate system of the moving track on the paper, and construct a virtual space coordinate system according to the identification result;
[0105] The movement trajectory is mapped to a specific pixel value according to the virtual space coordinate system.
[0106] As described above, the step of obtaining the coordinate system of the movement trajectory on the paper can capture the position information of the movement trajectory on the paper. This can be achieved in various ways, such as using a camera to capture an image and using image processing technology to identify the position of the trajectory in the image. The captured movement trajectory is identified to determine its specific position on the paper. Image recognition and pattern recognition techniques, such as edge detection, contour tracking, etc. can be used. Based on the recognition results, a virtual space coordinate system is constructed. This coordinate system can be a two-dimensional pixel coordinate system, in which each point corresponds to a pixel in the image. This coordinate system can be used to represent the entire area on the paper, including the position of the trajectory. Finally, the movement trajectory is mapped to a specific pixel value on the image according to the virtual space coordinate system. This means that each point of the trajectory is converted into a pixel coordinate in the image coordinate system, thereby obtaining a representation of the trajectory on the digital image. Through appropriate mapping and processing, the readability and comprehensibility of the trajectory can be enhanced, so that even complex trajectories can be clearly presented. The original movement trajectory data is converted from the coordinate system on the paper to the coordinate system of the image. The coordinate system on the paper may differ from the coordinate system of the image, such as rotation, scaling, or offset. Therefore, the coordinate system needs to be transformed to ensure that the movement trajectory can be accurately mapped to the image.
[0107] In one embodiment, identifying a single character region and / or multiple character regions in the image data by a connected domain detection algorithm comprises:
[0108] Identify brightness information in the image data, and segment the image in the image data whose brightness is greater than the first threshold as background according to a preset first threshold;
[0109] According to a preset second threshold, images whose brightness is less than the second threshold in the image data are segmented into character areas;
[0110] Extracting the character region, marking the connected domain of the character region, and forming adjacent pixels into a connected domain;
[0111] All the connected domains are screened according to a preset screening method to obtain a final single character region and / or multiple character regions, wherein the screening method includes screening based on the size, aspect ratio and compactness of the connected domain.
[0112] As described above, first, the algorithm analyzes the brightness information in the image data, which can be achieved by calculating the brightness value of each pixel (for example, the Y component in the RGB color space). According to the preset first threshold, the pixels in the image data with a brightness greater than the first threshold are segmented as background. The purpose of this is to distinguish the highlight area (such as the background or foreground) from the low-brightness area (such as the character) in the image. Next, according to the preset second threshold, the pixels in the image data with a brightness less than the second threshold are segmented into character areas. This threshold is used to distinguish between the character area and the background area. Then, the segmented character areas are extracted and connected domains are marked for these areas. Connected domain marking is to form a connected domain with adjacent pixels, so that the shape and structure of the character can be identified. Finally, all identified connected domains are screened according to the preset screening method. The purpose of screening is to remove connected domains that do not meet the character characteristics, so as to obtain the final single character area and / or multiple character areas. The screening method may include based on the size, aspect ratio and compactness of the connected domain. Through connected domain detection, character areas in images can be identified more accurately; by screening connected domains, connected domains that do not meet character characteristics can be excluded to reduce misrecognition; the connected domain detection algorithm can adapt to different fonts and sizes; compared with complex image processing technology, the connected domain detection algorithm is relatively simple and easy to implement and optimize.
[0113] The text recognition method of the campus smart paper and pen of the present application, by converting behavioral data into image data, and adopting a connected domain detection algorithm and a contour detection algorithm, can obtain higher quality image data under low-precision cameras and poor lighting conditions. The contour detection technology is used to detect and segment the character area boundary, and the complex image data can be segmented into a single character or multiple characters, adapting to the writing characteristics of the characters such as connected strokes and inclinations, and effectively reducing character recognition errors. Real-time acquisition and processing of behavioral data during the writing process makes text recognition more efficient. Campus smart paper and pen can also be applied to other scenarios that require text recognition, such as electronic signatures, handwriting input, etc. Through a preset synthesis method, the recognized character content is integrated into text information, which simplifies the character recognition process and improves recognition efficiency. By acquiring the character area of the image data through the connected domain detection algorithm, the text can be effectively distinguished from other backgrounds and the position of the text can be accurately located.
[0114] Reference Figure 3 The present application also provides a text recognition system for campus smart paper and pen, including:
[0115] A first acquisition module 1, used for acquiring the execution instruction of the paper and pen in real time;
[0116] A second acquisition module 2 is used to acquire the behavior data of the paper and pen during the writing process when receiving the execution instruction;
[0117] A conversion module 3, used to convert the behavior data into image data, and obtain the character region of the image data by a connected domain detection algorithm;
[0118] A detection module 4 is used to detect the boundary of the character area through the contour, and segment the characters in the image data according to the boundary to obtain a text area;
[0119] Recognition module 5, used to identify the characters distinguished by the text, perform feature extraction and matching, and identify the character content;
[0120] The integration module 6 is used to integrate the character contents into text information based on the character contents by a preset synthesis method.
[0121] As described above, it can be understood that the various components of the text recognition system of the campus smart paper and pen proposed in this application can realize the functions of any of the text recognition methods of the campus smart paper and pen described above, and the specific structure will not be repeated.
[0122] Reference Figure 4 In an embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as monitoring data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a text recognition method for campus smart paper and pen is implemented.
[0123] The processor executes the text recognition method of the campus smart paper and pen, including: obtaining the execution instruction of the paper and pen in real time; when receiving the execution instruction, obtaining the behavior data of the paper and pen during the writing process; converting the behavior data into image data, and obtaining the character area of the image data through a connected domain detection algorithm; detecting the boundary of the character area through contours, and segmenting the characters in the image data according to the boundary to obtain the text area; identifying the characters distinguished by the text for feature extraction and matching, and identifying the character content; based on the character content, integrating the character content into text information through a preset synthesis method.
[0124] The above-mentioned text recognition method of campus smart paper and pen, by converting behavioral data into image data, and adopting connected domain detection algorithm and contour detection algorithm, can obtain higher quality image data under low-precision cameras and poor lighting conditions. The contour detection technology is used to detect and segment the character area boundary, and the complex image data can be segmented into a single character or multiple characters, adapting to the writing characteristics of characters such as connected strokes and inclination, and effectively reducing character recognition errors. Real-time acquisition and processing of behavioral data during the writing process makes text recognition more efficient. Campus smart paper and pen can also be applied to other scenarios that require text recognition, such as electronic signatures, handwriting input, etc. Through a preset synthesis method, the recognized character content is integrated into text information, which simplifies the character recognition process and improves recognition efficiency. By acquiring the character area of the image data through the connected domain detection algorithm, the text can be effectively distinguished from other backgrounds and the position of the text can be accurately located.
[0125] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, a text recognition method for a campus smart paper and pen is implemented, comprising the steps of: obtaining the execution instruction of the paper and pen in real time; when the execution instruction is received, obtaining the behavior data of the paper and pen during the writing process; converting the behavior data into image data, and obtaining the character area of the image data through a connected domain detection algorithm; detecting the boundary of the character area through contours, and segmenting the characters in the image data according to the boundary to obtain a text area; identifying the characters distinguished by the text, performing feature extraction and matching, and identifying the character content; based on the character content, integrating the character content into text information through a preset synthesis method.
[0126] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0127] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.
[0128] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A text recognition method for campus smart paper and pen, characterized in that: The method comprises: Obtaining the execution instructions of the paper and pen in real time; When the execution instruction is received, the behavior data of the paper and pen during the writing process is obtained; Converting the behavior data into image data, and obtaining the character region of the image data by a connected domain detection algorithm; Detecting the boundary of the character area by contour, segmenting the characters in the image data according to the boundary, and obtaining a text area; Identify the characters that distinguish the text, perform feature extraction and matching, and identify the character content; Based on the character content, integrating the character content into text information by a preset synthesis method; The contour detection algorithm is used to identify the boundaries of each character area in the image. Contour detection is used to find the shape and boundaries of the characters. When the contour of the character is detected, the specific coordinates of these boundaries are identified. The combination of all coordinates defines the position and shape of the character in the image. According to the identified boundary coordinates, the image of each character is segmented along its boundary, including image cutting, filling and edge smoothing. The segmented character image can identify each character. Through model recognition, the identified character images are combined according to the preset sorting method, including from left to right and from top to bottom, to form a complete text area, and the spacing and typesetting rules between characters are analyzed to generate formatted text. The extracted contour is tracked to identify the boundary of the character; when the character boundary is not closed, the unclosed endpoint is filled by a preset tool or algorithm; the closed character boundary is denoised and smoothed, and the coordinates of the boundary point markers are obtained based on the processed character boundary; when there is a contour of a character boundary, it is composed of a series of points, and these points are arranged in a clockwise or counterclockwise direction. If the contour is closed, the first point and the last point are the same point; if the contour is not closed, the last point will not coincide with the first point; first, the last point of the contour is detected to determine whether it coincides with the first point. If it does not coincide, then this point is the unclosed endpoint; according to the rotation direction of the contour, the filling direction is determined; if the contour rotates clockwise, it starts from the unclosed endpoint and fills in the counterclockwise direction of the contour; using a preset filling area, starting from the unclosed endpoint, in a determined direction, move in the counterclockwise direction of the contour until returning to the starting point.
2. The text recognition method for campus smart paper and pen according to claim 1, characterized in that: The step of converting the behavior data into image data and obtaining the character region of the image data by a connected domain detection algorithm includes: Receiving behavior data of the paper and pen, wherein the behavior data includes movement trajectory, speed and pressure information of the pen on the paper; Preprocessing the behavior data and converting it into a feature vector; Inputting the feature vector into a preset model, identifying the feature vector through the preset model and outputting image data, wherein the image data includes mapping the movement trajectory to a specific pixel value; Identify a single character region and / or multiple character regions in the image data by a connected domain detection algorithm; Based on the single character region and / or the multiple character regions, character data is obtained.
3. The text recognition method for campus smart paper and pen according to claim 1, characterized in that: The step of integrating the character contents into text information by a preset synthesis method based on the character contents includes: Extract features from each character content, and normalize each extracted feature to control each feature within a preset value range; Each normalized eigenvector is multiplied element by element to obtain a new eigenvector; All the new feature vectors are concatenated and fused, and input into the trained text generation model to obtain the final text information.
4. The text recognition method for campus smart paper and pen according to claim 2, characterized in that: The movement trajectory is mapped to a specific pixel value, including: Obtaining a coordinate system of the moving trajectory on paper; Identify the coordinate system of the moving track on the paper, and construct a virtual space coordinate system according to the identification result; The movement trajectory is mapped to a specific pixel value according to the virtual space coordinate system.
5. The text recognition method for campus smart paper and pen according to claim 2, characterized in that: The identifying of a single character region and / or multiple character regions in the image data by a connected domain detection algorithm comprises: Identify brightness information in the image data, and segment the image in the image data whose brightness is greater than the first threshold as background according to a preset first threshold; According to a preset second threshold, images whose brightness is less than the second threshold in the image data are segmented into character areas; Extracting the character region, marking the connected domain of the character region, and forming adjacent pixels into a connected domain; All the connected domains are screened according to a preset screening method to obtain a final single character region and / or multiple character regions, wherein the screening method includes screening based on the size, aspect ratio and compactness of the connected domain.
6. A text recognition system for campus smart paper and pen, used in the method described in any one of claims 1 to 5, characterized in that: include: A first acquisition module, used for acquiring the execution instruction of the paper and pen in real time; A second acquisition module is used to acquire the behavior data of the paper and pen during the writing process when receiving the execution instruction; A conversion module, used to convert the behavior data into image data, and obtain the character region of the image data by a connected domain detection algorithm; A detection module, used for detecting the boundary of the character area through the contour, and performing character segmentation on the characters in the image data according to the boundary to obtain a text area; A recognition module, used to recognize the characters distinguished by the text, perform feature extraction and matching, and recognize the character content; The integration module is used to integrate the character contents into text information based on the character contents through a preset synthesis method.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Simple steel seal digital automatic identification method with high accuracy rate
CN102426649A
Character segmentation method and device
CN104239879A
Intelligent mobile terminal scene character processing method
CN104408449A
Multi-direction text detection method of natural scene
CN105005764A
Variable-length license plate character segmentation method based on hybrid tilt correction and projection method
CN106529534A
