CN-116394665-B - Mobile printer positioning method, printing method, mobile printer and chip
Abstract
The application discloses a mobile printer positioning method, a printing method, a mobile printer and a chip, wherein the positioning method comprises the steps of S1, based on an image shot by a camera, the mobile printer obtains actual printing data and then enters S2, step S2, based on the actual printing data, the mobile printer matches the actual printing data with internal known data, if the matching is successful, the step S3 is entered, based on a matching result, the mobile printer solves the coordinate of the camera relative to a standard coordinate system, and then enters S4, and based on the coordinate of the camera relative to the standard coordinate system, the mobile printer solves the coordinate of the printer relative to the standard coordinate system according to a coordinate transformation function of the camera and the printer, so that the positioning of the mobile printer is realized, wherein the standard coordinate system is a coordinate system constructed based on the internal known data. The positioning method can realize high-precision positioning and meet the printing requirement of the mobile printer.
Inventors
- LAI QINWEI
Assignees
- 珠海一微半导体股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20230407
Claims (8)
- 1. The positioning method of the mobile printer is characterized by comprising the following steps of: step S1, based on the image shot by the camera, the printer is moved to obtain actual printing data, and then step S2 is carried out; Step S2, based on the actual printing data, the mobile printer matches the actual printing data with the internal known data, and if the matching is successful, the step S3 is entered; step S3, based on the matching result, the mobile printer solves the coordinates of the camera relative to the standard coordinate system, and then the step S4 is carried out; Step S4, based on the coordinates of the camera relative to the standard coordinate system, the mobile printer solves the coordinates of the printer head relative to the standard coordinate system according to the coordinate transformation function of the camera and the printer head, so that the mobile printer is positioned; Wherein the standard coordinate system is a coordinate system constructed based on internally known data; in the step S2, the method for determining whether the matching is successful by the mobile printer specifically includes: step S21, based on the corner detection algorithm, the mobile printer searches for the corner of the actual printing data, and then step S22 is carried out; Step S22, based on the corner points of the actual printing data, the mobile printer compares the correlation degree between the mobile printer and the corner points of the internal known data, if the correlation degree between a pair of corner points is larger than or equal to a preset value, the corner points are matched, and when the number of the matched corner points is larger than or equal to the preset number, the matching of the actual printing data and the internal known data is successful, wherein the corner points of the internal known data are obtained through a corner point detection algorithm; the step S22 specifically includes: Step S221, based on the coordinate of the last solved printing head relative to the standard coordinate system and the coordinate transformation function of the camera and the printing head, the mobile printer determines the range of the internal known data which can be shot by the camera under the standard coordinate system, then extracts the angular point of the internal known data in the range, and then proceeds to step S222; Step S222, based on a normalized cross-correlation algorithm, the mobile printer calculates the correlation degree between the corner points of the actual printing data and the corner points of the internal known data in the range in a traversing way; Step S223, based on the correlation calculation result, if the correlation between a pair of corners is larger than or equal to a preset value, the corners are matched, and when the number of the matched corners is larger than or equal to the preset number, the matching between the actual printing data and the internal known data is successful; the step S223 further comprises the step of removing outer points in the matched corner points by a mobile printer through solvePnP algorithm based on a correlation calculation result to obtain calibrated matched corner points, wherein the calibrated matched corner points comprise the matched corner points of actual printing data and the matched corner points of internal known data; in the step S3, the method for solving the coordinates of the camera relative to the standard coordinate system by the mobile printer specifically includes: step S31, based on the matching angular points of the actual printing data and the matching angular points of the internal known data, the mobile printer solves the homography matrix, and then the step S32 is entered; step S32, based on a singular value decomposition algorithm, the mobile printer decomposes the homography matrix to obtain a rotation matrix and a translation vector, and then the step S33 is performed, wherein the rotation matrix and the translation vector are used for converting one coordinate from a camera coordinate system to a standard coordinate system or converting one coordinate from the standard coordinate system to the camera coordinate system; And step S33, based on the rotation matrix and the translation vector, the mobile printer converts the coordinate of the camera from a camera coordinate system to a standard coordinate system, wherein the camera coordinate system is a coordinate system constructed based on the camera, and the coordinate of the camera is the origin of the camera coordinate system.
- 2. The method according to claim 1, wherein before executing the step S1, the mobile printer determines whether the actual print data can be acquired from the image captured by the camera, performs the positioning by the optical flow method if the actual print data cannot be acquired, and proceeds to the step S1 if the actual print data can be acquired.
- 3. The method according to claim 2, wherein in the step S22, when the number of matched corner points is smaller than the preset number, the matching between the actual print data and the internal known data is unsuccessful, and the mobile printer performs positioning by the optical flow method.
- 4. The method according to claim 1, wherein in the step S4, the method for obtaining the coordinate transformation function of the camera and the print head specifically includes: Step S41, printing a second checkerboard by a mobile printer based on the first checkerboard, calculating the pose of a camera relative to the first checkerboard according to the coordinates of the corner relative to the first checkerboard when printing the corner, marking the pose as the first pose, and then entering step S42, wherein the first checkerboard is in the shooting range of the mobile printer, and the coordinates of the corner in the first checkerboard are known; step S42, when the mobile camera can acquire a second checkerboard from the image shot by the camera, calculating the pose of the camera relative to the second checkerboard based on the angular point coordinates of the second checkerboard, marking the pose as a second pose, and then entering step S43; Step S43, based on the first pose and the second pose, the mobile printer converts the first pose and the second pose into a camera coordinate system to obtain the pose of the second checkerboard relative to the first checkerboard, and marks the pose as a third pose, and then the step S44 is performed, wherein the camera coordinate system is a coordinate system constructed based on a camera; Step S44, based on the first pose and the third pose, the mobile printer solves the product of the inverse of the first pose and the third pose, and a coordinate transformation function of the camera and the printing head is obtained.
- 5. A mobile printer printing method, characterized in that the printing method includes the mobile printer positioning method according to any one of claims 1 to 4, the printing method comprising: Moving the printer while continuously positioning the printing head, and then printing data at the coordinates based on the coordinates of the printing head relative to a standard coordinate system; When the printing of the current scanning line is completed, the mobile printer moves to the next scanning line, and then continues to execute the printing operation until the printing stopping instruction is triggered; the scanning line is a virtual walking straight line generated by the mobile printer during printing.
- 6. A mobile printer is characterized in that the mobile printer is used for realizing the mobile printer positioning method according to any one of claims 1 to 4 or realizing the mobile printer printing method according to claim 5, and comprises a printer body, a control module, a memory, a printing head, a camera and a driving wheel, The memory is arranged inside the printer body and is used for storing known data inside; The printing head is arranged below the printer body and is used for printing actual printing data according to the internal known data under the control of the control module; the camera is arranged on the side face of the printer body and is used for shooting actual printing data; the driving wheel is arranged below the printer body and used for driving the printer body to move; the control module is arranged inside the printer body, is respectively connected with the memory, the printing head, the camera and the driving wheel and is used for positioning the printing head according to the internal known data and the actual printing data.
- 7. The mobile printer of claim 6, comprising two cameras disposed on two different sides of the printer body, wherein one camera is capable of capturing actual print data on a previous scan line and the other camera is capable of capturing actual print data on a current scan line, wherein the scan line is a virtual straight line of travel of the mobile printer when printing.
- 8. A chip storing computer program code, characterized in that the computer program code when executed implements the steps of the mobile printer positioning method according to any one of claims 1 to 4 or the steps of a mobile printer printing method according to claim 5.
Description
Mobile printer positioning method, printing method, mobile printer and chip Technical Field The application relates to the field of mobile printers, in particular to a mobile printer positioning method, a printing method, a mobile printer and a chip. Background The printer is a common tool in families or offices, people often encounter the printing when going out or traveling, and the traditional printer cannot be carried with the user due to the large size. The traditional printer has the defects that the printer is not moved but the paper moves in the paper feeding direction, so the volume is large, the power supply is needed, and the printer cannot be carried about. The movable printer can enable the printing head to move on the paper to finish printing under the condition that the paper is not moved, and has the advantages of small size and portability. But the printing accuracy of the mobile printer is too low to achieve an effect comparable to that of the conventional printer. Currently, there is a technical solution for implementing positioning of a handheld printer based on vision, such as CN113112545A, a positioning method of a handheld mobile printing device based on computer vision, which uses a monocular camera to implement positioning of a printer, but only needs to use an external mark pattern. The scheme can only realize centimeter-level positioning, and the positioning precision can possibly cause the problems of dislocation and the like of printing contents, so that the printing requirements of a mobile printer can not be met obviously. Disclosure of Invention The application provides a mobile printer positioning method, a printing method, a mobile printer and a chip, and the specific technical scheme is as follows: The positioning method of the mobile printer specifically comprises the following steps of S1, obtaining actual printing data by the mobile printer based on an image shot by a camera, then entering into S2, matching the actual printing data with internal known data by the mobile printer based on the actual printing data, entering into S3 if the matching is successful, solving the coordinate of the camera relative to a standard coordinate system by the mobile printer based on a matching result, then entering into S4, and solving the coordinate of the printer relative to the standard coordinate system by the mobile printer based on the coordinate of the camera relative to the standard coordinate system based on the coordinate transformation function of the camera and the printer to achieve positioning of the mobile printer, wherein the standard coordinate system is a coordinate system constructed based on the internal known data. According to the positioning method of the mobile printer, the coordinates of the camera relative to the standard coordinate system are obtained by matching the actual printing data on the printing medium with the internal known data stored in the mobile printer. Since the standard coordinate system is constructed based on the internal known data, the coordinates of the camera under the coordinate system can truly reflect the position of the camera. Furthermore, the position of the printing head can be truly reflected according to the coordinates of the printing head relative to the standard coordinate system, which are solved by the coordinate transformation function of the camera and the printing head, so that the printing head can accurately print data at the current coordinates, namely, the positioning of the mobile printer is accurately realized, and the printing quality is greatly improved. Further, before executing the step S1, the mobile printer determines whether the actual print data can be acquired from the image captured by the camera, if the actual print data cannot be acquired, the mobile printer performs positioning by an optical flow method, and if the actual print data can be acquired, the mobile printer proceeds to the step S1. Further, in the step S2, the method for judging whether the matching is successful by the mobile printer specifically comprises the step S21 of searching for the corner points of the actual printing data by the mobile printer based on the corner point detection algorithm, and then entering the step S22, the step S22 of comparing the correlation degree between the mobile printer and the corner points of the internal known data by the mobile printer based on the corner points of the actual printing data, if the correlation degree between a pair of corner points is larger than or equal to a preset value, the corner points are matched, and when the number of the matched corner points is larger than or equal to the preset number, the matching between the actual printing data and the internal known data is successful, wherein the corner points of the internal known data are obtained by the corner point detection algorithm. And performing corner matching on the actual printing data and the internal known data to accurate