CN111161328A - Screen image acquisition method based on two-dimensional code - Google Patents
Screen image acquisition method based on two-dimensional code Download PDFInfo
- Publication number
- CN111161328A CN111161328A CN201911414062.6A CN201911414062A CN111161328A CN 111161328 A CN111161328 A CN 111161328A CN 201911414062 A CN201911414062 A CN 201911414062A CN 111161328 A CN111161328 A CN 111161328A
- Authority
- CN
- China
- Prior art keywords
- image
- sub
- dimensional code
- original
- target
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/30—Determination of transform parameters for the alignment of images, i.e. image registration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K7/00—Methods or arrangements for sensing record carriers, e.g. for reading patterns
- G06K7/10—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
- G06K7/14—Methods 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/1404—Methods for optical code recognition
- G06K7/1408—Methods for optical code recognition the method being specifically adapted for the type of code
- G06K7/1417—2D bar codes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K7/00—Methods or arrangements for sensing record carriers, e.g. for reading patterns
- G06K7/10—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
- G06K7/14—Methods 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/1404—Methods for optical code recognition
- G06K7/1439—Methods for optical code recognition including a method step for retrieval of the optical code
- G06K7/1443—Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (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)
- Image Processing (AREA)
Abstract
The application relates to a screen image acquisition method based on a two-dimensional code. The method comprises the following steps: the method comprises the steps of obtaining an original image, wherein the original image comprises a two-dimensional code area and an original area, identifying the two-dimensional code area in the original image, extracting compression information in the two-dimensional code area, extracting image information in the original area, generating a target sub-image according to the compression information, replacing the two-dimensional code area from the original image by using the target sub-image, generating a replacement image, and performing registration processing on the replacement image according to the image information to obtain the target image. According to the technical scheme, the sub-images are processed, the complexity of data compression of the original image is avoided, and only the incomplete local image is obtained under the condition that the information content of the two-dimensional code is unknown, so that the concealment of data transmission of the image is enhanced.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a screen image acquisition method and device based on a two-dimensional code, computer equipment and a storage medium.
Background
With the development of computer technology, image processing technology is developed more and more. Image processing refers to removing noise, enhancing, restoring, segmenting, extracting features, etc. from an image by a computer device. Image processing may be the transformation, encoding, and compression of image data to facilitate storage and transmission of images. Image processing can be applied to computer vision, image processing, and the like, and data transmission and image processing are currently important research subjects in the field of communications. When an image is transmitted from one computer device to another computer device, the transmission mode can be multiple, such as wired transmission, wireless transmission and the like, and the image can also be directly acquired through a camera of the computer device.
However, when a camera of a computer device is used to process an image, the size of the acquired image is far away from the original image, the shooting effect on the screen is not ideal, and the problems of image translation, rotation, scaling and the like exist. Therefore, the conventional image processing method has a problem of poor quality of transmitted images.
Disclosure of Invention
Based on this, in order to solve the above technical problem, a two-dimensional code based screen image acquisition method is provided, which can improve the image quality of an image in an image processing process.
A screen image acquisition method based on two-dimensional codes comprises the following steps:
acquiring an original image, wherein the original image comprises a two-dimensional code area and an original area;
identifying the two-dimension code area in the original image, extracting compressed information in the two-dimension code area, and extracting image information in the original area; the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value; the first position coordinate is used for representing the position of the original image, and the second position coordinate is used for representing the position of the two-dimensional code area;
generating a target sub-image according to the compression information, and replacing the two-dimensional code area from the original image by using the target sub-image to generate a replacement image;
and carrying out registration processing on the replacement image according to the image information to obtain a target image.
Further, before the obtaining of the original image, where the original image includes a two-dimensional code region and an original region, the method further includes:
acquiring a target image, and decomposing the target image into a plurality of sub-images;
respectively calculating image parameters of the sub-images, and determining the target sub-image from the sub-images according to the image parameters;
and acquiring image information in the target sub-image, generating a two-dimensional code area according to the image information, and replacing the target sub-image from the target image by using the two-dimensional code area to generate an original image.
Further, the determining a target sub-image from the sub-images according to the threshold value and the image parameter includes:
comparing the threshold value with the image parameters of the plurality of sub-images respectively to obtain a comparison result;
when the comparison result is that the threshold value is larger than or equal to the image parameter of the sub-image, taking the sub-image corresponding to the image parameter of the sub-image as the target sub-image;
and when the comparison result is that the threshold value is smaller than the image parameter of the sub-image, decomposing the sub-image into a plurality of sub-images, and determining the target sub-image from the sub-images.
Further, the determining the target sub-image from the secondary sub-image comprises:
and respectively acquiring the image parameters of the plurality of sub-images, acquiring a target image parameter in the image parameters of the plurality of sub-images, and taking the sub-image corresponding to the target image parameter as the target sub-image.
Further, before the finding the threshold value, the method further includes:
acquiring a setting request of a threshold value, wherein the setting request comprises an image identifier;
extracting an image identifier in the setting request, and searching an original image corresponding to the image identifier;
and acquiring an input threshold value, and corresponding the input threshold value to the original image.
Further, the calculating the image parameter of the sub-image includes:
when the sub-image is a gray image, calculating the deviation absolute value of the average gray of the sub-image and each gray, and taking the deviation absolute value as the image parameter of the sub-image;
and when the sub-image is a color image, calculating the parameter average value of the sub-image, and taking the parameter average value as the image parameter of the sub-image.
Further, the calculating the image parameter of the sub-image further includes:
when the sub-image is a gray image, acquiring a first pixel gray value of the sub-image, calculating a deviation absolute value of the first pixel gray value and each gray value, and taking the deviation absolute value as an image parameter of the sub-image;
and when the sub-image is a color image, calculating the maximum value of the parameter of the sub-image, and taking the maximum value of the parameter as the image parameter of the sub-image.
A screen image acquisition device based on two-dimensional code, the device includes:
the image acquisition module is used for acquiring an original image, and the original image comprises a two-dimensional code area and an original area;
the area identification module is used for identifying the two-dimensional code area in the original image, extracting compressed information in the two-dimensional code area and extracting image information in the original area; the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value; the first position coordinate is used for representing the position of the original image, and the second position coordinate is used for representing the position of the two-dimensional code area;
the replacing image generating module is used for generating a target sub-image according to the compression information, replacing the two-dimensional code area from the original image by using the target sub-image and generating a replacing image;
and the target image generation module is used for carrying out registration processing on the replacement image according to the image information to obtain a target image.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring an original image, wherein the original image comprises a two-dimensional code area and an original area;
identifying the two-dimension code area in the original image, extracting compressed information in the two-dimension code area, and extracting image information in the original area; the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value; the first position coordinate is used for representing the position of the original image, and the second position coordinate is used for representing the position of the two-dimensional code area;
generating a target sub-image according to the compression information, and replacing the two-dimensional code area from the original image by using the target sub-image to generate a replacement image;
and carrying out registration processing on the replacement image according to the image information to obtain a target image.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring an original image, wherein the original image comprises a two-dimensional code area and an original area;
identifying the two-dimension code area in the original image, extracting compressed information in the two-dimension code area, and extracting image information in the original area; the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value; the first position coordinate is used for representing the position of the original image, and the second position coordinate is used for representing the position of the two-dimensional code area;
generating a target sub-image according to the compression information, and replacing the two-dimensional code area from the original image by using the target sub-image to generate a replacement image;
and carrying out registration processing on the replacement image according to the image information to obtain a target image.
The screen image acquisition method based on the two-dimensional code comprises the steps of acquiring an original image, wherein the original image comprises a two-dimensional code area and an original area, identifying the two-dimensional code area in the original image, extracting compressed information in the two-dimensional code area, and extracting image information in the original area, wherein the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value, the first position coordinate is used for representing the position of the original image, the second position coordinate is used for representing the position of the two-dimensional code area, generating a target sub-image according to the compressed information, replacing the two-dimensional code area from the original image by using the target sub-image, generating a replacement image, and carrying out registration processing on the replacement image according to the image information to obtain the target image. The technical scheme has the following beneficial effects that: the original image is decomposed, and the sub-images are selected for processing, so that the complexity of data compression on the original image is avoided; by searching a threshold value, the subimage meeting the requirement is selected, and the basic quality of image restoration is ensured; under the condition that the information content of the two-dimensional code is unknown, only an incomplete local image is obtained, and a complete image cannot be directly obtained, so that the concealment of data transmission of the image is enhanced.
Drawings
FIG. 1 is a diagram of an application environment of a two-dimensional code-based screen image acquisition method in an embodiment;
FIG. 2 is a schematic flow chart illustrating a two-dimensional code-based screen image acquisition method according to an embodiment;
FIG. 3 is a block diagram of a two-dimensional code-based screen image capture device in one embodiment;
FIG. 4 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The two-dimensional code-based screen image acquisition method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. As shown in FIG. 1, the application environment includes a computer device 110 and a computer device 120. The computer device 110 may obtain an original image from the computer device 120, where the original image includes a two-dimensional code region and an original region, and the computer device 110 may identify the two-dimensional code region in the original image, extract compressed information in the two-dimensional code region, and extract image information in the original region; the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value; the first position coordinate is used for representing the position of the original image, and the second position coordinate is used for representing the position of the two-dimensional code area. The computer device 110 may generate a target sub-image from the compression information and replace the two-dimensional code region with the original image using the target sub-image to generate a replacement image. The computer device 110 may perform registration processing on the replacement image according to the image information to obtain the target image. The computer devices 110 and 120 may be, but are not limited to, various personal computers, notebook computers, smart phones, tablet computers, portable wearable devices, and the like.
In one embodiment, as shown in fig. 2, a two-dimensional code-based screen image acquisition method is provided, which includes the following steps:
step 202, obtaining an original image, wherein the original image comprises a two-dimensional code area and an original area.
The original image may be an image stored in a computer device, or an image captured by a computer device in time, which is not limited herein. The original image may include a two-dimensional code region and an original region. And the area outside the two-dimensional code area in the original image is the original area.
The computer device can extract compression information from the two-dimensional code area, and the compression information can be used for representing the times of compression of the two-dimensional code area. The computer device can extract the pixel mean value from the original area region and acquire the first position coordinate of the original image and the second position coordinate of the two-dimensional code region. The first position coordinates may be used to represent a specific position of the original image in two-dimensional space or three-dimensional space; the second position coordinates of the two-dimensional code region may be used to represent the position of the two-dimensional code region in the original image. Wherein the first position coordinates of the original image may be the gravity center point coordinates of the original image, for example, the first position coordinates of the original image may be (640, 480); the second position coordinate of the two-dimensional code region may be a center of gravity point coordinate of the two-dimensional code region, for example, the second position coordinate of the two-dimensional code region may be (650,260). The computer device may extract the first position coordinates of the original image and the second position coordinates of the two-dimensional code region, respectively.
The pixel value can be used to represent how many tens of thousands of pixels are in the camera. For example 30, 130, 500, 1000 ten thousand pixels. The pixel values may be represented on the image, display, screen as 640 x 480, 1280 x 1024 pixels, etc. The computer device may extract a pixel mean from the two-dimensional code region.
The compression parameter may be used to indicate a compression ratio of the original area with respect to the two-dimensional code area. The threshold value may be a specific value or a range of values. For example, the threshold value may be a specific value of 5, or may be a range of 5 to 10.
And step 206, generating a target sub-image according to the compression information, and replacing the two-dimensional code area from the original image by using the target sub-image to generate a replacement image.
The two-dimensional code area can be used for representing an image which is distributed on a plane according to a certain rule by a certain specific geometric figure and is used for recording data symbol information. The original image may be used to represent an image containing a two-dimensional code.
The compression information may be used to indicate a multiple by which the two-dimensional code region is compressed. The computer device may generate the target sub-image from the compression information, wherein a byte size of the generated target sub-image is larger than a byte size of the two-dimensional code region. The computer device may replace the two-dimensional code region from the original image using the target sub-image, generating a replacement image.
And 208, carrying out registration processing on the replacement image according to the image information to obtain a target image.
In this embodiment, the computer device identifies a two-dimensional code region in an original image by acquiring the original image, where the original image includes the two-dimensional code region and the original region, extracts compressed information in the two-dimensional code region, and extracts image information in the original region, where the image information includes a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter, and a threshold value, where the first position coordinate is used to represent a position of the original image, and the second position coordinate is used to represent a position of the two-dimensional code region, generates a target sub-image according to the compressed information, replaces the two-dimensional code region with the target sub-image from the original image, generates a replacement image, and performs registration processing on the replacement image according to the image information, so as to obtain the target image. The technical scheme has the following beneficial effects that: the original image is decomposed, and the sub-images are selected for processing, so that the complexity of data compression on the original image is avoided; by searching a threshold value, the subimage meeting the requirement is selected, and the basic quality of image restoration is ensured; under the condition that the information content of the two-dimensional code is unknown, only an incomplete local image is obtained, and a complete image cannot be directly obtained, so that the concealment of data transmission of the image is enhanced.
In an embodiment, the provided two-dimensional code-based screen image acquisition method may further include a process of obtaining an original image, specifically including: acquiring a target image, and decomposing the target image into a plurality of sub-images; respectively calculating image parameters of the sub-images, and determining a target sub-image from the sub-images according to the image parameters; and acquiring image information in the target sub-image, generating a two-dimensional code area according to the image information, and replacing the target sub-image with the target image by using the two-dimensional code area to generate an original image.
The target image may be an image stored in the computer device, or an image captured by the computer device in time, which is not limited herein. The computer device may acquire a target image and decompose the target image into a plurality of sub-images, wherein the plurality of sub-images obtained by decomposition are non-overlapping partitions of the target image.
In the computer field, a grayscale digital image is an image in which each pixel has only one sample color. The grayscale value is a value of a certain pixel coordinate point of an image captured by a grayscale camera. The gray scale value parameter may be used to represent an absolute value of a maximum deviation between an average gray scale of an image and each gray scale, may be used to represent an absolute value of a maximum deviation between a first gray scale of the image and each gray scale value, may be used to represent an average value of three parameters of a gray scale image (regarded as three gray scale images), may be used to represent a maximum value of three parameters of a gray scale sub-image (regarded as three gray scale images), and the like, and is not limited herein.
After the target image is decomposed into a plurality of sub-images, the computer device can calculate the image parameters of each sub-image. Specifically, the computer device may sequentially perform image parameter calculation on the decomposed sub-images in sequence, and the computer device may also perform image parameter calculation on the decomposed sub-images randomly. The image parameter may be a specific numerical value. For example, the image parameter may be a specific value such as 5, 6, 9, 10, etc.
The computer device may then look up the threshold value and determine a target sub-image from the sub-images based on the threshold value and the image parameters. The threshold value may be a specific value or a range of values. For example, the threshold value may be a specific value of 5, or may be a range of 5 to 10. The target sub-image may be one of a plurality of sub-images, and since the image parameter calculated by the computer device is a specific value, the computer device may determine the target sub-image from the sub-images according to the found threshold value and the calculated image parameter.
The computer device may label the pixel mean, the first position coordinate, the second position coordinate, and the threshold value as image information, which may be used to represent a byte size of the image. The computer device may generate a two-dimensional code region from the image information, wherein a byte size of the generated two-dimensional code region is less than or equal to a byte size of the target sub-image. The computer device may replace the target sub-image with the target image using the two-dimensional code region, generating an original image.
In an embodiment, the provided two-dimensional code-based screen image acquisition method may further include a process of determining a target sub-image, specifically including: respectively comparing the threshold value with the image parameters of the plurality of sub-images to obtain a comparison result; when the comparison result is that the threshold value is larger than or equal to the image parameter of the sub-image, taking the sub-image corresponding to the image parameter of the sub-image as a target sub-image; and when the comparison result is that the threshold value is smaller than the image parameter of the sub-image, decomposing the sub-image into a plurality of sub-images, and determining the target sub-image from the sub-images.
The computer device may compare the found threshold values with the image parameters of the plurality of sub-images, respectively, and the comparison result may include that the threshold value is greater than or equal to the image parameter of the sub-image and the threshold value is smaller than the image parameter of the sub-image. When the threshold value is greater than or equal to the image parameters of the sub-images, the computer device may sequentially or randomly acquire the image parameters of each sub-image, and the computer device may select a first sub-image of which the image parameters are less than or equal to the threshold value and use the first sub-image as a target sub-image; when the threshold value is smaller than the image parameter of the sub-image, the computer device may select the sub-image with the smallest image parameter, decompose the sub-image into a plurality of sub-images, and determine the target sub-image from the sub-images.
In an embodiment, the provided two-dimensional code-based screen image capturing method may further include a process of determining a target sub-image from the sub-image, specifically including: and respectively acquiring the image parameters of the plurality of sub-images, acquiring target image parameters in the image parameters of the plurality of sub-images, and taking the sub-images corresponding to the target image parameters as target sub-images.
Wherein the target image parameter may be a smallest parameter among image parameters of the plurality of sub-images. The computer device may obtain image parameters of the plurality of sub-images, respectively, and select the sub-image with the smallest image parameter as the target sub-image.
In an embodiment, the provided two-dimensional code-based screen image acquisition method may further include a process of setting a threshold value, specifically including: acquiring a setting request of a threshold value, wherein the setting request comprises an image identifier; extracting an image identifier in the setting request, and searching an original image corresponding to the image identifier; and acquiring an input threshold value, and corresponding the input threshold value to the original image.
Wherein the request for setting the threshold value may be generated by a user triggering the computer device. For example, a user may press a button on the computer device, causing the computer device to generate a request to set a threshold value; the user may also click on a control in the display screen of the computer device, so that the computer device generates a request for setting the threshold value. The request for setting the threshold value may be used to set the threshold value. The image identifier may be a string of numbers or a string of codes, and is not limited herein.
After obtaining the setting request of the threshold value, the computer device may extract the image identifier in the setting request, so as to find the original image corresponding to the image identifier. The input threshold value may be used to represent a specific numerical value input by the user through the computer device, and the computer device may correspond the input threshold value to the original image.
In an embodiment, the provided two-dimensional code-based screen image acquisition method may further include a process of calculating image parameters of the sub-image, specifically including: when the sub-image is a gray image, calculating the deviation absolute value of the average gray of the sub-image and each gray, and taking the deviation absolute value as the image parameter of the sub-image; when the sub-image is a color image, calculating the parameter average value of the sub-image, and taking the parameter average value as the image parameter of the sub-image.
The computer device may determine the image type of the sub-image, wherein the image type may be divided into a grayscale image and a color image. When the sub-image is a grayscale image, the computer device may calculate an absolute value of deviation of the average grayscale of the sub-image from each grayscale, and use the absolute value of deviation as an image parameter of the sub-image. For example, the image parameter d is the absolute value of the maximum deviation between the average gray level m of the sub-image and each gray level, where m represents the pixel mean value of the sub-image, dj represents the absolute value of the difference between the gray level value xj and the mean value m, abs (xj-m), d is the largest absolute value, max (abs (xj-m)), and j is 1,2, … V.
When the sub-image is a color image, calculating the parameter average value of the sub-image, and taking the parameter average value as the image parameter of the sub-image. For example, the image parameter d is an average value of three parameters d1, d2, d3 of the RGB gray-scale sub-images (regarded as three gray-scale images).
In another embodiment, the provided two-dimensional code-based screen image acquisition method may further include a process of calculating image parameters of the sub-image, specifically including: when the sub-image is a gray image, acquiring a first pixel gray value of the sub-image, calculating a deviation absolute value of the first pixel gray value and each gray value, and taking the deviation absolute value as an image parameter of the sub-image; when the sub-image is a color image, calculating the maximum value of the parameter of the sub-image, and taking the maximum value of the parameter as the image parameter of the sub-image.
When the sub-image is a gray image, the computer device may obtain a first pixel gray value of the sub-image, calculate a deviation absolute value of the first pixel gray value from each gray value, and use the deviation absolute value as an image parameter of the sub-image. For example, the image parameter d is the absolute value of the maximum deviation between the first gray level x1 of the sub-image and each gray level; where x1 represents the first gray value of a pixel of the sub-image, dj represents the absolute value of the difference between the gray value xj and the first gray value x 1: abs (xj-m), d is the largest absolute value: max (abs (xj-x1)), j is 2, … V.
When the sub-image is a color image, the computer device may calculate a parameter maximum value of the sub-image, and take the parameter maximum value as an image parameter of the sub-image. For example, the image parameter d is the maximum value of the three parameters d1, d2, d3 of the RGB grayscale sub-images (considered as three grayscale images).
It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in the above-described flowcharts may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or the stages is not necessarily sequential, but may be performed alternately or alternatingly with other steps or at least a portion of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 3, there is provided a two-dimensional code based screen image capture device, including: an image acquisition module 310, a region identification module 320, a replacement image generation module 330, and a target image generation module 340, wherein:
the image obtaining module 310 is configured to obtain an original image, where the original image includes a two-dimensional code region and an original region.
The region identification module 320 is configured to identify a two-dimensional code region in an original image, extract compressed information in the two-dimensional code region, and extract image information in the original region; the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value; the first position coordinate is used for representing the position of the original image, and the second position coordinate is used for representing the position of the two-dimensional code area.
And the replacement image generation module 330 is configured to generate a target sub-image according to the compression information, and replace the two-dimensional code region with the original image by using the target sub-image to generate a replacement image.
And the target image generation module 340 is configured to perform registration processing on the replacement image according to the image information to obtain a target image.
In an embodiment, the provided two-dimensional code-based screen image acquisition device may further include an original image generation module, configured to acquire a target image and decompose the target image into a plurality of sub-images; respectively calculating image parameters of the sub-images, and determining a target sub-image from the sub-images according to the image parameters; and acquiring image information in the target sub-image, generating a two-dimensional code area according to the image information, and replacing the target sub-image with the target image by using the two-dimensional code area to generate an original image.
In one embodiment, the original image generation module is further configured to compare the threshold values with image parameters of a plurality of sub-images, respectively, and obtain comparison results; when the comparison result is that the threshold value is larger than or equal to the image parameter of the sub-image, taking the sub-image corresponding to the image parameter of the sub-image as a target sub-image; and when the comparison result is that the threshold value is smaller than the image parameter of the sub-image, decomposing the sub-image into a plurality of sub-images, and determining the target sub-image from the sub-images.
In an embodiment, the original image generation module is further configured to obtain image parameters of the multiple sub-images, respectively, obtain a target image parameter of the image parameters of the multiple sub-images, and use the sub-image corresponding to the target image parameter as the target sub-image.
In an embodiment, the provided two-dimensional code-based screen image acquisition device may further include a threshold value acquisition module, configured to acquire a setting request for a threshold value, where the setting request includes an image identifier; extracting an image identifier in the setting request, and searching an original image corresponding to the image identifier; and acquiring an input threshold value, and corresponding the input threshold value to the original image.
In one embodiment, the original image generation module is further configured to calculate, when the sub-image is a grayscale image, an absolute value of a deviation between an average grayscale of the sub-image and each grayscale, and use the absolute value of the deviation as an image parameter of the sub-image; when the sub-image is a color image, calculating the parameter average value of the sub-image, and taking the parameter average value as the image parameter of the sub-image.
In one embodiment, the original image generation module is further configured to, when the sub-image is a grayscale image, obtain a first pixel grayscale value of the sub-image, calculate a deviation absolute value between the first pixel grayscale value and each grayscale, and use the deviation absolute value as an image parameter of the sub-image; when the sub-image is a color image, calculating the maximum value of the parameter of the sub-image, and taking the maximum value of the parameter as the image parameter of the sub-image.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 4. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external computer device through a network connection. The computer program is executed by a processor to realize a two-dimensional code-based screen image acquisition method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring an original image, wherein the original image comprises a two-dimensional code area and an original area;
identifying a two-dimensional code area in an original image, extracting compressed information in the two-dimensional code area, and extracting image information in the original area; the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value; the first position coordinate is used for representing the position of the original image, and the second position coordinate is used for representing the position of the two-dimensional code area;
generating a target sub-image according to the compression information, and replacing the two-dimensional code area from the original image by using the target sub-image to generate a replacement image;
and carrying out registration processing on the replacement image according to the image information to obtain a target image.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring a target image, and decomposing the target image into a plurality of sub-images; respectively calculating image parameters of the sub-images, and determining a target sub-image from the sub-images according to the image parameters; and acquiring image information in the target sub-image, generating a two-dimensional code area according to the image information, and replacing the target sub-image with the target image by using the two-dimensional code area to generate an original image.
In one embodiment, the processor, when executing the computer program, further performs the steps of: respectively comparing the threshold value with the image parameters of the plurality of sub-images to obtain a comparison result; when the comparison result is that the threshold value is larger than or equal to the image parameter of the sub-image, taking the sub-image corresponding to the image parameter of the sub-image as a target sub-image; and when the comparison result is that the threshold value is smaller than the image parameter of the sub-image, decomposing the sub-image into a plurality of sub-images, and determining the target sub-image from the sub-images.
In one embodiment, the processor, when executing the computer program, further performs the steps of: and respectively acquiring the image parameters of the plurality of sub-images, acquiring target image parameters in the image parameters of the plurality of sub-images, and taking the sub-images corresponding to the target image parameters as target sub-images.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring a setting request of a threshold value, wherein the setting request comprises an image identifier; extracting an image identifier in the setting request, and searching an original image corresponding to the image identifier; and acquiring an input threshold value, and corresponding the input threshold value to the original image.
In one embodiment, the processor, when executing the computer program, further performs the steps of: when the sub-image is a gray image, calculating the deviation absolute value of the average gray of the sub-image and each gray, and taking the deviation absolute value as the image parameter of the sub-image; when the sub-image is a color image, calculating the parameter average value of the sub-image, and taking the parameter average value as the image parameter of the sub-image.
In one embodiment, the processor, when executing the computer program, further performs the steps of: when the sub-image is a gray image, acquiring a first pixel gray value of the sub-image, calculating a deviation absolute value of the first pixel gray value and each gray value, and taking the deviation absolute value as an image parameter of the sub-image; when the sub-image is a color image, calculating the maximum value of the parameter of the sub-image, and taking the maximum value of the parameter as the image parameter of the sub-image.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring an original image, wherein the original image comprises a two-dimensional code area and an original area;
identifying a two-dimensional code area in an original image, extracting compressed information in the two-dimensional code area, and extracting image information in the original area; the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value; the first position coordinate is used for representing the position of the original image, and the second position coordinate is used for representing the position of the two-dimensional code area;
generating a target sub-image according to the compression information, and replacing the two-dimensional code area from the original image by using the target sub-image to generate a replacement image;
and carrying out registration processing on the replacement image according to the image information to obtain a target image.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a target image, and decomposing the target image into a plurality of sub-images; respectively calculating image parameters of the sub-images, and determining a target sub-image from the sub-images according to the image parameters; and acquiring image information in the target sub-image, generating a two-dimensional code area according to the image information, and replacing the target sub-image with the target image by using the two-dimensional code area to generate an original image.
In one embodiment, the computer program when executed by the processor further performs the steps of: respectively comparing the threshold value with the image parameters of the plurality of sub-images to obtain a comparison result; when the comparison result is that the threshold value is larger than or equal to the image parameter of the sub-image, taking the sub-image corresponding to the image parameter of the sub-image as a target sub-image; and when the comparison result is that the threshold value is smaller than the image parameter of the sub-image, decomposing the sub-image into a plurality of sub-images, and determining the target sub-image from the sub-images.
In one embodiment, the computer program when executed by the processor further performs the steps of: and respectively acquiring the image parameters of the plurality of sub-images, acquiring target image parameters in the image parameters of the plurality of sub-images, and taking the sub-images corresponding to the target image parameters as target sub-images.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a setting request of a threshold value, wherein the setting request comprises an image identifier; extracting an image identifier in the setting request, and searching an original image corresponding to the image identifier; and acquiring an input threshold value, and corresponding the input threshold value to the original image.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the sub-image is a gray image, calculating the deviation absolute value of the average gray of the sub-image and each gray, and taking the deviation absolute value as the image parameter of the sub-image; when the sub-image is a color image, calculating the parameter average value of the sub-image, and taking the parameter average value as the image parameter of the sub-image.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the sub-image is a gray image, acquiring a first pixel gray value of the sub-image, calculating a deviation absolute value of the first pixel gray value and each gray value, and taking the deviation absolute value as an image parameter of the sub-image; when the sub-image is a color image, calculating the maximum value of the parameter of the sub-image, and taking the maximum value of the parameter as the image parameter of the sub-image.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. A screen image acquisition method based on two-dimensional codes is characterized by comprising the following steps:
acquiring an original image, wherein the original image comprises a two-dimensional code area and an original area;
identifying the two-dimension code area in the original image, extracting compressed information in the two-dimension code area, and extracting image information in the original area; the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value; the first position coordinate is used for representing the position of the original image, and the second position coordinate is used for representing the position of the two-dimensional code area;
generating a target sub-image according to the compression information, and replacing the two-dimensional code area from the original image by using the target sub-image to generate a replacement image;
and carrying out registration processing on the replacement image according to the image information to obtain a target image.
2. The two-dimensional code based screen image collecting method according to claim 1, wherein before the obtaining of the original image, the original image including the two-dimensional code area and the original area, the method further comprises:
acquiring a target image, and decomposing the target image into a plurality of sub-images;
respectively calculating image parameters of the sub-images, and determining the target sub-image from the sub-images according to the image parameters;
and acquiring image information in the target sub-image, generating a two-dimensional code area according to the image information, and replacing the target sub-image from the target image by using the two-dimensional code area to generate an original image.
3. The method for acquiring the screen image based on the two-dimensional code according to claim 2, wherein the determining the target sub-image from the sub-image according to the threshold value and the image parameter comprises:
comparing the threshold value with the image parameters of the plurality of sub-images respectively to obtain a comparison result;
when the comparison result is that the threshold value is larger than or equal to the image parameter of the sub-image, taking the sub-image corresponding to the image parameter of the sub-image as the target sub-image;
and when the comparison result is that the threshold value is smaller than the image parameter of the sub-image, decomposing the sub-image into a plurality of sub-images, and determining the target sub-image from the sub-images.
4. The two-dimensional code based screen image collecting method of claim 3, wherein the determining the target sub-image from the secondary sub-image comprises:
and respectively acquiring the image parameters of the plurality of sub-images, acquiring a target image parameter in the image parameters of the plurality of sub-images, and taking the sub-image corresponding to the target image parameter as the target sub-image.
5. The two-dimensional code based screen image collecting method according to claim 2, wherein before the searching for the threshold value, the method further comprises:
acquiring a setting request of a threshold value, wherein the setting request comprises an image identifier;
extracting an image identifier in the setting request, and searching an original image corresponding to the image identifier;
and acquiring an input threshold value, and corresponding the input threshold value to the original image.
6. The two-dimensional code-based screen image acquisition method according to claim 2, wherein the calculating of the image parameters of the sub-images comprises:
when the sub-image is a gray image, calculating the deviation absolute value of the average gray of the sub-image and each gray, and taking the deviation absolute value as the image parameter of the sub-image;
and when the sub-image is a color image, calculating the parameter average value of the sub-image, and taking the parameter average value as the image parameter of the sub-image.
7. The two-dimensional code-based screen image acquisition method according to claim 6, wherein the calculating of the image parameters of the sub-images further comprises:
when the sub-image is a gray image, acquiring a first pixel gray value of the sub-image, calculating a deviation absolute value of the first pixel gray value and each gray value, and taking the deviation absolute value as an image parameter of the sub-image;
and when the sub-image is a color image, calculating the maximum value of the parameter of the sub-image, and taking the maximum value of the parameter as the image parameter of the sub-image.
8. The utility model provides a screen image collection system based on two-dimensional code which characterized in that, the device includes:
the image acquisition module is used for acquiring an original image, and the original image comprises a two-dimensional code area and an original area;
the area identification module is used for identifying the two-dimensional code area in the original image, extracting compressed information in the two-dimensional code area and extracting image information in the original area; the image information comprises a pixel mean value, a first position coordinate, a second position coordinate, a compression parameter and a threshold value; the first position coordinate is used for representing the position of the original image, and the second position coordinate is used for representing the position of the two-dimensional code area;
the replacing image generating module is used for generating a target sub-image according to the compression information, replacing the two-dimensional code area from the original image by using the target sub-image and generating a replacing image;
and the target image generation module is used for carrying out registration processing on the replacement image according to the image information to obtain a target image.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911414062.6A CN111161328B (en) | 2019-12-31 | 2019-12-31 | Screen image acquisition method based on two-dimensional code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911414062.6A CN111161328B (en) | 2019-12-31 | 2019-12-31 | Screen image acquisition method based on two-dimensional code |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111161328A true CN111161328A (en) | 2020-05-15 |
CN111161328B CN111161328B (en) | 2023-02-24 |
Family
ID=70560162
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911414062.6A Active CN111161328B (en) | 2019-12-31 | 2019-12-31 | Screen image acquisition method based on two-dimensional code |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111161328B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018040948A1 (en) * | 2016-08-30 | 2018-03-08 | 阿里巴巴集团控股有限公司 | Digital object unique identifier (doi) recognition method and device |
CN109753838A (en) * | 2018-12-12 | 2019-05-14 | 深圳市三宝创新智能有限公司 | Two-dimensional code identification method, device, computer equipment and storage medium |
US20190236423A1 (en) * | 2018-02-01 | 2019-08-01 | ENN Science and Technology Development Co., Ltd | Two-dimensional code processing method and apparatus |
-
2019
- 2019-12-31 CN CN201911414062.6A patent/CN111161328B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018040948A1 (en) * | 2016-08-30 | 2018-03-08 | 阿里巴巴集团控股有限公司 | Digital object unique identifier (doi) recognition method and device |
US20190236423A1 (en) * | 2018-02-01 | 2019-08-01 | ENN Science and Technology Development Co., Ltd | Two-dimensional code processing method and apparatus |
CN109753838A (en) * | 2018-12-12 | 2019-05-14 | 深圳市三宝创新智能有限公司 | Two-dimensional code identification method, device, computer equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
郑喜凤等: "一种基于区域最大值的LED显示屏亮度特征数据提取方法", 《液晶与显示》 * |
Also Published As
Publication number | Publication date |
---|---|
CN111161328B (en) | 2023-02-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110427852B (en) | Character recognition method and device, computer equipment and storage medium | |
CN109886077B (en) | Image recognition method and device, computer equipment and storage medium | |
CN113239874B (en) | Behavior gesture detection method, device, equipment and medium based on video image | |
CN110020582B (en) | Face emotion recognition method, device, equipment and medium based on deep learning | |
CN111079841A (en) | Training method and device for target recognition, computer equipment and storage medium | |
WO2020258491A1 (en) | Universal character recognition method, apparatus, computer device, and storage medium | |
CN110378230B (en) | Missing face recognition method, device, computer equipment and storage medium | |
CN111898411B (en) | Text image labeling system, method, computer device and storage medium | |
CN110046577B (en) | Pedestrian attribute prediction method, device, computer equipment and storage medium | |
CN110688950B (en) | Face living body detection method and device based on depth information | |
CN111797834B (en) | Text recognition method and device, computer equipment and storage medium | |
CN110163864B (en) | Image segmentation method and device, computer equipment and storage medium | |
CN113469092B (en) | Character recognition model generation method, device, computer equipment and storage medium | |
CN110390254B (en) | Character analysis method and device based on human face, computer equipment and storage medium | |
CN110222752B (en) | Image processing method, system, computer device, storage medium and chip | |
CN115240203A (en) | Service data processing method, device, equipment and storage medium | |
CN115035580A (en) | Figure digital twinning construction method and system | |
CN111353429A (en) | Interest degree method and system based on eyeball turning | |
CN110956195A (en) | Image matching method and device, computer equipment and storage medium | |
JP5930450B2 (en) | Annotation device and annotation system | |
CN111161328B (en) | Screen image acquisition method based on two-dimensional code | |
CN111105447B (en) | Screen image transmission method based on local processing | |
CN108876713B (en) | Mapping method and device of two-dimensional template image, terminal equipment and storage medium | |
CN115424001A (en) | Scene similarity estimation method and device, computer equipment and storage medium | |
CN113421182B (en) | Three-dimensional reconstruction method, three-dimensional reconstruction device, electronic equipment and storage medium |
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 |