CN117041443B - Offline photo processing method, device and storage medium - Google Patents
Offline photo processing method, device and storage medium Download PDFInfo
- Publication number
- CN117041443B CN117041443B CN202311296268.XA CN202311296268A CN117041443B CN 117041443 B CN117041443 B CN 117041443B CN 202311296268 A CN202311296268 A CN 202311296268A CN 117041443 B CN117041443 B CN 117041443B
- Authority
- CN
- China
- Prior art keywords
- image
- detected
- clipping
- resolution
- equal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/32—Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device
- H04N1/32101—Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title
- H04N1/32144—Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title embedded in the image data, i.e. enclosed or integrated in the image, e.g. watermark, super-imposed logo or stamp
- H04N1/32149—Methods relating to embedding, encoding, decoding, detection or retrieval operations
- H04N1/32267—Methods relating to embedding, encoding, decoding, detection or retrieval operations combined with processing of the image
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
- G06V40/172—Classification, e.g. identification
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/12—Applying verification of the received information
- H04L63/126—Applying verification of the received information the source of the received data
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20112—Image segmentation details
- G06T2207/20132—Image cropping
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30168—Image quality inspection
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30196—Human being; Person
- G06T2207/30201—Face
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Oral & Maxillofacial Surgery (AREA)
- Human Computer Interaction (AREA)
- Computer Networks & Wireless Communication (AREA)
- General Engineering & Computer Science (AREA)
- Computing Systems (AREA)
- Quality & Reliability (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
The application discloses a method, a device and a storage medium for offline photo processing. The method is applied to an offline photo processing system, wherein the offline photo processing system is used for providing a target image meeting requirements for an online registration system. The method comprises the following steps: checking the resolution of the image to be detected; detecting a face region of an image to be detected; calculating a cutting area; checking the resolution of the clipping region; cutting out the cutting area to generate a cutting image; checking the quality of the cropping image; signing the clipping image; and generating a target image and uploading the target image to an online registration system. Therefore, the technical effects of reducing the workload of the network reporting system and reducing network congestion can be achieved.
Description
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method, an apparatus, and a storage medium for offline photo processing.
Background
Along with the continuous development of information technology, examination registration has gradually realized the transition from a field registration mode to an online registration mode, and various information of examinees is stored in a digital form. In examination information related to the examinee, the photograph of the examinee is important. The photos of the examinees can be used for making examination questions and seat lists, and can be convenient for subsequent examinees to judge whether the examinees take the examination, so that cheating of the examinees is prevented.
However, since the online registration system does not perform strict inspection and limitation on photos of the examinee in the early stage, the photos of the examinee often have different formats and different sizes, and may even have embedded backdoor programs.
Although the online image clipping function is provided by part of the online registration system aiming at the problems of different format quality and/or different size of photos of the examinees, the online registration system is often concentrated in the same time period when the examinees register, so that network congestion is easily caused by processing the photos in an online mode during the peak period when the examinees access the online registration system, the development of examination business is influenced, and the experience of the examinees is also influenced.
The publication number is CN116665224A, and the name is a certificate information extraction method and device based on OCR technology. The system comprises a photographing module, an identification module, an extraction module, a searching module, a personnel information updating module and a newly added personnel information module; the photographing module is used for sending photographing names at fixed time to photograph pictures, storing the photographed pictures in the device and uploading the photographed pictures to the identification module; the identification module identifies the photo shot by the shooting module through ocr and sends the photo to the extraction module for processing; the extraction module is used for judging whether the identity card or the lawyer card is an identity card or a lawyer card and extracting key information of the corresponding certificate; the searching module is used for judging searching information by receiving the data transmitted by the extracting module, and the newly added module is used for inserting and storing the data transmitted by the searching module.
The publication number is CN101359989A, and the name is a method, a device and a mobile communication terminal for generating a safe digital photo. Comprising the following steps: the digital signature generated in the above step may be added to the photo file or may be provided to the user separately. When the user challenges the photograph authenticity representation, the digital signature can be decrypted by using the key provided by the photograph author to obtain a digital digest, the digital digest is recalculated on the photograph file, and the two digital digests are compared, if the two digital digests are consistent, the photograph can be determined to be unmodified, otherwise, the photograph can be inferred to be modified (equivalent to the digital signature algorithm of the photograph).
Aiming at the problems of different format quality and/or different size of photos of the examinees in the prior art, the part of online registration system also provides an online image cutting function, but at the peak time of the examinees accessing the online registration system, the online processing of the photos is extremely easy to cause network congestion, so that the examination is influenced, and the experience of the examinees is influenced.
Disclosure of Invention
The embodiment of the disclosure provides a method, a device and a storage medium for processing offline photos, which at least solve the technical problems that in the prior art, although format quality and/or size of photos of examinees are different, part of online registration systems also provide an online image cutting function, network congestion is easily caused by using an online photo processing mode in peak period of the access of the examinees to the online registration systems, so that the examination is influenced, and experience of the examinees is also influenced.
According to one aspect of an embodiment of the present disclosure, there is provided a method of offline photo processing, including: 1) Firstly, checking the resolution (wo, ho) of an image to be detected, wherein the resolution of a target image is (wr, hr), if wo > wr and ho > hr, entering the next step, otherwise displaying an error prompt that the resolution of the image to be detected does not meet the requirement, and ending the process, wherein wo represents the width of the image to be detected, ho represents the height of the image to be detected, wr represents the width of the target image, and hr represents the height of the target image;
2) Converting the image to be detected into a gray image, calling Opencv or facenet to perform face detection on the image to be detected, entering the next step if a face area is detected, otherwise displaying an error prompt that the face detection of the image to be detected does not meet the requirement, and ending the process;
3) Calculating a clipping region (xt, yt, wt, ht) according to the detected face region (x, y, w, h), wherein (x, y, w, h) represents a rectangular position of the face region in the image to be detected, w represents a width of the face region, h represents a height of the face region, (x, y) represents a starting coordinate point of the face region in the image to be detected, and wherein (xt, yt, wt, ht) represents a rectangular position of the clipping region in the image to be detected, wt represents a width of the clipping region, ht represents a height of the clipping region, and (xt, yt) represents a starting coordinate point of the clipping region in the image to be detected, and the calculation formula is as follows:
wt = w / 0.618;
ht = wt×hr / wr;
xt = x - (wt - w) / 2;
yt = (y + h / 2) - ht / 2 ;
4) The clipping region is checked for resolution, and the specific judgment mode is as follows:
wr is less than or equal to wt is less than or equal to wo and hr is less than or equal to ht is less than or equal to ho;
xt is greater than or equal to 0 and yt is greater than or equal to 0;
xt+wt is less than or equal to wo and yt+ht is less than or equal to ho;
if the resolution of the clipping region passes the check, entering the next step, otherwise, displaying an error prompt that the resolution of the clipping region does not meet the requirement, and ending the process;
5) Intercepting an image to be detected according to a clipping region, generating a clipping image, and reducing the resolution of the clipping image to the resolution of a target image;
6) The quality inspection of the cut image is mainly divided into the following two aspects:
6.1 Background color check for cropped image): 1/8 sampling is carried out on the data of the cutting image, a cutting sampling image is generated, threshold binarization is carried out on the background color of the cutting sampling image according to the preset requirement, if n-type distribution is adopted, the background color of the cutting image is judged to meet the requirement, otherwise, an error prompt that the background color of the cutting image does not meet the requirement is displayed, and the process is ended;
6.2 Checking the sharpness of the cropped image): extracting a gradient value in the horizontal direction and a gradient value in the vertical direction of the cut image by using a Sobel operator, judging that the definition of the cut image meets the requirement if the gradient value in the horizontal direction and the gradient value in the vertical direction exceed a preset threshold, otherwise, displaying an error prompt that the definition of the cut image does not meet the requirement, and ending the process;
7) Signing the cropped image: temporarily storing the cut image into a jpeg format data block, adding salt data at the tail part of the data block, calculating a first MD5 abstract value through an MD5 algorithm, and generating a jpeg format target image added with remark data blocks; and
8) And storing the signed cut image as a target image in a jpeg format, uploading the target image to an online registration system by an examinee, removing remark data blocks in the target image after the online registration system receives the target image uploaded by the examinee, adding the same salified data at the tail parts of the data blocks, calculating by adopting an MD5 algorithm to obtain a second MD5 abstract value, acquiring a first MD5 abstract value of the remark data blocks, and comparing the second MD5 abstract value with the first MD5 abstract value, if the second MD5 abstract value is equal to the first MD5 abstract value, judging that the target image uploaded by the examinee is generated by the method.
According to another aspect of the embodiments of the present disclosure, there is also provided a storage medium including a stored program, wherein the method of any one of the above is performed by a processor when the program is run.
According to another aspect of the embodiments of the present disclosure, there is also provided an apparatus for offline photo-processing, including: a first resolution checking module, configured to check a resolution (wo, ho) of an image to be detected, where the target image resolution is (wr, hr), and if wo > wr and ho > hr, then go to the next step, otherwise display an error prompt that the resolution of the image to be detected is not satisfactory, and end the process, where wo represents a width of the image to be detected, ho represents a height of the image to be detected, wr represents a width of the target image, and hr represents a height of the target image;
The face detection module is used for converting the image to be detected into a gray image, calling Opencv or facenet to carry out face detection on the image to be detected, entering the next step if the face area is detected, otherwise displaying an error prompt that the face detection of the image to be detected does not meet the requirement, and ending the process;
the clipping region calculating module is configured to calculate a clipping region (xt, yt, wt, ht) according to the detected face region (x, y, w, h), where (x, y, w, h) represents a rectangular position of the face region in the image to be detected, w represents a width of the face region, h represents a height of the face region, (x, y) represents a starting coordinate point of the face region in the image to be detected, and where (xt, yt, wt, ht) represents a rectangular position of the clipping region in the image to be detected, wt represents a width of the clipping region, ht represents a height of the clipping region, and (xt, yt) represents a starting coordinate point of the clipping region in the image to be detected, and the calculating formula is as follows:
wt = w / 0.618;
ht = wt×hr / wr;
xt = x - (wt- w) / 2;
yt = (y + h / 2) - ht / 2;
the second resolution checking module is used for checking the resolution of the cutting area, and the specific judging mode is as follows:
wr is less than or equal to wt is less than or equal to wo and hr is less than or equal to ht is less than or equal to ho;
xt is greater than or equal to 0 and yt is greater than or equal to 0;
xt+wt is less than or equal to wo and yt+ht is less than or equal to ho;
if the resolution of the clipping region passes the check, entering the next step, otherwise, displaying an error prompt that the resolution of the clipping region does not meet the requirement, and ending the process;
the cutting image generation module is used for cutting out the image to be detected according to the cutting area, generating a cutting image, and reducing the resolution of the cutting image to the resolution of the target image;
the quality inspection module is used for performing quality inspection of the cut image, wherein the quality inspection module comprises: the background color checking module is used for 1/8 sampling the data of the cut image to generate a cut sample image, and carrying out threshold binarization on the background color of the cut sample image according to the preset requirement, if the cut sample image is in n-type distribution, judging that the background color of the cut image meets the requirement, otherwise, displaying an error prompt that the background color of the cut image does not meet the requirement, and ending the process;
the definition checking module is used for extracting a gradient value in the horizontal direction and a gradient value in the vertical direction of the cut image by using a Sobel operator, judging that the definition of the cut image meets the requirement if the gradient value in the horizontal direction and the gradient value in the vertical direction exceed a preset threshold, otherwise, displaying an error prompt that the definition of the cut image does not meet the requirement, and ending the process;
The signature module is used for temporarily storing the cut image into a jpeg format data block, adding salt data at the tail part of the data block, calculating a first MD5 abstract value through an MD5 algorithm, and generating a jpeg format target image added with remark data blocks; and
the judging module is used for saving the signed cut image as a target image in jpeg format and uploading the target image to the registration system by an examinee, after the registration system receives the target image uploaded by the examinee, firstly removing remark data blocks in the target image, then adding the same salted data at the tail parts of the data blocks, calculating by adopting an MD5 algorithm to obtain a second MD5 abstract value, obtaining a first MD5 abstract value of the remark data blocks, comparing the first MD5 abstract value with the first MD5 abstract value, and if the first MD5 abstract value is equal, judging that the target image uploaded by the examinee is generated by the method.
According to another aspect of the embodiments of the present disclosure, there is also provided an apparatus for offline photo-processing, including: a processor; and a memory, coupled to the processor, for providing instructions to the processor for processing the steps of: 1) Firstly, checking the resolution (wo, ho) of an image to be detected, wherein the resolution of a target image is (wr, hr), if wo > wr and ho > hr, entering the next step, otherwise displaying an error prompt that the resolution of the image to be detected does not meet the requirement, and ending the process, wherein wo represents the width of the image to be detected, ho represents the height of the image to be detected, wr represents the width of the target image, and hr represents the height of the target image;
2) Converting the image to be detected into a gray image, calling Opencv or facenet to perform face detection on the image to be detected, entering the next step if a face area is detected, otherwise displaying an error prompt that the face detection of the image to be detected does not meet the requirement, and ending the process;
3) Calculating a clipping region (xt, yt, wt, ht) according to the detected face region (x, y, w, h), wherein (x, y, w, h) represents a rectangular position of the face region in the image to be detected, w represents a width of the face region, h represents a height of the face region, (x, y) represents a starting coordinate point of the face region in the image to be detected, and wherein (xt, yt, wt, ht) represents a rectangular position of the clipping region in the image to be detected, wt represents a width of the clipping region, ht represents a height of the clipping region, and (xt, yt) represents a starting coordinate point of the clipping region in the image to be detected, and the calculation formula is as follows:
wt = w / 0.618;
ht = wt×hr / wr;
xt = x - (wt- w) / 2;
yt = (y + h / 2) - ht / 2 ;
4) The clipping region is checked for resolution, and the specific judgment mode is as follows:
wr is less than or equal to wt is less than or equal to wo and hr is less than or equal to ht is less than or equal to ho;
xt is greater than or equal to 0 and yt is greater than or equal to 0;
xt+wt is less than or equal to wo and yt+ht is less than or equal to ho;
if the resolution of the clipping region passes the check, entering the next step, otherwise, displaying an error prompt that the resolution of the clipping region does not meet the requirement, and ending the process;
5) Intercepting an image to be detected according to a clipping region, generating a clipping image, and reducing the resolution of the clipping image to the resolution of a target image;
6) The quality inspection of the cut image is mainly divided into the following two aspects:
6.1 Background color check for cropped image): 1/8 sampling is carried out on the data of the cutting image, a cutting sampling image is generated, threshold binarization is carried out on the background color of the cutting sampling image according to the preset requirement, if n-type distribution is adopted, the background color of the cutting image is judged to meet the requirement, otherwise, an error prompt that the background color of the cutting image does not meet the requirement is displayed, and the process is ended;
6.2 Checking the sharpness of the cropped image): extracting a gradient value in the horizontal direction and a gradient value in the vertical direction of the cut image by using a Sobel operator, judging that the definition of the cut image meets the requirement if the gradient value in the horizontal direction and the gradient value in the vertical direction exceed a preset threshold, otherwise, displaying an error prompt that the definition of the cut image does not meet the requirement, and ending the process;
7) Signing the cropped image: temporarily storing the cut image into a jpeg format data block, adding salt data at the tail part of the data block, calculating a first MD5 abstract value through an MD5 algorithm, and generating a jpeg format target image added with remark data blocks; and
8) And storing the signed cut image as a target image in a jpeg format, uploading the target image to an online registration system by an examinee, removing remark data blocks in the target image after the online registration system receives the target image uploaded by the examinee, adding the same salified data at the tail parts of the data blocks, calculating by adopting an MD5 algorithm to obtain a second MD5 abstract value, acquiring a first MD5 abstract value of the remark data blocks, and comparing the second MD5 abstract value with the first MD5 abstract value, if the second MD5 abstract value is equal to the first MD5 abstract value, judging that the target image uploaded by the examinee is generated by the method.
The technical scheme provided by the application is that the resolution detection and the face detection are firstly carried out on the image to be detected (namely, the picture of the examinee), the subsequent processing is carried out on the image to be detected after the detection is passed, and the process is directly ended after the detection is not passed, so that the workload of processing the image to be detected can be greatly reduced, and the efficiency of processing the image to be detected is improved.
Further, the technical scheme provided by the application is that the cutting area is calculated firstly, and then the determined cutting area is subjected to resolution check and quality check, so that the cutting image corresponding to the cutting area meets the requirement of an online registration system.
In addition, in order to further ensure that the target image finally uploaded to the online registration system is consistent with the picture of the examinee, the technical scheme provided by the application further provides a step of signing the cut image, so that the online registration system can judge whether the target image is consistent with the picture of the examinee by judging whether the signature is consistent or not under the condition that the examinee uploads the target image to the online registration system. Further, it is also possible to determine whether the target image is generated by the present method through the above-described operation.
Therefore, the technical scheme disclosed by the application processes the image to be detected, and then uploads the target image corresponding to the image to be detected to the online registration system, so that the technical effects of reducing the workload of the online registration system and reducing network congestion are achieved. The method solves the technical problems that in the prior art, although the format quality of photos of examinees is different and/or the sizes of photos are different, part of online registration systems also provide an online image cutting function, network congestion is easily caused by using an online photo processing mode in the peak period of the examinees accessing the online registration systems, the examination is influenced, and the experience of the examinees is influenced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure, illustrate and explain the present disclosure, and together with the description serve to explain the present disclosure. In the drawings:
FIG. 1 is a block diagram of a hardware architecture of a computing device for implementing a method according to embodiment 1 of the present disclosure;
FIG. 2 is a schematic diagram of an offline photo-processing system according to embodiment 1 of the present disclosure;
FIG. 3 is a flow diagram of a method for offline photo processing according to embodiment 1 of the present disclosure;
FIG. 4 is an overall flowchart of offline photo processing according to embodiment 1 of the present disclosure;
fig. 5 is a schematic view of an image to be detected, a face region of the image to be detected, and a clipping region according to embodiment 1 of the present disclosure;
FIG. 6 is a schematic diagram of an apparatus for offline photo processing according to embodiment 2 of the present disclosure; and
fig. 7 is a schematic diagram of an apparatus for offline photo processing according to embodiment 3 of the present disclosure.
Detailed Description
In order to better understand the technical solutions of the present disclosure, the following description will clearly and completely describe the technical solutions of the embodiments of the present disclosure with reference to the drawings in the embodiments of the present disclosure. It will be apparent that the described embodiments are merely embodiments of a portion, but not all, of the present disclosure. All other embodiments, which can be made by one of ordinary skill in the art without inventive effort, based on the embodiments in this disclosure, shall fall within the scope of the present disclosure.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
According to the present embodiment, there is provided an embodiment of a method of offline photo processing, it being noted that the steps shown in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be performed in an order other than that shown or described herein.
The method embodiments provided by the present embodiments may be performed in a mobile terminal, a computer terminal, a server, or similar computing device. FIG. 1 illustrates a hardware block diagram of a computing device for implementing a method of offline photo-processing. As shown in fig. 1, the computing device may include one or more processors (which may include, but are not limited to, a microprocessor MCU, a processing device such as a programmable logic device FPGA), memory for storing data, transmission means for communication functions, and input/output interfaces. Wherein the memory, the transmission device and the input/output interface are connected with the processor through a bus. In addition, the method may further include: a display connected to the input/output interface, a keyboard, and a cursor control device. It will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 1 is merely illustrative and is not intended to limit the configuration of the electronic device described above. For example, the computing device may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
It should be noted that the one or more processors and/or other data processing circuits described above may be referred to herein generally as "data processing circuits. The data processing circuit may be embodied in whole or in part in software, hardware, firmware, or any other combination. Furthermore, the data processing circuitry may be a single stand-alone processing module, or incorporated in whole or in part into any of the other elements in the computing device. As referred to in the embodiments of the present disclosure, the data processing circuit acts as a processor control (e.g., selection of the variable resistance termination path to interface with).
The memory may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the offline photo-processing method in the embodiments of the present disclosure, and the processor executes the software programs and modules stored in the memory, thereby performing various functional applications and data processing, that is, implementing the offline photo-processing method of the application program. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory. In some examples, the memory may further include memory remotely located with respect to the processor, which may be connected to the computing device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communications provider of the computing device. In one example, the transmission means comprises a network adapter (Network Interface Controller, NIC) connectable to other network devices via the base station to communicate with the internet. In one example, the transmission device may be a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the computing device.
It should be noted herein that in some alternative embodiments, the computing device shown in FIG. 1 described above may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that fig. 1 is only one example of a particular specific example and is intended to illustrate the types of components that may be present in the computing devices described above.
Fig. 2 is a schematic diagram of a system for offline photo-processing according to this embodiment. Referring to fig. 2, the system includes: a terminal device 100 and a processor 200.
The terminal device 100 is configured to transmit the received image to be detected (i.e. the picture of the examinee) uploaded by the examinee to the processor 200.
The processor 200 is configured to perform a resolution check on the received image to be detected to determine whether the resolution of the image to be detected is greater than the resolution of the target image.
The processor 200 is further configured to perform face detection on the image to be detected, and determine whether a face region exists in the image to be detected.
The processor 200 is further configured to perform a calculation of the crop area in accordance with the detected face area.
The processor 200 is further configured to crop the image to be detected according to the computed cropping zone and generate a cropped image.
The processor 200 is further configured for quality checking the cropped image. Wherein the quality inspection includes inspection of background color of the cut image, and inspection of sharpness of the cut image.
The processor 200 is further configured to calculate a first MD5 digest value by an MD5 algorithm to generate a jpeg-formatted target image with the remarked data block added.
The processor 200 is further configured to remove remark data blocks in the target image, calculate a second MD5 digest value of the remark data blocks using an MD5 algorithm, and compare the second MD5 digest value with the first MD5 digest value, thereby determining whether the target image uploaded by the examinee is generated by the method.
In the above-described operating environment, according to a first aspect of the present embodiment, there is provided a method of offline photo-processing, the method being implemented by the processor 200 shown in fig. 2. Fig. 3 shows a schematic flow chart of the method. Fig. 4 is an overall flowchart of offline photo processing according to an embodiment of the present disclosure. As shown with reference to fig. 3 and 4, the method comprises:
S302: checking the resolution of an image to be detected, and judging whether the resolution of the image to be detected is larger than the resolution of a target image, wherein the target image is an image meeting the requirement of an online registration system;
s304: carrying out face detection on the image to be detected, and judging whether a face area exists in the image to be detected;
s306: calculating a cutting area according to the detected face area;
s308: checking the resolution of the clipping region;
s310: intercepting an image to be detected according to a clipping region, generating a clipping image, and reducing the resolution of the clipping image to the resolution of a target image;
s312: performing quality inspection on the cut image;
s314: calculating a first MD5 abstract value through an MD5 algorithm, and generating a target image in a jpeg format added with remark data blocks; and
s316: and calculating a second MD5 digest value by adopting an MD5 algorithm, and comparing the second MD5 digest value with the first MD5 digest value, if the second MD5 digest value is equal to the first MD5 digest value, determining that the target image uploaded by the examinee is generated by the method.
Specifically, first, the processor 200 checks the resolution (wo, ho) of the image to be detected after receiving the image to be detected uploaded by the examinee through the terminal device 100, and determines the magnitude relation between the resolution (wo, ho) of the image to be detected and the resolution (wr, hr) of the target image based on the resolution (wr, hr) of the target image (S302). The target image is an image meeting the requirements of an online registration system. Where wo represents the width of the image to be detected, ho represents the height of the image to be detected, wr represents the width of the target image, and hr represents the height of the target image.
In the case that the resolution (wo, ho) of the image to be detected is greater than the resolution (wr, hr) of the target image, the processor 200 determines that the resolution (wo, ho) of the image to be detected meets the requirement, and proceeds to the next step; in the case where the resolution (wo, ho) of the image to be detected is smaller than the resolution (wr, hr) of the target image, the processor 200 determines that the resolution (wo, ho) of the image to be detected is not satisfactory, and ends the process.
In the case that the processor 200 determines that the resolution (wo, ho) of the image to be detected meets the requirement, the processor 200 further converts the image to be detected into a gray image, and invokes Opencv or facenet to perform face detection on the image to be detected. In the case that the processor 200 detects a face region, then go to the next step; in the case that the processor 200 does not detect the face region, an error prompt that the face detection of the image to be detected is not satisfactory is displayed, and the process is ended.
Further, if the processor 200 detects a face region on the image to be detected, the clipping region (xt, yt, wt, ht) is calculated according to the detected face region (x, y, w, h). The calculation formula is as follows:
wt=w/0.618 (equation 1)
ht=wt×hr/wr (formula 2)
xt=x- (wt-w)/2 (equation 3)
yt= (y+h/2) -ht/2 (equation 4)
Wherein (x, y, w, h) represents a rectangular position of the face region in the image to be detected, w represents a width of the face region, h represents a height of the face region, (x, y) represents a start coordinate point of the face region in the image to be detected, and wherein (xt, yt, wt, ht) represents a rectangular position of the clipping region in the image to be detected, wt represents a width of the clipping region, and ht represents a height of the clipping region, (xt, yt) represents a start coordinate point of the clipping region in the image to be detected.
Fig. 5 is a schematic diagram of an image to be detected, a face region of the image to be detected, and a clipping region according to an embodiment of the present disclosure. Referring to fig. 5, the clipping region has an area larger than that of the face region detected by the processor 200, and includes the face region. Wherein, formula 3 and formula 4 are used to calculate coordinates (xt, yt) of the upper left corner of the clipping region, formula 1 is used to calculate width wt of the clipping region, and formula 2 is used to calculate height ht of the clipping region.
Further, the processor 200 checks the resolution of the calculated clipping region. When wr is less than or equal to wt is less than or equal to wo and hr is less than or equal to ht is less than or equal to ho, xt is more than or equal to 0 and yt is more than or equal to 0, xt+wt is less than or equal to wo and yt+ht is less than or equal to ho, the resolution check of the clipping region is passed, and the next step is performed; otherwise, the processor 200 displays an error prompt that the resolution of the cropped area is not satisfactory and the process ends.
Referring to fig. 5, the coordinates of the lower left corner of the image to be detected are taken as the origin coordinates. Wherein wr is less than or equal to wt is less than or equal to wo and hr is less than or equal to ht is less than or equal to ho, the width of the clipping region is greater than the width of the face region and less than the width of the image to be detected, and the height of the clipping region is greater than the height of the face region and less than the height of the image to be detected. xt.gtoreq.0 and yt.gtoreq.0 represent that the abscissa of the upper left corner of the clipping region is greater than 0 and the ordinate is also greater than 0.xt+wt is less than or equal to wo and yt+ht is less than or equal to ho, and the distance from the right boundary of the clipping region to the left boundary of the image to be detected is less than the width of the image to be detected.
After the resolution check of the clipping region passes, the processor 200 clips the clipping image on the image to be detected in accordance with the clipping region, and reduces the clipping image to the resolution of the target image.
The processor 200 then performs a quality check on the cropped image. Wherein the quality inspection of the cropped image comprises an inspection of the background color of the cropped image and an inspection of the sharpness of the cropped image.
Wherein, the background color inspection of the clipping image comprises: the processor 200 performs 1/8 sampling on the data of the target image to generate a cut sample image, and performs threshold binarization on the background color of the cut sample image according to a preset requirement. That is, the processor 200 generates a clip sample image in such a manner that the color of one pixel is extracted every 8 points in the horizontal and vertical directions. If the distribution is n-type, judging that the background color of the cut image meets the requirement, otherwise, displaying an error prompt that the background color of the cut image does not meet the requirement, and ending the process.
The sharpness inspection of the cropped image includes: the processor 200 extracts the gradient values in the horizontal direction and the gradient values in the vertical direction of the cropped image using the Sobel operator. If the gradient value in the horizontal direction and the gradient value in the vertical direction of the cut image exceed the preset threshold, judging that the definition of the cut image meets the requirements, otherwise, displaying an error prompt that the definition of the cut image does not meet the requirements, and ending the process.
After the background color and sharpness of the cropped image are checked by the processor 200, the cropped image is signed. The specific operation is as follows: temporarily storing the cut image into a data block in jpeg format, and adding salt data at the tail part of the data block. Then, a first MD5 digest value is calculated through an MD5 algorithm, and a target image in jpeg format with remark data blocks added is generated. Note that remark data blocks corresponding to the target image are all different and one-to-one.
Finally, the processor 200 stores the signed cut image as a target image in jpeg format, and uploads the cut image to the online registration system. After receiving a target image uploaded by an examinee, the online registration system firstly removes remark data blocks in the target image, then adds the same salified data at the tail of the data blocks, calculates by adopting an MD5 algorithm to obtain a second MD5 abstract value, and obtains a first MD5 abstract value of the remark data blocks. The processor 200 compares the first MD5 digest with the second MD5 digest, and if the first MD5 digest is equal to the second MD5 digest, then it indicates that the target image uploaded by the examinee is generated by the method.
According to the first aspect of the embodiment, the technical effects of reducing the workload of the online registration system and reducing network congestion are achieved.
Further, referring to fig. 1, according to a second aspect of the present embodiment, there is provided a storage medium. The storage medium includes a stored program, wherein the method of any one of the above is performed by a processor when the program is run.
Therefore, according to the embodiment, the technical effects of reducing the workload of the online registration system and reducing the network congestion are achieved.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present invention. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present invention.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
Example 2
Fig. 6 shows an apparatus 600 for offline photo-processing according to the first aspect of the present embodiment, which apparatus 600 corresponds to the method according to the first aspect of embodiment 1. Referring to fig. 6, the apparatus 600 includes: a first resolution checking module 610, configured to check a resolution (wo, ho) of an image to be detected, where the target image resolution is (wr, hr), and if wo > wr and ho > hr, then go to the next step, otherwise display an error indication that the resolution of the image to be detected is not satisfactory, and end the process, where wo represents a width of the image to be detected, ho represents a height of the image to be detected, wr represents a width of the target image, and hr represents a height of the target image;
The face detection module 620 is configured to convert the image to be detected into a gray image, call Opencv or facenet to perform face detection on the image to be detected, enter the next step if the face area is detected, otherwise display an error prompt that the face detection of the image to be detected does not meet the requirement, and end the process;
the clipping region calculating module 630 is configured to calculate a clipping region (xt, yt, wt, ht) according to the detected face region (x, y, w, h), where (x, y, w, h) represents a rectangular position of the face region in the image to be detected, w represents a width of the face region, h represents a height of the face region, (x, y) represents a starting coordinate point of the face region in the image to be detected, and where (xt, yt, wt, ht) represents a rectangular position of the clipping region in the image to be detected, wt represents a width of the clipping region, ht represents a height of the clipping region, and (xt, yt) represents a starting coordinate point of the clipping region in the image to be detected, and the calculation formula is as follows:
wt = w / 0.618;
ht = wt×hr / wr;
xt = x - (wt - w) / 2;
yt = (y + h / 2) - ht / 2;
the second resolution checking module 640 is configured to check the resolution of the clipping area, and specifically determines the following manner:
wr is less than or equal to wt is less than or equal to wo and hr is less than or equal to ht is less than or equal to ho;
xt is greater than or equal to 0 and yt is greater than or equal to 0;
xt+wt is less than or equal to wo and yt+ht is less than or equal to ho;
if the resolution of the clipping region passes the check, entering the next step, otherwise, displaying an error prompt that the resolution of the clipping region does not meet the requirement, and ending the process;
a clipping image generation module 650, configured to clip an image to be detected according to a clipping region, generate a clipping image, and reduce the resolution of the clipping image to the resolution of the target image;
a quality inspection module 660 for performing quality inspection of the cropped image, wherein the quality inspection module comprises: the background color checking module is used for 1/8 sampling the data of the cut image to generate a cut sample image, and carrying out threshold binarization on the background color of the cut sample image according to the preset requirement, if the cut sample image is in n-type distribution, judging that the background color of the cut image meets the requirement, otherwise, displaying an error prompt that the background color of the cut image does not meet the requirement, and ending the process;
the definition checking module is used for extracting a gradient value in the horizontal direction and a gradient value in the vertical direction of the cut image by using a Sobel operator, judging that the definition of the cut image meets the requirement if the gradient value in the horizontal direction and the gradient value in the vertical direction exceed a preset threshold, otherwise, displaying an error prompt that the definition of the cut image does not meet the requirement, and ending the process;
The signature module 670 is configured to temporarily store the cut image as a jpeg format data block, add salted data at the tail of the data block, calculate a first MD5 digest value according to an MD5 algorithm, and generate a jpeg format target image to which the remark data block is added; and
the determining module 680 is configured to store the signed cut image as a target image in jpeg format, and upload the cut image to the registration system, after the registration system receives the target image uploaded by the examinee, remove a remark data block in the target image first, then add the same salified data at the tail of the data block, calculate by using MD5 algorithm to obtain a second MD5 digest value, obtain a first MD5 digest value of the remark data block, and compare the second MD5 digest value with the first MD5 digest value, if the first MD5 digest value is equal, then determine that the target image uploaded by the examinee is generated by the method.
Therefore, according to the embodiment, the technical effects of reducing the workload of the online registration system and reducing the network congestion are achieved.
Example 3
Fig. 7 shows an apparatus 700 for offline photo-processing according to the first aspect of the present embodiment, which apparatus 700 corresponds to the method according to the first aspect of embodiment 1. Referring to fig. 7, the apparatus 700 includes: a processor 710; and a memory 720 coupled to the processor 710 for providing instructions to the processor 710 for processing the following processing steps: 1) Firstly, checking the resolution (wo, ho) of an image to be detected, wherein the resolution of a target image is (wr, hr), if wo > wr and ho > hr, entering the next step, otherwise displaying an error prompt that the resolution of the image to be detected does not meet the requirement, and ending the process, wherein wo represents the width of the image to be detected, ho represents the height of the image to be detected, wr represents the width of the target image, and hr represents the height of the target image;
2) Converting the image to be detected into a gray image, calling Opencv or facenet to perform face detection on the image to be detected, entering the next step if a face area is detected, otherwise displaying an error prompt that the face detection of the image to be detected does not meet the requirement, and ending the process;
3) Calculating a clipping region (xt, yt, wt, ht) according to the detected face region (x, y, w, h), wherein (x, y, w, h) represents a rectangular position of the face region in the image to be detected, w represents a width of the face region, h represents a height of the face region, (x, y) represents a starting coordinate point of the face region in the image to be detected, and wherein (xt, yt, wt, ht) represents a rectangular position of the clipping region in the image to be detected, wt represents a width of the clipping region, ht represents a height of the clipping region, and (xt, yt) represents a starting coordinate point of the clipping region in the image to be detected, and the calculation formula is as follows:
wt = w / 0.618;
ht = wt×hr / wr;
xt = x - (wt - w) / 2;
yt = (y + h / 2) - ht / 2 ;
4) The clipping region is checked for resolution, and the specific judgment mode is as follows:
wr is less than or equal to wt is less than or equal to wo and hr is less than or equal to ht is less than or equal to ho;
xt is greater than or equal to 0 and yt is greater than or equal to 0;
xt+wt is less than or equal to wo and yt+ht is less than or equal to ho;
if the resolution of the clipping region passes the check, entering the next step, otherwise, displaying an error prompt that the resolution of the clipping region does not meet the requirement, and ending the process;
5) Intercepting an image to be detected according to a clipping region, generating a clipping image, and reducing the resolution of the clipping image to the resolution of a target image;
6) The quality inspection of the cut image is mainly divided into the following two aspects:
6.1 Background color check for cropped image): 1/8 sampling is carried out on the data of the cutting image, a cutting sampling image is generated, threshold binarization is carried out on the background color of the cutting sampling image according to the preset requirement, if n-type distribution is adopted, the background color of the cutting image is judged to meet the requirement, otherwise, an error prompt that the background color of the cutting image does not meet the requirement is displayed, and the process is ended;
6.2 Checking the sharpness of the cropped image): extracting a gradient value in the horizontal direction and a gradient value in the vertical direction of the cut image by using a Sobel operator, judging that the definition of the cut image meets the requirement if the gradient value in the horizontal direction and the gradient value in the vertical direction exceed a preset threshold, otherwise, displaying an error prompt that the definition of the cut image does not meet the requirement, and ending the process;
7) Signing the cropped image: temporarily storing the cut image into a jpeg format data block, adding salt data at the tail part of the data block, calculating a first MD5 abstract value through an MD5 algorithm, and generating a jpeg format target image added with remark data blocks; and
8) And storing the signed cut image as a target image in a jpeg format, uploading the target image to an online registration system by an examinee, removing remark data blocks in the target image after the online registration system receives the target image uploaded by the examinee, adding the same salified data at the tail parts of the data blocks, calculating by adopting an MD5 algorithm to obtain a second MD5 abstract value, acquiring a first MD5 abstract value of the remark data blocks, and comparing the second MD5 abstract value with the first MD5 abstract value, if the second MD5 abstract value is equal to the first MD5 abstract value, judging that the target image uploaded by the examinee is generated by the method.
Therefore, according to the embodiment, the technical effects of reducing the workload of the online registration system and reducing the network congestion are achieved.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.
Claims (4)
1. A method for offline photograph processing, applied to an offline photograph processing system, wherein the offline photograph processing system is used for providing a target image meeting requirements for an online registration system, the method is characterized by comprising the following steps:
1) Firstly checking the resolution (wo, ho) of an image to be detected, wherein the resolution of the target image is (wr, hr), if wo > wr and ho > hr, then entering the next step, otherwise displaying an error prompt that the resolution of the image to be detected is not satisfactory, and ending the process, wherein wo represents the width of the image to be detected, ho represents the height of the image to be detected, wr represents the width of the target image, and hr represents the height of the target image;
2) Converting the image to be detected into a gray image, calling Opencv or facenet to perform face detection on the image to be detected, entering the next step if a face area is detected, otherwise displaying an error prompt that the face detection of the image to be detected does not meet the requirement, and ending the process;
3) Calculating a clipping region (xt, yt, wt, ht) according to a detected face region (x, y, w, h), wherein (x, y, w, h) represents a rectangular position of the face region in the image to be detected, w represents a width of the face region, h represents a height of the face region, (x, y) represents a starting coordinate point of the face region in the image to be detected, and wherein (xt, yt, wt, ht) represents a rectangular position of the clipping region in the image to be detected, wt represents a width of the clipping region, ht represents a height of the clipping region, and (xt, yt) represents a starting coordinate point of the clipping region in the image to be detected, wherein the calculation formula is as follows:
wt = w / 0.618;
ht = wt×hr / wr;
xt = x - (wt - w) / 2;
yt = (y + h / 2) - ht / 2 ;
4) And checking the resolution of the clipping region, wherein the specific judging mode is as follows:
wr is less than or equal to wt is less than or equal to wo and hr is less than or equal to ht is less than or equal to ho;
xt is greater than or equal to 0 and yt is greater than or equal to 0;
xt+wt is less than or equal to wo and yt+ht is less than or equal to ho;
if the resolution of the clipping region passes the check, entering the next step, otherwise, displaying an error prompt that the resolution of the clipping region does not meet the requirement, and ending the process;
5) Intercepting the image to be detected according to the clipping region, generating a clipping image, and reducing the resolution of the clipping image to the resolution of the target image;
6) The quality inspection of the clipping image is mainly divided into the following two aspects:
6.1 Background color check of the cropped image): 1/8 sampling is carried out on the data of the clipping image to generate a clipping sampling image, threshold binarization is carried out on the background color of the clipping sampling image according to the preset requirement, if n-type distribution is adopted, the background color of the clipping image is judged to meet the requirement, otherwise, an error prompt that the background color of the clipping image does not meet the requirement is displayed, and the process is ended;
6.2 Checking the sharpness of the cropped image): extracting a gradient value in the horizontal direction and a gradient value in the vertical direction of the cut image by using a Sobel operator, judging that the definition of the cut image meets the requirement if the gradient value in the horizontal direction and the gradient value in the vertical direction exceed a preset threshold, otherwise, displaying an error prompt that the definition of the cut image does not meet the requirement, and ending the process;
7) Signing the cropped image: temporarily storing the cut image into a jpeg format data block, adding salt data at the tail part of the data block, calculating a first MD5 abstract value through an MD5 algorithm, and generating a jpeg format target image added with remark data blocks; and
8) And storing the signed cut image as a target image in a jpeg format, uploading the target image to the online registration system by a test taker, firstly removing remark data blocks in the target image after the online registration system receives the target image uploaded by the test taker, then adding the same salted data at the tail parts of the data blocks, calculating by adopting an MD5 algorithm to obtain a second MD5 abstract value, acquiring a first MD5 abstract value of the remark data blocks, comparing the second MD5 abstract value with the first MD5 abstract value, and if the second MD5 abstract value is equal to the first MD5 abstract value, judging that the target image uploaded by the test taker is generated by the method.
2. A storage medium comprising a stored program, wherein the method of claim 1 is performed by a processor when the program is run.
3. An apparatus for offline photograph processing, applied to an offline photograph processing system, wherein the offline photograph processing system is configured to provide a target image meeting requirements for an online registration system, comprising:
a first resolution checking module, configured to check a resolution (wo, ho) of an image to be detected, where the target image resolution is (wr, hr), and if wo > wr and ho > hr, then go to the next step, otherwise display an error indication that the resolution of the image to be detected is not satisfactory, and end the process, where wo represents a width of the image to be detected, ho represents a height of the image to be detected, wr represents a width of the target image, and hr represents a height of the target image;
The face detection module is used for converting the image to be detected into a gray image, calling Opencv or facenet to carry out face detection on the image to be detected, entering the next step if a face area is detected, otherwise displaying an error prompt that the face detection of the image to be detected does not meet the requirement, and ending the process;
a clipping region calculating module, configured to calculate a clipping region (xt, yt, wt, ht) according to a detected face region (x, y, w, h), where (x, y, w, h) represents a rectangular position of the face region in the image to be detected, w represents a width of the face region, h represents a height of the face region, (x, y) represents a starting coordinate point of the face region in the image to be detected, and where (xt, yt, wt, ht) represents a rectangular position of the clipping region in the image to be detected, wt represents a width of the clipping region, ht represents a height of the clipping region, and (xt, yt) represents a starting coordinate point of the clipping region in the image to be detected, with a calculation formula as follows:
wt = w / 0.618;
ht = wt×hr / wr;
xt = x - (wt - w) / 2;
yt = (y + h / 2) - ht / 2;
the second resolution checking module is used for checking the resolution of the cutting area, and the specific judging mode is as follows:
wr is less than or equal to wt is less than or equal to wo and hr is less than or equal to ht is less than or equal to ho;
xt is greater than or equal to 0 and yt is greater than or equal to 0;
xt+wt is less than or equal to wo and yt+ht is less than or equal to ho;
if the resolution of the clipping region passes the check, entering the next step, otherwise, displaying an error prompt that the resolution of the clipping region does not meet the requirement, and ending the process;
the clipping image generation module is used for clipping the image to be detected according to the clipping region, generating a clipping image, and reducing the resolution of the clipping image to the resolution of the target image;
a quality inspection module for performing quality inspection of the cropped image, wherein the quality inspection module comprises: the background color checking module is used for 1/8 sampling the data of the clipping image to generate a clipping sampling image, performing threshold binarization on the background color of the clipping sampling image according to preset requirements, judging that the background color of the clipping image meets the requirements if the clipping image is in n-type distribution, otherwise, displaying an error prompt that the background color of the clipping image does not meet the requirements, and ending the process;
the definition checking module is used for extracting a gradient value in the horizontal direction and a gradient value in the vertical direction of the cut image by using a Sobel operator, judging that the definition of the cut image meets the requirement if the gradient value in the horizontal direction and the gradient value in the vertical direction exceed a preset threshold, otherwise, displaying an error prompt that the definition of the cut image does not meet the requirement, and ending the process;
The signature module is used for temporarily storing the cut image into a data block in a jpeg format, adding salt data at the tail part of the data block, calculating a first MD5 abstract value through an MD5 algorithm, and generating a target image in the jpeg format with remark data blocks added; and
the judging module is used for saving the signed cut image as a target image in jpeg format and uploading the target image to the registration system by an examinee, after the registration system receives the target image uploaded by the examinee, firstly removing remark data blocks in the target image, then adding the same salted data at the tail parts of the data blocks, calculating by adopting an MD5 algorithm to obtain a second MD5 abstract value, acquiring a first MD5 abstract value of the remark data blocks, comparing the second MD5 abstract value with the first MD5 abstract value, and if the second MD5 abstract value is equal to the first MD5 abstract value, judging that the target image uploaded by the examinee is generated by the method.
4. An apparatus for offline photograph processing, applied to an offline photograph processing system, wherein the offline photograph processing system is configured to provide a target image meeting requirements for an online registration system, comprising:
a processor; and
a memory, coupled to the processor, for providing instructions to the processor to process the following processing steps:
1) Firstly checking the resolution (wo, ho) of an image to be detected, wherein the resolution of a target image is (wr, hr), if wo > wr and ho > hr, entering the next step, otherwise displaying an error prompt that the resolution of the image to be detected does not meet the requirement, and ending the process, wherein wo represents the width of the image to be detected, ho represents the height of the image to be detected, wr represents the width of the target image, and hr represents the height of the target image;
2) Converting the image to be detected into a gray image, calling Opencv or facenet to perform face detection on the image to be detected, entering the next step if a face area is detected, otherwise displaying an error prompt that the face detection of the image to be detected does not meet the requirement, and ending the process;
3) Calculating a clipping region (xt, yt, wt, ht) according to a detected face region (x, y, w, h), wherein (x, y, w, h) represents a rectangular position of the face region in the image to be detected, w represents a width of the face region, h represents a height of the face region, (x, y) represents a starting coordinate point of the face region in the image to be detected, and wherein (xt, yt, wt, ht) represents a rectangular position of the clipping region in the image to be detected, wt represents a width of the clipping region, ht represents a height of the clipping region, and (xt, yt) represents a starting coordinate point of the clipping region in the image to be detected, wherein the calculation formula is as follows:
wt = w / 0.618;
ht = wt×hr / wr;
xt = x - (wt - w) / 2;
yt = (y + h / 2) - ht / 2 ;
4) And checking the resolution of the clipping region, wherein the specific judging mode is as follows:
wr is less than or equal to wt is less than or equal to wo and hr is less than or equal to ht is less than or equal to ho;
xt is greater than or equal to 0 and yt is greater than or equal to 0;
xt+wt is less than or equal to wo and yt+ht is less than or equal to ho;
if the resolution of the clipping region passes the check, entering the next step, otherwise, displaying an error prompt that the resolution of the clipping region does not meet the requirement, and ending the process;
5) Intercepting the image to be detected according to the clipping region, generating a clipping image, and reducing the resolution of the clipping image to the resolution of the target image;
6) The quality inspection of the clipping image is mainly divided into the following two aspects:
6.1 Background color check of the cropped image): 1/8 sampling is carried out on the data of the clipping image to generate a clipping sampling image, threshold binarization is carried out on the background color of the clipping sampling image according to the preset requirement, if n-type distribution is adopted, the background color of the clipping image is judged to meet the requirement, otherwise, an error prompt that the background color of the clipping image does not meet the requirement is displayed, and the process is ended;
6.2 Checking the sharpness of the cropped image): extracting a gradient value in the horizontal direction and a gradient value in the vertical direction of the cut image by using a Sobel operator, judging that the definition of the cut image meets the requirement if the gradient value in the horizontal direction and the gradient value in the vertical direction exceed a preset threshold, otherwise, displaying an error prompt that the definition of the cut image does not meet the requirement, and ending the process;
7) Signing the cropped image: temporarily storing the cut image into a jpeg format data block, adding salt data at the tail part of the data block, calculating a first MD5 abstract value through an MD5 algorithm, and generating a jpeg format target image added with remark data blocks; and
8) And storing the signed cut image as a target image in a jpeg format, uploading the target image to the online registration system by a test taker, firstly removing remark data blocks in the target image after the online registration system receives the target image uploaded by the test taker, then adding the same salted data at the tail parts of the data blocks, calculating by adopting an MD5 algorithm to obtain a second MD5 abstract value, acquiring a first MD5 abstract value of the remark data blocks, comparing the second MD5 abstract value with the first MD5 abstract value, and if the second MD5 abstract value is equal to the first MD5 abstract value, judging that the target image uploaded by the test taker is generated by the method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311296268.XA CN117041443B (en) | 2023-10-09 | 2023-10-09 | Offline photo processing method, device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311296268.XA CN117041443B (en) | 2023-10-09 | 2023-10-09 | Offline photo processing method, device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117041443A CN117041443A (en) | 2023-11-10 |
CN117041443B true CN117041443B (en) | 2023-12-08 |
Family
ID=88632249
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311296268.XA Active CN117041443B (en) | 2023-10-09 | 2023-10-09 | Offline photo processing method, device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117041443B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1708093A (en) * | 2005-05-12 | 2005-12-14 | 北京中星微电子有限公司 | Self-taking portrait photo taking method and equipment |
CN105120167A (en) * | 2015-08-31 | 2015-12-02 | 广州市幸福网络技术有限公司 | Certificate picture camera and certificate picture photographing method |
CN111859369A (en) * | 2020-07-29 | 2020-10-30 | 浪潮云信息技术股份公司 | System and method for automatic unified management of passwords |
CN113556471A (en) * | 2021-09-18 | 2021-10-26 | 广州卓腾科技有限公司 | Certificate photo generation method, system and computer readable storage medium |
CN116704579A (en) * | 2023-06-08 | 2023-09-05 | 西安交通大学 | Student welcome new photo analysis system and method based on image processing |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9369625B2 (en) * | 2014-08-12 | 2016-06-14 | Kodak Alaris Inc. | System for producing compliant facial images for selected identification documents |
-
2023
- 2023-10-09 CN CN202311296268.XA patent/CN117041443B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1708093A (en) * | 2005-05-12 | 2005-12-14 | 北京中星微电子有限公司 | Self-taking portrait photo taking method and equipment |
CN105120167A (en) * | 2015-08-31 | 2015-12-02 | 广州市幸福网络技术有限公司 | Certificate picture camera and certificate picture photographing method |
CN111859369A (en) * | 2020-07-29 | 2020-10-30 | 浪潮云信息技术股份公司 | System and method for automatic unified management of passwords |
CN113556471A (en) * | 2021-09-18 | 2021-10-26 | 广州卓腾科技有限公司 | Certificate photo generation method, system and computer readable storage medium |
CN116704579A (en) * | 2023-06-08 | 2023-09-05 | 西安交通大学 | Student welcome new photo analysis system and method based on image processing |
Also Published As
Publication number | Publication date |
---|---|
CN117041443A (en) | 2023-11-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101773885B1 (en) | A method and server for providing augmented reality objects using image authentication | |
CN108337505B (en) | Information acquisition method and device | |
EP3627440B1 (en) | Image processing method and apparatus | |
CN106560840B (en) | A kind of image information identifying processing method and device | |
CN106303515B (en) | A kind of online live video quality detecting method and device | |
CN113158773B (en) | Training method and training device for living body detection model | |
CN113469869B (en) | Image management method and device | |
CN114095722A (en) | Sharpness determination method, device and apparatus | |
CN113037997A (en) | Image processing method and device and electronic equipment | |
CN109147708B (en) | Gamma value adjusting method and device of display panel and display equipment | |
CN112541899B (en) | Incomplete detection method and device of certificate, electronic equipment and computer storage medium | |
CN110958448B (en) | Video quality evaluation method, device, medium and terminal | |
CN117041443B (en) | Offline photo processing method, device and storage medium | |
CN107577973B (en) | image display method, image identification method and equipment | |
CN113128299B (en) | People stream density detection method and device, terminal equipment, server and storage medium | |
CN111277724B (en) | Detection method and device for abnormal operation application, electronic equipment and storage medium | |
CN113792661A (en) | Image detection method, image detection device, electronic equipment and storage medium | |
CN117459662B (en) | Video playing method, video identifying method, video playing device, video playing equipment and storage medium | |
CN112507798A (en) | Living body detection method, electronic device, and storage medium | |
CN108270973B (en) | Photographing processing method, mobile terminal and computer readable storage medium | |
CN112907540B (en) | Splice abnormality detection method, device, equipment and medium | |
CN113033530B (en) | Certificate copying detection method and device, electronic equipment and readable storage medium | |
US20230005301A1 (en) | Control apparatus, control method, and non-transitory computer readable medium | |
CN112132008A (en) | Document file detection method and device, electronic equipment and readable storage medium | |
CN109685151A (en) | The recognition methods of circuit board item number, device and computer readable 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 |