Scanning method, device, electronic device and storage medium based on line scan camera
By dividing the area to be scanned into multiple scanning units and adopting the bow scanning mode, the problem of low scanning efficiency of line scan cameras is solved, achieving faster scanning speed and higher efficiency.
Patent Information
- Application Number
- CN202410725546.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-06-06
AI Technical Summary
The line scan camera needs to move from the end to the beginning of the next line after scanning one line, resulting in long scanning time and low efficiency, especially when the workpiece is larger, the scanning time is longer.
By dividing the area to be scanned into multiple scanning units, and determining the starting point based on the coordinates of odd and even scanning units, the arc scanning mode is used to reduce the moving distance of the line scan camera during line breaks, and the line scan camera is controlled according to the coordinates of each scanning unit. Scan one by one from the starting point.
It improves the scanning speed and efficiency of the line scan camera, reduces the movement time during line feed scanning, reduces the positioning error, and improves the accuracy of spliced images.
Smart Images

Figure CN118301251B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image scanning technology, and in particular to a scanning method, device, electronic device and storage medium based on a line scan camera. Background Art
[0002] When a line scan camera scans an image, after scanning one line, it needs to move from the end of this line to the beginning of the next line to scan the next line. However, it takes a long time for the line scan camera to move from the end of one line to the beginning of the next line. Especially when the workpiece is large, the scanning time of the line scan camera is long and the scanning efficiency is low. Summary of the invention
[0003] In view of the deficiencies in the prior art, the present application provides a scanning method, device, electronic device and storage medium based on a line scan camera, which is conducive to improving the scanning speed of the line scan camera and improving the scanning efficiency.
[0004] To solve the above problems, the present invention provides the following technical solutions:
[0005] In a first aspect, an embodiment of the present application provides a scanning method based on a line scan camera, the method comprising:
[0006] Obtaining area information of the area to be scanned;
[0007] Dividing the area to be scanned into a plurality of scanning units according to the area information;
[0008] When the scanning mode is a preset scanning mode, a scanning starting point of the odd scanning unit is determined according to a first coordinate of the odd scanning unit in the first direction, and a scanning starting point of the even scanning unit is determined according to a last coordinate of the even scanning unit in the first direction; wherein the line scan camera scans the first scanning unit along the first direction;
[0009] The line scan camera is controlled to scan one by one starting from the first scanning unit according to the scanning starting point of each scanning unit, so as to scan the entire area to be scanned.
[0010] In some embodiments, determining the scanning starting point of the even-numbered scanning unit according to the last coordinate of the even-numbered scanning unit in the first direction includes:
[0011] Obtaining a deviation parameter; the deviation parameter is used to reflect the movement error of the line scan camera when it moves from the scanning end point of the odd scanning unit to the scanning starting point of the adjacent even scanning unit;
[0012] The scanning starting point of each of the even-numbered scanning units is calculated according to the last coordinate of each of the even-numbered scanning units in the first direction and the deviation parameter.
[0013] In some embodiments, a scanning end point of the odd-numbered scanning unit is determined according to the last coordinate of the odd-numbered scanning unit in the first direction;
[0014] Determine a scanning end point of the even-numbered scanning unit according to a first coordinate of the even-numbered scanning unit in the first direction and the deviation parameter;
[0015] The controlling the line scan camera to scan one by one starting from the first scanning unit according to the scanning starting point of each scanning unit comprises:
[0016] The line scan camera is controlled to scan one by one starting from the first scanning unit according to the scanning start point and the scanning end point of each scanning unit.
[0017] In some embodiments, the method further comprises:
[0018] Acquire at least one sub-image scanned by the Nth scanning unit; wherein the initial state of N is 1;
[0019] Determine whether N is an odd or even number;
[0020] If N is an odd number, the sub-images are sequentially spliced along a preset direction according to the acquisition order of the at least one sub-image to obtain a sub-scanned image;
[0021] If N is an even number, each of the sub-images is mirror-flipped along its vertical center line to obtain at least one flipped sub-image; the flipped sub-images are sequentially spliced along a preset direction in the opposite order of acquisition of the at least one sub-image to obtain a sub-scanned image;
[0022] splicing the sub-scanned images into the scanned image;
[0023] Determine whether N is equal to Nmax;
[0024] If N is equal to Nmax, then output the scanned image;
[0025] If N is not equal to Nmax, set N=N+1 and return to the execution step to obtain at least one sub-image scanned by the Nth scanning unit; wherein the initial state of N is 1.
[0026] In some embodiments, the area information of the area to be scanned includes coordinates of four vertices of the area to be scanned, and obtaining the area information of the area to be scanned includes:
[0027] Obtain the coordinates of the four vertices of the area where the workpiece to be scanned is located;
[0028] The coordinates of the four vertices of the area to be scanned which includes the area to be scanned and has one side parallel to the first direction are determined according to the coordinates of the four vertices of the area to be scanned.
[0029] In some embodiments, determining the coordinates of four vertices of the area to be scanned that includes the area where the workpiece to be scanned is located and one side of which is parallel to the first direction according to the coordinates of the four vertices of the area where the workpiece to be scanned is located includes:
[0030] The coordinates of the four vertices of the area to be scanned which includes the area to be scanned and has the smallest area and one side of which is parallel to the first direction are determined according to the coordinates of the four vertices of the area to be scanned where the workpiece to be scanned is located.
[0031] In some embodiments, the method further comprises:
[0032] Determine the length and width of the area to be scanned according to the coordinates of the four vertices of the area to be scanned;
[0033] Get the scanning parameters of the line scan camera;
[0034] The area to be scanned is processed according to the length, width and scanning parameters of the area to be scanned, so that the area to be scanned encompasses the workpiece to be scanned and the length and width are integer multiples of the scanning parameters.
[0035] In a second aspect, an embodiment of the present application provides a scanning device based on a line scan camera, the device comprising:
[0036] An acquisition unit, used for acquiring area information of the area to be scanned;
[0037] A division unit, used for dividing the area to be scanned into a plurality of scanning units according to the area information;
[0038] a determination unit, configured to determine, when the scanning mode is a preset scanning mode, a scanning starting point of the odd scanning unit according to a first coordinate of the odd scanning unit in the first direction, and to determine a scanning starting point of the even scanning unit according to a last coordinate of the even scanning unit in the first direction; wherein the line scan camera scans the first scanning unit along the first direction;
[0039] A control unit is used to control the line scan camera to scan one by one starting from the first scanning unit according to the scanning starting point of each scanning unit, so as to scan the entire area to be scanned.
[0040] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0041] at least one processor; and,
[0042] a memory communicatively connected to at least one processor; wherein,
[0043] The memory stores instructions executable by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the scanning method based on a line scan camera of the first aspect.
[0044] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores an executable program, and the executable program is executed by a processor to implement the scanning method based on a line scan camera as in the first aspect.
[0045] The present application provides a scanning method, device, electronic device and storage medium based on a line scan camera, the method comprising: obtaining area information of an area to be scanned; dividing the area to be scanned into a plurality of scanning units according to the area information; when the scanning mode is a preset scanning mode, determining the scanning starting point of the odd scanning unit according to the first coordinate of the odd scanning unit in the first direction, and determining the scanning starting point of the even scanning unit according to the last coordinate of the even scanning unit in the first direction; wherein the line scan camera scans the first scanning unit along the first direction; and controlling the line scan camera to scan one by one from the first scanning unit according to the scanning starting point of each scanning unit, so as to scan the entire area to be scanned. In the present application, the scanning starting point of the even scanning unit is no longer the beginning of the even scanning unit, so after scanning a line, it is not necessary to move from the end of the line to the beginning of the next line to scan the next line, which reduces the moving distance of the line scan camera during line-change scanning and improves the scanning efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a schematic diagram of the application scenario provided by this application.
[0047] Figure 2 It is a flow chart of a scanning method based on a line scan camera provided in an embodiment of the present application.
[0048] Figure 3 It is a schematic diagram of the area to be scanned provided in an embodiment of the present application.
[0049] Figure 4 It is a schematic diagram of the division of the area to be scanned provided in an embodiment of the present application.
[0050] Figure 5 It is a schematic diagram of the mirror flipping provided in the embodiment of the present application.
[0051] Figure 6 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0052] Figure 7 It is a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0054] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0055] See also Figure 1 , Figure 1 This is a schematic diagram of the application scenario provided by this application. Figure 1 As shown, the application scenario 1 includes: a line scan camera 10 , a workpiece placement area 20 , and a scanning range 30 corresponding to the line scan camera 10 in the workpiece placement area 20 .
[0056] The line scan camera 10 scans the workpiece in the workpiece placement area 20 by continuously moving, and obtains an image including the complete scan of the workpiece.
[0057] Furthermore, because the imaging range of the line scan camera 10 is limited, it is necessary to shoot multiple times to obtain multiple images. After scanning, the multiple images scanned by the line scan camera 10 need to be spliced to obtain a complete image.
[0058] See also Figure 2 , Figure 2 FIG. 1 is a flow chart of a scanning method based on a line scan camera provided in an embodiment of the present application. Figure 2 As shown, the scanning method 100 based on the line scan camera includes: steps 110 to 140.
[0059] Step 110: Acquire area information of the area to be scanned.
[0060] In some implementations, the area information of the area to be scanned includes coordinates of four vertices of the area to be scanned, and step 110 includes the following steps.
[0061] Step 111: Obtain the coordinates of the four vertices of the area where the workpiece to be scanned is located.
[0062] Step 112: Determine the coordinates of four vertices of an area to be scanned that includes the area to be scanned and has one side parallel to the first direction according to the coordinates of the four vertices of the area to be scanned.
[0063] In some implementations, the area where the workpiece to be scanned is located may be a minimum square area that includes the workpiece to be scanned, so as to preliminarily locate the workpiece to be scanned.
[0064] In some implementations, the area where the workpiece to be scanned is located may be an actual occupied area of the workpiece to be scanned.
[0065] In some embodiments, in order to ensure the positioning accuracy of the line scan camera, it is necessary to determine an area to be scanned that includes the area where the workpiece to be scanned is located and one side of which is parallel to the first direction, thereby ensuring that the scanning starting points of the odd-numbered scanning units in the area to be scanned in the second direction perpendicular to the first direction are the same, and the scanning starting points of the even-numbered scanning units in the area to be scanned in the second direction perpendicular to the first direction are the same, thereby reducing the positioning error of the line scan camera and preventing misalignment of the stitched image.
[0066] In some implementations, to improve scanning efficiency, step 112 includes the following steps.
[0067] The coordinates of the four vertices of the area to be scanned which includes the area to be scanned and has the smallest area and one side of which is parallel to the first direction are determined according to the coordinates of the four vertices of the area to be scanned where the workpiece to be scanned is located.
[0068] See also Figure 3 , Figure 3 Schematic diagram of the area to be scanned provided in the embodiment of the present application. Figure 3 As shown, the workpiece placement area 20 includes an area 21 where the workpiece to be scanned is located, and an area 22 to be scanned that includes the area 21 where the workpiece to be scanned is located and one side of which is parallel to the first direction.
[0069] in, Figure 3 The directions of the X-axis and the Y-axis are also indicated. The coordinates of the area where the workpiece to be scanned is located and the coordinates of the area to be scanned in the embodiment of the present application are coordinates in the same coordinate system, which is defined as a mechanical coordinate system.
[0070] Among them, the area to be scanned 22 includes a first vertex A, a second vertex B, a third vertex C and a fourth vertex D; determine the X-axis maximum value, X-axis minimum value, Y-axis minimum value and Y-axis maximum value among the first vertex A, the second vertex B, the third vertex C and the fourth vertex D, and the coordinates of the four vertices of the area to be scanned with the smallest area are (X-axis maximum value, Y-axis minimum value), (X-axis maximum value, Y-axis maximum value), (X-axis minimum value, Y-axis minimum value) and (X-axis minimum value, Y-axis maximum value), respectively.
[0071] In some implementations, the scanning method 100 based on a line scan camera provided in the embodiment of the present application further includes the following steps.
[0072] (1) Determine the length and width of the area to be scanned according to the coordinates of the four vertices of the area to be scanned.
[0073] (2) Obtain the scanning parameters of the line scan camera.
[0074] (3) Processing the area to be scanned according to the length, width and scanning parameters of the area to be scanned, so that the area to be scanned encompasses the workpiece to be scanned and the length and width are integer multiples of the scanning parameters.
[0075] In some embodiments, the scanning parameters of the line scan camera include the length and width of a scanning area corresponding to the line scan camera.
[0076] Exemplarily, the length of the area to be scanned is 105 and the width is 50, the scanning length is 10 and the scanning width is 1, then the length of the area to be scanned needs to be increased to 110 to adapt to the scanning parameters of the line scan camera.
[0077] In some implementations, the vertex farthest from the boundary of the workpiece placement area may be designated as a moving vertex, and the area to be scanned may be expanded by moving the moving vertex, thereby preventing the area from exceeding the boundary of the workpiece placement area when expanding.
[0078] Step 120: Divide the area to be scanned into a plurality of scanning units according to the area information.
[0079] See also Figure 4 , Figure 4 Schematic diagram of the division of the area to be scanned provided in the embodiment of the present application. Figure 4 As shown, the unit to be scanned is a scanning row, which is divided into a first row, a second row, ..., and an Nth row, where N is a positive integer.
[0080] It can be understood that in other embodiments, the unit to be scanned may also be a scanning column.
[0081] In some implementations, step 120 includes the steps of: acquiring scanning parameters, and dividing the area to be scanned into a plurality of scanning units according to the first direction, the scanning parameters, and the area information.
[0082] For example, the area to be scanned is divided into 10 rows or 10 columns.
[0083] Step 130: When the scanning mode is a preset scanning mode, the scanning starting point of the odd scanning unit is determined according to the first coordinate of the odd scanning unit in the first direction, and the scanning starting point of the even scanning unit is determined according to the last coordinate of the even scanning unit in the first direction; wherein the line scan camera scans the first scanning unit along the first direction.
[0084] Please refer to Figure 4 ,in, Figure 4 The second row includes a first scanning starting point and a second scanning starting point. In the related art, when a line scan camera scans from a scanning starting point of the first row to a scanning end point of the first row, the line scan camera returns to the first scanning starting point of the second row to scan the second row. This scanning method is defined as a Z-type scan. However, because the scanning end point of the first row is far from the first scanning starting point, the Z-type scan takes a long time and has a low scanning efficiency.
[0085] When the line scan camera scans from the scanning start point of the first row to the scanning end point of the first row in step 130, the line scan camera moves to the second scanning start point of the second row to scan the second row. This scanning mode is defined as bow-shaped scanning. Bow-shaped scanning reduces the movement time of the line scan camera during line scanning and improves scanning efficiency.
[0086] In some embodiments, the step of determining the scanning starting point of the odd scanning unit according to the first coordinate of the odd scanning unit in the first direction includes: determining the first coordinate of the odd scanning unit in the first direction as the scanning starting point of the odd scanning unit.
[0087] Furthermore, through long-term practice, it is found that in traditional Z-type scanning, the line scan camera can accurately return to the first scan starting point from the scan end point, but in bow scanning, when the line scan camera is controlled to move from the scan end point to the second scan starting point, the line scan camera will have a positioning error. This is also the reason why most line scan cameras currently use Z-type scanning, that is, in bow scanning, there is a positioning error when moving from the scan end point of the odd-numbered scanning unit to the scan starting point of the even-numbered scanning unit, but there is no positioning error when moving from the scan end point of the even-numbered scanning unit to the scan starting point of the odd-numbered scanning unit.
[0088] Based on this, in some implementations, the step of determining the scanning starting point of the even scanning unit according to the last coordinate of the even scanning unit in the first direction includes the following steps.
[0089] (1) Obtaining a deviation parameter; the deviation parameter is used to reflect the movement error of the line scan camera when it moves from the scanning end point of the odd scanning unit to the scanning start point of the adjacent even scanning unit.
[0090] (2) Calculating the scanning starting point of each of the even-numbered scanning units according to the last coordinate of each of the even-numbered scanning units in the first direction and the deviation parameter.
[0091] In some embodiments, if the area to be scanned is a square area whose side is parallel to the first direction, the movement error of each odd-numbered scanning unit's scanning end point to the scanning start point of the even-numbered scanning unit is the same, that is, the deviation parameters corresponding to each even-numbered scanning unit are the same.
[0092] In some embodiments, if the area to be scanned is a non-square area whose side is parallel to the first direction, the movement error of the scanning end point of each odd scanning unit to the scanning starting point of the even scanning unit is not necessarily the same, and the deviation parameters corresponding to each even scanning unit need to be obtained separately.
[0093] In some embodiments, the scanning starting point of each of the even-numbered scanning units is equal to the last coordinate in the first direction plus a deviation parameter or the last coordinate in the first direction minus the deviation parameter.
[0094] In some embodiments, the deviation parameter is also in the form of coordinates, and the deviation parameter can be called a deviation coordinate.
[0095] In some implementations, it is found through practice that when the line scan camera moves, there is only a displacement error in the first direction. The line scan camera is defined to scan along the positive direction of the first coordinate axis, and the deviation value corresponding to the second coordinate axis in the deviation coordinate is 0.
[0096] In some implementations, it has been found through long-term practice that factors affecting the positioning error include device positioning accuracy, current temperature, vibration amplitude, etc.
[0097] Optionally, the step of obtaining the deviation parameter includes the following steps: obtaining at least one of the equipment positioning accuracy, the current temperature, and the vibration amplitude; and calculating the deviation parameter based on at least one of the equipment positioning accuracy, the current temperature, and the vibration amplitude.
[0098] For example, the deviation parameter is K*(device positioning accuracy-standard positioning accuracy); where K is a coefficient.
[0099] In some embodiments, the line scan camera can also be controlled to scan the workpiece multiple times in a bow scanning manner, so as to count the movement error of each time moving from the scanning end point of the odd scanning unit to the scanning starting point of the even scanning unit, and finally calibrate the deviation parameters of the equipment based on the multiple movement errors obtained.
[0100] Step 140: Control the line scan camera to scan one by one starting from the first scanning unit according to the scanning starting point of each scanning unit to scan the entire area to be scanned.
[0101] In some implementations, it is also necessary to determine the scanning end point in order to control the line scan camera. In this case, the scanning method 100 based on the line scan camera provided in the embodiment of the present application further includes the following steps.
[0102] (1) Determine a scanning end point of the odd-numbered scanning unit according to the last coordinate of the odd-numbered scanning unit in the first direction.
[0103] (2) Determine a scanning end point of the even scanning unit according to a first coordinate of the even scanning unit in the first direction and the deviation parameter.
[0104] At this time, step 140 includes the following steps.
[0105] (3) Controlling the line scan camera to scan each scanning unit one by one starting from the first scanning unit according to the scanning start point and scanning end point of each scanning unit.
[0106] Through the above method, the movement process of the line scan camera can be better controlled.
[0107] In some implementations, the step of controlling the line scan camera to scan one by one starting from the first scanning unit according to the scanning start point and the scanning end point of each scanning unit includes the following steps.
[0108] (1) Obtaining scanning parameters of the scanning area of the line scan camera;
[0109] (2) Controlling the line scan camera to scan the scanning units one by one in units of scanning subunits starting from the first scanning unit according to the scanning start point, scanning end point and scanning parameters of each scanning unit; wherein each scanning unit includes at least one scanning subunit.
[0110] In some embodiments, for example, a line scan camera scans the scanning units one by one along the positive direction of the first coordinate axis, then the starting coordinates of each scanning sub-unit are (the first coordinate in the positive direction of the first coordinate axis of the scanning unit * Q, the first coordinate axis coordinate of the scanning unit), where Q is a positive integer, and Qmax is equal to the first coordinate axis length of the scanning unit / the first coordinate axis length of the scanning area.
[0111] In some embodiments, because the image range obtained by the line scan camera is limited, the images need to be stitched into a complete image after the scanning is completed. However, when using bow scanning, the image stitching method used in Z-type scanning cannot be used. Therefore, it is necessary to design a new image stitching algorithm. At this time, the scanning solution based on the line scan camera provided in the embodiment of the present application also includes the following steps.
[0112] (1) Obtaining at least one sub-image scanned by the Nth scanning unit; wherein the initial state of N is 1.
[0113] (2) Determine whether N is an odd number or an even number.
[0114] (3) If N is an odd number, the sub-images are sequentially spliced along a preset direction according to the acquisition order of the at least one sub-image to obtain a sub-scanned image.
[0115] (4) If N is an even number, each of the sub-images is mirror-flipped along its vertical center line to obtain at least one flipped sub-image; and the flipped sub-images are sequentially spliced along a preset direction in the opposite order of acquisition to the at least one sub-image to obtain a sub-scanned image.
[0116] (5) Stitching the sub-scanned images into the scanned image.
[0117] (6) Determine whether N is equal to Nmax.
[0118] (7) If N is equal to Nmax, the scanned image is output.
[0119] (8) If N is not equal to Nmax, set N=N+1 and return to the execution step to obtain at least one sub-image scanned by the Nth scanning unit; wherein the initial state of N is 1.
[0120] Please refer to Figure 5 , Figure 5 Schematic diagram of mirror flipping provided by the embodiment of the present application. Figure 5 As shown, the sub-image 40 is mirror-flipped along the center line 50 in the vertical direction to obtain a flipped sub-image 60 .
[0121] In some embodiments, the scanning directions of the odd-numbered scanning units and the even-numbered scanning units are opposite, and therefore the sub-images need to be spliced in an opposite splicing order.
[0122] In some embodiments, the number of sub-images is equal to the length of the scanning unit / the imaging length of the line scan camera.
[0123] In some embodiments, the unit parameters of each scanning unit include a first length parameter and a first width parameter, the imaging parameters of the imaging area of the line scan camera include a second length parameter and a second width parameter, the first length parameter and the second length parameter are the same and / or the first width parameter and the second width parameter are the same.
[0124] In some embodiments, step 140 includes the following steps.
[0125] (1) determining each moving point of the line scan camera according to the unit parameters of the scanning unit and the imaging parameters of the imaging area of the line scan camera; the moving points include a scanning start point, a scanning end point, and a scanning middle point located between the scanning start point and the scanning end point in each scanning unit;
[0126] (2) numbering each moving point, and when scanning odd-numbered scanning units, each time a sub-image is obtained, the sub-image and the corresponding number are stored in the storage area; when scanning even-numbered scanning units, each time a sub-image is obtained, the sub-image is mirror-flipped along the vertical center line and stored in the storage area with the corresponding number;
[0127] (3) When receiving a display instruction, read each sub-image and its corresponding number, and stitch all sub-images into a complete image according to the positional relationship corresponding to the number.
[0128] The embodiment of the present application also provides a scanning device based on a line scan camera, the device comprising:
[0129] An acquisition unit, used for acquiring area information of the area to be scanned;
[0130] A division unit, used for dividing the area to be scanned into a plurality of scanning units according to the area information;
[0131] a determination unit, configured to determine, when the scanning mode is a preset scanning mode, a scanning starting point of the odd scanning unit according to a first coordinate of the odd scanning unit in the first direction, and to determine a scanning starting point of the even scanning unit according to a last coordinate of the even scanning unit in the first direction; wherein the line scan camera scans the first scanning unit along the first direction;
[0132] A control unit is used to control the line scan camera to scan one by one starting from the first scanning unit according to the scanning starting point of each scanning unit, so as to scan the entire area to be scanned.
[0133] See also Figure 6 , Figure 6 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 6 As shown, the electronic device 200 includes: one or more processors 210 and a memory 220, Figure 6A processor 210 is taken as an example.
[0134] In some implementations, the processor 210 and the memory 220 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0135] In some embodiments, the processor 210 is used to obtain area information of the area to be scanned; divide the area to be scanned into multiple scanning units according to the area information; when the scanning mode is a preset scanning mode, determine the scanning starting point of the odd scanning unit according to the first coordinate of the odd scanning unit in the first direction, and determine the scanning starting point of the even scanning unit according to the last coordinate of the even scanning unit in the first direction; wherein the line scan camera scans the first scanning unit along the first direction; and controls the line scan camera to scan one by one starting from the first scanning unit according to the scanning starting point of each scanning unit to scan the entire area to be scanned.
[0136] In some embodiments, the memory 220, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules of the scanning method based on the line scan camera in the embodiment of the present application. The processor 210 executes various functional applications and data processing of the electronic device by running the non-volatile software programs, instructions and modules stored in the memory 220, that is, the scanning method based on the line scan camera in the above method embodiment is implemented.
[0137] In some embodiments, the memory 220 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 220 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 220 may optionally include a memory remotely arranged relative to the processor 210, and these remote memories may be connected to the controller via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0138] In some embodiments, one or more modules are stored in the memory 220, and when executed by one or more processors 210, perform the scanning method based on the line scan camera in any of the above method embodiments, for example, perform the above described Figure 2 Method steps 110 to 140 in.
[0139] Please refer to Figure 7 , Figure 7 The computer-readable storage medium 300 stores a program code 310, which can be called by a processor to execute the scanning method based on a line scan camera described in the above method embodiment.
[0140] The computer-readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. Optionally, the computer-readable storage medium includes a non-transitory computer-readable storage medium. The computer-readable storage medium 300 has a storage space for program codes for executing any method steps in the above control method. These program codes may be read from or written to one or more computer program products. The program code may be compressed, for example, in an appropriate form.
[0141] In summary, the present application provides a scanning method, device, electronic device and storage medium based on a line scan camera, the method comprising: obtaining area information of an area to be scanned; dividing the area to be scanned into a plurality of scanning units according to the area information; when the scanning mode is a preset scanning mode, determining the scanning starting point of the odd scanning unit according to the first coordinate of the odd scanning unit in the first direction, and determining the scanning starting point of the even scanning unit according to the last coordinate of the even scanning unit in the first direction; wherein the line scan camera scans the first row of scanning units along the first direction; and controlling the line scan camera to scan one by one starting from the first scanning unit according to the scanning starting point of each scanning unit to scan the entire area to be scanned. In the present application, the scanning starting point of the even scanning unit is no longer the beginning of the even scanning unit, so after scanning a line, it is not necessary to move from the end of the line to the beginning of the next line to scan the next line, which reduces the moving distance of the line scan camera during line-change scanning and improves the scanning efficiency.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A scanning method based on a line scan camera, It is characterized in that The method comprises: Obtaining area information of the area to be scanned; Dividing the area to be scanned into a plurality of scanning units according to the area information; When the scanning mode is the preset scanning mode, the scanning starting point of the odd scanning unit is determined according to the first coordinate of the odd scanning unit in the first direction, and the scanning starting point of the even scanning unit is determined according to the last coordinate of the even scanning unit in the first direction; wherein the line scan camera scans the first scanning unit along the first direction; Controlling the line scan camera to scan one by one starting from the first scanning unit according to the scanning starting point of each scanning unit, so as to scan the entire area to be scanned; The step of determining the scanning starting point of the even-numbered scanning unit according to the last coordinate of the even-numbered scanning unit in the first direction comprises: Obtaining a deviation parameter; wherein the deviation parameter is used to reflect the movement error of the line scan camera in a first direction when the line scan camera moves from a scanning end point of an odd-numbered scanning unit to a scanning start point of an adjacent even-numbered scanning unit, and if the area to be scanned is a square area with one side parallel to the first direction, the deviation parameter corresponding to each even-numbered scanning unit is the same; The scanning starting point of each of the even-numbered scanning units is calculated according to the last coordinate of each of the even-numbered scanning units in the first direction and the deviation parameter.
2. The method according to claim 1, It is characterized in that The method further comprises: Determine a scanning end point of the odd-numbered scanning unit according to the last coordinate of the odd-numbered scanning unit in the first direction; Determine a scanning end point of the even-numbered scanning unit according to a first coordinate of the even-numbered scanning unit in the first direction and the deviation parameter; The controlling the line scan camera to scan one by one starting from the first scanning unit according to the scanning starting point of each scanning unit comprises: The line scan camera is controlled to scan one by one starting from the first scanning unit according to the scanning start point and the scanning end point of each scanning unit.
3. The method according to claim 1, It is characterized in that The method further comprises: Acquire at least one sub-image scanned by the Nth scanning unit; wherein the initial state of N is 1; Determine whether N is an odd or even number; If N is an odd number, the sub-images are sequentially spliced along a preset direction according to the acquisition order of the at least one sub-image to obtain a sub-scanned image; If N is an even number, each of the sub-images is mirror-flipped along its vertical center line to obtain at least one flipped sub-image; the flipped sub-images are sequentially spliced along a preset direction in the opposite order of acquisition of the at least one sub-image to obtain a sub-scanned image; splicing the sub-scanned images into the scanned image; Determine whether N is equal to Nmax; If N is equal to Nmax, then output the scanned image; If N is not equal to Nmax, set N=N+1 and return to the execution step to obtain at least one sub-image scanned by the Nth scanning unit; wherein the initial state of N is 1.
4. The method according to claim 1, It is characterized in that The area information of the area to be scanned includes coordinates of four vertices of the area to be scanned, and the acquiring of the area information of the area to be scanned includes: Obtain the coordinates of the four vertices of the area where the workpiece to be scanned is located; The coordinates of the four vertices of the area to be scanned which includes the area to be scanned and has one side parallel to the first direction are determined according to the coordinates of the four vertices of the area to be scanned.
5. The method according to claim 4, It is characterized in that The step of determining the coordinates of four vertices of the area to be scanned that includes the area to be scanned and has one side parallel to the first direction according to the coordinates of the four vertices of the area to be scanned, comprises: The coordinates of the four vertices of the area to be scanned which includes the area to be scanned and has the smallest area and one side of which is parallel to the first direction are determined according to the coordinates of the four vertices of the area to be scanned where the workpiece to be scanned is located.
6. The method according to claim 4 or 5, It is characterized in that The method further comprises: Determine the length and width of the area to be scanned according to the coordinates of the four vertices of the area to be scanned; Get the scanning parameters of the line scan camera; The area to be scanned is processed according to the length, width and scanning parameters of the area to be scanned, so that the area to be scanned encompasses the workpiece to be scanned and the length and width are integer multiples of the scanning parameters.
7. A scanning device based on a line scan camera, It is characterized in that The device comprises: An acquisition unit, used for acquiring area information of the area to be scanned; A division unit, used for dividing the area to be scanned into a plurality of scanning units according to the area information; a determination unit, configured to determine, when the scanning mode is a preset scanning mode, a scanning starting point of the odd scanning unit according to a first coordinate of the odd scanning unit in the first direction, and to determine a scanning starting point of the even scanning unit according to a last coordinate of the even scanning unit in the first direction; wherein the line scan camera scans the first scanning unit along the first direction; A control unit, used for controlling the line scan camera to scan one by one starting from the first scanning unit according to the scanning starting point of each scanning unit, so as to scan the entire area to be scanned; The determination unit is used to obtain a deviation parameter; wherein the deviation parameter is used to reflect a movement error of the line scan camera in a first direction when the line scan camera moves from a scanning end point of an odd-numbered scanning unit to a scanning start point of an adjacent even-numbered scanning unit, and if the area to be scanned is a square area with one side parallel to the first direction, the deviation parameter corresponding to each even-numbered scanning unit is the same; The scanning starting point of each of the even-numbered scanning units is calculated according to the last coordinate of each of the even-numbered scanning units in the first direction and the deviation parameter.
8. An electronic device, It is characterized in that The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the scanning method based on a line scan camera as described in any one of claims 1 to 6.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores an executable program, and the executable program is executed by a processor to implement the scanning method based on a line scan camera as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Image shooting alignment method and system
CN107666546A
Image reading apparatus, image reading system, and method for controlling image reading apparatus
CN116582624A
Bidirectional scanning large-format image acquisition device and method based on image splicing technology
CN116805953A
Image processor
JP2001298588A
Method and apparatus for correcting scanning errors in a shuttle type scanner
US6411405B1
