Automatic Testing Method, Device, Electronic Device and Storage Medium of Scanning Translator Pen
Through the automatic testing method of machine vision and robotics working together, the problem of high efficiency and low cost of scanning and translation tests is solved, and efficient automated testing is achieved.
Patent Information
- Application Number
- CN202111498755.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-09
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2041-12-09
AI Technical Summary
The existing testing methods for scanning pens rely on manual operations, resulting in high testing costs and low efficiency.
Machine vision and robots work together to obtain file images through the camera, obtain text coordinate information, and control robot motion scanning pen with programmable logic controller to achieve automatic testing.
It improves the testing efficiency of the scanning and translation pen, reduces testing costs, and reduces manpower investment.
Smart Images

Figure CN114399767B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of character recognition, and particularly relates to an automatic testing method, device, electronic device and storage medium for a scanning and translating pen. Background Art
[0002] A scanning and translating pen is a portable intelligent product used for automatically recognizing characters and performing two-way translation, mainly for home education. With the increase in the number of users, there are relatively high expectations for the stability of this product. Most of the current testing methods for scanning and translating pens are that testers hold the scanning and translating pen, click on the document to be scanned and translated, and check whether the characters displayed on the scanning and translating pen or the voice played by the scanning and translating pen is consistent with the scanned and translated document to determine the accuracy of the scanning and translating pen. For the stability test of the scanning and translating pen, generally, the above operation steps need to be repeated hundreds or thousands of times to scan and translate the document to determine the stability of the scanning and translating pen system. This stability test requires a lot of energy and time from testers.
[0003] The purpose of the present invention is to provide an automatic testing method and device for a scanning and translating pen based on machine vision and a manipulator. This automatic testing method can accurately locate the starting and ending points of each line of text in a document through machine vision for different paper target documents placed on a test bench, and then use the manipulator to drive the scanning and translating pen to perform sequential scanning or random scanning according to the text positioning, so as to replace manual testing, and the number of tests can be set to perform a long-term stress test on the scanning and translating pen, reducing labor input and improving testing efficiency. Summary of the Invention
[0004] The purpose of the present invention is to provide an automatic testing method, device, electronic device and storage medium for a scanning and translating pen, aiming to solve the problems of high testing cost and low testing efficiency caused by manual execution of scanning and translating tests in the prior art.
[0005] On the one hand, the present invention provides an automatic testing method for a scanning and translating pen, and the method includes the following steps:
[0006] Obtain a first image of the document to be scanned and translated through a camera;
[0007] Obtain first coordinate information of the text to be scanned and translated according to the first image;
[0008] According to the first coordinate information, a preset coordinate mapping relationship, and a preset scanning and translating rule, control the movement of the manipulator fixed with the scanning and translating pen through a programmable logic controller, so that the scanning and translating pen scans the text to be scanned and translated to obtain a test log of the scanning and translating pen;
[0009] Output a test result according to the test log.
[0010] Preferably, before the step of obtaining the first coordinate information of the text to be scanned and translated according to the first image, the following steps are further included:
[0011] Set the origin of the manipulator;
[0012] Obtain a second image of the target document through the camera, and obtain the second coordinate information of the target area in the second image;
[0013] Obtain the third coordinate information of the manipulator corresponding to the target area;
[0014] Based on the origin, the second coordinate information, and the third coordinate information, obtain the preset coordinate mapping relationship.
[0015] Preferably, the preset scanning and translation rule includes a preset scanning and translation method. The first coordinate information includes the starting coordinate and the ending coordinate of each text line. According to the first coordinate information, the preset coordinate mapping relationship, and the preset scanning and translation rule, the step of controlling the movement of the manipulator fixed with the scanning and translation pen by the programmable logic controller includes:
[0016] Obtain the starting coordinate and the ending coordinate of the target line to be scanned and translated from the first coordinate information according to the preset scanning and translation method;
[0017] According to the preset coordinate mapping relationship, perform coordinate mapping on the starting coordinate and the ending coordinate of the target line to be scanned and translated to obtain the target movement coordinate information of the manipulator;
[0018] According to the target movement coordinate information, control the movement trajectory of the manipulator through the programmable logic controller.
[0019] Preferably, the preset scanning and translation rule includes a preset number of scanning and translation times. After the step of controlling the movement of the manipulator fixed with the scanning and translation pen by the programmable logic controller, the following steps are included:
[0020] Judge whether a preset error keyword appears in the test log corresponding to the current scanning and translation;
[0021] If the preset error keyword appears, stop scanning and translation and retain the error scene;
[0022] If the preset error keyword does not appear, judge whether the current number of scanning and translation times reaches the preset number of scanning and translation times;
[0023] If the preset number of scanning and translation times is reached, jump to the step of outputting the test result according to the test log;
[0024] If the preset number of scanning and translation operations is not reached, jump to the step of controlling the movement of the mechanical arm with the scanning and translation pen fixed thereto by a programmable logic controller according to the first coordinate information, the preset coordinate mapping relationship, and the preset scanning and translation rules.
[0025] Preferably, the preset scanning and translation rules include a preset scanning speed. The step of controlling the movement of the mechanical arm with the scanning and translation pen fixed thereto by a programmable logic controller to enable the scanning and translation pen to scan and translate the text to be scanned and translated further includes:
[0026] Controlling the movement speed of the mechanical arm by the programmable logic controller to enable the scanning and translation pen to scan and translate the text to be scanned and translated at the scanning speed.
[0027] Preferably, the preset scanning and translation rules include a preset scanning angle. The step of controlling the movement of the mechanical arm with the scanning and translation pen fixed thereto by a programmable logic controller to enable the scanning and translation pen to scan and translate the text to be scanned and translated further includes:
[0028] Controlling the movement posture of the mechanical arm by the programmable logic controller to enable the scanning and translation pen to scan and translate the text to be scanned and translated at the scanning angle.
[0029] On the other hand, the present invention provides an automatic testing device for a scanning and translation pen, and the device includes:
[0030] A first image acquisition unit, configured to acquire a first image of a file to be scanned and translated through a camera;
[0031] A first coordinate acquisition unit, configured to acquire first coordinate information of the text to be scanned and translated according to the first image;
[0032] A scanning and translation test execution unit, configured to control the movement of the mechanical arm with the scanning and translation pen fixed thereto by a programmable logic controller according to the first coordinate information, the preset coordinate mapping relationship, and the preset scanning and translation rules, so that the scanning and translation pen scans and translates the text to be scanned and translated to obtain a test log of the scanning and translation pen; and
[0033] A test result output unit, configured to output a test result according to the test log.
[0034] On the other hand, the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above method are implemented.
[0035] On the other hand, the present invention also provides an automatic test system for a scanning and translating pen, including the electronic device as described above, as well as a camera, a scanning and translating pen, and a programmable logic controller respectively connected to the electronic device. The scanning and translating pen is fixed on a manipulator, and the manipulator is connected to the programmable logic controller.
[0036] On the other hand, the present invention also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps of the method as described above are implemented.
[0037] The present invention obtains a first image of a file to be scanned and translated through a camera, obtains first coordinate information of the text to be scanned and translated according to the first image, and controls the movement of the manipulator fixed with the scanning and translating pen through a programmable logic controller according to the first coordinate information of the text to be scanned and translated, a preset coordinate mapping relationship, and a preset scanning and translating rule, so that the scanning and translating pen scans the text to be scanned and translated, obtains a test log of the scanning and translating pen, and outputs a test result according to the test log, thereby realizing the automatic test of the scanning and translating pen based on machine vision and the manipulator, improving the test efficiency of the scanning and translating pen and reducing the test cost. Description of the Drawings
[0038] Figure 1A is a schematic diagram of an application scenario of the automatic test method for a scanning and translating pen provided in Embodiment 1 of the present invention;
[0039] Figure 1B is a flowchart of the implementation of the automatic test method for a scanning and translating pen provided in Embodiment 1 of the present invention;
[0040] Figure 2 is a schematic structural diagram of an automatic test device for a scanning and translating pen provided in Embodiment 2 of the present invention;
[0041] Figure 3 is a schematic structural diagram of an electronic device provided in Embodiment 3 of the present invention; and
[0042] Figure 4 is a schematic structural diagram of an automatic test system for a scanning and translating pen provided in Embodiment 4 of the present invention. Detailed Embodiments
[0043] In order to make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0044] Figure 1A is a schematic diagram of an application scenario of an embodiment of the present invention. Figure 1AIn this case, the electronic device 10 is respectively connected to the camera 11, the scanning and translating pen 14, and the programmable logic controller (PLC) 12. The scanning and translating pen 14 is fixed on the mechanical arm 13. The electronic device 10 controls the movement of the mechanical arm 13 through the programmable logic controller 12 to drive the scanning and translating pen to scan the file to be scanned and translated. The file to be scanned and translated is placed on the test bench. The electronic device 10 can obtain the image of the file to be scanned and translated placed on the test bench through the camera 11. Among them, the above-mentioned camera can be a high-definition camera, and the above-mentioned mechanical arm can be a three-axis mechanical arm, which is appropriate to meet the actual test requirements.
[0045] The following describes the specific implementation of the present invention in detail with reference to specific embodiments:
[0046] Example 1:
[0047] Figure 1A The implementation process of the automatic test method of the scanning and translating pen provided in Embodiment 1 of the present invention is shown. For the convenience of description, only the parts related to the embodiments of the present invention are shown and are described in detail as follows:
[0048] In step S101, a first image of the file to be scanned and translated is obtained through the camera.
[0049] The embodiments of the present invention are applicable to electronic devices. Among them, the electronic device can be a mobile phone, a tablet computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiments of the present application do not impose any restrictions on the specific type of the electronic device.
[0050] In the embodiments of the present invention, the file to be scanned and translated can be placed on the test bench, and the camera is placed in a certain preset area around the test bench. Usually, the camera can be set directly above the test bench to ensure the image effect of the file to be scanned and translated, that is, the effect of the above-mentioned first image. After obtaining the above-mentioned first image, further, preprocessing is performed on the first image to improve the subsequent test effect. Among them, the preprocessing process can include binarization, denoising, image correction, etc.
[0051] Before obtaining the first image of the file to be scanned and translated through the camera, it is necessary to calibrate the coordinates of the manipulator. Preferably, the origin of the manipulator is set to eliminate the influence of external disturbances such as power failure of the manipulator on the coordinate correspondence. Specifically, due to the characteristic that once the manipulator is powered off and then powered on again, the default starting position is the origin, if a power failure occurs during the test, the coordinates during the test will not correspond. Therefore, the second image of the target file can be obtained through the camera, and a point that the manipulator can reach within the range of the second image is set as the origin, and the coordinates of the manipulator at this origin are mapped to (0, 0). In this way, even if the manipulator is powered off during operation, after restarting, the set point can still be used as the origin. Among them, the target file can be the above-mentioned file to be scanned and translated, or a paper file other than the file to be scanned and translated.
[0052] After setting the origin of the manipulator, further, calibrate the text coordinate information corresponding to the target area obtained through the camera with the manipulator coordinate information, that is, set the coordinate mapping relationship between the manipulator and the text area in the first image. Preferably, obtain the second image of the target file through the camera, obtain the second coordinate information of the target area in the second image, obtain the third coordinate information of the manipulator corresponding to the target area, and obtain the preset coordinate mapping relationship based on the second coordinate information and the third coordinate information to set the mapping relationship between the two coordinate information for subsequent scanning and translation tests. Specifically, after obtaining the above second image, the target area input by the user within the range of the second image can be received. This target area is usually a selected area. Obtain the upper left corner and lower right corner coordinates of this target area. Then, control the manipulator to move to the above upper left corner and lower right corner positions respectively. Through coordinate conversion, map the target areas corresponding to the manipulator and the camera to obtain the above coordinate mapping relationship. Further, record the coordinates of the manipulator when it is at the upper left corner and lower right corner of the target area, and set the activity range of the manipulator within the above target area for subsequent operation of the manipulator.
[0053] In step S102, obtain the first coordinate information of the text to be scanned and translated according to the first image.
[0054] In an embodiment of the present invention, the text area of the text to be scanned and translated can be obtained. Specifically, the above-mentioned text area input by the user can be received, and the image of the above-mentioned text area can be saved to a specified file path. Then, the file path can be sent to a preset text recognition algorithm, and the first coordinate information of each text line in the above-mentioned text area can be obtained through the text recognition algorithm. The first coordinate information may include the coordinates of a single text. Preferably, the first coordinate information includes the starting coordinate and the ending coordinate of each text line to reduce the amount of data during the test. Specifically, the starting coordinate can be selected as the center point position coordinates of the upper left corner and the lower left corner of the starting position of each text line, and the ending coordinate can be selected as the center point position coordinates of the upper right corner and the lower right corner of the ending position of the text line. Further, when there are multiple coordinate information of the text lines obtained through the text recognition algorithm, that is, the text recognition algorithm may find the coordinates of multiple text areas in a text line. At this time, the multiple coordinate information needs to be merged to obtain the starting coordinate and the ending coordinate of each text line.
[0055] In step S103, according to the first coordinate information of the text to be scanned and translated, the preset coordinate mapping relationship, and the preset scanning and translation rules, a programmable logic controller is used to control the movement of the manipulator fixed with the scanning and translation pen, so that the scanning and translation pen scans the text to be scanned and translated, and a test log of the scanning and translation pen is obtained.
[0056] In an embodiment of the present invention, the coordinate information of each text line obtained above can be coordinate-mapped according to the above-mentioned coordinate mapping relationship to obtain the coordinate information of the manipulator, and the movement trajectory of the manipulator can be determined based on the coordinate information. Further, considering the actual test requirements, scanning and translation rules can be preset to complete the test of the scanning and translation pen based on the scanning and translation rules.
[0057] Preferably, the preset scanning and translation rules include one or more of a preset scanning and translation method, a preset number of scanning and translation times, a preset scanning speed, or a preset scanning angle to enrich the test scenarios and improve the comprehensiveness of the test. Among them, the preset scanning and translation method may include a random line scanning and translation method or a sequential line scanning and translation method. The random line scanning may include one or more of an even line scanning method, an odd line scanning method, an interlaced scanning method, and a random line scanning method based on random numbers generated within the full text range. The sequential line scanning and translation method may be to scan each line of text in sequence.
[0058] Preferably, if the preset scanning and translation rule includes a preset scanning and translation method, when controlling the movement of the mechanical arm with the scanning and translation pen by a programmable logic controller according to the first coordinate information of the text to be scanned and translated, the preset coordinate mapping relationship, and the preset scanning and translation rule, the starting coordinate and the ending coordinate of the target line to be scanned and translated are obtained from the first coordinate information according to the preset scanning and translation method. According to the preset coordinate mapping relationship, coordinate mapping is performed on the starting coordinate and the ending coordinate of the target line to be scanned and translated to obtain the target movement coordinate information of the mechanical arm. According to the target movement coordinate information, the movement trajectory of the mechanical arm is controlled by the programmable logic controller to perform coordinate mapping and scanning and translation tests on the target line to be scanned and translated, further simplifying the amount of data in the test process.
[0059] Since different test problems may occur to the scanning and translation pen during the test process, such as response problems, crash problems, memory leak problems, error problems, etc., problem keywords corresponding to different test problems can be preset. For example, the problem keywords corresponding to response problems, crash problems, memory leak problems, and exception problems are "ANR", "CRASH", "Out ofmemory", and "Exception" respectively, so that testers can accurately query the corresponding test problems from the test log. Preferably, the preset scanning and translation rule includes a preset number of scanning and translation times. After the step of controlling the movement of the mechanical arm with the scanning and translation pen by a programmable logic controller, it is judged whether a preset error keyword appears in the test log corresponding to the current scanning and translation. If a preset error keyword appears, the scanning and translation are stopped and the error scene is retained. If a preset error keyword does not appear, it is judged whether the current number of scanning and translation times reaches the preset number of scanning and translation times. If the preset number of scanning and translation times is reached, it jumps to the step of outputting the test result according to the test log. If the preset number of scanning and translation times is not reached, it jumps to the step of controlling the movement of the mechanical arm with the scanning and translation pen by a programmable logic controller according to the first coordinate information of the text to be scanned and translated, the preset coordinate mapping relationship, and the preset scanning and translation rule, so as to retain the error scene in time while realizing multiple automatic tests, facilitating testers to analyze problems based on the retained error scene.
[0060] Preferably, the preset scanning and translation rule includes a preset scanning speed. When controlling the movement of the mechanical arm with the scanning and translation pen by a programmable logic controller to enable the scanning and translation pen to scan the text to be scanned and translated, the movement speed of the mechanical arm is controlled by the programmable logic controller to enable the scanning and translation pen to scan the text to be scanned and translated at the scanning speed, thereby testing the accuracy of the scanning and translation pen by setting different scanning speeds and improving the comprehensiveness of the scanning and translation pen test.
[0061] Preferably, the preset scanning and translation rules include a preset scanning angle. The programmable logic controller is used to control the movement of the mechanical arm fixed with the scanning and translation pen. When the scanning and translation pen scans the text to be scanned and translated, the programmable logic controller is used to control the movement posture of the mechanical arm so that the scanning and translation pen scans the text to be scanned and translated according to the scanning angle. Thus, by setting different scanning and translation angles, the accuracy of the scanning and translation pen is tested, and the comprehensiveness of the scanning and translation pen test is improved.
[0062] In step S104, according to the test log, the test result is output.
[0063] In the embodiment of the present invention, the test log is analyzed to obtain the test result. Specifically, the test result can be output according to one or more of the accuracy rate of text scanning and translation, the speed of text scanning and translation, the angle of text scanning and translation, the area of text scanning and translation, the actual number of text scanning and translations, the test start time, the test end time, etc. Further, the error keywords found in the test log can be used to determine the test problems that occur during the test, and the test result can be output according to the test problems and the positions where the test problems appear in the test log.
[0064] In the embodiment of the present invention, the first image of the file to be scanned and translated is obtained through the camera, the first coordinate information of the text to be scanned and translated is obtained according to the first image, and according to the first coordinate information of the text to be scanned and translated, the preset coordinate mapping relationship, and the preset scanning and translation rules, the programmable logic controller is used to control the movement of the mechanical arm fixed with the scanning and translation pen so that the scanning and translation pen scans the text to be scanned and translated, and the test log of the scanning and translation pen is obtained. According to the test log, the test result is output, thereby realizing the automatic test of the scanning and translation pen based on machine vision and the mechanical arm, improving the test efficiency of the scanning and translation pen and reducing the test cost.
[0065] Example 2:
[0066] Figure 2 The structure of the automatic test device for the scanning and translation pen provided in the second embodiment of the present invention is shown. For the convenience of description, only the parts related to the embodiment of the present invention are shown, including:
[0067] The first image acquisition unit 21 is used to obtain the first image of the file to be scanned and translated through the camera;
[0068] The first coordinate acquisition unit 22 is used to obtain the first coordinate information of the text to be scanned and translated according to the first image;
[0069] The scanning and translation test execution unit 23 is used to control the movement of the mechanical arm fixed with the scanning and translation pen through the programmable logic controller according to the first coordinate information of the text to be scanned and translated, the preset coordinate mapping relationship, and the preset scanning and translation rules, so that the scanning and translation pen scans the text to be scanned and translated, and obtains the test log of the scanning and translation pen; and
[0070] A test result output unit 24, configured to output a test result according to a test log.
[0071] Preferably, the device further includes:
[0072] An origin setting unit, configured to set the origin of the manipulator;
[0073] A second coordinate acquisition unit, configured to acquire a second image of a target file through a camera and acquire second coordinate information of a target area in the second image;
[0074] A third coordinate acquisition unit, configured to acquire third coordinate information of the manipulator corresponding to the target area; and
[0075] A mapping relationship acquisition unit, configured to obtain a preset coordinate mapping relationship based on the origin, the second coordinate information, and the third coordinate information.
[0076] Preferably, the preset scanning and translation rule includes a preset scanning and translation method, the first coordinate information includes the starting coordinate and the ending coordinate of each text line, and the scanning and translation test execution unit further includes:
[0077] A target line coordinate acquisition unit, configured to acquire the starting coordinate and the ending coordinate of a target line to be scanned and translated from the first coordinate information according to the preset scanning and translation method;
[0078] A coordinate mapping unit, configured to perform coordinate mapping on the starting coordinate and the ending coordinate of the target line to be scanned and translated according to the preset coordinate mapping relationship to obtain target motion coordinate information of the manipulator; and
[0079] A motion trajectory control unit, configured to control the motion trajectory of the manipulator through a programmable logic controller according to the target motion coordinate information.
[0080] Preferably, the preset scanning and translation rule includes a preset number of scanning and translation times, and the device further includes:
[0081] A keyword judgment unit, configured to judge whether a preset error keyword appears in the test log corresponding to the current scanning and translation;
[0082] An error scene retention unit, configured to stop scanning and translation and retain the error scene if the preset error keyword appears;
[0083] A scanning and translation times judgment unit, configured to judge whether the current scanning and translation times reach a preset scanning and translation times if no preset error keyword appears. If the preset scanning and translation times are reached, it controls the test result output unit to execute the step of outputting the test result according to the test log. If the preset scanning and translation times are not reached, it controls the scanning and translation test execution unit to execute the step of controlling the movement of the mechanical arm fixed with the scanning and translation pen through a programmable logic controller according to the first coordinate information of the text to be scanned and translated, the preset coordinate mapping relationship, and the preset scanning and translation rules, so that the scanning and translation pen scans the text to be scanned and translated to obtain the test log of the scanning and translation pen.
[0084] Preferably, the preset scanning and translation rules include a preset scanning speed. The scanning and translation test execution unit further includes a movement speed control unit, which is configured to control the movement speed of the mechanical arm through a programmable logic controller, so that the scanning and translation pen scans the text to be scanned and translated at the scanning speed.
[0085] Preferably, the preset scanning and translation rules include a preset scanning angle. The scanning and translation test execution unit further includes a movement attitude control unit, which is configured to control the movement attitude of the mechanical arm through a programmable logic controller, so that the scanning and translation pen scans the text to be scanned and translated at the scanning angle.
[0086] In the embodiment of the present invention, each unit of the automatic test device of the scanning and translation pen can be implemented by corresponding hardware or software units. Each unit can be an independent software or hardware unit, or can be integrated into a software or hardware unit, which is not used to limit the present invention here. The specific implementation manners of each unit of the automatic test device of the scanning and translation pen can refer to the description of the foregoing method embodiments, and will not be elaborated here.
[0087] Example 3:
[0088] Figure 3 The structure of the electronic device provided in Embodiment 3 of the present invention is shown. For the sake of convenience of description, only the parts related to the embodiment of the present invention are shown.
[0089] The electronic device 3 in the embodiment of the present invention includes a processor 30, a memory 31, and a computer program 32 stored in the memory 31 and executable on the processor 30. When the processor 30 executes the computer program 32, the steps in the foregoing method embodiments are implemented. For example, Figure 1B The steps S101 to S104 shown. Alternatively, when the processor 30 executes the computer program 32, the functions of each unit in the foregoing device embodiments are implemented. For example, Figure 2 The functions of the units 21 to 24 shown.
[0090] In an embodiment of the present invention, a first image of a file to be scanned and translated is obtained through a camera, first coordinate information of the text to be scanned and translated is obtained based on the first image, and based on the first coordinate information of the text to be scanned and translated, a preset coordinate mapping relationship, and a preset scanning and translation rule, a programmable logic controller is used to control the movement of a mechanical arm fixed with a scanning and translation pen, so that the scanning and translation pen scans the text to be scanned and translated, a test log of the scanning and translation pen is obtained, and a test result is output according to the test log. Thus, the automatic test of the scanning and translation pen is realized based on machine vision and a mechanical arm, the test efficiency of the scanning and translation pen is improved, and the test cost is reduced.
[0091] Example 4:
[0092] Figure 4 The structure of the automatic test system for a scanning and translation pen provided in Embodiment 4 of the present invention is shown. For the sake of convenience of description, only the parts related to the embodiments of the present invention are shown.
[0093] The automatic test system 4 for a scanning and translation pen in an embodiment of the present invention includes the electronic device 40 described in Embodiment 3, as well as a camera 41, a scanning and translation pen 42, and a programmable logic controller 43 that are respectively connected to the electronic device 40. The scanning and translation pen 42 is fixed on a mechanical arm 44, the mechanical arm 44 is connected to the programmable logic controller 43, and the electronic device 40 controls the movement of the mechanical arm 44 through the programmable logic controller 43 to drive the scanning and translation pen to complete an automatic test.
[0094] Example 5:
[0095] In an embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented. For example, Figure 1B the steps S101 to S104 shown. Alternatively, when the computer program is executed by a processor, the functions of each unit in the above device embodiments are implemented. For example, Figure 2 the functions of the units 21 to 24 shown.
[0096] In an embodiment of the present invention, a first image of a file to be scanned and translated is obtained through a camera, first coordinate information of the text to be scanned and translated is obtained based on the first image, and based on the first coordinate information of the text to be scanned and translated, a preset coordinate mapping relationship, and a preset scanning and translation rule, a programmable logic controller is used to control the movement of a mechanical arm fixed with a scanning and translation pen, so that the scanning and translation pen scans the text to be scanned and translated, a test log of the scanning and translation pen is obtained, and a test result is output according to the test log. Thus, the automatic test of the scanning and translation pen is realized based on machine vision and a mechanical arm, the test efficiency of the scanning and translation pen is improved, and the test cost is reduced.
[0097] The computer-readable storage medium according to an embodiment of the present invention may include any entity or device capable of carrying computer program code, a recording medium, for example, memories such as ROM / RAM, magnetic disks, optical disks, flash memories, etc.
[0098] The foregoing are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. An automatic testing method for a scanning and translating pen, characterized in that, The method includes the following steps: Obtain a first image of the file to be scanned and translated through a camera; Obtain first coordinate information of the text to be scanned and translated from the first image through a preset text recognition algorithm, where the first coordinate information includes the starting coordinate and the ending coordinate of each text line; According to the first coordinate information, a preset coordinate mapping relationship, and a preset scanning and translation rule, control the movement of a mechanical arm fixed with a scanning and translation pen through a programmable logic controller, so that the scanning and translation pen scans and translates the text to be scanned and translated, and obtain a test log of the scanning and translation pen; Output a test result according to the test log; Wherein, before the step of obtaining the first coordinate information of the text to be scanned and translated from the first image through a preset text recognition algorithm, the following steps are further included: Set the origin of the mechanical arm; Obtain a second image of a target file through the camera, and obtain second coordinate information of a target area in the second image; Obtain third coordinate information of the mechanical arm corresponding to the target area; Obtain the preset coordinate mapping relationship based on the origin, the second coordinate information, and the third coordinate information.
2. The method according to claim 1, characterized in that, The preset scanning and translation rule includes a preset scanning and translation method. According to the first coordinate information, the preset coordinate mapping relationship, and the preset scanning and translation rule, the step of controlling the movement of the mechanical arm fixed with the scanning and translation pen through the programmable logic controller includes: Obtain the starting coordinate and the ending coordinate of the target line to be scanned and translated from the first coordinate information according to the preset scanning and translation method; Perform coordinate mapping on the starting coordinate and the ending coordinate of the target line to be scanned and translated according to the preset coordinate mapping relationship, and obtain target movement coordinate information of the mechanical arm; Control the movement trajectory of the mechanical arm according to the target movement coordinate information through the programmable logic controller.
3. The method according to claim 1, wherein The preset scanning and translation rule includes a preset number of scanning and translation times. After the step of controlling the movement of the mechanical arm fixed with the scanning and translation pen through the programmable logic controller, the following steps are included: Judge whether a preset error keyword appears in the test log corresponding to the current scanning and translation; If the preset error keyword appears, stop scanning and translation and retain the error scene; If the preset error keyword does not appear, judge whether the current number of scanning and translation times reaches the preset number of scanning and translation times; If the preset number of scanning and translation times is reached, jump to the step of outputting a test result according to the test log; If the preset number of scanning and translation times is not reached, jump to the step of controlling the movement of the mechanical arm fixed with the scanning and translation pen through the programmable logic controller according to the first coordinate information, the preset coordinate mapping relationship, and the preset scanning and translation rule.
4. The method according to claim 1, wherein The preset scanning and translation rule includes a preset scanning speed. The step of controlling the movement of the mechanical arm fixed with the scanning and translation pen through the programmable logic controller, so that the scanning and translation pen scans and translates the text to be scanned and translated, further includes: Control the movement speed of the mechanical arm through the programmable logic controller, so that the scanning and translation pen scans and translates the text to be scanned and translated at the scanning speed.
5. The method according to claim 1, characterized in that, The preset scanning and translation rule includes a preset scanning angle, and the step of controlling the movement of the mechanical arm fixed with the scanning and translation pen by a programmable logic controller to enable the scanning and translation pen to scan and translate the text to be scanned and translated further includes: Controlling the movement posture of the mechanical arm by the programmable logic controller to enable the scanning and translation pen to scan and translate the text to be scanned and translated according to the scanning angle.
6. An automatic test device for a scanning and translating pen, characterized in that, The device includes: A first image acquisition unit, configured to acquire a first image of a file to be scanned and translated through a camera; A first coordinate acquisition unit, configured to acquire first coordinate information of the text to be scanned and translated from the first image through a preset character recognition algorithm, where the first coordinate information includes the starting coordinates and ending coordinates of each text line; A scanning and translation test execution unit, configured to control the movement of the mechanical arm fixed with the scanning and translation pen through a programmable logic controller according to the first coordinate information, a preset coordinate mapping relationship, and a preset scanning and translation rule, so that the scanning and translation pen scans and translates the text to be scanned and translated to obtain a test log of the scanning and translation pen; and A test result output unit, configured to output a test result according to the test log; The device further includes: An origin setting unit, configured to set the origin of the mechanical arm; A second coordinate acquisition unit, configured to acquire a second image of a target file through the camera and acquire second coordinate information of a target area in the second image; A third coordinate acquisition unit, configured to acquire third coordinate information of the mechanical arm corresponding to the target area; A mapping relationship acquisition unit, configured to obtain the preset coordinate mapping relationship based on the origin, the second coordinate information, and the third coordinate information.
7. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. An automatic test system for a scanning and translating pen, characterized in that, An electronic device including the one according to claim 7, as well as a camera, a scanning and translation pen, and a programmable logic controller respectively connected to the electronic device, where the scanning and translation pen is fixed to the mechanical arm, and the mechanical arm is connected to the programmable logic controller.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Test system and test method of coordinate accuracy of panel of reading machine
CN104913747A
Calibration method for position of robot arm
CN107175662A
Robot-based intelligent software test system and test method
CN112258161A