WO2020224089A1 - 图案码位置调整方法、装置及计算机可读存储介质 - Google Patents

图案码位置调整方法、装置及计算机可读存储介质 Download PDF

Info

Publication number
WO2020224089A1
WO2020224089A1 PCT/CN2019/101894 CN2019101894W WO2020224089A1 WO 2020224089 A1 WO2020224089 A1 WO 2020224089A1 CN 2019101894 W CN2019101894 W CN 2019101894W WO 2020224089 A1 WO2020224089 A1 WO 2020224089A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
window
terminal
scanned
screen
Prior art date
Application number
PCT/CN2019/101894
Other languages
English (en)
French (fr)
Inventor
刘真
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020224089A1 publication Critical patent/WO2020224089A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/14Transformations for image registration, e.g. adjusting or mapping for alignment of images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods

Definitions

  • This application relates to the field of image processing, and in particular to a method, device and computer-readable storage medium for adjusting the position of a pattern code.
  • Barcodes, two-dimensional codes, and other codes presented in patterns are pattern codes widely used in the mobile Internet era.
  • a common usage method is that a user provides a pattern code through a certain terminal, for example, a smart phone, and a professional scanning device scans the code to read the pattern code to realize data interaction.
  • the present application provides a method and device for adjusting the position of a pattern code, and a computer-readable storage medium, the main purpose of which is to improve the scanning efficiency of the code scanning device.
  • the present application provides an electronic device, which includes a memory, a processor, and a bus.
  • the memory includes a pattern code position adjustment readable instruction, and the pattern code position adjustment readable instruction is processed by the The following steps are implemented when the device is executed:
  • calculating the intersection area between the window of the code scanning device and the screen of the scanned terminal includes:
  • the screen area of the scanned code terminal overlaps the window range, and the overlapped part is determined as the intersection area of the window of the code scanning device and the screen of the scanned code terminal.
  • calculating the intersection area between the window of the code scanning device and the screen of the scanned terminal includes:
  • the convex polygon area enclosed by all the boundaries of the window or the convex polygon area enclosed by the screen of the scanning terminal and the boundary of the window in the picture containing the window is determined as the intersection area.
  • calculating the intersection area between the window of the code scanning device and the screen of the scanned terminal includes:
  • the pixel point P4x is the boundary E6, E7 and E8 of the window, or it is determined that the pixel point P5x, the pixel point P5y, the pixel point P6x, and the pixel point P6y are the boundaries E9, E10, E11 and E12 of the window;
  • a convex polygon surrounding the borders E1 and E2 of the window and the border of the screen of the terminal to be scanned, or the borders E3, E4, and E5 of the window and the border of the screen of the terminal to be scanned Convex polygon, or the convex polygon that surrounds the boundary E6, E7, and E8 of the window and the boundary of the screen of the terminal to be scanned, or the convex polygon that surrounds the boundary E9, E10, E11 and E12 of the window
  • the polygon is determined as the intersection area.
  • the moving the pattern code to the range of the intersection area includes:
  • the pattern code is directly translated into the range of the intersection area.
  • the moving the pattern code to the range of the intersection area includes:
  • the reduced pattern code is translated into the range of the intersection area.
  • the moving the pattern code to the range of the intersection area includes:
  • the reduced screen is translated to the intersection area, so that the pattern code on the screen is within the range of the intersection area.
  • the moving the pattern code to the range of the intersection area includes:
  • the pattern code of the minimum identification size and multiple copies thereof are displayed on the screen of the scanned code terminal, so that the pattern code of the minimum identification size or at least one copy thereof is displayed in the intersection area.
  • the present application also provides a pattern code position adjustment method, which includes:
  • calculating the intersection area between the window of the code scanning device and the screen of the scanned terminal includes:
  • the screen area of the scanned code terminal overlaps the window range, and the overlapped part is determined as the intersection area of the window of the code scanning device and the screen of the scanned code terminal.
  • calculating the intersection area between the window of the code scanning device and the screen of the scanned terminal includes:
  • the convex polygon area enclosed by all the boundaries of the window or the convex polygon area enclosed by the screen of the scanning terminal and the boundary of the window in the picture containing the window is determined as the intersection area.
  • calculating the intersection area between the window of the code scanning device and the screen of the scanned terminal includes:
  • the pixel point P4x is the boundary E6, E7 and E8 of the window, or it is determined that the pixel point P5x, the pixel point P5y, the pixel point P6x, and the pixel point P6y are the boundaries E9, E10, E11 and E12 of the window;
  • a convex polygon surrounding the borders E1 and E2 of the window and the border of the screen of the terminal to be scanned, or the borders E3, E4, and E5 of the window and the border of the screen of the terminal to be scanned Convex polygon, or the convex polygon that surrounds the boundary E6, E7, and E8 of the window and the boundary of the screen of the terminal to be scanned, or the convex polygon that surrounds the boundary E9, E10, E11 and E12 of the window
  • the polygon is determined as the intersection area.
  • the moving the pattern code to the range of the intersection area includes:
  • the pattern code is directly translated into the range of the intersection area.
  • the moving the pattern code to the range of the intersection area includes:
  • the reduced pattern code is translated into the range of the intersection area.
  • the moving the pattern code to the range of the intersection area includes:
  • the reduced screen is translated to the intersection area, so that the pattern code on the screen is within the range of the intersection area.
  • the moving the pattern code to the range of the intersection area includes:
  • the pattern code of the minimum identification size and multiple copies thereof are displayed on the screen of the scanned code terminal, so that the pattern code of the minimum identification size or at least one copy thereof is displayed in the intersection area.
  • the present application also provides a computer-readable storage medium, the computer-readable storage medium includes a pattern code position adjustment readable instruction, when the pattern code position adjustment readable instruction is executed by a processor , To achieve any step in the pattern code position adjustment method described above.
  • the scanned code terminal can be The displayed pattern code is moved to the range of the intersection area. Therefore, even if the pattern code user’s back to the screen and “blind pairing” with the window of the scanning device causes the pattern code to not fall within the window range, it can still be scanned.
  • the code device scans the pattern code displayed on the terminal to be scanned, and correctly recognizes the pattern code, thereby eliminating user obstacles and improving the scanning efficiency of the pattern code when the pattern code is used on a large scale.
  • FIG. 1 is a flowchart of implementing a method for adjusting the position of a pattern code provided by an embodiment of the application
  • FIG. 2 is a schematic structural diagram of a pattern code position adjustment device provided by an embodiment of the application.
  • FIG. 3 is a schematic structural diagram of an electronic device provided by an embodiment of the application.
  • the embodiment of the present application provides a method for adjusting the position of a pattern code, which is applied to an electronic device, and the electronic device may be a personal computer, a smart phone, or a tablet computer.
  • the pattern code position adjustment method in the embodiment of the present application mainly includes the following steps S101 to S103:
  • the scanned code terminal can be any electronic device that can display the pattern code and has a camera, such as a smart phone, a tablet computer, etc.
  • the code scanning device can be any electronic device that can read and decode the pattern code
  • the pattern code can be a barcode, a two-dimensional code, and other codes that are presented in patterns.
  • the camera in this application can face the code scanning device. More precisely, the lens of the camera and the element presenting the pattern code are in the same direction. For example, when the terminal to be scanned is a smartphone, The camera should be a front camera, because smart phones usually rely on the screen to display the pattern code.
  • the calculation of the intersection area between the window of the code scanning device and the screen of the scanned code terminal can be performed through the following steps S a 1021 to S a 1024 achieve:
  • the so-called feature information of a code scanning device is the key information that can uniquely identify a code scanning device.
  • the parting lines at different angles, screws at different positions, and the edges of window components on these code scanning devices , Holes, etc. are the key information that can uniquely identify a scanning device.
  • the characteristic information of the code scanning device can be different from those in the examples, or other information, as long as a code scanning device can be uniquely identified, for example, the code scanning device number, engraved ID, and so on.
  • S a 1022 Determine the current scanning device according to the extracted characteristic information of the scanning device.
  • the scanned terminal After extracting the characteristic information of the scanning device, the scanned terminal uploads the characteristic information to the cloud server. After receiving the characteristic information, the cloud server matches the characteristic information with the characteristic information of the scanning device stored in the database to determine the current scanning device.
  • the first window range captured by the terminal to be scanned is determined by comparing the location identifier captured by the terminal to be scanned with the determined full image of the current scanning device (the range of the first window is a relatively rough range ); In the first window range, calculate the distance between the positioning mark and the edge of the window to obtain the precise window range captured by the code scanning terminal.
  • step S a 1024 overlap the screen area of the terminal to be scanned with the window range calculated in step S a 1023, and the overlapped part is determined as the intersection area of the window of the scanning device and the screen of the terminal to be scanned.
  • the built-in positioning device of the terminal to be scanned for example, the gyroscope sensor, determine the angle and direction of the terminal to be scanned and the horizontal plane, and then the position of the camera of the terminal to be scanned on the screen of the terminal to be scanned and the camera and screen
  • the direction determined by the center point can determine a rectangle containing the camera.
  • the center point of the window range calculated in step S a 1023 is the projection point of the camera of the scanned terminal, and the size of the scanned terminal, the position of the camera on the scanned terminal and other information are known, according to this known information
  • the rectangle of the screen of the scanned terminal overlaps the window of the scanning device determined in step S a 1023, and the common part of the overlap is The intersection area between the window of the scanning device and the screen of the terminal being scanned.
  • the calculation of the intersection area between the window of the code scanning device and the screen of the scanned code terminal can be performed through the following steps S b 1021 to S b 1024 implementation:
  • the terminal to be scanned has a front camera, which can be used to be photographed by the scanning device in front of the scanning terminal to obtain a picture of the window containing the scanning device.
  • the window of the code scanning device here can be the entire window or part of the window.
  • a prompt is issued to move the scanning device or the terminal being scanned until the entire window or part of the window of the scanning device appears Within the shooting range of the front camera.
  • the step S b 1021 to obtain images of windows comprises at least two boundaries in the picture, i.e. is not completely contained in the picture in the window, the window of the two One or three borders are contained in the picture.
  • the window is completely contained in the picture, the four borders of the window are contained in the picture.
  • a method for determining the boundary of the window is:
  • gray-level mean square error of the current image block is less than the gray-level threshold THr, indicating that the gray-level change in the current image block is not obvious, it is determined that there is no edge in the current image block;
  • the gray-level mean square error of the current image block is greater than the gray-level threshold THr, it indicates that the gray level changes strongly in the current image block, and it is determined that there is an edge in the current image block, and this edge is the boundary of the window.
  • S b 1023 Determine the boundary of the screen of the terminal to be scanned in the picture containing the window.
  • the convex polygonal area enclosed by all the boundaries of the window is the intersection area.
  • Another situation is that only part of the border of the window is included in the range of the screen of the terminal to be scanned.
  • the border of the screen of the terminal to be scanned in the picture that contains the window and the window The area enclosed by the boundary of may be a convex polygonal area or a concave polygonal area.
  • only the convex polygonal area enclosed by the border of the screen of the scanning terminal and the border of the window is the intersection area referred to in this application.
  • the plane where the screen of the terminal to be scanned is located can be used as the plane where the coordinate system constructed above is located.
  • this plane is referred to as the coordinate system plane here.
  • the horizontal axis is obtained from the nearest projection pixel P1x longitudinal distance of the nearest pixel P1y, the horizontal axis or the distance of the nearest pixel P2x, the farthest distance from the horizontal axis and the distance the longitudinal axis pixel P3x
  • the passing pixel point P1x and the pixel point P1y are the borders E1 and E2 of the window, or the passing P2x, the pixel point P3x, and the pixel point P2y are the borders E3, E4 and E5 of the window, or the passing pixel P3y
  • the pixel point P4y and the pixel point P4x are the boundaries E6, E7, and E8 of the window, or it is determined that the pixel point P5x, the pixel point P5y, the pixel point P6x, and the pixel point P6y are the boundaries E9, E10, E11, and E12 of the window.
  • the mobile scanning device and/or the terminal to be scanned is prompted to expand the area of the intersection area.
  • the expansion of the intersection area makes the subsequent pattern code only need to be translated without first zooming and then panning, so that the pattern code pattern can be included in the intersection area.
  • the pattern code displayed on the scanned code terminal is not completely within the range of the intersection area, which means that part of the pattern code is outside the range of the intersection area, and the pattern code is moved to the range of the intersection area. It means that the area formed by the border of the pattern code is all included in the range of the intersection area, that is, the border of the pattern code is not outside the edge of the intersection area.
  • moving the pattern code to the range of the intersection area may be: directly translate the pattern code to the range of the intersection area.
  • moving the pattern code to the range of the intersection area may be: shrink the pattern code, and then translate the reduced pattern code pattern to the range of the intersection area.
  • moving the pattern code to the range of the intersection area may be: shrinking the screen of the terminal being scanned, and shifting the reduced screen to the intersection area or to the intersection area, so that the screen The pattern code of is within the range of the intersection area.
  • moving the pattern code to the range of the intersection area may be: reducing the pattern code to the smallest identification size that can be recognized, and then reducing the pattern code with the smallest identification size and its multiple copies It is displayed on the screen of the scanned code terminal, so that the pattern code of the smallest identification size or at least one copy thereof is displayed in the intersection area.
  • the pattern code displayed on the terminal being scanned can be moved to the intersection area Therefore, even if the pattern code does not fall within the range of the window due to the user’s back to the screen and "blind pairing" of the scanning device’s window, the scanning device can still scan to the scanned terminal
  • the pattern code presented above can correctly identify the pattern code, thereby eliminating the user's obstacles to use, and also enables the scanning efficiency of the pattern code to be improved when the pattern code is used on a large scale.
  • FIG. 2 provides a pattern code position adjustment device according to an embodiment of the application.
  • the electronic device can be used to implement the pattern code position adjustment method in the embodiment shown in FIG. 1.
  • the device mainly includes an opening module 201, an intersection calculation module 202, and an image movement module 203, among which:
  • the opening module 201 is used to turn on the camera of the scanned terminal when the scanned terminal presents the pattern code
  • the intersection calculation module 202 is used to calculate the intersection area between the window of the scanning device and the screen of the scanning terminal when the camera of the scanning terminal detects that a scanning device appears in front;
  • the image moving module 203 is configured to move the pattern code to the range of the intersection area if the pattern code displayed on the terminal being scanned is not completely within the range of the intersection area.
  • each functional module is only an example. In actual applications, the configuration requirements of the corresponding hardware or the convenience of the implementation of the software can be considered according to the needs.
  • Function allocation is completed by different functional modules, that is, the internal structure of the electronic device is divided into different functional modules to complete all or part of the functions described above.
  • the corresponding functional modules in this embodiment may be implemented by corresponding hardware, or may be implemented by corresponding hardware executing corresponding software.
  • the various embodiments provided in this specification can all apply the above described principles, which will not be repeated hereafter.
  • the pattern code position adjustment device in this embodiment of the application can move the pattern code displayed on the scanned code terminal to the intersection area between the window of the scanning device and the screen of the terminal being scanned.
  • the scanning device can still be scanned by the scanning device.
  • the pattern code displayed on the code terminal correctly recognizes the pattern code, thereby eliminating user obstacles and improving the scanning efficiency of pattern codes in large-scale use of pattern codes.
  • the intersection calculation module 202 is specifically configured to extract characteristic information of the scanning device; determine the current scanning device according to the extracted characteristic information of the scanning device; compare the image captured by the scanning terminal with the current scanning device Compare the full picture of the device to determine the window range captured by the terminal to be scanned; the screen area of the terminal to be scanned overlaps the window range, and the overlapping part is determined as the window of the scanning device and the screen of the terminal to be scanned The intersection area.
  • the intersection calculation module 202 is specifically configured to take a picture of the scanning device in front of the terminal to be scanned to obtain a picture containing a window; determine the boundary of the window in the picture containing the window; determine that the picture containing the window is The edge of the screen of the scanning terminal determines the convex polygonal area enclosed by all the borders of the window or the convex polygonal area enclosed by the border of the scanning terminal's screen and the border of the window in the picture containing the window as the intersection area.
  • the intersection calculation module 202 is specifically configured to use any two intersecting edge lines of the screen of the terminal to be scanned as the vertical axis and the horizontal axis, and use the intersection of the two edge lines as the origin to construct a coordinate system; and record;
  • the projection of the window of the scanning device on the plane of the coordinate system respectively find the pixel point P1x closest to the horizontal axis and the pixel point P1y closest to the vertical axis in the projection, or the pixel point P2x closest to the horizontal axis and the farthest from the horizontal axis Pixel point P3x and pixel point P2y closest to the vertical axis, or pixel point P3y closest to the vertical axis, pixel point P4y farthest from the vertical axis, and pixel point P4x farthest from the horizontal axis, or closest to the horizontal axis Pixel point P5x, pixel point P5y closest to the vertical axis, pixel point P6x farthest from the horizontal axis,
  • the image moving module 203 is specifically configured to directly translate the pattern code within the range of the intersection area.
  • the image moving module 203 is specifically configured to reduce the pattern code, and translate the reduced pattern code to the range of the intersection area.
  • the image moving module 203 is specifically configured to shrink the screen of the scanned terminal, and translate the reduced screen to the intersection area, so that the pattern code on the screen is within the range of the intersection area.
  • the image movement module 203 is specifically configured to reduce the pattern code to the minimum recognition size that can be recognized, and display the pattern code of the minimum recognition size and multiple copies thereof on the screen of the scanned code terminal so that the minimum recognition size is The pattern code or at least one copy thereof is displayed in the intersection area.
  • FIG. 3 provides an electronic device according to an embodiment of the application.
  • the electronic device can be used to implement the pattern code position adjustment method in the embodiment shown in FIG. 1.
  • the electronic device mainly includes:
  • the electronic device further includes:
  • At least one input device 303 and at least one output device 304 At least one input device 303 and at least one output device 304.
  • the aforementioned memory 301, processor 302, input device 303, and output device 304 are connected via a bus 305.
  • the input device 303 may specifically be a camera, a touch panel, a physical button or a mouse, etc.
  • the output device 304 may specifically be a display screen.
  • the memory 301 may be a high-speed random access memory (RAM, Random Access Memory) memory can also be non-volatile memory (non-volatile memory), such as disk storage.
  • RAM Random Access Memory
  • non-volatile memory such as disk storage.
  • the memory 301 is configured to store a set of executable readable instruction codes, and the processor 302 is coupled with the memory 301.
  • the device in the embodiment of the present application after calculating the intersection area between the window of the scanning device and the screen of the terminal being scanned, can move the pattern code displayed on the terminal being scanned to the range of the intersection area Therefore, even if the pattern code does not fall within the scope of the window due to the user’s back to the screen and “blind pairing” with the window of the scanning device, the scanning device can also be scanned and displayed on the scanned terminal
  • the pattern code can correctly identify the pattern code, thereby eliminating the user's obstacles to use, and also enables the scanning efficiency of the pattern code to be improved when the pattern code is used on a large scale.
  • the embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable storage medium may be provided in the electronic device in each of the foregoing embodiments, and the computer-readable storage medium may be the one shown in FIG.
  • the memory in the embodiment is shown.
  • the computer-readable storage medium stores computer-readable instructions, which when executed by the processor, implement the pattern code position adjustment method in the embodiment shown in FIG. 1.
  • the computer storage medium can also be a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), RAM, magnetic disks or optical disks and other media that can store readable instruction codes.
  • the disclosed device and method may be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the modules is only a logical function division, and there may be other divisions in actual implementation, for example, multiple modules or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or modules, and may be in electrical, mechanical or other forms.
  • modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
  • the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the medium includes a number of instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned readable storage medium includes: U disk, mobile hard disk, ROM, RAM, magnetic disk, or optical disk and other media that can store readable instruction codes.
  • the computer readable storage medium may be a non-volatile readable storage medium. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

一种图案码位置调整方法,以提高扫码设备的扫码效率,在被扫码终端呈现图案码时,开启被扫码终端的摄像头(S101);当被扫码终端的摄像头监测到前方出现扫码设备,则计算扫码设备的视窗与被扫码终端的屏幕的交汇区域(S102);若被扫码终端上呈现的图案码不完全在交汇区域范围内,则将图案码移至交汇区域的范围之内(S103)。该方法使得即使图案码用户由于背对屏幕、"盲对"扫码设备的视窗而导致图案码不能刚好落在视窗范围之内,同样能够让扫码设备扫描到被扫码终端上呈现的图案码,正确识别图案码,从而免去了用户的使用障碍,也使得在大规模使用图案码的场合能够提高图案码的扫码效率。

Description

图案码位置调整方法、装置及计算机可读存储介质
本申请要求于2019年5月7日提交中国专利局、申请号为201910374207.8、发明名称为“图案码位置调整方法、装置及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及图像处理领域,尤其涉及一种图案码位置调整方法、装置及计算机可读存储介质。
背景技术
条形码、二维码等以图案方式呈现的编码是移动互联网时代广泛使用到的图案码。一种常用的使用方式是由用户通过某种终端,例如,智能手机提供图案码,再由专业的扫码设备扫码即读取图案码,实现数据交互。
然而,现有的扫码方法在扫码时,用户需要将设备屏幕朝向扫码设备,此时屏幕背对用户,用户无法看到图案码的具***置,而扫码设备读取图案码的“视窗”面积总是有限,如此,不是每次都能准确无误地将图案码送入扫码设备的视窗,造成识别成功率降低。当出现扫码设备识别时间长,用户误认为图案码没有送入视窗而移动时,就进一步加剧了识别出错的问题,使整个使用体验变差,也降低了扫码的效率。
因此,如何将图案码调整到被扫码终端的合适位置呈现,提高扫码的效率成为业界亟需解决的技术问题。
发明内容
本申请提供一种图案码位置调整方法、装置及计算机可读存储介质,其主要目的在于提高扫码设备的扫码效率。
为实现上述目的,本申请提供一种电子装置,该装置包括:存储器、处理器及总线,所述存储器中包括图案码位置调整可读指令,所述图案码位置调整可读指令被所述处理器执行时实现如下步骤:
在被扫码终端呈现图案码时,开启被扫码终端的摄像头;
当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域;
若被扫码终端上呈现的图案码不完全在交汇区域范围内,则将所述图案码移至交汇区域的范围之内。
可选地,所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
提取所述扫码设备的特征信息;
根据所述提取的扫码设备的特征信息,确定当前扫码设备;
将所述被扫码终端所拍摄到的图像与所述当前扫码设备的全图对比,确定所述被扫码终端所拍摄到的视窗范围;
将所述被扫码终端的屏幕区域与所述视窗范围重叠,所述重叠的部分确定为所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域。
可选地,所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
对所述被扫码终端前方的扫码设备进行拍摄,得到一张包含视窗的图片;
确定所述包含视窗的图片中视窗的边界;
确定所述包含视窗的图片中被扫码终端的屏幕的边界;
将所述视窗的全部边界围成的凸多边形区域或者所述包含视窗的图片中被扫码终端的屏幕的边界与所述视窗的边界围成的凸多边形区域确定为交汇区域。
可选地,所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
以被扫码终端的屏幕的任意两条交叉的边缘线作为纵轴和横轴,并以两条边缘线的交叉点作为原点构建坐标系;
记录扫码设备的视窗在坐标系平面的投影;
分别求取投影中距离横轴最近的像素点P1x和距离纵轴最近的像素点P1y,或者距离横轴最近的像素点P2x、距离横轴最远的像素点P3x以及距离纵轴最近的像素点P2y,或者距离纵轴最近的像素点P3y、距离纵轴最远的像素点P4y以及距离横轴最远的像素点P4x,或者距离横轴最近的像素点P5x、距离纵轴最近的像素点P5y、距离横轴最远的像素点P6x以及距离纵轴最远的像素点P6y;
确定经过像素点P1x和像素点P1y为视窗的边界E1和E2,或者确定经过P2x、像素点P3x以及像素点P2y为视窗的边界E3、E4和E5,或者确定经过像素点P3y、像素点P4y以及像素点P4x为视窗的边界E6、E7和E8,或者确定经过像素点P5x、像素点P5y、像素点P6x以及像素点P6y为视窗的边界E9、E10、E11和E12;
将所述视窗的边界E1和E2与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E3、E4和E5与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E6、E7和E8与所述被扫码终端的屏幕的边界围成的凸多边形,或者将视窗的边界E9、E10、E11和E12围成的凸多边形确定为交汇区域。
可选地,所述将图案码移至交汇区域的范围之内,包括:
直接将所述图案码平移至所述交汇区域的范围之内。
可选地,所述将图案码移至交汇区域的范围之内,包括:
缩小所述图案码;
将所述缩小的图案码平移至所述交汇区域的范围之内。
可选地,所述将图案码移至交汇区域的范围之内,包括:
缩小所述被扫码终端的屏幕缩小;
将所述缩小的屏幕向所述交汇区域平移,使得屏幕上的图案码在交汇区域的范围之内。
可选地,所述将图案码移至交汇区域的范围之内,包括:
将图案码缩小至能够被识别的最小识别尺寸;
将所述最小识别尺寸的图案码及其多个副本显示在所述被扫码终端的屏幕,以便所述最小识别尺寸的图案码或其至少一个副本显示在所述交汇区域。
此外,为实现上述目的,本申请还提供一种图案码位置调整方法,该方法包括:
在被扫码终端呈现图案码时,开启被扫码终端的摄像头;
当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域;
若被扫码终端上呈现的图案码不完全在交汇区域范围内,则将所述图案码移至交汇区域的范围之内。
可选地,所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
提取所述扫码设备的特征信息;
根据所述提取的扫码设备的特征信息,确定当前扫码设备;
将所述被扫码终端所拍摄到的图像与所述当前扫码设备的全图对比,确定所述被扫码终端所拍摄到的视窗范围;
将所述被扫码终端的屏幕区域与所述视窗范围重叠,所述重叠的部分确定为所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域。
可选地,所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
对所述被扫码终端前方的扫码设备进行拍摄,得到一张包含视窗的图片;
确定所述包含视窗的图片中视窗的边界;
确定所述包含视窗的图片中被扫码终端的屏幕的边界;
将所述视窗的全部边界围成的凸多边形区域或者所述包含视窗的图片中被扫码终端的屏幕的边界与所述视窗的边界围成的凸多边形区域确定为交汇区域。
可选地,所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
以被扫码终端的屏幕的任意两条交叉的边缘线作为纵轴和横轴,并以两条边缘线的交叉点作为原点构建坐标系;
记录扫码设备的视窗在坐标系平面的投影;
分别求取投影中距离横轴最近的像素点P1x和距离纵轴最近的像素点P1y,或者距离横轴最近的像素点P2x、距离横轴最远的像素点P3x以及距离纵轴最近的像素点P2y,或者距离纵轴最近的像素点P3y、距离纵轴最远的像素点P4y以及距离横轴最远的像素点P4x,或者距离横轴最近的像素点P5x、距离纵轴最近的像素点P5y、距离横轴最远的像素点P6x以及距离纵轴最远的像素点P6y;
确定经过像素点P1x和像素点P1y为视窗的边界E1和E2,或者确定经过P2x、像素点P3x以及像素点P2y为视窗的边界E3、E4和E5,或者确定经过像素点P3y、像素点P4y以及像素点P4x为视窗的边界E6、E7和E8,或者确定经过像素点P5x、像素点P5y、像素点P6x以及像素点P6y为视窗的边界E9、E10、E11和E12;
将所述视窗的边界E1和E2与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E3、E4和E5与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E6、E7和E8与所述被扫码终端的屏幕的边界围成的凸多边形,或者将视窗的边界E9、E10、E11和E12围成的凸多边形确定为交汇区域。
可选地,所述将图案码移至交汇区域的范围之内,包括:
直接将所述图案码平移至所述交汇区域的范围之内。
可选地,所述将图案码移至交汇区域的范围之内,包括:
缩小所述图案码;
将所述缩小的图案码平移至所述交汇区域的范围之内。
可选地,所述将图案码移至交汇区域的范围之内,包括:
缩小所述被扫码终端的屏幕缩小;
将所述缩小的屏幕向所述交汇区域平移,使得屏幕上的图案码在交汇区域的范围之内。
可选地,所述将图案码移至交汇区域的范围之内,包括:
将图案码缩小至能够被识别的最小识别尺寸;
将所述最小识别尺寸的图案码及其多个副本显示在所述被扫码终端的屏幕,以便所述最小识别尺寸的图案码或其至少一个副本显示在所述交汇区域。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中包括图案码位置调整可读指令,所述图案码位置调整可读指令被处理器执行时,实现如上所述的图案码位置调整方法中的任意步骤。
从上述本申请提出的图案码位置调整方法、电子装置及计算机可读存储介质可知,由于在计算出扫码设备的视窗与被扫码终端的屏幕的交汇区域后,可以将被扫码终端上呈现的图案码移至交汇区域的范围之内,因此,即使图案码用户由于背对屏幕、“盲对”扫码设备的视窗而导致图案码不能刚好落在视窗范围之内,同样能够让扫码设备扫描到被扫码终端上呈现的图案码,正确识别图案码,从而免去了用户的使用障碍,也使得在大规模使用图案码的场合能够提高图案码的扫码效率。
附图说明
图1为本申请实施例提供的图案码位置调整方法实现流程图;
图2为本申请实施例提供的图案码位置调整装置的结构示意图;
图3为本申请实施例提供的电子装置结构示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
为使得本申请的发明目的、特征、优点能够更加地明显和易懂,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而非全部实施例。基于本申请中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请实施例提供一种图案码位置调整方法,该图案码位置调整方法应用于电子装置,该电子装置可以为个人电脑、智能手机或平板电脑等。
请参阅图1,本申请实施例中的图案码位置调整方法主要包括以下步骤S101至S103:
S101,在被扫码终端呈现图案码时,开启被扫码终端的摄像头。
在本申请中,被扫码终端可以是任何能够呈现图案码且带有摄像头的电子设备,例如智能手机、平板电脑等,扫码设备可以是任何能够对图案码进行读取和解码的电子设备,而图案码可以是条形码、二维码等以图案方式呈现的编码。需要说明的是,本申请中的摄像头是能够面对扫码设备的,更准确地说,摄像头的镜头和呈现图案码的元件是同一个方向,例如,在被扫码终端是智能手机时,摄像头应该是前置摄像头,因为智能手机通常是靠屏幕来呈现图案码。
S102,当被扫码终端的摄像头监测到前方出现扫码设备,则计算扫码设备的视窗与被扫码终端的屏幕的交汇区域。
作为本申请一个实施例,当被扫码终端的摄像头监测到前方出现扫码设备,则计算扫码设备的视窗与被扫码终端的屏幕的交汇区域可以通过如下步骤Sa1021至Sa1024实现:
Sa1021,提取扫码设备的特征信息。
所谓扫码设备的特征信息,是能够唯一确定一个扫码设备的关键信息,例如,对扫码设备而言,这些扫码设备上不同角度的分模线、不同位置的螺钉、视窗元器件边缘、开孔等就是可以唯一确定一个扫码设备的关键信息。当然,扫码设备的特征信息可以是不同于举例的那些信息,可以是其他的信息,只要能唯一确定一个扫码设备的都可以,例如,扫码设备的编号、镌刻的ID,等等。
Sa1022,根据提取的扫码设备的特征信息,确定当前扫码设备。
在提取到扫码设备的特征信息后,被扫码终端将这些特征信息上传到云服务器。云服务器收到这些特征信息后,将这些特征信息与数据库保存的扫码设备特征信息相匹配,以确定当前是何种扫码设备。
Sa1023,将被扫码终端所拍摄到的图像与所确定的当前扫码设备的全图对比,确定被扫码终端所拍摄到的视窗范围。
需要说明的是,被扫码终端所拍摄到的图像中存在一些可以作为定位标识的器件,例如,扫码设备上不同角度的分模线、不同位置的螺钉以及视窗元器件边缘等。具体地,通过被扫码终端所拍摄到的定位标识与所确定的当前扫码设备的全图对比,确定被扫码终端所拍摄到的第一视窗范围(第一视窗范围属于比较粗略的范围);在第一视窗范围内,计算定位标识与视窗边缘的距离,得到被扫码终端所拍摄到的精确视窗范围。
Sa1024,将被扫码终端的屏幕区域与经步骤Sa1023计算得到的视窗范围重叠,所重叠部分确定为扫码设备的视窗与被扫码终端的屏幕的交汇区域。
根据被扫码终端内置的定位设备,例如,陀螺仪传感器,确定出被扫码终端与水平面的角度、方向,再由被扫码终端的摄像头在被扫码终端的屏幕的位置以及摄像头与屏幕中心点确定的方向,可以确定一个包含摄像头的矩形。由于步骤Sa1023计算得到的视窗范围的中心点即为被扫码终端摄像头的投影点,而被扫码终端的尺寸、摄像头在被扫码终端的位置等信息已知,根据这些已知信息,按照被扫码终端摄像头与视窗范围的中心点之间的投影关系,将被扫码终端的屏幕的这个矩形与经步骤Sa1023确定的扫码设备的视窗重叠,重叠时的公共部分就是扫码设备的视窗与被扫码终端的屏幕的交汇区域。
作为本申请另一实施例,当被扫码终端的摄像头监测到前方出现扫码设备,则计算扫码设备的视窗与被扫码终端的屏幕的交汇区域可以通过如下步骤Sb1021至Sb1024实现:
Sb1021,对被扫码终端前方的扫码设备进行拍摄,得到一张包含视窗的图片。
如前所述,被扫码终端具有一个前置摄像头,可以利用这个前置摄像头被扫码终端前方的扫码设备进行拍摄,得到一张包含扫码设备的视窗的图片。需要说明的是,此处扫码设备的视窗可以是整个视窗,也可以是视窗中的部分。
进一步地,若扫码设备的整个视窗或者部分视窗不在前置摄像头的拍摄范围之内,则发出提示,以便移动扫码设备或者被扫码终端,直至扫码设备的整个视窗或者部分视窗呈现在前置摄像头的拍摄范围之内。
Sb1022,确定包含视窗的图片中视窗的边界。
在假设视窗是矩形时,根据视窗是否完全包含在图片中,经步骤Sb1021获得的图片,视窗至少有两条边界包含在图片中,即在视窗不完全包含在图片中时,视窗的两条或三条边界包含在图片中,当视窗完全包含在图片中时,视窗的四条边界包含在图片中。
鉴于视窗的边界与视窗的非边界部分存在光学上的差异,在本申请实施例中,一种确定视窗的边界的方法是:
设置灰度阈值THr并以任意一个图像块(图像块的面积尽量较小)作为检测对象,计算当前图像块的灰度均方差;
根据当前图像块的灰度均方差与灰度阈值THr的大小判断当前图像块中是否存在边缘;
若当前图像块的灰度均方差小于灰度阈值THr,说明该当前图像块中灰度变化不明显,则判定当前图像块中不存在边缘;
若当前图像块的灰度均方差大于灰度阈值THr,说明该当前图像块中灰度变化强烈,则判定当前图像块中存在边缘,这个边缘即为视窗的边界。
Sb1023,确定包含视窗的图片中被扫码终端的屏幕的边界。
可以采用与步骤Sb1022相同的方法,确定包含视窗的图片中被扫码终端的屏幕的边界,也可以直接确定被扫码终端的屏幕的边界,这是因为,被扫码终端可以自行读取其自身的屏幕尺寸等参数信息,从而能够根据这些信息确定包含视窗的图片中被扫码终端的屏幕的边界。
Sb1024,将视窗的全部边界围成的凸多边形区域或者包含视窗的图片中被扫码终端的屏幕的边界与视窗的边界围成的凸多边形区域确定为交汇区域。
当视窗的边界完全包含在被扫码终端的屏幕的范围之内时,视窗的全部边界围成的凸多边形区域就是交汇区域。另一种情形是,只有视窗的部分边界包含在被扫码终端的屏幕的范围之内,在这种情形下,需要说明的是,包含视窗的图片中被扫码终端的屏幕的边界与视窗的边界围成的区域可能是凸多边形区域,亦有可能是凹多边形区域。然而,根据几何学原理,只有被扫码终端的屏幕的边界与视窗的边界围成的凸多边形区域才是本申请所指的交汇区域。
作为本申请另一实施例,当被扫码终端的摄像头监测到前方出现扫码设备,则计算扫码设备的视窗与被扫码终端的屏幕的交汇区域可以通过如下步骤Sc1021至Sc1025实现:
Sc1021,以被扫码终端的屏幕的任意两条交叉的边缘线作为纵轴和横轴,并以两条边缘线的交叉点作为原点构建坐标系。
可以将被扫码终端的屏幕所在平面作为上述构建的坐标系所在平面,为了后续描述方便,此处将这个平面叫做坐标系平面。
Sc1022,记录扫码设备的视窗在坐标系平面的投影。
Sc1023,分别求取投影中距离横轴最近的像素点P1x和距离纵轴最近的像素点P1y,或者距离横轴最近的像素点P2x、距离横轴最远的像素点P3x以及距离纵轴最近的像素点P2y,或者距离纵轴最近的像素点P3y、距离纵轴最远的像素点P4y以及距离横轴最远的像素点P4x,或者距离横轴最近的像素点P5x、距离纵轴最近的像素点P5y、距离横轴最远的像素点P6x以及距离纵轴最远的像素点P6y。
Sc1024,确定经过像素点P1x和像素点P1y为视窗的边界E1和E2,或者确定经过P2x、像素点P3x以及像素点P2y为视窗的边界E3、E4和E5,或者确定经过像素点P3y、像素点P4y以及像素点P4x为视窗的边界E6、E7和E8,或者确定经过像素点P5x、像素点P5y、像素点P6x以及像素点P6y为视窗的边界E9、E10、E11和E12。
Sc1025,将视窗的边界E1和E2与被扫码终端的屏幕的边界围成的凸多边形,或者将视窗的边界E3、E4和E5与被扫码终端的屏幕的边界围成的凸多边形,或者将视窗的边界E6、E7和E8与被扫码终端的屏幕的边界围成的凸多边形,或者将视窗的边界E9、E10、E11和E12围成的凸多边形确定为交汇区域。
进一步地,在上述实施例中,若交汇区域的面积小于预设阈值,则提示移动扫码设备和/或被扫码终端,使得交汇区域的面积扩大。交汇区域的扩大,使得后续图案码只需要做平移而无需先缩放再平移就可以使图案码图案被包含在交汇区域之内。
S103,若被扫码终端上呈现的图案码图案不完全在交汇区域范围内,则将图案码移至交汇区域的范围之内。
需要说明的是,被扫码终端上呈现的图案码不完全在交汇区域范围内,是指图案码有一部分是在交汇区域的范围之外,而将图案码移至交汇区域的范围之内,是指图案码的边界所构成的区域全部被包含在交汇区域的范围之内,即图案码的边界没有在交汇区域的边缘之外的。
作为本申请的一个实施例,将图案码移至交汇区域的范围之内可以是:直接将图案码平移至交汇区域的范围之内。
作为本申请的另一实施例,将图案码移至交汇区域的范围之内可以是:将图案码缩小,然后,将缩小的图案码图案平移至交汇区域的范围之内。
作为本申请的另一实施例,将图案码移至交汇区域的范围之内可以是:将被扫码终端的屏幕缩小,并将缩小的屏幕向交汇区域平移或平移至交汇区域,使得屏幕上的图案码在交汇区域的范围之内。
作为本申请的另一实施例,将图案码移至交汇区域的范围之内可以是:将图案码缩小至能够被识别的最小识别尺寸,然后将这个最小识别尺寸的图案码及其多个副本显示在被扫码终端的屏幕,以便所述最小识别尺寸的图案码或其至少一个副本显示在交汇区域。
由上述附图1示例的图案码位置调整方法可知,由于在计算出扫码设备的视窗与被扫码终端的屏幕的交汇区域后,可以将被扫码终端上呈现的图案码移至交汇区域的范围之内,因此,即使图案码用户由于背对屏幕、“盲对”扫码设备的视窗而导致图案码不能刚好落在视窗范围之内,同样能够让扫码设备扫描到被扫码终端上呈现的图案码,正确识别图案码,从而免去了用户的使用障碍,也使得在大规模使用图案码的场合能够提高图案码的扫码效率。
图2为本申请实施例提供一种图案码位置调整装置。该电子装置可用于实现图1所示实施例中的图案码位置调整方法。如图2所示,该装置主要包括开启模块201、交汇区计算模块202和图像移动模块203,其中:
开启模块201,用于在被扫码终端呈现图案码时,开启被扫码终端的摄像头;
交汇区计算模块202,用于当被扫码终端的摄像头监测到前方出现扫码设备,则计算扫码设备的视窗与被扫码终端的屏幕的交汇区域;
图像移动模块203,用于若被扫码终端上呈现的图案码不完全在交汇区域范围内,则将所述图案码移至交汇区域的范围之内。
需要说明的是,以上图2示例的装置的实施方式中,各功能模块的划分仅是举例说明,实际应用中可以根据需要,例如相应硬件的配置要求或者软件的实现的便利考虑,而将上述功能分配由不同的功能模块完成,即将电子装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。而且,在实际应用中,本实施例中的相应的功能模块可以是由相应的硬件实现,也可以由相应的硬件执行相应的软件完成。本说明书提供的各个实施例都可应用上述描述原则,以下不再赘述。
本实施例提供的电子装置中各功能模块实现各自功能的具体过程,请参见上述方法实施例中描述的具体内容,此处不再赘述。
由上可见,本申请实施例中的图案码位置调整装置,由于在计算出扫码设备的视窗与被扫码终端的屏幕的交汇区域后,可以将被扫码终端上呈现的图案码移至交汇区域的范围之内,因此,即使图案码用户由于背对屏幕、“盲对”扫码设备的视窗而导致图案码不能刚好落在视窗范围之内,同样能够让扫码设备扫描到被扫码终端上呈现的图案码,正确识别图案码,从而免去了用户的使用障碍,也使得在大规模使用图案码的场合能够提高图案码的扫码效率。
可选地,交汇区计算模块202具体用于提取扫码设备的特征信息;根据提取的扫码设备的特征信息,确定当前扫码设备;将被扫码终端所拍摄到的图像与当前扫码设备的全图对比,确定被扫码终端所拍摄到的视窗范围;将被扫码终端的屏幕区域与视窗范围重叠,重叠的部分确定为扫码设备的视窗与所述被扫码终端的屏幕的交汇区域。
可选地,交汇区计算模块202具体用于对被扫码终端前方的扫码设备进行拍摄,得到一张包含视窗的图片;确定包含视窗的图片中视窗的边界;确定包含视窗的图片中被扫码终端的屏幕的边将视窗的全部边界围成的凸多边形区域或者所述包含视窗的图片中被扫码终端的屏幕的边界与视窗的边界围成的凸多边形区域确定为交汇区域。
可选地,交汇区计算模块202具体用于以被扫码终端的屏幕的任意两条交叉的边缘线作为纵轴和横轴,并以两条边缘线的交叉点作为原点构建坐标系;记录扫码设备的视窗在坐标系平面的投影;分别求取投影中距离横轴最近的像素点P1x和距离纵轴最近的像素点P1y,或者距离横轴最近的像素点P2x、距离横轴最远的像素点P3x以及距离纵轴最近的像素点P2y,或者距离纵轴最近的像素点P3y、距离纵轴最远的像素点P4y以及距离横轴最远的像素点P4x,或者距离横轴最近的像素点P5x、距离纵轴最近的像素点P5y、距离横轴最远的像素点P6x以及距离纵轴最远的像素点P6y;确定经过像素点P1x和像素点P1y为视窗的边界E1和E2,或者确定经过P2x、像素点P3x以及像素点P2y为视窗的边界E3、E4和E5,或者确定经过像素点P3y、像素点P4y以及像素点P4x为视窗的边界E6、E7和E8,或者确定经过像素点P5x、像素点P5y、像素点P6x以及像素点P6y为视窗的边界E9、E10、E11和E12;将视窗的边界E1和E2与被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E3、E4和E5与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E6、E7和E8与所述被扫码终端的屏幕的边界围成的凸多边形,或者将视窗的边界E9、E10、E11和E12围成的凸多边形确定为交汇区域。
可选地,图像移动模块203具体用于直接将图案码平移至交汇区域的范围之内。
可选地,图像移动模块203具体用于缩小图案码,将缩小的图案码平移至交汇区域的范围之内。
可选地,图像移动模块203具体用于缩小被扫码终端的屏幕缩小,将缩小的屏幕向交汇区域平移,使得屏幕上的图案码在交汇区域的范围之内。
可选地,图像移动模块203具体用于将图案码缩小至能够被识别的最小识别尺寸,将最小识别尺寸的图案码及其多个副本显示在被扫码终端的屏幕,以便最小识别尺寸的图案码或其至少一个副本显示在交汇区域。
图3为本申请实施例提供一种电子装置。该电子装置可用于实现图1所示实施例中的图案码位置调整方法。如图3所示,该电子装置主要包括:
存储器301、处理器302及存储在存储器301上并可在处理器302上运行的计算机可读指令,处理器302执行该计算机可读指令时,实现图1或所示实施例中的图案码位置调整方法。
进一步地,该电子装置还包括:
至少一个输入设备303以及至少一个输出设备304。
上述存储器301、处理器302、输入设备303以及输出设备304,通过总线305连接。
其中,输入设备303具体可为摄像头、触控面板、物理按键或者鼠标等等。输出设备304具体可为显示屏。
存储器301可以是高速随机存取记忆体(RAM,Random Access Memory)存储器,也可为非不稳定的存储器(non-volatile memory),例如磁盘存储器。存储器301用于存储一组可执行可读指令代码,处理器302与存储器301耦合。
由上可见,本申请实施例中的装置,由于在计算出扫码设备的视窗与被扫码终端的屏幕的交汇区域后,可以将被扫码终端上呈现的图案码移至交汇区域的范围之内,因此,即使图案码用户由于背对屏幕、“盲对”扫码设备的视窗而导致图案码不能刚好落在视窗范围之内,同样能够让扫码设备扫描到被扫码终端上呈现的图案码,正确识别图案码,从而免去了用户的使用障碍,也使得在大规模使用图案码的场合能够提高图案码的扫码效率。
进一步地,本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质可以是设置于上述各实施例中的电子装置中,该计算机可读存储介质可以是前述图3所示实施例中的存储器。该计算机可读存储介质上存储有计算机可读指令,该可读指令被处理器执行时实现图1所示实施例中的图案码位置调整方法。进一步地,该计算机可存储介质还可以是U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、RAM、磁碟或者光盘等各种可以存储可读指令代码的介质。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个可读存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的可读存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储可读指令代码的介质,计算机可读存储介质可以为非易失性可读存储介质。
需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本申请所必须的。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。
以上为对本申请所提供的图案码位置调整方法、电子装置及计算机可读存储介质的描述,对于本领域的技术人员,依据本申请实施例的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。

Claims (20)

  1. 一种图案码位置调整方法,应用于电子装置,其特征在于,所述方法包括:
    在被扫码终端呈现图案码时,开启被扫码终端的摄像头;
    当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域;
    若被扫码终端上呈现的图案码不完全在交汇区域范围内,则将所述图案码移至交汇区域的范围之内。
  2. 根据权利要求1所述的图案码位置调整方法,其特征在于,所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
    提取所述扫码设备的特征信息;
    根据所述提取的扫码设备的特征信息,确定当前扫码设备;
    将所述被扫码终端所拍摄到的图像与所述当前扫码设备的全图对比,确定所述被扫码终端所拍摄到的视窗范围;
    将所述被扫码终端的屏幕区域与所述视窗范围重叠,所述重叠的部分确定为所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域。
  3. 根据权利要求1所述的图案码位置调整方法,其特征在于,所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
    对所述被扫码终端前方的扫码设备进行拍摄,得到一张包含视窗的图片;
    确定所述包含视窗的图片中视窗的边界;
    确定所述包含视窗的图片中被扫码终端的屏幕的边界;
    将所述视窗的全部边界围成的凸多边形区域或者所述包含视窗的图片中被扫码终端的屏幕的边界与所述视窗的边界围成的凸多边形区域确定为交汇区域。
  4. 根据权利要求1所述的图案码位置调整方法,其特征在于,所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
    以所述被扫码终端的屏幕的任意两条交叉的边缘线作为纵轴和横轴,并以两条边缘线的交叉点作为原点构建坐标系;
    记录所述扫码设备的视窗在坐标系平面的投影;
    分别求取投影中距离横轴最近的像素点P1x和距离纵轴最近的像素点P1y,或者距离横轴最近的像素点P2x、距离横轴最远的像素点P3x以及距离纵轴最近的像素点P2y,或者距离纵轴最近的像素点P3y、距离纵轴最远的像素点P4y以及距离横轴最远的像素点P4x,或者距离横轴最近的像素点P5x、距离纵轴最近的像素点P5y、距离横轴最远的像素点P6x以及距离纵轴最远的像素点P6y;
    确定经过像素点P1x和像素点P1y为视窗的边界E1和E2,或者确定经过P2x、像素点P3x以及像素点P2y为视窗的边界E3、E4和E5,或者确定经过像素点P3y、像素点P4y以及像素点P4x为视窗的边界E6、E7和E8,或者确定经过像素点P5x、像素点P5y、像素点P6x以及像素点P6y为视窗的边界E9、E10、E11和E12;
    将所述视窗的边界E1和E2与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E3、E4和E5与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E6、E7和E8与所述被扫码终端的屏幕的边界围成的凸多边形,或者将视窗的边界E9、E10、E11和E12围成的凸多边形确定为交汇区域。
  5. 根据权利要求1所述的图案码位置调整方法,其特征在于,所述将图案码移至交汇区域的范围之内,包括:
    直接将所述图案码平移至所述交汇区域的范围之内。
  6. 根据权利要求1所述的图案码位置调整方法,其特征在于,所述将图案码移至交汇区域的范围之内,包括:
    缩小所述图案码;
    将所述缩小的图案码平移至所述交汇区域的范围之内。
  7. 根据权利要求1所述的图案码位置调整方法,其特征在于,所述将图案码移至交汇区域的范围之内,包括:
    缩小所述被扫码终端的屏幕缩小;
    将所述缩小的屏幕向所述交汇区域平移,使得屏幕上的图案码在交汇区域的范围之内。
  8. 根据权利要求1所述的图案码位置调整方法,其特征在于,所述将图案码移至交汇区域的范围之内,包括:
    将图案码缩小至能够被识别的最小识别尺寸;
    将所述最小识别尺寸的图案码及其多个副本显示在所述被扫码终端的屏幕,以便所述最小识别尺寸的图案码或其至少一个副本显示在所述交汇区域。
  9. 一种电子装置,其特征在于,该电子装置包括:存储器、处理器及总线,所述存储器中包括图案码位置调整可读指令,所述图案码位置调整可读指令被所述处理器执行时,调用开启模块、交汇区计算模块和图像移动模块实现如以下步骤:
    开启模块,用于在被扫码终端呈现图案码时,开启被扫码终端的摄像头;
    交汇区计算模块,用于当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域;
    图像移动模块,用于若被扫码终端上呈现的图案码不完全在交汇区域范围内,则将所述图案码移至交汇区域的范围之内。
  10. 根据权利要求9所述的电子装置,其特征在于,所述图案码位置调整可读指令被所述处理器执行时调用交汇区计算模块执行以下步骤:
    提取所述扫码设备的特征信息;
    根据所述提取的扫码设备的特征信息,确定当前扫码设备;
    将所述被扫码终端所拍摄到的图像与所述当前扫码设备的全图对比,确定所述被扫码终端所拍摄到的视窗范围;
    将所述被扫码终端的屏幕区域与所述视窗范围重叠,所述重叠的部分确定为所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域。
  11. 根据权利要求9所述的电子装置,其特征在于,所述图案码位置调整可读指令被所述处理器执行时调用交汇区计算模块执行以下步骤:
    对所述被扫码终端前方的扫码设备进行拍摄,得到一张包含视窗的图片;
    确定所述包含视窗的图片中视窗的边界;
    确定所述包含视窗的图片中被扫码终端的屏幕的边界;
    将所述视窗的全部边界围成的凸多边形区域或者所述包含视窗的图片中被扫码终端的屏幕的边界与所述视窗的边界围成的凸多边形区域确定为交汇区域。
  12. 根据权利要求9所述的电子装置,其特征在于,所述图案码位置调整可读指令被所述处理器执行时调用交汇区计算模块执行以下步骤:
    以所述被扫码终端的屏幕的任意两条交叉的边缘线作为纵轴和横轴,并以两条边缘线的交叉点作为原点构建坐标系;
    记录所述扫码设备的视窗在坐标系平面的投影;
    分别求取投影中距离横轴最近的像素点P1x和距离纵轴最近的像素点P1y,或者距离横轴最近的像素点P2x、距离横轴最远的像素点P3x以及距离纵轴最近的像素点P2y,或者距离纵轴最近的像素点P3y、距离纵轴最远的像素点P4y以及距离横轴最远的像素点P4x,或者距离横轴最近的像素点P5x、距离纵轴最近的像素点P5y、距离横轴最远的像素点P6x以及距离纵轴最远的像素点P6y;
    确定经过像素点P1x和像素点P1y为视窗的边界E1和E2,或者确定经过P2x、像素点P3x以及像素点P2y为视窗的边界E3、E4和E5,或者确定经过像素点P3y、像素点P4y以及像素点P4x为视窗的边界E6、E7和E8,或者确定经过像素点P5x、像素点P5y、像素点P6x以及像素点P6y为视窗的边界E9、E10、E11和E12;
    将所述视窗的边界E1和E2与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E3、E4和E5与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E6、E7和E8与所述被扫码终端的屏幕的边界围成的凸多边形,或者将视窗的边界E9、E10、E11和E12围成的凸多边形确定为交汇区域。
  13. 根据权利要求9所述的电子装置,其特征在于,所述图案码位置调整可读指令被所述处理器执行时调用图像移动模块,执行以步骤:
    直接将所述图案码平移至所述交汇区域的范围之内。
  14. 根据权利要求9所述的电子装置,其特征在于,所述图案码位置调整可读指令被所述处理器执行时调用图像移动模块,执行以步骤:
    缩小所述图案码;
    将所述缩小的图案码平移至所述交汇区域的范围之内。
  15. 根据权利要求9所述的电子装置,其特征在于,所述图案码位置调整可读指令被所述处理器执行时调用图像移动模块,执行以步骤:
    缩小所述被扫码终端的屏幕缩小;
    将所述缩小的屏幕向所述交汇区域平移,使得屏幕上的图案码在交汇区域的范围之内。
  16. 根据权利要求9所述的电子装置,其特征在于,所述图案码位置调整可读指令被所述处理器执行时调用图像移动模块,执行以步骤:
    将图案码缩小至能够被识别的最小识别尺寸;
    将所述最小识别尺寸的图案码及其多个副本显示在所述被扫码终端的屏幕,以便所述最小识别尺寸的图案码或其至少一个副本显示在所述交汇区域。
  17. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中包括图案码位置调整可读指令,所述图案码位置调整可读指令被处理器执行时,实现如权利以下步骤:
    在被扫码终端呈现图案码时,开启被扫码终端的摄像头;
    当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域;
    若被扫码终端上呈现的图案码不完全在交汇区域范围内,则将所述图案码移至交汇区域的范围之内。
  18. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述图案码位置调整可读指令被所述处理器执行所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
    提取所述扫码设备的特征信息;
    根据所述提取的扫码设备的特征信息,确定当前扫码设备;
    将所述被扫码终端所拍摄到的图像与所述当前扫码设备的全图对比,确定所述被扫码终端所拍摄到的视窗范围;
    将所述被扫码终端的屏幕区域与所述视窗范围重叠,所述重叠的部分确定为所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域。
  19. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述图案码位置调整可读指令被所述处理器执行所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
    对所述被扫码终端前方的扫码设备进行拍摄,得到一张包含视窗的图片;
    确定所述包含视窗的图片中视窗的边界;
    确定所述包含视窗的图片中被扫码终端的屏幕的边界;
    将所述视窗的全部边界围成的凸多边形区域或者所述包含视窗的图片中被扫码终端的屏幕的边界与所述视窗的边界围成的凸多边形区域确定为交汇区域。
  20. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述图案码位置调整可读指令被所述处理器执行所述当所述被扫码终端的摄像头监测到前方出现扫码设备,则计算所述扫码设备的视窗与所述被扫码终端的屏幕的交汇区域,包括:
    以所述被扫码终端的屏幕的任意两条交叉的边缘线作为纵轴和横轴,并以两条边缘线的交叉点作为原点构建坐标系;
    记录所述扫码设备的视窗在坐标系平面的投影;
    分别求取投影中距离横轴最近的像素点P1x和距离纵轴最近的像素点P1y,或者距离横轴最近的像素点P2x、距离横轴最远的像素点P3x以及距离纵轴最近的像素点P2y,或者距离纵轴最近的像素点P3y、距离纵轴最远的像素点P4y以及距离横轴最远的像素点P4x,或者距离横轴最近的像素点P5x、距离纵轴最近的像素点P5y、距离横轴最远的像素点P6x以及距离纵轴最远的像素点P6y;
    确定经过像素点P1x和像素点P1y为视窗的边界E1和E2,或者确定经过P2x、像素点P3x以及像素点P2y为视窗的边界E3、E4和E5,或者确定经过像素点P3y、像素点P4y以及像素点P4x为视窗的边界E6、E7和E8,或者确定经过像素点P5x、像素点P5y、像素点P6x以及像素点P6y为视窗的边界E9、E10、E11和E12;
    将所述视窗的边界E1和E2与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E3、E4和E5与所述被扫码终端的屏幕的边界围成的凸多边形,或者将所述视窗的边界E6、E7和E8与所述被扫码终端的屏幕的边界围成的凸多边形,或者将视窗的边界E9、E10、E11和E12围成的凸多边形确定为交汇区域。
PCT/CN2019/101894 2019-05-07 2019-08-22 图案码位置调整方法、装置及计算机可读存储介质 WO2020224089A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910374207.8A CN110197457B (zh) 2019-05-07 2019-05-07 图案码位置调整方法、装置及计算机可读存储介质
CN201910374207.8 2019-05-07

Publications (1)

Publication Number Publication Date
WO2020224089A1 true WO2020224089A1 (zh) 2020-11-12

Family

ID=67752380

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/101894 WO2020224089A1 (zh) 2019-05-07 2019-08-22 图案码位置调整方法、装置及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN110197457B (zh)
WO (1) WO2020224089A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110717750A (zh) * 2019-09-18 2020-01-21 平安科技(深圳)有限公司 一种二维码显示方法、二维码显示装置及移动终端
CN111126096A (zh) * 2019-12-06 2020-05-08 支付宝(杭州)信息技术有限公司 二维码尺寸确定方法、二维码显示方法、装置及设备

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107609442A (zh) * 2017-09-01 2018-01-19 深圳天珑无线科技有限公司 扫码方法、移动终端及计算机可读存储介质
CN107886020A (zh) * 2017-10-17 2018-04-06 北京三快在线科技有限公司 一种扫码的方法和装置
CN109409164A (zh) * 2018-11-20 2019-03-01 普联技术有限公司 扫描图像显示调整方法、装置及电子设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9424570B2 (en) * 2014-08-13 2016-08-23 Paypal, Inc. On-screen code stabilization
CN106557798A (zh) * 2015-09-24 2017-04-05 沈维 一种复合标志及形成所述复合标志的方法
CN107944325B (zh) * 2017-11-23 2020-01-03 维沃移动通信有限公司 一种扫码方法、扫码装置及移动终端
CN207557953U (zh) * 2017-11-30 2018-06-29 北京意锐新创科技有限公司 一种多功能扫码视窗及多功能条码扫描识别仪
CN109407940A (zh) * 2018-10-12 2019-03-01 无锡天脉聚源传媒科技有限公司 一种目标对象选中方法、***、终端及存储介质

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107609442A (zh) * 2017-09-01 2018-01-19 深圳天珑无线科技有限公司 扫码方法、移动终端及计算机可读存储介质
CN107886020A (zh) * 2017-10-17 2018-04-06 北京三快在线科技有限公司 一种扫码的方法和装置
CN109409164A (zh) * 2018-11-20 2019-03-01 普联技术有限公司 扫描图像显示调整方法、装置及电子设备

Also Published As

Publication number Publication date
CN110197457A (zh) 2019-09-03
CN110197457B (zh) 2024-04-09

Similar Documents

Publication Publication Date Title
WO2017119664A1 (en) Display apparatus and control methods thereof
WO2016085234A1 (en) Method and device for amending handwritten characters
WO2018182192A1 (en) Method and apparatus for displaying image based on user motion information
WO2018201638A1 (zh) 基于图像识别的信息采集方法、移动终端及存储介质
WO2019107981A1 (en) Electronic device recognizing text in image
WO2015016619A1 (en) Electronic apparatus, method of controlling the same, and image reproducing apparatus and method
WO2015137666A1 (ko) 오브젝트 인식 장치 및 그 제어 방법
WO2018093100A1 (en) Electronic apparatus and method for processing image thereof
WO2020141900A1 (ko) 이동 로봇 및 그 구동 방법
WO2015115698A1 (en) Portable device and method of controlling therefor
WO2020224089A1 (zh) 图案码位置调整方法、装置及计算机可读存储介质
WO2019143050A1 (en) Electronic device and method for controlling autofocus of camera
WO2016126083A1 (ko) 주변 상황 정보를 통지하기 위한 방법, 전자 장치 및 저장 매체
WO2020171333A1 (ko) 이미지 내의 오브젝트 선택에 대응하는 서비스를 제공하기 위한 전자 장치 및 방법
WO2019039739A1 (en) DISPLAY APPARATUS AND METHOD FOR CONTROLLING THE SAME
WO2021025509A1 (en) Apparatus and method for displaying graphic elements according to object
WO2016080653A1 (en) Method and apparatus for image processing
WO2020062615A1 (zh) 显示面板的伽马值调节方法、装置及显示设备
WO2020171342A1 (ko) 외부 객체의 정보에 기반하여 시각화된 인공 지능 서비스를 제공하는 전자 장치 및 전자 장치의 동작 방법
WO2019194423A1 (en) Electronic apparatus and operating method thereof
WO2020101420A1 (ko) 증강현실 기기의 광학 특성 측정 방법 및 장치
WO2014178578A1 (en) Apparatus and method for generating image data in portable terminal
WO2021132743A1 (ko) 애플리케이션과 관련된 컨텐츠를 표시하는 전자 장치 및 그 제어 방법
WO2020091182A1 (ko) 증강 현실을 이용한 영상 데이터를 제공하는 전자 장치 및 그 제어 방법
EP3912143A1 (en) Method of providing augmented reality contents and electronic device therefor

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: 19927930

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: 19927930

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01.06.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19927930

Country of ref document: EP

Kind code of ref document: A1