Test method, test system and processing equipment for writing pen

The handwriting images of the pen on the terminal device are collected through the robotic arm and the image acquisition device, and the brightness, contrast and structural characteristics are identified and analyzed, which solves the problem of evaluating the handwriting effect of the writing brush, and achieves test results similar to those on paper.

CN120452071APending Publication Date: 2025-08-08HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410133245.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-30
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

There is a lack of effective hardware and software technical means to evaluate whether the writing of the pen on the terminal device can achieve the effect of writing on paper.

Method used

Writing on the terminal device by clamping the pen with a robotic arm, the handwriting image is collected using the image acquisition device, and the processing device recognizes and analyzes image features, including brightness, contrast and structural features, determines the test results of the pen, and displays them on the interactive interface.

Benefits of technology

It realizes accurate evaluation of the writing of the pen on the terminal device, ensures that the test results are close to the judgment of the human visual system, reduces manual participation, and ensures the repetition and consistency of the test.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120452071A_ABST
    Figure CN120452071A_ABST
Patent Text Reader

Abstract

The invention provides a test method, a test system and processing equipment for a writing pen. According to the test method, when the degree that the handwriting written on the writing equipment by the writing pen is similar to the handwriting on paper is tested, after a test handwriting image formed after the writing pen writes on the terminal equipment is obtained, at least one test character in the test handwriting image is identified to obtain at least one corresponding test character graph; and determining a test result according to the graph feature information of each test word graph, and displaying the test result on the interactive interface. According to the scheme, when the test result is determined, the image features such as the brightness, the contrast ratio and the structure of the test word image are considered at the same time, so that the accuracy of the test result is guaranteed, and the test result is closer to the judgment reference of a human visual system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of testing technology, and in particular to a testing method, a testing system, and a processing device for a writing pen. Background Art

[0002] Styluses, used in conjunction with various terminal devices, are increasingly being used in our daily lives. People can use them to write text and other content on these devices. When testing the writing performance of styluses on these devices, a key test is whether the writing produced by the stylus on the terminal device can achieve the effect of writing on paper. However, currently, there are no relevant technologies or tools to achieve this test. Summary of the Invention

[0003] In view of the above problems, multiple aspects of the present application provide a testing method, a testing system, a processing device, a chip, a computer-readable storage medium and a computer program product for a writing pen, so as to achieve the effect that the handwriting of the test writing pen on the terminal device can achieve handwriting on paper.

[0004] In a first aspect, the present application provides a method for testing a writing pen. The method comprises:

[0005] Acquire a test handwriting image formed after the writing pen writes on the terminal device;

[0006] Recognizing at least one test word contained in the test handwriting image to obtain at least one corresponding test word image;

[0007] Determining a test result according to the graphic feature information of each test character graphic;

[0008] Displaying the test results on the interactive interface;

[0009] Among them, one of the test word images contains a test word, and the image feature information of the test word image includes brightness feature, contrast feature, and structure feature; the test result represents the degree to which the handwriting written by the writing pen is similar to the handwriting on paper.

[0010] In a second aspect, the present application provides another testing method for a writing pen. The method comprises:

[0011] Display the interactive interface;

[0012] On the interactive interface, displaying the acquired test handwriting image formed after the writing pen is written on the terminal device;

[0013] Recognizing at least one test word contained in the test handwriting image to obtain at least one corresponding test word image;

[0014] Comparing the image feature information of each test word graph with the corresponding reference word graph to obtain the image feature comparison result of each test word graph and the corresponding reference word graph;

[0015] Determining a test result based on a comparison result of the image features of each of the test character images and the corresponding reference character image;

[0016] On the interactive interface, the test results are displayed, and each of the test word graphs is associated with the corresponding reference word graph and the image feature comparison result;

[0017] Among them, one of the test word images contains a test word; the reference word in the reference word image is written on paper and is the same as the test word in the corresponding test word image, and the image feature information includes: brightness feature, contrast feature, and structural feature; the test result represents the degree to which the handwriting written by the writing pen is similar to the handwriting on paper.

[0018] In a third aspect, the present application provides a testing system. The testing system includes:

[0019] A writing device, comprising a robotic arm and a fixing platform; one end of the robotic arm is used to clamp the writing pen, and the fixing platform is used to fix the terminal device;

[0020] a driving device connected to the robotic arm, and configured to drive the robotic arm to move so that the writing pen performs a writing operation on the terminal device;

[0021] An image acquisition device, used for acquiring a test handwriting image formed after the writing pen writes on the terminal device;

[0022] A processing device is connected to the image acquisition device and is used to: receive the test handwriting image sent by the image acquisition device; identify at least one test word contained in the test handwriting image to obtain at least one corresponding test word image; determine a test result based on the graphic feature information of each test word image; and display the test result on an interactive interface; wherein, one test word image contains one test word, and the graphic feature information of the test word image includes brightness feature, contrast feature, and structural feature; and the test result indicates the degree to which the handwriting written by the writing pen is similar to handwriting on paper.

[0023] In a fourth aspect, the present application provides a processing device. The processing device includes a memory and a processor; wherein the memory is used to store a program; and the processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps of each method provided in the present application.

[0024] In a fifth aspect, the present application provides a chip, which is applied to the processing device provided in the present application. The chip includes a processor, and when the processor executes instructions, the steps in the methods provided in the present application are implemented.

[0025] In a sixth aspect, the present application provides a computer-readable storage medium having computer program instructions stored therein; when the computer program instructions are executed by a processor, the steps of the methods provided in the present application are implemented.

[0026] In a seventh aspect, the present application provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps in each method provided in the present application can be implemented.

[0027] The technical solutions provided by various embodiments of the present application are: To achieve a degree of similarity between handwriting on paper and the handwriting of a test pen on a writing device, after obtaining a test handwriting image formed by the pen writing on a terminal device, at least one test word in the test handwriting image is first identified to obtain at least one corresponding test word image. Then, based on the image feature information of each test word image, a test result is determined and displayed. This solution considers image features such as brightness, contrast, and structure of the test word image when determining the test result, which helps ensure the accuracy of the test result and makes the test result more consistent with the human visual system's judgment criteria. Furthermore, by using a robotic arm to drive the pen to write on the terminal device to form the corresponding test handwriting image, repeated writing of the test handwriting is achieved, reducing manual intervention and ensuring repeatable testing. Furthermore, the robotic arm facilitates control of the pen's writing force and style, thereby ensuring that the force and style of the pen writing on the terminal device are consistent across multiple repetitive tests. This effectively prevents the accuracy of the final test result from being affected by differences in writing force and style when the final test result is determined through the integration of multiple repeated tests. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0029] Figure 1 A schematic diagram of the structure of a test system provided by an exemplary embodiment of the present application;

[0030] Figure 2 and Figure 3 A schematic flow chart of a testing method for a writing pen provided in an embodiment of the present application;

[0031] Figure 4a and Figure 4b A schematic diagram of the display status of the interactive interface when no test is performed provided by an exemplary embodiment of the present application;

[0032] Figure 5a A schematic diagram of the display status of the interactive interface when executing a test provided by an exemplary embodiment of the present application;

[0033] Figure 5b Corresponding test results under different processing conditions provided by an exemplary embodiment of the present application;

[0034] Figure 6a and Figure 6b A schematic structural diagram of a processing device provided for an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0035] Whether the handwriting formed by a writing pen (electronic pen) used in conjunction with various terminal devices such as electronic whiteboards and smartphones can achieve the effect of handwriting on paper affects people's experience of using the writing pen. Therefore, when testing a writing pen, evaluating whether the handwriting formed by the writing pen on the terminal device can achieve the effect of handwriting on paper is also an important evaluation content; among them, this evaluation content can be achieved by comparing the handwriting of the writing pen on the terminal device with the corresponding handwriting on paper to determine the degree of similarity between the two. However, there is currently a lack of an effective hardware evaluation tool and corresponding software technology means for implementing this evaluation content.

[0036] To this end, in response to the above needs, this application provides a testing method, a testing system, and a processing device for a writing pen from multiple aspects, so as to evaluate whether the handwriting of the writing pen on the terminal device can achieve an effect similar to that of handwriting on paper.

[0037] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0038] In the embodiments of the present application, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical items or similar items with substantially the same functions and effects. For example, the first signal generating circuit and the second signal generating circuit are merely used to distinguish different signal generating circuits and do not limit their order. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily mean that they are different.

[0039] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design scheme described in this application as "exemplary" or "for example" should be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. In addition, "at least one" in this application refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, B exists alone, wherein A and B can be singular or plural, etc. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b and c can represent: a, b, c, a, b and c, a and b, a and c, b and c.

[0040] The following describes in detail the technical solutions provided by various embodiments of the present application in conjunction with the accompanying drawings.

[0041] To facilitate understanding of the present application, the hardware system on which the method embodiments provided in this application are based is first described in detail.

[0042] Figure 1 The schematic diagram of the structure of the test system provided by an embodiment of the present application is shown. The test system can be used to evaluate whether the handwriting formed by the writing pen on the terminal device can achieve the effect of handwriting on paper. The terminal device can be, but is not limited to, an electronic whiteboard, a smart phone, a tablet computer, etc. Figure 1 As shown, the test system includes: a writing device 10, a driving device 30, an image acquisition device 40 and a processing device 20; wherein,

[0043] The writing device 10 includes a robotic arm 11 and a fixing platform 12; one end (non-fixed end) of the robotic arm 11 is used to clamp a writing pen (not shown in the figure); the fixing platform is used to fix a terminal device (not shown in the figure);

[0044] a driving device 30 connected to the robotic arm 11 and configured to drive the robotic arm 11 to move so that the writing pen on the robotic arm performs a writing operation on the terminal device;

[0045] An image acquisition device 40 is used to acquire a test handwriting image formed after the writing pen writes on the terminal device;

[0046] The processing device 20 is connected to the image acquisition device 40 and is used to: receive the test handwriting image sent by the image acquisition device 40, and identify at least one test word contained in the test handwriting image to obtain at least one corresponding test word image; determine a test result based on the graphic feature information of each test word image; and display the test result on an interactive interface; wherein, each test word image contains one test word, and the graphic feature information of the test word image includes brightness features, contrast features, and structural features; the test result indicates the degree to which the handwriting written by the writing pen is similar to handwriting on paper.

[0047] The writing pen described in this application refers to any type of electronic pen that can be used for writing on a terminal device.

[0048] The robotic arm 11 supports holding various types of writing pens. In a specific implementation, the robotic arm 11 may be composed of multiple joints connected in sequence, with rotation between two connected joints. The drive device 30 may include, but is not limited to, a controller and a drive mechanism. The controller transmits corresponding control signals to the drive mechanism, which then drives the joints of the robotic arm according to the received control signals. The control signals may be generated by the controller based on the character trajectory information contained in the drive instructions after receiving them from the processing device 20.

[0049] Thus, the processing device 20 is further communicatively coupled to the driving device 30 and configured to send a driving instruction to the driving device 30, wherein the driving instruction includes the character trajectory information. Accordingly, the driving device 30 is specifically configured to drive the robotic arm to move according to the character trajectory information in the driving instruction, causing the writing pen on the robotic arm to write a certain structure and number of test characters (also referred to as test traces) on the terminal device.

[0050] It should be noted that, in addition to supporting various types of writing pens, the robotic arm 11 also supports various types of ordinary pens, such as gel pens. In addition to securing the terminal device, the mounting platform 12 can also be used to secure paper. When paper is secured to the mounting platform 12 and an ordinary pen is held by the robotic arm 11, driving the robotic arm enables writing on the paper using the ordinary pen. Accordingly, the image acquisition device 40 can also capture an image of the handwriting on the paper formed by writing with the ordinary pen and transmit it to the processing device 20. For details on how to capture the handwriting image on the paper, see the section below regarding capturing (capturing) a test handwriting image. Alternatively, a user can manually write on the paper using an ordinary pen, then place the paper on the mounting platform for the image acquisition device 40 to capture and transmit the captured handwriting image to the processing device 20. Alternatively, the user can place the completed paper on a scanning device connected to the processing device 20. The scanning device can then scan the paper and transmit the scanned handwriting image to the processing device 20. The processing device 20 can use the received handwriting image to establish a standard handwriting character library on paper to provide data support for subsequent test steps. When establishing the standard handwriting character library on paper, the handwriting image on paper can be processed accordingly to establish the standard handwriting character library on paper based on the processing results. The processing may include: graying, negation, filtering, Gaussian blurring and other pre-processing of the handwriting image on paper; further, in other embodiments, the above processing may also include: determining the minimum circumscribed geometric image of each character in the negated handwriting image on paper to obtain the character image corresponding to each character, adjusting the size of the character image to a preset size and storing it in association with the corresponding pre-processed handwriting image on paper, and so on. Based on the above, in one example, the established standard handwriting character library includes: multiple reference handwriting images; or, in another example, the established standard handwriting character library includes: multiple reference handwriting images and at least one reference character image corresponding to each reference handwriting image; wherein the reference handwriting image can be a preprocessed handwriting image or an original handwriting image, and the reference character image is obtained based on the minimum circumscribed geometric figure of the reference character in the reference handwriting image. For a description of the implementation of obtaining the reference character image, please refer to the relevant content of obtaining the test character image described in the method embodiment below, and will not be further elaborated here.

[0051] The image acquisition device 40 includes a bracket 41, a guide rail 42, and a camera 43. The bracket 41 has a horizontal extension portion above the fixed platform and a vertical portion extending vertically upward. The horizontal extension portion and the vertical portion may be integrated or detachably connected, which is not limited here. The guide rail 42 is mounted on the horizontal extension portion, specifically, it is arranged on the horizontal extension portion along the length direction of the horizontal extension portion. The camera 43 is slidably connected to the guide rail 42. Specifically, a sliding mechanism is provided at the bottom of the camera 43 or on the guide rail 42. The camera 43 is slidably connected to the guide rail 42 via the sliding mechanism. The sliding mechanism may be, but is not limited to, a slider.

[0052] After the driving device 30 completes driving the robotic arm 11, it indicates that the writing pen has completed writing on the terminal device. At this time, the driving device 30 can feedback the driving completion information to the processing device 20. Accordingly, after receiving the driving completion information, the processing device 20 can control the camera 43 to slide horizontally on the guide rail to a position above the fixed platform 12 (for example, the middle position of the fixed platform 12), capture the test handwriting image formed after the writing pen is written on the terminal device, and transmit the captured test handwriting image to the processing device 20 in real time.

[0053] During specific implementation, the processing device 20 can control the sliding mechanism to move horizontally along the length of the guide rail, thereby driving the camera 43 to slide horizontally on the guide rail 42. Alternatively, after receiving the drive completion information, the processing device 20 can also output a prompt message to prompt the tester to manually slide the camera 43 to a position above the fixed platform 12, wherein the prompt message can be a combination of one or more of voice, text, etc. In order to automate the entire test and reduce the participation of testers, it is preferred to realize automatic sliding of the camera by controlling the sliding mechanism. Automatic sliding can make the sliding speed of the camera more controllable than manual control, and can also avoid damage to the camera caused by the tester touching the camera.

[0054] The above-mentioned processing device 20 can be a desktop computer, a laptop computer, a smart phone, etc. After the processing device 20 obtains the test handwriting image through the camera, it can run its own built-in test analysis code program (including the test analysis algorithm code program) to compare the test handwriting image with the corresponding reference handwriting image to output the test result. The specific functional implementation of the processing device 20 will be described in detail in the method embodiment given below. Among them, the reference handwriting image is an image of handwriting on paper obtained by scanning the handwriting formed after writing on paper. In specific implementation, the reference handwriting image can be obtained from the aforementioned standard handwriting library on paper; the test result is the similarity between the handwriting written by the writing pen on the terminal device and the handwriting on paper, and the similarity is a representation of the degree to which the handwriting written by the writing pen on the terminal device is similar to the handwriting written on paper.

[0055] Figure 2 The present invention provides a testing method for a writing pen according to an embodiment of the present invention. The execution subject of the method is Figure 1 The processing device 20 shown in FIG. 1 is illustratively a computer. Figure 2 As shown, the test method includes the following steps:

[0056] S1. Acquire a test handwriting image formed by writing with a writing pen on a terminal device;

[0057] S2. Recognize at least one test word contained in the test handwriting image to obtain at least one corresponding test word image;

[0058] S3, determining a test result according to the image feature information of each test character image;

[0059] S4. Displaying the test results on the interactive interface;

[0060] Among them, one of the test word images contains a test word, and the image feature information of the test word image includes brightness feature, contrast feature, and structure feature; the test result represents the degree to which the handwriting written by the writing pen on the terminal device is similar to the handwriting on paper.

[0061] In the above S1, the test handwriting image is obtained by Figure 1 The image acquisition device shown in the figure obtains the image. For the specific implementation description of the acquisition, please refer to the relevant content in other embodiments. Figure 5a An example of a test handwriting image T is shown in FIG. The terminal device may be various terminal devices such as a smart phone, an electronic whiteboard, and a tablet.

[0062] In order to facilitate the implementation of subsequent steps, the obtained test handwriting image can be preprocessed as follows: the test handwriting image is grayscaled to obtain a grayscaled test handwriting image (which can be simply referred to as a test handwriting grayscale image); then, the grayscaled test handwriting image is inverted to obtain an inverted test handwriting image, wherein inversion specifically refers to inverting the pixel value (grayscale value) of the grayscaled test handwriting image, and the inverted pixel value pixel'=255-the pixel value before inversion pixel. The inverted test handwriting image is a grayscale image in which the grayscale value of the handwriting of the character is greater than 0 (that is, the grayscale value of the main body of the handwriting is greater than 0) and the corresponding background grayscale value is close to 0 or equal to 0. This can make the main body of the handwriting of the character in the image stand out, thereby facilitating the implementation of subsequent recognition, comparison and other steps.

[0063] Furthermore, considering that the test handwriting image obtained by the image acquisition device often inevitably has noise interference in its background, the presence of noise will affect the image quality, the efficiency and accuracy of the subsequent steps, etc., so it is necessary to remove the noise in the image. Noise refers to unnecessary or redundant interference information in the image, and its removal can be achieved by, but is not limited to, binarizing the image. Based on this, the aforementioned preprocessing may also include: using a corresponding binarization algorithm to binarize the inverted test handwriting image to set the pixel values less than the set threshold to 0, thereby obtaining a test handwriting image with a relatively clean background. Among them, the binarization algorithm can be the Otsu algorithm (Otsu method or maximum inter-class variance method), the bimodal histogram threshold segmentation algorithm, the average grayscale algorithm, the adaptive threshold algorithm, and the like.

[0064] Furthermore, due to the jitter during the writing process and the influence of camera acquisition, the handwriting strokes of the characters in the test handwriting image inevitably have edge burrs and uneven brightness. To solve this problem, the aforementioned preprocessing can also include: filtering processing and Gaussian blur processing. The two preprocessing processes here are not limited to the order of execution. The filtering process can be performed first and then the Gaussian blur processing, or the Gaussian blur processing can be performed first and then the filtering process. In this embodiment, the filtering process is performed first and then the Gaussian blur processing. The filtering process can adopt but is not limited to median filtering. Through filtering and Gaussian blur processing, the following purpose can be achieved: retaining the details of the binarized test handwriting image while optimizing the image quality. Among them, the role of median filtering is to remove bright or dark outliers in the binarized test handwriting image to achieve uniform brightness of the handwriting strokes; the role of Gaussian blur processing is to replace the grayscale value of each pixel in the binarized test handwriting image with the weighted average of the grayscale values of the surrounding pixels, thereby blurring some details while retaining the overall structure of the image and achieving smoothing of the edges of the handwriting strokes.

[0065] Based on this content, that is, between the above steps S1 and S2, the following steps may also be included:

[0066] A1. Preprocessing the test handwriting image to obtain the preprocessed test handwriting image;

[0067] A2. triggering the execution of step S2 according to the pre-processed test handwriting image;

[0068] The pre-processing includes one or more combinations of the following: grayscale processing, inversion processing, binarization processing, filtering processing, and Gaussian blur processing.

[0069] The preprocessed test handwriting image can be found in Figure 5a A specific example is shown in FIG.

[0070] After obtaining the preprocessed test handwriting image, in order to minimize background interference to the greatest extent, the test handwriting image can be divided according to the minimum circumscribed geometric figure of each test character in the test handwriting image, so as to obtain the test character image of each test character. Based on this, in one implementable solution, the above step S2 "identifying at least one test character included in the test handwriting image to obtain the corresponding at least one test character image" may include:

[0071] S21. Determine the minimum circumscribed geometric figure of each test character in the identified test handwriting image;

[0072] S22. Segment the test handwriting image according to the minimum circumscribed geometric figure of each test character to obtain the at least one test character image.

[0073] A specific implementation process of the above steps S21 - S22 may be as follows:

[0074] 1) Use an image recognition algorithm, such as a text recognition model constructed based on machine learning, to perform handwriting recognition on the preprocessed test handwriting image to obtain a recognition result;

[0075] 2) According to the recognition result, determine at least one test character in the test handwriting image and the two pixel points that are farthest apart in the X-axis direction (horizontal direction) and the two pixel points that are farthest apart in the Y-axis direction (vertical direction) of each test character;

[0076] 3) According to the four pixel points corresponding to each test character determined in step 2), determine the minimum circumscribed geometric figure of each test character, where the minimum circumscribed geometric figure can be, but is not limited to, a rectangle, a circle, etc.

[0077] 4) According to the minimum circumscribed geometric figure of each test character, segment the test handwriting image into multiple image blocks, and thus at least one test character image containing one test character can be selected from the multiple image blocks.

[0078] For example, referring to Figure 5a , "monkey" is one of the at least one test characters included in the test handwriting image. The four pixel points corresponding to "monkey" determined in step 2) are: pixel point P1, pixel point P2, pixel point P3, and pixel point P4. Then, a horizontal line can be drawn through pixel point P1 and pixel point P2 respectively, and a vertical line can be drawn through pixel point P3 and pixel point P4 respectively. The rectangle formed by the four intersection points of these four lines (the four dotted lines in the figure) is the minimum circumscribed rectangle of "monkey". According to the minimum circumscribed rectangle of "monkey", "monkey" can be segmented from the test handwriting image, and thus the test character image t corresponding to "monkey" is obtained.

[0079] Since the test character images are segmented from the test handwriting image based on the minimum circumscribed geometric figure of the corresponding test character, and the sizes of the minimum circumscribed geometric figures of different test characters in the test handwriting image are often different, the sizes of the different segmented test character images are also different. In order to avoid the reduction in the accuracy of the test results due to different sizes during subsequent comparison and analysis, in this embodiment, the sizes of both the test character images and the reference character images described in the context are normalized to a preset size, such as a standard size with a length and width ratio of 1:1, more specifically, the sizes are normalized to 128*128. Based on this, the method provided in this embodiment may also include:

[0080] S23 , normalizing the size of each test word graph in the at least one test word graph obtained through steps S21 to S22 to a preset size.

[0081] Taking the first test word graph as an example, where the first test word graph is one of the at least one test word graph, the step S23 of "normalizing the size of the first test word graph to a preset size" may include:

[0082] S231, determining a scaling factor according to a ratio of a preset size to a size of the first test character image;

[0083] S232: Scaling the first test character image according to the scaling factor to obtain a scaled first test character image. The size of the scaled first test character image becomes a preset size.

[0084] In a specific implementation, the determined ratio can be the scaling factor. The scaling factor includes a length scaling factor and a width scaling factor. For example, if the length scaling factor is greater than 1, the first test word image needs to be enlarged in the horizontal direction; if the length scaling factor is less than 1, the first test word image needs to be reduced in the horizontal direction; if the length scaling factor is equal to 1, the first test word image does not need to be scaled in the horizontal direction.

[0085] Using a corresponding scaling and filling algorithm, such as nearest neighbor interpolation, linear interpolation, quadratic interpolation, cubic interpolation, Lagrange interpolation, Gaussian interpolation, etc., the size of the original first test character image can be proportionally scaled to a preset size according to the scaling factor. During the scaling process, for areas of the first test character image that cannot be completely covered by the preset size, the aforementioned scaling and filling algorithm can be used to fill them with the background color, thereby normalizing the original first test image to the preset size without deforming the handwriting or losing the handwriting characteristics.

[0086] In addition, due to external factors such as the angle during the writing process and the light during the acquisition process, there will inevitably be a certain degree of angular deviation and brightness inconsistency between the test handwriting and the reference handwriting in the standard font library of the handwriting on the paper. These inconsistencies will also lead to a decrease in the accuracy of the final test results. Therefore, certain processing means are needed to reduce the influence of external factors. To address this problem, the technical means adopted in this application is: using a corresponding optimization algorithm to find the parameters for phase adjustment and pixel value adjustment between the test character image and the corresponding reference character image, so as to optimize the phase (such as translation, rotation) and pixel value (the gray value of the pixel) of the test character image. Based on this, the method may further include:

[0087] S24. Perform phase optimization and pixel value optimization on each scaled test character image (that is, each test character image with its size normalized to a preset size).

[0088] As an example承接上述针对步骤S23给出的示例, taking the first scaled test character image as an example, where the reference character image corresponding to the first test character image is the first reference character image, and the reference character contained in the first reference character image is the handwriting on the paper and is the same as the test character contained in the first test character image, for example, both are the character "猿", then: "Perform phase optimization and pixel value optimization on the scaled first test character image" in the above S24 may include:

[0089] S241. Use a preset phase optimization function to find the translation parameter and rotation parameter that make the scaled first test character image match the corresponding first reference character image in phase;

[0090] S242. Translate and rotate the first test character image according to the found translation parameter and rotation parameter;

[0091] S243. Use a preset chromaticity optimization function to find the chromaticity coefficient that makes the scaled first test character image match the first reference character image in pixel value;

[0092] S244. Adjust the pixel value of the first test character image according to the found chromaticity coefficient.

[0093] In the above, whether it is phase optimization or pixel value optimization of the first test character image, the optimization goal can be to minimize the mean square error of the pixel values between the first test character image and the corresponding first reference character image. Thus, the phase optimization function and chromaticity optimization function described in the above steps S241 and S243 can both be constructed based on the optimization objective function shown in the following expression (1):

[0094] E = ∑ i ∑ j (I t (i,j) - I r (i,j))2 (1)

[0095] Among them, I t (i, j) represents the pixel value of the test word at position (i, j), I r (i, j) represents the pixel value of the corresponding reference word image at position (i, j), and E represents the mean square error.

[0096] Since the main purpose of phase optimization is to find the optimal translation parameters and rotation parameters to achieve the best phase match between the test word image and the corresponding reference word image, so as to minimize the mean square error of the pixel values between the test word and the corresponding reference word image. Therefore, the phase optimization function constructed based on the above expression (1) can be expressed as the following expression (2):

[0097]

[0098] Where T represents the translation parameter and R represents the rotation parameter. T and R are often in matrix form. Therefore, the above translation parameters and rotation parameters are also called translation matrices and rotation matrices, respectively.

[0099] The first test word graph and the corresponding first reference word graph are input into the phase optimization function for iterative solution. When the iteration stop (i.e., iteration convergence) condition is reached, the optimal solution result will be output, and the optimal solution result includes the optimal translation parameters and rotation parameters found. According to the translation parameters and rotation parameters included in the optimal solution result, the first test word graph is translated and rotated, which can align the phases of the first test word graph and the corresponding first reference word graph (in other words, the phase information is most consistent), thereby reducing the impact of phase differences on subsequent comparison analysis.

[0100] In the iterative solution process, the iterative method used may be, but is not limited to, an optimization algorithm such as a gradient descent method and a modified Newton method (Levenberg-Marquardt).

[0101] As for chromaticity optimization, the main purpose is to find the optimal chromaticity coefficient to optimize the pixel values of the test word image, so that the test image and the corresponding reference image achieve the best match at the chromaticity level, thereby minimizing the mean square error of the pixel values between the two. Therefore, the chromaticity optimization function constructed based on the above expression (1) can be expressed as the following expression (3):

[0102]

[0103] Wherein, α represents the chromaticity coefficient. The first test word image and the corresponding first reference word image are input into the chromaticity optimization function for iterative solution. When the iteration stop (i.e., iteration convergence) condition is reached, the optimal solution result will be output, and the optimal solution result includes the optimal chromaticity coefficient α found. According to the chromaticity coefficient α contained in the optimal solution result, the pixel value of the first test word image is adjusted, so that the first test word image can be closest to the corresponding first reference word image in terms of the overall chromaticity level, thereby reducing the impact of the difference in pixel values on subsequent comparison analysis. As above, the iterative method that can be used in the iterative solution process here can also be the gradient descent method, the modified Newton method, etc.

[0104] It can be understood that since the test word image in this embodiment will become a grayscale image after preprocessing, in this case, the aforementioned chroma coefficient α is actually a grayscale coefficient, and the pixel value of the test word image described in the context is actually a grayscale value.

[0105] For details on the size normalization, phase optimization, and pixel value optimization of test word graphs other than the first test word graph, please refer to the above description of the first test word graph. Based on each test word graph that has undergone size normalization, phase optimization, and pixel value optimization, step S3, "determining a test result based on the graph feature information of each test word graph," can be triggered.

[0106] In one feasible technical solution, the above step S3 can be implemented by the following steps:

[0107] S31, obtaining a reference character image corresponding to each of the test character images;

[0108] S32, comparing the image characteristic information of each test character image with the corresponding reference character image, and obtaining the image feature comparison result of each test character image and the corresponding reference character image;

[0109] S33 , determining the test result according to the result of comparing the image features of each test character image with the corresponding reference character image.

[0110] In the above S31, the reference character image can be obtained from a pre-established standard character library of handwriting on paper. For a detailed description of the standard character library of handwriting on paper, please refer to the relevant content in other embodiments. When obtaining:

[0111] If the standard character library of handwriting on paper only includes multiple reference handwriting images, then: first, based on the test characters contained in each of the test character images, in other words, first, based on all the test character contents contained in the test handwriting images corresponding to each of the test character images, a reference handwriting image containing all the test character contents can be obtained from the standard character library of handwriting on paper; then, the reference handwriting image is segmented by characters to obtain at least one reference character image corresponding to the reference handwriting image. For a specific description of how to obtain at least one reference character image here, please refer to the content related to the above step S2 (i.e., obtaining at least one test character image) described in other embodiments of the present application. Afterwards, each reference character image in the obtained at least one reference character image is matched with each test character image for character content, thereby determining the reference character image corresponding to each test character image.

[0112] If the standard handwriting character library includes: a plurality of reference handwriting images and at least one reference character image corresponding to each reference handwriting image; then: the reference character image corresponding to each test character image can be directly searched and obtained from the standard handwriting character library.

[0113] It is understandable that, in addition to automatically searching for the reference handwriting image or the reference character image from the paper handwriting standard character library, the reference handwriting image or the reference character image can also be obtained manually from the paper handwriting standard character library. Figure 4a 、 Figure 4b and Figure 5a Description of relevant content.

[0114] In the above S32, still taking the first test word graph as an example, the first test word graph is one of the at least one test word graph and corresponds to the first reference word graph; then: based on the respective means (average values), standard deviations (also known as mean square errors), and covariances of the first test word graph and the first reference word graph, the brightness feature comparison results, contrast feature comparison results, and structural feature comparison results between the first test word graph and the first reference word graph can be determined, and then the product value of the three determined feature comparison results is calculated to determine the final image feature comparison result between the first test word graph and the first reference word graph. The formula for calculating the image feature comparison result between the first test word graph and the corresponding first reference word graph can be specifically referred to in Expression (4) shown below:

[0115] SSIM(I r ,I t )=[l(I r ,I t )] α [c(I r ,I t )] β [s(Ir ,I t )] γ (4)

[0116] Among them, I t Represents the test word graph, I r Representation and Test Word Graph I t Corresponding reference word graph; Represents the test word graph I t and reference word map I r Brightness feature comparison results; Represents the test word graph I t and reference word map I r The contrast feature comparison results; Represents the test word graph I t and reference word map I r The structural feature comparison results of α>0, β>0, γ>0, respectively, are adjusted l(I r ,I t )、c(I r ,I t )、s(I r ,I t ) parameter of relative importance; μ r and σ r , respectively, as reference character graph I r The mean and standard deviation, μ t and σ t They are test word graph I t The mean and standard deviation, σ rt Reference word diagram I r and test word graph I t The covariance of C1, C2, and C3 are all constants to maintain l(I r ,I t )、c(I r ,I t )、s(I r ,I t ) stability; SSIM(I r ,I t ) has a maximum value of 1. The larger the value, the better the effect of the test handwriting on paper.

[0117] Generally, the values of α, β, and γ are set to 1, and C3 = C2 / 2. Thus, the above expression (4) can be simplified to expression (5):

[0118]

[0119] In addition to directly comparing the image feature information of each test word image with the corresponding reference word image, other methods can also be used in actual comparison, such as dividing each test word image and the corresponding reference word image into blocks and comparing the image feature information based on the blocks. Based on this, the above step S32 can also be replaced by the following step S32':

[0120] S32′, dividing each of the test character graphs and the corresponding reference character graphs into blocks to perform image feature information comparison on a block-by-block basis, and obtaining an image feature comparison result between each of the test character graphs and the corresponding reference character graphs;

[0121] Still taking the first test word graph as an example, the first test word graph is one of the at least one test word graph and corresponds to the first reference word graph; then: dividing the first test word graph and the first reference word graph into blocks to perform a comparison of graph feature information by block, and obtaining a graph feature comparison result between the first test word graph and the first reference word graph may include:

[0122] S321′, dividing the first test word graph and the first reference word graph into blocks respectively, to obtain a plurality of first block graphs corresponding to the first test word graph and a plurality of second block graphs corresponding to the first reference word graph;

[0123] In this step, a sliding window may be used to divide the first test word graph and the first reference word graph into blocks.

[0124] S322′, comparing the image feature information of each of the first block images with the corresponding second block images, to obtain a block image feature comparison result between each of the first block images and the corresponding second block images;

[0125] In this step, the first block image is compared with the corresponding second block image to obtain the corresponding block image feature comparison result. For the implementation of comparing the image feature information of the test character image with the corresponding reference character image to obtain the corresponding image feature comparison result, please refer to the above description of the test character image and the corresponding reference character image described in combination with expressions (4) and (5). However, considering that the block images (first block image and second block image) are obtained by dividing the corresponding character image into blocks using a sliding window, the shape of the sliding window has an impact on the block images. In order to reduce this impact, when calculating the mean and standard deviation of each first block image and each second block image, as well as the covariance of each first block image and the corresponding second block image, Gaussian weighting can be used, for example.

[0126] S323′: Determine a graph feature comparison result between the first test character graph and the first reference character graph based on a block graph feature comparison result between each first block graph and the corresponding second block graph.

[0127] In this step, the block feature comparison results of each first block image and the corresponding second block image can be averaged, and the obtained average value can be used as the image feature comparison result of the first test word image and the first reference word image. That is, the calculation formula for the image feature comparison result of the first test word image and the first reference word image can be specifically referred to as expression (6) shown below:

[0128]

[0129] Where N represents the reference word graph I r The total number of the corresponding second block diagrams, or the test word diagram I t The total number of the corresponding first block graphs, reference word graph I r The total number of the corresponding first block graph and the test word graph I t The total number of corresponding second block images is equal; I ri Reference word graph I r The i-th second block graph, I ti Represents the test word graph I t The first block diagram of i, SSIM(I ri ,I ti ) represents the block image feature comparison result between the i-th first block image and the corresponding i-th second block image.

[0130] Based on the above-described contents related to steps S32 and S32', let the test target graph be the first test word graph and the reference target graph be the first reference word graph; or let the test target graph be one of the multiple first block graphs corresponding to the first test word graph, and the reference target graph be one of the multiple second block graphs corresponding to the first reference word graph, and correspond to the test target graph (such as position correspondence). Then: "Compare the first test word graph with the corresponding first reference word graph for graph characteristic information, and obtain the graph feature comparison result of each first test word graph and the corresponding first reference word graph" in step S32, and "Compare the graph feature information of a certain first block graph with the corresponding second block graph, and obtain the block graph feature comparison result of the first block graph and the corresponding second block graph" in step S32 can be expressed as the following step B:

[0131] Step B: Compare the image feature information of the test target image with the corresponding reference target image to obtain the image feature comparison result of the test target image and the corresponding reference target image.

[0132] The specific implementation process of step B is as follows:

[0133] B1. Determine a first mean and a first standard deviation of the test target graph, a second mean and a second standard deviation of the reference target graph, and a covariance between the test target graph and the reference target graph;

[0134] For example, combined with the above formula (4), the first mean and the first standard deviation are μ t , σ t , the second mean and the second standard deviation are μ r , σ r , the covariance is σ rt .

[0135] B2. determining a brightness feature comparison result between the test target image and the reference target image based on the first mean, the second mean, and a first set value;

[0136] Specifically, the brightness feature comparison result can be determined based on the product of the first mean and the second mean, the square of the first mean, the square of the second mean, and the first set value. More specifically, for example, the product of the first mean and the second mean can be calculated, multiplied by 2, and then added to the first set value to obtain a first calculated value; then, the square of the first mean, the square of the second mean, and the first set value are summed to obtain a second calculated value; the ratio of the first calculated value to the second calculated value is the brightness feature comparison result. For example, see the aforementioned 1(I r ,I t ) is a specific expression, wherein the first setting value is C1.

[0137] B3. determining a comparison result of contrast characteristics between the test target image and the reference target image based on the first standard deviation, the second standard deviation, and a second set value;

[0138] Specifically, the contrast feature comparison result can be determined based on the product of the first standard deviation and the second standard deviation, the square of the first standard deviation, the square of the second standard deviation, and the second set value. More specifically, for example, the product of the first standard deviation and the second standard deviation can be calculated, multiplied by 2, and then added to the second set value to obtain a third calculated value; then, the square of the first standard deviation, the square of the second standard deviation, and the second set value are summed to obtain a fourth calculated value; the ratio of the third calculated value to the fourth calculated value is the contrast feature comparison result. For example, see the aforementioned c(I r ,I t ) is a specific expression, wherein the second setting value is C2.

[0139] B4. Determining a comparison result of the structural features of the test target graph and the reference target graph based on the first standard deviation, the second standard deviation, the covariance, and a third set value; wherein the third set value is less than the second set value;

[0140] Specifically, for example, the covariance and the third set value may be summed to obtain a fifth calculated value; then, the product of the first standard deviation and the second standard deviation is calculated and added to the third set value to obtain a sixth calculated value; the ratio of the fifth calculated value to the sixth calculated value is the result of the structural feature comparison. For example, see the aforementioned s(I r ,I t ), the third set value is C3. The third set value may be half of the second set value.

[0141] B4. Determine a comparison result of image features between the test target image and the reference target image based on the brightness feature comparison result, the contrast feature comparison result, and the structure feature comparison result.

[0142] For example, the product of the brightness feature comparison result, the contrast feature comparison result, and the structure feature comparison result is determined as the final image feature comparison result of the test target image and the reference target image. See the aforementioned expression (4).

[0143] Through the above content, after obtaining the image feature comparison results of each test word image and the corresponding reference word image, the average value can be taken to determine the average image feature comparison result as the final test result and displayed on the interactive interface. For example, the test result is Figure 5a The average similarity displayed on the interactive interface is 97.20%.

[0144] It is understandable that in addition to displaying the final test results on the interactive interface, in order to facilitate users (tester) to intuitively understand the test process, other content can also be displayed on the interactive interface, such as the test handwriting image, the corresponding reference handwriting image, the test character images corresponding to the test handwriting image, the reference character images corresponding to the corresponding reference handwriting images, the image feature comparison results between the test character image and the corresponding reference character image, etc.

[0145] The following mainly describes in detail another testing method for a writing pen provided by this application from an interactive perspective. Figure 3 The present invention provides another flow chart of a testing method for a writing pen. The execution subject of the method is Figure 1 and Figures 4a to 5a The processing device 20 shown in FIG. Figure 3 As shown, the test method includes the following steps:

[0146] S51, display the interactive interface; the interactive interface is as follows Figure 4a or Figure 4b shown.

[0147] S52: Displaying, on the interactive interface, the acquired test handwriting image formed by the writing pen on the terminal device;

[0148] S53, identifying at least one test word contained in the test handwriting image to obtain at least one test word image;

[0149] S54, comparing the image characteristic information of each test character image with the corresponding reference character image, and obtaining the image feature comparison result of each test character image and the corresponding reference character image;

[0150] S55, determining a test result based on a comparison result of the image features of each test character image and the corresponding reference character image;

[0151] S56, displaying the test results on the interactive interface, and displaying each of the test character images in association with the corresponding reference character images and the image feature comparison results;

[0152] Among them, one of the test word images contains a test word; the reference word contained in the reference word image is a word written on paper and is the same as the test word contained in the corresponding test word image, and the image feature information includes: brightness feature, contrast feature, and structural feature; the test result represents the degree to which the handwriting written by the writing pen is similar to the handwriting on paper.

[0153] For the specific implementation description of the above steps, please refer to the relevant content in other embodiments. In addition, in addition to the above steps, the method provided in the embodiment of the present application may also include other steps. For the other steps that may be included and the specific implementation description, please refer to the relevant content in other embodiments, which will not be repeated here.

[0154] To facilitate understanding of the test method provided above, the following Figure 1 and Figures 4a to 5b Let’s take an example test scenario.

[0155] Before testing begins:

[0156] Before the test is started, the interactive interface displayed on the processing device 20 may be as follows: Figure 4a or Figure 4b As shown, the interactive interface is mainly divided into three areas: a first area for displaying reference handwriting images, a second area for displaying test handwriting images, and a third area for displaying test results and comparison results between the test handwriting images and the corresponding reference handwriting images and image features.

[0157] Start testing:

[0158] 1) The user operates the "Open Reference Image" control to jump into the paper handwriting standard library and select a reference handwriting image from it. In response to the selection operation, the processing device 20 will display the reference handwriting image selected by the user in the first area of the interactive interface, such as Figure 5aThe reference handwriting image R shown therein. After that, the processing device 20 determines the character trajectory information that the writing pen needs to write on the terminal device according to the reference character content included in the reference handwriting image R, and sends the character trajectory information to the driving device 30, so that the driving device 30 drives the robotic arm 11 to move according to the character trajectory information, and the writing pen writes characters with a certain number and structure on the terminal device.

[0159] Alternatively, as shown in Figure 4b , when there is an input box In_box provided on the interaction interface, the user can also directly input the test characters that need to be written by the writing pen through the input box In_box. For example, when the user clicks on the input box In_box, a writing content list will be displayed below the input box. The writing content list includes multiple writing contents, and one writing content contains at least one character. At this time, the user can directly select one or two or more writing contents from it, so as to input the characters that need to be written by the writing pen; correspondingly, in response to this input operation, the processing device 20 can determine the character trajectory information that the writing pen needs to write on the terminal device according to the writing content input by the user, and control the writing pen to write and move characters with a certain number and structure on the terminal device through the driving device 30 and the robotic arm 11. In addition, the processing device 20 can also search for the reference handwriting image containing the writing content input by the user from the standard character library of handwriting on paper, and display the found reference handwriting image R in the first area on the interaction interface.

[0160] 2) After writing is completed, the processing device 20 obtains the test handwriting image formed after the writing pen writes on the terminal device through the image acquisition device, and displays the test handwriting image in the second area on the interaction interface, as shown in Figure 5a the test handwriting image T shown therein. In addition, as combined with Figure 5a , the processing device 20 will also perform preprocessing on the test handwriting image T such as grayscale conversion, inversion, binarization, filtering, Gaussian blur, etc. After the preprocessing is completed, the test handwriting image T will also be segmented and other processed, so as to obtain at least one test character image t corresponding to the test handwriting image T, such as the test character images t of "tian", "gao", "yuan", etc., and display each obtained test character image t at the corresponding position in the third area on the interaction interface. And, the processing device 20 will also determine the corresponding reference character image r for each test character image t according to the at least one reference character image r corresponding to the reference handwriting image R, and display it at the corresponding position in the third area on the interaction interface. For example, each test character image t and the corresponding reference character image r can be but not limited to being displayed in an upper-lower relationship.

[0161] It should be noted that: The various processes performed by the above processing device 20 on the ranging handwriting image T and the reference handwriting image R can be automatically executed by the processing device 20 according to a program, or alternatively, can also be executed passively by the processing device 20 in response to the "obtain text" control on the user operation interface, which is not limited here. Preferably, it is to make the processing device 20 execute automatically.

[0162] 3) After determining the corresponding reference character image r for each test character image t, start to perform comparison and analysis of image feature information such as brightness, contrast, and structure between each test character image t and the corresponding reference character image r, so as to determine the image feature comparison result between each test character image t and the corresponding reference character image r, and this image feature comparison result can be understood as the image feature similarity. For example, Figure 5a The image feature similarity between the "ape" test character image shown in and the corresponding "ape" reference character image is 97.15%. Then, add up and average the image feature similarities between each test character image t and the corresponding reference character image r, and the average similarity obtained is 97.20% for example, and this average similarity is the test result of the writing pen. The higher the average similarity, the more similar the handwriting written by the writing pen on the terminal device is to the handwriting on paper.

[0163] It should be noted that: The above comparison and analysis of image feature information can be automatically executed by the processing device 20 according to a program, or alternatively, can also be executed passively by the processing device 20 in response to the "run" control on the user operation interface, which is not limited here. Preferably, it is to make the processing device 20 execute automatically. During the execution of the image feature information comparison and analysis by the processing device 20, the user can also use the "pause" control on the operation interface to make the processing device 20 stop the comparison and analysis of image feature information.

[0164] In summary, it should be supplemented and explained here that: The test result is affected by the preprocessing performed on the test handwriting image T in the early stage and the processing performed on the test character image r corresponding to the test handwriting image T. For example, combined with Figure 5b , assuming that only inversion and binarization are performed on the test handwriting image T in the early stage, and no processing is performed on each test character image t obtained by segmenting the test handwriting image T, the obtained test result (average similarity) is often relatively low, such as 84.25%; further, if on the basis of the above-mentioned processing, filtering, Gaussian blur, etc. are also performed on the test handwriting image T, the final obtained test result will be improved, such as it can be improved from 84.25% to 90.81%. Further still, if phase optimization, pixel value optimization, etc. are also performed on each test character image t obtained by segmenting the test handwriting image T, the final obtained test result will be improved again, such as it can be improved from 90.81% to 97.20%.

[0165] 4) Change the type and / or model of the writing pen and repeat steps 1) to 3) to conduct a new round of testing. In the new round of testing, the trajectory of the writing pen on the terminal device driven by the robotic arm can be changed.

[0166] In summary, the writing pen testing technical solution provided in this embodiment has the following benefits:

[0167] (1) The test handwriting can be repeatedly written by the robotic arm to ensure the repeatability and accuracy of the test.

[0168] For example, through the robotic arm, the writing force, style, etc. of the writing pen on the terminal device can be controlled, thereby ensuring that the writing force, style, etc. of the writing pen on the terminal device are consistent in multiple repetitive tests. This can effectively avoid the accuracy of the final test results being affected by differences in writing force, style, etc. when the final test results are determined by comprehensive multiple repeated tests.

[0169] (2) Traditional solutions often only consider the mean square error (MSE) when determining the similarity between two images. More specifically, they only consider the average brightness error between the two images, without considering the image structure and other characteristic information. This results in a drastic change in the calculated MSE value when the image brightness changes slightly. However, small changes in brightness will not cause humans to judge the two images as completely different. Compared to using the traditional MSE to determine the similarity between two images, this application considers the image brightness, contrast, and structure and other characteristic information when testing the effect of writing on paper when the writing pen is written on the terminal device, which can make the test results closer to the human visual system judgment standard.

[0170] (3) Traditional similarity algorithms have certain limitations in practical applications. When the image is displaced, scaled or rotated, the similarity calculation results will fluctuate greatly. This application reduces the impact of non-structural distortion on similarity calculation by adopting normalization, preprocessing and optimization algorithms (phase optimization, pixel value optimization), thereby improving the effectiveness and accuracy of using similarity to evaluate the effect of handwriting written by a writing pen on a terminal device.

[0171] It should be noted that the test system provided by the present application can be applied to not only the writing effect test scenario of a writing pen, but also other test scenarios, such as the automated testing of the operation and display effects of the user interface (UI) of a terminal device. For example, the processing device 20 can control the mechanical arm 11 through the driving device to operate the UI interface of the terminal device, and collect the UI interface image after the operation through the image acquisition device 40, and determine the accuracy of the UI response operation of the terminal device by analyzing the UI interface image; or, compare the collected UI interface image with the corresponding standard reference UI interface image to determine the UI interface display effect based on the comparison result.

[0172] This application also provides a processing device. For the specific form of the processing device, please refer to the relevant content in the above other embodiments. For example, Figure 6a and Figure 6b Schematic diagram of the structure of the processing device 20 is shown. Figure 6a As shown, the processing device 20 includes: a memory 221 and a processor 210; wherein,

[0173] The memory 221 is used to store programs; the processor 210 is coupled to the memory and is used to execute the programs stored in the memory to implement the steps in the various testing methods provided in the present application.

[0174] The memory 221 (which is a memory) can be used to store computer executable program code, which includes instructions. The memory 221 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 210 executes various functional applications and data processing of the processing device 20 by running instructions stored in the memory 221, and / or instructions stored in a memory provided in the processor.

[0175] The processor 210 may include one or more processing units. For example, the processor 210 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.

[0176] The processor can generate operation control signals based on instruction opcodes and timing signals to complete the control of instruction fetching and execution.

[0177] Processor 210 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 210 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 210. If processor 210 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0178] In some embodiments, the processor 210 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.

[0179] Furthermore, in addition to the functional components described above, Figure 6a and Figure 6b As shown, the processing device 20 also includes: an external memory interface 220, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera module 293, a display screen 294, and a subscriber identification module (SIM) card interface 295, etc.

[0180] Among them, the sensor module 280 can include a pressure sensor 280A, a gyroscope sensor 280B, an air pressure sensor 280C, a magnetic sensor 280D, an acceleration sensor 280E, a distance sensor 280F, a proximity light sensor 280G, a fingerprint sensor 280H, a temperature sensor 280J, a touch sensor 280K, an ambient light sensor 280L, a bone conduction sensor 280M, etc.

[0181] It is understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the processing device 20. In other embodiments of the present application, the processing device 20 may include more or fewer components than shown, or may combine or separate certain components, or may have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0182] Furthermore, it should be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are merely illustrative and do not constitute a structural limitation on the processing device 20. In other embodiments of the present application, the processing device 20 may also adopt different interface connection methods from those in the above embodiments, or a combination of multiple interface connection methods.

[0183] Processing device 20 implements display functions through a graphics processing unit (GPU), display screen 294, and an application processor. The GPU connects display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 210 may include one or more GPUs that execute program instructions to generate or modify display information.

[0184] Display screen 294 is used to display images, videos, and the like. Display screen 294 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLED, or a quantum dot light-emitting diode (QLED). In some embodiments, processing device 20 may include one or N display screens 294, where N is a positive integer greater than one.

[0185] The processing device 20 can realize the shooting function through the ISP, camera module 293, video codec, GPU, display screen 294 and application processor.

[0186] The camera module 293 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the camera module 293 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0187] Video codecs are used to compress or decompress digital video. Processing device 20 may support one or more video codecs. This allows electronic device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.

[0188] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU enables intelligent cognitive applications in processing device 20, such as image recognition, face recognition, speech recognition, and text comprehension.

[0189] The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 210 via the external memory interface 220 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0190] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a computer, can implement one or more steps in any of the above methods.

[0191] The computer readable storage medium may be a non-transitory computer readable storage medium, for example, a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.

[0192] Another embodiment of the present application further provides a computer program product comprising instructions, which, when executed by a computer, can implement one or more steps in any of the above methods.

[0193] Among them, the electronic device, computer-readable storage medium, and computer program product provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0194] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0195] Units described as separate components may or may not be physically separate, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0196] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0197] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0198] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A testing method for a writing pen, characterized in that: include: Acquire a test handwriting image formed after the writing pen writes on the terminal device; Recognizing at least one test word contained in the test handwriting image to obtain at least one corresponding test word image; Determining a test result according to the graphic feature information of each test character graphic; Displaying the test results on the interactive interface; Wherein, one of the test word graphs contains a test word, and the image feature information of the test word graph includes brightness feature, contrast feature, and structure feature; The test result indicates that the handwriting of the writing pen is similar to the handwriting on paper.

2. The method according to claim 1, characterized in that Determining a test result according to the image feature information of each test character image includes: Obtaining a reference character image corresponding to each of the test character images; wherein the reference character in the reference character image is written on paper and is the same as the test character in the corresponding test character image; Comparing the image feature information of each test character graph with the corresponding reference character graph, or dividing each test character graph and the corresponding reference character graph into blocks to compare the image feature information of each block, to obtain an image feature comparison result of each test character graph and the corresponding reference character graph; Determining the test result according to a comparison result of the image features of each test character image and the corresponding reference character image; The first test word graph is one of the at least one test word graph and corresponds to the first reference word graph; and the first test word graph and the first reference word graph are divided into blocks to perform a comparison of graph feature information by block, thereby obtaining a graph feature comparison result between the first test word graph and the first reference word graph, including: Dividing the first test word graph and the first reference word graph into blocks respectively to obtain a plurality of first block graphs corresponding to the first test word graph and a plurality of second block graphs corresponding to the first reference word graph; Comparing the image feature information of each of the first block images with the corresponding second block images to obtain a block image feature comparison result between each of the first block images and the corresponding second block images; According to the block image feature comparison results of each of the first block images and the corresponding second block image, a graph feature comparison result of the first test word image and the first reference word image is determined.

3. The method according to claim 2, characterized in that The test target graph is the first test word graph, and the reference target graph is the first reference word graph; or the test target graph is one of the plurality of first block graphs, and the reference target graph is one of the plurality of second block graphs and corresponds to the test target graph; and Comparing the image feature information of the test target image with the corresponding reference target image to obtain the image feature comparison result between the test target image and the reference target image, including: Determining a first mean and a first standard deviation of the test target graph, a second mean and a second standard deviation of the reference target graph, and a covariance between the test target graph and the reference target graph; Determining a brightness feature comparison result between the test target image and the reference target image according to the first mean, the second mean, and a first set value; Determining a contrast feature comparison result between the test target image and the reference target image according to the first standard deviation, the second standard deviation, and a second set value; determining a comparison result of the structural features of the test target graph and the reference target graph based on the first standard deviation, the second standard deviation, the covariance, and a third set value, wherein the third set value is less than the second set value; The image feature comparison result between the test target image and the reference target image is determined according to the brightness feature comparison result, the contrast feature comparison result and the structure feature comparison result.

4. The method according to claim 3, characterized in that Determining a brightness feature comparison result between the test target image and the reference target image according to the first mean, the second mean, and a first set value, including: The brightness feature comparison result is determined according to a product value of the first mean and the second mean, a square of the first mean, a square of the second mean, and a first set value.

5. The method according to claim 3, characterized in that Determining a contrast feature comparison result between the test target image and the reference target image according to the first standard deviation, the second standard deviation, and a second set value, including: The contrast feature comparison result is determined according to the product of the first standard deviation and the second standard deviation, the square of the first standard deviation, the square of the second standard deviation, and the second set value.

6. The method according to claim 3, characterized in that Determining a comparison result of structural features between the test target graph and the reference target graph according to the first standard deviation, the second standard deviation, the covariance, and a third set value includes: The structural feature comparison result is determined according to the covariance, the product of the first standard deviation and the second standard deviation, and the third set value.

7. The method according to any one of claims 2 to 6, characterized in that Before comparing the first test word graph with the first reference word graph for graph feature information, or before dividing the first test word graph and the first reference word graph into blocks, the method further includes: determining a scaling factor according to a ratio of a preset size to a size of the first test character image; The first test word image is scaled according to the scaling factor to obtain the scaled first test word image.

8. The method according to claim 7, characterized in that Also includes: Using a preset phase optimization function, searching for translation parameters and rotation parameters that enable the scaled first test word image to achieve phase matching with the first reference word image; translating and rotating the first test character image according to the found translation parameter and rotation parameter; Using a preset chromaticity optimization function, searching for a chromaticity coefficient that enables the scaled first test word image to achieve pixel value matching with the first reference image; According to the found chroma coefficient, the pixel values of the first test character image are adjusted.

9. The method according to any one of claims 1 to 6, characterized in that Recognizing at least one test word contained in the test handwriting image to obtain at least one corresponding test word image includes: Determining the minimum circumscribed geometric figure of each test character in the recognized test handwriting image; The test character image is segmented according to the minimum circumscribed geometric figure of each test character to obtain the at least one test character image.

10. The method according to any one of claims 1 to 6, characterized in that Also includes: Preprocessing the test handwriting image to obtain the preprocessed test handwriting image; triggering, according to the pre-processed test handwriting image, the step of identifying at least one test character contained in the test handwriting image; The preprocessing includes at least one of the following: grayscale processing, inversion processing, binarization processing, filtering processing, and Gaussian blur processing.

11. A testing method for a writing pen, characterized in that: include: Display the interactive interface; On the interactive interface, displaying the acquired test handwriting image formed after the writing pen is written on the terminal device; Recognizing at least one test word contained in the test handwriting image to obtain at least one corresponding test word image; Comparing the image feature information of each test character image with the corresponding reference character image to obtain the image feature comparison result of each test character image and the corresponding reference character image; Determining a test result based on a comparison result of the image features of each test character image and the corresponding reference character image; On the interactive interface, the test results are displayed, and each of the test word graphs is associated with the corresponding reference word graph and the image feature comparison result; Among them, one of the test word images contains a test word; the reference word in the reference word image is written on paper and is the same as the test word in the corresponding test word image, and the image feature information includes: brightness feature, contrast feature, and structural feature; the test result represents the degree to which the handwriting written by the writing pen is similar to the handwriting on paper.

12. A testing system, characterized in that: include: A writing device, comprising a robotic arm and a fixing platform; one end of the robotic arm is used to clamp the writing pen, and the fixing platform is used to fix the terminal device; a driving device connected to the robotic arm, and configured to drive the robotic arm to move so that the writing pen performs a writing operation on the terminal device; An image acquisition device, configured to acquire a test handwriting image formed after the writing pen writes on the terminal device; a processing device connected to the image acquisition device, and configured to: receive the test handwriting image sent by the image acquisition device; Identifying at least one test word contained in the test handwriting image to obtain at least one corresponding test word image; determining a test result based on the image feature information of each test word image; The test result is displayed on the interactive interface; wherein, one of the test character images contains a test character, and the image feature information of the test character image includes brightness feature, contrast feature, and structural feature. The test result represents the degree to which the handwriting written by the writing pen is similar to the handwriting on paper.

13. The system according to claim 12, wherein: The processing device is also connected to the driving device and is used to send a driving instruction to the driving device, wherein the driving instruction includes word track information; The driving device is specifically used to drive the robot arm to move according to the word trajectory information in the driving instruction.

14. The system according to claim 12, wherein: The image acquisition device comprises: a bracket having a horizontal extension above the fixing platform; a guide rail disposed on the horizontal extension; a camera, slidably connected to the guide rail; The processing device is further configured to: after receiving the driving completion information returned by the driving device, control the camera to slide on the guide rail, so as to slide to a position above the fixed platform to capture the test handwriting image.

15. A processing device, characterized in that include: Memory and processor; wherein, The memory is used to store programs; The processor is coupled to the memory and is configured to execute the program stored in the memory to implement the steps of the test method according to any one of claims 1 to 10, or to implement the steps of the test method according to claim 11.