WO2020233083A1 - 一种图像修复方法、装置、存储介质及终端设备 - Google Patents

一种图像修复方法、装置、存储介质及终端设备 Download PDF

Info

Publication number
WO2020233083A1
WO2020233083A1 PCT/CN2019/122568 CN2019122568W WO2020233083A1 WO 2020233083 A1 WO2020233083 A1 WO 2020233083A1 CN 2019122568 W CN2019122568 W CN 2019122568W WO 2020233083 A1 WO2020233083 A1 WO 2020233083A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
preset
new
repair
group
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2019/122568
Other languages
English (en)
French (fr)
Inventor
杜艳艳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Publication of WO2020233083A1 publication Critical patent/WO2020233083A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation

Definitions

  • This application relates to the field of image processing technology, and in particular to an image restoration method, device, computer-readable storage medium, and terminal equipment.
  • Image restoration is a technology that uses the known information in the image to restore the damaged area in the image, so that the image restoration effect meets the visual needs of people, so that the observer cannot perceive that the image has been damaged.
  • the image restoration method based on Criminisi algorithm is generally used to repair the image.
  • the Criminisi algorithm uses a global search based on the SSD matching principle, that is, after calculating the pixel to be repaired and each known pixel After the sum of squares of the difference, a global search is performed through the SSD matching principle to obtain the least square sum, and the best matching block is determined according to the least square sum for image restoration.
  • This global search-based image restoration method can be applied to small areas Image to be repaired, and using this global search-based image repair method for a large area of image to be repaired will lead to a longer search matching time, which greatly increases the time complexity of the algorithm, and makes the image repair speed slower And the efficiency is lower.
  • the embodiments of the present application provide an image restoration method, device, computer readable storage medium, and terminal equipment, which can reduce the time complexity of searching and matching for the best matching block in image restoration, reduce the time taken for search and matching, and improve image restoration Repair speed and repair efficiency.
  • the first aspect of the embodiments of the present application provides an image restoration method, including:
  • each boundary pixel as a center point, construct multiple repair blocks of a preset size, wherein the number of constructed repair blocks corresponds to the number of boundary pixels;
  • the second aspect of the embodiments of the present application provides an image restoration device, including:
  • the boundary point acquisition module is used to determine the target area to be repaired in the original image and the known source area, and obtain boundary pixels of the target area, where the known source area is the original image divided by the Area outside the target area;
  • the repair block building module is used to construct multiple repair blocks of preset size with each boundary pixel as the center point, wherein the number of the constructed repair block corresponds to the number of the boundary pixel;
  • the priority calculation module is used to calculate the priority of each repair block according to the number of sample pixels in each repair block and the structure information of each repair block, and select the first repair block according to the priority;
  • a matching block searching module configured to use a preset leapfrog algorithm to find the best matching block most similar to the first repaired block in the source area;
  • a repair block repair module configured to use the sample pixels corresponding to the best matching block to repair the corresponding pixels of the first repair block
  • a boundary point update module configured to divide the repaired first repair block into the source area and update the boundary pixels of the target area
  • the repair completion determining module is used for if the number of updated boundary pixels is greater than the set threshold, return to execute the steps of constructing multiple repair blocks of preset size with each boundary pixel as the center point and subsequent steps until When the number of updated boundary pixels is less than or equal to the set threshold, it is determined that the original image repair is completed and the updated source area is obtained.
  • a third aspect of the embodiments of the present application provides a computer-readable storage medium, the computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the foregoing first aspect is implemented The steps of the image restoration method.
  • the fourth aspect of the embodiments of the present application provides a terminal device, including a memory, a processor, and computer-readable instructions stored in the memory and running on the processor, and the processor executes the The following steps are implemented when computer-readable instructions:
  • each boundary pixel as a center point, construct multiple repair blocks of a preset size, wherein the number of constructed repair blocks corresponds to the number of boundary pixels;
  • a preset leaping algorithm can be used to find the best matching block most similar to the first repaired block in the source area, so as to use the most
  • the sample pixels of the best matching block are used to repair the first repaired block, that is, the search and matching of the best matching block can be performed through the fast local search and global search of the preset frog leaping algorithm, which can reduce the search and matching time of the best matching block Complexity, reducing the time occupied by search matching, thereby greatly improving the repair speed and efficiency of image repair.
  • FIG. 1 is a flowchart of an embodiment of an image restoration method in an embodiment of the application
  • FIG. 2 is a schematic flowchart of an image restoration method in an embodiment of the application for finding the best matching block in an application scenario
  • FIG. 3 is a schematic flowchart of an image restoration method in an application scenario for updating an individual frog in an embodiment of the application;
  • FIG. 4 is a structural diagram of an embodiment of an image restoration device in an embodiment of the application.
  • FIG. 5 is a schematic diagram of a terminal device provided by an embodiment of this application.
  • the embodiments of the application provide an image restoration method, device, computer-readable storage medium, and terminal equipment, which are used to reduce the time complexity of searching and matching for the best matching block in image restoration, reduce the time taken for search and matching, and improve image restoration The repair speed and repair efficiency.
  • an embodiment of the present application provides an image restoration method, and the image restoration method includes:
  • Step S101 Determine the target area to be repaired and the known source area in the original image, and obtain boundary pixels of the target area, where the known source area is the original image excluding the target area area;
  • the execution subject of the embodiments of the present application is a terminal device, which includes but is not limited to: servers, computers, smart phones, and tablet computers.
  • a terminal device which includes but is not limited to: servers, computers, smart phones, and tablet computers.
  • the relevant personnel can mark the area to be repaired by themselves, and input the marked original image into the terminal device.
  • the terminal device receives the original image, That is, the target area to be repaired in the original image can be determined according to the mark, and the area other than the target area in the original image can be determined as a well-known source area, and the boundary between the target area and the source area can be determined at the same time, And get the boundary pixels at the boundary.
  • a recognition algorithm can also be integrated in the terminal device to automatically identify the damaged area in the original image, that is, when image repair is required, the original image to be repaired can be directly input to the In the terminal device, the terminal device automatically recognizes the area to be repaired in the original image to determine the target area and the source area, thereby eliminating the manual marking process, avoiding manual participation, and improving the accuracy and efficiency of image repair.
  • Step S102 using each boundary pixel as a center point to construct multiple repair blocks of a preset size, wherein the number of the constructed repair blocks corresponds to the number of boundary pixels;
  • each boundary pixel can be used as the center point to construct multiple repair blocks of preset sizes, such as multiple m ⁇ n pixels. Repair block.
  • the preset size can be selected according to actual needs, and the number of repair blocks to be constructed corresponds to the number of boundary pixels.
  • Step S103 Calculate the priority of each repair block according to the number of sample pixels in each repair block and the structure information of each repair block, and select the first repair block according to the priority;
  • the priority of each repair block can be calculated according to the following formula, and the repair block with the highest priority can be determined as the first repair block to perform the first repair :
  • Priority(p) is the priority of repairing block p
  • Credit(p) is the confidence of repairing block p, indicating the number of sample pixels included in repairing block p
  • Data(p) is the data of repairing block p Item, representing the structure information of the repair block p
  • is the target area
  • is the number of pixels to be repaired in the repair block p
  • n p is the normal vector of the edge pixel p of the repair block p
  • is the normalized parameter.
  • the normalization parameter ⁇ can be 255, and
  • 1.
  • the repair block can provide more reliable information during the repair process, so the confidence level will be higher and the repair should be given priority.
  • it represents the vertical direction of the edge pixel point p gradient direction, where It can be obtained by partial differentiation, such as I x and I y are the partial differentials of the edge pixels in the x and y directions. Since the image has a large gradient value on a pixel point, the texture of the image near that point is richer and the linear structure information is more.
  • the edge of the image By priority repairing the pixels with richer texture and more linear structure information, the edge of the image The structure is smoother, which in turn makes the repair efficiency and repair effect better. Therefore, in the image restoration process, the edge of the image, that is, the area with more complex texture and more linear structure information, should be restored first, so that the image can diffuse the structural information of the image while the texture is restored, thereby improving the efficiency of image restoration And repair effect.
  • Step S104 using a preset leapfrog algorithm to find the best matching block that is most similar to the first repaired block in the source area;
  • the preset leapfrog algorithm can be used to find the best matching block most similar to the first repaired block in the intact source area, so as to pass the most Best matching block to repair the first repair block.
  • using a preset leapfrog algorithm to find the best matching block most similar to the first repaired block in the source area may include:
  • Step S201 Obtain sample pixel points of the source area, and construct a plurality of sample blocks of the preset size in the source area with the sample pixel points as the center point;
  • the first repaired block can be constructed in the source area first.
  • Multiple sample blocks with the same size so that the sample pixels of the sample blocks can be used to repair the first block to be repaired.
  • each sample pixel of the source area may be obtained first, and then the sample block of the preset size is constructed in the source area with each sample pixel as the center point, if the size of the repair block is 4 ⁇ With 3 pixels, the size of each sample block constructed is also 4 ⁇ 3 pixels.
  • Step S202 Determine each of the sample blocks as an individual frog, and obtain the initial population of the preset frog leaping algorithm
  • each sample block after each sample block is constructed in the source area, each sample block can be set as an individual frog, so as to obtain the initial population of the preset leapfrog algorithm.
  • the preset leaping algorithm can also be initialized in the terminal device in advance, and the number of groups Q of the preset leaping algorithm and the maximum number of iterations within the group J can be preset. , The maximum number of iterations of the group G, the maximum variable Dmax that an individual frog can allow when changing positions, etc.
  • Step S203 Calculate the fitness value of each frog individual in the initial group by using a preset fitness value calculation method, and divide the initial group into multiple initial groups according to the fitness value;
  • the preset fitness value calculation method may be used to calculate the fitness value of each individual frog in the initial population, for example, the following fitness may be used
  • the value calculation formula calculates the fitness value of each individual frog:
  • F(X i ) is the fitness value of the frog individual i corresponding to the sample block i
  • a j is the gray value corresponding to the j-th pixel to be repaired in the first repair block
  • X ij is the sample block i
  • n is the total number of pixels in the sample block i.
  • the square sum of the pixel difference between the sample block and the first repaired block as the fitness value of the corresponding frog individual, so that the fitness value of each sample block and the first repaired The degree of matching between blocks.
  • each frog individual can be divided into groups according to the fitness value, so as to divide the initial group into multiple initial groups, where the number of initial groups is It can be the number of groups Q initialized in the preset frog leaping algorithm, and the initial group can be divided into Q initial groups.
  • the division process can be specifically as follows: first, all frog individuals are arranged in ascending order according to the fitness value, and then the first frog individual can be divided into the first group, and the second frog individual can be divided into the second group.
  • Ethnic group divide the q-th frog individual into the Q-th ethnic group, that is, first divide the first frog individual-the q-th frog individual into the first ethnic group to the Q-th ethnic group, and then divide the q+1 frog individual The frog individuals are again divided into the first group, and so on, until all the frog individuals are divided.
  • Step S204 Obtain the worst frog individual with the largest fitness value in each initial population, and update each worst frog individual according to a preset update method to obtain an updated new population;
  • the worst frog individuals in each initial population can be obtained, and the worst frog individuals can be updated according to a preset update method, such as shrinkage factor-based
  • the update method updates the worst frog individuals in each initial group to obtain each new group after the update, wherein the worst frog individual refers to the frog individual with the largest fitness value in each initial group or new group,
  • the optimal frog individual refers to the frog individual with the smallest fitness value in each initial group or new group.
  • the location update method based on the shrinkage factor ⁇ may specifically be:
  • newX i i sample blocks corresponding to individual i frog gradation value updated
  • is the shrinkage factor
  • X i is the grayscale value before the update frog individual i
  • D is the coefficient update step size frog subject.
  • the update step coefficient can be specifically set according to actual conditions.
  • the worst frog individuals are updated according to the preset update method to obtain the updated new group, which may include
  • Step S301 Update each worst frog individual according to a preset update method to obtain the updated worst frog individual;
  • Step S302 Calculate the updated new fitness value of the worst frog individual
  • Step S303 Determine whether the new fitness value meets a preset condition
  • Step S304 If the new fitness value meets the preset condition, obtain an updated new ethnic group
  • Step S305 If the new fitness value does not meet the preset condition, randomly generate a new frog individual, and replace the worst frog individual with the new frog individual to obtain an updated new population.
  • the updated fitness value of each worst frog individual can be calculated, and Determine whether the new fitness value meets a preset condition, for example, it can be determined whether the new fitness value is less than the fitness value of the worst frog individual before the update, if the new fitness value meets the preset condition, If the new fitness value is less than the fitness value of the worst frog individual before the update, then the updated worst frog individual is retained in the initial population, and the retained initial population is determined as the new updated population; If the new fitness value does not meet the preset condition, if the new fitness value is greater than or equal to the fitness value of the worst frog individual before the update, a new frog individual can be randomly generated and used The generated new frog individual replaces the worst frog individual to obtain the updated new population.
  • a preset condition for example, it can be determined whether the new fitness value is less than the fitness value of the worst frog individual before the update, if the new fitness value meets the preset condition, If the new fitness value is less than the fitness value of
  • Step S205 Determine whether the new ethnic group meets a first preset termination condition
  • Step S206 If the new ethnic group does not meet the first preset termination condition, determine the new ethnic group as the initial ethnic group, and return to the step of obtaining the worst frog individual with the largest fitness value among the initial ethnic groups; and Next steps
  • Step S207 If the new ethnic group meets the first preset termination condition, mix each of the new ethnic groups to obtain a new group;
  • each frog individual can be recalculated in each new population, and then the worst frog individual with the largest fitness value can be obtained again, and the worst frog individual obtained again can be updated again until the value in each new population
  • the number of iterations reaches 5, that is, until the update of the worst frog individuals in each group is performed 5 times, the iterative operation is stopped, and then all new groups after the iteration are stopped are mixed to obtain a new group.
  • the first preset termination condition may also be whether the optimal frog individuals in each ethnic group have the same algebra continuously reach the first preset algebra value, which can be used in the update process of the ethnic group.
  • the optimal frog individual has the same continuous algebra.
  • the iterative operation is stopped, and then all the new populations after the iteration are stopped are mixed to obtain New groups.
  • Step S208 Determine whether the new group meets a second preset termination condition
  • Step S209 If the new group satisfies the second preset termination condition, obtain the optimal frog individual of the new group, and determine the sample block corresponding to the optimal frog individual as the first restoration The best matching block with the most similar blocks;
  • Step S210 If the new group does not meet the second preset termination condition, determine the new group as the initial group, and return to execute the calculation of each frog individual in the initial group using a preset fitness value calculation method The fitness value of the steps and subsequent steps.
  • the second preset termination condition may be Whether the number of iterations of the group reaches the preset maximum number of iterations of the group G, for example, when the maximum number of iterations of the group G is set to 10 times, after a new mixed group is obtained, judge whether the number of iterations of the new group reaches 10 times If it has not reached 10 times, it can be determined that the new group does not meet the second preset condition, and the fitness value of each frog individual in the new group is recalculated, and then the fitness value is recalculated according to the newly calculated fitness value.
  • the second preset termination condition may be Whether the number of iterations of the group reaches the preset maximum number of iterations of the group G, for example, when the maximum number of iterations of the group G is set to 10 times, after a new mixed group is obtained, judge whether the number of iterations of the new group reaches 10 times If it has not reached 10 times, it can be determined that the new group does not meet the second preset condition,
  • the second preset termination condition may also be whether the optimal frog individuals in the group have reached the second preset algebraic value for the same number of consecutive algebras, that is, real-time statistics of the optimal frog individuals in the group iteration process For the same algebra, when the same consecutive algebra reaches the preset second preset algebra value, the iterative operation is stopped, and the sample block represented by the optimal frog individual of the current new population is determined to be the same as the first restoration The best matching block with the most similar blocks.
  • Step S105 using the sample pixels corresponding to the best matching block to repair the corresponding pixels of the first repaired block;
  • the sample pixels corresponding to the best matching block can be used to fill the corresponding to-be-repaired in the first repaired block Pixel points to repair the first repair block.
  • Step S106 dividing the first repaired block that has been repaired into the source area, and updating the boundary pixels of the target area;
  • Step S107 Determine whether the number of updated boundary pixels is greater than a set threshold
  • Step S108 If the number of updated boundary pixels is less than or equal to the set threshold, it is determined that the original image restoration is completed and the updated source area is obtained; if the number of updated boundary pixels is If it is greater than the set threshold, return to the execution of the step of constructing multiple repair blocks of preset size with each boundary pixel as the center point and subsequent steps.
  • the repaired first repaired block can be divided into the source area, and the repaired first repaired block
  • the corresponding boundary pixels determine the known sample pixels to update the boundary pixels of the target area.
  • the target area can be detected to determine whether the original image has been repaired, That is, it is detected whether the number of boundary pixels of the target area is greater than a set threshold, where the set threshold can be set to 0, that is, it is detected whether the target area is empty. The number of boundary pixels is greater than the set threshold. If it is greater than 0, it indicates that there is an unrepaired target area, that is, the original image has not been repaired.
  • the repair block can be reconstructed based on the updated boundary pixels. , And recalculate the priority of each newly constructed repair block to determine and repair the next first repair block until the number of boundary pixels in the target area is less than or equal to the set threshold, as described When the number of boundary pixels of the target area is equal to 0, it is determined that the restoration of the original image is completed, and the restored restoration image is obtained.
  • a preset leaping algorithm can be used to find the best matching block most similar to the first repaired block in the source area, so as to use the most
  • the sample pixels of the best matching block are used to repair the first repaired block, that is, the search and matching of the best matching block can be performed through the fast local search and global search of the preset frog leaping algorithm, which can reduce the search and matching time of the best matching block Complexity, reducing the time occupied by search and matching, thereby greatly improving the repair speed and efficiency of image repair.
  • an embodiment of the present application provides an image restoration device, and the image restoration device includes:
  • the boundary point acquisition module 401 is used to determine the target area to be repaired and the known source area in the original image, and to acquire boundary pixels of the target area, where the known source area is the original image The area outside the target area;
  • the repair block construction module 402 is used to construct multiple repair blocks of a preset size with each boundary pixel as a center point, wherein the number of the constructed repair block corresponds to the number of the boundary pixel;
  • the priority calculation module 403 is configured to calculate the priority of each repair block according to the number of sample pixels in each repair block and the structure information of each repair block, and select the first repair block according to the priority;
  • a matching block searching module 404 configured to search for the best matching block that is most similar to the first repaired block in the source area by using a preset leapfrog algorithm
  • a repair block repair module 405, configured to use the sample pixels corresponding to the best matching block to repair the corresponding pixels of the first repair block;
  • a boundary point update module 406, configured to divide the first repaired block that has been repaired into the source area, and update the boundary pixels of the target area;
  • the repair completion determination module 407 is configured to return to the execution of the step of constructing multiple repair blocks of preset size with each boundary pixel as the center point and subsequent steps if the number of updated boundary pixels is greater than the set threshold. Until the number of updated boundary pixels is less than or equal to the set threshold, it is determined that the original image is repaired and the updated source area is acquired.
  • the matching block searching module 404 may include:
  • a sample block construction unit configured to obtain sample pixels of the source area, and construct a plurality of sample blocks of the preset size in the source area with the sample pixel as a center point;
  • An initial population acquisition unit configured to determine each of the sample blocks as an individual frog, and obtain the initial population of the preset frog leaping algorithm
  • the initial ethnic group division unit is configured to calculate the fitness value of each frog individual in the initial group using a preset fitness value calculation method, and divide the initial group into multiple initial ethnic groups according to the fitness value;
  • the new ethnic group acquisition unit is used to acquire the worst frog individual with the largest fitness value in each initial ethnic group, and update each worst frog individual according to the preset update method to obtain the updated new ethnic group;
  • a new ethnic group judging unit configured to determine whether the new ethnic group meets the first preset termination condition
  • the initial ethnic group determination unit is configured to determine the new ethnic group as the initial ethnic group if the new ethnic group does not meet the first preset termination condition, and return to execute the process of obtaining the worst frog with the largest fitness value among the initial ethnic groups Individual steps and subsequent steps;
  • a new group obtaining unit configured to mix each of the new groups to obtain a new group if the new group meets the first preset termination condition
  • the new group judgment unit is used to judge whether the new group meets the second preset termination condition
  • the matching block determination unit is configured to, if the new group meets the second preset termination condition, obtain the optimal frog individual of the new group, and determine the sample block corresponding to the optimal frog individual as the The best matching block that is the most similar to the first repaired block;
  • the initial group determining unit is configured to determine the new group as the initial group if the new group does not meet the second preset termination condition, and return to execute the calculation of the initial group using a preset fitness value calculation method The steps in the fitness value of each frog individual and subsequent steps.
  • the preset fitness value calculation method is:
  • F(X i ) is the fitness value of the frog individual i corresponding to the sample block i
  • a j is the gray value corresponding to the j-th pixel to be repaired in the first repair block
  • X ij is the sample block i
  • n is the total number of pixels in the sample block i.
  • the new ethnic group acquiring unit is specifically configured to update each worst frog individual according to the following update formula:
  • newX i i sample blocks corresponding to individual i frog gradation value updated
  • X i is the grayscale value before the update frog individual i
  • D is the coefficient update step size frog subject.
  • the new ethnic group acquiring unit may include:
  • the update subunit is used to update each worst frog individual according to a preset update method to obtain the updated worst frog individual;
  • the new fitness value calculation subunit is used to calculate the updated new fitness value of the worst frog individual
  • the new fitness value judgment subunit is used to judge whether the new fitness value meets a preset condition
  • the individual random generation subunit is used to randomly generate a new frog individual if the new fitness value does not meet the preset condition, and replace the worst frog individual with the new frog individual to obtain the updated frog individual New ethnic group.
  • the priority calculation module 403 is specifically configured to calculate the priority of each repair block according to the following formula:
  • Priority(p) is the priority of repairing block p
  • Credit(p) is the confidence of repairing block p, indicating the number of sample pixels included in repairing block p
  • Data(p) is the data of repairing block p Item, representing the structure information of the repair block p
  • is the target area
  • is the number of pixels to be repaired in the repair block p
  • n p is the normal vector of the edge pixel p of the repair block p
  • is the normalized parameter.
  • Fig. 5 is a schematic diagram of a terminal device provided by an embodiment of the present application.
  • a terminal device 5 of this embodiment includes: a processor 50, a memory 51, and computer-readable instructions 52 stored in the memory 51 and executable on the processor 50, such as an image Repair procedures.
  • the processor 50 executes the computer-readable instructions 52
  • the steps in the foregoing image restoration method embodiments such as steps S101 to S108 shown in FIG. 1
  • the processor 50 executes the computer-readable instructions 52
  • the functions of the modules/units in the foregoing device embodiments such as the functions of the modules 401 to 407 shown in FIG. 4, are realized.
  • the computer-readable instruction 52 may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 51 and executed by the processor 50, To complete this application.
  • the one or more modules/units may be a series of computer-readable instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer-readable instructions 52 in the terminal device 5.
  • the terminal device 5 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the terminal device may include, but is not limited to, a processor 50 and a memory 51.
  • FIG. 5 is only an example of the terminal device 5, and does not constitute a limitation on the terminal device 5. It may include more or less components than shown in the figure, or a combination of certain components, or different components.
  • the terminal device may also include input and output devices, network access devices, buses, etc.
  • the processor 50 may be a central processing unit (Central Processing Unit, CPU), other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (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 also be any conventional processor or the like.
  • the memory 51 may be an internal storage unit of the terminal device 5, such as a hard disk or a memory of the terminal device 5.
  • the memory 51 may also be an external storage device of the terminal device 5, for example, a plug-in hard disk equipped on the terminal device 5, a smart memory card (Smart Media Card, SMC), and a Secure Digital (SD) Card, Flash Card, etc. Further, the memory 51 may also include both an internal storage unit of the terminal device 6 and an external storage device.
  • the memory 51 is used to store the computer readable instructions and other programs and data required by the terminal device.
  • the memory 51 can also be used to temporarily store data that has been output or will be output.
  • each 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 may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

本申请涉及图像处理技术领域,尤其涉及一种图像修复方法、装置、存储介质及终端设备。所述方法包括确定原始图像中待修复的目标区域和已知的源区域,并获取目标区域的边界像素点;以各边界像素点为中心点,构建预设大小的多个修复块;计算各修复块的优先权,并根据优先权选择最先修复块;利用预设蛙跳算法寻找源区域中与最先修复块最相似的最佳匹配块;采用最佳匹配块对应的样本像素点修复最先修复块的对应像素点;将已修复的最先修复块划分至源区域,并更新目标区域的边界像素点,若边界像素点的个数大于设定阈值,返回执行以各边界像素点为中心点,构建预设大小的多个修复块的步骤以及后续步骤,以通过预设蛙跳算法进行搜索匹配,减少搜索时长。

Description

一种图像修复方法、装置、存储介质及终端设备
本申请要求于2019年05月21日提交中国专利局、申请号为201910422744.5、发明名称为“一种图像修复方法、装置、存储介质及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理技术领域,尤其涉及一种图像修复方法、装置、计算机可读存储介质及终端设备。
背景技术
图像修复是一种利用图像中的已知信息来对图像中的受损区域进行恢复的技术,以使得图像修复效果满足人的视觉需求,从而让观察者觉察不出图像曾经破损。目前,一般采用基于Criminisi算法的图像修复方法来进行图像的修复,Criminisi算法在进行图像修复时,采用的是基于SSD匹配原则的全局搜索,即在计算出待修复像素点与各已知像素点差值的平方和后,通过SSD匹配原则进行全局搜索来得到最小平方和,以根据最小平方和确定最佳匹配块来进行图像修复,这种基于全局搜索的图像修复方法可适用于小面积的待修复图像,而对于大面积的待修复图像使用这种基于全局搜索的图像修复方法,将会导致搜索匹配占用时间较长,极大地增加了算法的时间复杂度,从而使得图像修复速度较慢以及效率较低。
技术问题
本申请实施例提供了一种图像修复方法、装置、计算机可读存储介质及终端设备,能够降低图像修复中最佳匹配块搜索匹配的时间复杂度,减少搜索匹配的占用时长,提高图像修复的修复速度和修复效率。
技术解决方案
本申请实施例的第一方面,提供了一种图像修复方法,包括:
确定原始图像中待修复的目标区域和已知的源区域,并获取所述目标区域的边界像素点,其中,已知的源区域为所述原始图像中除所述目标区域以外的区域;
以各边界像素点为中心点,构建预设大小的多个修复块,其中,所构建的修复块的数量与边界像素点的数量对应;
根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,并根据所述优先权选择最先修复块;
利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块;
采用所述最佳匹配块对应的样本像素点修复所述最先修复块的对应像素点;
将已修复的所述最先修复块划分至所述源区域,并更新所述目标区域的边界像素点;
若更新后的边界像素点的个数大于设定阈值,则返回执行以各边界像素点为中心点,构建预设大小的多个修复块的步骤以及后续步骤,直到更新后的边界像素点的个数小于或者等于所述设定阈值时,确定所述原始图像修复完成并获取更新后的所述源区域。
本申请实施例的第二方面,提供了一种图像修复装置,包括:
边界点获取模块,用于确定原始图像中待修复的目标区域和已知的源区域,并获取所述目标区域的边界像素点,其中,已知的源区域为所述原始图像中除所述目标区域以外的区域;
修复块构建模块,用于以各边界像素点为中心点,构建预设大小的多个修复块,其中,所构建的修复块的数量与边界像素点的数量对应;
优先权计算模块,用于根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,并根据所述优先权选择最先修复块;
匹配块寻找模块,用于利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块;
修复块修复模块,用于采用所述最佳匹配块对应的样本像素点修复所述最先修复块的 对应像素点;
边界点更新模块,用于将已修复的所述最先修复块划分至所述源区域,并更新所述目标区域的边界像素点;
修复完成确定模块,用于若更新后的边界像素点的个数大于设定阈值,则返回执行以各边界像素点为中心点,构建预设大小的多个修复块的步骤以及后续步骤,直到更新后的边界像素点的个数小于或者等于所述设定阈值时,确定所述原始图像修复完成并获取更新后的所述源区域。
本申请实施例的第三方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如前述第一方面所述图像修复方法的步骤。
本申请实施例的第四方面,提供了一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:
确定原始图像中待修复的目标区域和已知的源区域,并获取所述目标区域的边界像素点,其中,已知的源区域为所述原始图像中除所述目标区域以外的区域;
以各边界像素点为中心点,构建预设大小的多个修复块,其中,所构建的修复块的数量与边界像素点的数量对应;
根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,并根据所述优先权选择最先修复块;
利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块;
采用所述最佳匹配块对应的样本像素点修复所述最先修复块的对应像素点;
将已修复的所述最先修复块划分至所述源区域,并更新所述目标区域的边界像素点;
若更新后的边界像素点的个数大于设定阈值,则返回执行以各边界像素点为中心点,构建预设大小的多个修复块的步骤以及后续步骤,直到更新后的边界像素点的个数小于或者等于所述设定阈值时,确定所述原始图像修复完成并获取更新后的所述源区域。
有益效果
本申请实施例中,在确定出待修复的原始图像的最先修复块后,可通过预设蛙跳算法来寻找源区域中与该最先修复块最相似的最佳匹配块,从而利用最佳匹配块的样本像素点来对最先修复块进行修复,即通过预设蛙跳算法的快速局部搜索和全局搜索来进行最佳匹配块的搜索匹配,可降低最佳匹配块搜索匹配的时间复杂度,减少搜索匹配的占用时长,从而极大地提高了图像修复的修复速度和修复效率。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例中一种图像修复方法的一个实施例流程图;
图2为本申请实施例中一种图像修复方法在一个应用场景下寻找最佳匹配块的流程示意图;
图3为本申请实施例中一种图像修复方法在一个应用场景下更新青蛙个体的流程示意图;
图4为本申请实施例中一种图像修复装置的一个实施例结构图;
图5为本申请一实施例提供的一种终端设备的示意图。
本发明的实施方式
本申请实施例提供了一种图像修复方法、装置、计算机可读存储介质及终端设备,用于降低图像修复中最佳匹配块搜索匹配的时间复杂度,减少搜索匹配的占用时长,提高图像修复的修复速度和修复效率。
为使得本申请的发明目的、特征能够更加的明显和易懂,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,下面所描述的实施例仅仅是本申请一部分实施例,而非全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。
请参阅图1,本申请实施例提供了一种图像修复方法,所述图像修复方法包括:
步骤S101、确定原始图像中待修复的目标区域和已知的源区域,并获取所述目标区域的边界像素点,其中,已知的源区域为所述原始图像中除所述目标区域以外的区域;
本申请实施例的执行主体为终端设备,该终端设备包括但不限于:服务器、计算机、智能手机以及平板电脑等设备。当某一原始图像存在破损需要对其进行修复时,可由相关人员自行标记出待修复的区域,并将标记后的原始图像输入至该终端设备中,该终端设备在接收到该原始图像后,即可根据标记确定出该原始图像中待修复的目标区域,并将该原始图像中除目标区域以外的区域确定为完好已知的源区域,同时确定出目标区域与源区域之间的边界,并获取边界处的边界像素点。
可以理解的是,本申请实施例中,也可以在该终端设备中集成识别算法来自动识别原始图像中的破损区域,即当需要进行图像修复时,可直接将待修复的原始图像输入至该终端设备中,由该终端设备自行识别出该原始图像中待修复的区域,以确定出目标区域和源区域,从而省去人工标记过程,避免人工参与,提高图像修复的准确性和修复效率。
步骤S102、以各边界像素点为中心点,构建预设大小的多个修复块,其中,所构建的修复块的数量与边界像素点的数量对应;
本申请实施例中,在获取到所述目标区域中的边界像素点后,则可以各边界像素点为中心点,构建出多个预设大小的修复块,如构建出多个m×n像素的修复块。其中,所述预设大小可以根据实际需要进行选取,而所构建的修复块的数量则与边界像素点的数量对应。
步骤S103、根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,并根据所述优先权选择最先修复块;
在此,在构建出多个预设大小的修复块后,可根据下述公式计算各修复块的优先权,并可将具有最高优先权的修复块确定为最先修复块,以进行首先修复:
Priority(p)=Credit(p)*Data(p)
Figure PCTCN2019122568-appb-000001
其中,Priority(p)为修复块p的优先权,Credit(p)为修复块p的置信度,表示修复块p中包含的样本像素点的个数,Data(p)为修复块p的数据项,表示修复块p的结构信息,
Figure PCTCN2019122568-appb-000002
Ω为目标区域,
Figure PCTCN2019122568-appb-000003
为源区域,|Ψp|为修复块p的待修复像素点的个数,n p为修复块p的边缘像素点p的法向量,
Figure PCTCN2019122568-appb-000004
为边缘像素点p处的等辐照线的方向和强度,α为归一化参数。
可以理解的是,归一化参数α可以为255,|n p|=1。当修复块中位于源区域的样本像素点多,或者已填充好的像素点多,表明在修复过程中该修复块能提供更可靠的信息,因此置信度就会比较高,应优先修复。
Figure PCTCN2019122568-appb-000005
具体表示边缘像素点p梯度方向的垂直方向,其中,
Figure PCTCN2019122568-appb-000006
可通过偏微分方式来求取,如可根据
Figure PCTCN2019122568-appb-000007
I x、I y为边缘像素点在x、y方向上的偏微分来求取。由于图像在一个像素点上梯度值较大时,该点附近图像的纹理较为丰富、线性结构信息较多,而通过优先修复纹理较为丰富、线性结构信息较多的像素点,可使得图像的边缘结构更加平滑,进而使得修复效率和修复效果更好。因此,在图像修复过程中,图像的边缘部分,即纹理较为复杂、线性结构信息比较多的区域应优先得到修复,以使得图像在纹理 修复的同时能扩散图像的结构信息,从而提高图像修复效率和修复效果。
步骤S104、利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块;
本申请实施例中,在确定出最先修复块后,则可以利用预设蛙跳算法来寻找完好的源区域中与所述最先修复块最相似的最佳匹配块,以通过所述最佳匹配块来进行所述最先修复块的修复。具体地,如图2所示,所述利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块,可以包括:
步骤S201、获取所述源区域的样本像素点,并以所述样本像素点为中心点在所述源区域中构建所述预设大小的多个样本块;
可以理解的是,在利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块时,可首先在所述源区域中构建与所述最先修复块大小相同的多个样本块,以使得可利用样本块的样本像素点来对最先待修复块进行修复。具体地,可首先获取所述源区域的各样本像素点,随后以各样本像素点为中心点在所述源区域中构建出所述预设大小的样本块,如若修复块的大小为4×3像素的话,则所构建的各样本块的大小也为4×3像素。
步骤S202、将各所述样本块确定为一青蛙个体,得到所述预设蛙跳算法的初始群体;
本申请实施例中,在所述源区域中构建出各样本块后,则可将各样本块设置为一青蛙个体,从而得到所述预设蛙跳算法的初始群体。可以理解的是,本申请实施例中,还可事先在该终端设备中进行预设蛙跳算法的初始化,即可预先设置所述预设蛙跳算法的族群数Q、族群内最大迭代次数J、群体最大迭代次数G、青蛙个体在改变位置时能够允许的最大变量Dmax等等。
步骤S203、采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值,并根据所述适应度值将所述初始群体划分为多个初始族群;
可以理解的是,在确定出所述预设蛙跳算法的初始群体后,可采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值,如可采用下述适应度值计算公式计算各青蛙个体的适应度值:
Figure PCTCN2019122568-appb-000008
其中,F(X i)为样本块i对应的青蛙个体i的适应度值,a j为最先修复块中的第j个待修复像素点对应的灰度值,X ij为样本块i中的第j个样本像素点对应的灰度值,n为样本块i中像素点的总个数。
本申请实施例中,优选采用样本块与最先修复块之间的像素差值的平方和来作为对应青蛙个体的适应度值,从而可通过适应度值初步反映出各样本块与最先修复块之间的匹配程度。
在此,在计算得到各青蛙个体的适应度值后,则可根据适应度值对各青蛙个体进行族群划分,以将所述初始群体划分为多个初始族群,其中,初始族群的族群数则可为所述预设蛙跳算法中初始化的族群数Q,即可将所述初始群体划分为Q个初始族群。其中,划分过程具体可以为:首先按照适应度值的大小对所有青蛙个体进行升序排列,然后,可将排名第1的青蛙个体划分至第1族群、将排名第2的青蛙个体划分至第2族群、……、将排名第q的青蛙个体划分至第Q族群,即首先将第1只青蛙个体-第q只青蛙个体分别划分至第1族群至第Q族群,再将第q+1只青蛙个体再次划分至第1族群,依次类推,直至将所有的青蛙个体划分完毕。
步骤S204、获取各初始族群中适应度值最大的最差青蛙个体,并按照预设更新方式对各最差青蛙个体进行更新,得到更新后的新族群;
在完成所有青蛙个体的划分,得到Q个初始族群后,可获取各初始族群内的最差青蛙个体,并可按照预设更新方式对各最差青蛙个体进行更新,如可采用基于收缩因子的更新方 式分别对各初始族群内的最差青蛙个体进行更新,以得到更新后的各新族群,其中,所述最差青蛙个体是指各初始族群或者新族群内适应度值最大的青蛙个体,相应地,最优青蛙个体则是指各初始族群或者新族群内适应度值最小的青蛙个体。本申请实施例中,基于收缩因子ε的位置更新方式具体可以为:
newX i=ε*(X i+D)
Figure PCTCN2019122568-appb-000009
phi=4*rand(i)
其中,newX i为样本块i对应的青蛙个体i更新后的灰度值,ε为收缩因子,X i为青蛙个体i更新之前的灰度值,D为青蛙个体的更新步长系数。在此,更新步长系数可根据实际情况进行具体设定。
进一步地,如图3所示,所述按照预设更新方式对各最差青蛙个体进行更新,得到更新后的新族群,可以包括
步骤S301、按照预设更新方式对各最差青蛙个体进行更新,得到更新后的最差青蛙个体;
步骤S302、计算更新后的最差青蛙个体的新适应度值;
步骤S303、判断所述新适应度值是否满足预设条件;
步骤S304、若所述新适应度值满足所述预设条件,则得到更新后的新族群;
步骤S305、若所述新适应度值不满足所述预设条件,则随机生成一新青蛙个体,并利用所述新青蛙个体替换所述最差青蛙个体,得到更新后的新族群。
对于上述步骤S301至步骤S305,可以理解的是,在采用基于收缩因子ε的更新方式对各最差青蛙个体进行更新后,可计算更新后的各最差青蛙个体的新适应度值,并可判断所述新适应度值是否满足预设条件,如可判断所述新适应度值是否小于该最差青蛙个体更新前的适应度值,若所述新适应度值满足所述预设条件,如所述新适应度值小于该最差青蛙个体更新前的适应度值的话,则在初始族群中保留更新后的最差青蛙个体,并将保留后的初始族群确定为更新后的新族群;若所述新适应度值不满足所述预设条件,如所述新适应度值大于或者等于该最差青蛙个体更新前的适应度值的话,则可随机生成一新青蛙个体,并可以利用所生成的新青蛙个体来替换该最差青蛙个体,以得到更新后的新族群。
也就是说,当某一初始族群中的最差青蛙个体,在采用基于收缩因子ε的更新方式进行更新后,并未得到优化时,则可通过随机产生一个全新的青蛙个体作为该初始族群中的青蛙个体,以替换未优化的最差青蛙个体来得到对应的新族群,从而提高所述预设蛙跳算法的收敛速度,进而提高图像修复效率。
步骤S205、判断所述新族群是否满足第一预设终止条件;
步骤S206、若所述新族群不满足所述第一预设终止条件,则将所述新族群确定为初始族群,并返回执行获取各初始族群中适应度值最大的最差青蛙个体的步骤以及后续步骤;
步骤S207、若所述新族群满足所述第一预设终止条件,则对各所述新族群进行混合,得到新群体;
对于上述步骤S205至步骤S207,可以理解的是,在得到各初始族群的每一代新族群后,可判断所述新族群是否满足第一预设终止条件,其中,所述第一预设终止条件可以为各族群的迭代次数是否达到预先设置的族群内最大迭代次数J,如当族群内最大迭代次数J设置为5次时,则表明对各族群需进行5次最差青蛙个体的更新,因此,在得到各初始族群的每一代新族群后,可判断各新族群的迭代次数是否达到5次,若未达到5次的话,则可确定新族群不满足所述第一预设终止条件,则可以在各新族群内重新计算各青蛙个体的适应度值,然后再次获取适应度值最大的最差青蛙个体,并对再次获取的各最差青蛙个体重新进行更新操作,直到各新族群中的迭代次数达到5次为止,即直到在各族群中进行了5次最差青蛙个体的更新时,停止迭代操作,然后对停止迭代后的所有新族群进行混合处理,以得到新群体。
可以理解的是,本申请实施例中,所述第一预设终止条件也可以为各族群中的最优青蛙个体连续相同的代数是否达到第一预设代数值,即可在族群的更新过程中实时统计最优青蛙个体连续相同的代数,当连续相同的代数达到预先设定的第一预设代数值时,则停止迭代操作,然后对停止迭代后的所有新族群进行混合处理,以得到新群体。
步骤S208、判断所述新群体是否满足第二预设终止条件;
步骤S209、若所述新群体满足所述第二预设终止条件,则获取所述新群体的最优青蛙个体,并将所述最优青蛙个体对应的样本块确定为与所述最先修复块最相似的最佳匹配块;
步骤S210、若所述新群体不满足所述第二预设终止条件,则将所述新群体确定为初始群体,并返回执行采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值的步骤以及后续步骤。
对于上述步骤S208至步骤S210,可以理解的是,在得到混合后的新群体之后,可进一步判断所述新群体是否满足第二预设终止条件,其中,所述第二预设终止条件可以为群体的迭代次数是否达到预先设置的群体最大迭代次数G,如当群体最大迭代次数G设置为10次时,则在得到混合后的新群体后,判断所述新群体的迭代次数是否达到10次,若未达到10次的话,则可确定新群体不满足所述第二预设条件,并对所述新群体的各青蛙个体重新进行适应度值的计算,然后按照新计算的适应度值重新进行族群的划分,并重新进行最差青蛙个体的更新,直到新群体的迭代次数达到10次时,停止迭代操作,并将所述新群体此时的最优青蛙个体所表示的样本块确定为与所述最先修复块最相似的最佳匹配块。
可以理解的是,所述第二预设终止条件也可以为群体中的最优青蛙个体连续相同的代数是否达到第二预设代数值,即可在群体迭代过程中实时统计最优青蛙个体连续相同的代数,当连续相同的代数达到预先设定的第二预设代数值时,则停止迭代操作,并将当前新群体的最优青蛙个体所表示的样本块确定为与所述最先修复块最相似的最佳匹配块。
步骤S105、采用所述最佳匹配块对应的样本像素点修复所述最先修复块的对应像素点;
本申请实施例中,在得到与所述最先修复块最相似的最佳匹配块后,可采用所述最佳匹配块对应的样本像素点来填充所述最先修复块中待修复的对应像素点,以对所述最先修复块进行修复。
步骤S106、将已修复的所述最先修复块划分至所述源区域,并更新所述目标区域的边界像素点;
步骤S107、判断更新后的边界像素点的个数是否大于设定阈值;
步骤S108、若更新后的边界像素点的个数小于或者等于所述设定阈值,则确定所述原始图像修复完成并获取更新后的所述源区域;若更新后的边界像素点的个数大于所述设定阈值,则返回执行以各边界像素点为中心点,构建预设大小的多个修复块的步骤以及后续步骤。
对于上述步骤S106至步骤S108,可以理解的是,在每一次完成最先修复块的修复之后,可将修复完成的最先修复块划分至所述源区域,并将修复完成的最先修复块所对应的边界像素点确定已知的样本像素点来更新所述目标区域的边界像素点,边界像素点更新完成后,可对所述目标区域进行检测,以判断所述原始图像是否修复完成,即检测所述目标区域的边界像素点的个数是否大于设定阈值,其中,所述设定阈值可以设置为0,也就是说,检测所述目标区域是否为空,若所述目标区域的边界像素点的个数大于设定阈值,如大于0的话,则表明还存在未修复的目标区域,即所述原始图像未修复完成,此时则可根据更新后的边界像素点重新构建修复块,并重新计算所新构建的各修复块的优先权来进行下一个最先修复块的确定与修复,直到所述目标区域的边界像素点的个数小于或者等于设定阈值时,如所述目标区域的边界像素点的个数等于0时,则确定所述原始图像修复完成,并获取修复完成的修复图像。
本申请实施例中,在确定出待修复的原始图像的最先修复块后,可通过预设蛙跳算法来寻找源区域中与该最先修复块最相似的最佳匹配块,从而利用最佳匹配块的样本像素点来对最先修复块进行修复,即通过预设蛙跳算法的快速局部搜索和全局搜索来进行最佳匹配块 的搜索匹配,可降低最佳匹配块搜索匹配的时间复杂度,减少搜索匹配的占用时长,从而及大地提高了图像修复的修复速度和修复效率。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
上面主要描述了一种图像修复方法,下面将对一种图像修复装置进行详细描述。
如图4所示,本申请实施例提供了一种图像修复装置,所述图像修复装置包括:
边界点获取模块401,用于确定原始图像中待修复的目标区域和已知的源区域,并获取所述目标区域的边界像素点,其中,已知的源区域为所述原始图像中除所述目标区域以外的区域;
修复块构建模块402,用于以各边界像素点为中心点,构建预设大小的多个修复块,其中,所构建的修复块的数量与边界像素点的数量对应;
优先权计算模块403,用于根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,并根据所述优先权选择最先修复块;
匹配块寻找模块404,用于利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块;
修复块修复模块405,用于采用所述最佳匹配块对应的样本像素点修复所述最先修复块的对应像素点;
边界点更新模块406,用于将已修复的所述最先修复块划分至所述源区域,并更新所述目标区域的边界像素点;
修复完成确定模块407,用于若更新后的边界像素点的个数大于设定阈值,则返回执行以各边界像素点为中心点,构建预设大小的多个修复块的步骤以及后续步骤,直到更新后的边界像素点的个数小于或者等于所述设定阈值时,确定所述原始图像修复完成并获取更新后的所述源区域。
进一步地,所述匹配块寻找模块404,可以包括:
样本块构建单元,用于获取所述源区域的样本像素点,并以所述样本像素点为中心点在所述源区域中构建所述预设大小的多个样本块;
初始群体获取单元,用于将各所述样本块确定为一青蛙个体,得到所述预设蛙跳算法的初始群体;
初始族群划分单元,用于采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值,并根据所述适应度值将所述初始群体划分为多个初始族群;
新族群获取单元,用于获取各初始族群中适应度值最大的最差青蛙个体,并按照预设更新方式对各最差青蛙个体进行更新,得到更新后的新族群;
新族群判断单元,用于判断所述新族群是否满足第一预设终止条件;
初始族群确定单元,用于若所述新族群不满足所述第一预设终止条件,则将所述新族群确定为初始族群,并返回执行获取各初始族群中适应度值最大的最差青蛙个体的步骤以及后续步骤;
新群体获取单元,用于若所述新族群满足所述第一预设终止条件,则对各所述新族群进行混合,得到新群体;
新群体判断单元,用于判断所述新群体是否满足第二预设终止条件;
匹配块确定单元,用于若所述新群体满足所述第二预设终止条件,则获取所述新群体的最优青蛙个体,并将所述最优青蛙个体对应的样本块确定为与所述最先修复块最相似的最佳匹配块;
初始群体确定单元,用于若所述新群体不满足所述第二预设终止条件,则将所述新群体确定为初始群体,并返回执行采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值的步骤以及后续步骤。
优选地,所述预设适应度值计算方式为:
Figure PCTCN2019122568-appb-000010
其中,F(X i)为样本块i对应的青蛙个体i的适应度值,a j为最先修复块中的第j个待修复像素点对应的灰度值,X ij为样本块i中的第j个样本像素点对应的灰度值,n为样本块i中像素点的总个数。
可选地,所述新族群获取单元,具体用于根据下述更新公式对各最差青蛙个体进行更新:
newX i=ε*(X i+D)
Figure PCTCN2019122568-appb-000011
phi=4*rand(i)
其中,newX i为样本块i对应的青蛙个体i更新后的灰度值,X i为青蛙个体i更新之前的灰度值,D为青蛙个体的更新步长系数。
进一步地,所述新族群获取单元,可以包括:
更新子单元,用于按照预设更新方式对各最差青蛙个体进行更新,得到更新后的最差青蛙个体;
新适应度值计算子单元,用于计算更新后的最差青蛙个体的新适应度值;
新适应度值判断子单元,用于判断所述新适应度值是否满足预设条件;
个体随机生成子单元,用于若所述新适应度值不满足所述预设条件,则随机生成一新青蛙个体,并利用所述新青蛙个体替换所述最差青蛙个体,得到更新后的新族群。
优选地,所述优先权计算模块403,具体用于根据下述公式计算各修复块的优先权:
Priority(p)=Credit(p)*Data(p)
Figure PCTCN2019122568-appb-000012
Figure PCTCN2019122568-appb-000013
其中,Priority(p)为修复块p的优先权,Credit(p)为修复块p的置信度,表示修复块p中包含的样本像素点的个数,Data(p)为修复块p的数据项,表示修复块p的结构信息,
Figure PCTCN2019122568-appb-000014
Ω为目标区域,
Figure PCTCN2019122568-appb-000015
为源区域,|Ψp|为修复块p的待修复像素点的个数,n p为修复块p的边缘像素点p的法向量,
Figure PCTCN2019122568-appb-000016
为边缘像素点p处的等辐照线的方向和强度,α为归一化参数。
图5是本申请一实施例提供的一种终端设备的示意图。如图5所示,该实施例的一种终端设备5包括:处理器50、存储器51以及存储在所述存储器51中并可在所述处理器50上运行的计算机可读指令52,例如图像修复程序。所述处理器50执行所述计算机可读指令52时实现上述各个图像修复方法实施例中的步骤,例如图1所示的步骤S101至步骤S108。或者,所述处理器50执行所述计算机可读指令52时实现上述各装置实施例中各模块/单元的功能,例如图4所示的模块401至模块407的功能。
示例性的,所述计算机可读指令52可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器51中,并由所述处理器50执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机可读指令52在所述终端设备5中的执行过程。
所述终端设备5可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端设备可包括,但不仅限于,处理器50、存储器51。本领域技术人员可以理解,图5仅仅是终端设备5的示例,并不构成对终端设备5的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备还可以包括输入输出设备、网 络接入设备、总线等。
所述处理器50可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器51可以是所述终端设备5的内部存储单元,例如终端设备5的硬盘或内存。所述存储器51也可以是所述终端设备5的外部存储设备,例如所述终端设备5上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器51还可以既包括所述终端设备6的内部存储单元也包括外部存储设备。所述存储器51用于存储所述计算机可读指令以及所述终端设备所需的其他程序和数据。所述存储器51还可以用于暂时地存储已经输出或者将要输出的数据。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机非易失性可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种图像修复方法,其特征在于,包括:
    确定原始图像中待修复的目标区域和已知的源区域,并获取所述目标区域的边界像素点,其中,已知的源区域为所述原始图像中除所述目标区域以外的区域;
    以各边界像素点为中心点,构建预设大小的多个修复块,其中,所构建的修复块的数量与边界像素点的数量对应;
    根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,并根据所述优先权选择最先修复块;
    利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块;
    采用所述最佳匹配块对应的样本像素点修复所述最先修复块的对应像素点;
    将已修复的所述最先修复块划分至所述源区域,并更新所述目标区域的边界像素点;
    若更新后的边界像素点的个数大于设定阈值,则返回执行以各边界像素点为中心点,构建预设大小的多个修复块的步骤以及后续步骤,直到更新后的边界像素点的个数小于或者等于所述设定阈值时,确定所述原始图像修复完成并获取更新后的所述源区域。
  2. 根据权利要求1所述的图像修复方法,其特征在于,所述利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块,包括:
    获取所述源区域的样本像素点,并以所述样本像素点为中心点在所述源区域中构建所述预设大小的多个样本块;
    将各所述样本块确定为一青蛙个体,得到所述预设蛙跳算法的初始群体;
    采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值,并根据所述适应度值将所述初始群体划分为多个初始族群;
    获取各初始族群中适应度值最大的最差青蛙个体,并按照预设更新方式对各最差青蛙个体进行更新,得到更新后的新族群;
    判断所述新族群是否满足第一预设终止条件;
    若所述新族群不满足所述第一预设终止条件,则将所述新族群确定为初始族群,并返回执行获取各初始族群中适应度值最大的最差青蛙个体的步骤以及后续步骤;
    若所述新族群满足所述第一预设终止条件,则对各所述新族群进行混合,得到新群体;
    判断所述新群体是否满足第二预设终止条件;
    若所述新群体满足所述第二预设终止条件,则获取所述新群体的最优青蛙个体,并将所述最优青蛙个体对应的样本块确定为与所述最先修复块最相似的最佳匹配块;
    若所述新群体不满足所述第二预设终止条件,则将所述新群体确定为初始群体,并返回执行采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值的步骤以及后续步骤。
  3. 根据权利要求2所述的图像修复方法,其特征在于,所述预设适应度值计算方式为:
    Figure PCTCN2019122568-appb-100001
    其中,F(X i)为样本块i对应的青蛙个体i的适应度值,a j为最先修复块中的第j个待修复像素点对应的灰度值,X ij为样本块i中的第j个样本像素点对应的灰度值,n为样本块i中像素点的总个数。
  4. 根据权利要求2所述的图像修复方法,其特征在于,所述按照预设更新方式对各最差青蛙个体进行更新,包括:
    根据下述更新公式对各最差青蛙个体进行更新:
    newX i=ε*(X i+D)
    Figure PCTCN2019122568-appb-100002
    其中,newX i为样本块i对应的青蛙个体i更新后的灰度值,X i为青蛙个体i更新之前的灰度值,D为青蛙个体的更新步长系数。
  5. 根据权利要求2所述的图像修复方法,其特征在于,所述按照预设更新方式对各最差青蛙个体进行更新,得到更新后的新族群,包括:
    按照预设更新方式对各最差青蛙个体进行更新,得到更新后的最差青蛙个体;
    计算更新后的最差青蛙个体的新适应度值;
    判断所述新适应度值是否满足预设条件;
    若所述新适应度值不满足所述预设条件,则随机生成一新青蛙个体,并利用所述新青蛙个体替换所述最差青蛙个体,得到更新后的新族群。
  6. 根据权利要求1至5中任一项所述的图像修复方法,其特征在于,所述根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,包括:
    根据下述公式计算各修复块的优先权:
    Priority(p)=Credit(p)*Data(p)
    Figure PCTCN2019122568-appb-100003
    Figure PCTCN2019122568-appb-100004
    其中,Priority(p)为修复块p的优先权,Credit(p)为修复块p的置信度,表示修复块p中包含的样本像素点的个数,Data(p)为修复块p的数据项,表示修复块p的结构信息,
    Figure PCTCN2019122568-appb-100005
    Ω为目标区域,
    Figure PCTCN2019122568-appb-100006
    为源区域,|Ψp|为修复块p的待修复像素点的个数,n p为修复块p的边缘像素点p的法向量,
    Figure PCTCN2019122568-appb-100007
    为边缘像素点p处的等辐照线的方向和强度,α为归一化参数。
  7. 一种图像修复装置,其特征在于,包括:
    边界点获取模块,用于确定原始图像中待修复的目标区域和已知的源区域,并获取所述目标区域的边界像素点,其中,已知的源区域为所述原始图像中除所述目标区域以外的区域;
    修复块构建模块,用于以各边界像素点为中心点,构建预设大小的多个修复块,其中,所构建的修复块的数量与边界像素点的数量对应;
    优先权计算模块,用于根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,并根据所述优先权选择最先修复块;
    匹配块寻找模块,用于利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块;
    修复块修复模块,用于采用所述最佳匹配块对应的样本像素点修复所述最先修复块的对应像素点;
    边界点更新模块,用于将已修复的所述最先修复块划分至所述源区域,并更新所述目标区域的边界像素点;
    修复完成确定模块,用于若更新后的边界像素点的个数大于设定阈值,则返回执行以各边界像素点为中心点,构建预设大小的多个修复块的步骤以及后续步骤,直到更新后的边界像素点的个数小于或者等于所述设定阈值时,确定所述原始图像修复完成并获取更新后的所述源区域。
  8. 根据权利要求7所述的图像修复装置,其特征在于,所述匹配块寻找模块,包括:
    样本块构建单元,用于获取所述源区域的样本像素点,并以所述样本像素点为中心点在所述源区域中构建所述预设大小的多个样本块;
    初始群体获取单元,用于将各所述样本块确定为一青蛙个体,得到所述预设蛙跳算法的初始群体;
    初始族群划分单元,用于采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值,并根据所述适应度值将所述初始群体划分为多个初始族群;
    新族群获取单元,用于获取各初始族群中适应度值最大的最差青蛙个体,并按照预设更新方式对各最差青蛙个体进行更新,得到更新后的新族群;
    新族群判断单元,用于判断所述新族群是否满足第一预设终止条件;
    初始族群确定单元,用于若所述新族群不满足所述第一预设终止条件,则将所述新族群确定为初始族群,并返回执行获取各初始族群中适应度值最大的最差青蛙个体的步骤以及后续步骤;
    新群体获取单元,用于若所述新族群满足所述第一预设终止条件,则对各所述新族群进行混合,得到新群体;
    新群体判断单元,用于判断所述新群体是否满足第二预设终止条件;
    匹配块确定单元,用于若所述新群体满足所述第二预设终止条件,则获取所述新群体的最优青蛙个体,并将所述最优青蛙个体对应的样本块确定为与所述最先修复块最相似的最佳匹配块;
    初始群体确定单元,用于若所述新群体不满足所述第二预设终止条件,则将所述新群体确定为初始群体,并返回执行采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值的步骤以及后续步骤。
  9. 根据权利要求8所述的图像修复装置,其特征在于,所述预设适应度值计算方式为:
    Figure PCTCN2019122568-appb-100008
    其中,F(X i)为样本块i对应的青蛙个体i的适应度值,a j为最先修复块中的第j个待修复像素点对应的灰度值,X ij为样本块i中的第j个样本像素点对应的灰度值,n为样本块i中像素点的总个数。
  10. 根据权利要求8所述的图像修复装置,其特征在于,所述新族群获取单元,具体用于根据下述更新公式对各最差青蛙个体进行更新:
    newX i=ε*(X i+D)
    Figure PCTCN2019122568-appb-100009
    其中,newX i为样本块i对应的青蛙个体i更新后的灰度值,X i为青蛙个体i更新之前的灰度值,D为青蛙个体的更新步长系数。
  11. 根据权利要求8所述的图像修复装置,其特征在于,所述新族群获取单元,包括:
    更新子单元,用于按照预设更新方式对各最差青蛙个体进行更新,得到更新后的最差青蛙个体;
    新适应度值计算子单元,用于计算更新后的最差青蛙个体的新适应度值;
    新适应度值判断子单元,用于判断所述新适应度值是否满足预设条件;
    个体随机生成子单元,用于若所述新适应度值不满足所述预设条件,则随机生成一新青蛙个体,并利用所述新青蛙个体替换所述最差青蛙个体,得到更新后的新族群。
  12. 根据权利要求7至11中任一项所述的图像修复装置,其特征在于,所述优先权计算模块,具体用于根据下述公式计算各修复块的优先权:
    Priority(p)=Credit(p)*Data(p)
    Figure PCTCN2019122568-appb-100010
    Figure PCTCN2019122568-appb-100011
    其中,Priority(p)为修复块p的优先权,Credit(p)为修复块p的置信度,表示修复块p中包含的样本像素点的个数,Data(p)为修复块p的数据项,表示修复块p的结构信息,
    Figure PCTCN2019122568-appb-100012
    Ω为目标区域,
    Figure PCTCN2019122568-appb-100013
    为源区域,|Ψp|为修复块p的待修复像素点的个数,n p为修复块p的边缘像素点p的法向量,
    Figure PCTCN2019122568-appb-100014
    为边缘像素点p处的等辐照线的方向和强度,α为归一化参数。
  13. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现如下步骤:
    确定原始图像中待修复的目标区域和已知的源区域,并获取所述目标区域的边界像素点,其中,已知的源区域为所述原始图像中除所述目标区域以外的区域;
    以各边界像素点为中心点,构建预设大小的多个修复块,其中,所构建的修复块的数量与边界像素点的数量对应;
    根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,并根据所述优先权选择最先修复块;
    利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块;
    采用所述最佳匹配块对应的样本像素点修复所述最先修复块的对应像素点;
    将已修复的所述最先修复块划分至所述源区域,并更新所述目标区域的边界像素点;
    若更新后的边界像素点的个数大于设定阈值,则返回执行以各边界像素点为中心点,构建预设大小的多个修复块的步骤以及后续步骤,直到更新后的边界像素点的个数小于或者等于所述设定阈值时,确定所述原始图像修复完成并获取更新后的所述源区域。
  14. 根据权利要求13所述的计算机可读存储介质,其特征在于,所述利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块,包括:
    获取所述源区域的样本像素点,并以所述样本像素点为中心点在所述源区域中构建所述预设大小的多个样本块;
    将各所述样本块确定为一青蛙个体,得到所述预设蛙跳算法的初始群体;
    采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值,并根据所述适应度值将所述初始群体划分为多个初始族群;
    获取各初始族群中适应度值最大的最差青蛙个体,并按照预设更新方式对各最差青蛙个体进行更新,得到更新后的新族群;
    判断所述新族群是否满足第一预设终止条件;
    若所述新族群不满足所述第一预设终止条件,则将所述新族群确定为初始族群,并返回执行获取各初始族群中适应度值最大的最差青蛙个体的步骤以及后续步骤;
    若所述新族群满足所述第一预设终止条件,则对各所述新族群进行混合,得到新群体;
    判断所述新群体是否满足第二预设终止条件;
    若所述新群体满足所述第二预设终止条件,则获取所述新群体的最优青蛙个体,并将所述最优青蛙个体对应的样本块确定为与所述最先修复块最相似的最佳匹配块;
    若所述新群体不满足所述第二预设终止条件,则将所述新群体确定为初始群体,并返回执行采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值的步骤以及后续步骤。
  15. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:
    确定原始图像中待修复的目标区域和已知的源区域,并获取所述目标区域的边界像素点,其中,已知的源区域为所述原始图像中除所述目标区域以外的区域;
    以各边界像素点为中心点,构建预设大小的多个修复块,其中,所构建的修复块的数 量与边界像素点的数量对应;
    根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,并根据所述优先权选择最先修复块;
    利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块;
    采用所述最佳匹配块对应的样本像素点修复所述最先修复块的对应像素点;
    将已修复的所述最先修复块划分至所述源区域,并更新所述目标区域的边界像素点;
    若更新后的边界像素点的个数大于设定阈值,则返回执行以各边界像素点为中心点,构建预设大小的多个修复块的步骤以及后续步骤,直到更新后的边界像素点的个数小于或者等于所述设定阈值时,确定所述原始图像修复完成并获取更新后的所述源区域。
  16. 根据权利要求15所述的终端设备,其特征在于,所述利用预设蛙跳算法寻找所述源区域中与所述最先修复块最相似的最佳匹配块,包括:
    获取所述源区域的样本像素点,并以所述样本像素点为中心点在所述源区域中构建所述预设大小的多个样本块;
    将各所述样本块确定为一青蛙个体,得到所述预设蛙跳算法的初始群体;
    采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值,并根据所述适应度值将所述初始群体划分为多个初始族群;
    获取各初始族群中适应度值最大的最差青蛙个体,并按照预设更新方式对各最差青蛙个体进行更新,得到更新后的新族群;
    判断所述新族群是否满足第一预设终止条件;
    若所述新族群不满足所述第一预设终止条件,则将所述新族群确定为初始族群,并返回执行获取各初始族群中适应度值最大的最差青蛙个体的步骤以及后续步骤;
    若所述新族群满足所述第一预设终止条件,则对各所述新族群进行混合,得到新群体;
    判断所述新群体是否满足第二预设终止条件;
    若所述新群体满足所述第二预设终止条件,则获取所述新群体的最优青蛙个体,并将所述最优青蛙个体对应的样本块确定为与所述最先修复块最相似的最佳匹配块;
    若所述新群体不满足所述第二预设终止条件,则将所述新群体确定为初始群体,并返回执行采用预设适应度值计算方式计算所述初始群体中各青蛙个体的适应度值的步骤以及后续步骤。
  17. 根据权利要求16所述的终端设备,其特征在于,所述预设适应度值计算方式为:
    Figure PCTCN2019122568-appb-100015
    其中,F(X i)为样本块i对应的青蛙个体i的适应度值,a j为最先修复块中的第j个待修复像素点对应的灰度值,X ij为样本块i中的第j个样本像素点对应的灰度值,n为样本块i中像素点的总个数。
  18. 根据权利要求16所述的终端设备,其特征在于,所述按照预设更新方式对各最差青蛙个体进行更新,包括:
    根据下述更新公式对各最差青蛙个体进行更新:
    newX i=ε*(X i+D)
    Figure PCTCN2019122568-appb-100016
    其中,newX i为样本块i对应的青蛙个体i更新后的灰度值,X i为青蛙个体i更新之前的灰度值,D为青蛙个体的更新步长系数。
  19. 根据权利要求16所述的终端设备,其特征在于,所述按照预设更新方式对各最差青蛙个体进行更新,得到更新后的新族群,包括:
    按照预设更新方式对各最差青蛙个体进行更新,得到更新后的最差青蛙个体;
    计算更新后的最差青蛙个体的新适应度值;
    判断所述新适应度值是否满足预设条件;
    若所述新适应度值不满足所述预设条件,则随机生成一新青蛙个体,并利用所述新青蛙个体替换所述最差青蛙个体,得到更新后的新族群。
  20. 根据权利要求15至19中任一项所述的终端设备,其特征在于,所述根据各修复块中样本像素点的个数和各修复块的结构信息计算各修复块的优先权,包括:
    根据下述公式计算各修复块的优先权:
    Priority(p)=Credit(p)*Data(p)
    Figure PCTCN2019122568-appb-100017
    Figure PCTCN2019122568-appb-100018
    其中,Priority(p)为修复块p的优先权,Credit(p)为修复块p的置信度,表示修复块p中包含的样本像素点的个数,Data(p)为修复块p的数据项,表示修复块p的结构信息,
    Figure PCTCN2019122568-appb-100019
    Ω为目标区域,
    Figure PCTCN2019122568-appb-100020
    为源区域,|Ψp|为修复块p的待修复像素点的个数,n p为修复块p的边缘像素点p的法向量,
    Figure PCTCN2019122568-appb-100021
    为边缘像素点p处的等辐照线的方向和强度,α为归一化参数。
PCT/CN2019/122568 2019-05-21 2019-12-03 一种图像修复方法、装置、存储介质及终端设备 Ceased WO2020233083A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910422744.5 2019-05-21
CN201910422744.5A CN110246095B (zh) 2019-05-21 2019-05-21 一种图像修复方法、装置、存储介质及终端设备

Publications (1)

Publication Number Publication Date
WO2020233083A1 true WO2020233083A1 (zh) 2020-11-26

Family

ID=67884666

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/122568 Ceased WO2020233083A1 (zh) 2019-05-21 2019-12-03 一种图像修复方法、装置、存储介质及终端设备

Country Status (2)

Country Link
CN (1) CN110246095B (zh)
WO (1) WO2020233083A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112561830A (zh) * 2020-12-23 2021-03-26 安徽大学 一种内窥镜图像高亮点修复方法及装置
CN113313651A (zh) * 2021-06-11 2021-08-27 中交三航(上海)新能源工程有限公司 一种基于周围变化的侧扫声呐图像纹理失真区域修复方法
CN113763409A (zh) * 2021-08-27 2021-12-07 南通大学 一种基于高斯滤波的高维脑核磁图像多阈值分割方法
CN115994873A (zh) * 2023-02-28 2023-04-21 北京字跳网络技术有限公司 图像处理方法、装置、设备及存储介质
CN116205801A (zh) * 2022-12-28 2023-06-02 江汉大学 一种图像的修复方法和装置
CN117457010A (zh) * 2023-02-27 2024-01-26 湖南芯海聆半导体有限公司 音频三维码编码方法和解码方法
CN118181421A (zh) * 2024-04-16 2024-06-14 东北林业大学 一种基于bp神经网络的微米木纤维切削加工方法

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110246095B (zh) * 2019-05-21 2022-04-12 深圳壹账通智能科技有限公司 一种图像修复方法、装置、存储介质及终端设备
CN115797186A (zh) * 2021-08-31 2023-03-14 杭州三坛医疗科技有限公司 一种图像修复方法、装置、电子设备及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102760285A (zh) * 2012-05-31 2012-10-31 河海大学 一种图像修复方法
CN103279914A (zh) * 2013-05-27 2013-09-04 深圳大学 一种基于蛙跳优化的图像压缩感知隐写方法及装置
CN103955906A (zh) * 2014-05-21 2014-07-30 武汉科技大学 基于蝙蝠算法的Criminisi图像修复方法
CN106056546A (zh) * 2016-05-25 2016-10-26 广东工业大学 一种基于样本块匹配的图像修复方法和装置
US20160379344A1 (en) * 2006-11-27 2016-12-29 Google Inc. Method for sliced inpainting
CN108510050A (zh) * 2018-03-28 2018-09-07 天津大学 一种基于混洗蛙跳的特征选择方法
CN110246095A (zh) * 2019-05-21 2019-09-17 深圳壹账通智能科技有限公司 一种图像修复方法、装置、存储介质及终端设备

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8488883B2 (en) * 2009-12-28 2013-07-16 Picscout (Israel) Ltd. Robust and efficient image identification
CN102999887B (zh) * 2012-11-12 2015-07-01 中国科学院研究生院 一种基于样本的图像修复方法

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160379344A1 (en) * 2006-11-27 2016-12-29 Google Inc. Method for sliced inpainting
CN102760285A (zh) * 2012-05-31 2012-10-31 河海大学 一种图像修复方法
CN103279914A (zh) * 2013-05-27 2013-09-04 深圳大学 一种基于蛙跳优化的图像压缩感知隐写方法及装置
CN103955906A (zh) * 2014-05-21 2014-07-30 武汉科技大学 基于蝙蝠算法的Criminisi图像修复方法
CN106056546A (zh) * 2016-05-25 2016-10-26 广东工业大学 一种基于样本块匹配的图像修复方法和装置
CN108510050A (zh) * 2018-03-28 2018-09-07 天津大学 一种基于混洗蛙跳的特征选择方法
CN110246095A (zh) * 2019-05-21 2019-09-17 深圳壹账通智能科技有限公司 一种图像修复方法、装置、存储介质及终端设备

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112561830A (zh) * 2020-12-23 2021-03-26 安徽大学 一种内窥镜图像高亮点修复方法及装置
CN112561830B (zh) * 2020-12-23 2022-11-18 安徽大学 一种内窥镜图像高亮点修复方法及装置
CN113313651A (zh) * 2021-06-11 2021-08-27 中交三航(上海)新能源工程有限公司 一种基于周围变化的侧扫声呐图像纹理失真区域修复方法
CN113313651B (zh) * 2021-06-11 2024-03-29 中交三航(上海)新能源工程有限公司 一种基于周围变化的侧扫声呐图像纹理失真区域修复方法
CN113763409A (zh) * 2021-08-27 2021-12-07 南通大学 一种基于高斯滤波的高维脑核磁图像多阈值分割方法
CN116205801A (zh) * 2022-12-28 2023-06-02 江汉大学 一种图像的修复方法和装置
CN117457010A (zh) * 2023-02-27 2024-01-26 湖南芯海聆半导体有限公司 音频三维码编码方法和解码方法
CN115994873A (zh) * 2023-02-28 2023-04-21 北京字跳网络技术有限公司 图像处理方法、装置、设备及存储介质
CN118181421A (zh) * 2024-04-16 2024-06-14 东北林业大学 一种基于bp神经网络的微米木纤维切削加工方法

Also Published As

Publication number Publication date
CN110246095B (zh) 2022-04-12
CN110246095A (zh) 2019-09-17

Similar Documents

Publication Publication Date Title
WO2020233083A1 (zh) 一种图像修复方法、装置、存储介质及终端设备
WO2020233084A1 (zh) 一种图像分割方法、装置、存储介质及终端设备
CN112800915B (zh) 建筑物变化检测方法、装置、电子设备以及存储介质
CN111652845B (zh) 异常细胞自动标注方法、装置、电子设备及存储介质
WO2021169116A1 (zh) 智能化的缺失数据填充方法、装置、设备及存储介质
WO2021189912A1 (zh) 图像中目标物的检测方法、装置、电子设备及存储介质
WO2021218314A1 (zh) 基于位置定位的事件识别方法、装置、设备及存储介质
CN115063589B (zh) 基于知识蒸馏的车辆部件分割方法及相关设备
CN111595850A (zh) 切片缺陷检测方法、电子装置及可读存储介质
WO2020087564A1 (zh) 三维物体重建方法、计算机设备及存储介质
US20230325244A1 (en) Object processing method and apparatus, computer device, storage medium, and program product
CN112541902A (zh) 相似区域搜索方法、装置、电子设备及介质
WO2021051868A1 (zh) 目标的定位方法及装置、计算机设备、计算机存储介质
CN114359352B (zh) 图像处理方法、装置、设备、存储介质及计算机程序产品
WO2020024394A1 (zh) 背景剔除方法、装置、计算机设备及存储介质
CN108731648B (zh) 2000独立坐标系参数获取方法、装置与计算机可读存储介质
CN114359563A (zh) 模型训练方法、装置、计算机设备和存储介质
CN110673146A (zh) 气象预测图检测方法、装置、计算机设备和可读存储介质
WO2017201949A1 (zh) 一种选址方法及装置
CN116227573B (zh) 分割模型训练方法、图像分割方法、装置及相关介质
CN114723894B (zh) 一种三维坐标获取方法、装置及电子设备
CN112184753B (zh) 目标光流法确定方法、装置、计算机设备和存储介质
CN110428012A (zh) 脑网络模型建立方法、脑图像分类方法、装置及电子设备
CN119649476A (zh) 样本处理方法、装置、设备及存储介质
JP2014099848A (ja) イメージ分割システム及びその方法

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: 19929494

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: 19929494

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01.04.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19929494

Country of ref document: EP

Kind code of ref document: A1