Mobile printer positioning method, printing method, mobile printer and chip
By matching actual printing data with known internal data in a mobile printer, a standard coordinate system is constructed, and the coordinate transformation function between the camera and the print head is used to solve the problems of low accuracy in traditional mobile printers and reliance on external markers for existing visual positioning, thus achieving high-precision printing positioning and improved quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AMICRO SEMICONDUCTOR CO LTD
- Filing Date
- 2023-04-07
- Publication Date
- 2026-05-05
AI Technical Summary
Traditional mobile printers have low printing accuracy and cannot compare with traditional printers. Furthermore, existing vision-based positioning technologies require external marking patterns, resulting in insufficient positioning accuracy and potential misalignment of printed content.
By matching the actual printed data on the printing medium with the internal known data stored in the mobile printer, a standard coordinate system is constructed. The coordinate transformation function of the camera and the print head is used to achieve precise positioning of the camera and the print head. Corner detection, normalized cross-correlation algorithm and optical flow method are used to improve positioning accuracy.
It achieves high-precision positioning of the mobile printer, enabling the print head to accurately print the data at the current coordinates, thus improving print quality and accuracy.
Smart Images

Figure CN116394665B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of mobile printers, specifically to a mobile printer positioning method, a printing method, a mobile printer, and a chip. Background Technology
[0002] Printers are common tools in homes and offices, and people often need to print when they are out and about or traveling. However, traditional printers are bulky and cannot be carried around. Traditional printers move the paper while the printer itself remains stationary, resulting in a large size and the need for a power source, making them unsuitable for portability. Portable printers, on the other hand, allow the print head to move across the paper without moving the paper itself, offering advantages such as small size and portability. However, portable printers have lower printing accuracy and cannot achieve the same results as traditional printers.
[0003] Currently, there are vision-based solutions for handheld printer positioning, such as CN113112545A - a computer vision-based positioning method for handheld mobile printing devices. This solution uses a monocular camera to position the printer, but it requires external marker patterns. This solution can only achieve centimeter-level positioning, and such positioning accuracy may lead to problems such as misalignment of printed content, which clearly cannot meet the printing needs of mobile printers. Summary of the Invention
[0004] This application provides a mobile printer positioning method, a printing method, a mobile printer, and a chip, the specific technical solution of which is as follows:
[0005] A mobile printer positioning method includes the following steps: Step S1, based on an image captured by a camera, the mobile printer obtains actual printing data, and then proceeds to Step S2; Step S2, based on the actual printing data, the mobile printer matches it with internally known data. If the match is successful, proceed to Step S3; Step S3, based on the matching result, the mobile printer calculates the coordinates of the camera relative to a standard coordinate system, and then proceeds to Step S4; Step S4, based on the coordinates of the camera relative to the standard coordinate system, the mobile printer calculates the coordinates of the print head relative to the standard coordinate system according to the coordinate transformation function between the camera and the print head, thereby achieving the positioning of the mobile printer; wherein, the standard coordinate system is a coordinate system constructed based on internally known data.
[0006] The mobile printer positioning method described in this application obtains the camera's coordinates relative to a standard coordinate system by matching the actual printed 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 camera's coordinates in this coordinate system accurately reflect the camera's position. Furthermore, the print head's coordinates relative to the standard coordinate system, obtained from the coordinate transformation function between the camera and the print head, also accurately reflect the print head's position, enabling the print head to accurately print the data at its current coordinates. This precisely achieves the mobile printer's positioning and significantly improves print quality.
[0007] Furthermore, before performing step S1, the mobile printer determines whether it can obtain actual printing data from the image captured by the camera. If it cannot obtain actual printing data, it uses optical flow to perform positioning. If it can obtain actual printing data, it proceeds to step S1.
[0008] Further, in step S2, the method for the mobile printer to determine whether the matching is successful specifically includes: step S21, based on the corner detection algorithm, the mobile printer searches for corners in the actual printed data, and then proceeds to step S22; step S22, based on the corners of the actual printed data, the mobile printer compares the correlation between them and the corners of the internally known data. If the correlation between a pair of corners is greater than or equal to a preset value, then the pair of corners matches. When the number of matched corners is greater than or equal to a preset number, the actual printed data and the internally known data are successfully matched. The corners of the internally known data are obtained through the corner detection algorithm. Corner matching is performed on the actual printed data and the internally known data to accurately find the corresponding position of the actual printed data within the internally known data.
[0009] Further, step S22 specifically includes: Step S221, based on the most recently solved coordinates of the print head relative to the standard coordinate system and the coordinate transformation function between the camera and the print head, moving the printer to determine the range of internal known data that the camera can capture in the standard coordinate system, then extracting the corner points of the internal known data within the range, and then proceeding to step S222; Step S222, based on the normalized cross-correlation algorithm, moving the printer to traverse and calculate the correlation between the corner points of the actual printed data and the corner points of the internal known data within the range; Step S223, based on the correlation calculation results, if the correlation between a pair of corner points is greater than or equal to a preset value, then the pair of corner points are matched; when the number of matched corner points is greater than or equal to a preset number, the actual printed data and the internal known data are successfully matched. Determining the range of internal known data that the camera can capture in the standard coordinate system can greatly reduce the computational power consumption of global search and improve computational efficiency.
[0010] Furthermore, step S223 also includes: based on the correlation calculation results, the mobile printer removes external points from the matching corner points using the solvePnP algorithm to obtain calibrated matching corner points; wherein, the calibrated matching corner points include matching corner points of the actual printed data and matching corner points of the internal known data. This removes abnormal points and reduces subsequent calculation errors.
[0011] Furthermore, in step S22, when the number of matching corner points is less than a preset number, the actual printed data and the internal known data fail to match, and the mobile printer is positioned using optical flow. This improves the positioning robustness of the mobile printer.
[0012] Further, in step S3, the method for the mobile printer to solve for the camera's coordinates relative to the standard coordinate system specifically includes: Step S31, based on the matching corner points of the actual printed data and the matching corner points of the internal known data, the mobile printer solves for the homography matrix, and then proceeds to step S32; Step S32, based on the singular value decomposition algorithm, the mobile printer decomposes the homography matrix to obtain the rotation matrix and translation vector, and then proceeds to step S33; wherein, the rotation matrix and translation vector are used to transform a coordinate from the camera coordinate system to the standard coordinate system, or to transform a coordinate from the standard coordinate system to the camera coordinate system; Step S33, based on the rotation matrix and translation vector, the mobile printer transforms the camera's coordinates from the camera coordinate system to the standard coordinate system; wherein, the camera coordinate system is a coordinate system constructed based on the camera, and the camera's coordinates are the origin of the camera coordinate system. Obtaining the camera's coordinates in the internal known data lays the groundwork for accurately obtaining the print head's coordinates subsequently.
[0013] Further, in step S4, the method for obtaining the coordinate transformation function between the camera and the print head specifically includes: Step S41, based on the first checkerboard grid, the mobile printer prints the second checkerboard grid, and simultaneously calculates the camera's pose relative to the first checkerboard grid based on the coordinates of the corner point relative to the first checkerboard grid when printing, denoted as the first pose, and then proceeds to step S42; wherein, the first checkerboard grid is within the shooting range of the mobile printer, and the coordinates of the corner points in the first checkerboard grid are known; Step S42, when the mobile printer can obtain the second checkerboard grid from the image captured by the camera, based on the second checkerboard grid... The coordinates of the corner points of the first and second chessboard grids are used to calculate the camera's pose relative to the first grid, denoted as the second pose. Then, proceed to step S43. In step S43, based on the first and second poses, the printer is moved to transform the first and second poses into the camera coordinate system, obtaining the pose of the second chessboard grid relative to the first chessboard grid, denoted as the third pose. Then, proceed to step S44. Here, the camera coordinate system is a coordinate system constructed based on the camera. In step S44, based on the first and third poses, the printer is moved to solve for the product of the inverse of the first pose and the third pose, obtaining the coordinate transformation function between the camera and the print head. The chessboard-based calibration method can quickly and accurately obtain the function that transforms camera coordinates into print head coordinates.
[0014] A mobile printer printing method includes the aforementioned mobile printer positioning method, comprising: the mobile printer continuously positioning the print head while moving, and then printing data at the coordinates of the print head relative to a standard coordinate system; upon completion of printing the current scan line, the mobile printer moves to the next scan line and continues printing until a stop printing command is triggered; wherein, the scan line is a virtual straight line drawn by the mobile printer during printing.
[0015] A mobile printer is disclosed, which is used to implement the mobile printer positioning method or the mobile printer printing method. The mobile printer includes a printer body, a control module, a memory, a print head, a camera, and drive wheels. The memory is located inside the printer body and is used to store known internal data. The print head is located below the printer body and is used to print actual print data based on the known internal data under the control of the control module. The camera is located on the side of the printer body and is used to capture the actual print data. The drive wheels are located below the printer body and are used to move the printer body. The control module is located inside the printer body and is connected to the memory, print head, camera, and drive wheels respectively, and is used to position the print head based on the known internal data and the actual print data.
[0016] The mobile printer described in this application acquires actual printing data on the printing medium through a camera, and then matches this data with internally known data in a memory to obtain the camera's coordinates relative to a standard coordinate system. Since the standard coordinate system is constructed based on the internally known data, the camera's coordinates in this system accurately reflect its position. Furthermore, the coordinates of the print head relative to the standard coordinate system, obtained from the coordinate transformation function between the camera and the print head, also accurately reflect the print head's position, enabling the print head to accurately print the data at its current coordinates. This precise positioning of the mobile printer significantly improves print quality.
[0017] Furthermore, the mobile printer includes two cameras positioned on two different sides of the printer body. One camera captures the actual print data along the previous scan line, while the other captures the actual print data along the current scan line. The scan line is a virtual straight line drawn by the mobile printer during printing. The two cameras can acquire more actual print data from different angles, improving the success rate and accuracy of positioning.
[0018] A chip is disclosed, which stores computer program code that, when executed, implements the steps of the mobile printer positioning method or the steps of the mobile printer printing method. The chip described in this application enables a mobile printer equipped with this chip to achieve high-precision positioning, meeting the printing needs of the mobile printer. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating a mobile printer positioning method according to one embodiment of this application.
[0020] Figure 2 This is a front view schematic diagram of a mobile printer according to one embodiment of this application. Implementation
[0021] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0022] It should be understood that, when used in this application, the term "comprising" indicates the presence of the described feature, integral, step, operation, element, and / or component, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof. It should also be understood that, as used in this application, the term "and / or" refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0023] As used in this application, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [the described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [the described condition or event] is detected," or "in response to detection of [the described condition or event]."
[0024] Furthermore, in the description of this application, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance. References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0025] Printers are common tools in homes and offices, and people often need to print when they are out and about or traveling. However, traditional printers are bulky and cannot be carried around. Traditional printers move the paper while the printer itself remains stationary, resulting in a large size and the need for a power source, making them unsuitable for portability. Portable printers, on the other hand, allow the print head to move across the paper without moving the paper itself, offering advantages such as small size and portability. However, portable printers have lower printing accuracy and cannot achieve the same results as traditional printers.
[0026] Currently, there are vision-based solutions for handheld printer positioning, such as CN113112545A - a computer vision-based positioning method for handheld mobile printing devices. This solution uses a monocular camera to position the printer, but it requires external marker patterns. This solution can only achieve centimeter-level positioning, and such positioning accuracy may lead to problems such as misalignment of printed content, which clearly cannot meet the printing needs of mobile printers.
[0027] To address the aforementioned issues, this application provides a mobile printer positioning method. By matching the actual printed data on the printing medium with the internal known data stored in the mobile printer, the coordinates of the camera relative to a standard coordinate system are obtained. Since the standard coordinate system is constructed based on the internal known data, the camera's coordinates in this system accurately reflect its position. Furthermore, the coordinates of the print head relative to the standard coordinate system, obtained from the coordinate transformation function between the camera and the print head, also accurately reflect the print head's position. This allows the print head to accurately print the data at its current coordinates, thus precisely achieving the mobile printer's positioning and significantly improving print quality.
[0028] like Figure 1 As shown, the positioning method specifically includes the following steps:
[0029] Step S1: Based on the image captured by the camera, move the printer to obtain the actual print data, and then proceed to step S2;
[0030] Step S2: Based on the actual printed data, move the printer to match it with the known internal data. If the match is successful, proceed to step S3.
[0031] Step S3: Based on the matching results, move the printer to solve for the coordinates of the camera relative to the standard coordinate system, and then proceed to step S4;
[0032] Step S4: Based on the coordinates of the camera relative to the standard coordinate system, the mobile printer solves the coordinates of the print head relative to the standard coordinate system according to the coordinate transformation function between the camera and the print head, thereby realizing the positioning of the mobile printer; wherein, the standard coordinate system is a coordinate system constructed based on internal known data.
[0033] The mobile printer described in this application is a self-propelled printing robot. Before printing, the data to be printed is sent to the mobile printer, which is then placed on a flat printing surface to automatically begin printing. For example, to print a document, the document is sent to the mobile printer and stored, and an A4 sheet of paper is prepared and placed on a horizontal surface. Next, the mobile printer is manually placed on one corner of the A4 sheet and aligned with the edge. Following general printing logic, i.e., printing from top to bottom and from left to right, the mobile printer of this application is pre-set with the following printing path: The mobile printer starts from the upper left corner of the A4 sheet, moves to the right and prints until it reaches the upper right corner of the A4 sheet, completing the printing of the first scan line. Then, the mobile printer rotates 90 degrees clockwise, moves to the second scan line, rotates 90 degrees counterclockwise to return to the starting position, and retreats a distance equal to the width of one A4 sheet back to the left. At this point, it moves to the right and prints until it reaches the right side of the A4 sheet, completing the printing of the second scan line. This process continues, and the mobile printer can move and print on the paper autonomously until the printing end condition is triggered. It should be noted that a scan line is a virtual straight line generated by the mobile printer during printing, and the first scan line is equivalent to the first line. After receiving the document, the mobile printer performs preprocessing to generate the scan line, in order to know the basic information required for the printing process, such as where the printing starts, where to move to the next line, and where to trigger the printing end condition.
[0034] In one embodiment, the mobile printer may also print according to a right-to-left, top-to-bottom printing logic, or a bow-shaped printing logic that first prints from left to right and then from right to left. This application does not specifically limit the printing path of the mobile printer. Similarly, the method by which the mobile printer moves from the first scan line to the second scan line and then to other scan lines is not specifically limited.
[0035] In one implementation, before performing step S1, the mobile printer determines whether actual print data can be obtained from the image captured by the camera. If actual print data cannot be obtained, positioning is performed using optical flow. If actual print data can be obtained, then step S1 is performed. The mobile printer determines whether actual print data can be obtained from the image captured by the camera using an image detection method. Image detection is existing technology and will not be elaborated upon here.
[0036] It should be noted that the orientation of the mobile printer is defined according to the printing logic from top to bottom and left to right: assuming the mobile printer is printing on A4 paper, from a top-down perspective, the direction of movement is defined as the front of the mobile printer, the opposite side is defined as the rear, the top is defined as the left, and the bottom is defined as the right. The camera is positioned on the left side of the mobile printer. Therefore, when the mobile printer is on the first scan line, it cannot capture the actual printed data, thus requiring the use of optical flow for assisted positioning. The optical flow method is existing technology and will not be elaborated upon here. When the mobile printer moves to the second scan line, its camera can capture the data printed on the first scan line; that is, the mobile printer can capture the data from the previous scan line while on the current scan line. Depending on the field of view of different cameras and the camera's installation angle, the mobile printer may also capture data from the first two, three, or even multiple scan lines.
[0037] In one implementation, the method for determining whether the matching is successful in step S2 specifically includes: step S21, based on the corner detection algorithm, the mobile printer searches for corners in the actual printed data, and then proceeds to step S22; step S22, based on the corners of the actual printed data, the mobile printer compares the correlation between them and the corners of the internal known data. If the correlation between a pair of corners is greater than or equal to a preset value, then the pair of corners is matched. When the number of matched corners is greater than or equal to a preset number, the actual printed data and the internal known data are successfully matched; wherein, the corners of the internal known data are obtained through the corner detection algorithm.
[0038] Preferably, the mobile printer searches for corners in the actual printed data using the Harris corner detection algorithm. The basic idea of the Harris corner detection algorithm is to slide a fixed window across the image in any direction, comparing the changes in pixel grayscale before and after the slide. If there is a significant change in grayscale regardless of the direction of the slide, then a corner is considered to exist within that window. Generally, corners exist at the intersection of two or more patterns with different colors. It should be noted that the Harris corner detection algorithm returns the coordinates of the corner and the pixel values surrounding it. Based on the pre-calibrated intrinsic parameters of the camera and the coordinate transformation function between the camera and the print head, the coordinates of the corners in the actual printed data relative to the camera coordinate system can be obtained. The coordinates of the corners in the internally known data relative to the standard coordinate system are known. The intrinsic parameters of the camera refer to parameters such as focal length and distortion; the calibration of these intrinsic parameters is existing technology and will not be elaborated here. The coordinate transformation function between the camera and the print head represents the spatial geometric relationship between the camera and the print head.
[0039] Understandably, before printing begins, the user transmits the data to be printed to the mobile printer. For example, if the user needs to print a document, the document is transmitted to the mobile printer, which then stores the document in its memory, obtaining the internal known data. Subsequently, the mobile printer establishes a standard coordinate system based on the user-selected paper size (A4 by default), projects the internal known data into this system, and uses the Harris corner detection algorithm to search for the corner points of the internal known data. Clearly, the coordinates of each corner point relative to the standard coordinate system are known, essentially predetermined values. If the coordinates of the print head relative to the standard coordinate system can be accurately obtained, then the data at those coordinates can be printed precisely.
[0040] In one implementation, step S22 further includes: Step S221, based on the most recently solved coordinates of the print head relative to the standard coordinate system and the coordinate transformation function between the camera and the print head, the mobile printer determines the range of internal known data that the camera can capture in the standard coordinate system, then extracts the corner points of the internal known data within the range, and then proceeds to step S222; Step S222, based on a normalized cross-correlation algorithm, the mobile printer iterates and calculates the correlation between the corner points of the actual printed data and the corner points of the internal known data within the range; Step S223, based on the correlation calculation results, if the correlation between a pair of corner points is greater than or equal to a preset value, then the pair of corner points are matched; when the number of matched corner points is greater than or equal to a preset number, the actual printed data and the internal known data are successfully matched. The mobile printer estimates the range of internal known data that the camera can capture in the standard coordinate system based on the camera's coordinates relative to the standard coordinate system and the camera's field of view, thereby reducing the matching range and significantly reducing the computational power consumption of the global search, thus improving computational efficiency. It is easy to understand that different types of cameras have different fields of view, and the estimated shooting range will also be different, which will not be elaborated further. The normalized cross-correlation algorithm is a classic algorithm for similarity measurement or matching degree representation. It calculates the correlation between corners based on the coordinates of the corners returned by the Harris corner detection algorithm and the pixel values around the corners. The specific process will not be elaborated here.
[0041] In one implementation, step S223 further includes: based on the correlation calculation results, the mobile printer removes outliers from the matching corner points using the solvePnP algorithm to obtain calibrated matching corner points; wherein, the calibrated matching corner points include matching corner points from the actual printed data and matching corner points from the internal known data. Outliers refer to abnormal or unsuitable points. The solvePnP algorithm refers to the relationship between three-dimensional physical space and projection; based on the principle of majority rule, if most points conform to a certain spatial relationship, then a small number of non-conforming points can be discarded. Preferably, the P3P algorithm is used to remove outliers to reduce subsequent calculation errors.
[0042] In one implementation, in step S22, when the number of matching corner points is less than a preset number, the actual printed data and the internal known data fail to match, and the moving printer is positioned using optical flow. If the number of matching corner points is too small, it cannot guarantee correct positioning; therefore, optical flow is used for positioning to improve robustness.
[0043] In one implementation, step S3, the method for the mobile printer to solve for the camera's coordinates relative to the standard coordinate system specifically includes: Step S31, based on the matching corner points of the actual printed data and the matching corner points of the internal known data, the mobile printer solves for the homography matrix, and then proceeds to step S32; Step S32, based on the singular value decomposition algorithm, the mobile printer decomposes the homography matrix to obtain the rotation matrix and translation vector, and then proceeds to step S33; wherein, the rotation matrix and translation vector are used to transform a coordinate from the camera coordinate system to the standard coordinate system, or to transform a coordinate from the standard coordinate system to the camera coordinate system; Step S33, based on the rotation matrix and translation vector, the mobile printer transforms the camera's coordinates from the camera coordinate system to the standard coordinate system; wherein, the camera coordinate system is a coordinate system constructed based on the camera, and the camera's coordinates are the origin of the camera coordinate system. The homography matrix represents the projection relationship between two planes, which is prior art and will not be elaborated further.
[0044] In one implementation, the method for obtaining the coordinate transformation function between the camera and the print head in step S4 specifically includes: Step S41, based on the first checkerboard grid, the mobile printer prints the second checkerboard grid, and simultaneously calculates the pose of the camera relative to the first checkerboard grid based on the coordinates of the corner point relative to the first checkerboard grid when printing the corner point, denoted as the first pose M1, and then proceeds to step S42; wherein, the first checkerboard grid is within the shooting range of the mobile printer, and the coordinates of the corner points in the first checkerboard grid are known; Step S42, when the mobile printer can obtain the coordinate transformation function between the camera and the print head from the image captured by the camera... When acquiring the second chessboard grid, the camera pose relative to the second chessboard grid is calculated based on the corner coordinates of the second chessboard grid, and denoted as the second pose. Then, proceed to step S43. In step S43, based on the first and second poses, move the printer to transform the first and second poses into the camera coordinate system to obtain the pose of the second chessboard grid relative to the first chessboard grid, denoted as the third pose M2. Then, proceed to step S44. Here, the camera coordinate system is a coordinate system constructed based on the camera. In step S44, based on the first and third poses, move the printer to solve for the inverse M1 of the first pose. -1 The product of the third pose M2 and the coordinate transformation function Z = M2·M1 between the camera and the print head is obtained. -1 It should be noted that the checkerboard is a commonly used calibration tool. The size of each cell in the checkerboard, the coordinate system of the checkerboard, and the coordinates of the corner points in the checkerboard are all known. Based on this known information, the pose of the camera relative to the first and second checkerboards can be calculated, which will not be elaborated further.
[0045] This application provides a mobile printer printing method, which includes the aforementioned mobile printer positioning method. The printing method includes: the mobile printer continuously positions the print head while moving, and then prints data at the coordinates relative to a standard coordinate system. Upon completion of printing the current scan line, the mobile printer moves to the next scan line and continues printing until a stop printing command is triggered. The scan line is a virtual straight line drawn by the mobile printer during printing. The stop printing command includes, but is not limited to, the mobile printer completing the printing of the last scan line, the mobile printer detecting that it has exceeded the range of the standard coordinate system, or the mobile printer detecting that it has completed printing the last piece of known internal data. In one embodiment, the image resolution is 640x480, and the resolution for edge alignment of the image printed by the mobile printer is 0.5 pixels, corresponding to an accuracy better than 0.1mm, achieving precise print head positioning, thereby ensuring that the content printed by the mobile printer is neat, aligned, and misaligned.
[0046] like Figure 2As shown, this application provides a mobile printer, which includes a printer body 101, a control module, a memory, a printhead 103, a camera 104, and a drive wheel 102. The memory is located inside the printer body 101 and is used to store known internal data. The printhead 103 is located below the printer body 101 and is used to print actual print data based on the known internal data under the control of the control module. The camera 104 is located on the side of the printer body 101 and is used to capture the actual print data. The drive wheel 102 is located below the printer body 101 and is used to move the printer body 101. The control module is located inside the printer body 101 and is connected to the memory, printhead 103, camera 104, and drive wheel 102 respectively, and is used to position the printhead 103 based on the known internal data and the actual print data.
[0047] Figure 2 This displays a front view of the mobile printer, with the side of the mobile printer that is moving forward designated as the front (i.e., the front side). Figure 2 (Category A). With the front of the mobile printer facing the same direction, position its left side (…). Figure 2 The middle label (B) is set as the left and right sides ( Figure 2 The side marked C is set to the right, and the side opposite the front is set to the rear. Camera 104 is located on the left side of the mobile printer. Figure 2 (marked as B in the middle).
[0048] In one implementation, the mobile printer includes two cameras positioned on two different sides of the printer body 101. One camera, 104, is located on the left side of the mobile printer and can capture the actual print data on the previous scan line. The other camera is located at the rear of the mobile printer and can capture the actual print data on the current scan line. The scan line is a virtual straight line drawn by the mobile printer during printing. The two cameras can acquire more actual print data from different angles, improving the success rate and accuracy of positioning. In this embodiment, because the camera is located at the rear of the mobile printer, the mobile printer can capture the actual print data on the first scan line. That is, on the first scan line, the mobile printer can use the positioning method described in this application for positioning, improving the positioning accuracy of the mobile printer. Of course, when the number of matching corner points is less than a preset number, i.e., when the actual print data and the internal known data do not match successfully, the mobile printer still uses the optical flow method for positioning.
[0049] The mobile printer described in this application acquires actual printing data on the printing medium through a camera, and then matches this data with internally known data in a memory to obtain the camera's coordinates relative to a standard coordinate system. Since the standard coordinate system is constructed based on the internally known data, the camera's coordinates in this system accurately reflect its position. Furthermore, the coordinates of the print head relative to the standard coordinate system, obtained from the coordinate transformation function between the camera and the print head, also accurately reflect the print head's position, enabling the print head to accurately print the data at its current coordinates. This precise positioning of the mobile printer significantly improves print quality.
[0050] This application also provides a chip that stores computer program code and can be disposed in the aforementioned mobile printer. When the computer program code is executed, it implements the steps of the mobile printer positioning method. Exemplarily, the computer program code can be divided into one or more modules / units, which are stored in the chip and executed by the chip to complete this application. The one or more modules / units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program code in the mobile printer.
[0051] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. References to memory, storage, databases, or other media used in the embodiments provided in this application can all include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable memory (PROM), electrically programmable memory (DPROM), electrically erasable programmable memory (DDPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory.
[0052] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0053] The above embodiments are merely illustrative of several implementations of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these modifications and improvements all fall within the protection scope of this application.
Claims
1. A method for positioning a mobile printer, characterized in that, The positioning method specifically includes the following steps: Step S1: Based on the image captured by the camera, move the printer to obtain the actual print data, and then proceed to step S2; Step S2: Based on the actual printed data, move the printer to match it with the known internal data. If the match is successful, proceed to step S3. Step S3: Based on the matching results, move the printer to solve for the coordinates of the camera relative to the standard coordinate system, and then proceed to step S4; Step S4: Based on the coordinates of the camera relative to the standard coordinate system, the mobile printer calculates the coordinates of the print head relative to the standard coordinate system according to the coordinate transformation function between the camera and the print head, thereby achieving the positioning of the mobile printer. The standard coordinate system is a coordinate system constructed based on known internal data; Specifically, in step S2, the method for the mobile printer to determine whether the matching is successful includes: Step S21: Based on the corner detection algorithm, move the printer to search for corners in the actual printed data, and then proceed to step S22; Step S22: Based on the corner points of the actual printed data, move the printer to compare the correlation between the actual printed data and the corner points of the internal known data. If the correlation between a pair of corner points is greater than or equal to a preset value, then the pair of corner points are matched. When the number of matched corner points is greater than or equal to a preset number, the actual printed data and the internal known data are successfully matched. The corner points of the internal known data are obtained through a corner point detection algorithm. Specifically, step S22 includes: Step S221: Based on the most recently solved coordinates of the print head relative to the standard coordinate system and the coordinate transformation function between the camera and the print head, move the printer to determine the range of known internal data that the camera can capture in the standard coordinate system, then extract the corner points of the known internal data in the range, and then proceed to step S222. Step S222: Based on the normalized cross-correlation algorithm, the mobile printer traverses and calculates the correlation between the corner points of the actual printed data and the corner points of the known data within the range; Step S223: Based on the correlation calculation results, if the correlation between a pair of corner points is greater than or equal to a preset value, then the corner points are matched. When the number of matched corner points is greater than or equal to a preset number, the actual printed data and the internal known data are successfully matched. Step S223 further includes: based on the correlation calculation results, the mobile printer removes the outer points in the matching corner points using the solvePnP algorithm to obtain calibrated matching corner points; wherein, the calibrated matching corner points include matching corner points of the actual printed data and matching corner points of the internal known data; Specifically, in step S3, the method for the mobile printer to solve for the coordinates of the camera relative to the standard coordinate system includes: Step S31: Based on the matching corner points of the actual printed data and the matching corner points of the internal known data, move the printer to solve the homography matrix, and then proceed to step S32; Step S32: Based on the singular value decomposition algorithm, the mobile printer decomposes the homography matrix to obtain the rotation matrix and translation vector, and then proceeds to step S33; wherein, the rotation matrix and translation vector are used to transform a coordinate from the camera coordinate system to the standard coordinate system, or to transform a coordinate from the standard coordinate system to the camera coordinate system; Step S33: Based on the rotation matrix and translation vector, the mobile printer transforms the camera coordinates from the camera coordinate system to the standard coordinate system; wherein, the camera coordinate system is a coordinate system constructed based on the camera, and the camera coordinates are the origin of the camera coordinate system.
2. The mobile printer positioning method according to claim 1, characterized in that, Before performing step S1, the mobile printer determines whether it can obtain actual printing data from the image captured by the camera. If it cannot obtain actual printing data, it uses optical flow to locate the printer. If it can obtain actual printing data, it proceeds to step S1.
3. The mobile printer positioning method according to claim 2, characterized in that, In step S22, when the number of matching corner points is less than the preset number, the actual printed data and the internal known data fail to match, and the mobile printer is positioned using the optical flow method.
4. The mobile printer positioning method according to claim 1, characterized in that, In step S4, the method for obtaining the coordinate transformation function between the camera and the print head specifically includes: Step S41: Based on the first chessboard grid, the mobile printer prints the second chessboard grid. At the same time, the camera pose relative to the first chessboard grid is calculated based on the coordinates of the corner point relative to the first chessboard grid when printing the corner point, and recorded as the first pose. Then proceed to step S42. The first chessboard grid is within the shooting range of the mobile printer, and the coordinates of the corner points in the first chessboard grid are known. Step S42: When the mobile printer can obtain the second chessboard grid from the image captured by the camera, calculate the pose of the camera relative to the second chessboard grid based on the corner coordinates of the second chessboard grid, record it as the second pose, and then proceed to step S43. Step S43: Based on the first pose and the second pose, the mobile printer transforms the first pose and the second pose into the camera coordinate system to obtain the pose of the second chessboard grid relative to the first chessboard grid, which is recorded as the third pose, and then proceeds to step S44; wherein, the camera coordinate system is a coordinate system constructed based on the camera. Step S44: Based on the first pose and the third pose, move the printer to solve for the product of the inverse of the first pose and the third pose to obtain the coordinate transformation function between the camera and the print head.
5. A printing method using a mobile printer, 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: The mobile printer moves while continuously positioning the print head, and then prints the data at that coordinate based on the print head's coordinates relative to the standard coordinate system. When the current scan line is finished printing, move the printer to the next scan line and continue printing until a stop printing command is triggered; The scan line is a virtual straight line that the mobile printer creates during printing.
6. A portable printer, characterized in that, The mobile printer is used to implement the mobile printer positioning method according to any one of claims 1 to 4, or to implement the mobile printer printing method according to claim 5. The mobile printer includes a printer body, a control module, a memory, a print head, a camera, and a drive wheel. in, The memory, located inside the printer body, is used to store known internal data; The printhead, located below the printer body, is used to print actual print data based on known internal data under the control of the control module. A camera, mounted on the side of the printer, is used to capture actual print data. The drive wheel is located below the printer body and is used to move the printer body. The control module, located inside the printer body, is connected to the memory, printhead, camera, and drive wheel, and is used to position the printhead based on known internal data and actual printing data.
7. A portable printer according to claim 6, characterized in that, The mobile printer includes two cameras, which are positioned on two different sides of the printer body. One camera can capture the actual printing data on the previous scan line, and the other camera can capture the actual printing data on the current scan line. The scan line is a virtual straight line that the mobile printer moves along during printing.
8. A chip storing computer program code, characterized in that, When the computer program code is executed, it implements the steps of the mobile printer positioning method according to any one of claims 1 to 4, or the steps of the mobile printer printing method according to claim 5.
Citation Information
Patent Citations
An image registration evaluation method of a printed circuit board
CN109285140A
Calibration method and device of double stereo cameras, electronic equipment and storage medium
CN112785656A
Handheld mobile printing device positioning method based on computer vision
CN113112545A
Design method of portable printing and copying machine based on high-precision visual positioning
CN113306308A
Screen plate positioning method, device and equipment and storage medium
CN115578449A