CN105404841A - Mobile equipment data calculation method based on internet of things - Google Patents

Mobile equipment data calculation method based on internet of things Download PDF

Info

Publication number
CN105404841A
CN105404841A CN201510741272.1A CN201510741272A CN105404841A CN 105404841 A CN105404841 A CN 105404841A CN 201510741272 A CN201510741272 A CN 201510741272A CN 105404841 A CN105404841 A CN 105404841A
Authority
CN
China
Prior art keywords
image
dimensional code
pixel
connected domain
theta
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.)
Pending
Application number
CN201510741272.1A
Other languages
Chinese (zh)
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.)
Chengdu Hui Zhi Distant View Science And Technology Ltd
Original Assignee
Chengdu Hui Zhi Distant View Science And Technology 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 Chengdu Hui Zhi Distant View Science And Technology Ltd filed Critical Chengdu Hui Zhi Distant View Science And Technology Ltd
Priority to CN201510741272.1A priority Critical patent/CN105404841A/en
Publication of CN105404841A publication Critical patent/CN105404841A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a mobile equipment data processing method based on the internet of things. The method comprises the steps that a mobile terminal performs area location and direction correction on a scanned two-dimensional code image; and product or user information corresponding to the two-dimensional code is analyzed and recorded. According to the mobile equipment data processing method, property and action management of a user and a product is performed based on the two-dimensional code, and identification rate of the two-dimensional code is enhanced under the condition of existence of the fragmentary and skew two-dimensional code so that product management efficiency is enhanced.

Description

Mobile equipment data calculation method based on Internet of things
Technical Field
The invention relates to the Internet of things, in particular to a mobile equipment data calculation method based on the Internet of things.
Background
The Internet of things is an important stage of development in the information era and is characterized in that objects are connected with one another and information sharing is realized. The internet of things is widely integrated in a network through communication perception technologies such as an identification technology and information acquisition. For example, in hospitals, drug stores, and related manufacturers, drug administration is an important item. Under the traditional management mode depending on manual recording, the medicine management efficiency is low, the normative is poor, accurate retrieval statistics and strict process supervision cannot be carried out, loss events easily occur in the transportation process, and the positioning and tracking are difficult. Therefore, the accurate management and strict supervision of the whole process and the whole link of the life cycle of the product by applying the advanced information technology in combination with the modern technology of the internet of things become necessary requirements and development trends for strengthening the product management.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a mobile equipment data calculation method based on the internet of things, which comprises the following steps:
the mobile terminal carries out area positioning on the scanned two-dimensional code image and carries out direction correction;
and decoding and recording product or user information corresponding to the two-dimensional code.
Preferably, the positioning the two-dimensional code region in the image further includes:
(1) graying an original color image, performing morphological corrosion operation on the grayed image, forming a maximum black pixel block in the whole area by the two-dimensional code area, and enabling the variance of the finally extracted maximum connected domain to be smaller than a preset threshold value;
(2) binarizing the corroded image, and performing negation operation simultaneously to change the two-dimensional code area into the largest connected domain in the whole image, and interchanging the logic values of pixel points to make the low logic value of the pixel of the two-dimensional code area be 1;
(3) extracting the maximum connected domain of the image, namely positioning a two-dimensional code area, and determining that the maximum connected domain is the area where the two-dimensional code is located, wherein the calculation step of the connected domain comprises the following steps: dividing the whole image into a plurality of connected domains, and solving the number of pixel points in each connected domain; determining the total number N of pixel points in the maximum connected domain; thirdly, traversing each connected domain to set the logic values of all the pixel points in the connected domain with the pixel points smaller than N to be 0, and obtaining a divided two-dimensional code region;
performing phase operation or pixel-by-pixel multiplication operation on the image subjected to the corrosion operation and the original gray level image to obtain a segmented two-dimensional code image only containing a two-dimensional code region but not containing any other background;
and, the performing the direction correction further includes:
the method comprises the steps of firstly extracting the edge of a two-dimensional code image, then detecting the horizontal and vertical straight lines of the two-dimensional code image, obtaining the inclination angle of the two-dimensional code, and finally rotating the image by taking the middle point of the image as the origin to obtain the corrected two-dimensional code image.
Preferably, the extracting the edge of the two-dimensional code image further includes:
(1) smoothing the original image f (x, y) by a Gaussian filter to obtain a smoothed image g (x, y):
g(x,y)=f(x,y)H(x,y)
wherein,the smoothing function is a, b and sigma are preset constant parameters;
(2) gradient magnitude and direction were calculated using first order finite difference of partial derivatives:
G ( x , y ) = G 2 x + G 2 y
θ=arctanGy/Gx
wherein | G (x, y) | is the gradient size, θ is the gradient direction, GxAnd GySobel operators in the x direction and the y direction respectively;
(3) for any pixel point, comparing the gradient value with the gradient value of the neighborhood, and if the gradient value is not the maximum gradient in the neighborhood, setting the gray value of the pixel point to be 0;
(4) setting two thresholds T1And T2Wherein T is2Greater than T1By means of T1The result of the threshold segmentation continuously fills in T2Segmenting discontinuous points in the image to obtain continuous edges;
the detecting the horizontal and vertical straight line of the two-dimensional code image and obtaining the inclination angle of the two-dimensional code further comprises:
(1) performing edge detection on the original gray level image;
(2) establishing a Hough transform accumulator storage space according to the edge detection image;
(3) performing Hough transform on each point on a parameter plane, calculating the value of the Hough transform (rho, theta) of the current point, and adding 1 to the corresponding accumulator;
(4) counting local maximum points of the accumulated value;
(5) drawing a straight line in the image space according to the detected point;
(6) determining straight lines of two inclination angles, namely theta is 45 degrees and theta is-45 degrees, existing in the original image as horizontal and vertical line segments in the corresponding two-dimensional code;
the rotating the image with the image midpoint as the origin further comprises:
(1) moving the central pixel point of the two-dimensional code image to the origin (x) of the reference coordinate0,y0) That is, the coordinate of the center pixel is (0, 0), and the coordinates of the other pixels are sequentially x' ═ x-x0,y'=y-y0(ii) a Wherein, (x, y) is the pixel coordinate before translation transformation, and (x ', y') is the pixel coordinate space after translation transformation;
(2) rotating all the pixel points by an angle theta with the central pixel as an origin, namely x ═ x 'cos theta-y' sin theta, y ═ x 'sin theta + y' cos theta
Wherein, (x, y) is a final coordinate space, and θ is an inclination angle of the two-dimensional code image; after coordinate translation and coordinate rotation, the inclined two-dimensional code image can be corrected to a vertical position;
and, the method further comprises:
dividing an image to be segmented into a foreground image and a background image, and obtaining the average gray level u of foreground and background pixel points1And u2And the ratio w of foreground and background pixels1And w2By u0Expressing the average gray of the original gray image, and determining the minimum threshold value for dividing all pixel points into foreground and background pixel points so as to enable the inter-class variance g of the pixel points, wherein:
g=w1(u1-u0)2+w2(u2-u0)2
compared with the prior art, the invention has the following advantages:
the invention provides a mobile equipment data calculation method, which is used for carrying out attribute and action management on users and products based on two-dimensional codes and improving the recognition rate of the two-dimensional codes under the condition that the two-dimensional codes are incomplete and inclined so as to improve the product management efficiency.
Drawings
Fig. 1 is a flowchart of a method for calculating data of a mobile device based on the internet of things according to an embodiment of the present invention.
Detailed Description
A detailed description of one or more embodiments of the invention is provided below along with accompanying figures that illustrate the principles of the invention. The invention is described in connection with such embodiments, but the invention is not limited to any embodiment. The scope of the invention is limited only by the claims and the invention encompasses numerous alternatives, modifications and equivalents. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. These details are provided for the purpose of example and the invention may be practiced according to the claims without some or all of these specific details.
One aspect of the invention provides a mobile device data calculation method based on the Internet of things. Fig. 1 is a flowchart of a method for calculating data of a mobile device based on the internet of things according to an embodiment of the invention. The invention relates to product management based on two-dimension codes, which realizes the management of products in a non-networking environment. The product management system based on the two-dimension code improves the management capability of products and the positioning capability of events by means of the safe and efficient information storage and transmission capability of the two-dimension code. The whole system consists of a product two-dimensional code, a user identity token (or an automatic identification card), a user authentication module, a product two-dimensional code coding module and a product management and action monitoring module.
Firstly, a two-dimensional code uniquely bound with a product is designed. Relevant information required by product management is completely and safely stored in the two-dimensional code, independent use under the condition of non-networking is realized, and quick input and inspection of relevant summary information of the product are supported at any time and any place.
The user identity token can adopt one of a check type IC card, an RFID radio frequency and a two-dimensional code. In comparison, the user token based on the two-dimensional code technology is not affected by strong magnetic fields, static electricity and high temperature, the data reliability is high, and the manufacturing cost is lower. The two-dimensional code on the user token is generated by encoding the contents of the user identity information, the authority information and the like, so that the verification of the real identity of the user and the direct acquisition of the basic information under the non-networking environment are supported. The user authentication module realizes the unified management and authorization of users. The system supports generation, management and authorization of users and administrators, and also comprises user identity information input, personal characteristic information acquisition and coding of a user token two-dimensional code. And the product two-dimension code coding module generates a two-dimension code of the product. And the product attribute information is input and the associated two-dimensional code is generated synchronously with the release of the product code. The system avoids the administrator from relying on subjective judgment to implement action control on the visitor through the supervision and control of user identity authentication and product related actions. The system also provides for location retrieval of user actions and classification management of products.
The attributes of the product two-dimensional code comprise three contents of identification attributes, secret-related attributes and positioning attributes. The identification attribute is element information extracted according to individual identification and unified management requirements of the product, and specifically comprises a product category, a name and a coding sequence number. The identification information can also be summarized into a serial number as a unique identification number of each product entity, and is used for realizing the uniform management and ordered docking of the system to the product entities in the whole life cycle. Preferably, to ensure the uniqueness of the serial number, the generation formula is defined as: category number + random number based on "product name" + random number based on "code number". The generation of two random numbers takes the product name and the code number as seeds, and a hash function is used to generate the random number of a fixed number, and the process is irreversible. The random number generation method has non-repeatability, namely, if the product name A is not equal to the product name B, the random number generated by the A is not equal to the random number generated by the B. The serial number is designed to hide the title and the code serial number of the product and allow anti-counterfeiting inspection of the two-dimensional code of the product.
And the positioning attribute is used for recording relevant element information of code release according to the positioning and tracking requirements of the product. In the distribution and transportation process of products, in order to facilitate the tracking and positioning of the products under the non-networking condition, the related element information is necessary to be recorded in the two-dimensional code.
The product two-dimensional code coding module performs compression coding on input product attribute data to obtain n-bit data code word di(i-0 … n-2, n-1). The first data codeword of the two-dimensional code is a symbol length codeword, indicating the number of data codewords, and the data encoding starts with the second codeword. The check character comprises two parts of error code detection and error correction, and the error code detection is fixed as 2 code words ci(i ═ 0, 1), and the remaining k-bit code words ri(i-0 … k-2, k-1) are used for error correction.
Two-dimensional codes should have a strong error correction capability to ensure correct reading in case of being bent or smeared over a large area. Therefore, when the two-dimensional code is designed, the proper error correction level is selected, and the balance between the data storage capacity and the error correction capacity is realized. According to different error correction levels s, the number of corresponding error correction code words is 2s + 1. When the two-dimension code attribute data of the product is mainly Chinese content, a byte compression mode is used for representing Chinese characters, and each Chinese character occupies 2 bytes. In the case of the highest error correction level (s ═ 8), the check codeword number is 512, and the capacity available for storing attribute data is only 496 bytes, which corresponds to 248 chinese characters. The error correction level is generally selected at level 2-5 in view of the large amount of attribute content data contained in the product two-dimensional code. The error correction uses the following error control method. The two-dimensional code symbol data is expressed using the following equation.
d(x)=dn-1xn-1+dn-2xn-2+…+d1x+d0
The generation of k error correction codewords is the following equation.
g(x)=(x-3)(x-32)…(x-3k)=xk+gk-1xk-1+…+g1x+g0
The error correcting code expression is: x is the number ofkd (x)/g (x) the complement of each coefficient of the remainder.
The two-dimensional code attribute of the user token comprises three parts of content of identity attribute, authority attribute and management attribute of the user. The user identity attribute is to record the element information of the user identity certificate according to the requirements of user identity identification and authenticity verification. The specific content comprises a user name, user fingerprint characteristic information and the like. The user fingerprint characteristic information is the basis for automatically checking the authenticity of the user token by the system, provides high-reliability anti-counterfeiting check and is suitable for controlling the operation action of the product. The user authority attribute is to record element information of user action authority and secret-related level according to the user action control requirement, and the specific content of the user authority attribute comprises user type, user level, action authority and valid period. The user types are divided into administrator users and general users, and the user action authority is the combination of actions such as code distribution, transportation, storage, destruction and the like.
The effective authentication of the user token depends on the effective identity verification technology. The invention adopts fingerprint characteristic collection and identification technology to realize the anti-counterfeiting function of the user token. The key steps of generating the two-dimensional code of the user token and generating the two-dimensional code of the product are as follows:
(1) and preprocessing the acquired fingerprint image. Through the enhancement, segmentation, filtering, thinning and binarization operations of the image, a clear fingerprint binarization image, namely a fingerprint gray level image represented by 0 and 1, is obtained.
(2) And fingerprint feature point extraction is carried out on the binary image. The fingerprint has complex and various texture characteristics, and breaks, branches or turning points and the like often occur. The extraction of the fingerprint feature points is to extract the nodes with specific attributes. The number of the extracted fingerprint feature points is usually between 20 and 40, and the space of thousands of bytes required for storing fingerprint images can be greatly compressed, so that information storage within the two-dimensional code capacity range is realized.
(3) An array of fingerprint features is generated. Each fingerprint feature point contains three dimensional information of position, type and direction, wherein the feature point type mainly comprises end points and branch points. And splicing the three dimensional information of the fingerprint feature points one by one according to the position coordinates to generate a specific fingerprint feature array.
(4) And encrypting the two-dimension code attribute information. The DES or MD5 symmetric encryption mode is used to encrypt the fingerprint feature array, or encrypt the fingerprint information and other identity information of the user.
(5) And generating a two-dimensional code data symbol. And taking the fingerprint characteristic array and a ciphertext generated by other attribute information of the user as the data item content of the two-dimensional code, performing data coding by adopting a PDF417 coding mode, supplementing and filling code words and error correction code words to form a two-dimensional code data symbol, and finally generating a two-dimensional code graph.
The product management and action monitoring module adopts a modular design and mainly comprises 6 parts, namely a product label information extraction and verification module, a user label information extraction and identity verification module, an action control module, a log recording module, a positioning retrieval module and a product classification management module. When a user needs to transport a product, an administrator respectively reads product attribute information and user attribute information in the product two-dimensional code and the user token two-dimensional code, the two parts of information are input into the action control module to carry out user action verification, and the verified user action information is stored in the action log database by the log recording module. The administrator can track and analyze the user action through the positioning retrieval module, and fine management of the product is performed through the product classification management module.
The mobile terminal with the image acquisition device is used for reading the two-dimension code information of the product, and the product attribute information is extracted through error correction and decoding processing, so that a basis is provided for checking and controlling the transportation action of the product. The module supports a serial number-based two-dimensional code authenticity checking function. For the product which is checked for the first time, the extracted product attribute information needs to be recorded in a product attribute database, and data support is provided for the classification management of the product and the positioning retrieval of the printing link.
And reading the two-dimensional code information of the user token by using a mobile terminal with image acquisition equipment, and extracting user attribute information through error correction, decoding and decryption processing so as to provide a basis for user action management and control. The system displays the information about the user identity attribute and the management attribute in the token two-dimensional code, so that an administrator can compare the visible content on the token to check the authenticity. When the user uses the token for the first time, the system starts the fingerprint recording device to collect the fingerprint characteristics of the user, and the fingerprint characteristics are matched with the fingerprint characteristics carried in the two-dimensional code of the user token, so that the verification of the authenticity of the user identity is realized.
And information of personnel, time, places, actions and the like related to product viewing and transportation is recorded in an action log database, so that the process recording of events is realized, and data support is provided for positioning retrieval. Whether the user action is successfully verified through the security policy or not, element information related to the action is automatically recorded in a log form. The related element information comprises the contents of a user identity token number, a name, a code serial number, a serial number, an action type, occurrence time, an operation place and the like. The module also comprises a log record exporting function to support the allopatric summary analysis in the positioning stage. And on the basis of the action log record, providing an information retrieval and statistical tool, and realizing the positioning retrieval and statistical analysis aiming at the product operation action and the transportation state information. After a loss event occurs, the module can be used for quickly searching related user and product information. The condition of the positioning retrieval can be the user action, and also can be the identity information of an action person or the identification information of a product. And the data of the positioning retrieval in the two-dimension code release stage is derived from the product positioning attribute in the product attribute database. In order to realize combined retrieval and summary analysis, the system supports the function of importing historical action logs or remote action logs.
According to the mobile terminal with the image acquisition equipment, due to the limitation of the software and hardware platform conditions provided by the mobile terminal, the external environment influences the image acquisition equipment, and the whole equipment can encounter a lot of noises in the acquisition process. The positioning of the two-dimensional code needs to overcome the influence of the degradation of the optical system on the identification of the two-dimensional code. The invention further identifies the two-dimensional code under the incomplete condition through denoising, positioning and decoding of the two-dimensional code image by an image processing algorithm.
The method adopts mean filtering with strong real-time performance and ideal denoising effect. Selecting a window capable of sliding, and arranging the data in the window according to the continuous increase or decrease of the pixel value, wherein the average filtering output formula is as follows:
f(x,y)=Med{I(x-m,y-n),(m,n)∈W}
wherein: f (x, y) is an image after template mean processing; i (x, y) denotes the image to be processed, and Med is the mean filtering function. W is the image mean template window, which can be empirically 3 x 3 or 5 x 5 in size. And performing binarization processing on the two-dimensional code image for the denoised image.
Let the parameter (d, α) represent a straight-line equation for the point to the middle line, (x)m,ym) The midpoint of the point pair is represented by d ═ xmcosα+ymsin α, constructing a parameter space from (d, α), finding the maximum value in the parameter space (d, α) corresponds to the symmetry axis of the pattern.
The detection of the rectangle is constructed as follows: setting an accumulation array Ad (d, alpha);
1) clearing the accumulation array Ad (d, alpha);
2) for any point (x) on the contour1,y1) Performing the following steps 3) -6);
3) for any point (x) on the contour2,y2) Requires (x)2,y2) And (x)1,y1) Are two distinct points;
4) for the above-mentioned point pairs, the coordinate points (d, α) of their perpendicular bisectors in the parameter space are calculated using the following formula;
α=arctan((y1-y2)/(x1-x2))
d=((y1-y2)/2)sinα+((x1+x2)/2)cosα
5) adding 1 to the parameter space array Ad (d, alpha);
6) the process is circulated until all points on the contour are visited;
7) searching the maximum value in the accumulated array, and remembering d and alpha corresponding to the moment, wherein the corresponding straight line is a symmetry axis of the graph;
8) β is calculated from | α - β | pi/2 and looked for in the array for all determined Ad (d) corresponding theretoiβ) (i ═ 1, 2, 3 …) in which the maximum is sought, the determined line for Ad (d, β) being the other axis of symmetry and perpendicular to the previously determined axis of symmetry, the intersection (x) of the two axes of symmetryc,yc) Is the center point of the rectangle;
9) then, according to the determined inclination angle, the intersection point of the symmetry axis and the outline of the rectangle is found, and the length and the width of the rectangle are determined.
The decoding steps from reading the two-dimensional code to outputting the information represented by the two-dimensional code are as follows:
1) and positioning and obtaining the two-dimensional code image. The black and white modules are identified as an array of "0" s and "1" s.
2) And reading the format information, removing the mask pattern, correcting the error of the format information module, and identifying the error correction level and the reference of the mask pattern.
3) And reading the version information and determining the version of the symbol.
4) And performing exclusive-or processing on the bitmap of the encoding area by using the mask pattern to eliminate the mask.
5) And reading according to the module arrangement rule, and recovering the data and the error correction code words of the information.
6) And detecting error codes by using the error correction code words corresponding to the error correction level information, and if the error codes are found, correcting the errors.
7) The data codeword is divided into a plurality of portions according to the mode indicator and the character count indicator.
8) And finally, decoding according to the used mode to obtain corresponding information and outputting the result.
Preferably, for the binarization processing described above, since the gray histogram of the two-dimensional code has a bimodal characteristic, the image to be segmented is divided into a foreground image (black dots in the two-dimensional code) and a background image (white dots in the two-dimensional code). u. of1And u2Representing the average gray scale, w, of foreground and background pixels, respectively1And w2Respectively representing the ratio of foreground and background pixels by u0Expressing the average gray of an original gray image, determining a threshold value, and dividing all pixel points into foreground pixel points and background pixel points to minimize the inter-class variance g, wherein:
g=w1(u1-u0)2+w2(u2-u0)2
traversing the threshold determines the threshold that minimizes the inter-class variance g.
After binarization processing, separating the information of the two-dimensional code image and the background by using a mathematical form method in combination with extraction of a connected domain, and positioning a two-dimensional code area, wherein the specific steps are as follows:
(1) graying the original color image, and performing morphological erosion operation on the grayed image. After morphological etching operation, the two-dimensional code area is etched into the largest black pixel block in the whole area. And the number of corrosion times is to enable the variance of the finally extracted maximum connected domain to be smaller than a preset threshold value, so that the connected domain of the extracted two-dimensional code region contains as few black pixel points as possible. The present invention is able to reach this threshold when the final number of etchings is 3.
(2) And binarizing and negating the corroded image. In order to extract a two-dimensional code region, namely the largest black pixel block region, binaryzation of the corroded image is needed, and meanwhile, negation operation is conducted, so that the two-dimensional code region is changed into the largest connected region in the whole image. In order to change the two-dimensional code area into the largest connected domain, the following operations are required, and the logical values of the pixel points are interchanged, so that the low logical value of the pixel in the two-dimensional code area is 1:
BW=-BW+1
(3) and extracting the maximum connected domain of the image to locate the two-dimensional code area. And determining that the largest connected domain is the area where the two-dimensional code is located. The calculation steps of the connected domain are as follows: dividing the whole image into a plurality of connected domains, and solving the number of pixel points in each connected domain; determining the total number N of pixel points in the maximum connected domain; and thirdly, traversing each connected domain to set the logic values of all the pixel points in the connected domain with the pixel point smaller than N to be 0. And obtaining the divided two-dimensional code area after the 3 steps.
And performing phase operation or pixel-by-pixel multiplication operation on the image subjected to the corrosion operation and the original gray-scale image to obtain a segmented two-dimensional code image only containing the two-dimensional code region but not containing any other background.
When a two-dimensional code image is acquired by using equipment such as a camera, the acquired two-dimensional code image may be inclined at a certain angle due to the inclination of the camera, and the two-dimensional code image is inconvenient to identify. In order to solve the problem of inclination of the two-dimensional code image, the edge of the two-dimensional code image is extracted, then the horizontal and vertical straight lines of the two-dimensional code image are detected, the inclination angle of the two-dimensional code is calculated, and finally the corrected two-dimensional code image can be obtained by rotating the image by taking the middle point of the image as the origin.
In order to determine horizontal and vertical straight lines of the two-dimensional code, firstly, extracting the edge of the two-dimensional code by using a Sobel edge detection operator, and the steps are as follows:
(1) smoothing the original image f (x, y) by a Gaussian filter to obtain a smoothed image g (x, y):
g(x,y)=f(x,y)H(x,y)
wherein,for the smoothing function, a, b, and σ are preset constant parameters.
(2) Gradient magnitude and direction were calculated using first order finite difference of partial derivatives:
G ( x , y ) = G 2 x + G 2 y
θ=arctanGy/Gx
wherein | G (x, y) | is the gradient size, θ is the gradient direction, GxAnd GyThe Sobel operators in the x direction and the y direction respectively.
(3) Suppressing gradient amplitudes
And for any pixel point, comparing the gradient value with the gradient value of the neighborhood, and if the gradient value is not the maximum gradient in the neighborhood, setting the gray value of the pixel point to be 0.
(4) Setting two thresholds T1And T2,T2Greater than T1Dividing the non-maximum suppressed imageCutting, using T1The result of the threshold segmentation continuously fills in T2And (4) segmenting discontinuous points in the image to obtain continuous edges with less false edges.
And more continuous edges can be obtained by using a Sobel operator for edge detection, and the interruption of the edges is reduced. And a relatively ideal edge detection effect can be obtained for the two-dimensional code image with certain noise.
And after the edge of the two-dimensional code is detected, a horizontal line and a vertical line in the image of the two-dimensional code can be extracted, and the inclination angle of the line can be calculated. The method comprises the following steps:
(1) and (5) utilizing a Sobel operator to carry out edge detection on the original gray level image.
(2) And creating a Hough transform accumulator storage space according to the edge detection image.
(3) And performing Hough transform on each point on the parameter plane, calculating the Hough transform (rho, theta) value of the current point, and adding 1 to the corresponding accumulator.
(4) And counting local maximum points of the accumulated values. Wherein a larger accumulated value corresponds to a straight line in image space.
(5) And drawing a straight line in the image space according to the detected points.
(6) According to the distribution of H (ρ, θ) in the hough transform graph, the original image mainly contains straight lines with two tilt angles, where θ is 45 ° and θ is-45 °, respectively corresponding to horizontal and vertical line segments in the two-dimensional code.
After the inclination angle of the two-dimensional code image is obtained by utilizing Sobel edge detection and Hough transformation, the image can be rotationally corrected to the vertical direction so as to be convenient for identification. Here, the rotation correction is performed with the midpoint of the two-dimensional code image as the origin, and the steps are as follows:
(1) moving the central pixel point of the two-dimensional code image to the origin (x) of the reference coordinate0,y0) That is, the coordinate of the center pixel is (0, 0), and the coordinates of the other pixels are sequentially x' ═ x-x0,y'=y-y0
Wherein, (x, y) is the pixel coordinate before translation transformation, and (x ', y') is the pixel coordinate space after translation transformation.
(2) Rotating all the pixel points by an angle theta with the central pixel as an origin, namely x ═ x 'cos theta-y' sin theta, y ═ x 'sin theta + y' cos theta
And (x, y) is a final coordinate space, and theta is an inclined angle of the two-dimensional code image. The inclined two-dimensional code image can be corrected to a vertical position after coordinate translation and coordinate rotation.
In summary, the present invention provides a mobile device data calculation method, which performs attribute and motion management on a user and a product based on a two-dimensional code, and improves the recognition rate of the two-dimensional code when the two-dimensional code is incomplete or skewed, so as to improve the product management efficiency.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented in a general purpose computing system, centralized on a single computing system, or distributed across a network of computing systems, and optionally implemented in program code that is executable by the computing system, such that the program code is stored in a storage system and executed by the computing system. Thus, the present invention is not limited to any specific combination of hardware and software.
It is to be understood that the above-described embodiments of the present invention are merely illustrative of or explaining the principles of the invention and are not to be construed as limiting the invention. Therefore, any modification, equivalent replacement, improvement and the like made without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention. Further, it is intended that the appended claims cover all such variations and modifications as fall within the scope and boundaries of the appended claims or the equivalents of such scope and boundaries.

Claims (3)

1. A mobile device data calculation method based on the Internet of things is characterized by comprising the following steps:
the mobile terminal carries out area positioning on the scanned two-dimensional code image and carries out direction correction;
and decoding and recording product or user information corresponding to the two-dimensional code.
2. The method of claim 1, wherein the locating the two-dimensional code region in the image further comprises:
(1) graying an original color image, performing morphological corrosion operation on the grayed image, forming a maximum black pixel block in the whole area by the two-dimensional code area, and enabling the variance of the finally extracted maximum connected domain to be smaller than a preset threshold value;
(2) binarizing the corroded image, and performing negation operation simultaneously to change the two-dimensional code area into the largest connected domain in the whole image, and interchanging the logic values of pixel points to make the low logic value of the pixel of the two-dimensional code area be 1;
(3) extracting the maximum connected domain of the image, namely positioning a two-dimensional code area, and determining that the maximum connected domain is the area where the two-dimensional code is located, wherein the calculation step of the connected domain comprises the following steps: dividing the whole image into a plurality of connected domains, and solving the number of pixel points in each connected domain; determining the total number N of pixel points in the maximum connected domain; thirdly, traversing each connected domain to set the logic values of all the pixel points in the connected domain with the pixel points smaller than N to be 0, and obtaining a divided two-dimensional code region;
performing phase operation or pixel-by-pixel multiplication operation on the image subjected to the corrosion operation and the original gray level image to obtain a segmented two-dimensional code image only containing a two-dimensional code region but not containing any other background;
and, the performing the direction correction further includes:
the method comprises the steps of firstly extracting the edge of a two-dimensional code image, then detecting the horizontal and vertical straight lines of the two-dimensional code image, obtaining the inclination angle of the two-dimensional code, and finally rotating the image by taking the middle point of the image as the origin to obtain the corrected two-dimensional code image.
3. The method of claim 2, wherein the extracting the edge of the two-dimensional code image further comprises:
(1) smoothing the original image f (x, y) by a Gaussian filter to obtain a smoothed image g (x, y):
g(x,y)=f(x,y)H(x,y)
wherein,the smoothing function is a, b and sigma are preset constant parameters;
(2) gradient magnitude and direction were calculated using first order finite difference of partial derivatives:
G ( x , y ) = G 2 x + G 2 y
θ=arctanGy/Gx
wherein | G (x, y) | is the gradient size, θ is the gradient direction, GxAnd GySobel operators in the x direction and the y direction respectively;
(3) for any pixel point, comparing the gradient value with the gradient value of the neighborhood, and if the gradient value is not the maximum gradient in the neighborhood, setting the gray value of the pixel point to be 0;
(4) setting two thresholds T1And T2Wherein T is2Greater than T1By means of T1The result of the threshold segmentation continuously fills in T2Segmenting discontinuous points in the image to obtain continuous edges;
the detecting the horizontal and vertical straight line of the two-dimensional code image and obtaining the inclination angle of the two-dimensional code further comprises:
(1) performing edge detection on the original gray level image;
(2) establishing a Hough transform accumulator storage space according to the edge detection image;
(3) performing Hough transform on each point on a parameter plane, calculating the value of the Hough transform (rho, theta) of the current point, and adding 1 to the corresponding accumulator;
(4) counting local maximum points of the accumulated value;
(5) drawing a straight line in the image space according to the detected point;
(6) determining straight lines of two inclination angles, namely theta is 45 degrees and theta is-45 degrees, existing in the original image as horizontal and vertical line segments in the corresponding two-dimensional code;
the rotating the image with the image midpoint as the origin further comprises:
(1) moving the central pixel point of the two-dimensional code image to the origin of reference coordinates (x0, y)0) That is, the coordinate of the center pixel is (0, 0), and the coordinates of the other pixels are sequentially x' ═ x-x0,y'=y-y0(ii) a Wherein, (x, y) is the pixel coordinate before translation transformation, and (x ', y') is the pixel coordinate space after translation transformation;
(2) rotating all the pixel points by an angle theta with the central pixel as an origin, namely x ═ x 'cos theta-y' sin theta, y ═ x 'sin theta + y' cos theta
Wherein, (x, y) is a final coordinate space, and θ is an inclination angle of the two-dimensional code image; after coordinate translation and coordinate rotation, the inclined two-dimensional code image can be corrected to a vertical position;
and, the method further comprises:
dividing an image to be segmented into a foreground image and a background image, and obtaining the average gray level u of foreground and background pixel points1And u2And the ratio w of foreground and background pixels1And w2By u0Expressing the average gray of the original gray image, and determining the minimum threshold value for dividing all pixel points into foreground and background pixel points so as to enable the inter-class variance g of the pixel points, wherein:
g=w1(u1-u0)2+w2(u2-u0)2
CN201510741272.1A 2015-11-04 2015-11-04 Mobile equipment data calculation method based on internet of things Pending CN105404841A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510741272.1A CN105404841A (en) 2015-11-04 2015-11-04 Mobile equipment data calculation method based on internet of things

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510741272.1A CN105404841A (en) 2015-11-04 2015-11-04 Mobile equipment data calculation method based on internet of things

Publications (1)

Publication Number Publication Date
CN105404841A true CN105404841A (en) 2016-03-16

Family

ID=55470320

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510741272.1A Pending CN105404841A (en) 2015-11-04 2015-11-04 Mobile equipment data calculation method based on internet of things

Country Status (1)

Country Link
CN (1) CN105404841A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107122816A (en) * 2017-03-20 2017-09-01 广东顺德中山大学卡内基梅隆大学国际联合研究院 A kind of self-defined view finding figure Quick Response Code and generation method
CN108960000A (en) * 2018-07-17 2018-12-07 深圳市零点零科技有限公司 A kind of strip small two-dimension code recognition methods
CN109242807A (en) * 2018-11-07 2019-01-18 厦门欢乐逛科技股份有限公司 Rendering parameter adaptive edge softening method, medium and computer equipment
CN109587219A (en) * 2018-11-07 2019-04-05 重庆光电信息研究院有限公司 The setting and management method at Locating Type city Internet of Things edge calculations point station
CN109840522A (en) * 2019-01-08 2019-06-04 河北科技大学 A kind of big plane rod end tagging scheme and character picture antidote
CN109961383A (en) * 2018-09-29 2019-07-02 大连艾米移动科技有限公司 A kind of home for destitute promotional system based on two-dimensional code scanning
CN113962239A (en) * 2021-09-14 2022-01-21 北京小米移动软件有限公司 Two-dimensional code scanning method and device, mobile terminal and computer readable storage medium
CN114911435A (en) * 2022-07-18 2022-08-16 北京中宏立达科技发展有限公司 Copying control method and system based on two-dimensional bar code

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060043186A1 (en) * 2004-08-30 2006-03-02 Nadabar Sateesha G Methods and apparatus for reading bar code identifications
CN104376292A (en) * 2013-08-13 2015-02-25 海尔集团公司 Household appliance and production method thereof, information system and using method of household appliance
CN104766095A (en) * 2015-04-16 2015-07-08 成都汇智远景科技有限公司 Mobile terminal image identification method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060043186A1 (en) * 2004-08-30 2006-03-02 Nadabar Sateesha G Methods and apparatus for reading bar code identifications
CN104376292A (en) * 2013-08-13 2015-02-25 海尔集团公司 Household appliance and production method thereof, information system and using method of household appliance
CN104766095A (en) * 2015-04-16 2015-07-08 成都汇智远景科技有限公司 Mobile terminal image identification method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
张培晶: "基于二维码技术的涉密文件保密管理系统", 《中国人民公安大学学报(自然科学版)》 *
李璐: "面向手机的二维条码定位识别算法的研究", 《中国优秀硕士学位论文全文数据库信息科技辑》 *
陈超等: "基于数字图像处理的条形码识别预处理算法研究", 《河南工程学院学报(自然科学版)》 *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107122816A (en) * 2017-03-20 2017-09-01 广东顺德中山大学卡内基梅隆大学国际联合研究院 A kind of self-defined view finding figure Quick Response Code and generation method
CN108960000A (en) * 2018-07-17 2018-12-07 深圳市零点零科技有限公司 A kind of strip small two-dimension code recognition methods
CN109961383A (en) * 2018-09-29 2019-07-02 大连艾米移动科技有限公司 A kind of home for destitute promotional system based on two-dimensional code scanning
CN109242807A (en) * 2018-11-07 2019-01-18 厦门欢乐逛科技股份有限公司 Rendering parameter adaptive edge softening method, medium and computer equipment
CN109587219A (en) * 2018-11-07 2019-04-05 重庆光电信息研究院有限公司 The setting and management method at Locating Type city Internet of Things edge calculations point station
CN109242807B (en) * 2018-11-07 2020-07-28 厦门欢乐逛科技股份有限公司 Rendering parameter adaptive edge softening method, medium, and computer device
CN109587219B (en) * 2018-11-07 2021-11-19 重庆光电信息研究院有限公司 Method for setting and managing fixed-type city Internet of things edge computing point station
CN109840522A (en) * 2019-01-08 2019-06-04 河北科技大学 A kind of big plane rod end tagging scheme and character picture antidote
CN109840522B (en) * 2019-01-08 2023-06-20 河北科技大学 Large-rod end face marking scheme and character image correction method
CN113962239A (en) * 2021-09-14 2022-01-21 北京小米移动软件有限公司 Two-dimensional code scanning method and device, mobile terminal and computer readable storage medium
CN114911435A (en) * 2022-07-18 2022-08-16 北京中宏立达科技发展有限公司 Copying control method and system based on two-dimensional bar code
CN114911435B (en) * 2022-07-18 2022-11-11 北京中宏立达科技发展有限公司 Copying control method and system based on two-dimensional bar code

Similar Documents

Publication Publication Date Title
CN105404841A (en) Mobile equipment data calculation method based on internet of things
US10789465B2 (en) Feature extraction and matching for biometric authentication
CN102799850B (en) A kind of barcode recognition method and device
US8483427B2 (en) System and method for image authentication
Alshehri et al. Cross-sensor fingerprint matching method based on orientation, gradient, and gabor-hog descriptors with score level fusion
CN104166955B (en) Based on the generation of conformal mapping image Hash and distorted image detection localization method
CN111695410A (en) Violation reporting method and device, computer equipment and storage medium
CN108717744B (en) Method and device for identifying seal serial number on financial document and terminal equipment
CN104636730A (en) Method and device for face verification
US20190138840A1 (en) Automatic ruler detection
US20220156756A1 (en) Fraud detection via automated handwriting clustering
Lopez-Rincon et al. Binary Large Object‐Based Approach for QR Code Detection in Uncontrolled Environments
Gupta et al. A simplistic global median filtering forensics based on frequency domain analysis of image residuals
Mahiuddin Design a secure voting system using smart card and Iris recognition
CN114120377A (en) Application method and system of printing control instrument for accurately identifying spatial pyramid fingerprints
CN113221696A (en) Image recognition method, system, equipment and storage medium
CN111104844B (en) Multi-invoice information input method and device, electronic equipment and storage medium
CN107077622B (en) Digital signature authentication
CN107239776B (en) Method and apparatus for tilt image correction
Mishra et al. A lossless model for generation of unique digital code for identification of biometric images
CN105373931A (en) Mobile terminal information processing method based on Internet of things
US10380391B1 (en) Method and apparatus for fractal identification
CN113239381A (en) Data security encryption method
Tantubay et al. A Survey of Biometric Key-Binding Biocrypto-System Using Different Techniques
CN112132693A (en) Transaction verification method, transaction verification device, computer equipment and computer-readable storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160316