WO2020140617A1 - Image processing method, terminal apparatus, and computer readable medium - Google Patents

Image processing method, terminal apparatus, and computer readable medium Download PDF

Info

Publication number
WO2020140617A1
WO2020140617A1 PCT/CN2019/117576 CN2019117576W WO2020140617A1 WO 2020140617 A1 WO2020140617 A1 WO 2020140617A1 CN 2019117576 W CN2019117576 W CN 2019117576W WO 2020140617 A1 WO2020140617 A1 WO 2020140617A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
area
repaired
image area
repair
Prior art date
Application number
PCT/CN2019/117576
Other languages
French (fr)
Chinese (zh)
Inventor
陈颖聪
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN201910013962.3A external-priority patent/CN109785256B/en
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020140617A1 publication Critical patent/WO2020140617A1/en

Links

Images

Classifications

    • G06T5/77

Definitions

  • the present application relates to the field of image processing technology, and in particular, to an image processing method, terminal device, and computer-readable medium.
  • Embodiments of the present application provide an image processing method that can quickly and effectively repair defects in photos.
  • an embodiment of the present application provides an image processing method.
  • the method includes:
  • the image area to be repaired is repaired.
  • an embodiment of the present application provides a terminal device.
  • the terminal device includes a unit for performing the method of the first aspect.
  • an embodiment of the present application provides another terminal device, including a processor, an input device, an output device, and a memory, where the processor, input device, output device, and memory are connected to each other, wherein the memory is used for A computer program supporting the terminal device to execute the above method is stored, the computer program includes program instructions, and the processor is configured to call the program instructions to perform the method of the first aspect.
  • an embodiment of the present application provides a computer non-volatile readable storage medium, the computer storage medium stores a computer program, the computer program includes program instructions, and the program instructions when executed by a processor Causing the processor to perform the method of the first aspect described above.
  • a second image area that has a similarity to the first image area that reaches a threshold can be found through the first image area adjacent to the defective area in the image to be repaired, so as to utilize the image where the second image area is located To repair the image to be repaired.
  • FIG. 1 is a schematic flowchart of an image processing method provided by an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of another image processing method provided by an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of yet another image processing method provided by an embodiment of the present application.
  • FIG. 4 is a block diagram of a possible functional unit of a terminal device provided by an embodiment of the present application.
  • FIG. 5 is a schematic block diagram of a terminal according to another embodiment of the present application.
  • the term “if” may be interpreted as “when” or “once” or “in response to determination” or “in response to detection” depending on the context .
  • the phrase “if determined” or “if [described condition or event] is detected” may be interpreted in the context to mean “once determined” or “in response to a determination” or “once detected [described condition or event ]” or “In response to detection of [the described condition or event]”.
  • the terminal devices described in the embodiments of the present application include but are not limited to other portable devices such as mobile phones, laptop computers, or tablet computers with touch-sensitive surfaces (eg, touch screen displays and/or touch pads) . It should also be understood that, in some embodiments, the device is not a portable communication device, but a desktop computer with a touch-sensitive surface (eg, touch screen display and/or touch pad).
  • terminal devices including displays and touch-sensitive surfaces are described.
  • the terminal device may include one or more other physical user interface devices such as a physical keyboard, mouse, and/or joystick.
  • the terminal device supports various applications, such as one or more of the following: drawing applications, presentation applications, word processing applications, website creation applications, disk burning applications, spreadsheet applications, game applications, phones Applications, video conferencing applications, email applications, instant messaging applications, exercise support applications, image management applications, digital camera applications, digital camera applications, web browsing applications, digital music player applications And/or digital video player applications.
  • applications such as one or more of the following: drawing applications, presentation applications, word processing applications, website creation applications, disk burning applications, spreadsheet applications, game applications, phones Applications, video conferencing applications, email applications, instant messaging applications, exercise support applications, image management applications, digital camera applications, digital camera applications, web browsing applications, digital music player applications And/or digital video player applications.
  • Various applications that can be executed on the terminal device can use at least one common physical user interface device such as a touch-sensitive surface.
  • One or more functions of the touch-sensitive surface and corresponding information displayed on the terminal device may be adjusted and/or changed between applications and/or within the corresponding applications.
  • the common physical architecture of the terminal device eg, touch-sensitive surface
  • FIG. 1 is a schematic flowchart of an image processing method according to an embodiment of the present application. As shown in the figure, the method may include:
  • the terminal device acquires the image to be repaired, and determines the area of the image to be repaired in the image to be repaired.
  • the terminal devices may include various terminal devices such as mobile phones, tablet computers, personal digital assistants (Personal Digital Assistant (PDA), mobile Internet devices (MID), etc., and the embodiments of the present application are not limited.
  • PDA Personal Digital Assistant
  • MID mobile Internet devices
  • the above-mentioned image to be repaired may be a photo selected by the user from the terminal device that needs to be repaired with a certain defect, or may be a picture downloaded from the Internet with a certain defect.
  • the image area to be repaired may be an area selected by the user to be repaired, or the terminal device may detect whether a defect corresponding to the repair type exists in the image according to a preset repair type; when a defect is detected, the area where the defect is located is determined It is the above-mentioned image area to be repaired, wherein the above-mentioned image area to be repaired may be an image area included in a regular set image, or may be an image area included in an irregular closed curve, that is, contains only a defective area.
  • the terminal device displays the image to be repaired on the screen of the terminal device, and the user can select the image repair tool from the toolbar next to the image
  • the terminal device displays a repair image area selection box on the image to be repaired.
  • the terminal device receives the user's operation instruction on the above-mentioned repair image area selection frame, and completes the operation corresponding to the above operation instruction.
  • the user terminal determines the image area in the repair image area selection frame as the image area to be repaired.
  • the operation instructions of the user on the selection frame of the repaired image area may include a drag operation instruction, a zoom-in operation instruction, a zoom-out operation instruction, a stretch operation instruction, a deformation operation instruction, and the like.
  • the confirmation operation instruction may be a confirmation option that the user clicks on the screen, or a specific operation of the user on the repair image area selection box, for example, double-clicking the repair image area selection box.
  • the terminal device receives the first repair type selected by the user from the preset repair types, and then the terminal device automatically detects the first repair type according to the first repair type Whether there is a defect corresponding to the first repair type in the image to be repaired, and if so, the area where the defect is located is determined to be the image area to be repaired.
  • the above-mentioned repair types may include at least one of portrait closed-eye repair, blurry area repair, shadow area repair, distortion area repair, designated area repair, and group photo repair.
  • the terminal device selects the first image area surrounding the image area to be repaired among the image to be repaired.
  • the terminal device after the terminal device determines the image area to be repaired in the image to be repaired, the terminal device automatically determines a first surrounding the image area to be repaired from the image to be repaired according to the image area to be repaired An image area, so that a second image area that is the same as or similar to the first image area can be searched for based on the first image area, so that the second image area and the area surrounded by the second image area can be used to repair the to-be-repaired Image area.
  • the terminal device calculates the maximum radiation radius of the image area to be repaired, and then according to the maximum radiation radius of the image area to be repaired Determine the position of the first image area in the image to be repaired.
  • the positional relationship between the first image area and the image area to be repaired may be: the maximum radiation radius of the image area to be repaired is R, then the first image area may be selected with the center of the image area to be repaired as the center of the circle and 2R as the radius Remove the area where the image area to be repaired is located in the circular area; the positional relationship between the first image area and the image area to be repaired may also be: the maximum radiation radius of the image area to be repaired is R, and the first image area is selected as described above
  • the center of the image area to be repaired is taken as the center, and the area where the image area to be repaired is located is removed from the area of the square whose four sides are 2R away from the center.
  • the shape of the first image area may be other sizes or shapes than those shown in FIG. 3, and only needs to satisfy that the first image area surrounds the image area to be repaired.
  • the terminal device selects a target reference image from the reference image set, and there is a second image area matching the first image area in the target reference image.
  • the above-mentioned reference image set may be a picture existing in the gallery of the terminal device; or may be a picture that the terminal device selects from the terminal device according to the above-mentioned image to be repaired or downloaded from the Internet that meets the preset conditions, such as the above-mentioned to-be-repaired
  • the above reference image set may be a photo taken at the same time period as the photo to be repaired, or a photo with the same background as the photo to be repaired (for example, photos taken continuously with the photo to be repaired) , Can also be a picture manually selected by the user from the terminal device gallery.
  • the terminal device searches for a target reference with a second image area matching the first image area from the reference image set according to the first image area Image to use the target reference image to repair the image to be repaired.
  • the matching between the first image area and the second image area may be that the first image area and the second image area are the same or the similarity between the first image area and the second image area is greater than the threshold.
  • the shape of the border outline of the first image area and the second image area are the same, and the size of the border outline of the first image area and the second image area may be the same or different, that is, the second graphics area may be the first image area The enlarged or reduced version of.
  • the terminal device may use the image of the first image area as a template image, and then sequentially match each image in the reference image set with the template image.
  • matching first extract the feature points in the template image and the reference image to be matched, and then match the feature points in the template image and the reference image to be matched, and then determine the reference image to be matched by the matched feature points Whether there is an area similar to the template image in the image, if it exists, the similarity between the template image and the similar area similar to the template image in the image to be matched is calculated, and if the similarity is greater than the threshold, the image to be matched is used as the target reference image , The aforementioned similar area is used as the aforementioned second image area.
  • the terminal device determines whether the image area surrounded by the similar area is defective, and if the image area surrounded by the similar area is determined If there is no defect, the similar area is determined as the second image area, and the reference image corresponding to the similar area is determined as the target reference image.
  • one or more reference images may be searched from the reference image set to satisfy the existence and similarity of the image area similar to the template image Degree is greater than the threshold.
  • the terminal device monitors two or more reference images from the reference image set to meet the above target reference image conditions, the terminal device selects the one with the largest similarity
  • the reference image serves as the target reference image that is ultimately used to repair the image to be repaired.
  • the similarity refers to the similarity of the similar area in the template image and the reference image.
  • the terminal device expands the range of the first image area according to preset conditions (for example, expanding the first image area to the original Twice), and then continue to perform the above 103 steps.
  • the terminal device uses the second image area in the target reference image and the area surrounded by the second image area as references to repair the image area to be repaired.
  • the terminal device determines the target reference image
  • the terminal device according to the second image area in the target reference image
  • the image area surrounded by the second image area repairs the image area to be repaired in the image to be repaired.
  • the terminal device when the second image area in the target reference image is the same as the boundary outline size of the first image area in the image to be repaired, the terminal device directly sets the second image in the target reference image The image of the image area surrounded by the area and the second image area is copied as the image to be stitched, and then the image with the stitching is spliced onto the first image area of the image to be repaired, so that the second image area in the target reference image And the image of the image area surrounded by the second image area covers the first image area and the image area to be repaired on the image to be repaired.
  • the terminal device needs to process the copied image after copying the second image area in the target reference image and the image area surrounded by the second image area Create an image with the same size as the outer boundary of the first image area as the image to be stitched, and then stitch the image to be stitched onto the first image area of the image to be repaired, so that the second image area in the target reference image And the image of the image area surrounded by the second image area covers the first image area and the image area to be repaired on the image to be repaired.
  • Image stitching technology is mainly divided into three main steps: image preprocessing, image registration, image fusion and boundary smoothing.
  • Image preprocessing mainly refers to geometric distortion correction and noise point suppression on the image, so that the reference image and the image to be stitched There is no obvious geometric distortion. If the image quality is not ideal, the image stitching can easily cause some mismatches if the image is not preprocessed.
  • Image preprocessing is mainly to prepare for the next image registration, so that the image quality can meet the requirements of image registration.
  • Image registration mainly refers to extracting the matching information in the reference image and the image to be stitched, finding the best match in the extracted information, and completing the alignment between the images.
  • image stitching is mainly the registration of images. Between the images to be stitched, there may be multiple transformations such as translation, rotation, scaling, or large areas of the same color area that are difficult to match.
  • a good image registration algorithm should be able to accurately find the inter-image Corresponding information, align the image.
  • Image fusion refers to stitching the image after the image matching is completed, and smoothing the stitched boundary to let the stitching transition naturally. Since the acquisition conditions of any two adjacent images cannot be exactly the same, for some image characteristics that should be the same, such as the illumination characteristics of the image, the two images will not behave exactly the same.
  • the image stitching gap is caused by the transition of some relevant characteristics in the image when it transitions from the image area of one image to the image area of another image.
  • the purpose of image fusion is to make the stitching gap between the images less obvious and the stitching more natural.
  • the splicing of the image to be spliced onto the first image area of the image to be repaired may include: the terminal device performing image correction processing on the image to be spliced; and then correcting the corrected image to be spliced with Image registration is performed on the first image area; according to the image registration result, the image to be stitched in the corrected image is merged with the first image area to complete image stitching.
  • the terminal device needs to perform image correction processing on the image to be stitched.
  • image correction may be to perform barrel transformation on the image to be stitched. The main purpose of the transformation is to reduce the distortion of the stitched picture.
  • the terminal device needs to perform image registration on the corrected image to be stitched and the first image area.
  • the terminal device separately extracts feature points from the first image area in the image to be repaired and the image to be spliced, and then performs feature point matching to find the corresponding positions of the feature points in the image to be spliced in the first image area, and Determine the transformation relationship between the two images.
  • the terminal device performs image fusion on the area to be merged with the first image area in the corrected image to be stitched to complete image stitching.
  • the terminal device calculates each parameter value in the mathematical model according to the corresponding relationship between the image to be stitched and the first image region obtained in the image registration step, thereby establishing a mathematical transformation model of the two images.
  • the image to be spliced is converted into the coordinate system in the image of the first image area to complete the unified coordinate transformation.
  • the overlapping areas of the images to be stitched (that is, the first image area and the corresponding second image area in the image to be stitched) are fused to obtain a stitched and reconstructed smooth and seamless panoramic image.
  • the image area to be repaired in the image to be repaired by determining the image area to be repaired in the image to be repaired; selecting the first image area surrounding the image area to be repaired in the image to be repaired; selecting the target reference image from the reference image set, the target reference image There is a second image area matching the first image area; the second image area in the target reference image and the area surrounded by the second image area are used as a reference to repair the image area to be repaired.
  • a second image area that has a similarity to the first image area that reaches a threshold can be found through the first image area adjacent to the defective area in the image to be repaired, so as to utilize the image where the second image area is located To repair the image to be repaired.
  • FIG. 2 is a schematic flowchart of another image processing method provided by an embodiment of the present application. As shown in the figure, the method may include:
  • the terminal device starts the photo processing application, and displays the photo to be repaired selected by the user from the gallery on the screen of the terminal device.
  • the above photo processing application is an application that can repair photos.
  • the user when the user needs to repair a defective photo, the user can start the photo processing application on the terminal. Specifically, after the terminal device starts the photo processing application, the display interface of the photo processing application is displayed.
  • the above display interface includes a photo display area and a toolbar, and the toolbar includes an option to repair photos. Then, after receiving the user's instruction to open the photo to be repaired in the gallery, the terminal device displays the photo to be repaired on the photo display area of the photo processing application.
  • the terminal device receives the repair operation instruction for the above photo, and displays a selection frame of the image area to be repaired on the photo to be repaired.
  • the terminal device when the terminal device then displays the photo to be repaired in the photo display area of the photo processing application, after receiving the user clicks the photo repair option in the toolbar, the terminal device displays the repaired image area on the photo to be repaired A check box, so that the user can select the area to be repaired on the photo to be repaired by selecting the check box for the repaired image area.
  • the shape of the selection frame of the repaired image area is a rectangular frame.
  • the terminal device receives the operation instruction on the selection box of the image region to be repaired, and executes the operation corresponding to the operation instruction on the selection box of the image region to be repaired.
  • the operation instructions of the selection frame of the image area to be repaired include a drag operation instruction, a zoom-in operation instruction, a zoom-out operation instruction, a stretch operation instruction, a deformation operation instruction, and the like.
  • the terminal device After the terminal device receives the operation instruction of the selection frame of the image area to be repaired, the terminal device responds to the operation instruction and implements operations such as dragging, enlarging, reducing, stretching, and deforming the selection frame of the repaired image area.
  • the terminal device determines the image area to be repaired of the photo to be repaired according to the current position and size of the selection frame of the image area to be repaired.
  • the terminal device After using the terminal device to complete the user's operation instruction for the repair image area selection box, that is, after the user determines the defective area of the photo to be repaired through the repair image area selection box, the terminal device receives the confirmation instruction to repair the image area, the terminal device will The area selected by the frame of the image area to be repaired on the photo to be repaired is taken as the image area to be repaired.
  • the confirmation operation instruction may be a confirmation option that the user clicks on the screen, or a specific operation of the user on the repair image area selection box, such as double-clicking the repair image area selection box.
  • the terminal device determines the first image area surrounding the image area to be repaired according to the image area to be repaired.
  • the first image area is the same center as the image area to be repaired, and the length and width are areas where the length and width of the image area to be repaired are twice out of the partial area of the image area to be repaired, that is, the above
  • the first image area is an adjacent area surrounding the image area to be repaired.
  • the terminal device searches the gallery for a target reference photo that has a second image area matching the first image area according to the first image area.
  • the terminal device copies the image of the second image area and the image area surrounded by the second image area in the target reference photo as the image to be stitched.
  • the terminal device stitches the image to be spliced onto the graphics area where the first image area of the image to be repaired is located, so as to cover the image area to be repaired.
  • steps 206 to 208 reference may be made to the specific descriptions in steps 103 to 104 in the embodiment shown in FIG. 1, which will not be repeated here.
  • the photo to be repaired is selected from the terminal device, and the photo to be repaired is displayed on the screen of the terminal device, and then the image area to be repaired is determined by the image area to be repaired selection box, and according to the image to be repaired
  • the image area determines the first image area; then the target reference photo is determined from the gallery according to the image area to be repaired; finally, the image area to be repaired of the photo to be repaired is repaired according to the target reference photo.
  • a second image area that has a similarity to the first image area that reaches a threshold can be found through the first image area adjacent to the defective area in the photo to be repaired, so as to utilize the image where the second image area is located To repair the image to be repaired.
  • FIG. 3 is a schematic flowchart of yet another image processing method provided by an embodiment of the present application. As shown in the figure, the method may include:
  • the terminal device starts the photo processing application, and displays the photo to be repaired selected by the user from the gallery on the screen of the terminal device.
  • the above photo processing application is an application that can repair photos.
  • the user when the user needs to repair a defective photo, the user can start the photo processing application on the terminal. Specifically, after the terminal device starts the photo processing application, the display interface of the photo processing application is displayed. Then, after receiving the user's instruction to open the photo to be repaired in the gallery, the terminal device displays the photo to be repaired on the photo display area of the photo processing application.
  • the terminal device receives the repair type selection operation instruction, and determines the repair type of the photo to be repaired according to the repair type selection operation instruction.
  • the above display interface includes a photo display area and a toolbar
  • the toolbar includes a photo repair type selection option
  • the repair type selection options include portrait closed eye repair, blur area repair, shadow area repair, distortion area repair, designated Regional restoration, at least one of the group photo restoration.
  • the terminal device displays the photo to be repaired on the screen of the terminal device, it receives the repair type selection instruction input by the user in the toolbar, and the terminal device determines the above-mentioned to be repaired according to the repair type selection instruction The type of photo repair.
  • the terminal device then detects, according to the repair type, the image area to be repaired in which the defect corresponding to the repair type is present in the photo to be repaired.
  • the terminal device determines the repair type of the photo to be repaired, the terminal device detects whether the above defect exists in the photo to be repaired according to the defect corresponding to the repair type, and if so, determines the area where the defect is located It is the image area to be repaired above.
  • the terminal device determines the first image area surrounding the image area to be repaired according to the image area to be repaired.
  • the terminal device searches for a target reference photo in the second image area matching the first image area from the gallery according to the first image area.
  • the terminal device copies the image of the second image area and the image area surrounded by the second image area in the target reference photo as an image to be stitched.
  • the terminal device stitches the image to be spliced onto the graphics area where the first image area of the image to be repaired is located, so as to cover the image area to be repaired.
  • steps 304-307 reference may be made to the specific descriptions in steps 102-104 of the embodiment shown in FIG. 1, which will not be repeated here.
  • step 103 For this step, reference may be made to the specific description in step 103 of the embodiment shown in FIG. 1, and details are not described herein again.
  • the photos to be repaired are selected from the terminal device, and the photos to be repaired are displayed on the screen of the terminal device, and then the type of the photo to be repaired needs to be repaired, and the photo and repair are detected according to the repair type Defect area corresponding to the type, the defect area is determined as the image area to be repaired; then the first image area is determined according to the image area to be repaired, and the target reference photo is determined from the gallery according to the image area to be repaired; finally, the target photo is repaired according to the target reference photo Repair the image area of the photo to be repaired.
  • a second image area that has a similarity to the first image area that reaches a threshold can be found through the first image area adjacent to the defective area in the photo to be repaired, so as to utilize the image where the second image area is located To repair the image to be repaired.
  • FIG. 4 is a block diagram of a possible functional unit composition of a terminal device provided by an embodiment of the present application.
  • the terminal device includes: a first determining unit 410, a first selecting unit 420, and a second selecting unit 430 ⁇ Repair unit 440.
  • the first determining unit 410 is used to determine the image area to be repaired in the image to be repaired;
  • the first selection unit 420 is configured to select a first image area surrounding the image area to be repaired in the image to be repaired;
  • the second selecting unit 430 is configured to select a target reference image from the reference image set, and there is a second image area matching the first image area in the target reference image;
  • the repair unit 440 is configured to repair the image area to be repaired using the second image area and the area surrounded by the second image area in the target reference image as a reference.
  • the above terminal device further includes:
  • the receiving unit 450 is configured to receive the first repair type selected by the user from the preset repair types for the image to be repaired, the repair type includes closed-eye repair, blurred area repair, repair from the shadow area, and distortion deformation area repair, At least one of the repairs in the designated area and the collective photo repair;
  • the first determining unit 410 is configured to detect a defect area where a defect corresponding to the first repair type in the image to be repaired is located; and determine the defect area in the image to be repaired as the image area to be repaired .
  • the first determining unit 410 is configured to identify a user's selection operation on the image to be repaired; and determine an area corresponding to the selection operation as the image to be repaired region.
  • the second selection unit 430 includes:
  • the searching unit 431 is configured to search for the similar region with the highest similarity to the first image region from the reference image, and the boundary contour shape of the similar region and the first image region is the same;
  • the third determining unit 432 is configured to determine the reference image corresponding to the similar area as the target reference image and determine the similar area as the second image area if the similarity between the first image area and the similar area is greater than a threshold .
  • the third determining unit 422 is configured to determine whether the image area surrounded by the similar area is defective; if not, determine the reference image corresponding to the similar area as the target reference image and determine the similar area as the above The second image area.
  • the repair unit 440 includes:
  • the copying unit 441 is configured to copy the images of the second image area and the area surrounded by the second image area in the target reference image, and use the copied image as the image to be stitched;
  • the stitching unit 442 is configured to stitch the above-mentioned image to be spliced into the above-mentioned image to be repaired to cover the region of the image to be repaired.
  • the above-mentioned stitching unit 442 is specifically configured to perform image correction processing on the above-mentioned image to be stitched; perform image registration on the corrected image to be stitched with the above-mentioned first image area; After the image to be stitched is merged with one of the first image regions to complete the image stitching.
  • the steps 101 to 104, 201 to 208, and 301 to 307 involved in the image processing method shown in FIGS. 1, 2, and 3 may be performed by the terminal device shown in FIG. Various modules to execute.
  • the image area to be repaired in the image to be repaired by determining the image area to be repaired in the image to be repaired; selecting the first image area surrounding the image area to be repaired in the image to be repaired; selecting the target reference image from the reference image set, the target reference image There is a second image area matching the first image area; the second image area in the target reference image and the area surrounded by the second image area are used as a reference to repair the image area to be repaired.
  • a second image area that has a similarity to the first image area that reaches a threshold can be found through the first image area adjacent to the defective area in the image to be repaired, so as to utilize the image where the second image area is located To repair the image to be repaired.
  • FIG. 5 is a schematic block diagram of a terminal according to another embodiment of the present application.
  • the terminal in this embodiment may include: one or more processors 501; one or more input devices 502, one or more output devices 503, and a memory 504.
  • the processor 501, the input device 502, the output device 503, and the memory 504 are connected via a bus 505.
  • the memory 502 is used to store a computer program.
  • the computer program includes program instructions, and the processor 501 is used to execute the program instructions stored in the memory 502.
  • the processor 501 is configured to call the above program instructions to execute: determine the image area to be repaired in the image to be repaired; select the first image area surrounding the image area to be repaired in the image to be repaired; select the target from the reference image set Reference image, there is a second image area matching the first image area in the target reference image; the second image area in the target reference image and the area surrounded by the second image area are used as references to repair the to-be-repaired Image area.
  • the so-called processor 501 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP) , Application Specific Integrated Circuit (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the input device 502 may include a touchpad, a fingerprint sensor (for collecting user's fingerprint information and fingerprint direction information), a microphone, etc.
  • the output device 503 may include a display (LCD, etc.), a speaker, and the like.
  • the memory 504 may include a read-only memory and a random access memory, and provide instructions and data to the processor 501.
  • a portion of storage 504 may also include non-volatile random access memory.
  • the memory 504 may also store device type information.
  • the processor 501, the input device 502, and the output device 503 described in the embodiments of the present application may execute the first and second embodiments of an image processing method provided in the embodiments of the present application.
  • the implementation manner can also implement the implementation manner of the terminal described in the embodiments of the present application, which will not be repeated here.
  • a computer non-volatile readable storage medium stores a computer program.
  • the computer program includes program instructions.
  • the program instructions are processed by a processor. Achieved during execution: determining the image area to be repaired in the image to be repaired; selecting the first image area surrounding the image area to be repaired in the image to be repaired; selecting the target reference image from the reference image set The second image area matching the first image area; using the second image area in the target reference image and the area surrounded by the second image area as a reference to repair the image area to be repaired.
  • the non-volatile computer-readable storage medium may be the internal storage unit of the terminal described in any of the foregoing embodiments, such as the hard disk or the memory of the terminal.
  • the non-volatile computer-readable storage medium may also be an external storage device of the terminal, such as a plug-in hard disk equipped on the terminal, a smart memory card (Smart Media, Card, SMC), and secure digital (SD) Cards, flash cards, etc.
  • the computer non-volatile readable storage medium may also include both the internal storage unit of the terminal and the external storage device.
  • the computer non-volatile readable storage medium is used to store the computer program and other programs and data required by the terminal.
  • the computer non-volatile readable storage medium may also be used to temporarily store data that has been output or will be output.
  • the disclosed terminal device and method may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the above-mentioned units is only a division of logical functions.
  • there may be other division modes for example, multiple units or components may be combined or may Integration into another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual couplings or direct couplings or communication connections may be indirect couplings or communication connections through some interfaces, devices, or units, and may also be electrical, mechanical, or other forms of connection.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments of the present application.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or software function unit.
  • the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
  • the technical solution of the present application essentially or part of the contribution to the existing technology, or all or part of the technical solution can be embodied in the form of a software product
  • the computer software product is stored in a storage medium
  • several instructions are included to enable 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 above methods in various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code .

Landscapes

  • Image Processing (AREA)

Abstract

An image processing method, a terminal apparatus, and a computer readable medium, pertaining to image match processing. The method comprises: determining an image region to be repaired in an image to be repaired (101); selecting a first image region surrounding the image region to be repaired from the image (102); selecting a target reference image from a reference image set, the target reference image containing a second image region matching the first image region (103); and repairing the image region to be repaired by using the second image region and a region surrounded by the second image region in the target reference image as a reference (104). In the method, the first image region neighboring a defective region in the image to be repaired is used to search for a second image region having a similarity level to the first image region that reaches a threshold; and accordingly, the image is repaired by using the image containing the second image region.

Description

一种图像处理方法、终端设备及计算机可读介质Image processing method, terminal equipment and computer readable medium
本申请要求于2019年1月4日提交中国专利局、申请号为201910013962.3、申请名称为“一种图像处理方法、终端设备及计算机可读介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of the Chinese patent application submitted to the China Patent Office on January 4, 2019, with the application number of 201910013962.3 and the application name of "An Image Processing Method, Terminal Equipment, and Computer-readable Medium". The reference is incorporated in this application.
技术领域Technical field
本申请涉及图像处理技术领域,尤其涉及一种图像处理方法、终端设备及计算机可读介质。The present application relates to the field of image processing technology, and in particular, to an image processing method, terminal device, and computer-readable medium.
背景技术Background technique
随着智能终端技术的不断发展,智能终端越来越个性化和人性化。在日常生活中,用户经常使用智能终端来进行拍摄,且智能终端的拍照功能也越来越智能化和人性化。但是用户在使用智能终端拍照时,常常会因为各种原因(例如终端抖动,拍摄对象眨眼等因素)而导致拍出来的照片存在缺陷(例如闭眼、模糊等)。目前常用的解决方案是采用连拍的方式来解决上述问题,然后从多找连拍的照片汇总选取一张最好的照片保留。With the continuous development of smart terminal technology, smart terminals are becoming more and more personalized and humanized. In daily life, users often use smart terminals to shoot, and the camera function of smart terminals is becoming more and more intelligent and humanized. However, when taking pictures with a smart terminal, users often have defects (such as closed eyes, blurry, etc.) due to various reasons (such as terminal shaking, subject blinking, etc.). At present, the commonly used solution is to use continuous shooting to solve the above problems, and then select one of the best photos from the summary of more continuous shooting photos.
但是在连拍的过程中,连拍出来的照片可能都存在缺陷,只是存在的缺陷区域不同。因此,如何快速有效处理照片的缺陷是目前待解决的问题。However, in the continuous shooting process, all the photos taken continuously may have defects, but the defect areas are different. Therefore, how to deal with the defects of photos quickly and effectively is a problem to be solved at present.
发明内容Summary of the invention
本申请实施例提供一种图像处理方法,可快速有效的修复照片中的缺陷。Embodiments of the present application provide an image processing method that can quickly and effectively repair defects in photos.
第一方面,本申请实施例提供了一种图像处理方法,该方法包括:In a first aspect, an embodiment of the present application provides an image processing method. The method includes:
确定待修复图像中的待修复图像区域;Determine the image area to be repaired in the image to be repaired;
选取上述待修复图像中包围所述待修复图像区域的第一图像区域;Selecting the first image area surrounding the image area to be repaired in the image to be repaired;
从参考图像集中选取目标参考图像,所述目标参考图像中存在与所述第一图像区域匹配的第二图像区域;Selecting a target reference image from the reference image set, where a second image area matching the first image area exists in the target reference image;
以所述目标参考图像中第二图像区域及被所述第二图像区域包围的区域为参考,修复所述待修复图像区域。Using the second image area in the target reference image and the area surrounded by the second image area as references, the image area to be repaired is repaired.
第二方面,本申请实施例提供了一种终端设备,该终端设备包括用于执行上述第一方面的方法的单元。In a second aspect, an embodiment of the present application provides a terminal device. The terminal device includes a unit for performing the method of the first aspect.
第三方面,本申请实施例提供了另一种终端设备,包括处理器、输入设备、 输出设备和存储器,所述处理器、输入设备、输出设备和存储器相互连接,其中,所述存储器用于存储支持终端设备执行上述方法的计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行上述第一方面的方法。In a third aspect, an embodiment of the present application provides another terminal device, including a processor, an input device, an output device, and a memory, where the processor, input device, output device, and memory are connected to each other, wherein the memory is used for A computer program supporting the terminal device to execute the above method is stored, the computer program includes program instructions, and the processor is configured to call the program instructions to perform the method of the first aspect.
第四方面,本申请实施例提供了一种计算机非易失性可读存储介质,所述计算机存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行上述第一方面的方法。According to a fourth aspect, an embodiment of the present application provides a computer non-volatile readable storage medium, the computer storage medium stores a computer program, the computer program includes program instructions, and the program instructions when executed by a processor Causing the processor to perform the method of the first aspect described above.
在本申请实施例中,可以通过待修复图像中与缺陷区域的邻近的第一图像区域来寻找与该第一图像区域相似度达到阈值的第二图像区域,从而利用第二图像区域所在的图像来修复待修复图像。In an embodiment of the present application, a second image area that has a similarity to the first image area that reaches a threshold can be found through the first image area adjacent to the defective area in the image to be repaired, so as to utilize the image where the second image area is located To repair the image to be repaired.
附图说明BRIEF DESCRIPTION
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍。In order to explain the technical solutions of the embodiments of the present application more clearly, the drawings required in the description of the embodiments will be briefly introduced below.
图1是本申请实施例提供一种图像处理方法的示意流程图;1 is a schematic flowchart of an image processing method provided by an embodiment of the present application;
图2是本申请实施例提供的另一种图像处理方法的示意流程图;2 is a schematic flowchart of another image processing method provided by an embodiment of the present application;
图3是本申请实施例提供的又一种图像处理方法的示意流程图;3 is a schematic flowchart of yet another image processing method provided by an embodiment of the present application;
图4是本申请实施例提供的一种终端设备的一种可能的功能单元组成框图;4 is a block diagram of a possible functional unit of a terminal device provided by an embodiment of the present application;
图5是本申请另一实施例提供的一种终端示意框图。FIG. 5 is a schematic block diagram of a terminal according to another embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and the appended claims, the terms "including" and "comprising" indicate the presence of described features, wholes, steps, operations, elements, and/or components, but do not exclude one or The presence or addition of multiple other features, wholes, steps, operations, elements, components, and/or collections thereof.
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施 例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should also be understood that the terminology used in the description of this application is for the purpose of describing particular embodiments only and is not intended to limit this application. As used in the specification of the present application and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should also be further understood that the term "and/or" used in the specification of the present application and the appended claims refers to any and all possible combinations of one or more of the associated listed items and includes these combinations .
如在本说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "once" or "in response to determination" or "in response to detection" depending on the context . Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted in the context to mean "once determined" or "in response to a determination" or "once detected [described condition or event ]" or "In response to detection of [the described condition or event]".
具体实现中,本申请实施例中描述的终端设备包括但不限于诸如具有触摸敏感表面(例如,触摸屏显示器和/或触摸板)的移动电话、膝上型计算机或平板计算机之类的其它便携式设备。还应当理解的是,在某些实施例中,所述设备并非便携式通信设备,而是具有触摸敏感表面(例如,触摸屏显示器和/或触摸板)的台式计算机。In a specific implementation, the terminal devices described in the embodiments of the present application include but are not limited to other portable devices such as mobile phones, laptop computers, or tablet computers with touch-sensitive surfaces (eg, touch screen displays and/or touch pads) . It should also be understood that, in some embodiments, the device is not a portable communication device, but a desktop computer with a touch-sensitive surface (eg, touch screen display and/or touch pad).
在接下来的讨论中,描述了包括显示器和触摸敏感表面的终端设备。然而,应当理解的是,终端设备可以包括诸如物理键盘、鼠标和/或控制杆的一个或多个其它物理用户接口设备。In the discussion that follows, terminal devices including displays and touch-sensitive surfaces are described. However, it should be understood that the terminal device may include one or more other physical user interface devices such as a physical keyboard, mouse, and/or joystick.
终端设备支持各种应用程序,例如以下中的一个或多个:绘图应用程序、演示应用程序、文字处理应用程序、网站创建应用程序、盘刻录应用程序、电子表格应用程序、游戏应用程序、电话应用程序、视频会议应用程序、电子邮件应用程序、即时消息收发应用程序、锻炼支持应用程序、图像管理应用程序、数码相机应用程序、数字摄影机应用程序、web浏览应用程序、数字音乐播放器应用程序和/或数字视频播放器应用程序。The terminal device supports various applications, such as one or more of the following: drawing applications, presentation applications, word processing applications, website creation applications, disk burning applications, spreadsheet applications, game applications, phones Applications, video conferencing applications, email applications, instant messaging applications, exercise support applications, image management applications, digital camera applications, digital camera applications, web browsing applications, digital music player applications And/or digital video player applications.
可以在终端设备上执行的各种应用程序可以使用诸如触摸敏感表面的至少一个公共物理用户接口设备。可以在应用程序之间和/或相应应用程序内调整和/或改变触摸敏感表面的一个或多个功能以及终端设备上显示的相应信息。这样,终端设备的公共物理架构(例如,触摸敏感表面)可以支持具有对用户而言直观且透明的用户界面的各种应用程序。Various applications that can be executed on the terminal device can use at least one common physical user interface device such as a touch-sensitive surface. One or more functions of the touch-sensitive surface and corresponding information displayed on the terminal device may be adjusted and/or changed between applications and/or within the corresponding applications. In this way, the common physical architecture of the terminal device (eg, touch-sensitive surface) can support various applications with a user interface that is intuitive and transparent to the user.
参见图1,图1是本申请实施例提供一种图像处理方法的示意流程图,如图所示方法可包括:Referring to FIG. 1, FIG. 1 is a schematic flowchart of an image processing method according to an embodiment of the present application. As shown in the figure, the method may include:
101:终端设备获取待修复图像,确定待修复图像中的待修复图像区域。101: The terminal device acquires the image to be repaired, and determines the area of the image to be repaired in the image to be repaired.
本申请实施例中,终端设备可以包括移动手机、平板电脑、个人数字助理(Personal Digital Assistant,PDA)、移动互联网设备(Mobile Internet Device,MID)等各种终端设备,本申请实施例不作限定。In the embodiments of the present application, the terminal devices may include various terminal devices such as mobile phones, tablet computers, personal digital assistants (Personal Digital Assistant (PDA), mobile Internet devices (MID), etc., and the embodiments of the present application are not limited.
其中,上述待修复图像可以为用户从终端设备中选取的存在某种缺陷需要修复的照片,也可以是从互联网上下载的存在某种缺陷的图片。上述待修复图像区域可以是用户手段选择需要修复的区域,也可以是终端设备根据预设的修复类型来检测图像中是否存在修复类型对应的缺陷;当检测到缺陷后,将缺陷所在的区域确定为上述待修复图像区域,其中上述待修复图像区域可以是规则的集合图像包括的图像区域,也可以是不规则的封闭曲线包括的图像区域,即只包含缺陷区域。The above-mentioned image to be repaired may be a photo selected by the user from the terminal device that needs to be repaired with a certain defect, or may be a picture downloaded from the Internet with a certain defect. The image area to be repaired may be an area selected by the user to be repaired, or the terminal device may detect whether a defect corresponding to the repair type exists in the image according to a preset repair type; when a defect is detected, the area where the defect is located is determined It is the above-mentioned image area to be repaired, wherein the above-mentioned image area to be repaired may be an image area included in a regular set image, or may be an image area included in an irregular closed curve, that is, contains only a defective area.
作为一种可选的实施方式,当用户从图库中选取了待修复的图像之后,终端设备将待修复的图像显示在终端设备的屏幕上,用户可以从图像旁边的工具栏中选择图像修复工具,当终端设备接收到用户点击图像修复工具的操作后,终端设备则在待修复的图像上显示修复图像区域选取框。然后终端设备接收用户对上述修复图像区域选取框的操作指令,并完成上述操作指令对应的的操作。接着用户终端在接收到确认操作指令之后,将上述修复图像区域选取框中的图像区域确定为上述待修复图像区域。As an optional embodiment, after the user selects the image to be repaired from the gallery, the terminal device displays the image to be repaired on the screen of the terminal device, and the user can select the image repair tool from the toolbar next to the image After the terminal device receives the operation of the user clicking the image repair tool, the terminal device displays a repair image area selection box on the image to be repaired. Then, the terminal device receives the user's operation instruction on the above-mentioned repair image area selection frame, and completes the operation corresponding to the above operation instruction. Then, after receiving the confirmation operation instruction, the user terminal determines the image area in the repair image area selection frame as the image area to be repaired.
其中,上述用户对上述修复图像区域选取框的操作指令可以包括拖动操作指令、放大操作指令、缩小操作指令、拉伸操作指令、变形操作指令等。上述确认操作指令可以是用户点击屏幕上的确认选项,也可以是用户对上述修复图像区域选取框的特定操作,例如双击上述修复图像区域选取框。Wherein, the operation instructions of the user on the selection frame of the repaired image area may include a drag operation instruction, a zoom-in operation instruction, a zoom-out operation instruction, a stretch operation instruction, a deformation operation instruction, and the like. The confirmation operation instruction may be a confirmation option that the user clicks on the screen, or a specific operation of the user on the repair image area selection box, for example, double-clicking the repair image area selection box.
作为另一种可选的实施方式,当终端设备显示上述待修复的图像之后,终端设备接收用户从预设的修复类型中选择的第一修复类型,然后终端设备根据第一修复类型来自动检测上述待修复图像中是否存在第一修复类型对应的缺陷,若存在,则将缺陷所在的区域确定为上述待修复图像区域。其中,上述修复类型可以包括人像闭眼修复、模糊区域修复、从影区域修复、扭曲变形区域修复、指定区域修复,集体合照修复中的至少一项。As another optional embodiment, after the terminal device displays the image to be repaired, the terminal device receives the first repair type selected by the user from the preset repair types, and then the terminal device automatically detects the first repair type according to the first repair type Whether there is a defect corresponding to the first repair type in the image to be repaired, and if so, the area where the defect is located is determined to be the image area to be repaired. Wherein, the above-mentioned repair types may include at least one of portrait closed-eye repair, blurry area repair, shadow area repair, distortion area repair, designated area repair, and group photo repair.
102:终端设备选取上述待修复图像中包围上述待修复图像区域的第一图像区域。102: The terminal device selects the first image area surrounding the image area to be repaired among the image to be repaired.
在本申请实施例中,当终端设备确定了上述待修复图像中的待修复图像区域之后,终端设备自动根据上述待修复图像区域从上述待修复图像中确定一个 包围上述待修复图像区域的第一图像区域,以便可以根据上述第一图像区域搜索到与上述第一图像区域相同或相似的第二图像区域,从而利用第二图像区域以及被所述第二图像区域包围的区域来修复上述待修复图像区域。In the embodiment of the present application, after the terminal device determines the image area to be repaired in the image to be repaired, the terminal device automatically determines a first surrounding the image area to be repaired from the image to be repaired according to the image area to be repaired An image area, so that a second image area that is the same as or similar to the first image area can be searched for based on the first image area, so that the second image area and the area surrounded by the second image area can be used to repair the to-be-repaired Image area.
作为一种可选的实施方式,当终端设备确定了上述待修复图像中的待修复图像区域之后,终端设备计算上述待修复图像区域的最大辐射半径,然后根据上述待修复图像区域的最大辐射半径确定上述第一图像区域在上述待修复图像中的位置。具体的,第一图像区域和待修复图像区域的位置关系可以是:待修复图像区域的最大辐射半径为R,则上述第一图像区域可以选取以上述待修复图像区域中心为圆心,2R为半径的圆形区域中除去上述待修复图像区域所在的区域;第一图像区域和待修复图像区域的位置关系还可以是:待修复图像区域的最大辐射半径为R,上述第一图像区域选取以上述待修复图像区域中心为中心,四边距离中心位置2R的正方形的区域中除去上述待修复图像区域所在的区域。As an optional embodiment, after the terminal device determines the image area to be repaired in the image to be repaired, the terminal device calculates the maximum radiation radius of the image area to be repaired, and then according to the maximum radiation radius of the image area to be repaired Determine the position of the first image area in the image to be repaired. Specifically, the positional relationship between the first image area and the image area to be repaired may be: the maximum radiation radius of the image area to be repaired is R, then the first image area may be selected with the center of the image area to be repaired as the center of the circle and 2R as the radius Remove the area where the image area to be repaired is located in the circular area; the positional relationship between the first image area and the image area to be repaired may also be: the maximum radiation radius of the image area to be repaired is R, and the first image area is selected as described above The center of the image area to be repaired is taken as the center, and the area where the image area to be repaired is located is removed from the area of the square whose four sides are 2R away from the center.
可以理解的是,上述第一图像区域的形状还可以是除图3中所示的其他大小或形状,只需要满足该第一图像区域包围上述待修复图像区域即可。It can be understood that the shape of the first image area may be other sizes or shapes than those shown in FIG. 3, and only needs to satisfy that the first image area surrounds the image area to be repaired.
103:终端设备从参考图像集中选取目标参考图像,上述目标参考图像中存在与上述第一图像区域匹配的第二图像区域。103: The terminal device selects a target reference image from the reference image set, and there is a second image area matching the first image area in the target reference image.
其中,上述参考图像集可以是终端设备的图库中存在的图片;也可以是终端设备根据上述待修复图像从终端设备中选择的或从互联网上下载的满足预设条件的图片,例如上述待修复图像为照片时,上述参考图像集可以是与待修复的照片在同一时间段拍摄的照片,也可以是与待修复的照片具有相同背景的照片(例如与上述待修复照片一起连拍的照片),还可以是用户手动从终端设备图库中选择的图片。The above-mentioned reference image set may be a picture existing in the gallery of the terminal device; or may be a picture that the terminal device selects from the terminal device according to the above-mentioned image to be repaired or downloaded from the Internet that meets the preset conditions, such as the above-mentioned to-be-repaired When the image is a photo, the above reference image set may be a photo taken at the same time period as the photo to be repaired, or a photo with the same background as the photo to be repaired (for example, photos taken continuously with the photo to be repaired) , Can also be a picture manually selected by the user from the terminal device gallery.
在本申请实施例中,当终端设备确定了上述第一图像区域之后,终端设备便根据上述第一图像区域从参考图像集中搜索存在与上述第一图像区域向匹配的第二图像区域的目标参考图像,以便利用上述目标参考图像来修复上述待修复图像。其中,上述第一图像区域与第二图像区域匹配可以是第一图像区域与第二图像区域相同或者第一图像区域与第二图像区域的相似度大于阈值。此外,上述第一图像区域与第二图像区域的边界轮廓形状相同,上述第一图像区域与第二图像区域的边界轮廓的大小可以相同也可以不同,即第二图形区域可以是第一图像区域的放大或缩小版。In the embodiment of the present application, after the terminal device determines the first image area, the terminal device searches for a target reference with a second image area matching the first image area from the reference image set according to the first image area Image to use the target reference image to repair the image to be repaired. The matching between the first image area and the second image area may be that the first image area and the second image area are the same or the similarity between the first image area and the second image area is greater than the threshold. In addition, the shape of the border outline of the first image area and the second image area are the same, and the size of the border outline of the first image area and the second image area may be the same or different, that is, the second graphics area may be the first image area The enlarged or reduced version of.
作为一种可选的实施方式,终端设备可以将上述第一图像区域的图像作为模板图像,然后依次对上述参考图像集中的每张图像和上述模板图像进行匹配。 匹配时,首先分别提取模板图像和待匹配的参考图像中的特征点,然后对上述模板图像和待匹配的参考图像中的特征点进行匹配,接着通过匹配的特征点来判断待匹配的参考图像中是否存在与模板图像相似的区域,若存在,则计算模板图像与待匹配图像中与模板图像相似的相似区域的相似度,若相似度大于阈值,则将该待匹配图像作为上述目标参考图像,将上述相似区域作为上述第二图像区域。As an optional implementation manner, the terminal device may use the image of the first image area as a template image, and then sequentially match each image in the reference image set with the template image. When matching, first extract the feature points in the template image and the reference image to be matched, and then match the feature points in the template image and the reference image to be matched, and then determine the reference image to be matched by the matched feature points Whether there is an area similar to the template image in the image, if it exists, the similarity between the template image and the similar area similar to the template image in the image to be matched is calculated, and if the similarity is greater than the threshold, the image to be matched is used as the target reference image , The aforementioned similar area is used as the aforementioned second image area.
作为一种可选的实施方式,在上述确定了第一图像区域与相似区域的相似度大于阈值后,终端设备确定上述相似区域包围的图像区域是否存在缺陷,若确定上述相似区域包围的图像区域不存在缺陷,则将上述相似区域确定为上述第二图像区域,将上述相似区域对应的参考图像确定为上述目标参考图像。As an optional implementation manner, after determining that the similarity between the first image area and the similar area is greater than the threshold, the terminal device determines whether the image area surrounded by the similar area is defective, and if the image area surrounded by the similar area is determined If there is no defect, the similar area is determined as the second image area, and the reference image corresponding to the similar area is determined as the target reference image.
进一步的,在上述从参考图像集中搜索与模板图形匹配的图像区域的过程中,可能会从上述参考图像集中搜索出张或两张以上的参考图像满足存在与上述模板图像相似的图像区域且相似度大于阈值。在上述情况下,为了使得后续图像修复的效果更好,当终端设备从参考图像集中监测到两张或两张以上的参考图像满足上述目标参考图像的条件,则终端设备选择其中相似度最大的参考图像作为最终用来修复待修复图像的目标参考图像。其中,这里的相似度是指模板图像与参考图像中的相似区域的相似度。Further, in the above process of searching the image area matching the template image from the reference image set, one or more reference images may be searched from the reference image set to satisfy the existence and similarity of the image area similar to the template image Degree is greater than the threshold. In the above case, in order to make the effect of subsequent image restoration better, when the terminal device monitors two or more reference images from the reference image set to meet the above target reference image conditions, the terminal device selects the one with the largest similarity The reference image serves as the target reference image that is ultimately used to repair the image to be repaired. Here, the similarity here refers to the similarity of the similar area in the template image and the reference image.
作为一种可选的实施方式,在上述使用第一图像区域的图像作为模板图像从上述参考图像集中匹配相似区域时,可能会应为第一图像区域的图像范围太小,提取的特征图像点太少,导致参考图像集中的所有参考图像集中都没有与上述模板图像匹配的相似区域时,则终端设备按照预设条件扩大上述第一图像区域的范围(例如将上述第一图像区域扩大至原来的一倍),然后继续执行上述103步骤。As an optional implementation manner, when the above image using the first image region as a template image matches similar regions from the above reference image set, it may be that the image range of the first image region is too small and the extracted feature image points If there are too few results in all reference image sets in the reference image set that have no similar areas matching the template image, the terminal device expands the range of the first image area according to preset conditions (for example, expanding the first image area to the original Twice), and then continue to perform the above 103 steps.
104:终端设备以上述目标参考图像中第二图像区域及被所述第二图像区域包围的区域为参考,修复上述待修复图像区域。104: The terminal device uses the second image area in the target reference image and the area surrounded by the second image area as references to repair the image area to be repaired.
在本申请实施例中,当终端设备确定了目标参考图像之后,该目标参考图像中存在与上述第一图像区域匹配的第二图像区域,终端设备则根据上述目标参考图像中的第二图像区域以及第二图像区域包围的图像区域对上述待修复图像中的待修复图像区域进行修复。In the embodiment of the present application, after the terminal device determines the target reference image, there is a second image area matching the above-mentioned first image area in the target reference image, and the terminal device according to the second image area in the target reference image And the image area surrounded by the second image area repairs the image area to be repaired in the image to be repaired.
作为一种可选的实施方式,当上述目标参考图像中的第二图像区域与上述待修复图像中的第一图像区域边界轮廓大小一样时,终端设备直接将上述目标参考图像中的第二图像区域以及第二图像区域包围的图像区域的图像复制之后 作为待拼接图像,然后将带待拼接图像拼接到上述待修复图像的第一图像区域之上,使得上述目标参考图像中的第二图像区域以及第二图像区域包围的图像区域的图像覆盖待修复图像上的第一图像区域以及待修复图像区域。As an optional implementation, when the second image area in the target reference image is the same as the boundary outline size of the first image area in the image to be repaired, the terminal device directly sets the second image in the target reference image The image of the image area surrounded by the area and the second image area is copied as the image to be stitched, and then the image with the stitching is spliced onto the first image area of the image to be repaired, so that the second image area in the target reference image And the image of the image area surrounded by the second image area covers the first image area and the image area to be repaired on the image to be repaired.
作为另一种可选的实施方式,当上述目标参考图像中的第二图像区域与上述待修复图相中的第一图形区域的边界轮廓大小不同时,即第二图像区域的图像可能与上述第一图像区域的图像的放大或缩小版相似,则终端设备需在复制上述目标参考图像中的第二图像区域以及第二图像区域包围的图像区域的图像之后,需要将上述复制后的图像处理成和上述第一图像区域的外边界大小相同的图像作为待拼接图像,然后将带待拼接图像拼接到上述待修复图像的第一图像区域之上,使得上述目标参考图像中的第二图像区域以及第二图像区域包围的图像区域的图像覆盖待修复图像上的第一图像区域以及待修复图像区域。As another optional embodiment, when the boundary contour size of the second image area in the target reference image and the first graphic area in the phase to be repaired is different, that is, the image of the second image area may be different from the above If the enlarged or reduced version of the image of the first image area is similar, the terminal device needs to process the copied image after copying the second image area in the target reference image and the image area surrounded by the second image area Create an image with the same size as the outer boundary of the first image area as the image to be stitched, and then stitch the image to be stitched onto the first image area of the image to be repaired, so that the second image area in the target reference image And the image of the image area surrounded by the second image area covers the first image area and the image area to be repaired on the image to be repaired.
图像拼接技术主要分为三个主要步骤:图像预处理、图像配准、图像融合与边界平滑,图像预处理主要指对图像进行几何畸变校正和噪声点的抑制等,让参考图像和待拼接图像不存在明显的几何畸变。在图像质量不理想的情况下进行图像拼接,如果不经过图像预处理,很容易造成一些误匹配。Image stitching technology is mainly divided into three main steps: image preprocessing, image registration, image fusion and boundary smoothing. Image preprocessing mainly refers to geometric distortion correction and noise point suppression on the image, so that the reference image and the image to be stitched There is no obvious geometric distortion. If the image quality is not ideal, the image stitching can easily cause some mismatches if the image is not preprocessed.
图像预处理主要是为下一步图像配准做准备,让图像质量能够满足图像配准的要求。图像配准主要指对参考图像和待拼接图像中的匹配信息进行提取,在提取出的信息中寻找最佳的匹配,完成图像间的对齐。Image preprocessing is mainly to prepare for the next image registration, so that the image quality can meet the requirements of image registration. Image registration mainly refers to extracting the matching information in the reference image and the image to be stitched, finding the best match in the extracted information, and completing the alignment between the images.
图像拼接的成功与否主要是图像的配准。待拼接的图像之间,可能存在平移、旋转、缩放等多种变换或者大面积的同色区域等很难匹配的情况,一个好的图像配准算法应该能够在各种情况下准确找到图像间的对应信息,将图像对齐。The success of image stitching is mainly the registration of images. Between the images to be stitched, there may be multiple transformations such as translation, rotation, scaling, or large areas of the same color area that are difficult to match. A good image registration algorithm should be able to accurately find the inter-image Corresponding information, align the image.
图像融合指在完成图像匹配以后,对图像进行缝合,并对缝合的边界进行平滑处理,让缝合自然过渡。由于任何两幅相邻图像在采集条件上都不可能做到完全相同,因此,对于一些本应该相同的图像特性,如图像的光照特性等,在两幅图像中就不会表现的完全一样。图像拼接缝隙就是从一幅图像的图像区域过渡到另一幅图像的图像区域时,由于图像中的某些相关特性发生了跃变而产生的。图像融合就是为了让图像间的拼接缝隙不明显,拼接更自然。Image fusion refers to stitching the image after the image matching is completed, and smoothing the stitched boundary to let the stitching transition naturally. Since the acquisition conditions of any two adjacent images cannot be exactly the same, for some image characteristics that should be the same, such as the illumination characteristics of the image, the two images will not behave exactly the same. The image stitching gap is caused by the transition of some relevant characteristics in the image when it transitions from the image area of one image to the image area of another image. The purpose of image fusion is to make the stitching gap between the images less obvious and the stitching more natural.
因此,在本申请实施例中,上述将待拼接图像拼接到上述待修复图像的第一图像区域上可以包括:终端设备对上述待拼接图像进行图像矫正处理;然后将矫正后的待拼接图像与上述第一图像区域进行图像配准;根据上述图像配准结果将上述将矫正后的待拼接图像中与上述第一图像区域对一个的区域进行图 像融合完成图像的拼接。Therefore, in the embodiment of the present application, the splicing of the image to be spliced onto the first image area of the image to be repaired may include: the terminal device performing image correction processing on the image to be spliced; and then correcting the corrected image to be spliced with Image registration is performed on the first image area; according to the image registration result, the image to be stitched in the corrected image is merged with the first image area to complete image stitching.
首先,终端设备需要对上述待拼接的图像进行图像矫正处理。在图像形成时,当照相系统的镜头或者照相装置没有正对着待拍摄的景物时候,那么拍摄到的景物图像就会产生一定的变形。这是几何畸变最常见的情况。另外,由于光学成像系统或电子扫描系统的限制而产生的枕形或桶形失真,也是几何畸变的典型情况。几何畸变会给图像拼接造成很大的问题,原本在两幅图像中相同的物体会因为畸变而变得不匹配,这会给图像的配准带来很大的问题。因此,解决几何畸变的问题显得很重要。在本申请实施例中,图象校正的可以是对上述待拼接的图像进行桶形变换处理,改变换的主要目的是为了减少拼接后图片的畸变。First, the terminal device needs to perform image correction processing on the image to be stitched. When the image is formed, when the lens or camera of the camera system is not directly facing the scene to be photographed, then the scene image captured will be deformed to some extent. This is the most common case of geometric distortion. In addition, pincushion or barrel distortion caused by the limitation of optical imaging system or electronic scanning system is also a typical case of geometric distortion. Geometric distortion will cause great problems for image stitching. Originally the same objects in two images will become mismatched due to distortion, which will cause great problems for image registration. Therefore, it is very important to solve the problem of geometric distortion. In the embodiment of the present application, the image correction may be to perform barrel transformation on the image to be stitched. The main purpose of the transformation is to reduce the distortion of the stitched picture.
然后,终端设备需要对上述矫正后的待拼接图像与上述第一图像区域进行图像配准。终端设备分别对上述待修复图像中的第一图像区域和待拼接图像进行特征点提取,然后进行特征点匹配以找出待拼接图像中的特征点在上述第一图像区域中对应的位置,进而确定两幅图像之间的变换关系。Then, the terminal device needs to perform image registration on the corrected image to be stitched and the first image area. The terminal device separately extracts feature points from the first image area in the image to be repaired and the image to be spliced, and then performs feature point matching to find the corresponding positions of the feature points in the image to be spliced in the first image area, and Determine the transformation relationship between the two images.
最后,终端设备根据上述图像配准结果将上述将矫正后的待拼接图像中与上述第一图像区域对一个的区域进行图像融合完成图像的拼接。终端设备根据上述图像配准步骤中得到的待拼接图像与第一图像区域对应的关系,计算出数学模型中的各参数值,从而建立两幅图像的数学变换模型。然后根据建立的数学转换模型,将待拼接图像转换到第一图像区域的图像中的坐标系中,完成统一坐标变换。最后,将待拼接图像的重合区域(即第一图像区域和待拼接图像中对应的第二图像区域)进行融合得到拼接重构的平滑无缝全景图像。Finally, according to the image registration result, the terminal device performs image fusion on the area to be merged with the first image area in the corrected image to be stitched to complete image stitching. The terminal device calculates each parameter value in the mathematical model according to the corresponding relationship between the image to be stitched and the first image region obtained in the image registration step, thereby establishing a mathematical transformation model of the two images. Then, according to the established mathematical conversion model, the image to be spliced is converted into the coordinate system in the image of the first image area to complete the unified coordinate transformation. Finally, the overlapping areas of the images to be stitched (that is, the first image area and the corresponding second image area in the image to be stitched) are fused to obtain a stitched and reconstructed smooth and seamless panoramic image.
在本申请实施例中,通过确定待修复图像中的待修复图像区域;选取上述待修复图像中包围上述待修复图像区域的第一图像区域;从参考图像集中选取目标参考图像,上述目标参考图像中存在与上述第一图像区域匹配的第二图像区域;以上述目标参考图像中第二图像区域及被所述第二图像区域包围的区域为参考,修复上述待修复图像区域。在本申请实施例中,可以通过待修复图像中与缺陷区域的邻近的第一图像区域来寻找与该第一图像区域相似度达到阈值的第二图像区域,从而利用第二图像区域所在的图像来修复待修复图像。In the embodiment of the present application, by determining the image area to be repaired in the image to be repaired; selecting the first image area surrounding the image area to be repaired in the image to be repaired; selecting the target reference image from the reference image set, the target reference image There is a second image area matching the first image area; the second image area in the target reference image and the area surrounded by the second image area are used as a reference to repair the image area to be repaired. In an embodiment of the present application, a second image area that has a similarity to the first image area that reaches a threshold can be found through the first image area adjacent to the defective area in the image to be repaired, so as to utilize the image where the second image area is located To repair the image to be repaired.
参见图2,图2是本申请实施例提供的另一种图像处理方法的示意流程图,如图所示该方法可包括:Referring to FIG. 2, FIG. 2 is a schematic flowchart of another image processing method provided by an embodiment of the present application. As shown in the figure, the method may include:
201:终端设备启动照片处理应用,将用户从图库中选择的待修复照片显示在终端设备的屏幕上。201: The terminal device starts the photo processing application, and displays the photo to be repaired selected by the user from the gallery on the screen of the terminal device.
其中,上述照片处理应用为能够对照片进行修复的应用。Among them, the above photo processing application is an application that can repair photos.
在本申请实施例中,当用户需要对某张存在缺陷的照片进行修复的时候,用户可以启动终端上照片处理应用。具体的,当终端设备启动了照片处理应用之后,显示上述照片处理应用的显示界面。在上述显示界面中包括照片显示区域和工具栏,工具栏中包括修复照片的选项。然后在接收用户打开图库中待修复照片的指令后,终端设备将待修复照片显示在上述照片处理应用的照片显示区域上。In the embodiment of the present application, when the user needs to repair a defective photo, the user can start the photo processing application on the terminal. Specifically, after the terminal device starts the photo processing application, the display interface of the photo processing application is displayed. The above display interface includes a photo display area and a toolbar, and the toolbar includes an option to repair photos. Then, after receiving the user's instruction to open the photo to be repaired in the gallery, the terminal device displays the photo to be repaired on the photo display area of the photo processing application.
202:终端设备接收对上述照片的修复操作指令,在上述待修复照片上显示待修复图像区域选择框。202: The terminal device receives the repair operation instruction for the above photo, and displays a selection frame of the image area to be repaired on the photo to be repaired.
在本申请实施例中,当终端设备接将待修复照片显示在照片处理应用的照片显示区域,接收到用户点击工具栏中的照片修复选项后,终端设备在上述待修复照片上显示修复图像区域选取框,以便用户对上述修复图像区域选取框来选择待修复照片上需要修复的区域。其中,上述修复图像区域选取框的形状为矩形框。In the embodiment of the present application, when the terminal device then displays the photo to be repaired in the photo display area of the photo processing application, after receiving the user clicks the photo repair option in the toolbar, the terminal device displays the repaired image area on the photo to be repaired A check box, so that the user can select the area to be repaired on the photo to be repaired by selecting the check box for the repaired image area. The shape of the selection frame of the repaired image area is a rectangular frame.
203:终端设备接收对上述待修复图像区域选择框的操作指令,执行上述对上述待修复图像区域选择框的操作指令对应的操作。203: The terminal device receives the operation instruction on the selection box of the image region to be repaired, and executes the operation corresponding to the operation instruction on the selection box of the image region to be repaired.
其中,上述对待修复图像区域选择框的操作指令包括拖动操作指令、放大操作指令、缩小操作指令、拉伸操作指令、变形操作指令等。The operation instructions of the selection frame of the image area to be repaired include a drag operation instruction, a zoom-in operation instruction, a zoom-out operation instruction, a stretch operation instruction, a deformation operation instruction, and the like.
当终端设备接收到上述对待修复图像区域选择框的操作指令之后,终端设备响应上述操作指令,实现对上述修复图像区域选取框的拖动、放大、缩小、拉伸以及变形等操作。After the terminal device receives the operation instruction of the selection frame of the image area to be repaired, the terminal device responds to the operation instruction and implements operations such as dragging, enlarging, reducing, stretching, and deforming the selection frame of the repaired image area.
204:终端设备接根据上述待修复图像区域选择框当前的位置和大小确定上述待修复照片的待修复图像区域。204: The terminal device then determines the image area to be repaired of the photo to be repaired according to the current position and size of the selection frame of the image area to be repaired.
当用终端设备完成用户对上述修复图像区域选取框的操作指令之后,即用户通过修复图像区域选取框确定了待修复照片的缺陷区域之后,终端设备接收修复图像区域的确认指令,终端设备将上述待修复图像区域选择框在上述待修复照片上框选的区域作为上述待修复图像区域。其中,上述确认操作指令可以是用户点击屏幕上的确认选项,也可以是用户对上述修复图像区域选取框的特定操作,例如双击上述修复图像区域选取框。After using the terminal device to complete the user's operation instruction for the repair image area selection box, that is, after the user determines the defective area of the photo to be repaired through the repair image area selection box, the terminal device receives the confirmation instruction to repair the image area, the terminal device will The area selected by the frame of the image area to be repaired on the photo to be repaired is taken as the image area to be repaired. Wherein, the confirmation operation instruction may be a confirmation option that the user clicks on the screen, or a specific operation of the user on the repair image area selection box, such as double-clicking the repair image area selection box.
205:终端设备根据上述待修复图像区域确定包围上述待修复图像区域的第一图像区域。205: The terminal device determines the first image area surrounding the image area to be repaired according to the image area to be repaired.
在本申请实施例中,上述第一图像区域为和待修复图像区域同中心,长和 宽为待修复图像区域的长和宽的两倍所在的区域出去待修复图像区域的部分区域,即上述第一图像区域为包围上述待修复图像区域的邻近区域。In the embodiment of the present application, the first image area is the same center as the image area to be repaired, and the length and width are areas where the length and width of the image area to be repaired are twice out of the partial area of the image area to be repaired, that is, the above The first image area is an adjacent area surrounding the image area to be repaired.
206:终端设备根据上述第一图像区域从图库中搜索存在与上述第一图像区域匹配的第二图像区域的目标参考照片。206: The terminal device searches the gallery for a target reference photo that has a second image area matching the first image area according to the first image area.
207:终端设备复制上述目标参考照片中第二图像区域以及第二图像区域包围的图像区域的图像作为待拼接图像。207: The terminal device copies the image of the second image area and the image area surrounded by the second image area in the target reference photo as the image to be stitched.
208:终端设备将上述待拼接图像拼接到上述待修复图像的第一图像区域所在的图形区域上,以覆盖上述待修复图像区域。208: The terminal device stitches the image to be spliced onto the graphics area where the first image area of the image to be repaired is located, so as to cover the image area to be repaired.
上述步骤206-步骤208可以参考图1所示实施例步骤103-步骤104中的具体描述,此处不再赘述。For the above steps 206 to 208, reference may be made to the specific descriptions in steps 103 to 104 in the embodiment shown in FIG. 1, which will not be repeated here.
在本申请实施例中,通过从终端设备中选取待修复的照片,并将待修复的照片显示在终端设备屏幕上,然后通过待修复图像区域选择框来确定待修复图像区域,并根据待修复图像区域确定第一图像区域;接着根据待修复图像区域从图库中确定目标参考照片;最后根据目标参考照片来修复待修复照片的待修复图像区域。在本申请实施例中,可以通过待修复照片中与缺陷区域的邻近的第一图像区域来寻找与该第一图像区域相似度达到阈值的第二图像区域,从而利用第二图像区域所在的图像来修复待修复图像。In the embodiment of the present application, the photo to be repaired is selected from the terminal device, and the photo to be repaired is displayed on the screen of the terminal device, and then the image area to be repaired is determined by the image area to be repaired selection box, and according to the image to be repaired The image area determines the first image area; then the target reference photo is determined from the gallery according to the image area to be repaired; finally, the image area to be repaired of the photo to be repaired is repaired according to the target reference photo. In the embodiment of the present application, a second image area that has a similarity to the first image area that reaches a threshold can be found through the first image area adjacent to the defective area in the photo to be repaired, so as to utilize the image where the second image area is located To repair the image to be repaired.
参见图3,图3是本申请实施例提供的又一种图像处理方法的示意流程图,如图所示该方法可包括:Referring to FIG. 3, FIG. 3 is a schematic flowchart of yet another image processing method provided by an embodiment of the present application. As shown in the figure, the method may include:
301:终端设备启动照片处理应用,将用户从图库中选择的待修复照片显示在终端设备的屏幕上。301: The terminal device starts the photo processing application, and displays the photo to be repaired selected by the user from the gallery on the screen of the terminal device.
其中,上述照片处理应用为能够对照片进行修复的应用。Among them, the above photo processing application is an application that can repair photos.
在本申请实施例中,当用户需要对某张存在缺陷的照片进行修复的时候,用户可以启动终端上照片处理应用。具体的,当终端设备启动了照片处理应用之后,显示上述照片处理应用的显示界面。然后在接收用户打开图库中待修复照片的指令后,终端设备将待修复照片显示在上述照片处理应用的照片显示区域上。In the embodiment of the present application, when the user needs to repair a defective photo, the user can start the photo processing application on the terminal. Specifically, after the terminal device starts the photo processing application, the display interface of the photo processing application is displayed. Then, after receiving the user's instruction to open the photo to be repaired in the gallery, the terminal device displays the photo to be repaired on the photo display area of the photo processing application.
302:终端设备接收修复类型选择操作指令,根据上述修复类型选择操作指令确定上述待修复照片的修复类型。302: The terminal device receives the repair type selection operation instruction, and determines the repair type of the photo to be repaired according to the repair type selection operation instruction.
其中,在上述显示界面中包括照片显示区域和工具栏,工具栏中包括照片修复类型选择选项,修复类型选择的选项包括人像闭眼修复、模糊区域修复、从影区域修复、扭曲变形区域修复、指定区域修复,集体合照修复中的至少一 项。Among them, the above display interface includes a photo display area and a toolbar, and the toolbar includes a photo repair type selection option, and the repair type selection options include portrait closed eye repair, blur area repair, shadow area repair, distortion area repair, designated Regional restoration, at least one of the group photo restoration.
在本申请实施例中,当终端设备将上述待修复照片显示在终端设备的屏幕上之后,接收用户在上述工具栏中输入的修复类型选择指令,终端设备根据上述修复类型选择指令确定上述待修复照片的修复类型。In the embodiment of the present application, after the terminal device displays the photo to be repaired on the screen of the terminal device, it receives the repair type selection instruction input by the user in the toolbar, and the terminal device determines the above-mentioned to be repaired according to the repair type selection instruction The type of photo repair.
303:终端设备接根据上述修复类型检测上述待修复照片中存在上述修复类型对应的缺陷的待修复图像区域。303: The terminal device then detects, according to the repair type, the image area to be repaired in which the defect corresponding to the repair type is present in the photo to be repaired.
在本申请实施例中,当终端设备确定了待修复照片的修复类型后,终端设备根据修复类型对应的缺陷,检测待修复照片中是否存在上述缺陷,若存在,则将该缺陷所在的区域确定为上述待修复图像区域。In the embodiment of the present application, after the terminal device determines the repair type of the photo to be repaired, the terminal device detects whether the above defect exists in the photo to be repaired according to the defect corresponding to the repair type, and if so, determines the area where the defect is located It is the image area to be repaired above.
304:终端设备根据上述待修复图像区域确定包围上述待修复图像区域的第一图像区域。304: The terminal device determines the first image area surrounding the image area to be repaired according to the image area to be repaired.
305:终端设备根据上述第一图像区域从图库中搜索存在与上述第一图像区域匹配的第二图像区域的目标参考照片。305: The terminal device searches for a target reference photo in the second image area matching the first image area from the gallery according to the first image area.
306:终端设备复制上述目标参考照片中第二图像区域以及第二图像区域包围的图像区域的图像作为待拼接图像。306: The terminal device copies the image of the second image area and the image area surrounded by the second image area in the target reference photo as an image to be stitched.
307:终端设备将上述待拼接图像拼接到上述待修复图像的第一图像区域所在的图形区域上,以覆盖上述待修复图像区域。307: The terminal device stitches the image to be spliced onto the graphics area where the first image area of the image to be repaired is located, so as to cover the image area to be repaired.
上述步骤304-步骤307可以参考图1所示实施例步骤102-步骤104中的具体描述,此处不再赘述。For the above steps 304-307, reference may be made to the specific descriptions in steps 102-104 of the embodiment shown in FIG. 1, which will not be repeated here.
该步骤可以参考图1所示实施例步骤103中的具体描述,此处不再赘述。For this step, reference may be made to the specific description in step 103 of the embodiment shown in FIG. 1, and details are not described herein again.
在本申请实施例中,通过从终端设备中选取待修复的照片,并将待修复的照片显示在终端设备屏幕上,然后确定待修复照片需要修复的类型,并根据修复类型检测照片中与修复类型对应的缺陷区域,将缺陷区域确定为待修复图像区域;接着根据待修复图像区域确定第一图像区域,并根据待修复图像区域从图库中确定目标参考照片;最后根据目标参考照片来修复待修复照片的待修复图像区域。在本申请实施例中,可以通过待修复照片中与缺陷区域的邻近的第一图像区域来寻找与该第一图像区域相似度达到阈值的第二图像区域,从而利用第二图像区域所在的图像来修复待修复图像。In the embodiment of the present application, the photos to be repaired are selected from the terminal device, and the photos to be repaired are displayed on the screen of the terminal device, and then the type of the photo to be repaired needs to be repaired, and the photo and repair are detected according to the repair type Defect area corresponding to the type, the defect area is determined as the image area to be repaired; then the first image area is determined according to the image area to be repaired, and the target reference photo is determined from the gallery according to the image area to be repaired; finally, the target photo is repaired according to the target reference photo Repair the image area of the photo to be repaired. In the embodiment of the present application, a second image area that has a similarity to the first image area that reaches a threshold can be found through the first image area adjacent to the defective area in the photo to be repaired, so as to utilize the image where the second image area is located To repair the image to be repaired.
请参阅图4,图4是本申请实施例提供的一种终端设备的一种可能的功能单元组成框图,该终端设备包括:第一确定单元410、第一选取单元420、第二选取单元430、修复单元440。Please refer to FIG. 4. FIG. 4 is a block diagram of a possible functional unit composition of a terminal device provided by an embodiment of the present application. The terminal device includes: a first determining unit 410, a first selecting unit 420, and a second selecting unit 430 、 Repair unit 440.
上述第一确定单元410,用于确定待修复图像中的待修复图像区域;The first determining unit 410 is used to determine the image area to be repaired in the image to be repaired;
上述第一选取单元420,用于选取上述待修复图像中包围上述待修复图像区域的第一图像区域;The first selection unit 420 is configured to select a first image area surrounding the image area to be repaired in the image to be repaired;
上述第二选取单元430,用于从参考图像集中选取目标参考图像,上述目标参考图像中存在与上述第一图像区域匹配的第二图像区域;The second selecting unit 430 is configured to select a target reference image from the reference image set, and there is a second image area matching the first image area in the target reference image;
上述修复单元440,用于以上述目标参考图像中第二图像区域及被所述第二图像区域包围的区域为参考,修复上述待修复图像区域。The repair unit 440 is configured to repair the image area to be repaired using the second image area and the area surrounded by the second image area in the target reference image as a reference.
可选的,上述终端设备还包括:Optionally, the above terminal device further includes:
接收单元450,用于接收用户针对所述待修复图像从预设的修复类型中选择的第一修复类型,上述修复类型包括人像闭眼修复、模糊区域修复、从影区域修复、扭曲变形区域修复、指定区域修复,集体合照修复中的至少一项;The receiving unit 450 is configured to receive the first repair type selected by the user from the preset repair types for the image to be repaired, the repair type includes closed-eye repair, blurred area repair, repair from the shadow area, and distortion deformation area repair, At least one of the repairs in the designated area and the collective photo repair;
上述第一确定单元410,用于检测所述待修复图像中所述第一修复类型对应的缺陷所在的缺陷区域;将所述待修复图像中的所述缺陷区域确定为所述待修复图像区域。The first determining unit 410 is configured to detect a defect area where a defect corresponding to the first repair type in the image to be repaired is located; and determine the defect area in the image to be repaired as the image area to be repaired .
可选的,上述第一确定单元410,用于识别用户在上述待修复图像上的选取操作;将上述选取操作对应的区域确定为上述待修复图像区域。Optionally, the first determining unit 410 is configured to identify a user's selection operation on the image to be repaired; and determine an area corresponding to the selection operation as the image to be repaired region.
可选的,上述第二选取单元430包括:Optionally, the second selection unit 430 includes:
搜索单元431,用于从上述参考图像中搜索与上述第一图像区域相似度最大的相似区域,上述相似区域与上述第一图像区域的边界轮廓形状相同;The searching unit 431 is configured to search for the similar region with the highest similarity to the first image region from the reference image, and the boundary contour shape of the similar region and the first image region is the same;
第三确定单元432,用于若上述第一图像区域与上述相似区域的相似度大于阈值,则将上述相似区域对应的参考图像确定为上述目标参考图像,上述相似区域确定为上述第二图像区域。The third determining unit 432 is configured to determine the reference image corresponding to the similar area as the target reference image and determine the similar area as the second image area if the similarity between the first image area and the similar area is greater than a threshold .
可选的,上述第三确定单元422,用于判断上述相似区域包围的图像区域是否存在缺陷;若否,则将上述相似区域对应的参考图像确定为上述目标参考图像,上述相似区域确定为上述第二图像区域。Optionally, the third determining unit 422 is configured to determine whether the image area surrounded by the similar area is defective; if not, determine the reference image corresponding to the similar area as the target reference image and determine the similar area as the above The second image area.
可选的,上述修复单元440包括:Optionally, the repair unit 440 includes:
复制单元441,用于复制上述目标参考图像中第二图像区域及被所述第二图像区域包围的区域的图像,将复制得到的图像作为待拼接图像;The copying unit 441 is configured to copy the images of the second image area and the area surrounded by the second image area in the target reference image, and use the copied image as the image to be stitched;
拼接单元442,用于将上述待拼接图像拼接到上述待修复图像中以覆盖上述待修复图像区域。The stitching unit 442 is configured to stitch the above-mentioned image to be spliced into the above-mentioned image to be repaired to cover the region of the image to be repaired.
可选的,上述拼接单元442,具体用于对上述待拼接图像进行图像矫正处理;将矫正后的待拼接图像与上述第一图像区域进行图像配准;根据上述图像配准结果将上述将矫正后的待拼接图像中与上述第一图像区域对一个的区域进行图 像融合完成图像的拼接。Optionally, the above-mentioned stitching unit 442 is specifically configured to perform image correction processing on the above-mentioned image to be stitched; perform image registration on the corrected image to be stitched with the above-mentioned first image area; After the image to be stitched is merged with one of the first image regions to complete the image stitching.
根据本申请实施例的具体实施方式,图1、图2以及图3所示的图像处理方法涉及的步骤101~104、201~208、301~307可以是由图5所示的终端设备中的各个模块来执行。According to the specific implementation of the embodiments of the present application, the steps 101 to 104, 201 to 208, and 301 to 307 involved in the image processing method shown in FIGS. 1, 2, and 3 may be performed by the terminal device shown in FIG. Various modules to execute.
在本申请实施例中,通过确定待修复图像中的待修复图像区域;选取上述待修复图像中包围上述待修复图像区域的第一图像区域;从参考图像集中选取目标参考图像,上述目标参考图像中存在与上述第一图像区域匹配的第二图像区域;以上述目标参考图像中第二图像区域及被所述第二图像区域包围的区域为参考,修复上述待修复图像区域。在本申请实施例中,可以通过待修复图像中与缺陷区域的邻近的第一图像区域来寻找与该第一图像区域相似度达到阈值的第二图像区域,从而利用第二图像区域所在的图像来修复待修复图像。In the embodiment of the present application, by determining the image area to be repaired in the image to be repaired; selecting the first image area surrounding the image area to be repaired in the image to be repaired; selecting the target reference image from the reference image set, the target reference image There is a second image area matching the first image area; the second image area in the target reference image and the area surrounded by the second image area are used as a reference to repair the image area to be repaired. In an embodiment of the present application, a second image area that has a similarity to the first image area that reaches a threshold can be found through the first image area adjacent to the defective area in the image to be repaired, so as to utilize the image where the second image area is located To repair the image to be repaired.
参见图5,图5是本申请另一实施例提供的一种终端示意框图。如图所示的本实施例中的终端可以包括:一个或多个处理器501;一个或多个输入设备502,一个或多个输出设备503和存储器504。上述处理器501、输入设备502、输出设备503和存储器504通过总线505连接。存储器502用于存储计算机程序,上述计算机程序包括程序指令,处理器501用于执行存储器502存储的程序指令。其中,处理器501被配置用于调用上述程序指令执行:确定待修复图像中的待修复图像区域;选取上述待修复图像中包围上述待修复图像区域的第一图像区域;从参考图像集中选取目标参考图像,上述目标参考图像中存在与上述第一图像区域匹配的第二图像区域;以上述目标参考图像中第二图像区域及被所述第二图像区域包围的区域为参考,修复上述待修复图像区域。Referring to FIG. 5, FIG. 5 is a schematic block diagram of a terminal according to another embodiment of the present application. As shown in the figure, the terminal in this embodiment may include: one or more processors 501; one or more input devices 502, one or more output devices 503, and a memory 504. The processor 501, the input device 502, the output device 503, and the memory 504 are connected via a bus 505. The memory 502 is used to store a computer program. The computer program includes program instructions, and the processor 501 is used to execute the program instructions stored in the memory 502. The processor 501 is configured to call the above program instructions to execute: determine the image area to be repaired in the image to be repaired; select the first image area surrounding the image area to be repaired in the image to be repaired; select the target from the reference image set Reference image, there is a second image area matching the first image area in the target reference image; the second image area in the target reference image and the area surrounded by the second image area are used as references to repair the to-be-repaired Image area.
应当理解,在本申请实施例中,所称处理器501可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that in the embodiment of the present application, the so-called processor 501 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP) , Application Specific Integrated Circuit (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
输入设备502可以包括触控板、指纹采传感器(用于采集用户的指纹信息和指纹的方向信息)、麦克风等,输出设备503可以包括显示器(LCD等)、扬声器等。The input device 502 may include a touchpad, a fingerprint sensor (for collecting user's fingerprint information and fingerprint direction information), a microphone, etc., and the output device 503 may include a display (LCD, etc.), a speaker, and the like.
该存储器504可以包括只读存储器和随机存取存储器,并向处理器501提供指令和数据。存储504的一部分还可以包括非易失性随机存取存储器。例如, 存储器504还可以存储设备类型的信息。The memory 504 may include a read-only memory and a random access memory, and provide instructions and data to the processor 501. A portion of storage 504 may also include non-volatile random access memory. For example, the memory 504 may also store device type information.
具体实现中,本申请实施例中所描述的处理器501、输入设备502、输出设备503可执行本申请实施例提供的一种图像处理方法的第一实施例和第二实施例中所描述的实现方式,也可执行本申请实施例所描述的终端的实现方式,在此不再赘述。In a specific implementation, the processor 501, the input device 502, and the output device 503 described in the embodiments of the present application may execute the first and second embodiments of an image processing method provided in the embodiments of the present application. The implementation manner can also implement the implementation manner of the terminal described in the embodiments of the present application, which will not be repeated here.
在本申请的另一实施例中提供一种计算机非易失性可读存储介质,上述计算机非易失性可读存储介质存储有计算机程序,上述计算机程序包括程序指令,上述程序指令被处理器执行时实现:确定待修复图像中的待修复图像区域;选取上述待修复图像中包围上述待修复图像区域的第一图像区域;从参考图像集中选取目标参考图像,上述目标参考图像中存在与上述第一图像区域匹配的第二图像区域;以上述目标参考图像中第二图像区域及被所述第二图像区域包围的区域为参考,修复上述待修复图像区域。In another embodiment of the present application, a computer non-volatile readable storage medium is provided. The computer non-volatile readable storage medium stores a computer program. The computer program includes program instructions. The program instructions are processed by a processor. Achieved during execution: determining the image area to be repaired in the image to be repaired; selecting the first image area surrounding the image area to be repaired in the image to be repaired; selecting the target reference image from the reference image set The second image area matching the first image area; using the second image area in the target reference image and the area surrounded by the second image area as a reference to repair the image area to be repaired.
上述计算机非易失性可读存储介质可以是前述任一实施例上述的终端的内部存储单元,例如终端的硬盘或内存。上述计算机非易失性可读存储介质也可以是上述终端的外部存储设备,例如上述终端上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,上述计算机非易失性可读存储介质还可以既包括上述终端的内部存储单元也包括外部存储设备。上述计算机非易失性可读存储介质用于存储上述计算机程序以及上述终端所需的其他程序和数据。上述计算机非易失性可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。The non-volatile computer-readable storage medium may be the internal storage unit of the terminal described in any of the foregoing embodiments, such as the hard disk or the memory of the terminal. The non-volatile computer-readable storage medium may also be an external storage device of the terminal, such as a plug-in hard disk equipped on the terminal, a smart memory card (Smart Media, Card, SMC), and secure digital (SD) Cards, flash cards, etc. Further, the computer non-volatile readable storage medium may also include both the internal storage unit of the terminal and the external storage device. The computer non-volatile readable storage medium is used to store the computer program and other programs and data required by the terminal. The computer non-volatile readable storage medium may also be used to temporarily store data that has been output or will be output.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art may realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two, in order to clearly explain the hardware and software. Interchangeability, in the above description, the composition and steps of each example have been generally described according to function. Whether these functions are executed in hardware or software depends on the specific application of the technical solution and design constraints. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的端设备和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of the description, the specific working processes of the above-described end devices and units can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的终端设备和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的, 例如,上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the several embodiments provided in this application, it should be understood that the disclosed terminal device and method may be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above-mentioned units is only a division of logical functions. In actual implementation, there may be other division modes, for example, multiple units or components may be combined or may Integration into another system, or some features can be ignored, or not implemented. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be indirect couplings or communication connections through some interfaces, devices, or units, and may also be electrical, mechanical, or other forms of connection.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本申请实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments of the present application.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The above integrated unit can be implemented in the form of hardware or software function unit.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例上述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application essentially or part of the contribution to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, the computer software product is stored in a storage medium In it, several instructions are included to enable 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 above methods in various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above is only the specific implementation of this application, but the scope of protection of this application is not limited to this, any person skilled in the art can easily think of various equivalents within the technical scope disclosed in this application Modifications or replacements, these modifications or replacements should be covered within the scope of protection of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (20)

  1. 一种图像处理方法,其特征在于,包括:An image processing method, which includes:
    确定待修复图像中的待修复图像区域;Determine the image area to be repaired in the image to be repaired;
    选取上述待修复图像中包围所述待修复图像区域的第一图像区域;Selecting the first image area surrounding the image area to be repaired in the image to be repaired;
    从参考图像集中选取目标参考图像,所述目标参考图像中存在与所述第一图像区域匹配的第二图像区域;Selecting a target reference image from the reference image set, where a second image area matching the first image area exists in the target reference image;
    以所述目标参考图像中第二图像区域及被所述第二图像区域包围的图像区域为参考,修复所述待修复图像区域。Using the second image area in the target reference image and the image area surrounded by the second image area as references, the image area to be repaired is repaired.
  2. 根据权利要求1所述的方法,其特征在于,在所述确定待修复图像中的待修复图像区域之前,所述方法还包括:The method according to claim 1, wherein before the determining the area of the image to be repaired in the image to be repaired, the method further comprises:
    接收用户针对所述待修复图像从预设的修复类型中选择的第一修复类型,所述预设的修复类型包括人像闭眼修复、模糊区域修复、从影区域修复、扭曲变形区域修复、指定区域修复,集体合照修复中的至少一项;Receiving the first repair type selected by the user from the preset repair types for the image to be repaired, the preset repair type includes portrait closed-eye repair, blurred area repair, shadow area repair, warped deformation area repair, and designated area Repair, at least one of the group photo repairs;
    所述确定待修复图像中的待修复图像区域,包括:The determining of the image area to be repaired in the image to be repaired includes:
    检测所述待修复图像中所述第一修复类型对应的缺陷所在的缺陷区域;Detecting a defect area where a defect corresponding to the first repair type in the image to be repaired is located;
    将所述待修复图像中的所述缺陷区域确定为所述待修复图像区域。The defect area in the image to be repaired is determined as the image area to be repaired.
  3. 根据权利要求1所述的方法,其特征在于,所述确定待修复图像中的待修复图像区域,包括:The method according to claim 1, wherein the determining the area of the image to be repaired in the image to be repaired comprises:
    识别用户在所述待修复图像上的选取操作;Identify the user's selection operation on the image to be repaired;
    将所述选取操作对应的区域确定为所述待修复图像区域。The area corresponding to the selection operation is determined as the image area to be repaired.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述从参考图像集中选取目标参考图像,所述目标参考图像中存在与所述第一图像区域匹配的第二图像区域,包括:The method according to any one of claims 1 to 3, wherein the target reference image is selected from the reference image set, and there is a second image area matching the first image area in the target reference image, include:
    从所述参考图像中搜索与所述第一图像区域相似度最大的相似区域,所述相似区域与所述第一图像区域的边界轮廓形状相同;Searching for a similar region with the highest similarity to the first image region from the reference image, and the similar region has the same boundary contour shape as the first image region;
    若所述第一图像区域与所述相似区域的相似度大于阈值,则将所述相似区域对应的参考图像确定为所述目标参考图像,所述相似区域确定为所述第二图像区域。If the similarity between the first image area and the similar area is greater than a threshold, the reference image corresponding to the similar area is determined as the target reference image, and the similar area is determined as the second image area.
  5. 根据权利要求4所述的方法,其特征在于,在确定所述第一图像区域与所述相似区域的相似度大于阈值之后,所述方法还包括:The method according to claim 4, wherein after determining that the similarity between the first image area and the similar area is greater than a threshold, the method further comprises:
    判断所述相似区域包围的图像区域是否存在缺陷;Determine whether the image area surrounded by the similar area has defects;
    若否,则将所述相似区域对应的参考图像确定为所述目标参考图像,所述相似区域确定为所述第二图像区域。If not, the reference image corresponding to the similar area is determined as the target reference image, and the similar area is determined as the second image area.
  6. 根据权利要求5所述的方法,其特征在于,所述以所述目标参考图像中第二图像区域及被所述第二图像区域包围的图像区域为参考,修复所述待修复图像区域,包括:The method according to claim 5, wherein the repairing the image area to be repaired with reference to the second image area in the target reference image and the image area surrounded by the second image area includes :
    复制所述目标参考图像中第二图像区域及被所述第二图像区域包围的区域的图像,将复制得到的图像作为待拼接图像;Copy the images of the second image area and the area surrounded by the second image area in the target reference image, and use the copied image as the image to be stitched;
    将所述待拼接图像拼接到所述待修复图像中以覆盖所述待修复图像区域。The image to be spliced is spliced into the image to be repaired to cover the image area to be repaired.
  7. 根据权利要求6所述的方法,其特征在于,所述将所述待拼接图像拼接到所述待修复图像中以覆盖所述待修复图像区域,包括:The method according to claim 6, wherein the splicing the image to be spliced into the image to be repaired to cover the area of the image to be repaired includes:
    对所述待拼接图像进行图像矫正处理;Performing image correction processing on the image to be stitched;
    将矫正后的待拼接图像与所述第一图像区域进行图像配准;Performing image registration on the corrected image to be stitched with the first image area;
    根据所述图像配准的结果将所述将矫正后的待拼接图像中与所述第一图像区域对一个的区域进行图像融合完成图像的拼接。According to the result of the image registration, the image to be stitched in the corrected image to be merged with the first image region to complete the image stitching.
  8. 根据权利要求4所述的方法,其特征在于,所述从所述参考图像中搜索与所述第一图像区域相似度最大的相似区域之前,所述方法还包括:The method according to claim 4, characterized in that before searching for a similar region with the greatest similarity to the first image region from the reference image, the method further comprises:
    分别提取模板图像和所述参考图像中的特征点;Extract feature points in the template image and the reference image respectively;
    对所述模板图像和所述参考图像中的特征点进行匹配,通过匹配的特征点判断所述参考图像中是否存在与所述模板图像相似的所述相似区域。The feature points in the template image and the reference image are matched, and whether the similar region similar to the template image exists in the reference image is determined by the matched feature points.
  9. 根据权利要求7所述的方法,其特征在于,所述对所述待拼接图像进行图像矫正处理包括:The method according to claim 7, wherein the image correction processing on the image to be stitched comprises:
    对所述待拼接的图像进行桶形变换处理。Perform barrel transformation on the image to be stitched.
  10. 一种终端设备,其特征在于,包括:第一确定单元、第一选取单元、第二选取单元、修复单元,其中:A terminal device is characterized by comprising: a first determination unit, a first selection unit, a second selection unit, and a repair unit, wherein:
    所述第一确定单元,用于确定待修复图像中的待修复图像区域;The first determining unit is configured to determine the image area to be repaired in the image to be repaired;
    所述第一选取单元,用于选取所述待修复图像中包围所述待修复图像区域的第一图像区域;The first selection unit is configured to select a first image area surrounding the image area to be repaired in the image to be repaired;
    所述第二选取单元,用于从参考图像集中选取目标参考图像,所述目标参考图像中存在与所述第一图像区域匹配的第二图像区域;The second selection unit is configured to select a target reference image from the reference image set, and there is a second image area matching the first image area in the target reference image;
    所述修复单元,用于以所述目标参考图像中第二图像区域及被所述第二图像区域包围的区域为参考,修复所述待修复图像区域。The repair unit is configured to repair the image area to be repaired by using the second image area in the target reference image and the area surrounded by the second image area as a reference.
  11. 根据权利要求10所述的终端设备,其特征在于,所述终端设备还包括:The terminal device according to claim 10, wherein the terminal device further comprises:
    接收单元,用于接收用户针对所述待修复图像从预设的修复类型中选择的第一修复类型,所述修复类型包括人像闭眼修复、模糊区域修复、从影区域修复、扭曲变形区域修复、指定区域修复,集体合照修复中的至少一项;The receiving unit is configured to receive the first repair type selected by the user from the preset repair types for the image to be repaired, the repair type including portrait closed-eye repair, blurry area repair, shadow area repair, distortion area repair, At least one of the repairs in the designated area and the collective photo repair;
    所述第一确定单元,用于检测所述待修复图像中所述第一修复类型对应的缺陷所在的缺陷区域;将所述待修复图像中的所述缺陷区域确定为所述待修复图像区域。The first determining unit is configured to detect a defect area where a defect corresponding to the first repair type in the image to be repaired is located; and determine the defect area in the image to be repaired as the image area to be repaired .
  12. 根据权利要求10所述的终端设备,其特征在于,所述第一确定单元,用于识别用户在所述待修复图像上的选取操作;将所述选取操作对应的区域确定为所述待修复图像区域。The terminal device according to claim 10, wherein the first determining unit is configured to identify a user's selection operation on the image to be repaired; and determine an area corresponding to the selection operation as the to-be-repaired Image area.
  13. 根据权利要求10-12任一项所述的终端设备,其特征在于,所述第二选取单元包括:The terminal device according to any one of claims 10-12, wherein the second selection unit includes:
    搜索单元,用于从所述参考图像中搜索与所述第一图像区域相似度最大的相似区域,所述相似区域与所述第一图像区域的边界轮廓形状相同;A search unit, configured to search for a similar region with the highest similarity to the first image region from the reference image, and the similar region has the same boundary contour shape as the first image region;
    第三确定单元,用于若所述第一图像区域与所述相似区域的相似度大于阈值,则将所述相似区域对应的参考图像确定为所述目标参考图像,所述相似区域确定为所述第二图像区域。A third determining unit, configured to determine the reference image corresponding to the similar area as the target reference image if the similarity between the first image area and the similar area is greater than a threshold, and determine the similar area as the The second image area.
  14. 根据权利要求13所述的终端设备,其特征在于,所述第三确定单元,用于判断所述相似区域包围的图像区域是否存在缺陷;若否,则将所述相似区域对应的参考图像确定为所述目标参考图像,所述相似区域确定为所述第二图像区域。The terminal device according to claim 13, wherein the third determining unit is configured to determine whether an image area surrounded by the similar area has a defect; if not, determine a reference image corresponding to the similar area For the target reference image, the similar area is determined as the second image area.
  15. 根据权利要求14所述的终端设备,其特征在于,所述修复单元包括:The terminal device according to claim 14, wherein the repair unit comprises:
    复制单元,用于复制所述目标参考图像中第二图像区域及被所述第二图像区域包围的区域的图像,将复制得到的图像作为待拼接图像;A copying unit, for copying images of the second image area and the area surrounded by the second image area in the target reference image, and using the copied image as the image to be stitched;
    拼接单元,用于将所述待拼接图像拼接到所述待修复图像中以覆盖所述待修复图像区域。A stitching unit is used to stitch the image to be spliced into the image to be repaired to cover the image area to be repaired.
  16. 根据权利要求15所述的终端设备,其特征在于,所述拼接单元,具体用于对所述待拼接图像进行图像矫正处理;将矫正后的待拼接图像与所述第一图像区域进行图像配准;根据所述图像配准结果将所述将矫正后的待拼接图像中与所述第一图像区域对一个的区域进行图像融合完成图像的拼接。The terminal device according to claim 15, wherein the stitching unit is specifically configured to perform image correction processing on the image to be spliced; and perform image matching on the first image area after the corrected image to be spliced According to the result of the image registration, the image to be stitched in the corrected image is merged with the first image region to complete the image stitching.
  17. 根据权利要求13所述的终端设备,其特征在于,所述第二选取单元还用于:The terminal device according to claim 13, wherein the second selection unit is further configured to:
    分别提取模板图像和所述参考图像中的特征点;Extract feature points in the template image and the reference image respectively;
    所述搜索单元具体用于,对所述模板图像和所述参考图像中的特征点进行匹配,通过匹配的特征点判断所述参考图像中是否存在与所述模板图像相似的所述相似区域。The search unit is specifically configured to match feature points in the template image and the reference image, and determine whether the similar region similar to the template image exists in the reference image by the matched feature points.
  18. 根据权利要求16所述的终端设备,其特征在于,上述拼接单元,具体还用于对所述待拼接的图像进行桶形变换处理。The terminal device according to claim 16, wherein the stitching unit is further specifically configured to perform barrel transformation on the image to be stitched.
  19. 一种终端设备,其特征在于,包括处理器、存储器和总线;所述处理器和所述存储器通过所述总线相互连接;其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行如权利要求1至9任一项所述的方法。A terminal device, comprising a processor, a memory and a bus; the processor and the memory are connected to each other through the bus; wherein the memory is used to store a computer program, and the computer program includes program instructions The processor is configured to call the program instructions to perform the method according to any one of claims 1 to 9.
  20. 一种计算机非易失性可读存储介质,其特征在于,所述计算机非易失性可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时,使所述处理器执行如权利要求1至9任一项所述的方法。A computer non-volatile readable storage medium, characterized in that the computer non-volatile readable storage medium stores a computer program, the computer program includes program instructions, when the program instructions are executed by a processor So that the processor executes the method according to any one of claims 1 to 9.
PCT/CN2019/117576 2019-01-04 2019-11-12 Image processing method, terminal apparatus, and computer readable medium WO2020140617A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910013962.3A CN109785256B (en) 2019-01-04 Image processing method, terminal equipment and computer readable medium
CN201910013962.3 2019-01-04

Publications (1)

Publication Number Publication Date
WO2020140617A1 true WO2020140617A1 (en) 2020-07-09

Family

ID=66500105

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117576 WO2020140617A1 (en) 2019-01-04 2019-11-12 Image processing method, terminal apparatus, and computer readable medium

Country Status (1)

Country Link
WO (1) WO2020140617A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2712176A1 (en) * 2012-09-25 2014-03-26 Samsung Electronics Co., Ltd Method and apparatus for photography
CN107833197A (en) * 2017-10-31 2018-03-23 广东欧珀移动通信有限公司 Method, apparatus, computer-readable recording medium and the electronic equipment of image procossing
CN108229443A (en) * 2018-02-08 2018-06-29 三星电子(中国)研发中心 A kind of photographic method and device of anti-eye closing
CN108234878A (en) * 2018-01-31 2018-06-29 广东欧珀移动通信有限公司 Image processing method, device and terminal
CN109785256A (en) * 2019-01-04 2019-05-21 平安科技(深圳)有限公司 A kind of image processing method, terminal device and computer-readable medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2712176A1 (en) * 2012-09-25 2014-03-26 Samsung Electronics Co., Ltd Method and apparatus for photography
CN107833197A (en) * 2017-10-31 2018-03-23 广东欧珀移动通信有限公司 Method, apparatus, computer-readable recording medium and the electronic equipment of image procossing
CN108234878A (en) * 2018-01-31 2018-06-29 广东欧珀移动通信有限公司 Image processing method, device and terminal
CN108229443A (en) * 2018-02-08 2018-06-29 三星电子(中国)研发中心 A kind of photographic method and device of anti-eye closing
CN109785256A (en) * 2019-01-04 2019-05-21 平安科技(深圳)有限公司 A kind of image processing method, terminal device and computer-readable medium

Also Published As

Publication number Publication date
CN109785256A (en) 2019-05-21

Similar Documents

Publication Publication Date Title
WO2018214365A1 (en) Image correction method, apparatus, device, and system, camera device, and display device
US9959649B2 (en) Image compositing device and image compositing method
US8345106B2 (en) Camera-based scanning
CN110100251B (en) Apparatus, method, and computer-readable storage medium for processing document
WO2018176925A1 (en) Hdr image generation method and apparatus
US20120242852A1 (en) Gesture-Based Configuration of Image Processing Techniques
WO2019052534A1 (en) Image stitching method and device, and storage medium
CN104486552A (en) Method and electronic device for obtaining images
US20130076941A1 (en) Systems And Methods For Editing Digital Photos Using Surrounding Context
WO2022042679A1 (en) Picture processing method and apparatus, device, and storage medium
US20110134208A1 (en) Panoramic image synthesizer, panoramic image synthesis method, and program
WO2019237747A1 (en) Image cropping method and apparatus, and electronic device and computer-readable storage medium
Asha et al. Auto removal of bright spot from images captured against flashing light source
WO2016074467A1 (en) Image processing method and device
WO2016101524A1 (en) Method and apparatus for correcting inclined shooting of object being shot, mobile terminal, and storage medium
WO2019120018A1 (en) Photograph processing method and apparatus, and storage medium and electronic device
US11770603B2 (en) Image display method having visual effect of increasing size of target image, mobile terminal, and computer-readable storage medium
WO2022111461A1 (en) Recognition method and apparatus, and electronic device
CN109495778B (en) Film editing method, device and system
WO2015096015A1 (en) Image display method and user terminal
WO2020140617A1 (en) Image processing method, terminal apparatus, and computer readable medium
CN111784604A (en) Image processing method, device, equipment and computer readable storage medium
CN109785256B (en) Image processing method, terminal equipment and computer readable medium
JP2018125658A (en) Portable information processing device having camera function, display control method thereof, and program
JP2017162179A (en) Information processing apparatus, information processing method, and program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19906852

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19906852

Country of ref document: EP

Kind code of ref document: A1