CN110197457B - Pattern code position adjustment method, device and computer readable storage medium - Google Patents

Pattern code position adjustment method, device and computer readable storage medium Download PDF

Info

Publication number
CN110197457B
CN110197457B CN201910374207.8A CN201910374207A CN110197457B CN 110197457 B CN110197457 B CN 110197457B CN 201910374207 A CN201910374207 A CN 201910374207A CN 110197457 B CN110197457 B CN 110197457B
Authority
CN
China
Prior art keywords
code
window
code scanning
terminal
pattern
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201910374207.8A
Other languages
Chinese (zh)
Other versions
CN110197457A (en
Inventor
刘真
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910374207.8A priority Critical patent/CN110197457B/en
Priority to PCT/CN2019/101894 priority patent/WO2020224089A1/en
Publication of CN110197457A publication Critical patent/CN110197457A/en
Application granted granted Critical
Publication of CN110197457B publication Critical patent/CN110197457B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • G06T3/14
    • 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

Abstract

The application provides a pattern code position adjustment method, which is used for improving the code scanning efficiency of code scanning equipment, and starting a camera of a code scanning terminal when the code scanning terminal presents a pattern code; when the camera of the code scanning terminal monitors that the code scanning device appears in front, calculating an intersection area of a window of the code scanning device and a screen of the code scanning terminal; if the pattern codes presented on the scanned code terminal are not completely within the range of the intersection area, the pattern codes are moved into the range of the intersection area. According to the technical scheme, even if a pattern code user can not just fall in the window range due to the fact that the pattern code user is back to the window of the screen and the pattern code can not be just caused by the blind-to-blind code scanning device, the pattern code displayed on the code scanning terminal can be scanned by the code scanning device, and the pattern code can be correctly identified, so that the use obstacle of the user is avoided, and the code scanning efficiency of the pattern code can be improved on the occasion of using the pattern code on a large scale.

Description

Pattern code position adjustment method, device and computer readable storage medium
Technical Field
The present disclosure relates to the field of image processing, and in particular, to a method and apparatus for adjusting a position of a pattern code, and a computer readable storage medium.
Background
The codes presented in a pattern form such as bar codes and two-dimensional codes are pattern codes widely used in the mobile internet age. One common use method is that a user provides a pattern code through a certain terminal, such as a smart phone, and then a professional code scanning device scans the code, namely reads the pattern code, so as to realize data interaction.
However, in the existing code scanning method, when scanning codes, a user needs to face a screen of the device towards the code scanning device, at the moment, the screen faces away from the user, the user cannot see the specific position of the pattern code, and the area of a window for reading the pattern code by the code scanning device is always limited, so that the pattern code can not be accurately sent into the window of the code scanning device every time, and the recognition success rate is reduced. When the code scanning equipment has long recognition time, and a user mistakenly thinks that the pattern code is not sent into the window to move, the problem of recognition errors is further aggravated, the whole use experience is deteriorated, and the code scanning efficiency is also reduced.
Therefore, how to adjust the pattern code to the appropriate position of the scanned code terminal for presentation, and improving the code scanning efficiency is a technical problem that needs to be solved in the industry.
Disclosure of Invention
The invention provides a pattern code position adjustment method, a pattern code position adjustment device and a computer readable storage medium, and mainly aims to improve code scanning efficiency of code scanning equipment.
To achieve the above object, the present invention provides an electronic device including: the device comprises a memory, a processor and a bus, wherein the memory comprises a pattern code position adjusting program, and the pattern code position adjusting program realizes the following steps when being executed by the processor:
when the scanned code terminal presents the pattern code, a camera of the scanned code terminal is started;
when the camera of the code scanning terminal monitors that the code scanning device appears in front, calculating an intersection area of a window of the code scanning device and a screen of the code scanning terminal;
if the pattern codes presented on the scanned code terminal are not completely within the range of the intersection area, the pattern codes are moved into the range of the intersection area.
Optionally, when the camera of the code scanning terminal detects that the code scanning device appears in front, calculating an intersection area of a window of the code scanning device and a screen of the code scanning terminal includes:
extracting characteristic information of the code scanning equipment;
determining current code scanning equipment according to the extracted characteristic information of the code scanning equipment;
comparing the image shot by the code scanning terminal with the full image of the current code scanning equipment, and determining the window range shot by the code scanning terminal;
and overlapping the screen area of the code scanning terminal with the window range, wherein the overlapped part is determined as an intersection area of the window of the code scanning device and the screen of the code scanning terminal.
Optionally, when the camera of the code scanning terminal detects that the code scanning device appears in front, calculating an intersection area of a window of the code scanning device and a screen of the code scanning terminal includes:
shooting code scanning equipment in front of the code scanning terminal to obtain a picture containing a window;
determining the boundary of a window in the picture containing the window;
determining the boundary of a screen of the scanned code terminal in the picture containing the window;
and determining a convex polygon area surrounded by all boundaries of the window or a convex polygon area surrounded by the boundary of a screen of the scanned code terminal in the picture containing the window and the boundary of the window as an intersection area.
Optionally, when the camera of the code scanning terminal detects that the code scanning device appears in front, calculating an intersection area of a window of the code scanning device and a screen of the code scanning terminal includes:
constructing a coordinate system by taking any two crossed edge lines of a screen of a scanned code terminal as a vertical axis and a horizontal axis and taking the crossing point of the two edge lines as an origin;
recording projection of a window of the code scanning device on a coordinate system plane;
respectively obtaining a pixel point P1x closest to a horizontal axis and a pixel point P1y closest to a vertical axis, or a pixel point P2x closest to the horizontal axis, a pixel point P3x farthest to the horizontal axis and a pixel point P2y closest to the vertical axis, or a pixel point P3y closest to the vertical axis, a pixel point P4y farthest to the vertical axis and a pixel point P4x farthest to the horizontal axis, or a pixel point P5x closest to the horizontal axis, a pixel point P5y closest to the vertical axis, a pixel point P6x farthest to the horizontal axis and a pixel point P6y farthest to the vertical axis in projection;
determining boundaries E1 and E2 passing through the pixel point P1x and the pixel point P1y as windows, or determining boundaries E3, E4 and E5 passing through the pixel point P2x, the pixel point P3x and the pixel point P2y as windows, or determining boundaries E6, E7 and E8 passing through the pixel point P3y, the pixel point P4y and the pixel point P4x as windows, or determining boundaries E9, E10, E11 and E12 passing through the pixel point P5x, the pixel point P5y, the pixel point P6x and the pixel point P6y as windows;
convex polygons formed by the boundaries E1 and E2 of the window and the boundary of the screen of the scanned code terminal, or convex polygons formed by the boundaries E3, E4 and E5 of the window and the boundary of the screen of the scanned code terminal, or convex polygons formed by the boundaries E6, E7 and E8 of the window and the boundary of the screen of the scanned code terminal, or convex polygons formed by the boundaries E9, E10, E11 and E12 of the window are determined as intersection areas.
Optionally, the step of code-shifting the pattern into the area of the intersection area includes:
the pattern code is directly translated into the range of the intersection region.
Optionally, the step of code-shifting the pattern into the area of the intersection area includes:
shrinking the pattern code;
and translating the reduced pattern code into the range of the intersection area.
Optionally, the step of code-shifting the pattern into the area of the intersection area includes:
reducing the screen of the scanned code terminal;
and translating the reduced screen to the intersection area so that the pattern codes on the screen are within the range of the intersection area.
Optionally, the step of code-shifting the pattern into the area of the intersection area includes:
reducing the pattern code to a minimum recognition size capable of being recognized;
and displaying the pattern code with the minimum recognition size and a plurality of copies thereof on a screen of the scanned code terminal, so that the pattern code with the minimum recognition size or at least one copy thereof is displayed in the intersection area.
In addition, in order to achieve the above object, the present invention further provides a method for adjusting a position of a pattern code, the method comprising:
when the scanned code terminal presents the pattern code, a camera of the scanned code terminal is started;
when the camera of the code scanning terminal monitors that the code scanning device appears in front, calculating an intersection area of a window of the code scanning device and a screen of the code scanning terminal;
if the pattern codes presented on the scanned code terminal are not completely within the range of the intersection area, the pattern codes are moved into the range of the intersection area.
Optionally, when the camera of the code scanning terminal detects that the code scanning device appears in front, calculating an intersection area of a window of the code scanning device and a screen of the code scanning terminal includes:
extracting characteristic information of the code scanning equipment;
determining current code scanning equipment according to the extracted characteristic information of the code scanning equipment;
comparing the image shot by the code scanning terminal with the full image of the current code scanning equipment, and determining the window range shot by the code scanning terminal;
and overlapping the screen area of the code scanning terminal with the window range, wherein the overlapped part is determined as an intersection area of the window of the code scanning device and the screen of the code scanning terminal.
Optionally, when the camera of the code scanning terminal detects that the code scanning device appears in front, calculating an intersection area of a window of the code scanning device and a screen of the code scanning terminal includes:
shooting code scanning equipment in front of the code scanning terminal to obtain a picture containing a window;
determining the boundary of a window in the picture containing the window;
determining the boundary of a screen of the scanned code terminal in the picture containing the window;
and determining a convex polygon area surrounded by all boundaries of the window or a convex polygon area surrounded by the boundary of a screen of the scanned code terminal in the picture containing the window and the boundary of the window as an intersection area.
Optionally, when the camera of the code scanning terminal detects that the code scanning device appears in front, calculating an intersection area of a window of the code scanning device and a screen of the code scanning terminal includes:
constructing a coordinate system by taking any two crossed edge lines of a screen of a scanned code terminal as a vertical axis and a horizontal axis and taking the crossing point of the two edge lines as an origin;
recording projection of a window of the code scanning device on a coordinate system plane;
respectively obtaining a pixel point P1x closest to a horizontal axis and a pixel point P1y closest to a vertical axis, or a pixel point P2x closest to the horizontal axis, a pixel point P3x farthest to the horizontal axis and a pixel point P2y closest to the vertical axis, or a pixel point P3y closest to the vertical axis, a pixel point P4y farthest to the vertical axis and a pixel point P4x farthest to the horizontal axis, or a pixel point P5x closest to the horizontal axis, a pixel point P5y closest to the vertical axis, a pixel point P6x farthest to the horizontal axis and a pixel point P6y farthest to the vertical axis in projection;
determining boundaries E1 and E2 passing through the pixel point P1x and the pixel point P1y as windows, or determining boundaries E3, E4 and E5 passing through the pixel point P2x, the pixel point P3x and the pixel point P2y as windows, or determining boundaries E6, E7 and E8 passing through the pixel point P3y, the pixel point P4y and the pixel point P4x as windows, or determining boundaries E9, E10, E11 and E12 passing through the pixel point P5x, the pixel point P5y, the pixel point P6x and the pixel point P6y as windows;
convex polygons formed by the boundaries E1 and E2 of the window and the boundary of the screen of the scanned code terminal, or convex polygons formed by the boundaries E3, E4 and E5 of the window and the boundary of the screen of the scanned code terminal, or convex polygons formed by the boundaries E6, E7 and E8 of the window and the boundary of the screen of the scanned code terminal, or convex polygons formed by the boundaries E9, E10, E11 and E12 of the window are determined as intersection areas.
Optionally, the step of code-shifting the pattern into the area of the intersection area includes:
the pattern code is directly translated into the range of the intersection region.
Optionally, the step of code-shifting the pattern into the area of the intersection area includes:
shrinking the pattern code;
and translating the reduced pattern code into the range of the intersection area.
Optionally, the step of code-shifting the pattern into the area of the intersection area includes:
reducing the screen of the scanned code terminal;
and translating the reduced screen to the intersection area so that the pattern codes on the screen are within the range of the intersection area.
Optionally, the step of code-shifting the pattern into the area of the intersection area includes:
reducing the pattern code to a minimum recognition size capable of being recognized;
and displaying the pattern code with the minimum recognition size and a plurality of copies thereof on a screen of the scanned code terminal, so that the pattern code with the minimum recognition size or at least one copy thereof is displayed in the intersection area.
In addition, in order to achieve the above object, the present invention also provides a computer-readable storage medium including therein a pattern code position adjustment program which, when executed by a processor, implements any of the steps of the pattern code position adjustment method described above.
As can be seen from the above-mentioned pattern code position adjustment method, electronic device and computer readable storage medium of the present invention, since the pattern codes presented on the scanned code terminal can be moved to the range of the intersection area after calculating the intersection area of the window of the scanned code device and the screen of the scanned code terminal, even if the pattern codes cannot fall within the window range due to the window of the "blind-to-blind" scanned code device, the scanned code device can scan the pattern codes presented on the scanned code terminal, and correctly identify the pattern codes, thereby avoiding the use obstacle of the user and improving the code scanning efficiency of the pattern codes in the occasion of using the pattern codes on a large scale.
Drawings
Fig. 1 is a flowchart of an implementation of a pattern code position adjustment method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a pattern code position adjustment device according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
The embodiment of the application provides a pattern code position adjustment method, which is applied to an electronic device, wherein the electronic device can be a personal computer, a smart phone or a tablet personal computer and the like.
Referring to fig. 1, the pattern code position adjustment method in the embodiment of the present application mainly includes the following steps S101 to S103:
s101, when the scanned code terminal presents the pattern code, a camera of the scanned code terminal is started.
In the application, the code scanning terminal can be any electronic device which can present a pattern code and is provided with a camera, such as a smart phone, a tablet computer and the like, the code scanning device can be any electronic device which can read and decode the pattern code, and the pattern code can be a code presented in a pattern manner such as a bar code, a two-dimensional code and the like. It should be noted that, in this application, the camera 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 code scanning terminal is a smart phone, the camera should be a front camera, because the smart phone usually presents the pattern code by a screen.
S102, when the camera of the scanned code terminal monitors that the code scanning device appears in front, calculating an intersection area of a window of the code scanning device and a screen of the scanned code terminal.
As an embodiment of the application, when the camera of the scanned code terminal detects that the code scanning device appears in front, the intersection area of the window of the code scanning device and the screen of the scanned code terminal can be calculated through the following step S a 1021 to S a 1024 implement:
S a and 1021, extracting characteristic information of the code scanning equipment.
The characteristic information of the code scanning device is key information which can uniquely determine one code scanning device, for example, for the code scanning device, the code scanning device can uniquely determine key information of the code scanning device, such as parting lines of different angles, screws of different positions, edges of window components, holes and the like. Of course, the characteristic information of the code scanning device may be information other than those exemplified, and may be other information as long as it is possible to uniquely determine all of the code scanning devices, for example, the number of the code scanning device, the ID engraved, and the like.
S a 1022, determining the current code scanning device according to the extracted characteristic information of the code scanning device.
After the characteristic information of the code scanning equipment is extracted, the code scanning terminal uploads the characteristic information to the cloud server. And after the cloud server receives the characteristic information, matching the characteristic information with the characteristic information of the code scanning equipment stored in the database to determine what code scanning equipment is currently used.
S a 1023, comparing the image shot by the code scanning terminal with the determined full image of the current code scanning device, and determining the window range shot by the code scanning terminal.
It should be noted that, some devices capable of being used as positioning marks exist in the image shot by the code scanning terminal, for example, parting lines of different angles, screws of different positions, edges of window components and the like on the code scanning device. Specifically, comparing the positioning identifier shot by the code scanning terminal with the determined full graph of the current code scanning device, and determining a first window range shot by the code scanning terminal (the first window range belongs to a relatively rough range); and calculating the distance between the positioning mark and the window edge in the first window range to obtain the accurate window range shot by the code scanning terminal.
S a 1024, the screen area of the code terminal to be scanned is scanned and the step S is performed a 1023, overlapping window ranges, wherein the overlapped part is determined as an intersection area of the window of the code scanning device and the screen of the code scanning terminal.
According to the built-in locating equipment of the code scanning terminal, for example, a gyroscope sensor, the angle and the direction of the code scanning terminal and the horizontal plane are determined, and then the rectangular containing the camera can be determined according to the position of the camera of the code scanning terminal on the screen of the code scanning terminal and the direction determined by the center points of the camera and the screen. Due to step S a 1023 the center point of the window range calculated is the projection point of the camera of the scanned code terminal, the size of the scanned code terminal, the position of the camera at the scanned code terminal and other information are known, and according to the known information, the rectangle of the screen of the scanned code terminal and the step S are carried out according to the projection relationship between the camera of the scanned code terminal and the center point of the window range a 1023, overlapping the window of the code scanning device, wherein the common part of the window of the code scanning device and the intersection area of the screen of the code scanning terminal are the overlapped part.
As another embodiment of the application, when the camera of the scanned code terminal detects that the code scanning device appears in front, the intersection area of the window of the code scanning device and the screen of the scanned code terminal can be calculated by the following step S b 1021 to S b 1024 implement:
S b 1021, shooting the code scanning equipment in front of the code scanning terminal to obtain a picture containing a window.
As described above, the scanned code terminal is provided with a front camera, and the front camera can be used for shooting by the code scanning equipment in front of the scanned code terminal, so that a picture containing a window of the code scanning equipment is obtained. It should be noted that, the window of the code scanning device may be the whole window or may be a part of the window.
Further, if the whole window or part of the window of the code scanning device is not within the shooting range of the front camera, a prompt is sent so as to move the code scanning device or the code scanning terminal until the whole window or part of the window of the code scanning device is displayed within the shooting range of the front camera.
S b 1022, the boundary of the window in the picture containing the window is determined.
When the window is assumed to be rectangular, according to whether the window is completely contained in the picture, the method goes through step S b 1021, wherein at least two boundaries of the window are contained in the picture, i.e. when the window is not completely contained in the picture, two or three boundaries of the window are contained in the picture, and when the window is completely contained in the picture, four boundaries of the window are contained in the picture.
In view of the optical difference between the boundary of the window and the non-boundary portion of the window, in one embodiment of the present application, a method for determining the boundary of the window is:
setting a gray threshold THr, taking any image block (the area of the image block is as small as possible) as a detection object, and calculating the gray mean square error of the current image block;
judging whether an edge exists in the current image block according to the gray mean square error of the current image block and the gray threshold THr;
if the gray mean square error of the current image block is smaller than the gray threshold THr, the gray change in the current image block is not obvious, and the current image block is judged to have no edge;
if the gray mean square error of the current image block is larger than the gray threshold THr, the gray change in the current image block is strong, and the edge in the current image block is judged to be the boundary of the window.
S b 1023, determining the boundary of the screen of the scanned code terminal in the picture containing the window.
Can adopt the following steps b 1022, determining the edge of the screen of the scanned code terminal in the picture containing the windowThe boundary of the screen of the code terminal to be scanned can also be directly determined, because the code terminal to be scanned can read parameter information such as the screen size of the terminal to be scanned and the like by itself, so that the boundary of the screen of the code terminal to be scanned in the picture containing the window can be determined according to the information.
S b 1024, determining a convex polygon area surrounded by the whole boundary of the window or a convex polygon area surrounded by the boundary of the screen of the scanned code terminal and the boundary of the window in the picture containing the window as an intersection area.
When the boundary of the window is completely contained within the screen of the scanned code terminal, the convex polygon area surrounded by the whole boundary of the window is the intersection area. In another case, only a part of the boundary of the window is included in the range of the screen of the scanned code terminal, and in this case, it should be noted that, in the picture including the window, the area surrounded by the boundary of the screen of the scanned code terminal and the boundary of the window may be a convex polygon area or a concave polygon area. However, according to the geometric principle, only the convex polygon area surrounded by the boundary of the screen of the scanned code terminal and the boundary of the window is the intersection area referred to in the application.
As another embodiment of the present application, when the camera of the scanned code terminal detects that the scanned code device appears in front, calculating the intersection area of the window of the scanned code device and the screen of the scanned code terminal may be achieved through the following steps Sc1021 to Sc 1025:
sc1021, taking any two crossed edge lines of a screen of a scanned code terminal as a vertical axis and a horizontal axis, and taking the crossing point of the two edge lines as an origin to construct a coordinate system.
The plane of the screen of the scanned code terminal may be used as the plane of the coordinate system constructed as described above, and this plane is referred to herein as a coordinate system plane for convenience of description later.
Sc1022, recording the projection of the window of the code scanning device on the coordinate system plane.
Sc1023, respectively, obtains a pixel point P1x closest to the horizontal axis and a pixel point P1y closest to the vertical axis, or a pixel point P2x closest to the horizontal axis, a pixel point P3x furthest from the horizontal axis and a pixel point P2y closest to the vertical axis, or a pixel point P3y closest to the vertical axis, a pixel point P4y furthest from the vertical axis and a pixel point P4x furthest from the horizontal axis, or a pixel point P5x closest to the horizontal axis, a pixel point P5y closest to the vertical axis, a pixel point P6x furthest from the horizontal axis and a pixel point P6y furthest from the vertical axis in projection.
Sc1024, determining the boundaries E1 and E2 passing through the pixel point P1x and the pixel point P1y as windows, or determining the boundaries E3, E4 and E5 passing through the pixel point P2x, the pixel point P3x and the pixel point P2y as windows, or determining the boundaries E6, E7 and E8 passing through the pixel point P3y, the pixel point P4y and the pixel point P4x as windows, or determining the boundaries E9, E10, E11 and E12 passing through the pixel point P5x, the pixel point P5y, the pixel point P6x and the pixel point P6y as windows.
Sc1025, the convex polygon surrounded by the boundaries E1 and E2 of the window and the boundary of the screen of the code terminal to be scanned, or the convex polygon surrounded by the boundaries E3, E4 and E5 of the window and the boundary of the screen of the code terminal to be scanned, or the convex polygon surrounded by the boundaries E6, E7 and E8 of the window and the boundary of the screen of the code terminal to be scanned, or the convex polygon surrounded by the boundaries E9, E10, E11 and E12 of the window is determined as an intersection area.
Further, in the above embodiment, if the area of the intersection area is smaller than the preset threshold, the mobile code scanning device and/or the scanned code terminal is prompted to expand the area of the intersection area. The expansion of the intersection area allows the subsequent pattern code to be contained within the intersection area by translating without first scaling and then translating.
And S103, if the pattern code pattern presented on the scanned code terminal is not completely within the range of the intersection area, the pattern code is moved into the range of the intersection area.
It should be noted that the pattern code presented on the scanned code terminal is not completely within the range of the intersection region, which means that a part of the pattern code is outside the range of the intersection region, and the pattern code is moved into the range of the intersection region, which means that the region formed by the boundary of the pattern code is completely contained within the range of the intersection region, that is, the boundary of the pattern code is not outside the edge of the intersection region.
As one embodiment of the present application, the pattern code is moved within the scope of the intersection area: the pattern code is directly translated into the range of the intersection area.
As another embodiment of the present application, the pattern code is shifted within the area of the intersection region may be: the pattern code is reduced and then the reduced pattern code pattern is translated into the area of the intersection region.
As another embodiment of the present application, the pattern code is shifted within the area of the intersection region may be: and (3) reducing the screen of the scanned code terminal, and translating the reduced screen to the intersection area or translating the reduced screen to the intersection area, so that the pattern codes on the screen are within the range of the intersection area.
As another embodiment of the present application, the pattern code is shifted within the area of the intersection region may be: the pattern code is reduced to a minimum recognition size which can be recognized, and then the pattern code of the minimum recognition size and a plurality of copies thereof are displayed on a screen of a scanned code terminal, so that the pattern code of the minimum recognition size or at least one copy thereof is displayed in an intersection area.
As can be seen from the above-mentioned pattern code position adjustment method illustrated in FIG. 1, after calculating the intersection area of the window of the code scanning device and the screen of the code scanning terminal, the pattern codes displayed on the code scanning terminal can be moved into the range of the intersection area, so that even if the pattern codes cannot fall within the window range due to the fact that the pattern code user is opposite to the window of the screen and the pattern codes are scanned by the code scanning device, the pattern codes displayed on the code scanning terminal can be scanned by the code scanning device, and the pattern codes can be identified correctly, thereby avoiding the use obstacle of the user and improving the code scanning efficiency of the pattern codes in the occasion of using the pattern codes on a large scale.
Fig. 2 is a schematic diagram of a device for adjusting a position of a pattern code according to an embodiment of the present application. The electronic device can be used for realizing the pattern code position adjustment method in the embodiment shown in fig. 1. As shown in fig. 2, the apparatus mainly includes an opening module 201, an intersection area calculating module 202, and an image moving module 203, wherein:
the starting module 201 is used for starting a camera of the scanned code terminal when the scanned code terminal presents the pattern code;
the intersection area calculating module 202 is configured to calculate an intersection area of a window of the code scanning device and a screen of the code scanning terminal when the camera of the code scanning terminal detects that the code scanning device appears in front;
the image moving module 203 is configured to move the pattern code presented on the scanned terminal to the range of the intersection area if the pattern code is not completely within the range of the intersection area.
It should be noted that, in the embodiment of the apparatus illustrated in fig. 2, the division of the functional modules is merely illustrative, and in practical application, the above-mentioned functional allocation may be performed by different functional modules according to requirements, for example, configuration requirements of corresponding hardware or convenience of implementation of software, that is, the internal structure of the electronic apparatus is divided into different functional modules to perform all or part of the functions described above. In addition, in practical application, the corresponding functional modules in the embodiment may be implemented by corresponding hardware, or may be implemented by corresponding hardware executing corresponding software. The embodiments provided in the present specification can apply the principles described above, and will not be repeated herein.
For specific processes of implementing respective functions by each functional module in the electronic device provided in this embodiment, please refer to the specific contents described in the above method embodiment, which are not described herein again.
Therefore, even if a pattern code user cannot just fall in the window range due to the fact that the window of the code scanning device faces away from the screen, the pattern code displayed on the code scanning device can be scanned to correctly identify the pattern code, and therefore the use obstacle of the user is avoided, and the code scanning efficiency of the pattern code can be improved in the occasion of using the pattern code on a large scale.
Optionally, the intersection area calculating module 202 is specifically configured to extract feature information of the code scanning device; determining current code scanning equipment according to the extracted characteristic information of the code scanning equipment; comparing the image shot by the code scanning terminal with the full image of the current code scanning equipment, and determining the window range shot by the code scanning terminal; and overlapping the screen area of the code scanning terminal with the window range, and determining the overlapped part as the intersection area of the window of the code scanning device and the screen of the code scanning terminal.
Optionally, the intersection area calculating module 202 is specifically configured to shoot the code scanning device in front of the code scanning terminal, so as to obtain a picture including a window; determining the boundary of a window in a picture containing the window; and determining a convex polygon area surrounded by all boundaries of the window or a convex polygon area surrounded by the boundaries of the screen of the code scanning terminal and the boundaries of the window in the picture containing the window as an intersection area by the edges of the screen of the code scanning terminal in the picture containing the window.
Optionally, the intersection area calculation module 202 is specifically configured to take any two crossed edge lines of the screen of the scanned code terminal as a vertical axis and a horizontal axis, and take a crossing point of the two edge lines as an origin to construct a coordinate system; recording projection of a window of the code scanning device on a coordinate system plane; respectively obtaining a pixel point P1x closest to a horizontal axis and a pixel point P1y closest to a vertical axis, or a pixel point P2x closest to the horizontal axis, a pixel point P3x farthest to the horizontal axis and a pixel point P2y closest to the vertical axis, or a pixel point P3y closest to the vertical axis, a pixel point P4y farthest to the vertical axis and a pixel point P4x farthest to the horizontal axis, or a pixel point P5x closest to the horizontal axis, a pixel point P5y closest to the vertical axis, a pixel point P6x farthest to the horizontal axis and a pixel point P6y farthest to the vertical axis in projection; determining boundaries E1 and E2 passing through the pixel point P1x and the pixel point P1y as windows, or determining boundaries E3, E4 and E5 passing through the pixel point P2x, the pixel point P3x and the pixel point P2y as windows, or determining boundaries E6, E7 and E8 passing through the pixel point P3y, the pixel point P4y and the pixel point P4x as windows, or determining boundaries E9, E10, E11 and E12 passing through the pixel point P5x, the pixel point P5y, the pixel point P6x and the pixel point P6y as windows; convex polygons formed by the boundaries E1 and E2 of the window and the boundary of the screen of the code terminal to be scanned, or convex polygons formed by the boundaries E3, E4 and E5 of the window and the boundary of the screen of the code terminal to be scanned, or convex polygons formed by the boundaries E6, E7 and E8 of the window and the boundary of the screen of the code terminal to be scanned, or convex polygons formed by the boundaries E9, E10, E11 and E12 of the window are determined as intersection areas.
Optionally, the image shifting module 203 is specifically configured to directly translate the pattern code into the range of the intersection region.
Optionally, the image shifting module 203 is specifically configured to reduce the pattern code, and translate the reduced pattern code into the range of the intersection area.
Optionally, the image moving module 203 is specifically configured to reduce the screen of the scanned code terminal, and translate the reduced screen toward the intersection area, so that the pattern code on the screen is within the range of the intersection area.
Optionally, the image moving module 203 is specifically configured to reduce the pattern code to a minimum identification size capable of being identified, and display the pattern code with the minimum identification size and multiple copies thereof on a screen of the scanned code terminal, so that the pattern code with the minimum identification size or at least one copy thereof is displayed in the intersection area.
Fig. 3 is a schematic diagram of an electronic device according to an embodiment of the present application. The electronic device can be used for realizing the pattern code position adjustment method in the embodiment shown in fig. 1. As shown in fig. 3, the electronic device mainly includes:
the apparatus comprises a memory 301, a processor 302 and a computer program stored in the memory 301 and executable on the processor 302, wherein the processor 302 implements the pattern code position adjustment method in the embodiment shown in fig. 1 or the embodiment shown when executing the computer program.
Further, the electronic device further includes:
at least one input device 303 and at least one output device 304.
The memory 301, the processor 302, the input device 303, and the output device 304 are connected via a bus 305.
The input device 303 may be a camera, a touch panel, a physical key, a mouse, or the like. The output device 304 may be in particular a display screen.
The memory 301 may be a high-speed random access memory (RAM, random Access Memory) memory or a non-volatile memory (non-volatile memory), such as a disk memory. Memory 301 is used to store a set of executable program codes and processor 302 is coupled to memory 301.
Therefore, even if a pattern code user cannot just fall in the window range due to the fact that the pattern code is opposite to the window of the 'blind-to-code' scanning device, the pattern code displayed on the scanning device can be scanned to the pattern code displayed on the scanning terminal, and the pattern code can be accurately identified, so that the use obstacle of the user is avoided, and the code scanning efficiency of the pattern code can be improved in the occasion of using the pattern code on a large scale.
Further, the embodiment of the application further provides a computer readable storage medium, which may be provided in the electronic device in each embodiment, and the computer readable storage medium may be a memory in the embodiment shown in fig. 3. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the pattern code position adjustment method in the embodiment shown in fig. 1. Further, the computer-readable medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a RAM, a magnetic disk, or an optical disk, etc. which may store the program code.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, 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 integrated modules may be implemented in hardware or in software functional modules.
The integrated modules, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution that contributes to the prior art, or in the form of a software product, which is stored in a readable storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. And the aforementioned readable storage medium includes: a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, etc.
It should be noted that, for the sake of simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all necessary for the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The foregoing describes the pattern code position adjustment method, the electronic device and the computer readable storage medium provided in the present application, and those skilled in the art may change the specific embodiments and the application scope according to the ideas of the embodiments of the present application, so that the present disclosure should not be construed as limiting the present application.

Claims (9)

1. A pattern code position adjustment method, comprising:
when a scanned code terminal presents a pattern code, a camera of the scanned code terminal is started;
when the camera monitors that the code scanning equipment appears in front, calculating an intersection area of a window of the code scanning equipment and a screen of the code scanning terminal;
if the pattern code is not completely within the range of the intersection area, the pattern code is moved into the range of the intersection area;
the step of calculating the intersection area of the window of the code scanning device and the screen of the code scanning terminal comprises the following steps:
extracting characteristic information of the code scanning equipment;
matching the characteristic information with a preset characteristic information database, and determining current code scanning equipment according to a matching result;
comparing the image shot by the code scanning terminal with the full image of the current code scanning device, and determining a window of the code scanning device shot by the code scanning terminal;
overlapping a screen area of the code scanning terminal with a window of the code scanning device, wherein the overlapped part is determined as an intersection area of the window of the code scanning device and the screen of the code scanning terminal;
the image shot by the code scanning terminal comprises a plurality of positioning identification devices which are inherent on the code scanning equipment and used as positioning identifications; the step of comparing the image shot by the code scanning terminal with the full image of the current code scanning device to determine the window of the code scanning device shot by the code scanning terminal comprises the following steps:
comparing all the positioning identification devices in the image shot by the code scanning terminal with the full image of the current code scanning device, and determining a rough window of the code scanning device shot by the code scanning terminal;
and calculating the distance between each positioning identification device in the image shot by the code scanning terminal and the edge of the rough window in the rough window of the code scanning equipment to obtain the precise window of the code scanning equipment shot by the code scanning terminal.
2. The pattern code position adjustment method according to claim 1, wherein the step of calculating an intersection area of a window of the code scanning device and a screen of the code scanned terminal is replaced by:
shooting code scanning equipment in front of the code scanning terminal to obtain a picture containing a window;
determining the boundary of a window in the picture containing the window;
determining the boundary of a screen of the scanned code terminal in the picture containing the window;
and determining a convex polygon area surrounded by all boundaries of the window or a convex polygon area surrounded by the boundary of a screen of the scanned code terminal in the picture containing the window and the boundary of the window as an intersection area.
3. The pattern code position adjustment method according to claim 1, wherein the step of calculating an intersection area of a window of the code scanning device and a screen of the code scanned terminal is replaced by:
constructing a coordinate system by taking any two crossed edge lines of a screen of the scanned code terminal as a vertical axis and a horizontal axis and taking the crossing point of the two edge lines as an origin;
recording projection of a window of the code scanning device on a coordinate system plane;
respectively obtaining a pixel point P1x closest to a horizontal axis and a pixel point P1y closest to a vertical axis, or a pixel point P2x closest to the horizontal axis, a pixel point P3x farthest to the horizontal axis and a pixel point P2y closest to the vertical axis, or a pixel point P3y closest to the vertical axis, a pixel point P4y farthest to the vertical axis and a pixel point P4x farthest to the horizontal axis, or a pixel point P5x closest to the horizontal axis, a pixel point P5y closest to the vertical axis, a pixel point P6x farthest to the horizontal axis and a pixel point P6y farthest to the vertical axis in projection;
determining boundaries E1 and E2 passing through the pixel point P1x and the pixel point P1y as windows, or determining boundaries E3, E4 and E5 passing through the pixel point P2x, the pixel point P3x and the pixel point P2y as windows, or determining boundaries E6, E7 and E8 passing through the pixel point P3y, the pixel point P4y and the pixel point P4x as windows, or determining boundaries E9, E10, E11 and E12 passing through the pixel point P5x, the pixel point P5y, the pixel point P6x and the pixel point P6y as windows;
convex polygons formed by the boundaries E1 and E2 of the window and the boundary of the screen of the scanned code terminal, or convex polygons formed by the boundaries E3, E4 and E5 of the window and the boundary of the screen of the scanned code terminal, or convex polygons formed by the boundaries E6, E7 and E8 of the window and the boundary of the screen of the scanned code terminal, or convex polygons formed by the boundaries E9, E10, E11 and E12 of the window are determined as intersection areas.
4. A pattern code position adjustment method according to any one of claims 1 to 3, characterized in that said shifting a pattern code into the range of said intersection region comprises:
the pattern code is directly translated into the range of the intersection region.
5. A pattern code position adjustment method according to any one of claims 1 to 3, characterized in that said shifting a pattern code into the range of said intersection region comprises:
shrinking the pattern code;
and translating the reduced pattern code into the range of the intersection area.
6. A pattern code position adjustment method according to any one of claims 1 to 3, characterized in that said shifting a pattern code into the range of said intersection region comprises:
reducing the screen of the scanned code terminal;
and translating the reduced screen to the intersection area so that the pattern codes on the screen are within the range of the intersection area.
7. A pattern code position adjustment method according to any one of claims 1 to 3, characterized in that said shifting a pattern code into the range of said intersection region comprises:
reducing the pattern code to a minimum recognition size capable of being recognized;
and displaying the pattern code with the minimum recognition size and a plurality of copies thereof on a screen of the scanned code terminal, so that the pattern code with the minimum recognition size or at least one copy thereof is displayed in the intersection area.
8. An electronic device, comprising: a memory, a processor and a bus, wherein the memory includes a pattern code position adjustment program, which when executed by the processor, implements the steps of the pattern code position adjustment method according to any one of claims 1 to 7.
9. A computer-readable storage medium, wherein a pattern code position adjustment program is included in the computer-readable storage medium, which when executed by a processor, implements the steps of the pattern code position adjustment method according to any one of claims 1 to 7.
CN201910374207.8A 2019-05-07 2019-05-07 Pattern code position adjustment method, device and computer readable storage medium Active CN110197457B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910374207.8A CN110197457B (en) 2019-05-07 2019-05-07 Pattern code position adjustment method, device and computer readable storage medium
PCT/CN2019/101894 WO2020224089A1 (en) 2019-05-07 2019-08-22 Pattern code position adjustment method and apparatus, and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910374207.8A CN110197457B (en) 2019-05-07 2019-05-07 Pattern code position adjustment method, device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110197457A CN110197457A (en) 2019-09-03
CN110197457B true CN110197457B (en) 2024-04-09

Family

ID=67752380

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910374207.8A Active CN110197457B (en) 2019-05-07 2019-05-07 Pattern code position adjustment method, device and computer readable storage medium

Country Status (2)

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

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110717750A (en) * 2019-09-18 2020-01-21 平安科技(深圳)有限公司 Two-dimensional code display method, two-dimensional code display device and mobile terminal
CN111126096A (en) * 2019-12-06 2020-05-08 支付宝(杭州)信息技术有限公司 Two-dimensional code size determination method, two-dimensional code display method, device and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017050095A1 (en) * 2015-09-24 2017-03-30 沈维 Composite mark and method for forming the composite mark
CN107944325A (en) * 2017-11-23 2018-04-20 维沃移动通信有限公司 A kind of barcode scanning method, barcode scanning device and mobile terminal
CN207557953U (en) * 2017-11-30 2018-06-29 北京意锐新创科技有限公司 A kind of multi-functional barcode scanning form and multi-functional bar code scan identifier
CN109407940A (en) * 2018-10-12 2019-03-01 无锡天脉聚源传媒科技有限公司 A kind of target object chooses method, system, terminal and storage medium
CN109409164A (en) * 2018-11-20 2019-03-01 普联技术有限公司 Scan image display adjusting method, device and electronic equipment

Family Cites Families (3)

* 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
CN107609442A (en) * 2017-09-01 2018-01-19 深圳天珑无线科技有限公司 Barcode scanning method, mobile terminal and computer-readable recording medium
CN107886020B (en) * 2017-10-17 2019-03-08 北京三快在线科技有限公司 A kind of method and apparatus of barcode scanning

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017050095A1 (en) * 2015-09-24 2017-03-30 沈维 Composite mark and method for forming the composite mark
CN107944325A (en) * 2017-11-23 2018-04-20 维沃移动通信有限公司 A kind of barcode scanning method, barcode scanning device and mobile terminal
CN207557953U (en) * 2017-11-30 2018-06-29 北京意锐新创科技有限公司 A kind of multi-functional barcode scanning form and multi-functional bar code scan identifier
CN109407940A (en) * 2018-10-12 2019-03-01 无锡天脉聚源传媒科技有限公司 A kind of target object chooses method, system, terminal and storage medium
CN109409164A (en) * 2018-11-20 2019-03-01 普联技术有限公司 Scan image display adjusting method, device and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于链码向量的图像匹配算法;方兴林等;齐齐哈尔大学学报;20111115;第27卷(第6期);第25-28页 *

Also Published As

Publication number Publication date
WO2020224089A1 (en) 2020-11-12
CN110197457A (en) 2019-09-03

Similar Documents

Publication Publication Date Title
JP6417702B2 (en) Image processing apparatus, image processing method, and image processing program
US6774889B1 (en) System and method for transforming an ordinary computer monitor screen into a touch screen
US9405182B2 (en) Image processing device and image processing method
US9519968B2 (en) Calibrating visual sensors using homography operators
JP7422105B2 (en) Obtaining method, device, electronic device, computer-readable storage medium, and computer program for obtaining three-dimensional position of an obstacle for use in roadside computing device
US20200184697A1 (en) Image Modification Using Detected Symmetry
EP3093822B1 (en) Displaying a target object imaged in a moving picture
CN110197457B (en) Pattern code position adjustment method, device and computer readable storage medium
US10643095B2 (en) Information processing apparatus, program, and information processing method
CN114387347B (en) Method, device, electronic equipment and medium for determining external parameter calibration
KR20200104488A (en) System and method for object recognition using local binarization
CN110431563A (en) The method and apparatus of image rectification
US10999513B2 (en) Information processing apparatus having camera function, display control method thereof, and storage medium
CN107330974B (en) Commodity display method and device and mobile equipment
CN111832558A (en) Character image correction method, device, storage medium and electronic equipment
CN112070844A (en) Calibration method and device of structured light system, calibration tool diagram, equipment and medium
CN104933430B (en) A kind of Interactive Image Processing method and system for mobile terminal
CN108780572A (en) The method and device of image rectification
US10339702B2 (en) Method for improving occluded edge quality in augmented reality based on depth camera
CN107515844B (en) Font setting method and device and mobile device
WO2022123929A1 (en) Information processing device and information processing method
CN110909729B (en) Click-to-read content identification method and device and terminal equipment
JP2022185872A (en) Image processing device, image processing method and imaging apparatus
JP2017199288A (en) Image processing device, image processing method and program
KR102239564B1 (en) System and method for object recognition different by administrative area

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant