Method, device, equipment and medium for processing original image into multiple ID photos
Through intelligent detection and processing technology, the problem of a wide variety of ID photos and differences in standards and specifications has been solved, the multiple uses of photos have been realized, the ID photo production process has been simplified, and the convenience of work has been improved.
Patent Information
- Application Number
- CN202311295938.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-09
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-10-09
AI Technical Summary
There are many types of ID photos with different standards and requirements, which makes it difficult to reuse the photos taken and the processing process is cumbersome, affecting the convenience of the people to apply for certificates.
Through intelligent detection and processing technology, it receives the original photo taken, cuts, colors, and changes the background to generate ID photos that meet the standards of different ID types, and performs standard detection and correction to achieve multiple uses of one photo.
It realizes the seamless reuse of photos between different ID types, simplifies the ID photo production process, and improves the convenience and happiness of the people.
Smart Images

Figure CN117412158B
Abstract
Description
Technical Field
[0001] The present invention relates to a method, device, computer equipment and storage medium for processing a captured original image into multiple ID photos, belonging to the technical field of image processing in photo service. Background Art
[0002] In China, everyone has more than a hundred certificates and certifications that they use frequently throughout their lives, from birth, household registration, schooling, examinations, personal identity, social security, job titles, marriage, going abroad, to retirement certificates and senior citizen certificates when they are old, and they continue to apply for various certificates and certifications until death. Among them, ID photos are an important part of the documents, especially legal documents such as identity cards, entry and exit documents (including passports, Hong Kong, Macau and Taiwan passes), and driver's licenses. There are strict standards and technical requirements. The original photos taken by digital cameras, mobile phones, and self-service camera all-in-one devices cannot be directly used for various ID photos. Corresponding ID photos must be produced according to the different technical standards and specifications of the photos of the ID type. Therefore, there are the following problems in ID photos:
[0003] 1) There are many types of certificates and it is difficult to distinguish the standard specifications
[0004] There are many types of ID photos, such as resident ID card photos, motor vehicle driver's license photos, entry and exit document photos, etc. Since different certificates use different certificate production processes, each business department has formulated corresponding certificate standards. There are large differences in the background, size, pixels, color and other portrait collection technical specifications. Resident ID card photos have a white background, entry and exit document photos have a blue background, driver's license photos have a white background... etc. The technical standards and specifications for each type of certificate are different. Photo service units or the public need to memorize the technical standards for various certificate photos in order to produce the corresponding ID photos.
[0005] 2) ID photos are difficult to take and reuse
[0006] Due to the high degree of professionalism and many standards and specifications for certificates, the photos taken by the public using cameras, camcorders, smart phones and other selfies barely meet the standards of certain certificates, but are difficult to reuse on other certificates; going to a photo studio to take photos requires manual shooting and processing by photographers, retouchers, etc., which takes a long time. Furthermore, since certificate photos cannot be reused on other certificates, when certificate photos are needed for other business in the short term, it will take time to go to the photo studio to take photos again. It takes a lot of time and effort to get the required certificate photos, which seriously affects the convenience of people in getting certificates.
[0007] 3) The ID photo production process is cumbersome and time-consuming
[0008] The current ID photo processing technology is still unable to process one original photo into multiple ID photos of different ID types at the same time. Whether it is manual or automatic image processing, processing ID photos of different standards requires photo processing one by one (covering steps such as cropping, color adjustment, and background replacement). It takes at least 10 minutes to 20 minutes or even longer to process one photo. Such repeated processing is inefficient and affects the normal development of other businesses of the photography unit. Summary of the invention
[0009] In view of this, the present invention provides a method, device, computer equipment and storage medium for taking an original image and processing it into a variety of ID photos, which can solve the problems of people taking photos repeatedly, difficulty in reusing photos, cumbersome photo processing, etc. The photos can be reused in multiple occasions and places within the validity period of the photos, so that people can run less errands and more information. By utilizing an image processing method based on processing the original image into a variety of ID photos, one photo can be used for multiple purposes, thereby improving people's convenience and happiness in handling affairs.
[0010] The first object of the present invention is to provide a method for processing an original image into a variety of ID photos.
[0011] The second object of the present invention is to provide a device for processing an original image into a variety of ID photos.
[0012] A third object of the present invention is to provide a computer device.
[0013] A fourth object of the present invention is to provide a storage medium.
[0014] The first object of the present invention can be achieved by adopting the following technical solutions:
[0015] A method for processing a photographed original image into multiple ID photos, the method comprising:
[0016] Receive original photos uploaded by photography units / users;
[0017] Intelligent detection of original photos;
[0018] After the original photo passes the inspection, it will be cut into photos of corporate standard specifications;
[0019] According to the standard requirements of the selected certificate type, the photos of the enterprise standard specifications are processed to generate certificate photos;
[0020] Standard testing of ID photos;
[0021] After the ID photo passes the inspection, it is processed to generate ID photos of various ID types and specifications.
[0022] Furthermore, the intelligent detection of the original photograph includes:
[0023] Check whether the color brightness, posture and makeup, image quality, clothing and accessories of the original photo meet the standard requirements for ID photos.
[0024] Furthermore, the processing of the photo of the enterprise standard specification to generate the ID photo includes:
[0025] Crop, brighten, cut out and change the background of photos that meet corporate standard specifications to generate ID photos.
[0026] Furthermore, the steps of cropping, adjusting the color and brightening the photo, and changing the background of the photo according to the corporate standard specifications include:
[0027] According to the standard requirements of the selected ID type, obtain the image width and image height of the target ID photo;
[0028] For the human face in the photo of the corporate standard, the face is divided into six areas: left eye area, right eye area, top of the head, chin, left cheek and right cheek, and the corresponding parameters of each area are obtained;
[0029] According to the corresponding parameters of each area, image width and image height, face width correction, center correction, scaling ratio calculation and cropping coordinate calculation are performed in sequence;
[0030] Crop the photos to the company's standard specifications according to the cropping coordinates;
[0031] Detect the facial color in the cropped photo, and adjust the brightness and color in turn;
[0032] Get the adjusted standard certificate photo, trimap image and Alpha image filled with background color, and merge the standard certificate photo, trimap image and Alpha image.
[0033] Furthermore, the face width correction, center correction, scaling ratio calculation, and cropping coordinate calculation are sequentially performed according to the corresponding parameters of each region, the image width, and the image height, including:
[0034] The face width is calculated based on the parameters of the top of the head, the chin, the left cheek and the right cheek, so as to correct the face width.
[0035] The offset is calculated based on the parameters of the left eye area, the right eye area, the top of the head, the left cheek, the right cheek and the chin position, so as to perform centering correction;
[0036] The scaling ratio is calculated according to the calculated face width, left cheek and right cheek parameters;
[0037] According to the scaling ratio, image width, corrected face width and left cheek parameters, the upper left X coordinate and lower right X coordinate to be cropped are calculated;
[0038] According to the parameters of the scaling ratio and the top position of the head, the upper left Y coordinate to be cropped is calculated;
[0039] According to the parameters of scaling, top position and image height, the lower right Y coordinate to be cropped is calculated.
[0040] Furthermore, the detecting the facial color in the cropped photo and sequentially performing brightness adjustment and color adjustment include:
[0041] According to the biased brightness correction coefficient and the overall adjustment value, the brightness difference is calculated to adjust the brightness;
[0042] If the color is reddish or cyan, make reddish or cyan adjustments based on the reddish correction coefficient and reddish adjustment value;
[0043] If the color is yellowish, make yellowish adjustments based on the yellowish correction coefficient and cyan adjustment value;
[0044] If the color is bluish, make bluish adjustments based on the bluish correction coefficient and cyan adjustment value.
[0045] Furthermore, the standard test of the ID photo includes:
[0046] Check whether the color brightness, posture and makeup, clothing and accessories, and portrait quality of the ID photo meet the standard requirements for ID photos.
[0047] Furthermore, after the ID photo is processed to generate ID photos of various ID types and specifications, the method further includes:
[0048] Conduct random checks on ID photos of different ID types and specifications;
[0049] If the random check is passed, the ID photo will be saved in the database, and a receipt or ID code will be generated and sent to the photo taking unit / user;
[0050] If the random check fails, the ID photo will be corrected to ensure that it meets the standard specifications of various ID documents. The ID photo will be saved in the database, and a receipt or ID code will be generated and sent to the photo taking unit / user.
[0051] The second object of the present invention can also be achieved by adopting the following technical solutions:
[0052] A device for processing an original image into multiple ID photos, the device comprising:
[0053] A receiving module is used to receive the original photos uploaded by the photography unit / user;
[0054] The first detection module is used to perform intelligent detection on the original photo;
[0055] A cropping module is used to crop the original photo into a photo of corporate standard specifications after the original photo passes the inspection;
[0056] The first processing module is used to process the photo of the enterprise standard according to the standard requirements of the selected certificate type to generate the certificate photo;
[0057] The second detection module is used to perform standard detection on the ID photo;
[0058] The second processing module is used to process the ID photo after it passes the inspection, and generate ID photos of various ID types and specifications.
[0059] The third object of the present invention can also be achieved by adopting the following technical solutions:
[0060] A computer device comprises a processor and a memory for storing a program executable by the processor. When the processor executes the program stored in the memory, the above method is implemented.
[0061] The fourth object of the present invention can also be achieved by adopting the following technical solutions:
[0062] A storage medium stores a program, and when the program is executed by a processor, the above method is implemented.
[0063] The present invention has the following beneficial effects compared with the prior art:
[0064] The method for processing an original image into multiple ID photos (referred to as "one photo for multiple uses") is to quickly generate ID photos of different specifications, such as resident ID card photos, passport photos or Hong Kong, Macao and Taiwan pass photos, motor vehicle driver's license photos, residence permit photos and social security card photos, through "three inspections and three processings" and six ID photo production technical means: original image intelligent inspection, automatic (or manual) cropping of corporate logo photos, intelligent processing (cropping of ID photos, color adjustment and brightening, background processing), one-photo-for-multiple-use photo standard inspection, standard intelligent (or manual) processing of different ID photos (cropping, color adjustment and brightening, and background color replacement), standard spot check inspection (or manual correction) of each ID photo and other ID photo production processes. The public can present a photo receipt (or electronic ID code) when handling business as needed. After the business department scans the code, it obtains the corresponding photo information to handle the business. By taking a photo once, they can obtain photos of various types of ID cards for reuse in multiple scenarios, greatly improving the convenience and happiness of the public. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0066] Figure 1 The present invention is a simplified flowchart of a method for processing an original image into a variety of ID photos according to Embodiment 1 of the present invention.
[0067] Figure 2 This is a specific flow chart of the method for processing an original image into multiple ID photos according to Embodiment 1 of the present invention.
[0068] Figure 3 This is a schematic diagram of a method for processing an original image into multiple ID photos according to Embodiment 1 of the present invention.
[0069] Figure 4 This is a schematic diagram of the principle of photo detection and review according to Embodiment 1 of the present invention.
[0070] Figure 5 This is a schematic diagram of the principle of generating a receipt or a license code according to Embodiment 1 of the present invention.
[0071] Figure 6 This is a diagram showing the effect of insufficient brightness before adjustment in Example 1 of the present invention.
[0072] Figure 7 This is a diagram showing the effect of insufficient brightness after adjustment in Example 1 of the present invention.
[0073] Figure 8 This is a schematic diagram of a standard certificate photo after color adjustment and brightening according to Example 1 of the present invention.
[0074] Fig. 9 This is the trimap diagram of Example 1 of the present invention.
[0075] Fig.10 This is the final effect diagram of the background replacement after cutting out the image in Example 1 of the present invention.
[0076] Fig.11 This is a schematic diagram of a specific application of the ID photo of Example 1 of the present invention.
[0077] Fig.12 This is a structural block diagram of an apparatus for processing an original image into various ID photos according to Embodiment 2 of the present invention.
[0078] Fig.13 This is a structural block diagram of a computer device according to Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0079] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0080] Embodiment 1:
[0081] like Figure 1 to Figure 5 As shown, this embodiment provides a method for taking an original image and processing it into multiple ID photos. The method can be applied to a platform system and includes the following steps:
[0082] S101, receiving the original photo uploaded by the photography unit / user.
[0083] S102: Perform intelligent detection on the original photo.
[0084] In this embodiment, after the photographing unit / user uploads the original photograph to the platform system, the original photograph is subjected to intelligent detection, mainly to detect whether the color brightness, posture and makeup, image quality, clothing and accessories of the original photograph meet the standard requirements of the ID photo. If the detection passes, the process proceeds to step S103. If the detection fails, the result of the failed detection is fed back to the photographing unit / user.
[0085] S103, cropping the original photo into a photo of corporate standard specifications.
[0086] In this embodiment, the photos are cropped into photos of corporate standard specifications through platform software or interface, and the cropping can be done automatically or manually.
[0087] S104. Process the photo of the enterprise standard according to the standard requirements of the selected certificate type to generate a certificate photo.
[0088] In this embodiment, a photo of the enterprise logo specification is processed to generate an ID photo, specifically: the photo of the enterprise logo specification is cropped, the color is adjusted and brightened, and the background is cut out and changed to generate the ID photo.
[0089] A. Cutting process
[0090] According to the standard requirements of the selected ID type, the image width and image height of the target ID photo are obtained. For the face in the photo of the corporate standard, six areas are divided: left eye area, right eye area, top of head position, chin position, left cheek and right cheek, and the corresponding parameters of each area are obtained. The top of the head is also called the top of the head distance. The parameters of the left eye area and the right eye area refer to the X and Y coordinates of the pupil in the image (the photo of the corporate standard), the top of the head position and the chin position parameters refer to the Y coordinate in the image (the photo of the corporate standard), and the left cheek and the right cheek parameters refer to the X coordinate in the image (the photo of the corporate standard). These parameters are obtained by using OpenCV; according to the corresponding parameters of each area, the image width and the image height, the face width correction, the center correction, the scaling ratio calculation and the cropping coordinate calculation are performed in turn; according to the cropping coordinates, the photo of the corporate standard is cropped.
[0091] Among them, the corresponding parameters of the six areas, namely the left eye area, the right eye area, the top of the head, the chin position, the left cheek and the right cheek, are recorded as LeftEye, RightEye, HeadTop, Chin, LeftCheek and RightCheek, respectively, and the image width and image height are recorded as ImageWidth and ImageHeight.
[0092] Among them, according to the corresponding parameters of each area, image width and image height, face width correction, center correction, scaling ratio calculation and cropping coordinate calculation are performed in sequence, specifically including:
[0093] 1) Face width correction
[0094] The face width is calculated based on the parameters of the top of the head, chin, left cheek, and right cheek, so as to correct the face width. The face width is calculated as follows:
[0095] FaceWidth=Chin*(RightCheek-LeftCheek) / (Chin–HeadTop)
[0096] 2) Centering correction
[0097] According to the parameters of the left eye area, right eye area, top of the head position, left cheek, right cheek and chin position, the offset is calculated as follows:
[0098] Offset=(((LeftCheek+RightCheek) / 2–(LeftEye-RightEye) / 2)*Chin) / (Chin-HeadTop)
[0099] According to the calculated offset, center correction is performed to obtain the x-coordinate of the left cheek after center correction and the x-coordinate of the right cheek after center correction, as shown in the following formula:
[0100] LeftCheek'=LeftCheek–Offset
[0101] RightCheek'=RightCheek–Offset
[0102] 3) Calculate the scaling ratio
[0103] According to the calculated face width, the parameters of the left cheek after center correction, and the right cheek after center correction, the scaling ratio is calculated as follows:
[0104] RATE=(LeftCheek'–RightCheek' / FaceWidth)
[0105] 4) Calculate clipping coordinates
[0106] According to the scaling ratio, image width, calculated face width and the parameters of the left cheek after center correction, the upper left X coordinate and lower right X coordinate to be cropped are calculated as follows:
[0107] Upper left coordinate X = LeftCheek'-RATE*((ImageWidth-FaceWidth) / 2)
[0108] Lower right coordinate X = LeftCheek'-RATE*((ImageWidth-FaceWidth) / 2)+(RATE*
[0109] imageWidth)
[0110] According to the parameters of the scaling ratio and the top position of the head, calculate the upper left Y coordinate to be cropped, as follows:
[0111] Upper left coordinate Y = HeadTop – RATE*HeadTop
[0112] According to the parameters of scaling, top position and image height, calculate the lower right Y coordinate to be cropped as follows:
[0113] Lower right coordinate Y = HeadTop – RATE*HeadTop+RATE*ImageHeight
[0114] B. Color adjustment and brightening process
[0115] Detect the facial color in the cropped photo and perform brightness adjustment and color adjustment in sequence, including:
[0116] 1) According to the biased brightness correction coefficient and the overall adjustment value, the brightness difference is calculated as follows:
[0117] Diff = DefaultLight – d6
[0118] If Diff=0, adjust Curve(-1, 1, -1);
[0119] If abs(Diff)≤5, make the following adjustments:
[0120] 1) If Diff>0, adjust Curve(Diff+3, Diff+3, Diff+3).
[0121] 2) If Diff<0, adjust Curve(Diff-3, Diff-3, Diff-3).
[0122] If abs(Diff)>5, define a configuration item LightOffset, which can be automatically adjusted. The recommended value is 5. Make the following adjustments:
[0123] 1) If Diff>0, adjust Curve(Diff+LightOffset, Diff+LightOffset, Diff+LightOffset).
[0124] 2) If Diff<0, adjust Curve(Diff-LightOffset, Diff-LightOffset, Diff-LightOffset).
[0125] 2) If the color is reddish or cyan, make reddish or cyan adjustments based on the reddish correction coefficient and reddish adjustment value, as shown in the following formula:
[0126] Red adjustment: Curve(DefaultRed–d1,d1–DefaultRed,0)
[0127] Cyan adjustment: Curve(DefaultRed–d1,0,0)
[0128] 3) If the color is yellowish, make yellowish adjustment according to the yellowish correction coefficient and cyan adjustment value, as shown in the following formula:
[0129] Curve(0,0,d4-DefaultYellow)
[0130] 4) If the color is bluish, make bluish adjustments based on the bluish correction coefficient and cyan adjustment value.
[0131] Curve(0,0,d4-DefaultBlue)
[0132] In the above formulas,
[0133] d1 is the reddish adjustment value, d1=r*120 / g;
[0134] d4 is the cyan adjustment value, d4=g*120 / b;
[0135] The overall (RGB) adjustment of d6, d6 = A*rB*g+C*b, where A, B, and C are empirical constants. Reasonable constant values are obtained through a large number of observations of photo effects. Among them, 0.05≤A≤0.35, the optimal reference value of A is 0.1, 0.4≤B≤0.6, the optimal reference value of B is 0.44, 0.10≤C≤0.30, and the optimal reference value of C is 0.18;
[0136] The variables r, g, and b are the mean values of the facial colors, which are calculated by the total amount of r in the facial area / the total amount of pixels in the facial area, the total amount of g in the facial area / the total amount of pixels in the facial area, and the total amount of b in the facial area / the total amount of pixels in the facial area in the photo;
[0137] The face area refers to a rectangular area that includes most of the facial skin. Specifically, the X coordinate of the upper left corner of the rectangular area is: the X coordinate of the left eye area – 20; the Y coordinate of the upper left corner of the rectangular area is: the Y coordinate of the left eye area – 20; the width of the rectangular area is: the X coordinate of the right eye area – the X coordinate of the left eye area + 40; the height of the rectangular area is: the X coordinate of the right eye area – the X coordinate of the left eye area.
[0138] Curve is a curve function, which is the adjustment of the R, G, and B channels of the image color;
[0139] DefaultLight is the brightness correction coefficient, which can be adjusted freely, and the reference value is 175;
[0140] DefaultRed is the red correction coefficient, which can be adjusted freely, and the reference value is -5;
[0141] DefaultYellow is the yellow correction coefficient, which can be adjusted freely, and the reference value is -5;
[0142] DefaultBlue is the blue correction coefficient, which can be adjusted freely and the reference value is -5.
[0143] This embodiment takes insufficient brightness as an example, and the effect diagram before adjustment is as follows: Figure 6 As shown, due to insufficient brightness, it needs to be brightened. The effect after adjustment is as follows Figure 7As shown, by observing before and after adjustment, the photo before adjustment is directly cropped based on the original image, and the overall color is darker, with heavier shadows in some areas. The overall brightness of the photo after adjustment is improved, the impact of the shadow on the overall photo quality is weakened, and the photo looks more beautiful.
[0144] C. The process of cutting out the image and changing the background.
[0145] 1) Obtain the adjusted standard certificate photo. The standard certificate photo after color adjustment and brightening is as follows: Figure 8 shown.
[0146] 2) Obtain the Trimap image based on the Grabcut algorithm, such as Fig. 9 As shown, white represents the background color, light gray represents the boundary between the foreground color and the background color, and dark gray represents the foreground color.
[0147] 3) Get the alpha image filled with the background color, such as yellow.
[0148] 4) Use the Bayesian algorithm to combine the standard certificate, Trimap and Alpha map to form the final effect, such as Fig.10 shown.
[0149] S105. Perform standard testing on the ID photo.
[0150] In this embodiment, the ID photo is subjected to standard testing, specifically: testing whether the color brightness, posture and makeup, clothing accessories, and portrait quality of the ID photo meet the standard requirements of the ID photo. The standard test can be reviewed automatically or manually; if the test passes, the process proceeds to step S106. If the test fails, the result of the failed test is fed back to the photography unit / user.
[0151] S106: Process the ID photo to generate ID photos of various ID types and specifications.
[0152] In this embodiment, the processing of the ID photo is similar to the processing in the above step S104, and the ID photo is cropped, the color is adjusted and brightened, and the background is cut out and changed to generate ID photos of various ID types and specifications.
[0153] After step S106, this embodiment may further include:
[0154] S107. Conduct random checks on ID photos of different types and specifications.
[0155] The spot check may be conducted automatically or manually. If the spot check passes, the process proceeds to step S108 . If the spot check fails, the process proceeds to step S109 .
[0156] S108: Save the ID photo to the database, and generate a receipt or ID code, and send it to the photo taking unit / user.
[0157] S109, modify the ID photo to ensure that it meets the standard specifications of various ID documents, save the ID photo to the database, and generate a receipt or ID code and send it to the photo unit / user.
[0158] In this embodiment, the photos that fail the spot check are corrected, and the correction can be made automatically or manually to ensure that the photos meet the standard specifications of various certificates, such as resident identity cards, passports or Hong Kong, Macau and Taiwan passes, motor vehicle driver's licenses, etc.
[0159] The ID photo finally obtained in this embodiment is specifically used as follows: Fig.11 The specific instructions are as follows:
[0160] 1) After obtaining a multi-purpose photo receipt (or ID code) from the photo unit or platform system, the public user goes to various business departments to handle business, such as the household registration department to handle ID cards, the entry and exit department to handle entry and exit business, etc., and presents the multi-purpose photo receipt (or ID code) according to the business requirements.
[0161] 2) Each business department scans a multi-purpose photo receipt (or ID code), and based on the photo information obtained from the receipt (or ID code), initiates a photo call to the business intranet system. After receiving the photo request from the business department, the business intranet system sends a photo retrieval instruction to the platform system.
[0162] 3) After the platform system receives the photo retrieval instruction, it sends the certificate photo information corresponding to the one-photo-for-all photo library to the corresponding business intranet system, so that each business department can retrieve the corresponding photo information. For example, if the household registration department needs the photo information of the resident ID card, it will initiate a call request to the household registration business intranet system photo. After receiving the instruction, the household registration business intranet system will retrieve the corresponding photo information from the platform's one-photo-for-all photo library and provide it to the business department for use to complete the public business processing.
[0163] It should be noted that although the method operations of the above embodiments are described in a specific order, this does not require or imply that these operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0164] Embodiment 2:
[0165] like Fig.12As shown, this embodiment provides a device for processing an original image into multiple ID photos, the device includes a receiving module 1201, a first detection module 1202, a cropping module 1203, a first processing module 1204, a second detection module 1205 and a second processing module 1206, and the specific description of each module is as follows:
[0166] The receiving module 1201 is used to receive the original photos uploaded by the photography unit / user.
[0167] The first detection module 1202 is used to perform intelligent detection on the original photo.
[0168] The cropping module 1203 is used to crop the original photograph into a photo of corporate standard specifications after the original photograph passes the inspection.
[0169] The first processing module 1204 is used to process the photo of the enterprise standard specification according to the standard requirements of the selected certificate type to generate a certificate photo.
[0170] The second detection module 1205 is used to perform standard detection on the ID photo.
[0171] The second processing module 1206 is used to process the ID photo after it passes the detection, and generate ID photos of various ID types and specifications.
[0172] The specific implementation of the above modules can refer to the above embodiment 1; it should be noted that the device provided in this embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure can be divided into different functional modules to complete all or part of the functions described above.
[0173] Embodiment 3:
[0174] This embodiment provides a computer device, such as Fig.13 As shown, it includes a processor 1302, a memory, an input device 1303, a display device 1304 and a network interface 1305 connected through a system bus 1301. The processor is used to provide computing and control capabilities. The memory includes a non-volatile storage medium 1306 and an internal memory 1307. The non-volatile storage medium 1306 stores an operating system, a computer program and a database. The internal memory 1307 provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the processor 1302 executes the computer program stored in the memory, the method for processing the original image into a variety of ID photos in the above-mentioned embodiment 1 is implemented as follows:
[0175] Receive original photos uploaded by photography units / users;
[0176] Intelligent detection of original photos;
[0177] After the original photo passes the inspection, it will be cut into photos of corporate standard specifications;
[0178] According to the standard requirements of the selected certificate type, the photos of the enterprise standard specifications are processed to generate certificate photos;
[0179] Standard testing of ID photos;
[0180] After the ID photo passes the inspection, it is processed to generate ID photos of various ID types and specifications.
[0181] Furthermore, after the ID photo is processed to generate ID photos of various ID types and specifications, it also includes:
[0182] Conduct random checks on ID photos of different ID types and specifications;
[0183] If the random check is passed, the ID photo will be saved in the database, and a receipt or ID code will be generated and sent to the photo taking unit / user;
[0184] If the random check fails, the ID photo will be corrected to ensure that it meets the standard specifications of various ID documents. The ID photo will be saved in the database, and a receipt or ID code will be generated and sent to the photo taking unit / user.
[0185] Embodiment 4:
[0186] This embodiment provides a storage medium, which is a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method of processing the original image into multiple ID photos in the above embodiment 1 is implemented as follows:
[0187] Receive original photos uploaded by photography units / users;
[0188] Intelligent detection of original photos;
[0189] After the original photo passes the inspection, it will be cut into photos of corporate standard specifications;
[0190] According to the standard requirements of the selected certificate type, the photos of the enterprise standard specifications are processed to generate certificate photos;
[0191] Standard testing of ID photos;
[0192] After the ID photo passes the inspection, it is processed to generate ID photos of various ID types and specifications.
[0193] Furthermore, after the ID photo is processed to generate ID photos of various ID types and specifications, it also includes:
[0194] Conduct random checks on ID photos of different ID types and specifications;
[0195] If the random check is passed, the ID photo will be saved in the database, and a receipt or ID code will be generated and sent to the photo taking unit / user;
[0196] If the random check fails, the ID photo will be corrected to ensure that it meets the standard specifications of various ID documents. The ID photo will be saved in the database, and a receipt or ID code will be generated and sent to the photo taking unit / user.
[0197] It should be noted that the computer-readable storage medium of the above-mentioned embodiment may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor device, device or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0198] In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution device, device, or device. In this embodiment, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium, which may send, propagate, or transmit a program used by or in combination with an instruction execution device, device, or device. The computer program contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0199] The computer readable storage medium may be written in one or more programming languages or a combination thereof to execute the computer program of the present embodiment, including object-oriented programming languages such as Java, Python, C++, and conventional procedural programming languages such as C or similar programming languages. The program may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0200] In summary, the method of the present invention for processing an original image into a variety of ID photos (referred to as "one photo for multiple uses"), takes a color front-facing portrait bare-headed ID digital photo original image, and uses "three inspections and three processings" and six ID photo production technical means: original image intelligent detection, automatic (or manual) cropping of corporate logo photos, intelligent processing (cropping ID photos, color adjustment and brightening, background processing), one-photo-multiple-use photo standard detection, different ID photo standard intelligent (or manual) processing (cropping, color adjustment and brightening, and background color replacement), each ID photo standard spot check detection (or manual correction) and other ID photo production processes to quickly generate ID photos of different specifications, such as resident identity card photos, passport or Hong Kong, Macao and Taiwan pass photos, motor vehicle driver's license photos, residence permit photos and social security card photos. When handling business as needed, the public can present a paper photo receipt (or electronic ID code). After the business department scans the code, it obtains the corresponding photo information to handle the business. By taking a photo once, they can obtain photos of various types of ID cards for reuse in multiple scenarios, greatly improving the convenience and happiness of the public.
[0201] The above is only a preferred embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solution and invention concept of the present invention within the scope disclosed by the present invention, which shall fall within the protection scope of the present invention.
Claims
1. A method for processing an original image into multiple ID photos, characterized in that: The method comprises: Receive original photos uploaded by photography units / users; Intelligent detection of original photos; After the original photo passes the inspection, it will be cut into photos of corporate standard specifications; According to the standard requirements of the selected ID type, crop, adjust the color and brighten the photo, cut out the image and change the background to generate the ID photo; Standard testing of ID photos; After the ID photo passes the inspection, the ID photo is processed to generate ID photos of various ID types and specifications; Carry out random checks on ID photos of different ID types and specifications. If the random check passes, the ID photo will be saved in the database, and a receipt or ID code will be generated and sent to the photo unit / user; if the random check fails, the ID photo will be corrected to ensure that it meets the standard specifications of various ID documents, and the ID photo will be saved in the database, and a receipt or ID code will be generated and sent to the photo unit / user; The above-mentioned steps of cropping, adjusting the color and brightening the photo, and changing the background of the photo according to the corporate standard specifications include: According to the standard requirements of the selected ID type, obtain the image width and image height of the target ID photo; For the human face in the photo of the corporate standard, the face is divided into six areas: left eye area, right eye area, top of the head, chin, left cheek and right cheek, and the corresponding parameters of each area are obtained; According to the corresponding parameters of each area, the image width and the image height, face width correction, centering correction, scaling ratio calculation and cropping coordinate calculation are performed in sequence, including: according to the parameters of the top of the head position, the chin position, the left cheek and the right cheek, the face width is calculated to correct the face width; according to the parameters of the left eye area, the right eye area, the top of the head position, the left cheek, the right cheek and the chin position, the offset is calculated to correct the center; according to the calculated face width, the parameters of the left cheek and the right cheek, the scaling ratio is calculated; according to the scaling ratio, the image width, the corrected face width and the parameters of the left cheek, the upper left X coordinate and the lower right X coordinate to be cropped are calculated; according to the scaling ratio and the parameters of the top of the head position, the upper left Y coordinate to be cropped is calculated; according to the parameters of the scaling ratio, the top of the head position and the image height, the lower right Y coordinate to be cropped is calculated; Crop the photos to the company's standard specifications according to the cropping coordinates; Detect the facial color in the cropped photo, and adjust the brightness and color in turn; Get the adjusted standard certificate photo, trimap image and Alpha image filled with background color, and merge the standard certificate photo, trimap image and Alpha image.
2. The method according to claim 1, characterized in that The intelligent detection of the original photograph includes: Check whether the color brightness, posture and makeup, image quality, clothing and accessories of the original photo meet the standard requirements for ID photos.
3. The method according to claim 1, characterized in that: The detecting the facial color in the cropped photo and sequentially performing brightness adjustment and color adjustment include: According to the biased brightness correction coefficient and the overall adjustment value, the brightness difference is calculated to adjust the brightness; If the color is reddish or cyan, make reddish or cyan adjustments based on the reddish correction coefficient and reddish adjustment value; If the color is yellowish, make yellowish adjustments based on the yellowish correction coefficient and cyan adjustment value; If the color is bluish, make bluish adjustments based on the bluish correction coefficient and cyan adjustment value.
4. The method according to claim 1, characterized in that: The standard test of the ID photo includes: Check whether the color brightness, posture and makeup, clothing and accessories, and portrait quality of the ID photo meet the standard requirements for ID photos.
5. A device for processing an original image into multiple ID photos, characterized in that: The device comprises: A receiving module is used to receive the original photos uploaded by the photography unit / user; The first detection module is used to perform intelligent detection on the original photo; A cropping module is used to crop the original photo into a photo of corporate standard specifications after the original photo passes the inspection; The first processing module is used to crop, adjust the color and lighten the photo, cut out and change the background of the photo according to the standard requirements of the selected certificate type to generate a certificate photo; The second detection module is used to perform standard detection on the ID photo; The second processing module is used to process the ID photo after it passes the inspection, and generate ID photos of various ID types and specifications; The spot check module is used to spot check the ID photos of different ID types and specifications. If the spot check passes, the ID photo will be saved in the database, and a receipt or ID code will be generated and sent to the photo unit / user; if the spot check fails, the ID photo will be corrected to ensure that it meets the standard specifications of various ID documents, and the ID photo will be saved in the database, and a receipt or ID code will be generated and sent to the photo unit / user; The above-mentioned steps of cropping, adjusting the color and brightening the photo, and changing the background of the photo according to the corporate standard specifications include: According to the standard requirements of the selected ID type, obtain the image width and image height of the target ID photo; For the human face in the photo of the corporate standard, the face is divided into six areas: left eye area, right eye area, top of the head, chin, left cheek and right cheek, and the corresponding parameters of each area are obtained; According to the corresponding parameters of each area, the image width and the image height, face width correction, centering correction, scaling ratio calculation and cropping coordinate calculation are performed in sequence, including: according to the parameters of the top of the head position, the chin position, the left cheek and the right cheek, the face width is calculated to correct the face width; according to the parameters of the left eye area, the right eye area, the top of the head position, the left cheek, the right cheek and the chin position, the offset is calculated to correct the center; according to the calculated face width, the parameters of the left cheek and the right cheek, the scaling ratio is calculated; according to the scaling ratio, the image width, the corrected face width and the parameters of the left cheek, the upper left X coordinate and the lower right X coordinate to be cropped are calculated; according to the scaling ratio and the parameters of the top of the head position, the upper left Y coordinate to be cropped is calculated; according to the parameters of the scaling ratio, the top of the head position and the image height, the lower right Y coordinate to be cropped is calculated; Crop the photos to the company's standard specifications according to the cropping coordinates; Detect the facial color in the cropped photo, and adjust the brightness and color in turn; Get the adjusted standard certificate photo, trimap image and Alpha image filled with background color, and merge the standard certificate photo, trimap image and Alpha image.
6. A computer device comprising a processor and a memory for storing a program executable by the processor, characterized in that: When the processor executes the program stored in the memory, the method described in any one of claims 1 to 4 is implemented.
7. A storage medium storing a program, characterized in that: When the program is executed by a processor, the method described in any one of claims 1 to 4 is implemented.
