WO2023274090A1 - Scanning method and system for portable electronic device, and electronic device and storage medium - Google Patents
Scanning method and system for portable electronic device, and electronic device and storage medium Download PDFInfo
- Publication number
- WO2023274090A1 WO2023274090A1 PCT/CN2022/101303 CN2022101303W WO2023274090A1 WO 2023274090 A1 WO2023274090 A1 WO 2023274090A1 CN 2022101303 W CN2022101303 W CN 2022101303W WO 2023274090 A1 WO2023274090 A1 WO 2023274090A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- scanning
- electronic device
- portable electronic
- preset
- image
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 108
- 238000003860 storage Methods 0.000 title claims abstract description 13
- 238000003384 imaging method Methods 0.000 claims abstract description 100
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 claims description 48
- 230000009466 transformation Effects 0.000 claims description 30
- 238000004590 computer program Methods 0.000 claims description 11
- 238000007499 fusion processing Methods 0.000 claims description 8
- 238000004891 communication Methods 0.000 claims description 5
- 238000004458 analytical method Methods 0.000 claims description 4
- 230000008569 process Effects 0.000 abstract description 46
- 238000012805 post-processing Methods 0.000 abstract description 7
- 230000006870 function Effects 0.000 description 21
- 230000000694 effects Effects 0.000 description 15
- 238000011156 evaluation Methods 0.000 description 8
- 238000012545 processing Methods 0.000 description 8
- 230000007547 defect Effects 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 6
- 230000004927 fusion Effects 0.000 description 6
- 238000005259 measurement Methods 0.000 description 5
- 238000012937 correction Methods 0.000 description 4
- 238000001514 detection method Methods 0.000 description 4
- 238000005070 sampling Methods 0.000 description 4
- 238000013519 translation Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000005520 cutting process Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 239000011521 glass Substances 0.000 description 2
- 230000001939 inductive effect Effects 0.000 description 2
- 238000009434 installation Methods 0.000 description 2
- 239000007788 liquid Substances 0.000 description 2
- 238000013507 mapping Methods 0.000 description 2
- 239000011159 matrix material Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000002360 preparation method Methods 0.000 description 2
- 238000003825 pressing Methods 0.000 description 2
- 238000010008 shearing Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000003708 edge detection Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000005043 peripheral vision Effects 0.000 description 1
- 230000008092 positive effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/00795—Reading arrangements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/04—Scanning arrangements, i.e. arrangements for the displacement of active reading or reproducing elements relative to the original or reproducing medium, or vice versa
Definitions
- the invention relates to the technical field of computers, in particular to a scanning method and system of a portable electronic device, the electronic device and a storage medium.
- More and more portable electronic devices are equipped with document scanning functions comparable to traditional scanners by virtue of powerful shooting functions and graphics and image processing capabilities.
- the technical problem to be solved by the present invention is to provide a scanning method and system for a portable electronic device, an electronic device and a storage medium in order to overcome the defects in the prior art that it is difficult to control the position and posture of the scanning device resulting in poor scanning effect.
- the invention provides a scanning method of a portable electronic device, and the scanning method comprises the following steps:
- the portable electronic device is controlled to scan the surface of the scanning object.
- the preset scanning conditions include: the imaging plane of the portable electronic device is parallel to the surface of the scanning object; the tilt parameters include a horizontal tilt angle.
- the preset scanning conditions include: the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the object to be scanned; the tilt parameter includes a magnetic azimuth.
- the scanning method also includes:
- the target image is acquired from all the images, wherein in all the images, the absolute value of the difference between the tilt parameter corresponding to the target image and the preset tilt parameter is the smallest.
- the scanning method also includes:
- the step of scanning the surface of the scanning object by panoramic shooting to obtain at least two frames of images further includes: obtaining a scanning distance corresponding to the image, and the scanning distance is the distance of the camera of the portable electronic device The distance to the surface of the scanning object in the focal length direction;
- the scan distance corresponding to the reference image is the reference scan distance
- the step of performing affine transformation on images other than the reference image also makes the scanning distance of the image after affine transformation consistent with the reference scanning distance.
- the scanning method also includes:
- the scanning distance is the focal length direction of the camera of the portable electronic device the distance to the surface of the scanned object
- the step of acquiring the current tilt parameter of the portable electronic device it further includes:
- second prompt information is generated, and the second prompt information is used to prompt the user to adjust the portable electronic device so that the The error is reduced to within the preset range.
- the present invention also provides a scanning system of a portable electronic device, the scanning system comprising:
- a parameter preset module configured to obtain a preset tilt parameter of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object;
- a parameter acquisition module configured to acquire the current tilt parameter of the portable electronic device
- a scanning control module configured to control the portable electronic device to scan the surface of the scanning object when the error between the current tilt parameter and the preset tilt parameter is within a preset range.
- the preset scanning condition includes: the imaging plane of the portable electronic device is parallel to the surface of the scanning object; the tilt parameter includes a horizontal tilt angle.
- the preset scanning conditions include: the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the object to be scanned; the tilt parameter includes a magnetic azimuth.
- the scanning system also includes:
- a dynamic shooting module configured to scan the surface of the scanned object by dynamic shooting to obtain at least two frames of images
- the target image acquiring module is configured to acquire the target image from all the images, wherein in all the images, the absolute value of the difference between the tilt parameter corresponding to the target image and the preset tilt parameter is the smallest.
- the scanning system also includes:
- a panoramic shooting module configured to scan the surface of the scanning object by panoramic shooting to obtain at least two frames of images
- a reference image acquisition module configured to obtain a reference image from all images, wherein in all images, the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest;
- An affine transformation module configured to perform affine transformation on images other than the reference image, so that the tilt parameters of the affine transformed image are consistent with the tilt parameters corresponding to the reference image;
- a panoramic image acquisition module configured to perform image fusion processing on the reference image and the image after affine transformation, so as to acquire a panoramic image.
- the panoramic shooting module is further configured to: acquire a scanning distance corresponding to the image, the scanning distance being the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction;
- the scan distance corresponding to the reference image is the reference scan distance
- the affine transformation module is further configured to make the scanning distance of the affine transformed image consistent with the reference scanning distance.
- the scanning system also includes:
- the imaging area analysis module is used to obtain the corresponding relationship between at least two sets of scanning distances and the area ratio of the scanning object in the imaging area of the portable electronic device under the scanning distance;
- the scanning distance is the The distance from the camera of the device to the surface of the scanned object in the focal length direction;
- An optimal distance determination module configured to determine an optimal scanning distance based on the correspondence
- the first prompt information module is configured to generate first prompt information, where the first prompt information includes the optimal scanning distance.
- the scanning system also includes:
- the second prompt information module is configured to generate second prompt information when the error between the current tilt parameter and the preset tilt parameter exceeds a preset range, and the second prompt information is used to prompt the user to adjust the portable Electronic equipment, so that the error is reduced to within the preset range.
- the present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and operable on the processor.
- the processor executes the computer program, the above-mentioned scanning method of the portable electronic device is realized. .
- the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above scanning method for a portable electronic device is realized.
- the positive and progressive effect of the present invention is: by providing a scanning method and system for a portable electronic device, an electronic device and a storage medium, the portable electronic device can maintain a reasonable posture during the scanning process, thereby ensuring the accuracy of the scanning result and improving the accuracy of the scanning result. It improves the efficiency of the scanning operation and makes the scanned results more suitable for post-processing such as cropping.
- FIG. 1 is a flowchart of a scanning method of a portable electronic device according to Embodiment 1 of the present invention.
- FIG. 2 is a schematic diagram of obtaining a preset magnetic azimuth in Embodiment 1 of the present invention.
- Fig. 3 is a schematic diagram of obtaining level readings in Embodiment 1 of the present invention.
- FIG. 4 is a schematic diagram of a scanning object and an imaging area in Embodiment 1 of the present invention.
- FIG. 5 is a block diagram of a scanning system of a portable electronic device according to Embodiment 2 of the present invention.
- FIG. 6 is a structural block diagram of an electronic device according to Embodiment 3 of the present invention.
- the present embodiment specifically provides a scanning method of a portable electronic device, comprising the following steps:
- the portable electronic device in this embodiment is an electronic device with an image capturing function; including but not limited to a mobile phone and a tablet computer.
- the shooting resolution of the electronic device meets the scanning resolution requirements.
- the document scanning usually requires a resolution of 200dpi (Dots Per Inch, dots per inch), then the highest resolution of the corresponding electronic device should be able to reach Corresponding parameters to meet the scanning resolution of 200dpi.
- this embodiment only uses a mobile phone as an example to describe the scanning method of a portable electronic device.
- the scanned object it is usually text, pattern or a combination thereof in a rectangular paper, and usually the scanned object has a relatively flat surface.
- the above-mentioned scanned text is used as the scanned object for illustration. It can be understood that the scanning method in this embodiment is not limited to the above-mentioned application scenarios of mobile phones and scanning text.
- Step S1 acquires a preset tilt parameter of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object.
- step S1 first obtains the tilt parameters of the imaging plane of the mobile phone when the surface of the scanned text meets the preset scanning conditions.
- the preset scanning conditions It can be considered as the pose parameter sampling performed by the mobile phone based on the scanned text when the scanned text is in a relatively static environment.
- the purpose is to obtain a preset tilt parameter for the mobile phone based on the sampling result, and perform scanning according to the tilt parameter. During operation, satisfy the relatively ideal pose state and obtain the scanning effect that meets the requirements.
- the imaging plane of the mobile phone is the image plane
- the imaging plane of the mobile phone is a photosensitive element such as a CCD (charge coupled device, charge coupled device).
- CCD charge coupled device, charge coupled device
- the imaging plane is not necessarily the plane formed by the mobile phone as a whole. coincident or parallel.
- a plane that meets the maximum degree of correlation and the best evaluation standard with the scanning state of the mobile phone is required.
- the focal plane of the mobile phone is parallel to the imaging plane, depending on the scanned object, the focal plane needs to be adjusted to coincide with the image plane. Therefore, in this embodiment, the imaging plane of the mobile phone is set as a reference for the tilt parameter.
- scanned text it can be placed flat in different positions, for example, it may be a horizontal desktop, it may be an inclined desk, and it may even be attached to a vertical wall or ceiling.
- Obtaining the preset tilt parameters of the mobile phone can be implemented according to actual scenarios, and is not limited to a specific method. Due to the above-mentioned defects in the prior art, this embodiment aims to ensure that the imaging plane of the mobile phone and the surface of the scanned text have corresponding inclination parameters as much as possible, such as being parallel. Therefore, generally, to acquire the preset tilt parameters, as long as the tilt parameters of the surface on which the text is scanned are obtained, the preset tilt parameters of the mobile phone can be correspondingly acquired and set.
- step S1 can realize the acquisition of the preset tilt parameters for the mobile phone.
- Step S2 obtains the current tilt parameter of the portable electronic device.
- the preset tilt parameters of the mobile phone it is also necessary to obtain the current tilt parameters of the mobile phone for comparison and calculation, and to determine whether the current pose of the mobile phone meets the above scanning requirements.
- the above-mentioned preset and current tilt parameters may include more than one kind, but they are calculated and compared in a one-to-one correspondence to obtain judgment results.
- the error between the current inclination parameter and the preset inclination parameter exceeds the preset range, it can be considered that scanning with the pose of the mobile phone at this time will not be able to obtain a satisfactory scanning result. Therefore, some necessary prompts can be sent to the user on the mobile phone; for example, the type of tilt parameter, the deviation angle, etc., so that the user can correct the scanning operation.
- step S3 controls the mobile phone to scan the scanned text.
- the preset range can usually be set according to the requirements for scanning precision, for example, for higher scanning precision, the preset range can be set close to zero. Since the above conditions are met, it can be considered that the scanning of the mobile phone pose at this time can obtain the scanning results that meet the requirements, that is, the content is complete, and the deformation is controllable and small.
- the preset scanning condition is that the imaging plane of the portable electronic device is parallel to the surface of the scanning object.
- the tilt parameter is the horizontal tilt angle.
- the preset scanning condition is set in this embodiment to be that the imaging plane of the portable electronic device is parallel to the surface of the scanned object.
- set the tilt parameter as the horizontal tilt angle.
- Horizontal inclination that is, the angle formed by a straight line or plane and the horizontal plane.
- the preset horizontal inclination can represent the horizontality of the scanned text.
- the scanned text on a horizontal desktop has a horizontal inclination of 0°; correspondingly, if the preset scanning condition is that the mobile phone is parallel to the scanned text, the mobile phone
- the condition for scanning is also that the horizontal inclination angle is 0°.
- the preset scanning conditions may also include other setting methods besides the above-mentioned imaging plane of the portable electronic device being parallel to the surface of the scanning object.
- the error value of the horizontal inclination angle between the imaging plane of the portable electronic device and the surface of the scanning object is a preset interval.
- the error value of the horizontal inclination angle of the mobile phone and the surface of the scanned text is ⁇ 5°.
- a spirit level is a commonly used measuring tool for measuring angles, and is used to measure horizontal inclination, horizontal position and vertical position of equipment installation, etc. According to the shape of the level, it can be divided into universal level, column level, frame level, ruler level and so on.
- the level tube of the bubble-type universal level is made of glass.
- the inner wall of the level tube is a curved surface with a certain radius of curvature.
- the tube is filled with liquid.
- the air bubbles in the level tube will move toward the raised end of the level. , so as to determine the position of the horizontal plane.
- the larger the radius of curvature of the inner wall of the vial the higher the resolution and the higher the accuracy of the level.
- an inductive spirit level with a readout display has similar functionality.
- the mobile phone has the above-mentioned spirit level, and the appearance of the mobile phone is planar, which meets the requirement that the above-mentioned imaging plane is parallel to the overall plane of the mobile phone; then to make the mobile phone meet the preset scanning conditions, that is, the mobile phone is parallel to the scanned text, the following methods can be used accomplish:
- the imaging plane of the portable electronic device is parallel to the surface of the scanning object, and setting the tilt parameter as a horizontal inclination angle, it is ensured that the imaging plane of the portable device can be parallel to the surface of the scanning object during the scanning process, thereby The deformation of the scanned image due to the excessively large included angle between the above two planes is avoided, the quality and ease of handling of the scanned text are ensured, and the scanning effect is improved.
- the preset scanning condition is that the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the scanning object; the tilt parameter is a magnetic azimuth.
- Another difficulty in scanning text with portable devices such as mobile phones is that traditional scanning devices can place the scanned text at a fixed position to ensure that the scanned text is located in the imaging plane of the scanning device’s camera as a whole during the scanning, shooting and imaging process, and the scanning
- the central axis of the surface of the text is parallel or nearly parallel to the central axis of the imaging plane, so as to obtain a scanning result including a complete scan image with edges flush with the scanned text edges.
- Scanning by holding and other methods can usually ensure the overall imaging of the scanned text surface, but due to the above-mentioned reason that the pose of the mobile phone is not fixed, it is very easy to cause the final image due to the misalignment of the viewfinder frame during the shooting process.
- the scanned text is skewed and requires post-processing such as rotation and cutting.
- this embodiment sets the preset scanning condition to be that the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the scanned object. ;
- the tilt parameter is the magnetic azimuth.
- the magnetic azimuth is the direction of the compass pointer, which is the angle between the north end of the magnetic meridian passing through a certain point and the clockwise direction to a certain straight line (that is, the line connecting magnetic south and magnetic north on the north and south poles of the earth).
- a certain straight line that is, the line connecting magnetic south and magnetic north on the north and south poles of the earth.
- the magnetic declination angles of various places are different depending on the latitude and longitude. to obtain relatively accurate readings.
- the readings of the compass are obtained for the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanned object, in order to determine their relative relationship, so there is no influence of the above-mentioned magnetic declination on the two located at the same place.
- the preset magnetic azimuth can characterize the placement direction of the scanned text. Assuming that the scanned text is placed in a certain direction first, the imaging plane needs to be in this direction according to the above preset scanning conditions.
- the preset scanning conditions may also include other setting methods besides the above-mentioned direction of the imaging plane of the portable electronic device being consistent with the surface of the scanning object.
- the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanning object are within a preset interval.
- the error value between the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanning object is ⁇ 5°.
- the mobile phone has a compass function, and the shape of the mobile phone is rectangular, then the following methods can be used to make the mobile phone meet the above preset scanning conditions:
- the preset magnetic azimuth can also be obtained in other ways, such as aligning the mobile phone viewfinder with the scanned text in advance, and displaying vertical and horizontal indicator lines on the mobile phone viewfinder for easy alignment.
- aligning the mobile phone viewfinder with the scanned text in advance and displaying vertical and horizontal indicator lines on the mobile phone viewfinder for easy alignment.
- the imaging plane of the portable electronic device by setting the preset scanning condition that the imaging plane of the portable electronic device is consistent with the central axis direction of the scanning object surface, and setting the tilt parameter as the magnetic azimuth angle, the imaging plane of the portable electronic device and the scanning object surface are guaranteed during the scanning process.
- the orientation of the projection direction is consistent, thereby avoiding the imaging distortion of the scanned image due to the inconsistency of the directions of the above two planes, which is difficult to handle, and improving the quality of the scanned text.
- the scanning method of this embodiment also includes the steps:
- S41 Scanning the surface of the scanning object by dynamic shooting to obtain at least two frames of images.
- Step S41 scans the surface of the object to be scanned by dynamic shooting to obtain at least two frames of images, that is, continuously shoots the scanned text through the above-mentioned dynamic shooting method to obtain continuous shooting images.
- Step S42 From all the images obtained by the above-mentioned continuous shooting, based on the comparison with the preset tilt parameters, select the image corresponding to the tilt parameter with the smallest absolute value of the difference between the preset tilt parameters as the target image, that is, the final scanning result .
- step S42 it will be described by taking the above-mentioned horizontal inclination set as the inclination parameter when the function of the spirit level is used as an example.
- the spirit level is a bubble-type disk spirit level with a four-quadrant two-dimensional coordinate scale of abscissa and ordinate, and the horizontal inclination can be obtained by reading the ordinate and abscissa of the bubble. Then assume that when the scanned text is placed on the desktop, the coordinate reading of the bubble of the level is (x’, y’), then for n images obtained after continuous shooting, the coordinate reading of the bubble in it is obtained:
- (x i , y i ) are the coordinate readings of the bubbles of the spirit level in the i-th image, respectively. Therefore, corresponding to the finally obtained A i is the target image that meets the requirements, that is, the imaging plane of the mobile phone that is closest to the parallel to the surface of the scanned text when shooting.
- the obtained preset horizontal inclination angle is 0°, that is, the level bubble is centered when the mobile phone sticker is placed on the scanned text, and the coordinates are (0, 0); assuming that the mobile phone is held and the bubble passes the origin (0,0) along the dotted line track of the dotted line in Figure 3 to complete the dynamic shooting and obtain a set of images, only need to calculate:
- the target image can be obtained.
- the above steps S41 and S42 are applicable to the application scenario where the tilt parameter is the magnetic azimuth angle, and in one application scenario, the above two current tilt parameters including at least the horizontal tilt angle and the magnetic azimuth angle can be combined with their respective The preset tilt parameters are compared, and the absolute values of the differences obtained respectively can be comprehensively calculated according to a certain weight.
- the absolute value of the difference between the horizontal inclination of each picture and the preset horizontal inclination is T ⁇
- the absolute value of the difference between the horizontal inclination of each picture and the preset horizontal inclination is T ⁇
- the weight of the horizontal inclination consistent with the preset is set to 0.6
- the weight of the magnetic azimuth consistent with the preset is set to 0.4
- the comprehensive value of the absolute value of the difference between the tilt parameters of each picture S T ⁇ *0.6 +T ⁇ *0.4, so that among all the images obtained by continuous shooting, the S with the minimum value is obtained; the corresponding image is the target image.
- the tilt parameters in this embodiment include but are not limited to the above two manners and combinations.
- This embodiment makes full use of the dynamic shooting function of the portable electronic device, and overcomes the deviation of the scanned image caused by the unavoidable shaking during the shooting process by automatically selecting the best, thereby increasing the possibility of obtaining pictures that meet the quality requirements, and By replacing multiple scans with one continuous shooting, the scanning efficiency and scanning effect of portable devices are improved.
- the scanning method of this embodiment further includes:
- S401 Scan the surface of the scanned object by panoramic shooting, so as to obtain at least two frames of images.
- panoramic photos Panoramic Photo
- the scanned text is A4 (210 mm ⁇ 297 mm) size paper, but there are also some special content such as scrolls, code texts, etc. that require long strips of scanned text with a large aspect ratio as a carrier.
- panoramic shooting In order to scan all the text in the scene, it can be realized by panoramic shooting.
- the phone In the process of panoramic shooting, the phone is held for a long time, and the camera is prone to shake and shift, resulting in poor shooting results.
- the long text scanning technology provided in this embodiment improves on the above defects caused by the unstable pose of the scanning device during the scanning process.
- Step S401 scans the surface of the object to be scanned by dynamic shooting to obtain at least two frames of images, that is, continuously shoots the scanned text through the above-mentioned dynamic shooting method to obtain continuous shooting images.
- Step S42 From all the images obtained by the continuous shooting, based on the comparison with the preset tilt parameters, select the image corresponding to the tilt parameter with the smallest absolute value of the difference between the preset tilt parameters as the reference image.
- the horizontal inclination, magnetic azimuth and other inclination parameters can also be evaluated, and the evaluation results can also be combined and evaluated in different ways such as weights as described in the previous embodiment. Since the specific principles involved are similar and no longer repeat.
- Step S402 Obtain the reference image from all the captured images as the reference basis for feature detection and feature matching. Since the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest in all images, it can be considered that The reference image has a strong pose reference evaluation significance.
- the panorama image generation result based on the tilt parameters of the reference image and other image features can also better restore the content of the scanned text.
- Step S403 performs affine transformation on images other than the reference image, so that the tilt parameters of the affine transformed image are consistent with the tilt parameters corresponding to the reference image.
- Affine transformation also known as affine mapping, refers to performing a linear transformation in a vector space in geometry followed by a translation to transform it into another vector space.
- the calculation process may include translation, rotation, scaling, shearing, and reflection; the calculated results have characteristics: the line segments are still line segments after the affine transformation and the ratio between them remains unchanged.
- other images are affine transformed based on the reference image to obtain a group of images, which can ensure the quality of the panoramic image.
- Step S404 performs image fusion processing on the reference image and the affine transformed image to obtain a panoramic image. Since the image after affine transformation has a high degree of fitting of feature points, the accuracy of feature point extraction, matching, and registration for each image is higher when performing image fusion stitching, and the overlapping boundaries of each image are more accurate. The processing is more precise, resulting in better panoramic images.
- This embodiment uses the panoramic image dynamic shooting function of the portable electronic device to scan long texts, and obtains the reference image based on the tilt parameters, so as to ensure that a more accurate panoramic image can be generated, and solves the problem of panoramic images caused by human operation errors in the shooting process in the past.
- Image distortion and lower quality issues improve scanning of long text on portable devices.
- step S301 further includes: acquiring a scanning distance corresponding to the image, where the scanning distance is the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction.
- the scanning distance corresponding to the reference image is the reference scanning distance;
- Step S303 also makes the scanning distance of the affine transformed image consistent with the reference scanning distance.
- TOF (Time-of-Flight) camera is a 3D (three-dimensional) camera that uses a modulated light source to illuminate the scene and observes the reflected light for distance measurement. It uses the TOF measurement principle to determine the distance between the camera and the object or the surrounding environment. And generate a depth image or 3D image through the measured points.
- the principle of distance measurement is to measure the time required for light to travel a certain distance in a medium, usually the time it takes for the pulsed emitted light to reach the object and reflect back to the sensor. Since the TOF camera can collect depth of field information and obtain more image details, it can not only obtain more high-precision feature points for subsequent image fusion operations, but also obtain finer scanning effects.
- the precise scanning distance is obtained by the TOF camera, which is helpful for more accurate feature matching in the process of image fusion.
- the reference image has a higher reference significance in the process of generating the panoramic image, further improves the accuracy of the panoramic image, and further improves the image distortion problem of long text scanning And improved the scanning effect of portable devices for long text.
- the scanning method of this embodiment further includes:
- S501 Obtain a corresponding relationship between at least two sets of scanning distances and the area ratio of the scanning object within the imaging area of the portable electronic device under the scanning distances. It can be understood that the scanning distance is the same as that in the previous embodiment, which is the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction.
- step S501 can be during the preparation process of scanning, that is, the focusing stage, or during the scanning process, when it is detected that the distance between the camera of the portable electronic device and the surface of the scanned object changes in the focal length direction, the text can be obtained through text edge detection. Parameters such as range and text edge, and on this basis, at least two sets of correspondences between scanning distances and the above-mentioned area ratios are obtained. Step S502 calculates based on this and obtains the appropriate distance for scanning based on the placement position of the current scanning object, which is the optimal scanning distance.
- the optimal scanning distance is the scanning distance at which the area ratio a/a' is the maximum value while ensuring that the edges of the text all fall into the aforementioned imaging area a'.
- step S503 displays the optimal scanning distance to help the user adjust the portable electronic device in time to scan more accurately.
- the area ratio of the scanned text is obtained by analyzing the imaged area of the scanned text, and then the optimal scanning distance for the scanned text is determined and prompted to the user, thereby helping to obtain a better scanning effect. Get the highest possible scan clarity while ensuring scan productivity.
- step S2 it also includes:
- the second prompt information is used to prompt the user to adjust the portable electronic device to reduce the error to within the preset range.
- the inclination parameter is the horizontal inclination
- the preset horizontal inclination is 5°
- the preset error range is 10°
- the current horizontal inclination and the preset horizontal inclination If the error of 25° exceeds the preset range, a second prompt message will be issued.
- the absolute value of the difference between the current horizontal inclination and the preset horizontal inclination can be displayed in real time, and a green arrow is displayed when it is detected that the absolute value is close to the above-mentioned preset range value; A red warning arrow is displayed when the range value is preset.
- the tilt parameter is magnetic azimuth
- the preset magnetic azimuth is 5° north by west, and the preset error range is 10°; then the current magnetic azimuth If the error of 25° between the angle and the preset magnetic azimuth exceeds the preset range, a second prompt message will be issued.
- the absolute value of the difference between the current magnetic azimuth and the preset magnetic azimuth can be displayed on the electronic device in real time, and an arrow can be displayed to indicate the direction in which the user should turn the portable electronic device.
- the color of the arrow can be detected A green arrow is displayed when the absolute value of the difference is close to the preset range value; otherwise, a red warning arrow is displayed when the absolute value is detected to be far from the preset range value.
- a targeted prompt is issued to help the user correct the deviation, which is beneficial to obtain a better scanning effect and improves user experience.
- This embodiment provides a scanning method for a portable electronic device, so that the portable electronic device maintains a reasonable posture during the scanning process, thereby ensuring the accuracy of the scanning result, improving the efficiency of the scanning operation, and making the scanning result more suitable. For post-processing such as cropping.
- this embodiment specifically provides a scanning system for portable electronic devices, and the scanning system includes:
- the parameter preset module 1 is used to acquire the preset tilt parameters of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object;
- a parameter acquisition module 2 configured to acquire the current tilt parameter of the portable electronic device
- the scanning control module 3 is configured to control the portable electronic device to scan the surface of the scanning object when the error between the current tilt parameter and the preset tilt parameter is within a preset range.
- the portable electronic device in this embodiment is an electronic device with an image capturing function; including but not limited to a mobile phone and a tablet computer.
- the shooting resolution of the electronic device meets the scanning resolution requirements.
- the document scanning requires a resolution of 200dpi, and the highest resolution of the corresponding electronic device should be able to meet the corresponding parameters to meet the scanning requirements of 200dpi. resolution.
- this embodiment only uses a mobile phone as an example to describe the scanning system of a portable electronic device.
- the scanned object it is generally text, pattern or a combination thereof in a rectangular paper, and usually the scanned object has a relatively flat surface.
- the above-mentioned scanned text is used as the scanned object for illustration. It can be understood that the scanning system of this embodiment is not limited to the above-mentioned application scenarios of mobile phones and scanning text.
- the parameter preset module 1 acquires a preset tilt parameter of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object.
- the parameter preset module 1 first obtains the tilt parameters of the imaging plane of the mobile phone when the surface of the scanned text meets the preset scanning conditions. Assuming that the scanning condition can be considered as the pose parameter sampling performed by the mobile phone based on the scanned text when the scanned text is in a relatively static environment, the purpose is to obtain a preset tilt parameter for the mobile phone based on the sampling result. When the parameters perform the scanning operation, the relatively ideal pose state is satisfied, and the scanning effect that meets the requirements is obtained.
- the imaging plane of the mobile phone is the image plane
- the imaging plane of the mobile phone is a photosensitive element such as a CCD.
- the imaging plane is not necessarily the plane formed by the mobile phone as a whole. coincident or parallel.
- a plane that meets the maximum degree of correlation and the best evaluation standard with the scanning state of the mobile phone is required.
- the focal plane of the mobile phone is parallel to the imaging plane, depending on the scanned object, the focal plane needs to be adjusted to coincide with the image plane. Therefore, in this embodiment, the imaging plane of the mobile phone is set as a reference for the tilt parameter.
- scanned text it can be placed flat in different positions, for example, it may be a horizontal desktop, it may be an inclined desk, and it may even be attached to a vertical wall or ceiling.
- Obtaining the preset tilt parameters of the mobile phone can be implemented according to actual scenarios, and is not limited to a specific method. Due to the above-mentioned defects in the prior art, this embodiment aims to ensure that the imaging plane of the mobile phone and the surface of the scanned text have corresponding inclination parameters as much as possible, such as being parallel. Therefore, generally, to acquire the preset tilt parameters, as long as the tilt parameters of the surface on which the text is scanned are obtained, the preset tilt parameters of the mobile phone can be correspondingly acquired and set.
- the relevant preset tilt parameters of the mobile phone can be directly obtained.
- the corresponding parameters of the scanned text can be sensed and obtained through sensors.
- the parameter preset module 1 can realize the acquisition of the preset tilt parameters for the mobile phone.
- the parameter acquisition module 2 acquires the current tilt parameter of the portable electronic device.
- the preset tilt parameters of the mobile phone it is also necessary to obtain the current tilt parameters of the mobile phone for comparison and calculation, and to determine whether the current pose of the mobile phone meets the above scanning requirements.
- the above-mentioned preset and current tilt parameters may include more than one kind, but they are calculated and compared in a one-to-one correspondence to obtain judgment results.
- the error between the current inclination parameter and the preset inclination parameter exceeds the preset range, it can be considered that scanning with the pose of the mobile phone at this time will not be able to obtain a satisfactory scanning result. Therefore, some necessary prompts can be sent to the user on the mobile phone; for example, the type of tilt parameter, the deviation angle, etc., so that the user can correct the scanning operation.
- the scanning control module 3 controls the mobile phone to scan the scanned text.
- the preset range can usually be set according to the requirements for scanning precision, for example, for higher scanning precision, the preset range can be set close to zero. Since the above conditions are met, it can be considered that the scanning of the mobile phone pose at this time can obtain the scanning results that meet the requirements, that is, the content is complete, and the deformation is controllable and small.
- the preset scanning condition is that the imaging plane of the portable electronic device is parallel to the surface of the scanning object; the tilt parameter is a horizontal tilt angle.
- the preset scanning condition is set in this embodiment to be that the imaging plane of the portable electronic device is parallel to the surface of the scanned object.
- set the tilt parameter as the horizontal tilt angle.
- Horizontal inclination that is, the angle formed by a straight line or plane and the horizontal plane.
- the preset horizontal inclination can represent the horizontality of the scanned text.
- the scanned text on a horizontal desktop has a horizontal inclination of 0°; correspondingly, if the preset scanning condition is that the mobile phone is parallel to the scanned text, the mobile phone
- the condition for scanning is also that the horizontal inclination angle is 0°.
- the preset scanning conditions may also include other setting methods besides the above-mentioned imaging plane of the portable electronic device being parallel to the surface of the scanning object.
- the error value of the horizontal inclination angle between the imaging plane of the portable electronic device and the surface of the scanning object is a preset interval.
- the error value of the horizontal inclination angle of the mobile phone and the surface of the scanned text is ⁇ 5°.
- a spirit level is a commonly used measuring tool for measuring angles, and is used to measure horizontal inclination, horizontal position and vertical position of equipment installation, etc. According to the shape of the level, it can be divided into universal level, column level, frame level, ruler level and so on.
- the level tube of the bubble-type universal level is made of glass.
- the inner wall of the level tube is a curved surface with a certain radius of curvature.
- the tube is filled with liquid.
- the air bubbles in the level tube will move toward the raised end of the level. , so as to determine the position of the horizontal plane.
- the larger the radius of curvature of the inner wall of the vial the higher the resolution and the higher the accuracy of the level.
- an inductive spirit level with a readout display has similar functionality.
- the mobile phone has the above-mentioned spirit level, and the appearance of the mobile phone is planar, which meets the requirement that the above-mentioned imaging plane is parallel to the overall plane of the mobile phone; then to make the mobile phone meet the preset scanning conditions, that is, the mobile phone is parallel to the scanned text, the following methods can be used accomplish:
- the imaging plane of the portable electronic device is parallel to the surface of the scanning object, and setting the tilt parameter as a horizontal inclination angle, it is ensured that the imaging plane of the portable device can be parallel to the surface of the scanning object during the scanning process, thereby The deformation of the scanned image due to the excessively large included angle between the above two planes is avoided, the quality and ease of handling of the scanned text are ensured, and the scanning effect is improved.
- the preset scanning condition is that the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the scanning object; the tilt parameter is a magnetic azimuth.
- Another difficulty in scanning text with portable devices such as mobile phones is that traditional scanning devices can place the scanned text at a fixed position to ensure that the scanned text is located in the imaging plane of the scanning device’s camera as a whole during the scanning, shooting and imaging process, and the scanning
- the central axis of the surface of the text is parallel or nearly parallel to the central axis of the imaging plane, so as to obtain a scanning result including a complete scan image with edges flush with the scanned text edges.
- Scanning by holding and other methods can usually ensure the overall imaging of the scanned text surface, but due to the above-mentioned reason that the pose of the mobile phone is not fixed, it is very easy to cause the final image due to the misalignment of the viewfinder frame during the shooting process.
- the scanned text is skewed and requires post-processing such as rotation and cutting.
- this embodiment sets the preset scanning condition to be that the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the scanned object. ;
- the tilt parameter is the magnetic azimuth.
- the magnetic azimuth is the direction of the compass pointer, which is the angle between the north end of the magnetic meridian passing through a certain point and the clockwise direction to a certain straight line (that is, the line connecting magnetic south and magnetic north on the north and south poles of the earth).
- a certain straight line that is, the line connecting magnetic south and magnetic north on the north and south poles of the earth.
- the magnetic declination angles of various places are different depending on the latitude and longitude. to obtain relatively accurate readings.
- the readings of the compass are obtained for the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanned object, in order to determine their relative relationship, so there is no influence of the above-mentioned magnetic declination on the two located at the same place.
- the preset magnetic azimuth can characterize the placement direction of the scanned text. Assuming that the scanned text is placed in a certain direction first, the imaging plane should also be in this direction according to the above preset scanning conditions.
- the preset scanning conditions may also include other setting methods besides the above-mentioned direction of the imaging plane of the portable electronic device being consistent with the surface of the scanning object.
- the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanning object are within a preset interval.
- the error value between the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanning object is ⁇ 5°.
- the mobile phone has a compass function, and the shape of the mobile phone is rectangular, then the following methods can be used to make the mobile phone meet the above preset scanning conditions:
- the reading ⁇ of the compass at this time is obtained as the preset magnetic azimuth, and the preset magnetic azimuth represents the placement direction of the scanned text surface. Adjusting the posture of the mobile phone during scanning according to the reading ⁇ can ensure that the imaging plane and the scanning text surface maintain a relatively consistent direction during the scanning process, and obtain better scanning results.
- the preset magnetic azimuth can also be obtained in other ways, such as aligning the mobile phone viewfinder with the scanned text in advance, and displaying vertical and horizontal indicator lines on the mobile phone viewfinder for easy alignment.
- aligning the mobile phone viewfinder with the scanned text in advance and displaying vertical and horizontal indicator lines on the mobile phone viewfinder for easy alignment.
- the imaging plane of the portable electronic device by setting the preset scanning condition that the imaging plane of the portable electronic device is consistent with the central axis direction of the scanning object surface, and setting the tilt parameter as the magnetic azimuth angle, the imaging plane of the portable electronic device and the scanning object surface are guaranteed during the scanning process.
- the orientation of the projection direction is consistent, thereby avoiding the imaging distortion of the scanned image due to the inconsistency of the directions of the above two planes, which is difficult to handle, and improving the quality of the scanned text.
- the scanning system of this embodiment also includes:
- a dynamic photographing module 41 configured to scan the surface of the scanned object through dynamic photographing to obtain at least two frames of images
- the target image acquiring module 42 is configured to acquire the target image from all the images, wherein in all the images, the absolute value of the difference between the tilt parameter corresponding to the target image and the preset tilt parameter is the smallest.
- the dynamic photographing module 41 scans the surface of the scanning object through dynamic photographing to obtain at least two frames of images, that is, continuously photographs the scanned text in the above-mentioned dynamic photographing manner to obtain continuous photographing images.
- the target image acquisition module 42 selects the image corresponding to the tilt parameter with the smallest absolute value of the difference between the preset tilt parameters based on the comparison with the preset tilt parameters from all the images obtained by the above-mentioned continuous shooting, as the target image, that is, the final scan results.
- the spirit level is a bubble-type disk spirit level with a four-quadrant two-dimensional coordinate scale of abscissa and ordinate, and the horizontal inclination can be obtained by reading the ordinate and abscissa of the bubble.
- the coordinate reading of the bubble of the level is (x’, y’)
- the coordinate reading of the bubble in it is obtained:
- (x i , y i ) are the coordinate readings of the bubbles of the spirit level in the i-th image, respectively. Therefore, corresponding to the finally obtained A i is the target image that meets the requirements, that is, the imaging plane of the mobile phone that is closest to the parallel to the surface of the scanned text when shooting.
- this embodiment is applicable to the application scenario where the tilt parameter is the magnetic azimuth, and in one application scenario, the above two current tilt parameters including at least the horizontal tilt and the magnetic azimuth can be combined with the respective preset The tilt parameters are compared, and the absolute value of the difference obtained separately can be comprehensively calculated according to a certain weight.
- the absolute value of the difference between the horizontal inclination of each picture and the preset horizontal inclination is T ⁇
- the absolute value of the difference between the horizontal inclination of each picture and the preset horizontal inclination is T ⁇
- the weight of the horizontal inclination consistent with the preset is set to 0.6
- the weight of the magnetic azimuth consistent with the preset is set to 0.4
- the comprehensive value of the absolute value of the difference between the tilt parameters of each picture S T ⁇ *0.6 +T ⁇ *0.4, so that among all the images obtained by continuous shooting, the S with the minimum value is obtained; the corresponding image is the target image.
- the tilt parameters in this embodiment include but are not limited to the above two manners and combinations.
- This embodiment makes full use of the dynamic shooting function of the portable electronic device, and overcomes the deviation of the scanned image caused by the unavoidable shaking during the shooting process by automatically selecting the best, thereby increasing the possibility of obtaining pictures that meet the quality requirements, and By replacing multiple scans with one continuous shooting, the scanning efficiency and scanning effect of portable devices are improved.
- the scanning system of this embodiment further includes:
- a panoramic shooting module 401 configured to scan the surface of the scanned object by panoramic shooting to obtain at least two frames of images
- a reference image acquisition module 402 configured to acquire a reference image from all images, wherein in all images, the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest;
- An affine transformation module 403, configured to perform affine transformation on images other than the reference image, so that the inclination parameters of the affine transformed image are consistent with the inclination parameters corresponding to the reference image;
- the panoramic image acquisition module 404 is configured to perform image fusion processing on the reference image and the affine transformed image to acquire a panoramic image.
- Panoramic photos usually refer to shooting that conforms to the normal effective angle of view of the human eye or includes the angle of view above the peripheral vision of both eyes or even a complete 360° scene range.
- Photo Most of the scanned text is A4 size paper, but there are also some special content such as scrolls, code texts, etc. that require long strips of scanned text with a large aspect ratio as the carrier.
- panoramic shooting in order to store all the text Scanning can be achieved by panoramic shooting.
- the phone is held for a long time, and the camera is prone to shake and shift, resulting in poor shooting results.
- the long text scanning technology provided in this embodiment improves on the above defects caused by the unstable pose of the scanning device during the scanning process.
- the panoramic shooting module 401 scans the surface of the scanning object through dynamic shooting to obtain at least two frames of images, that is, continuously shoots the scanned text through the above-mentioned dynamic shooting method to obtain continuous shooting images.
- the reference image acquisition module 402 selects the image corresponding to the tilt parameter with the smallest absolute value of the preset tilt parameter difference as the reference image from all the images obtained by the continuous shooting, based on the comparison with the preset tilt parameter.
- the reference image acquisition module 402 can also evaluate the horizontal inclination, magnetic azimuth and other inclination parameters, and the evaluation results can also be combined and evaluated in different ways such as weights as described in the previous embodiment. Let me repeat.
- the reference image acquisition module 402 obtains the reference image from all captured images as a reference basis for feature detection and feature matching, because in all images, the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest , it can be considered that the reference image has a strong pose reference evaluation significance.
- the panorama image generation result based on the tilt parameters of the reference image and other image features can also better restore the content of the scanned text.
- the affine transformation module 403 performs affine transformation on images other than the reference image, so that the inclination parameters of the affine transformed image are consistent with the inclination parameters corresponding to the reference image.
- Affine transformation also known as affine mapping, refers to performing a linear transformation in a vector space in geometry followed by a translation to transform it into another vector space.
- the calculation process may include translation, rotation, scaling, shearing, and reflection; the calculated results have characteristics: the line segments are still line segments after the affine transformation and the ratio between them remains unchanged.
- other images are affine transformed based on the reference image to obtain a group of images, which can ensure the quality of the panoramic image.
- the panoramic image acquisition module 404 performs image fusion processing on the reference image and the affine transformed image to acquire a panoramic image. Since the image after affine transformation has a high degree of fitting of feature points, the accuracy of feature point extraction, matching, and registration for each image is higher when performing image fusion stitching, and the overlapping boundaries of each image are more accurate. The processing is more precise, resulting in better panoramic images.
- This embodiment uses the panoramic image dynamic shooting function of the portable electronic device to scan long texts, and obtains the reference image based on the tilt parameters, thereby ensuring that a more accurate panoramic image can be generated, and solving the problems caused by human operation errors in the shooting process in the past.
- Panoramic image distortion and lower quality issues improve the scanning performance of long text on portable devices.
- the panoramic shooting module 401 is also used to acquire the scanning distance corresponding to the image, and the scanning distance is the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction.
- the scanning distance corresponding to the reference image is the reference scanning distance; the panoramic image acquisition module 404 is also configured to make the scanning distance of the affine transformed image consistent with the reference scanning distance.
- the TOF camera is a 3D camera that uses a modulated light source to illuminate the scene and observe the reflected light for distance measurement. It uses the TOF measurement principle to determine the distance between the camera and the object or the surrounding environment, and generates a depth image or 3D image through the measured points.
- the distance principle is to measure the time required for light to travel a certain distance in a medium, usually the time it takes for the pulsed emitted light to reach the object and reflect back to the sensor. Since the TOF camera can collect depth of field information and obtain more image details, it can not only obtain more high-precision feature points for subsequent image fusion operations, but also obtain finer scanning effects. In this embodiment, the precise scanning distance is obtained by the TOF camera, which is helpful for more accurate feature matching in the process of image fusion.
- the reference image has a higher reference significance in the process of generating the panoramic image, further improves the accuracy of the panoramic image, and further improves the image distortion problem of long text scanning And improved the scanning effect of portable devices for long text.
- the scanning system of this embodiment further includes:
- the imaging area analysis module 51 is configured to obtain at least two sets of correspondences between scanning distances and the area ratio of the scanning object within the imaging area of the portable electronic device under the scanning distances. It can be understood that the scanning distance is the same as that in the previous embodiment, which is the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction.
- An optimal distance determination module 52 configured to determine an optimal scanning distance based on the correspondence
- the first prompt information module 53 is configured to generate first prompt information, which includes the optimal scanning distance.
- the imaging area analysis module 51 can detect that the distance between the camera of the portable electronic device and the surface of the scanned object changes in the focal length direction during the scanning preparation process, that is, the focusing stage, or during the scanning process. Detect and obtain parameters such as text range and text edge, and on this basis, obtain at least two sets of corresponding relationships between scanning distances and the above-mentioned area ratios. Based on this, the optimal distance determination module 52 calculates which distance should be used for scanning based on the placement position of the current scanning object, and the distance is the optimal scanning distance.
- the optimal scanning distance is the scanning distance at which the area ratio a/a' is the maximum value while ensuring that the edges of the text all fall into the aforementioned imaging area a'.
- the first prompt information module 53 displays the optimal scanning distance to help the user adjust the portable electronic device in time to scan more accurately.
- the area ratio of the scanned text is obtained by analyzing the imaged area of the scanned text, and then the optimal scanning distance for the scanned text is determined and prompted to the user, thereby helping to obtain a better scanning effect. Get the highest possible scan clarity while ensuring scan productivity.
- the scanning system further includes a second prompt information module, configured to generate second prompt information when the error between the current tilt parameter and the preset tilt parameter exceeds a preset range, and the second prompt information It is used to prompt the user to adjust the portable electronic device to reduce the error within the preset range.
- a second prompt information module configured to generate second prompt information when the error between the current tilt parameter and the preset tilt parameter exceeds a preset range, and the second prompt information It is used to prompt the user to adjust the portable electronic device to reduce the error within the preset range.
- the second prompt information module when the inclination parameter is the horizontal inclination, if the current horizontal inclination is 30°, the preset horizontal inclination is 5°, and the preset error range is 10°; then the current horizontal inclination and the preset horizontal inclination If the error of 25° exceeds the preset range, the second prompt information module generates second prompt information.
- the absolute value of the difference between the current horizontal inclination and the preset horizontal inclination can be displayed in real time, and a green arrow is displayed when it is detected that the absolute value is close to the above-mentioned preset range value; A red warning arrow is displayed when the range value is preset.
- the tilt parameter is magnetic azimuth
- the preset magnetic azimuth is 5° north by west, and the preset error range is 10°; then the current magnetic azimuth
- the second prompt information module generates second prompt information.
- the absolute value of the difference between the current magnetic azimuth and the preset magnetic azimuth can be displayed on the electronic device in real time, and an arrow can be displayed to indicate the direction in which the user should turn the portable electronic device.
- the color of the arrow can be detected A green arrow is displayed when the absolute value of the difference is close to the preset range value; otherwise, a red warning arrow is displayed when the absolute value is detected to be far from the preset range value.
- a targeted prompt is generated to help the user correct the deviation, which is beneficial to obtain a better scanning effect and improves user experience.
- This embodiment provides a scanning system for a portable electronic device, so that the portable electronic device maintains a reasonable posture during the scanning process, thereby ensuring the accuracy of the scanning result, improving the efficiency of the scanning operation, and making the scanning result more suitable. For post-processing such as cropping.
- FIG. 6 is a schematic structural diagram of an electronic device provided by Embodiment 3 of the present invention.
- the electronic device includes a memory, a processor, and a computer program stored in the memory and operable on the processor. When the processor executes the program, the scanning method of the portable electronic device in Embodiment 1 is realized.
- the electronic device 30 shown in FIG. 6 is only an example, and should not limit the functions and scope of use of the embodiments of the present invention.
- the electronic device 30 may be in the form of a general-purpose computing device, for example, it may be a server device.
- Components of the electronic device 30 may include, but are not limited to: at least one processor 31 , at least one memory 32 , and a bus 33 connecting different system components (including the memory 32 and the processor 31 ).
- the bus 33 includes a data bus, an address bus, and a control bus.
- the memory 32 may include a volatile memory, such as a random access memory (RAM) 321 and/or a cache memory 322 , and may further include a read only memory (ROM) 323 .
- RAM random access memory
- ROM read only memory
- Memory 32 may also include a program/utility tool 325 having a set (at least one) of program modules 324 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, which Each or some combination of the examples may include the implementation of a network environment.
- program/utility tool 325 having a set (at least one) of program modules 324 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, which Each or some combination of the examples may include the implementation of a network environment.
- the processor 31 executes various functional applications and data processing by running the computer program stored in the memory 32 , such as the scanning method of the portable electronic device in Embodiment 1 of the present invention.
- Electronic device 30 may also communicate with one or more external devices 34 (eg, keyboards, pointing devices, etc.). Such communication may occur through input/output (I/O) interface 35 .
- the model generation device 30 can also communicate with one or more networks (eg, a local area network (LAN), a wide area network (WAN) and/or a public network, such as the Internet) via a network adapter 36 .
- network adapter 36 communicates with other modules of model generation device 30 via bus 33 .
- model generating device 30 may be used in conjunction with the model generating device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.
- This embodiment provides a computer-readable storage medium, on which a computer program is stored.
- the program is executed by a processor, the scanning method for the portable electronic device in Embodiment 1 is implemented.
- the readable storage medium that can be used more specifically may include, but is not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device or any of the above-mentioned the right combination.
- the present invention can also be implemented in the form of a program product, which includes program code.
- program product runs on the terminal device
- the program code is used to make the terminal device execute the portable In scanning methods for electronic devices.
- program code for executing the present invention may be written in any combination of one or more programming languages, and the program code may be completely executed on the user equipment, partially executed on the user equipment, or used as an independent software Package execution, partly on the user device and partly on the remote device, or entirely on the remote device.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Studio Devices (AREA)
Abstract
Disclosed in the present invention are a scanning method and system for a portable electronic device, and an electronic device and a storage medium. The scanning method comprises the following steps: acquiring a preset inclination parameter of a portable electronic device when an imaging plane of the portable electronic device and the surface of a scanning object meet a preset scanning condition; acquiring a current inclination parameter of the portable electronic device; and if the difference between the current inclination parameter and the preset inclination parameter is within a preset range, controlling the portable electronic device to scan the surface of the scanning object. By means of the scanning method and system for a portable electronic device, and the electronic device and the storage medium provided in the present invention, the portable electronic device is maintained at a reasonable pose during a scanning process, thereby ensuring the precision of a scanning result, improving the efficiency of a scanning operation, and also making the scanning result more suitable for post-processing such as cropping.
Description
本发明涉及计算机技术领域,具体涉及一种便携式电子设备的扫描方法及系统、电子设备及存储介质。The invention relates to the technical field of computers, in particular to a scanning method and system of a portable electronic device, the electronic device and a storage medium.
越来越多的便携式电子设备借助强大的拍摄功能和图形图像处理能力,具备足以媲美传统扫描仪的文档扫描功能。More and more portable electronic devices are equipped with document scanning functions comparable to traditional scanners by virtue of powerful shooting functions and graphics and image processing capabilities.
然而手机等便携式电子设备在扫描时,由于通常需要用户手持操作,而对于大多数用户来说,在一次手持扫描尤其是对于长文本的手持扫描过程中,始终持稳电子设备以将其保持在同一平面也绝非易事。这样就会导致拍摄过程中便携式电子设备并不稳定,扫描得到的图像容易变形失真,内容倾斜残缺,影响对文本的识别率及精度,甚至难以进行后期处理。However, when portable electronic devices such as mobile phones are scanned, the user usually needs to hold the operation, and for most users, during a hand-held scan, especially for a long text, the electronic device should always be held firmly to keep it in the The same plane is by no means easy. This will cause the portable electronic device to be unstable during the shooting process, and the scanned image will be easily deformed and distorted, and the content will be skewed and incomplete, which will affect the recognition rate and accuracy of the text, and even make post-processing difficult.
目前一些便携式电子设备通过设置额外的支架等设备以便在扫描过程中固定位姿,但这样不仅要占用多余空间,还大大降低了便携式电子设备作为扫描工具的便携性和操作简易性。At present, some portable electronic devices use additional brackets and other equipment to fix the pose during the scanning process, but this not only takes up extra space, but also greatly reduces the portability and ease of operation of portable electronic devices as scanning tools.
发明内容Contents of the invention
本发明要解决的技术问题是为了克服现有技术中对扫描设备的位姿难以控制导致扫描效果不佳的缺陷,提供一种便携式电子设备的扫描方法及系统、电子设备及存储介质。The technical problem to be solved by the present invention is to provide a scanning method and system for a portable electronic device, an electronic device and a storage medium in order to overcome the defects in the prior art that it is difficult to control the position and posture of the scanning device resulting in poor scanning effect.
本发明是通过下述技术方案来解决上述技术问题:The present invention solves the above technical problems through the following technical solutions:
本发明提供了一种便携式电子设备的扫描方法,所述扫描方法包括以下步骤:The invention provides a scanning method of a portable electronic device, and the scanning method comprises the following steps:
获取所述便携式电子设备的成像平面与扫描对象表面之间满足预设扫描条件时,所述便携式电子设备的预设的倾斜参数;Acquiring a preset tilt parameter of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object;
获取所述便携式电子设备的当前的倾斜参数;Acquiring the current tilt parameter of the portable electronic device;
若所述当前的倾斜参数与所述预设的倾斜参数的误差处于预设范围内,则控制所述便携式电子设备对所述扫描对象表面进行扫描。If the error between the current tilt parameter and the preset tilt parameter is within a preset range, the portable electronic device is controlled to scan the surface of the scanning object.
较佳地,所述预设扫描条件包括:所述便携式电子设备的成像平面与所述扫描对象表 面平行;所述倾斜参数包括水平倾角。Preferably, the preset scanning conditions include: the imaging plane of the portable electronic device is parallel to the surface of the scanning object; the tilt parameters include a horizontal tilt angle.
较佳地,所述预设扫描条件包括:所述便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴平行;所述倾斜参数包括磁方位角。Preferably, the preset scanning conditions include: the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the object to be scanned; the tilt parameter includes a magnetic azimuth.
较佳地,所述扫描方法还包括:Preferably, the scanning method also includes:
对所述扫描对象表面通过动态拍摄进行扫描,以获得至少两帧图像;Scanning the surface of the scanning object by dynamic shooting to obtain at least two frames of images;
从所有图像中获取目标图像,其中在所有图像中,所述目标图像对应的倾斜参数与所述预设的倾斜参数的差值绝对值最小。The target image is acquired from all the images, wherein in all the images, the absolute value of the difference between the tilt parameter corresponding to the target image and the preset tilt parameter is the smallest.
较佳地,所述扫描方法还包括:Preferably, the scanning method also includes:
对所述扫描对象表面通过全景拍摄进行扫描,以获得至少两帧图像;Scanning the surface of the scanning object by panoramic shooting to obtain at least two frames of images;
从所有图像中获取基准图像,其中在所有图像中,所述基准图像对应的倾斜参数与所述预设的倾斜参数的差值绝对值最小;Obtaining a reference image from all images, wherein in all images, the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest;
对所述基准图像以外的图像进行仿射变换,以使仿射变换后的图像的倾斜参数与所述基准图像对应的倾斜参数一致;performing affine transformation on images other than the reference image, so that the tilt parameters of the affine transformed image are consistent with the tilt parameters corresponding to the reference image;
对所述基准图像以及仿射变换后的图像进行图像融合处理,以获取全景图像。Perform image fusion processing on the reference image and the image after affine transformation to obtain a panoramic image.
较佳地,所述对所述扫描对象表面通过全景拍摄进行扫描,以获得至少两帧图像的步骤还包括:获取所述图像对应的扫描距离,所述扫描距离为所述便携式电子设备的摄像头在焦距方向上到所述扫描对象表面的距离;Preferably, the step of scanning the surface of the scanning object by panoramic shooting to obtain at least two frames of images further includes: obtaining a scanning distance corresponding to the image, and the scanning distance is the distance of the camera of the portable electronic device The distance to the surface of the scanning object in the focal length direction;
所述基准图像对应的扫描距离为基准扫描距离;The scan distance corresponding to the reference image is the reference scan distance;
所述对所述基准图像以外的图像进行仿射变换的步骤还使仿射变换后的图像的扫描距离与所述基准扫描距离一致。The step of performing affine transformation on images other than the reference image also makes the scanning distance of the image after affine transformation consistent with the reference scanning distance.
较佳地,所述扫描方法还包括:Preferably, the scanning method also includes:
获取至少两组扫描距离与所述扫描距离下所述扫描对象在所述便携式电子设备的成像区域内的面积占比的对应关系;所述扫描距离为所述便携式电子设备的摄像头在焦距方向上到所述扫描对象表面的距离;Acquiring at least two sets of correspondences between scanning distances and the area ratio of the scanning object in the imaging area of the portable electronic device under the scanning distances; the scanning distance is the focal length direction of the camera of the portable electronic device the distance to the surface of the scanned object;
基于所述对应关系确定最佳扫描距离;determining an optimal scanning distance based on the correspondence;
生成第一提示信息,所述第一提示信息包括所述最佳扫描距离。Generate first prompt information, where the first prompt information includes the optimal scanning distance.
较佳地,所述获取所述便携式电子设备的当前的倾斜参数的步骤之后还包括:Preferably, after the step of acquiring the current tilt parameter of the portable electronic device, it further includes:
若所述当前的倾斜参数与所述预设的倾斜参数的误差超过预设范围,则生成第二提示信息,所述第二提示信息用于提示用户调整所述便携式电子设备,以使所述误差缩小至所 述预设范围内。If the error between the current tilt parameter and the preset tilt parameter exceeds a preset range, second prompt information is generated, and the second prompt information is used to prompt the user to adjust the portable electronic device so that the The error is reduced to within the preset range.
本发明还提供了一种便携式电子设备的扫描系统,所述扫描系统包括:The present invention also provides a scanning system of a portable electronic device, the scanning system comprising:
参数预设模块,用于获取所述便携式电子设备的成像平面与扫描对象表面之间满足预设扫描条件时,所述便携式电子设备的预设的倾斜参数;A parameter preset module, configured to obtain a preset tilt parameter of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object;
参数获取模块,用于获取所述便携式电子设备的当前的倾斜参数;A parameter acquisition module, configured to acquire the current tilt parameter of the portable electronic device;
扫描控制模块,用于在所述当前的倾斜参数与所述预设的倾斜参数的误差处于预设范围内时,控制所述便携式电子设备对所述扫描对象表面进行扫描。A scanning control module, configured to control the portable electronic device to scan the surface of the scanning object when the error between the current tilt parameter and the preset tilt parameter is within a preset range.
较佳地,所述预设扫描条件包括:所述便携式电子设备的成像平面与所述扫描对象表面平行;所述倾斜参数包括水平倾角。Preferably, the preset scanning condition includes: the imaging plane of the portable electronic device is parallel to the surface of the scanning object; the tilt parameter includes a horizontal tilt angle.
较佳地,所述预设扫描条件包括:所述便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴平行;所述倾斜参数包括磁方位角。Preferably, the preset scanning conditions include: the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the object to be scanned; the tilt parameter includes a magnetic azimuth.
较佳地,所述扫描系统还包括:Preferably, the scanning system also includes:
动态拍摄模块,用于对所述扫描对象表面通过动态拍摄进行扫描,以获得至少两帧图像;A dynamic shooting module, configured to scan the surface of the scanned object by dynamic shooting to obtain at least two frames of images;
目标图像获取模块,用于从所有图像中获取目标图像,其中在所有图像中,所述目标图像对应的倾斜参数与所述预设的倾斜参数的差值绝对值最小。The target image acquiring module is configured to acquire the target image from all the images, wherein in all the images, the absolute value of the difference between the tilt parameter corresponding to the target image and the preset tilt parameter is the smallest.
较佳地,所述扫描系统还包括:Preferably, the scanning system also includes:
全景拍摄模块,用于对所述扫描对象表面通过全景拍摄进行扫描,以获得至少两帧图像;A panoramic shooting module, configured to scan the surface of the scanning object by panoramic shooting to obtain at least two frames of images;
基准图像获取模块,用于从所有图像中获取基准图像,其中在所有图像中,所述基准图像对应的倾斜参数与所述预设的倾斜参数的差值绝对值最小;A reference image acquisition module, configured to obtain a reference image from all images, wherein in all images, the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest;
仿射变换模块,用于对所述基准图像以外的图像进行仿射变换,以使仿射变换后的图像的倾斜参数与所述基准图像对应的倾斜参数一致;An affine transformation module, configured to perform affine transformation on images other than the reference image, so that the tilt parameters of the affine transformed image are consistent with the tilt parameters corresponding to the reference image;
全景图像获取模块,用于对所述基准图像以及仿射变换后的图像进行图像融合处理,以获取全景图像。A panoramic image acquisition module, configured to perform image fusion processing on the reference image and the image after affine transformation, so as to acquire a panoramic image.
较佳地,所述全景拍摄模块还用于:获取所述图像对应的扫描距离,所述扫描距离为所述便携式电子设备的摄像头在焦距方向上到所述扫描对象表面的距离;Preferably, the panoramic shooting module is further configured to: acquire a scanning distance corresponding to the image, the scanning distance being the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction;
所述基准图像对应的扫描距离为基准扫描距离;The scan distance corresponding to the reference image is the reference scan distance;
所述仿射变换模块还用于使仿射变换后的图像的扫描距离与所述基准扫描距离一致。The affine transformation module is further configured to make the scanning distance of the affine transformed image consistent with the reference scanning distance.
较佳地,所述扫描系统还包括:Preferably, the scanning system also includes:
成像区域分析模块,用于获取至少两组扫描距离与所述扫描距离下所述扫描对象在所述便携式电子设备的成像区域内的面积占比的对应关系;所述扫描距离为所述便携式电子设备的摄像头在焦距方向上到所述扫描对象表面的距离;The imaging area analysis module is used to obtain the corresponding relationship between at least two sets of scanning distances and the area ratio of the scanning object in the imaging area of the portable electronic device under the scanning distance; the scanning distance is the The distance from the camera of the device to the surface of the scanned object in the focal length direction;
最佳距离确定模块,用于基于所述对应关系确定最佳扫描距离;An optimal distance determination module, configured to determine an optimal scanning distance based on the correspondence;
第一提示信息模块,用于生成第一提示信息,所述第一提示信息包括所述最佳扫描距离。The first prompt information module is configured to generate first prompt information, where the first prompt information includes the optimal scanning distance.
较佳地,所述扫描系统还包括:Preferably, the scanning system also includes:
第二提示信息模块,用于当所述当前的倾斜参数与所述预设的倾斜参数的误差超过预设范围时生成第二提示信息,所述第二提示信息用于提示用户调整所述便携式电子设备,以使所述误差缩小至所述预设范围内。The second prompt information module is configured to generate second prompt information when the error between the current tilt parameter and the preset tilt parameter exceeds a preset range, and the second prompt information is used to prompt the user to adjust the portable Electronic equipment, so that the error is reduced to within the preset range.
本发明还提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述的便携式电子设备的扫描方法。The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and operable on the processor. When the processor executes the computer program, the above-mentioned scanning method of the portable electronic device is realized. .
本发明还提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述的便携式电子设备的扫描方法。The present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above scanning method for a portable electronic device is realized.
本发明的积极进步效果在于:通过提供一种便携式电子设备的扫描方法及系统、电子设备及存储介质,使得便携式电子设备在扫描过程中保持合理的位姿,从而能够确保扫描成果的精度,提高了扫描操作的效率,也使得扫描的成果更适于进行裁剪等后处理。The positive and progressive effect of the present invention is: by providing a scanning method and system for a portable electronic device, an electronic device and a storage medium, the portable electronic device can maintain a reasonable posture during the scanning process, thereby ensuring the accuracy of the scanning result and improving the accuracy of the scanning result. It improves the efficiency of the scanning operation and makes the scanned results more suitable for post-processing such as cropping.
图1为本发明的实施例1的便携式电子设备的扫描方法的流程图。FIG. 1 is a flowchart of a scanning method of a portable electronic device according to Embodiment 1 of the present invention.
图2为本发明的实施例1中获取预设的磁方位角的示意图。FIG. 2 is a schematic diagram of obtaining a preset magnetic azimuth in Embodiment 1 of the present invention.
图3为本发明的实施例1中获取水平仪读数的示意图。Fig. 3 is a schematic diagram of obtaining level readings in Embodiment 1 of the present invention.
图4为本发明的实施例1中的扫描对象和成像区域的示意图。FIG. 4 is a schematic diagram of a scanning object and an imaging area in Embodiment 1 of the present invention.
图5为本发明的实施例2的便携式电子设备的扫描系统的模块示意图。FIG. 5 is a block diagram of a scanning system of a portable electronic device according to Embodiment 2 of the present invention.
图6为本发明的实施例3的电子设备的结构框图。FIG. 6 is a structural block diagram of an electronic device according to Embodiment 3 of the present invention.
下面通过实施例的方式进一步说明本发明,但并不因此将本发明限制在所述的实施例范围之中。The present invention is further illustrated below by means of examples, but the present invention is not limited to the scope of the examples.
实施例1Example 1
参见图1所示,本实施例具体提供了一种便携式电子设备的扫描方法,包括以下步骤:Referring to Fig. 1, the present embodiment specifically provides a scanning method of a portable electronic device, comprising the following steps:
S1.获取便携式电子设备的成像平面与扫描对象表面之间满足预设扫描条件时,便携式电子设备的预设的倾斜参数。S1. Acquiring a preset tilt parameter of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object.
S2.获取便携式电子设备的当前的倾斜参数。S2. Obtain the current tilt parameter of the portable electronic device.
S3.若当前的倾斜参数与预设的倾斜参数的误差处于预设范围内,则控制便携式电子设备对扫描对象表面进行扫描。S3. If the error between the current tilt parameter and the preset tilt parameter is within a preset range, control the portable electronic device to scan the surface of the scanning object.
本实施例中的便携式电子设备是带有图像拍摄功能的电子设备;包括但不限于手机及平板电脑。较佳地,该电子设备的拍摄分辨率符合扫描的分辨率要求,例如通常对于文档扫描要求分辨率达到200dpi(Dots Per Inch,每英寸点数),则对应的电子设备的最高分辨率应该能达到相应的参数,以满足200dpi的扫描分辨率。为便于说明,本实施例中仅以手机为例描述便携式电子设备的扫描方法。同样,对于扫描对象,通常是矩形纸张内的文本、图案或其结合,通常扫描对象具有相对平展的表面,本实施例中仅以上述扫描文本作为扫描对象为例进行说明。可以理解,本实施例的扫描方法并不限于对上述手机和扫描文本的应用场景。The portable electronic device in this embodiment is an electronic device with an image capturing function; including but not limited to a mobile phone and a tablet computer. Preferably, the shooting resolution of the electronic device meets the scanning resolution requirements. For example, the document scanning usually requires a resolution of 200dpi (Dots Per Inch, dots per inch), then the highest resolution of the corresponding electronic device should be able to reach Corresponding parameters to meet the scanning resolution of 200dpi. For ease of description, this embodiment only uses a mobile phone as an example to describe the scanning method of a portable electronic device. Similarly, for the scanned object, it is usually text, pattern or a combination thereof in a rectangular paper, and usually the scanned object has a relatively flat surface. In this embodiment, only the above-mentioned scanned text is used as the scanned object for illustration. It can be understood that the scanning method in this embodiment is not limited to the above-mentioned application scenarios of mobile phones and scanning text.
步骤S1获取便携式电子设备的成像平面与扫描对象表面之间满足预设扫描条件时,便携式电子设备的预设的倾斜参数。Step S1 acquires a preset tilt parameter of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object.
通常扫描文件或证件时由于采用专业的扫描仪固定压纸,因此不会存在扫描过程中拍摄角度的变换造成的扫描结果变形。然而采用手持手机扫描的过程很难保证手机摄像头与扫描文本之间平行,所扫描的文本很容易倾斜且内容不全。即使通过扫描软件后期矫正也有较大困难,例如由于原本是矩形的文本被拍摄为不规则四边形,后期矫正处理可能需要将文本调节为梯形或者为了保证文本的形状而缩减文本内容。Usually, when scanning documents or certificates, professional scanners are used to fix the pressing paper, so there will be no deformation of the scanning results caused by the change of the shooting angle during the scanning process. However, it is difficult to ensure that the camera of the mobile phone is parallel to the scanned text in the process of scanning with a handheld mobile phone, and the scanned text is easily skewed and the content is incomplete. Even post-correction by scanning software is difficult. For example, because the original rectangular text is captured as a trapezoid, post-correction processing may require adjusting the text to a trapezoid or reducing the text content to ensure the shape of the text.
因此,为了确保手机在扫描过程中能够保持合理的位姿进行针对扫描文本的拍摄,步骤S1首先获取手机的成像平面在满足扫描文本表面符合预设扫描条件时的倾斜参数,该预设扫描条件可以被认为是在扫描文本处于相对静态环境的情况下,手机基于扫描文本进行的位姿参数取样,目的在于,基于该取样结果,使手机获得一预设的倾斜参数,根据该倾斜参数执行扫描操作时,满足相对理想的位姿状态,获得符合要求的扫描效果。Therefore, in order to ensure that the mobile phone can maintain a reasonable posture during the scanning process to shoot the scanned text, step S1 first obtains the tilt parameters of the imaging plane of the mobile phone when the surface of the scanned text meets the preset scanning conditions. The preset scanning conditions It can be considered as the pose parameter sampling performed by the mobile phone based on the scanned text when the scanned text is in a relatively static environment. The purpose is to obtain a preset tilt parameter for the mobile phone based on the sampling result, and perform scanning according to the tilt parameter. During operation, satisfy the relatively ideal pose state and obtain the scanning effect that meets the requirements.
其中,手机的成像平面即像平面,手机成像平面就是CCD(charge coupled device,电荷耦合器件)等感光元件。通常和呈平板状的手机外形是平行的,但也不排除一些电子设备设计中手机外形较为独特或摄像头的设置位置在手机侧方等情况,则此时成像平面不一定和手机整体形成的平面重合或平行。而获取手机预设的倾斜参数,需要和手机扫描状态符合最大关联度和最佳评价标准的平面。虽然理论上手机的焦平面平行于成像平面,但由于根据扫描对象的不同,焦平面需要经调焦操作才会与像平面重合,因此本实施例中设置手机的成像平面作为倾斜参数的参考。Among them, the imaging plane of the mobile phone is the image plane, and the imaging plane of the mobile phone is a photosensitive element such as a CCD (charge coupled device, charge coupled device). Usually, it is parallel to the shape of the tablet-shaped mobile phone, but it does not rule out that the shape of the mobile phone is relatively unique in the design of some electronic devices or the camera is installed on the side of the mobile phone, etc., then the imaging plane is not necessarily the plane formed by the mobile phone as a whole. coincident or parallel. To obtain the preset tilt parameters of the mobile phone, a plane that meets the maximum degree of correlation and the best evaluation standard with the scanning state of the mobile phone is required. Although theoretically the focal plane of the mobile phone is parallel to the imaging plane, depending on the scanned object, the focal plane needs to be adjusted to coincide with the image plane. Therefore, in this embodiment, the imaging plane of the mobile phone is set as a reference for the tilt parameter.
对于扫描文本,则可以平展放置于不同的位置,例如可能是水平的桌面,也可能是倾斜的书案,甚至可能是贴设于竖直的墙上或天花板。For scanned text, it can be placed flat in different positions, for example, it may be a horizontal desktop, it may be an inclined desk, and it may even be attached to a vertical wall or ceiling.
获取手机的预设的倾斜参数可以根据实际场景实现,并不局限于某种特定的方式。由于上述现有技术的缺陷,本实施例旨在最大可能保证手机的成像平面和扫描文本的表面具有相应的倾斜参数即可,例如平行。因此,通常预设的倾斜参数的获取只要取得扫描文本的表面的倾斜参数,就可以相应地获取和设置手机的预设倾斜参数。Obtaining the preset tilt parameters of the mobile phone can be implemented according to actual scenarios, and is not limited to a specific method. Due to the above-mentioned defects in the prior art, this embodiment aims to ensure that the imaging plane of the mobile phone and the surface of the scanned text have corresponding inclination parameters as much as possible, such as being parallel. Therefore, generally, to acquire the preset tilt parameters, as long as the tilt parameters of the surface on which the text is scanned are obtained, the preset tilt parameters of the mobile phone can be correspondingly acquired and set.
例如对于用于放置扫描文本的桌面,如果是已知的水平桌面或竖直墙面,则可以直接获取手机的相关预设的倾斜参数。又如可以通过传感器感知并获取扫描文本相应的参数。在此基础上,步骤S1就能实现对于手机预设的倾斜参数的获取。For example, if the desktop for placing the scanned text is a known horizontal desktop or a vertical wall, the relevant preset tilt parameters of the mobile phone can be directly obtained. Another example is that the corresponding parameters of the scanned text can be sensed and obtained through sensors. On this basis, step S1 can realize the acquisition of the preset tilt parameters for the mobile phone.
步骤S2获取便携式电子设备的当前的倾斜参数。如上所述,在获取了手机预设的倾斜参数的情况下,还需要获取手机当前的倾斜参数用于与之进行对比计算,并判断手机的当前位姿是否符合上述扫描要求。当然,上述预设和当前的倾斜参数均可能包括不止一种,但在计算和对比时是分别一一对应进行以获得判断结果。Step S2 obtains the current tilt parameter of the portable electronic device. As mentioned above, in the case of obtaining the preset tilt parameters of the mobile phone, it is also necessary to obtain the current tilt parameters of the mobile phone for comparison and calculation, and to determine whether the current pose of the mobile phone meets the above scanning requirements. Of course, the above-mentioned preset and current tilt parameters may include more than one kind, but they are calculated and compared in a one-to-one correspondence to obtain judgment results.
如果当前的倾斜参数和预设的倾斜参数的误差超出了预设范围,则可以认为此时的手机位姿进行扫描将无法得到符合要求的扫描结果。因此,可以在手机上向用户发出一些必要的提示;例如倾斜参数的种类、偏差角度等,以使用户对扫描操作予以纠偏。If the error between the current inclination parameter and the preset inclination parameter exceeds the preset range, it can be considered that scanning with the pose of the mobile phone at this time will not be able to obtain a satisfactory scanning result. Therefore, some necessary prompts can be sent to the user on the mobile phone; for example, the type of tilt parameter, the deviation angle, etc., so that the user can correct the scanning operation.
反之,如果当前的倾斜参数和预设的倾斜参数的误差处于预设范围内,则步骤S3控制手机对于扫描文本进行扫描。该预设范围通常可以根据对扫描精度的要求来设定,例如对于较高的扫描精度可以将预设范围设定为接近于零。由于满足上述条件,可以认为此时的手机位姿进行扫描能够得到符合要求的扫描结果,即内容完整,形变可控且较小。On the contrary, if the error between the current tilt parameter and the preset tilt parameter is within the preset range, step S3 controls the mobile phone to scan the scanned text. The preset range can usually be set according to the requirements for scanning precision, for example, for higher scanning precision, the preset range can be set close to zero. Since the above conditions are met, it can be considered that the scanning of the mobile phone pose at this time can obtain the scanning results that meet the requirements, that is, the content is complete, and the deformation is controllable and small.
作为一种可选的实施方式,预设扫描条件为便携式电子设备的成像平面与扫描对象表面平行。倾斜参数为水平倾角。As an optional implementation manner, the preset scanning condition is that the imaging plane of the portable electronic device is parallel to the surface of the scanning object. The tilt parameter is the horizontal tilt angle.
为了克服手机的成像平面和扫描文本的表面的不平行导致的上述问题,本实施方式设定预设扫描条件为便携式电子设备的成像平面与扫描对象表面平行。相应地,设定倾斜参数为水平倾角。水平倾角,即直线或平面与水平面形成的夹角。预设的水平倾角可以表征扫描文本的放置的水平程度,例如在水平的桌面上的扫描文本,则其水平倾角为0°;相应地,如果预设扫描条件为手机与扫描文本平行,则手机进行扫描的条件同样也是水平倾角为0°。当然本领域技术人员可以知晓,预设扫描条件除了上述便携式电子设备的成像平面与扫描对象表面平行之外,也可以包括其他设置方式。例如,便携式电子设备的成像平面与扫描对象表面的水平倾角的误差值为一预设区间。具体地,例如手机和扫描文本表面的水平倾角的误差值为±5°。In order to overcome the above-mentioned problems caused by the non-parallel between the imaging plane of the mobile phone and the surface of the scanned text, the preset scanning condition is set in this embodiment to be that the imaging plane of the portable electronic device is parallel to the surface of the scanned object. Correspondingly, set the tilt parameter as the horizontal tilt angle. Horizontal inclination, that is, the angle formed by a straight line or plane and the horizontal plane. The preset horizontal inclination can represent the horizontality of the scanned text. For example, the scanned text on a horizontal desktop has a horizontal inclination of 0°; correspondingly, if the preset scanning condition is that the mobile phone is parallel to the scanned text, the mobile phone The condition for scanning is also that the horizontal inclination angle is 0°. Of course, those skilled in the art will know that the preset scanning conditions may also include other setting methods besides the above-mentioned imaging plane of the portable electronic device being parallel to the surface of the scanning object. For example, the error value of the horizontal inclination angle between the imaging plane of the portable electronic device and the surface of the scanning object is a preset interval. Specifically, for example, the error value of the horizontal inclination angle of the mobile phone and the surface of the scanned text is ±5°.
水平仪是一种测量角度的常用量具,用于测量水平倾角、设备安装的水平位置和垂直位置等。按水平仪的外形不同可分为万向水平仪、柱式水平仪、框式水平仪、尺式水平仪等。其中气泡式万向水平仪的水准管是由玻璃制成,水准管内壁是一个具有一定曲率半径的曲面,管内装有液体,当水平仪发生倾斜时,水准管中气泡就向水平仪升高的一端移动,从而确定水平面的位置。水准管内壁曲率半径越大,分辨率就越高,水平仪的精度就越高。此外,还包括具有类似功能且带有读数显示的电感式水平仪。A spirit level is a commonly used measuring tool for measuring angles, and is used to measure horizontal inclination, horizontal position and vertical position of equipment installation, etc. According to the shape of the level, it can be divided into universal level, column level, frame level, ruler level and so on. The level tube of the bubble-type universal level is made of glass. The inner wall of the level tube is a curved surface with a certain radius of curvature. The tube is filled with liquid. When the level tilts, the air bubbles in the level tube will move toward the raised end of the level. , so as to determine the position of the horizontal plane. The larger the radius of curvature of the inner wall of the vial, the higher the resolution and the higher the accuracy of the level. In addition, an inductive spirit level with a readout display has similar functionality.
本实施方式中,如果手机具有上述水平仪,并且手机外形呈平面状,满足上述成像平面和手机整体平面平行的要求;则对于使手机满足预设扫描条件即手机与扫描文本平行,可以通过以下方式实现:In this embodiment, if the mobile phone has the above-mentioned spirit level, and the appearance of the mobile phone is planar, which meets the requirement that the above-mentioned imaging plane is parallel to the overall plane of the mobile phone; then to make the mobile phone meet the preset scanning conditions, that is, the mobile phone is parallel to the scanned text, the following methods can be used accomplish:
将手机贴紧放置于扫描文本表面,获取此时水平仪的读数α作为预设的水平倾角,该预设的水平倾角即表征了扫描文本表面的倾斜情况。按照读数α来调整手机扫描时的位姿,就能够确保扫描过程中成像平面和扫描文本表面保持较好的平行度,获得较佳的扫描结果。Place the mobile phone close to the surface of the scanned text, and obtain the reading α of the level at this time as the preset horizontal inclination, which represents the inclination of the scanned text surface. Adjusting the posture of the mobile phone during scanning according to the reading α can ensure that the imaging plane and the surface of the scanned text maintain a good parallelism during the scanning process, and obtain better scanning results.
本实施方式通过设置预设扫描条件为便携式电子设备的成像平面与扫描对象表面平行,以及将倾斜参数设置为水平倾角,保证了扫描过程中便携式设备的成像平面能够和扫描对象表面呈平行,从而避免扫描得到的图像由于上述两个平面之间产生的夹角过大导致的形变,保证了扫描文本的质量和易处理性,提高了扫描效果。In this embodiment, by setting the preset scanning condition that the imaging plane of the portable electronic device is parallel to the surface of the scanning object, and setting the tilt parameter as a horizontal inclination angle, it is ensured that the imaging plane of the portable device can be parallel to the surface of the scanning object during the scanning process, thereby The deformation of the scanned image due to the excessively large included angle between the above two planes is avoided, the quality and ease of handling of the scanned text are ensured, and the scanning effect is improved.
作为另一种可选的实施方式,预设扫描条件为便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴平行;倾斜参数为磁方位角。As another optional implementation manner, the preset scanning condition is that the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the scanning object; the tilt parameter is a magnetic azimuth.
通过手机等便携式设备扫描文本的另一个难点在,传统的扫描设备能够将扫描文本按固定位置放置后,保证扫描文本在扫描拍摄成像的过程中,整体位于扫描设备摄像头的成 像平面内,并且扫描文本的表面的中心轴平行或接近平行于成像平面的中心轴,从而获得包括完整且扫描图像的边缘与其中的扫描文本边缘平齐的扫描结果。而通过握持等方式进行扫描,虽然通常能够保证扫描文本表面的整体成像,但由于上述的原因即手机位姿的不固定,十分容易由于拍摄过程中取景框未对准扫描文本而导致最终的扫描图像中,扫描文本是歪斜的,需要进行旋转切割等后处理。Another difficulty in scanning text with portable devices such as mobile phones is that traditional scanning devices can place the scanned text at a fixed position to ensure that the scanned text is located in the imaging plane of the scanning device’s camera as a whole during the scanning, shooting and imaging process, and the scanning The central axis of the surface of the text is parallel or nearly parallel to the central axis of the imaging plane, so as to obtain a scanning result including a complete scan image with edges flush with the scanned text edges. Scanning by holding and other methods can usually ensure the overall imaging of the scanned text surface, but due to the above-mentioned reason that the pose of the mobile phone is not fixed, it is very easy to cause the final image due to the misalignment of the viewfinder frame during the shooting process. In the scanned image, the scanned text is skewed and requires post-processing such as rotation and cutting.
为了克服手机的成像平面和扫描文本的表面在投影方向上的方向不一致导致的上述问题,本实施方式设定预设扫描条件为便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴平行;倾斜参数为磁方位角。In order to overcome the above-mentioned problems caused by the inconsistency between the imaging plane of the mobile phone and the surface of the scanned text in the projection direction, this embodiment sets the preset scanning condition to be that the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the scanned object. ;The tilt parameter is the magnetic azimuth.
磁方位角即指南针的指针朝向,是由通过某点磁子午线北端起算,顺时针方向至某一直线间的夹角(即地球南北极上的磁南、磁北两点间的连线)。当然因为地球南北磁极与南北极并不重合而存在磁偏角,各地的磁偏角视经纬度而各不相同,没有统一的校正角度,需要根据各地的磁偏角数据对磁方位角进行修正后才能获取相对精确的读数。但本实施例中对于便携式电子设备的成像平面中心轴和扫描对象表面中心轴获取指南针的读数,旨在确定其相对关系,因此对于位于同地的两者并不存在上述磁偏角的影响。The magnetic azimuth is the direction of the compass pointer, which is the angle between the north end of the magnetic meridian passing through a certain point and the clockwise direction to a certain straight line (that is, the line connecting magnetic south and magnetic north on the north and south poles of the earth). Of course, there is a magnetic declination because the north and south magnetic poles of the earth do not coincide with the north and south poles. The magnetic declination angles of various places are different depending on the latitude and longitude. to obtain relatively accurate readings. However, in this embodiment, the readings of the compass are obtained for the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanned object, in order to determine their relative relationship, so there is no influence of the above-mentioned magnetic declination on the two located at the same place.
预设的磁方位角可以表征扫描文本的放置方向,假设首先将扫描文本按照一定方向进行放置,则按照上述预设扫描条件需要使成像平面也处于该方向。当然本领域技术人员可以知晓,预设扫描条件除了上述便携式电子设备的成像平面与扫描对象表面方向一致之外,也可以包括其他设置方式。例如,便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴为一预设区间。具体地,例如便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴的误差值为±5°。The preset magnetic azimuth can characterize the placement direction of the scanned text. Assuming that the scanned text is placed in a certain direction first, the imaging plane needs to be in this direction according to the above preset scanning conditions. Of course, those skilled in the art can know that the preset scanning conditions may also include other setting methods besides the above-mentioned direction of the imaging plane of the portable electronic device being consistent with the surface of the scanning object. For example, the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanning object are within a preset interval. Specifically, for example, the error value between the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanning object is ±5°.
本实施方式中,如果手机具有指南针功能,并且手机外形呈矩形,则对于使手机满足上述预设扫描条件可以通过以下方式实现:In this embodiment, if the mobile phone has a compass function, and the shape of the mobile phone is rectangular, then the following methods can be used to make the mobile phone meet the above preset scanning conditions:
参见图2所示,可以将手机贴紧放置于扫描文本表面,并且使得手机的两条相邻边缘与扫描文本的两条相邻边缘保持齐平,当然可以理解,此时还需保持取景框与扫描文本的长宽方向一致。则获取此时的指南针的读数β作为预设的磁方位角,该预设的磁方位角即表征了扫描文本表面的放置方向。按照读数β来调整手机扫描时的位姿,就能够确保扫描过程中成像平面和扫描文本表面保持相对一致的方向,获得较佳的扫描结果。As shown in Figure 2, you can place the mobile phone close to the surface of the scanned text, and keep the two adjacent edges of the mobile phone flush with the two adjacent edges of the scanned text. Of course, it is understandable that the viewfinder needs to be maintained at this time Matches the length and width of the scanned text. Then, the reading β of the compass at this time is obtained as the preset magnetic azimuth, and the preset magnetic azimuth represents the placement direction of the scanned text surface. Adjusting the posture of the mobile phone during scanning according to the reading β can ensure that the imaging plane and the scanning text surface maintain a relatively consistent direction during the scanning process, and obtain better scanning results.
当然,除了上述方式之外,也可以通过其他方式获得预设的磁方位角,例如预先将手机取景框对准扫描文本,并且在手机取景框显示纵横垂直的指示线,以便于对准对其扫描 文本的边缘时,获取上述预设的磁方位角。Of course, in addition to the above methods, the preset magnetic azimuth can also be obtained in other ways, such as aligning the mobile phone viewfinder with the scanned text in advance, and displaying vertical and horizontal indicator lines on the mobile phone viewfinder for easy alignment. When scanning the edge of the text, obtain the above preset magnetic azimuth.
本实施方式通过设置预设扫描条件为便携式电子设备的成像平面与扫描对象表面的中心轴方向一致,以及将倾斜参数设置为磁方位角,保证了扫描过程中便携式设备的成像平面和扫描对象表面在投影方向的朝向一致,从而避免扫描得到的图像由于上述两个平面的方向不一致导致的成像歪斜不易处理,提高了扫描文本的质量。In this embodiment, by setting the preset scanning condition that the imaging plane of the portable electronic device is consistent with the central axis direction of the scanning object surface, and setting the tilt parameter as the magnetic azimuth angle, the imaging plane of the portable electronic device and the scanning object surface are guaranteed during the scanning process. The orientation of the projection direction is consistent, thereby avoiding the imaging distortion of the scanned image due to the inconsistency of the directions of the above two planes, which is difficult to handle, and improving the quality of the scanned text.
作为一种可选的实施方式,本实施例的扫描方法还包括步骤:As an optional implementation, the scanning method of this embodiment also includes the steps:
S41.对扫描对象表面通过动态拍摄进行扫描,以获得至少两帧图像。S41. Scanning the surface of the scanning object by dynamic shooting to obtain at least two frames of images.
S42.从所有图像中获取目标图像,其中在所有图像中,目标图像对应的倾斜参数与预设的倾斜参数的差值绝对值最小。S42. Acquire the target image from all the images, wherein, among all the images, the absolute value of the difference between the tilt parameter corresponding to the target image and the preset tilt parameter is the smallest.
目前大多数手机以及其他可作为便携式电子设备的电子设备都带有动态拍摄功能,即在短时间可拍摄连续的图像,通常可以达到拍摄每秒8张及以上。利用动态拍摄功能,可以较好地弥补通过握持等方式进行扫描带来的便携式电子设备自身位姿不固定的缺陷。At present, most mobile phones and other electronic devices that can be used as portable electronic devices have a dynamic shooting function, that is, they can shoot continuous images in a short time, usually up to 8 pictures per second and above. Utilizing the dynamic shooting function can better make up for the defect that the portable electronic device itself is not fixed in position and posture caused by scanning by holding or other methods.
步骤S41对扫描对象表面通过动态拍摄进行扫描获得至少两帧图像,即通过上述动态拍摄的方式对扫描文本进行连拍,获得连拍图像。步骤S42从上述连拍获得的所有图像中,基于与预设的倾斜参数的比较,遴选与预设的倾斜参数的差值绝对值最小的倾斜参数对应的图像作为目标图像,即最终的扫描成果。Step S41 scans the surface of the object to be scanned by dynamic shooting to obtain at least two frames of images, that is, continuously shoots the scanned text through the above-mentioned dynamic shooting method to obtain continuous shooting images. Step S42 From all the images obtained by the above-mentioned continuous shooting, based on the comparison with the preset tilt parameters, select the image corresponding to the tilt parameter with the smallest absolute value of the difference between the preset tilt parameters as the target image, that is, the final scanning result .
步骤S42中,以上述具有水平仪功能时设定的水平倾角为倾斜参数为例进行说明。水平仪为气泡式圆盘水平仪,并且带有横坐标及纵坐标的四象限二维坐标刻度,水平倾角可以通过气泡的纵横坐标读数获得。则假设扫描文本放置于桌面时,水平仪的气泡的坐标读数为(x’,y’),则对于连拍后获得n张图像,获取其中气泡的坐标读数:In step S42 , it will be described by taking the above-mentioned horizontal inclination set as the inclination parameter when the function of the spirit level is used as an example. The spirit level is a bubble-type disk spirit level with a four-quadrant two-dimensional coordinate scale of abscissa and ordinate, and the horizontal inclination can be obtained by reading the ordinate and abscissa of the bubble. Then assume that when the scanned text is placed on the desktop, the coordinate reading of the bubble of the level is (x’, y’), then for n images obtained after continuous shooting, the coordinate reading of the bubble in it is obtained:
其中,(x
i,y
i)分别为第i张图像的水平仪的气泡的坐标读数。从而与最终获取的A
i对应就是符合要求的目标图像,即具有拍摄时与扫描文本表面最接近平行的手机成像平面。
Wherein, (x i , y i ) are the coordinate readings of the bubbles of the spirit level in the i-th image, respectively. Therefore, corresponding to the finally obtained A i is the target image that meets the requirements, that is, the imaging plane of the mobile phone that is closest to the parallel to the surface of the scanned text when shooting.
作为其中的一个例子,参见图3所示,假设扫描文本放置于水平桌面,则获取的预设的水平倾角为0°,即手机贴置于扫描文本时的水平仪气泡居中,坐标为(0,0);假设握持手机让气泡沿虚线图3的虚线轨迹通过原点(0,0)完成动态拍摄获得了一组图像,只需要计算:As an example, as shown in Figure 3, assuming that the scanned text is placed on a horizontal desktop, the obtained preset horizontal inclination angle is 0°, that is, the level bubble is centered when the mobile phone sticker is placed on the scanned text, and the coordinates are (0, 0); assuming that the mobile phone is held and the bubble passes the origin (0,0) along the dotted line track of the dotted line in Figure 3 to complete the dynamic shooting and obtain a set of images, only need to calculate:
同样地,上述步骤S41、S42适用于倾斜参数为磁方位角的应用场景,并且在一种应 用场景中,可以将上述至少包括水平倾角和磁方位角的两种当前的倾斜参数同时与各自的预设的倾斜参数进行比较,分别获得的差值绝对值则可以按照一定的权重进行综合计算。Similarly, the above steps S41 and S42 are applicable to the application scenario where the tilt parameter is the magnetic azimuth angle, and in one application scenario, the above two current tilt parameters including at least the horizontal tilt angle and the magnetic azimuth angle can be combined with their respective The preset tilt parameters are compared, and the absolute values of the differences obtained respectively can be comprehensively calculated according to a certain weight.
例如,按照上述步骤分别获得每张图片的水平倾角与的预设的水平倾角的差值绝对值为T
α,每张图片的水平倾角与的预设的水平倾角的差值绝对值为T
β,如果设定符合水平倾角与预设一致的权重为0.6,符合磁方位角与预设一致的权重为0.4,则每张图片的倾斜参数的差值绝对值的综合值S=T
α*0.6+T
β*0.4,从而在所有连拍获得的图像中,获取具有最小值的S;其对应的图像即为目标图像。此外还应当理解,本实施方式中的倾斜参数包括但不限于上述两种方式及组合。
For example, according to the above steps, the absolute value of the difference between the horizontal inclination of each picture and the preset horizontal inclination is T α , and the absolute value of the difference between the horizontal inclination of each picture and the preset horizontal inclination is T β , if the weight of the horizontal inclination consistent with the preset is set to 0.6, and the weight of the magnetic azimuth consistent with the preset is set to 0.4, then the comprehensive value of the absolute value of the difference between the tilt parameters of each picture S=T α *0.6 +T β *0.4, so that among all the images obtained by continuous shooting, the S with the minimum value is obtained; the corresponding image is the target image. In addition, it should be understood that the tilt parameters in this embodiment include but are not limited to the above two manners and combinations.
本实施方式充分利用了便携式电子设备的动态拍摄功能,并对拍摄过程中难以避免的抖动造成的扫描图像偏差通过自动择优的方式予以克服,从而增加了获得质量符合要求的图片的可能性,且通过一次连拍代替多次扫描,提升了便携式设备的扫描效率和扫描效果。This embodiment makes full use of the dynamic shooting function of the portable electronic device, and overcomes the deviation of the scanned image caused by the unavoidable shaking during the shooting process by automatically selecting the best, thereby increasing the possibility of obtaining pictures that meet the quality requirements, and By replacing multiple scans with one continuous shooting, the scanning efficiency and scanning effect of portable devices are improved.
在一种可选的实施方式中,本实施例的扫描方法还包括:In an optional implementation manner, the scanning method of this embodiment further includes:
S401.对扫描对象表面通过全景拍摄进行扫描,以获得至少两帧图像。S401. Scan the surface of the scanned object by panoramic shooting, so as to obtain at least two frames of images.
S402.从所有图像中获取基准图像,其中在所有图像中,基准图像对应的倾斜参数与预设的倾斜参数的差值绝对值最小。S402. Acquire a reference image from all the images, wherein, among all the images, the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest.
S403.对基准图像以外的图像进行仿射变换,以使仿射变换后的图像的倾斜参数与基准图像对应的倾斜参数一致。S403. Perform affine transformation on images other than the reference image, so that the tilt parameters of the affine transformed image are consistent with the tilt parameters corresponding to the reference image.
S404.对基准图像以及仿射变换后的图像进行图像融合处理,以获取全景图像。S404. Perform image fusion processing on the reference image and the image after affine transformation to obtain a panoramic image.
目前大多数手机以及其他可作为便携式电子设备的电子设备还具备全景拍摄功能用于拍摄全景照片(Panoramic Photo),全景照片通常是指符合人眼正常有效视角或包括双眼余光视角以上乃至360°完整场景范围拍摄的照片。扫描文本大多数情况下是A4(210毫米×297毫米)尺寸的纸型,但也有些特殊的内容如画卷、代码文本等需要长宽比值较大的长条形扫描文本作为载体,在这种应用场景中为了将所有的文本进行扫描,可以通过全景拍摄来实现。但是在全景拍摄的过程中,握持手机的时间较长,摄像头极易发生抖动偏移导致拍摄效果不佳。本实施方式提供的长文本扫描技术即针对上述由于扫描过程中扫描设备位姿不固定造成的缺陷加以改进。At present, most mobile phones and other electronic devices that can be used as portable electronic devices also have a panoramic shooting function for taking panoramic photos (Panoramic Photo). Photos taken from the full range of the scene. In most cases, the scanned text is A4 (210 mm × 297 mm) size paper, but there are also some special content such as scrolls, code texts, etc. that require long strips of scanned text with a large aspect ratio as a carrier. In this application In order to scan all the text in the scene, it can be realized by panoramic shooting. However, in the process of panoramic shooting, the phone is held for a long time, and the camera is prone to shake and shift, resulting in poor shooting results. The long text scanning technology provided in this embodiment improves on the above defects caused by the unstable pose of the scanning device during the scanning process.
步骤S401对扫描对象表面通过动态拍摄进行扫描获得至少两帧图像,即通过上述动态拍摄的方式对扫描文本进行连拍,获得连拍图像。步骤S42从上述连拍获得的所有图像中,基于与预设的倾斜参数的比较,遴选与预设的倾斜参数的差值绝对值最小的倾斜参数 对应的图像作为基准图像。当然,对于步骤S402,同样可以针对水平倾角、磁方位角以及其他倾斜参数进行评价,评价结果也可以如上一实施方式中所述依据权重等不同方式进行组合评价,由于具体涉及的原理类似不再赘述。Step S401 scans the surface of the object to be scanned by dynamic shooting to obtain at least two frames of images, that is, continuously shoots the scanned text through the above-mentioned dynamic shooting method to obtain continuous shooting images. Step S42 From all the images obtained by the continuous shooting, based on the comparison with the preset tilt parameters, select the image corresponding to the tilt parameter with the smallest absolute value of the difference between the preset tilt parameters as the reference image. Of course, for step S402, the horizontal inclination, magnetic azimuth and other inclination parameters can also be evaluated, and the evaluation results can also be combined and evaluated in different ways such as weights as described in the previous embodiment. Since the specific principles involved are similar and no longer repeat.
通常全景拍摄的实现分为如下步骤:特征检测、特征匹配、计算单应性矩阵、图像变形以及图像拼合。步骤S402从所有拍摄的图像中,获取基准图像作为特征检测和特征匹配的参考依据,由于在所有的图像中,基准图像对应的倾斜参数与预设的倾斜参数的差值绝对值最小,可以认为该基准图像具有较强的位姿参考评价意义。基于该基准图像的倾斜参数以及其他图像特征作出的全景图像生成结果也能较好地还原扫描文本的内容。Usually, the realization of panoramic shooting is divided into the following steps: feature detection, feature matching, calculation of homography matrix, image deformation and image stitching. Step S402 Obtain the reference image from all the captured images as the reference basis for feature detection and feature matching. Since the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest in all images, it can be considered that The reference image has a strong pose reference evaluation significance. The panorama image generation result based on the tilt parameters of the reference image and other image features can also better restore the content of the scanned text.
步骤S403对基准图像以外的图像进行仿射变换,以使仿射变换后的图像的倾斜参数与基准图像对应的倾斜参数一致。Step S403 performs affine transformation on images other than the reference image, so that the tilt parameters of the affine transformed image are consistent with the tilt parameters corresponding to the reference image.
仿射变换又称仿射映射,是指在几何中一个向量空间进行一次线性变换并接上一个平移,变换为另一个向量空间。其计算过程可能包括平移、旋转、放缩、剪切、反射;其计算得到的结果具有特征:线段在仿射变换后依然是线段并且相互间比例保持不变。而全景图像的生成过程中,由于通过本实施方式中获取的具有较高质量的图像作为基准图像,其他图像基于基准图像进行仿射变换而得到一组图像,能够保证全景图像的质量。Affine transformation, also known as affine mapping, refers to performing a linear transformation in a vector space in geometry followed by a translation to transform it into another vector space. The calculation process may include translation, rotation, scaling, shearing, and reflection; the calculated results have characteristics: the line segments are still line segments after the affine transformation and the ratio between them remains unchanged. In the process of generating the panoramic image, since the image with higher quality obtained in this embodiment is used as the reference image, other images are affine transformed based on the reference image to obtain a group of images, which can ensure the quality of the panoramic image.
步骤S404对基准图像以及仿射变换后的图像进行图像融合处理以获取全景图像。由于经过仿射变换后的图像具有较高的特征点拟合度,因此进行图像融合拼接时对每幅图进行特征点提取、匹配、配准的准确性更高,对各图像的重叠边界的处理更精确,从而能够得到效果更佳的全景图像。Step S404 performs image fusion processing on the reference image and the affine transformed image to obtain a panoramic image. Since the image after affine transformation has a high degree of fitting of feature points, the accuracy of feature point extraction, matching, and registration for each image is higher when performing image fusion stitching, and the overlapping boundaries of each image are more accurate. The processing is more precise, resulting in better panoramic images.
本实施方式利用便携式电子设备的全景图像动态拍摄功能进行长文本扫描,并基于倾斜参数获取基准图像,从而保证能够生成更为精确的全景图像,解决了以往由于拍摄过程的人为操作误差造成的全景图像失真和质量较低的问题,提升了便携式设备对于长文本的扫描效果。This embodiment uses the panoramic image dynamic shooting function of the portable electronic device to scan long texts, and obtains the reference image based on the tilt parameters, so as to ensure that a more accurate panoramic image can be generated, and solves the problem of panoramic images caused by human operation errors in the shooting process in the past. Image distortion and lower quality issues improve scanning of long text on portable devices.
对于上述实施方式,步骤S301还包括:获取图像对应的扫描距离,扫描距离为便携式电子设备的摄像头在焦距方向上到扫描对象表面的距离。基准图像对应的扫描距离为基准扫描距离;步骤S303还使仿射变换后的图像的扫描距离与基准扫描距离一致。For the above embodiment, step S301 further includes: acquiring a scanning distance corresponding to the image, where the scanning distance is the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction. The scanning distance corresponding to the reference image is the reference scanning distance; Step S303 also makes the scanning distance of the affine transformed image consistent with the reference scanning distance.
TOF(Time-of-Flight,飞行时间)摄像头是一种使用调制光源照亮场景并观察反射光进行测距的3D(三维)摄像头,利用TOF测量原理确定摄像头与物体或周围环境之间距离,并通过测量的点生成深度图像或3D图像,测距原理即通过测量光在某介质中行进一 段距离所需的时间,通常是对脉冲发射光到达物体并反射回到传感器所用时间测量。由于TOF摄像头能够收集景深信息并且可以获取更多的图像细节,因此其不仅可以获取更多高精度的特征点用于后续的图像融合操作,还能获得更精细的扫描效果。本实施例通过TOF摄像头获得精确的扫描距离,有助于在图像融合过程中进行更准确的特征匹配。本实施方式进一步通过设置扫描距离综合评价并获取基准图像,使得基准图像在全景图像生成的过程中具有更高的参考意义,进一步提高了全景图像的精确度,进一步改善长文本扫描的图像失真问题并提升了便携式设备对于长文本的扫描效果。TOF (Time-of-Flight) camera is a 3D (three-dimensional) camera that uses a modulated light source to illuminate the scene and observes the reflected light for distance measurement. It uses the TOF measurement principle to determine the distance between the camera and the object or the surrounding environment. And generate a depth image or 3D image through the measured points. The principle of distance measurement is to measure the time required for light to travel a certain distance in a medium, usually the time it takes for the pulsed emitted light to reach the object and reflect back to the sensor. Since the TOF camera can collect depth of field information and obtain more image details, it can not only obtain more high-precision feature points for subsequent image fusion operations, but also obtain finer scanning effects. In this embodiment, the precise scanning distance is obtained by the TOF camera, which is helpful for more accurate feature matching in the process of image fusion. In this embodiment, by setting the comprehensive evaluation of the scanning distance and obtaining the reference image, the reference image has a higher reference significance in the process of generating the panoramic image, further improves the accuracy of the panoramic image, and further improves the image distortion problem of long text scanning And improved the scanning effect of portable devices for long text.
在一种可选的实施方式中,本实施例的扫描方法还包括:In an optional implementation manner, the scanning method of this embodiment further includes:
S501.获取至少两组扫描距离与该扫描距离下,扫描对象在便携式电子设备的成像区域内的面积占比的对应关系。可以理解,扫描距离和上一实施方式中相同,均为便携式电子设备的摄像头在焦距方向上到扫描对象表面的距离。S501. Obtain a corresponding relationship between at least two sets of scanning distances and the area ratio of the scanning object within the imaging area of the portable electronic device under the scanning distances. It can be understood that the scanning distance is the same as that in the previous embodiment, which is the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction.
S502.基于所述对应关系确定最佳扫描距离;S502. Determine an optimal scanning distance based on the corresponding relationship;
S503.生成第一提示信息,所述第一提示信息包括所述最佳扫描距离。S503. Generate first prompt information, where the first prompt information includes the optimal scanning distance.
参见图4,对于固定放置的扫描对象A,为了尽量减少不必要的多次重复扫描,应当在扫描过程中,尽可能将其成像a包含于便携式电子设备的成像区域a’中,同时,为了保证扫描的精度以便后期处理,还应当尽可能地使其成像a在成像区域a’中的面积占比a/a’达到最大。Referring to Fig. 4, for a fixedly placed scanning object A, in order to minimize unnecessary repeated scanning, its image a should be included in the imaging area a' of the portable electronic device as much as possible during the scanning process, and at the same time, in order to To ensure the scanning accuracy for later processing, the area ratio a/a' of the image a in the imaging area a' should be maximized as much as possible.
具体地,步骤S501可以在扫描的准备过程中即聚焦阶段,或是扫描过程中,当检测到便携式电子设备的摄像头在焦距方向上到扫描对象表面的距离发生变化时,通过文本边缘检测获取文本范围、文本边缘等参数,以及在此基础上获取至少两组扫描距离与上述面积占比的对应关系。步骤S502据此解算得到基于当前扫描对象的放置位置,应当以何种距离进行扫描为宜,该距离即最佳扫描距离。该最佳扫描距离也就是保证文本边缘均落入上述成像区域a’的同时,使得面积占比a/a’为最大值时的扫描距离。Specifically, step S501 can be during the preparation process of scanning, that is, the focusing stage, or during the scanning process, when it is detected that the distance between the camera of the portable electronic device and the surface of the scanned object changes in the focal length direction, the text can be obtained through text edge detection. Parameters such as range and text edge, and on this basis, at least two sets of correspondences between scanning distances and the above-mentioned area ratios are obtained. Step S502 calculates based on this and obtains the appropriate distance for scanning based on the placement position of the current scanning object, which is the optimal scanning distance. The optimal scanning distance is the scanning distance at which the area ratio a/a' is the maximum value while ensuring that the edges of the text all fall into the aforementioned imaging area a'.
最后,步骤S503显示该最佳扫描距离,帮助用户及时调整便携式电子设备以更准确地进行扫描。Finally, step S503 displays the optimal scanning distance to help the user adjust the portable electronic device in time to scan more accurately.
本实施方式通过对扫描文本的成像区域的图像分析获取扫描文本在其中的面积占比,进而确定对于该扫描文本的最佳扫描距离并提示给用户,从而有助于获得更好的扫描效果,确保扫描工作效率的同时,能够获得尽可能高的扫描清晰度。In this embodiment, the area ratio of the scanned text is obtained by analyzing the imaged area of the scanned text, and then the optimal scanning distance for the scanned text is determined and prompted to the user, thereby helping to obtain a better scanning effect. Get the highest possible scan clarity while ensuring scan productivity.
在一种可选的实施方式中,步骤S2之后还包括:In an optional implementation manner, after step S2, it also includes:
S3’.若当前的倾斜参数与预设的倾斜参数的误差超过预设范围,则生成第二提示信息,第二提示信息用于提示用户调整便携式电子设备以使误差缩小至预设范围内。S3'. If the error between the current inclination parameter and the preset inclination parameter exceeds the preset range, generate second prompt information, the second prompt information is used to prompt the user to adjust the portable electronic device to reduce the error to within the preset range.
具体地,当倾斜参数为水平倾角时,如果当前的水平倾角为30°,预设的水平倾角为5°,误差的预设范围为10°;则当前的水平倾角和预设的水平倾角的误差25°超过预设范围,则发出第二提示信息。例如,可实时显示当前的水平倾角和预设的水平倾角的差值绝对值,并且当检测到该绝对值趋近上述预设范围值时显示绿色箭头;反之,当检测到该绝对值远离上述预设范围值时显示红色的警示箭头。Specifically, when the inclination parameter is the horizontal inclination, if the current horizontal inclination is 30°, the preset horizontal inclination is 5°, and the preset error range is 10°; then the current horizontal inclination and the preset horizontal inclination If the error of 25° exceeds the preset range, a second prompt message will be issued. For example, the absolute value of the difference between the current horizontal inclination and the preset horizontal inclination can be displayed in real time, and a green arrow is displayed when it is detected that the absolute value is close to the above-mentioned preset range value; A red warning arrow is displayed when the range value is preset.
当倾斜参数为磁方位角时,如果当前的磁方位角为西偏南20°,预设的磁方位角为西偏北5°,而误差的预设范围为10°;则当前的磁方位角和预设的磁方位角的误差25°超过预设范围,则发出第二提示信息。此时,可于电子设备实时显示当前的磁方位角和预设的磁方位角的差值绝对值,以及显示一箭头表征用户应当将便携式电子设备转向的方向,同时对于箭头颜色,可当检测到该差值绝对值趋近上述预设范围值时显示绿色箭头;反之,当检测到该绝对值远离上述预设范围值时显示红色的警示箭头。When the tilt parameter is magnetic azimuth, if the current magnetic azimuth is 20° south by west, the preset magnetic azimuth is 5° north by west, and the preset error range is 10°; then the current magnetic azimuth If the error of 25° between the angle and the preset magnetic azimuth exceeds the preset range, a second prompt message will be issued. At this time, the absolute value of the difference between the current magnetic azimuth and the preset magnetic azimuth can be displayed on the electronic device in real time, and an arrow can be displayed to indicate the direction in which the user should turn the portable electronic device. At the same time, the color of the arrow can be detected A green arrow is displayed when the absolute value of the difference is close to the preset range value; otherwise, a red warning arrow is displayed when the absolute value is detected to be far from the preset range value.
本实施方式在便携式电子设备扫描过程中倾斜参数超出预设范围的情况下,发出针对性的提示以帮助用户进行纠偏,从而有利于获得更佳的扫描效果,提高了用户体验。In this embodiment, when the tilt parameter exceeds the preset range during the scanning process of the portable electronic device, a targeted prompt is issued to help the user correct the deviation, which is beneficial to obtain a better scanning effect and improves user experience.
本实施例通过提供一种便携式电子设备的扫描方法,使得便携式电子设备在扫描过程中保持合理的位姿,从而能够确保扫描成果的精度,提高了扫描操作的效率,也使得扫描的成果更适于进行裁剪等后处理。This embodiment provides a scanning method for a portable electronic device, so that the portable electronic device maintains a reasonable posture during the scanning process, thereby ensuring the accuracy of the scanning result, improving the efficiency of the scanning operation, and making the scanning result more suitable. For post-processing such as cropping.
实施例2Example 2
参见图5所示,本实施例具体提供了一种便携式电子设备的扫描系统,扫描系统包括:Referring to Fig. 5, this embodiment specifically provides a scanning system for portable electronic devices, and the scanning system includes:
参数预设模块1,用于获取便携式电子设备的成像平面与扫描对象表面之间满足预设扫描条件时,便携式电子设备的预设的倾斜参数;The parameter preset module 1 is used to acquire the preset tilt parameters of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object;
参数获取模块2,用于获取便携式电子设备的当前的倾斜参数;A parameter acquisition module 2, configured to acquire the current tilt parameter of the portable electronic device;
扫描控制模块3,用于在当前的倾斜参数与预设的倾斜参数的误差处于预设范围内时,控制便携式电子设备对扫描对象表面进行扫描。The scanning control module 3 is configured to control the portable electronic device to scan the surface of the scanning object when the error between the current tilt parameter and the preset tilt parameter is within a preset range.
本实施例中的便携式电子设备是带有图像拍摄功能的电子设备;包括但不限于手机及平板电脑。较佳地,该电子设备的拍摄分辨率符合扫描的分辨率要求,例如通常对于文档扫描要求分辨率达到200dpi,则对应的电子设备的最高分辨率应该能达到相应的参数,以满足200dpi的扫描分辨率。为便于说明,本实施例中仅以手机为例描述便携式电子设备的 扫描系统。对于扫描对象,通常是矩形纸张内的文本、图案或其结合,通常扫描对象具有相对平展的表面,本实施例中仅以上述扫描文本作为扫描对象为例进行说明。可以理解,本实施例的扫描系统并不限于对上述手机和扫描文本的应用场景。The portable electronic device in this embodiment is an electronic device with an image capturing function; including but not limited to a mobile phone and a tablet computer. Preferably, the shooting resolution of the electronic device meets the scanning resolution requirements. For example, the document scanning requires a resolution of 200dpi, and the highest resolution of the corresponding electronic device should be able to meet the corresponding parameters to meet the scanning requirements of 200dpi. resolution. For ease of description, this embodiment only uses a mobile phone as an example to describe the scanning system of a portable electronic device. For the scanned object, it is generally text, pattern or a combination thereof in a rectangular paper, and usually the scanned object has a relatively flat surface. In this embodiment, only the above-mentioned scanned text is used as the scanned object for illustration. It can be understood that the scanning system of this embodiment is not limited to the above-mentioned application scenarios of mobile phones and scanning text.
参数预设模块1获取便携式电子设备的成像平面与扫描对象表面之间满足预设扫描条件时,便携式电子设备的预设的倾斜参数。The parameter preset module 1 acquires a preset tilt parameter of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object.
通常扫描文件或证件时由于采用专业的扫描仪固定压纸,因此不会存在扫描过程中拍摄角度的变换造成的扫描结果变形。然而采用手持手机扫描的过程很难保证手机摄像头与扫描文本之间平行,所扫描的文本很容易倾斜且内容不全。即使通过扫描软件后期矫正也有较大困难,例如由于原本是矩形的文本被拍摄为不规则四边形,后期矫正处理可能需要将文本调节为梯形或者为了保证文本的形状而缩减文本内容。Usually, when scanning documents or certificates, professional scanners are used to fix the pressing paper, so there will be no deformation of the scanning results caused by the change of the shooting angle during the scanning process. However, it is difficult to ensure that the camera of the mobile phone is parallel to the scanned text in the process of scanning with a handheld mobile phone, and the scanned text is easily skewed and the content is incomplete. Even post-correction by scanning software is difficult. For example, because the original rectangular text is captured as a trapezoid, post-correction processing may require adjusting the text to a trapezoid or reducing the text content to ensure the shape of the text.
因此,为了确保手机在扫描过程中能够保持合理的位姿进行针对扫描文本的拍摄,参数预设模块1首先获取手机的成像平面在满足扫描文本表面符合预设扫描条件时的倾斜参数,该预设扫描条件可以被认为是在扫描文本处于相对静态环境的情况下,手机基于扫描文本进行的位姿参数取样,目的在于,基于该取样结果,使手机获得一预设的倾斜参数,根据该倾斜参数执行扫描操作时,满足相对理想的位姿状态,获得符合要求的扫描效果。Therefore, in order to ensure that the mobile phone can maintain a reasonable pose during the scanning process for shooting the scanned text, the parameter preset module 1 first obtains the tilt parameters of the imaging plane of the mobile phone when the surface of the scanned text meets the preset scanning conditions. Assuming that the scanning condition can be considered as the pose parameter sampling performed by the mobile phone based on the scanned text when the scanned text is in a relatively static environment, the purpose is to obtain a preset tilt parameter for the mobile phone based on the sampling result. When the parameters perform the scanning operation, the relatively ideal pose state is satisfied, and the scanning effect that meets the requirements is obtained.
其中,手机的成像平面即像平面,手机成像平面就是CCD等感光元件。通常和呈平板状的手机外形是平行的,但也不排除一些电子设备设计中手机外形较为独特或摄像头的设置位置在手机侧方等情况,则此时成像平面不一定和手机整体形成的平面重合或平行。而获取手机预设的倾斜参数,需要和手机扫描状态符合最大关联度和最佳评价标准的平面。虽然理论上手机的焦平面平行于成像平面,但由于根据扫描对象的不同,焦平面需要经调焦操作才会与像平面重合,因此本实施例中设置手机的成像平面作为倾斜参数的参考。Wherein, the imaging plane of the mobile phone is the image plane, and the imaging plane of the mobile phone is a photosensitive element such as a CCD. Usually, it is parallel to the shape of the tablet-shaped mobile phone, but it does not rule out that the shape of the mobile phone is relatively unique in the design of some electronic devices or the camera is installed on the side of the mobile phone, etc., then the imaging plane is not necessarily the plane formed by the mobile phone as a whole. coincident or parallel. To obtain the preset tilt parameters of the mobile phone, a plane that meets the maximum degree of correlation and the best evaluation standard with the scanning state of the mobile phone is required. Although theoretically the focal plane of the mobile phone is parallel to the imaging plane, depending on the scanned object, the focal plane needs to be adjusted to coincide with the image plane. Therefore, in this embodiment, the imaging plane of the mobile phone is set as a reference for the tilt parameter.
对于扫描文本,则可以平展放置于不同的位置,例如可能是水平的桌面,也可能是倾斜的书案,甚至可能是贴设于竖直的墙上或天花板。For scanned text, it can be placed flat in different positions, for example, it may be a horizontal desktop, it may be an inclined desk, and it may even be attached to a vertical wall or ceiling.
获取手机的预设的倾斜参数可以根据实际场景实现,并不局限于某种特定的方式。由于上述现有技术的缺陷,本实施例旨在最大可能保证手机的成像平面和扫描文本的表面具有相应的倾斜参数即可,例如平行。因此,通常预设的倾斜参数的获取只要取得扫描文本的表面的倾斜参数,就可以相应地获取和设置手机的预设倾斜参数。Obtaining the preset tilt parameters of the mobile phone can be implemented according to actual scenarios, and is not limited to a specific method. Due to the above-mentioned defects in the prior art, this embodiment aims to ensure that the imaging plane of the mobile phone and the surface of the scanned text have corresponding inclination parameters as much as possible, such as being parallel. Therefore, generally, to acquire the preset tilt parameters, as long as the tilt parameters of the surface on which the text is scanned are obtained, the preset tilt parameters of the mobile phone can be correspondingly acquired and set.
例如对于用于放置扫描文本的桌面,如果是已知的水平桌面或竖直墙面,则可以直接获取手机的相关预设的倾斜参数。又如可以通过传感器感知并获取扫描文本相应的参数。 在此基础上,参数预设模块1就能实现对于手机预设的倾斜参数的获取。For example, if the desktop for placing the scanned text is a known horizontal desktop or a vertical wall, the relevant preset tilt parameters of the mobile phone can be directly obtained. Another example is that the corresponding parameters of the scanned text can be sensed and obtained through sensors. On this basis, the parameter preset module 1 can realize the acquisition of the preset tilt parameters for the mobile phone.
参数获取模块2获取便携式电子设备的当前的倾斜参数。如上所述,在获取了手机预设的倾斜参数的情况下,还需要获取手机当前的倾斜参数用于与之进行对比计算,并判断手机的当前位姿是否符合上述扫描要求。当然,上述预设和当前的倾斜参数均可能包括不止一种,但在计算和对比时是分别一一对应进行以获得判断结果。The parameter acquisition module 2 acquires the current tilt parameter of the portable electronic device. As mentioned above, in the case of obtaining the preset tilt parameters of the mobile phone, it is also necessary to obtain the current tilt parameters of the mobile phone for comparison and calculation, and to determine whether the current pose of the mobile phone meets the above scanning requirements. Of course, the above-mentioned preset and current tilt parameters may include more than one kind, but they are calculated and compared in a one-to-one correspondence to obtain judgment results.
如果当前的倾斜参数和预设的倾斜参数的误差超出了预设范围,则可以认为此时的手机位姿进行扫描将无法得到符合要求的扫描结果。因此,可以在手机上向用户发出一些必要的提示;例如倾斜参数的种类、偏差角度等,以使用户对扫描操作予以纠偏。If the error between the current inclination parameter and the preset inclination parameter exceeds the preset range, it can be considered that scanning with the pose of the mobile phone at this time will not be able to obtain a satisfactory scanning result. Therefore, some necessary prompts can be sent to the user on the mobile phone; for example, the type of tilt parameter, the deviation angle, etc., so that the user can correct the scanning operation.
反之,如果当前的倾斜参数和预设的倾斜参数的误差处于预设范围内,则扫描控制模块3控制手机对于扫描文本进行扫描。该预设范围通常可以根据对扫描精度的要求来设定,例如对于较高的扫描精度可以将预设范围设定为接近于零。由于满足上述条件,可以认为此时的手机位姿进行扫描能够得到符合要求的扫描结果,即内容完整,形变可控且较小。On the contrary, if the error between the current tilt parameter and the preset tilt parameter is within the preset range, the scanning control module 3 controls the mobile phone to scan the scanned text. The preset range can usually be set according to the requirements for scanning precision, for example, for higher scanning precision, the preset range can be set close to zero. Since the above conditions are met, it can be considered that the scanning of the mobile phone pose at this time can obtain the scanning results that meet the requirements, that is, the content is complete, and the deformation is controllable and small.
作为一种可选的实施方式,预设扫描条件为便携式电子设备的成像平面与扫描对象表面平行;倾斜参数为水平倾角。As an optional implementation manner, the preset scanning condition is that the imaging plane of the portable electronic device is parallel to the surface of the scanning object; the tilt parameter is a horizontal tilt angle.
为了克服手机的成像平面和扫描文本的表面的不平行导致的上述问题,本实施方式设定预设扫描条件为便携式电子设备的成像平面与扫描对象表面平行。相应地,设定倾斜参数为水平倾角。水平倾角,即直线或平面与水平面形成的夹角。预设的水平倾角可以表征扫描文本的放置的水平程度,例如在水平的桌面上的扫描文本,则其水平倾角为0°;相应地,如果预设扫描条件为手机与扫描文本平行,则手机进行扫描的条件同样也是水平倾角为0°。当然本领域技术人员可以知晓,预设扫描条件除了上述便携式电子设备的成像平面与扫描对象表面平行之外,也可以包括其他设置方式。例如,便携式电子设备的成像平面与扫描对象表面的水平倾角的误差值为一预设区间。具体地,例如手机和扫描文本表面的水平倾角的误差值为±5°。In order to overcome the above-mentioned problems caused by the non-parallel between the imaging plane of the mobile phone and the surface of the scanned text, the preset scanning condition is set in this embodiment to be that the imaging plane of the portable electronic device is parallel to the surface of the scanned object. Correspondingly, set the tilt parameter as the horizontal tilt angle. Horizontal inclination, that is, the angle formed by a straight line or plane and the horizontal plane. The preset horizontal inclination can represent the horizontality of the scanned text. For example, the scanned text on a horizontal desktop has a horizontal inclination of 0°; correspondingly, if the preset scanning condition is that the mobile phone is parallel to the scanned text, the mobile phone The condition for scanning is also that the horizontal inclination angle is 0°. Of course, those skilled in the art will know that the preset scanning conditions may also include other setting methods besides the above-mentioned imaging plane of the portable electronic device being parallel to the surface of the scanning object. For example, the error value of the horizontal inclination angle between the imaging plane of the portable electronic device and the surface of the scanning object is a preset interval. Specifically, for example, the error value of the horizontal inclination angle of the mobile phone and the surface of the scanned text is ±5°.
水平仪是一种测量角度的常用量具,用于测量水平倾角、设备安装的水平位置和垂直位置等。按水平仪的外形不同可分为万向水平仪、柱式水平仪、框式水平仪、尺式水平仪等。其中气泡式万向水平仪的水准管是由玻璃制成,水准管内壁是一个具有一定曲率半径的曲面,管内装有液体,当水平仪发生倾斜时,水准管中气泡就向水平仪升高的一端移动,从而确定水平面的位置。水准管内壁曲率半径越大,分辨率就越高,水平仪的精度就越高。此外,还包括具有类似功能且带有读数显示的电感式水平仪。A spirit level is a commonly used measuring tool for measuring angles, and is used to measure horizontal inclination, horizontal position and vertical position of equipment installation, etc. According to the shape of the level, it can be divided into universal level, column level, frame level, ruler level and so on. The level tube of the bubble-type universal level is made of glass. The inner wall of the level tube is a curved surface with a certain radius of curvature. The tube is filled with liquid. When the level tilts, the air bubbles in the level tube will move toward the raised end of the level. , so as to determine the position of the horizontal plane. The larger the radius of curvature of the inner wall of the vial, the higher the resolution and the higher the accuracy of the level. In addition, an inductive spirit level with a readout display has similar functionality.
本实施方式中,如果手机具有上述水平仪,并且手机外形呈平面状,满足上述成像平面和手机整体平面平行的要求;则对于使手机满足预设扫描条件即手机与扫描文本平行,可以通过以下方式实现:In this embodiment, if the mobile phone has the above-mentioned spirit level, and the appearance of the mobile phone is planar, which meets the requirement that the above-mentioned imaging plane is parallel to the overall plane of the mobile phone; then to make the mobile phone meet the preset scanning conditions, that is, the mobile phone is parallel to the scanned text, the following methods can be used accomplish:
将手机贴紧放置于扫描文本表面,获取此时水平仪的读数α作为预设的水平倾角,该预设的水平倾角即表征了扫描文本表面的倾斜情况。按照读数α来调整手机扫描时的位姿,就能够确保扫描过程中成像平面和扫描文本表面保持较好的平行度,获得较佳的扫描结果。Place the mobile phone close to the surface of the scanned text, and obtain the reading α of the level at this time as the preset horizontal inclination, which represents the inclination of the scanned text surface. Adjusting the posture of the mobile phone during scanning according to the reading α can ensure that the imaging plane and the surface of the scanned text maintain a good parallelism during the scanning process, and obtain better scanning results.
本实施方式通过设置预设扫描条件为便携式电子设备的成像平面与扫描对象表面平行,以及将倾斜参数设置为水平倾角,保证了扫描过程中便携式设备的成像平面能够和扫描对象表面呈平行,从而避免扫描得到的图像由于上述两个平面之间产生的夹角过大导致的形变,保证了扫描文本的质量和易处理性,提高了扫描效果。In this embodiment, by setting the preset scanning condition that the imaging plane of the portable electronic device is parallel to the surface of the scanning object, and setting the tilt parameter as a horizontal inclination angle, it is ensured that the imaging plane of the portable device can be parallel to the surface of the scanning object during the scanning process, thereby The deformation of the scanned image due to the excessively large included angle between the above two planes is avoided, the quality and ease of handling of the scanned text are ensured, and the scanning effect is improved.
作为另一种可选的实施方式,预设扫描条件为便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴平行;倾斜参数为磁方位角。As another optional implementation manner, the preset scanning condition is that the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the scanning object; the tilt parameter is a magnetic azimuth.
通过手机等便携式设备扫描文本的另一个难点在,传统的扫描设备能够将扫描文本按固定位置放置后,保证扫描文本在扫描拍摄成像的过程中,整体位于扫描设备摄像头的成像平面内,并且扫描文本的表面的中心轴平行或接近平行于成像平面的中心轴,从而获得包括完整且扫描图像的边缘与其中的扫描文本边缘平齐的扫描结果。而通过握持等方式进行扫描,虽然通常能够保证扫描文本表面的整体成像,但由于上述的原因即手机位姿的不固定,十分容易由于拍摄过程中取景框未对准扫描文本而导致最终的扫描图像中,扫描文本是歪斜的,需要进行旋转切割等后处理。Another difficulty in scanning text with portable devices such as mobile phones is that traditional scanning devices can place the scanned text at a fixed position to ensure that the scanned text is located in the imaging plane of the scanning device’s camera as a whole during the scanning, shooting and imaging process, and the scanning The central axis of the surface of the text is parallel or nearly parallel to the central axis of the imaging plane, so as to obtain a scanning result including a complete scan image with edges flush with the scanned text edges. Scanning by holding and other methods can usually ensure the overall imaging of the scanned text surface, but due to the above-mentioned reason that the pose of the mobile phone is not fixed, it is very easy to cause the final image due to the misalignment of the viewfinder frame during the shooting process. In the scanned image, the scanned text is skewed and requires post-processing such as rotation and cutting.
为了克服手机的成像平面和扫描文本的表面在投影方向上的方向不一致导致的上述问题,本实施方式设定预设扫描条件为便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴平行;倾斜参数为磁方位角。In order to overcome the above-mentioned problems caused by the inconsistency between the imaging plane of the mobile phone and the surface of the scanned text in the projection direction, this embodiment sets the preset scanning condition to be that the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the scanned object. ;The tilt parameter is the magnetic azimuth.
磁方位角即指南针的指针朝向,是由通过某点磁子午线北端起算,顺时针方向至某一直线间的夹角(即地球南北极上的磁南、磁北两点间的连线)。当然因为地球南北磁极与南北极并不重合而存在磁偏角,各地的磁偏角视经纬度而各不相同,没有统一的校正角度,需要根据各地的磁偏角数据对磁方位角进行修正后才能获取相对精确的读数。但本实施例中对于便携式电子设备的成像平面中心轴和扫描对象表面中心轴获取指南针的读数,旨在确定其相对关系,因此对于位于同地的两者并不存在上述磁偏角的影响。The magnetic azimuth is the direction of the compass pointer, which is the angle between the north end of the magnetic meridian passing through a certain point and the clockwise direction to a certain straight line (that is, the line connecting magnetic south and magnetic north on the north and south poles of the earth). Of course, there is a magnetic declination because the north and south magnetic poles of the earth do not coincide with the north and south poles. The magnetic declination angles of various places are different depending on the latitude and longitude. to obtain relatively accurate readings. However, in this embodiment, the readings of the compass are obtained for the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanned object, in order to determine their relative relationship, so there is no influence of the above-mentioned magnetic declination on the two located at the same place.
预设的磁方位角可以表征扫描文本的放置方向,假设首先将扫描文本按照一定方向进 行放置,则按照上述预设扫描条件需要使成像平面也处于该方向。当然本领域技术人员可以知晓,预设扫描条件除了上述便携式电子设备的成像平面与扫描对象表面方向一致之外,也可以包括其他设置方式。例如,便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴为一预设区间。具体地,例如便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴的误差值为±5°。本实施方式中,如果手机具有指南针功能,并且手机外形呈矩形,则对于使手机满足上述预设扫描条件可以通过以下方式实现:The preset magnetic azimuth can characterize the placement direction of the scanned text. Assuming that the scanned text is placed in a certain direction first, the imaging plane should also be in this direction according to the above preset scanning conditions. Of course, those skilled in the art can know that the preset scanning conditions may also include other setting methods besides the above-mentioned direction of the imaging plane of the portable electronic device being consistent with the surface of the scanning object. For example, the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanning object are within a preset interval. Specifically, for example, the error value between the central axis of the imaging plane of the portable electronic device and the central axis of the surface of the scanning object is ±5°. In this embodiment, if the mobile phone has a compass function, and the shape of the mobile phone is rectangular, then the following methods can be used to make the mobile phone meet the above preset scanning conditions:
将手机贴紧放置于扫描文本表面,并且使得手机的两条相邻边缘与扫描文本的两条相邻边缘保持齐平,当然可以理解,此时还需保持取景框与扫描文本的长宽方向一致。则获取此时的指南针的读数β作为预设的磁方位角,该预设的磁方位角即表征了扫描文本表面的放置方向。按照读数β来调整手机扫描时的位姿,就能够确保扫描过程中成像平面和扫描文本表面保持相对一致的方向,获得较佳的扫描结果。Place the mobile phone close to the surface of the scanned text, and keep the two adjacent edges of the mobile phone flush with the two adjacent edges of the scanned text. Of course, it is understandable that the length and width of the viewfinder frame and the scanned text should be maintained at this time unanimous. Then, the reading β of the compass at this time is obtained as the preset magnetic azimuth, and the preset magnetic azimuth represents the placement direction of the scanned text surface. Adjusting the posture of the mobile phone during scanning according to the reading β can ensure that the imaging plane and the scanning text surface maintain a relatively consistent direction during the scanning process, and obtain better scanning results.
当然,除了上述方式之外,也可以通过其他方式获得预设的磁方位角,例如预先将手机取景框对准扫描文本,并且在手机取景框显示纵横垂直的指示线,以便于对准对其扫描文本的边缘时,获取上述预设的磁方位角。Of course, in addition to the above methods, the preset magnetic azimuth can also be obtained in other ways, such as aligning the mobile phone viewfinder with the scanned text in advance, and displaying vertical and horizontal indicator lines on the mobile phone viewfinder for easy alignment. When scanning the edge of the text, obtain the above preset magnetic azimuth.
本实施方式通过设置预设扫描条件为便携式电子设备的成像平面与扫描对象表面的中心轴方向一致,以及将倾斜参数设置为磁方位角,保证了扫描过程中便携式设备的成像平面和扫描对象表面在投影方向的朝向一致,从而避免扫描得到的图像由于上述两个平面的方向不一致导致的成像歪斜不易处理,提高了扫描文本的质量。In this embodiment, by setting the preset scanning condition that the imaging plane of the portable electronic device is consistent with the central axis direction of the scanning object surface, and setting the tilt parameter as the magnetic azimuth angle, the imaging plane of the portable electronic device and the scanning object surface are guaranteed during the scanning process. The orientation of the projection direction is consistent, thereby avoiding the imaging distortion of the scanned image due to the inconsistency of the directions of the above two planes, which is difficult to handle, and improving the quality of the scanned text.
作为一种可选的实施方式,本实施例的扫描系统还包括:As an optional implementation manner, the scanning system of this embodiment also includes:
动态拍摄模块41,用于对扫描对象表面通过动态拍摄进行扫描,以获得至少两帧图像;A dynamic photographing module 41, configured to scan the surface of the scanned object through dynamic photographing to obtain at least two frames of images;
目标图像获取模块42,用于从所有图像中获取目标图像,其中在所有图像中,目标图像对应的倾斜参数与预设的倾斜参数的差值绝对值最小。The target image acquiring module 42 is configured to acquire the target image from all the images, wherein in all the images, the absolute value of the difference between the tilt parameter corresponding to the target image and the preset tilt parameter is the smallest.
目前大多数手机以及其他可作为便携式电子设备的电子设备都带有动态拍摄功能,即在短时间可拍摄连续的图像,通常可以达到拍摄每秒8张及以上。利用动态拍摄功能,可以较好地弥补通过握持等方式进行扫描带来的便携式电子设备自身位姿不固定的缺陷。At present, most mobile phones and other electronic devices that can be used as portable electronic devices have a dynamic shooting function, that is, they can shoot continuous images in a short time, usually up to 8 pictures per second and above. Utilizing the dynamic shooting function can better make up for the defect that the portable electronic device itself is not fixed in position and posture caused by scanning by holding or other methods.
动态拍摄模块41对扫描对象表面通过动态拍摄进行扫描获得至少两帧图像,即通过上述动态拍摄的方式对扫描文本进行连拍,获得连拍图像。目标图像获取模块42从上述连拍获得的所有图像中,基于与预设的倾斜参数的比较,遴选与预设的倾斜参数的差值绝对值最小的倾斜参数对应的图像作为目标图像,即最终的扫描成果。The dynamic photographing module 41 scans the surface of the scanning object through dynamic photographing to obtain at least two frames of images, that is, continuously photographs the scanned text in the above-mentioned dynamic photographing manner to obtain continuous photographing images. The target image acquisition module 42 selects the image corresponding to the tilt parameter with the smallest absolute value of the difference between the preset tilt parameters based on the comparison with the preset tilt parameters from all the images obtained by the above-mentioned continuous shooting, as the target image, that is, the final scan results.
对于目标图像获取模块42,以上述具有水平仪功能时设定的水平倾角为倾斜参数为例进行说明。参见图3,水平仪为气泡式圆盘水平仪,并且带有横坐标及纵坐标的四象限二维坐标刻度,水平倾角可以通过气泡的纵横坐标读数获得。则假设扫描文本放置于桌面时,水平仪的气泡的坐标读数为(x’,y’),则对于连拍后获得n张图像,获取其中气泡的坐标读数:For the target image acquisition module 42 , it will be described by taking the above-mentioned horizontal inclination set as the inclination parameter when it has the function of the spirit level as an example. Referring to Figure 3, the spirit level is a bubble-type disk spirit level with a four-quadrant two-dimensional coordinate scale of abscissa and ordinate, and the horizontal inclination can be obtained by reading the ordinate and abscissa of the bubble. Then assume that when the scanned text is placed on the desktop, the coordinate reading of the bubble of the level is (x’, y’), then for n images obtained after continuous shooting, the coordinate reading of the bubble in it is obtained:
其中,(x
i,y
i)分别为第i张图像的水平仪的气泡的坐标读数。从而与最终获取的A
i对应就是符合要求的目标图像,即具有拍摄时与扫描文本表面最接近平行的手机成像平面。
Wherein, (x i , y i ) are the coordinate readings of the bubbles of the spirit level in the i-th image, respectively. Therefore, corresponding to the finally obtained A i is the target image that meets the requirements, that is, the imaging plane of the mobile phone that is closest to the parallel to the surface of the scanned text when shooting.
同样地,本实施方式适用于倾斜参数为磁方位角的应用场景,并且在一种应用场景中,可以将上述至少包括水平倾角和磁方位角的两种当前的倾斜参数同时与各自的预设的倾斜参数进行比较,分别获得的差值绝对值则可以按照一定的权重进行综合计算。Likewise, this embodiment is applicable to the application scenario where the tilt parameter is the magnetic azimuth, and in one application scenario, the above two current tilt parameters including at least the horizontal tilt and the magnetic azimuth can be combined with the respective preset The tilt parameters are compared, and the absolute value of the difference obtained separately can be comprehensively calculated according to a certain weight.
例如,按照上述步骤分别获得每张图片的水平倾角与的预设的水平倾角的差值绝对值为T
α,每张图片的水平倾角与的预设的水平倾角的差值绝对值为T
β,如果设定符合水平倾角与预设一致的权重为0.6,符合磁方位角与预设一致的权重为0.4,则每张图片的倾斜参数的差值绝对值的综合值S=T
α*0.6+T
β*0.4,从而在所有连拍获得的图像中,获取具有最小值的S;其对应的图像即为目标图像。此外还应当理解,本实施方式中的倾斜参数包括但不限于上述两种方式及组合。
For example, according to the above steps, the absolute value of the difference between the horizontal inclination of each picture and the preset horizontal inclination is T α , and the absolute value of the difference between the horizontal inclination of each picture and the preset horizontal inclination is T β , if the weight of the horizontal inclination consistent with the preset is set to 0.6, and the weight of the magnetic azimuth consistent with the preset is set to 0.4, then the comprehensive value of the absolute value of the difference between the tilt parameters of each picture S=T α *0.6 +T β *0.4, so that among all the images obtained by continuous shooting, the S with the minimum value is obtained; the corresponding image is the target image. In addition, it should be understood that the tilt parameters in this embodiment include but are not limited to the above two manners and combinations.
本实施方式充分利用了便携式电子设备的动态拍摄功能,并对拍摄过程中难以避免的抖动造成的扫描图像偏差通过自动择优的方式予以克服,从而增加了获得质量符合要求的图片的可能性,且通过一次连拍代替多次扫描,提升了便携式设备的扫描效率和扫描效果。This embodiment makes full use of the dynamic shooting function of the portable electronic device, and overcomes the deviation of the scanned image caused by the unavoidable shaking during the shooting process by automatically selecting the best, thereby increasing the possibility of obtaining pictures that meet the quality requirements, and By replacing multiple scans with one continuous shooting, the scanning efficiency and scanning effect of portable devices are improved.
在一种可选的实施方式中,本实施例的扫描系统还包括:In an optional implementation manner, the scanning system of this embodiment further includes:
全景拍摄模块401,用于对扫描对象表面通过全景拍摄进行扫描,以获得至少两帧图像;A panoramic shooting module 401, configured to scan the surface of the scanned object by panoramic shooting to obtain at least two frames of images;
基准图像获取模块402,用于从所有图像中获取基准图像,其中在所有图像中,基准图像对应的倾斜参数与预设的倾斜参数的差值绝对值最小;A reference image acquisition module 402, configured to acquire a reference image from all images, wherein in all images, the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest;
仿射变换模块403,用于对基准图像以外的图像进行仿射变换,以使仿射变换后的图像的倾斜参数与基准图像对应的倾斜参数一致;An affine transformation module 403, configured to perform affine transformation on images other than the reference image, so that the inclination parameters of the affine transformed image are consistent with the inclination parameters corresponding to the reference image;
全景图像获取模块404,用于对基准图像以及仿射变换后的图像进行图像融合处理,以获取全景图像。The panoramic image acquisition module 404 is configured to perform image fusion processing on the reference image and the affine transformed image to acquire a panoramic image.
目前大多数手机以及其他可作为便携式电子设备的电子设备还具备全景拍摄功能用 于拍摄全景照片,全景照片通常是指符合人眼正常有效视角或包括双眼余光视角以上乃至360°完整场景范围拍摄的照片。扫描文本大多数情况下是A4尺寸的纸型,但也有些特殊的内容如画卷、代码文本等需要长宽比值较大的长条形扫描文本作为载体,在这种应用场景中为了将所有的文本进行扫描,可以通过全景拍摄来实现。但是在全景拍摄的过程中,握持手机的时间较长,摄像头极易发生抖动偏移导致拍摄效果不佳。本实施方式提供的长文本扫描技术即针对上述由于扫描过程中扫描设备位姿不固定造成的缺陷加以改进。At present, most mobile phones and other electronic devices that can be used as portable electronic devices also have a panoramic shooting function for taking panoramic photos. Panoramic photos usually refer to shooting that conforms to the normal effective angle of view of the human eye or includes the angle of view above the peripheral vision of both eyes or even a complete 360° scene range. Photo. Most of the scanned text is A4 size paper, but there are also some special content such as scrolls, code texts, etc. that require long strips of scanned text with a large aspect ratio as the carrier. In this application scenario, in order to store all the text Scanning can be achieved by panoramic shooting. However, in the process of panoramic shooting, the phone is held for a long time, and the camera is prone to shake and shift, resulting in poor shooting results. The long text scanning technology provided in this embodiment improves on the above defects caused by the unstable pose of the scanning device during the scanning process.
全景拍摄模块401对扫描对象表面通过动态拍摄进行扫描获得至少两帧图像,即通过上述动态拍摄的方式对扫描文本进行连拍,获得连拍图像。基准图像获取模块402从上述连拍获得的所有图像中,基于与预设的倾斜参数的比较,遴选与预设的倾斜参数的差值绝对值最小的倾斜参数对应的图像作为基准图像。当然,基准图像获取模块402同样可以针对水平倾角、磁方位角以及其他倾斜参数进行评价,评价结果也可以如上一实施方式中所述依据权重等不同方式进行组合评价,由于具体涉及的原理类似不再赘述。The panoramic shooting module 401 scans the surface of the scanning object through dynamic shooting to obtain at least two frames of images, that is, continuously shoots the scanned text through the above-mentioned dynamic shooting method to obtain continuous shooting images. The reference image acquisition module 402 selects the image corresponding to the tilt parameter with the smallest absolute value of the preset tilt parameter difference as the reference image from all the images obtained by the continuous shooting, based on the comparison with the preset tilt parameter. Of course, the reference image acquisition module 402 can also evaluate the horizontal inclination, magnetic azimuth and other inclination parameters, and the evaluation results can also be combined and evaluated in different ways such as weights as described in the previous embodiment. Let me repeat.
通常全景拍摄的实现分为如下步骤:特征检测、特征匹配、计算单应性矩阵、图像变形以及图像拼合。基准图像获取模块402从所有拍摄的图像中,获取基准图像作为特征检测和特征匹配的参考依据,由于在所有的图像中,基准图像对应的倾斜参数与预设的倾斜参数的差值绝对值最小,可以认为该基准图像具有较强的位姿参考评价意义。基于该基准图像的倾斜参数以及其他图像特征作出的全景图像生成结果也能较好地还原扫描文本的内容。Usually, the realization of panoramic shooting is divided into the following steps: feature detection, feature matching, calculation of homography matrix, image deformation and image stitching. The reference image acquisition module 402 obtains the reference image from all captured images as a reference basis for feature detection and feature matching, because in all images, the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest , it can be considered that the reference image has a strong pose reference evaluation significance. The panorama image generation result based on the tilt parameters of the reference image and other image features can also better restore the content of the scanned text.
仿射变换模块403对基准图像以外的图像进行仿射变换,以使仿射变换后的图像的倾斜参数与基准图像对应的倾斜参数一致。The affine transformation module 403 performs affine transformation on images other than the reference image, so that the inclination parameters of the affine transformed image are consistent with the inclination parameters corresponding to the reference image.
仿射变换又称仿射映射,是指在几何中一个向量空间进行一次线性变换并接上一个平移,变换为另一个向量空间。其计算过程可能包括平移、旋转、放缩、剪切、反射;其计算得到的结果具有特征:线段在仿射变换后依然是线段并且相互间比例保持不变。而全景图像的生成过程中,由于通过本实施方式中获取的具有较高质量的图像作为基准图像,其他图像基于基准图像进行仿射变换而得到一组图像,能够保证全景图像的质量。Affine transformation, also known as affine mapping, refers to performing a linear transformation in a vector space in geometry followed by a translation to transform it into another vector space. The calculation process may include translation, rotation, scaling, shearing, and reflection; the calculated results have characteristics: the line segments are still line segments after the affine transformation and the ratio between them remains unchanged. In the process of generating the panoramic image, since the image with higher quality obtained in this embodiment is used as the reference image, other images are affine transformed based on the reference image to obtain a group of images, which can ensure the quality of the panoramic image.
全景图像获取模块404对基准图像以及仿射变换后的图像进行图像融合处理以获取全景图像。由于经过仿射变换后的图像具有较高的特征点拟合度,因此进行图像融合拼接时对每幅图进行特征点提取、匹配、配准的准确性更高,对各图像的重叠边界的处理更精确,从而能够得到效果更佳的全景图像。The panoramic image acquisition module 404 performs image fusion processing on the reference image and the affine transformed image to acquire a panoramic image. Since the image after affine transformation has a high degree of fitting of feature points, the accuracy of feature point extraction, matching, and registration for each image is higher when performing image fusion stitching, and the overlapping boundaries of each image are more accurate. The processing is more precise, resulting in better panoramic images.
本实施方式利用便携式电子设备的全景图像动态拍摄功能进行长文本扫描,并基于倾斜参数获取基准图像,从而保证了能够生成更为精确的全景图像,解决了以往由于拍摄过程的人为操作误差造成的全景图像失真和质量较低的问题,提升了便携式设备对于长文本的扫描效果。This embodiment uses the panoramic image dynamic shooting function of the portable electronic device to scan long texts, and obtains the reference image based on the tilt parameters, thereby ensuring that a more accurate panoramic image can be generated, and solving the problems caused by human operation errors in the shooting process in the past. Panoramic image distortion and lower quality issues improve the scanning performance of long text on portable devices.
对于上述实施方式,全景拍摄模块401还用于获取图像对应的扫描距离,扫描距离为便携式电子设备的摄像头在焦距方向上到扫描对象表面的距离。基准图像对应的扫描距离为基准扫描距离;全景图像获取模块404还用于使仿射变换后的图像的扫描距离与基准扫描距离一致。For the above embodiments, the panoramic shooting module 401 is also used to acquire the scanning distance corresponding to the image, and the scanning distance is the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction. The scanning distance corresponding to the reference image is the reference scanning distance; the panoramic image acquisition module 404 is also configured to make the scanning distance of the affine transformed image consistent with the reference scanning distance.
TOF摄像头是一种使用调制光源照亮场景并观察反射光进行测距的3D摄像头,利用TOF测量原理确定摄像头与物体或周围环境之间距离,并通过测量的点生成深度图像或3D图像,测距原理即通过测量光在某介质中行进一段距离所需的时间,通常是对脉冲发射光到达物体并反射回到传感器所用时间测量。由于TOF摄像头能够收集景深信息并且可以获取更多的图像细节,因此其不仅可以获取更多高精度的特征点用于后续的图像融合操作,还能获得更精细的扫描效果。本实施例通过TOF摄像头获得精确的扫描距离,有助于在图像融合过程中进行更准确的特征匹配。The TOF camera is a 3D camera that uses a modulated light source to illuminate the scene and observe the reflected light for distance measurement. It uses the TOF measurement principle to determine the distance between the camera and the object or the surrounding environment, and generates a depth image or 3D image through the measured points. The distance principle is to measure the time required for light to travel a certain distance in a medium, usually the time it takes for the pulsed emitted light to reach the object and reflect back to the sensor. Since the TOF camera can collect depth of field information and obtain more image details, it can not only obtain more high-precision feature points for subsequent image fusion operations, but also obtain finer scanning effects. In this embodiment, the precise scanning distance is obtained by the TOF camera, which is helpful for more accurate feature matching in the process of image fusion.
本实施方式进一步通过设置扫描距离综合评价并获取基准图像,使得基准图像在全景图像生成的过程中具有更高的参考意义,进一步提高了全景图像的精确度,进一步改善长文本扫描的图像失真问题并提升了便携式设备对于长文本的扫描效果。In this embodiment, by setting the comprehensive evaluation of the scanning distance and obtaining the reference image, the reference image has a higher reference significance in the process of generating the panoramic image, further improves the accuracy of the panoramic image, and further improves the image distortion problem of long text scanning And improved the scanning effect of portable devices for long text.
在一种可选的实施方式中,本实施例的扫描系统还包括:In an optional implementation manner, the scanning system of this embodiment further includes:
成像区域分析模块51,用于获取至少两组扫描距离与该扫描距离下,扫描对象在便携式电子设备的成像区域内的面积占比的对应关系。可以理解,扫描距离和上一实施方式中相同,均为便携式电子设备的摄像头在焦距方向上到扫描对象表面的距离。The imaging area analysis module 51 is configured to obtain at least two sets of correspondences between scanning distances and the area ratio of the scanning object within the imaging area of the portable electronic device under the scanning distances. It can be understood that the scanning distance is the same as that in the previous embodiment, which is the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction.
最佳距离确定模块52,用于基于所述对应关系确定最佳扫描距离;An optimal distance determination module 52, configured to determine an optimal scanning distance based on the correspondence;
第一提示信息模块53,用于生成第一提示信息,第一提示信息中包括所述最佳扫描距离。The first prompt information module 53 is configured to generate first prompt information, which includes the optimal scanning distance.
参见图4,对于固定放置的扫描对象A,为了尽量减少不必要的多次重复扫描,应当在扫描过程中,尽可能将其成像a包含于便携式电子设备的成像区域a’中,同时,为了保证扫描的精度以便后期处理,还应当尽可能地使其成像a在成像区域a’中的面积占比a/a’达到最大。Referring to Fig. 4, for a fixedly placed scanning object A, in order to minimize unnecessary repeated scanning, its image a should be included in the imaging area a' of the portable electronic device as much as possible during the scanning process, and at the same time, in order to To ensure the scanning accuracy for later processing, the area ratio a/a' of the image a in the imaging area a' should be maximized as much as possible.
具体地,成像区域分析模块51可以在扫描的准备过程中即聚焦阶段,或是扫描过程中,当检测到便携式电子设备的摄像头在焦距方向上到扫描对象表面的距离发生变化时,通过文本边缘检测获取文本范围、文本边缘等参数,以及在此基础上获取至少两组扫描距离与上述面积占比的对应关系。最佳距离确定模块52据此解算得到基于当前扫描对象的放置位置,应当以何种距离进行扫描为宜,该距离即最佳扫描距离。该最佳扫描距离也就是保证文本边缘均落入上述成像区域a’的同时,使得面积占比a/a’为最大值时的扫描距离。Specifically, the imaging area analysis module 51 can detect that the distance between the camera of the portable electronic device and the surface of the scanned object changes in the focal length direction during the scanning preparation process, that is, the focusing stage, or during the scanning process. Detect and obtain parameters such as text range and text edge, and on this basis, obtain at least two sets of corresponding relationships between scanning distances and the above-mentioned area ratios. Based on this, the optimal distance determination module 52 calculates which distance should be used for scanning based on the placement position of the current scanning object, and the distance is the optimal scanning distance. The optimal scanning distance is the scanning distance at which the area ratio a/a' is the maximum value while ensuring that the edges of the text all fall into the aforementioned imaging area a'.
最后,第一提示信息模块53显示该最佳扫描距离,帮助用户及时调整便携式电子设备以更准确地进行扫描。Finally, the first prompt information module 53 displays the optimal scanning distance to help the user adjust the portable electronic device in time to scan more accurately.
本实施方式通过对扫描文本的成像区域的图像分析获取扫描文本在其中的面积占比,进而确定对于该扫描文本的最佳扫描距离并提示给用户,从而有助于获得更好的扫描效果,确保扫描工作效率的同时,能够获得尽可能高的扫描清晰度。In this embodiment, the area ratio of the scanned text is obtained by analyzing the imaged area of the scanned text, and then the optimal scanning distance for the scanned text is determined and prompted to the user, thereby helping to obtain a better scanning effect. Get the highest possible scan clarity while ensuring scan productivity.
在一种可选的实施方式中,扫描系统还包括第二提示信息模块,用于在当前的倾斜参数与预设的倾斜参数的误差超过预设范围时生成第二提示信息,第二提示信息用于提示用户调整便携式电子设备以使误差缩小至预设范围内。In an optional embodiment, the scanning system further includes a second prompt information module, configured to generate second prompt information when the error between the current tilt parameter and the preset tilt parameter exceeds a preset range, and the second prompt information It is used to prompt the user to adjust the portable electronic device to reduce the error within the preset range.
具体地,当倾斜参数为水平倾角时,如果当前的水平倾角为30°,预设的水平倾角为5°,误差的预设范围为10°;则当前的水平倾角和预设的水平倾角的误差25°超过预设范围,则第二提示信息模块生成第二提示信息。例如,可实时显示当前的水平倾角和预设的水平倾角的差值绝对值,并且当检测到该绝对值趋近上述预设范围值时显示绿色箭头;反之,当检测到该绝对值远离上述预设范围值时显示红色的警示箭头。Specifically, when the inclination parameter is the horizontal inclination, if the current horizontal inclination is 30°, the preset horizontal inclination is 5°, and the preset error range is 10°; then the current horizontal inclination and the preset horizontal inclination If the error of 25° exceeds the preset range, the second prompt information module generates second prompt information. For example, the absolute value of the difference between the current horizontal inclination and the preset horizontal inclination can be displayed in real time, and a green arrow is displayed when it is detected that the absolute value is close to the above-mentioned preset range value; A red warning arrow is displayed when the range value is preset.
当倾斜参数为磁方位角时,如果当前的磁方位角为西偏南20°,预设的磁方位角为西偏北5°,而误差的预设范围为10°;则当前的磁方位角和预设的磁方位角的误差25°超过预设范围,则第二提示信息模块生成第二提示信息。此时,可于电子设备实时显示当前的磁方位角和预设的磁方位角的差值绝对值,以及显示一箭头表征用户应当将便携式电子设备转向的方向,同时对于箭头颜色,可当检测到该差值绝对值趋近上述预设范围值时显示绿色箭头;反之,当检测到该绝对值远离上述预设范围值时显示红色的警示箭头。When the tilt parameter is magnetic azimuth, if the current magnetic azimuth is 20° south by west, the preset magnetic azimuth is 5° north by west, and the preset error range is 10°; then the current magnetic azimuth If the error of 25° between the angle and the preset magnetic azimuth exceeds the preset range, the second prompt information module generates second prompt information. At this time, the absolute value of the difference between the current magnetic azimuth and the preset magnetic azimuth can be displayed on the electronic device in real time, and an arrow can be displayed to indicate the direction in which the user should turn the portable electronic device. At the same time, the color of the arrow can be detected A green arrow is displayed when the absolute value of the difference is close to the preset range value; otherwise, a red warning arrow is displayed when the absolute value is detected to be far from the preset range value.
本实施方式在便携式电子设备扫描过程中倾斜参数超出预设范围的情况下,生成针对性的提示以帮助用户进行纠偏,从而有利于获得更佳的扫描效果,提高了用户体验。In this embodiment, when the tilt parameter exceeds the preset range during the scanning process of the portable electronic device, a targeted prompt is generated to help the user correct the deviation, which is beneficial to obtain a better scanning effect and improves user experience.
本实施例通过提供一种便携式电子设备的扫描系统,使得便携式电子设备在扫描过程中保持合理的位姿,从而能够确保扫描成果的精度,提高了扫描操作的效率,也使得扫描 的成果更适于进行裁剪等后处理。This embodiment provides a scanning system for a portable electronic device, so that the portable electronic device maintains a reasonable posture during the scanning process, thereby ensuring the accuracy of the scanning result, improving the efficiency of the scanning operation, and making the scanning result more suitable. For post-processing such as cropping.
实施例3Example 3
图6为本发明实施例3提供的一种电子设备的结构示意图。电子设备包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行程序时实现实施例1中的便携式电子设备的扫描方法。图6显示的电子设备30仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。FIG. 6 is a schematic structural diagram of an electronic device provided by Embodiment 3 of the present invention. The electronic device includes a memory, a processor, and a computer program stored in the memory and operable on the processor. When the processor executes the program, the scanning method of the portable electronic device in Embodiment 1 is realized. The electronic device 30 shown in FIG. 6 is only an example, and should not limit the functions and scope of use of the embodiments of the present invention.
如图6所示,电子设备30可以以通用计算设备的形式表现,例如其可以为服务器设备。电子设备30的组件可以包括但不限于:上述至少一个处理器31、上述至少一个存储器32、连接不同系统组件(包括存储器32和处理器31)的总线33。As shown in FIG. 6, the electronic device 30 may be in the form of a general-purpose computing device, for example, it may be a server device. Components of the electronic device 30 may include, but are not limited to: at least one processor 31 , at least one memory 32 , and a bus 33 connecting different system components (including the memory 32 and the processor 31 ).
总线33包括数据总线、地址总线和控制总线。The bus 33 includes a data bus, an address bus, and a control bus.
存储器32可以包括易失性存储器,例如随机存取存储器(RAM)321和/或高速缓存存储器322,还可以进一步包括只读存储器(ROM)323。The memory 32 may include a volatile memory, such as a random access memory (RAM) 321 and/or a cache memory 322 , and may further include a read only memory (ROM) 323 .
存储器32还可以包括具有一组(至少一个)程序模块324的程序/实用工具325,这样的程序模块324包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。 Memory 32 may also include a program/utility tool 325 having a set (at least one) of program modules 324 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, which Each or some combination of the examples may include the implementation of a network environment.
处理器31通过运行存储在存储器32中的计算机程序,从而执行各种功能应用以及数据处理,例如本发明实施例1中的便携式电子设备的扫描方法。The processor 31 executes various functional applications and data processing by running the computer program stored in the memory 32 , such as the scanning method of the portable electronic device in Embodiment 1 of the present invention.
电子设备30也可以与一个或多个外部设备34(例如键盘、指向设备等)通信。这种通信可以通过输入/输出(I/O)接口35进行。并且,模型生成的设备30还可以通过网络适配器36与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图6所示,网络适配器36通过总线33与模型生成的设备30的其它模块通信。应当明白,尽管图中未示出,可以结合模型生成的设备30使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理器、外部磁盘驱动阵列、RAID(磁盘阵列)系统、磁带驱动器以及数据备份存储系统等。 Electronic device 30 may also communicate with one or more external devices 34 (eg, keyboards, pointing devices, etc.). Such communication may occur through input/output (I/O) interface 35 . Also, the model generation device 30 can also communicate with one or more networks (eg, a local area network (LAN), a wide area network (WAN) and/or a public network, such as the Internet) via a network adapter 36 . As shown in FIG. 6 , network adapter 36 communicates with other modules of model generation device 30 via bus 33 . It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the model generating device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.
应当注意,尽管在上文详细描述中提及了电子设备的若干单元/模块或子单元/模块,但是这种划分仅仅是示例性的并非强制性的。实际上,根据本发明的实施方式,上文描述的两个或更多单元/模块的特征和功能可以在一个单元/模块中具体化。反之,上文描述的一个单元/模块的特征和功能可以进一步划分为由多个单元/模块来具体化。It should be noted that although several units/modules or subunits/modules of an electronic device are mentioned in the above detailed description, such division is only exemplary and not mandatory. Actually, according to the embodiment of the present invention, the features and functions of two or more units/modules described above may be embodied in one unit/module. Conversely, the features and functions of one unit/module described above can be further divided to be embodied by a plurality of units/modules.
实施例4Example 4
本实施例提供了一种计算机可读存储介质,其上存储有计算机程序,程序被处理器执行时实现实施例1中的便携式电子设备的扫描方法中。This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the scanning method for the portable electronic device in Embodiment 1 is implemented.
其中,可读存储介质可以采用的更具体可以包括但不限于:便携式盘、硬盘、随机存取存储器、只读存储器、可擦拭可编程只读存储器、光存储器件、磁存储器件或上述的任意合适的组合。Wherein, the readable storage medium that can be used more specifically may include, but is not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device or any of the above-mentioned the right combination.
在可能的实施方式中,本发明还可以实现为一种程序产品的形式,其包括程序代码,当程序产品在终端设备上运行时,程序代码用于使终端设备执行实现实施例1中的便携式电子设备的扫描方法中。In a possible implementation, the present invention can also be implemented in the form of a program product, which includes program code. When the program product runs on the terminal device, the program code is used to make the terminal device execute the portable In scanning methods for electronic devices.
其中,可以以一种或多种程序设计语言的任意组合来编写用于执行本发明的程序代码,程序代码可以完全地在用户设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户设备上部分在远程设备上执行或完全在远程设备上执行。Wherein, the program code for executing the present invention may be written in any combination of one or more programming languages, and the program code may be completely executed on the user equipment, partially executed on the user equipment, or used as an independent software Package execution, partly on the user device and partly on the remote device, or entirely on the remote device.
虽然以上描述了本发明的具体实施方式,但是本领域的技术人员应当理解,这仅是举例说明,本发明的保护范围是由所附权利要求书限定的。本领域的技术人员在不背离本发明的原理和实质的前提下,可以对这些实施方式做出多种变更或修改,但这些变更和修改均落入本发明的保护范围。Although the specific implementation of the present invention has been described above, those skilled in the art should understand that this is only an example, and the protection scope of the present invention is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principle and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.
Claims (20)
- 一种便携式电子设备的扫描方法,其特征在于,所述扫描方法包括以下步骤:A scanning method for a portable electronic device, characterized in that the scanning method comprises the following steps:获取所述便携式电子设备的成像平面与扫描对象表面之间满足预设扫描条件时,所述便携式电子设备的预设的倾斜参数;Acquiring a preset tilt parameter of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object;获取所述便携式电子设备的当前的倾斜参数;Acquiring the current tilt parameter of the portable electronic device;若所述当前的倾斜参数与所述预设的倾斜参数的误差处于预设范围内,则控制所述便携式电子设备对所述扫描对象表面进行扫描。If the error between the current tilt parameter and the preset tilt parameter is within a preset range, the portable electronic device is controlled to scan the surface of the scanning object.
- 如权利要求1所述的便携式电子设备的扫描方法,其特征在于,所述预设扫描条件包括:所述便携式电子设备的成像平面与所述扫描对象表面平行;所述倾斜参数包括水平倾角。The scanning method for a portable electronic device according to claim 1, wherein the preset scanning condition includes: the imaging plane of the portable electronic device is parallel to the surface of the scanning object; and the inclination parameter includes a horizontal inclination.
- 如权利要求1所述的便携式电子设备的扫描方法,其特征在于,所述预设扫描条件包括:所述便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴平行;所述倾斜参数包括磁方位角。The scanning method of a portable electronic device according to claim 1, wherein the preset scanning condition comprises: the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the scanning object; the tilt parameter Includes magnetic azimuth.
- 如权利要求1-3中任一项所述的便携式电子设备的扫描方法,其特征在于,所述扫描方法还包括:The scanning method of a portable electronic device according to any one of claims 1-3, wherein the scanning method further comprises:对所述扫描对象表面通过动态拍摄进行扫描,以获得至少两帧图像;Scanning the surface of the scanning object by dynamic shooting to obtain at least two frames of images;从所有图像中获取目标图像,其中在所有图像中,所述目标图像对应的倾斜参数与所述预设的倾斜参数的差值绝对值最小。The target image is acquired from all the images, wherein in all the images, the absolute value of the difference between the tilt parameter corresponding to the target image and the preset tilt parameter is the smallest.
- 如权利要求1-3中任一项所述的便携式电子设备的扫描方法,其特征在于,所述扫描方法还包括:The scanning method of a portable electronic device according to any one of claims 1-3, wherein the scanning method further comprises:对所述扫描对象表面通过全景拍摄进行扫描,以获得至少两帧图像;Scanning the surface of the scanning object by panoramic shooting to obtain at least two frames of images;从所有图像中获取基准图像,其中在所有图像中,所述基准图像对应的倾斜参数与所述预设的倾斜参数的差值绝对值最小;Obtaining a reference image from all images, wherein in all images, the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest;对所述基准图像以外的图像进行仿射变换,以使仿射变换后的图像的倾斜参数与所述基准图像对应的倾斜参数一致;performing affine transformation on images other than the reference image, so that the tilt parameters of the affine transformed image are consistent with the tilt parameters corresponding to the reference image;对所述基准图像以及仿射变换后的图像进行图像融合处理,以获取全景图像。Perform image fusion processing on the reference image and the image after affine transformation to obtain a panoramic image.
- 如权利要求5所述的便携式电子设备的扫描方法,其特征在于,所述对所述扫描对 象表面通过全景拍摄进行扫描,以获得至少两帧图像的步骤还包括:获取所述图像对应的扫描距离,所述扫描距离为所述便携式电子设备的摄像头在焦距方向上到所述扫描对象表面的距离;The scanning method of a portable electronic device according to claim 5, wherein the step of scanning the surface of the scanning object by panoramic shooting to obtain at least two frames of images further comprises: obtaining a scan corresponding to the image distance, the scanning distance is the distance from the camera of the portable electronic device to the surface of the scanning object in the focal length direction;所述基准图像对应的扫描距离为基准扫描距离;The scanning distance corresponding to the reference image is the reference scanning distance;所述对所述基准图像以外的图像进行仿射变换的步骤还使仿射变换后的图像的扫描距离与所述基准扫描距离一致。The step of performing affine transformation on images other than the reference image also makes the scanning distance of the image after affine transformation consistent with the reference scanning distance.
- 如权利要求1所述的便携式电子设备的扫描方法,其特征在于,所述扫描方法还包括:The scanning method of portable electronic device as claimed in claim 1, is characterized in that, described scanning method also comprises:获取至少两组扫描距离与所述扫描距离下所述扫描对象在所述便携式电子设备的成像区域内的面积占比的对应关系;所述扫描距离为所述便携式电子设备的摄像头在焦距方向上到所述扫描对象表面的距离;Acquiring at least two sets of correspondences between scanning distances and the area ratio of the scanning object in the imaging area of the portable electronic device under the scanning distances; the scanning distance is the focal length direction of the camera of the portable electronic device the distance to the surface of the scanned object;基于所述对应关系确定最佳扫描距离;determining an optimal scanning distance based on the correspondence;生成第一提示信息,所述第一提示信息包括所述最佳扫描距离。Generate first prompt information, where the first prompt information includes the optimal scanning distance.
- 如权利要求1所述的便携式电子设备的扫描方法,其特征在于,所述获取所述便携式电子设备的当前的倾斜参数的步骤之后还包括:The scanning method of the portable electronic device according to claim 1, wherein, after the step of obtaining the current tilt parameter of the portable electronic device, it also includes:若所述当前的倾斜参数与所述预设的倾斜参数的误差超过预设范围,则生成第二提示信息,所述第二提示信息用于提示用户调整所述便携式电子设备,以使所述误差缩小至所述预设范围内。If the error between the current tilt parameter and the preset tilt parameter exceeds a preset range, second prompt information is generated, and the second prompt information is used to prompt the user to adjust the portable electronic device so that the The error is reduced to within the preset range.
- 一种便携式电子设备的扫描系统,其特征在于,所述扫描系统包括:A scanning system for a portable electronic device, characterized in that the scanning system includes:参数预设模块,用于获取所述便携式电子设备的成像平面与扫描对象表面之间满足预设扫描条件时,所述便携式电子设备的预设的倾斜参数;A parameter preset module, configured to obtain a preset tilt parameter of the portable electronic device when the preset scanning condition is satisfied between the imaging plane of the portable electronic device and the surface of the scanning object;参数获取模块,用于获取所述便携式电子设备的当前的倾斜参数;A parameter acquisition module, configured to acquire the current tilt parameter of the portable electronic device;扫描控制模块,用于在所述当前的倾斜参数与所述预设的倾斜参数的误差处于预设范围内时,控制所述便携式电子设备对所述扫描对象表面进行扫描。A scanning control module, configured to control the portable electronic device to scan the surface of the scanning object when the error between the current tilt parameter and the preset tilt parameter is within a preset range.
- 如权利要求9所述的便携式电子设备的扫描系统,其特征在于,所述预设扫描条件包括:所述便携式电子设备的成像平面与所述扫描对象表面平行;所述倾斜参数包括水平倾角。The scanning system of a portable electronic device according to claim 9, wherein the preset scanning condition includes: the imaging plane of the portable electronic device is parallel to the surface of the scanning object; and the inclination parameter includes a horizontal inclination.
- 如权利要求9所述的便携式电子设备的扫描系统,其特征在于,所述预设扫描条件包括:所述便携式电子设备的成像平面的中心轴与扫描对象表面的中心轴平行;所述倾斜 参数包括磁方位角。The scanning system of a portable electronic device according to claim 9, wherein the preset scanning conditions include: the central axis of the imaging plane of the portable electronic device is parallel to the central axis of the surface of the scanning object; the tilt parameter Includes magnetic azimuth.
- 如权利要求9-11中任一项所述的便携式电子设备的扫描系统,其特征在于,所述扫描系统还包括:The scanning system of a portable electronic device according to any one of claims 9-11, wherein the scanning system further comprises:动态拍摄模块,用于对所述扫描对象表面通过动态拍摄进行扫描,以获得至少两帧图像;A dynamic shooting module, configured to scan the surface of the scanned object by dynamic shooting to obtain at least two frames of images;目标图像获取模块,用于从所有图像中获取目标图像,其中在所有图像中,所述目标图像对应的倾斜参数与所述预设的倾斜参数的差值绝对值最小。The target image acquiring module is configured to acquire the target image from all the images, wherein in all the images, the absolute value of the difference between the tilt parameter corresponding to the target image and the preset tilt parameter is the smallest.
- 如权利要求9-11中任一项所述的便携式电子设备的扫描系统,其特征在于,所述扫描系统还包括:The scanning system of a portable electronic device according to any one of claims 9-11, wherein the scanning system further comprises:全景拍摄模块,用于对所述扫描对象表面通过全景拍摄进行扫描,以获得至少两帧图像;A panoramic shooting module, configured to scan the surface of the scanning object by panoramic shooting to obtain at least two frames of images;基准图像获取模块,用于从所有图像中获取基准图像,其中在所有图像中,所述基准图像对应的倾斜参数与所述预设的倾斜参数的差值绝对值最小;A reference image acquisition module, configured to obtain a reference image from all images, wherein in all images, the absolute value of the difference between the tilt parameter corresponding to the reference image and the preset tilt parameter is the smallest;仿射变换模块,用于对所述基准图像以外的图像进行仿射变换,以使仿射变换后的图像的倾斜参数与所述基准图像对应的倾斜参数一致;An affine transformation module, configured to perform affine transformation on images other than the reference image, so that the tilt parameters of the affine transformed image are consistent with the tilt parameters corresponding to the reference image;全景图像获取模块,用于对所述基准图像以及仿射变换后的图像进行图像融合处理,以获取全景图像。A panoramic image acquisition module, configured to perform image fusion processing on the reference image and the affine transformed image to acquire a panoramic image.
- 如权利要求13所述的便携式电子设备的扫描系统,其特征在于,所述全景拍摄模块还用于:获取所述图像对应的扫描距离,所述扫描距离为所述便携式电子设备的摄像头在焦距方向上到所述扫描对象表面的距离;The scanning system of a portable electronic device according to claim 13, wherein the panoramic shooting module is also used for: acquiring a scanning distance corresponding to the image, and the scanning distance is the focal length of the camera of the portable electronic device The distance to the surface of the scanned object in the direction;所述基准图像对应的扫描距离为基准扫描距离;The scanning distance corresponding to the reference image is the reference scanning distance;所述仿射变换模块还用于使仿射变换后的图像的扫描距离与所述基准扫描距离一致。The affine transformation module is further configured to make the scanning distance of the affine transformed image consistent with the reference scanning distance.
- 如权利要求9所述的便携式电子设备的扫描系统,其特征在于,所述扫描系统还包括:The scanning system of portable electronic equipment as claimed in claim 9, is characterized in that, described scanning system also comprises:成像区域分析模块,用于获取至少两组扫描距离与所述扫描距离下所述扫描对象在所述便携式电子设备的成像区域内的面积占比的对应关系;所述扫描距离为所述便携式电子设备的摄像头在焦距方向上到所述扫描对象表面的距离;The imaging area analysis module is used to obtain the corresponding relationship between at least two sets of scanning distances and the area ratio of the scanning object in the imaging area of the portable electronic device under the scanning distance; the scanning distance is the The distance from the camera of the device to the surface of the scanned object in the focal length direction;最佳距离确定模块,用于基于所述对应关系确定最佳扫描距离;An optimal distance determination module, configured to determine an optimal scanning distance based on the correspondence;第一提示信息模块,用于生成第一提示信息,所述第一提示信息包括所述最佳扫描距 离。The first prompt information module is used to generate first prompt information, and the first prompt information includes the optimal scanning distance.
- 如权利要求9所述的便携式电子设备的扫描系统,其特征在于,所述扫描系统还包括:The scanning system of portable electronic equipment as claimed in claim 9, is characterized in that, described scanning system also comprises:第二提示信息模块,用于当所述当前的倾斜参数与所述预设的倾斜参数的误差超过预设范围时生成第二提示信息,所述第二提示信息用于提示用户调整所述便携式电子设备,以使所述误差缩小至所述预设范围内。The second prompt information module is configured to generate second prompt information when the error between the current tilt parameter and the preset tilt parameter exceeds a preset range, and the second prompt information is used to prompt the user to adjust the portable Electronic equipment, so that the error is reduced to within the preset range.
- 一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1-8中任一项所述的便携式电子设备的扫描方法。An electronic device, comprising a memory, a processor, and a computer program stored in the memory and operable on the processor, wherein any one of claims 1-8 is implemented when the processor executes the computer program The scanning method of the portable electronic device.
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1-8中任一项所述的便携式电子设备的扫描方法。A computer-readable storage medium, on which a computer program is stored, wherein, when the computer program is executed by a processor, the scanning method for a portable electronic device according to any one of claims 1-8 is implemented.
- 一种芯片,其特征在于,所述芯片用于执行如权利要求1~8中任一项所述的方法。A chip, characterized in that the chip is used to execute the method according to any one of claims 1-8.
- 一种芯片模组,其特征在于,所述芯片模组包括通信接口和芯片,其中:所述通信接口用于进行芯片模组内部通信,或者用于所述芯片模组与外部设备进行通信;所述芯片用于执行如权利要求1~8中任一项所述的方法。A chip module, characterized in that the chip module includes a communication interface and a chip, wherein: the communication interface is used for internal communication of the chip module, or for communication between the chip module and external equipment; The chip is used to execute the method according to any one of claims 1-8.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110721997.X | 2021-06-28 | ||
CN202110721997.XA CN113596276B (en) | 2021-06-28 | 2021-06-28 | Scanning method and system for portable electronic equipment, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023274090A1 true WO2023274090A1 (en) | 2023-01-05 |
Family
ID=78244939
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/101303 WO2023274090A1 (en) | 2021-06-28 | 2022-06-24 | Scanning method and system for portable electronic device, and electronic device and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113596276B (en) |
WO (1) | WO2023274090A1 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113596276B (en) * | 2021-06-28 | 2022-09-27 | 展讯半导体(南京)有限公司 | Scanning method and system for portable electronic equipment, electronic equipment and storage medium |
CN116883461B (en) * | 2023-05-18 | 2024-03-01 | 珠海移科智能科技有限公司 | Method for acquiring clear document image and terminal device thereof |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080232691A1 (en) * | 2004-11-08 | 2008-09-25 | Karolos Gkikas | Method for Using Portable Electronic Equipment, Which Comprises a Digital Camera or Can be Connected to a Digital Camera, to Scan a Surface Containing Text and/or Drawings or Sketches |
CN106447728A (en) * | 2016-08-29 | 2017-02-22 | 华为技术有限公司 | Scanning state adjustment method and apparatus |
CN110213456A (en) * | 2019-06-10 | 2019-09-06 | Oppo广东移动通信有限公司 | Scan document bearing calibration, electronic device and computer readable storage medium |
CN112215756A (en) * | 2020-10-19 | 2021-01-12 | 珠海奔图电子有限公司 | Scanning deviation rectifying method and device, storage medium and computer equipment |
CN113596276A (en) * | 2021-06-28 | 2021-11-02 | 展讯半导体(南京)有限公司 | Scanning method and system for portable electronic equipment, electronic equipment and storage medium |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102006393A (en) * | 2010-12-20 | 2011-04-06 | 东莞市金翔电器设备有限公司 | Large format scanning method capable of realizing automatic image deformation correction |
CN202103744U (en) * | 2011-06-29 | 2012-01-04 | 上海融磁电子有限公司 | Inclined shooting type scanning and shooting equipment |
CN105791660A (en) * | 2014-12-22 | 2016-07-20 | 中兴通讯股份有限公司 | Method and device for correcting photographing inclination of photographed object and mobile terminal |
CA3002319C (en) * | 2015-12-09 | 2022-06-14 | Ventana Medical Systems, Inc. | An image scanning apparatus and methods of operating an image scanning apparatus |
-
2021
- 2021-06-28 CN CN202110721997.XA patent/CN113596276B/en active Active
-
2022
- 2022-06-24 WO PCT/CN2022/101303 patent/WO2023274090A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080232691A1 (en) * | 2004-11-08 | 2008-09-25 | Karolos Gkikas | Method for Using Portable Electronic Equipment, Which Comprises a Digital Camera or Can be Connected to a Digital Camera, to Scan a Surface Containing Text and/or Drawings or Sketches |
CN106447728A (en) * | 2016-08-29 | 2017-02-22 | 华为技术有限公司 | Scanning state adjustment method and apparatus |
CN110213456A (en) * | 2019-06-10 | 2019-09-06 | Oppo广东移动通信有限公司 | Scan document bearing calibration, electronic device and computer readable storage medium |
CN112215756A (en) * | 2020-10-19 | 2021-01-12 | 珠海奔图电子有限公司 | Scanning deviation rectifying method and device, storage medium and computer equipment |
CN113596276A (en) * | 2021-06-28 | 2021-11-02 | 展讯半导体(南京)有限公司 | Scanning method and system for portable electronic equipment, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113596276B (en) | 2022-09-27 |
CN113596276A (en) | 2021-11-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2023274090A1 (en) | Scanning method and system for portable electronic device, and electronic device and storage medium | |
US20180255287A1 (en) | Generating hi-res dewarped book images | |
US7899270B2 (en) | Method and apparatus for providing panoramic view with geometric correction | |
US8554012B2 (en) | Image processing apparatus and image processing method for correcting distortion in photographed image | |
JP5580164B2 (en) | Optical information processing apparatus, optical information processing method, optical information processing system, and optical information processing program | |
CN111935465B (en) | Projection system, projection device and correction method of display image thereof | |
US8818101B1 (en) | Apparatus and method for feature matching in distorted images | |
US20160371855A1 (en) | Image based measurement system | |
JP4010754B2 (en) | Image processing apparatus, image processing method, and computer-readable recording medium | |
KR101219162B1 (en) | Image processing system for enhancement of the accuracy of air photograph | |
CN111872544B (en) | Calibration method and device for laser light-emitting indication point and galvanometer coaxial vision system | |
WO2019232793A1 (en) | Two-camera calibration method, electronic device and computer-readable storage medium | |
JP6172987B2 (en) | Azimuth angle estimation apparatus and azimuth angle estimation program | |
EP4242609A1 (en) | Temperature measurement method, apparatus, and system, storage medium, and program product | |
WO2018006566A1 (en) | View adjustment method and system | |
JP2005003463A (en) | Calibration chart image display device, calibration apparatus, and calibration method | |
US8983227B2 (en) | Perspective correction using a reflection | |
JP4138145B2 (en) | Image forming apparatus | |
CN104596442A (en) | Assisted three-dimensional scanning device and method | |
JP4169464B2 (en) | Image processing method, image processing apparatus, and computer-readable recording medium | |
CN116485902A (en) | Mark point matching method, device, computer equipment and storage medium | |
JP2020071854A (en) | Image processing apparatus, image processing method, and program | |
WO2022267027A1 (en) | Image correction method and apparatus, and electronic device and storage medium | |
JP6448413B2 (en) | Roof slope estimation system and roof slope estimation method | |
CN113920525A (en) | Text correction method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22831904 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 22831904 Country of ref document: EP Kind code of ref document: A1 |