CN103886561B - Criminisi image inpainting method based on mathematical morphology - Google Patents

Criminisi image inpainting method based on mathematical morphology Download PDF

Info

Publication number
CN103886561B
CN103886561B CN201410142195.3A CN201410142195A CN103886561B CN 103886561 B CN103886561 B CN 103886561B CN 201410142195 A CN201410142195 A CN 201410142195A CN 103886561 B CN103886561 B CN 103886561B
Authority
CN
China
Prior art keywords
repaired
pixel
priority
area
restored
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.)
Expired - Fee Related
Application number
CN201410142195.3A
Other languages
Chinese (zh)
Other versions
CN103886561A (en
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.)
Wuhan University of Science and Engineering WUSE
Original Assignee
Wuhan University of Science and Engineering WUSE
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 Wuhan University of Science and Engineering WUSE filed Critical Wuhan University of Science and Engineering WUSE
Priority to CN201410142195.3A priority Critical patent/CN103886561B/en
Publication of CN103886561A publication Critical patent/CN103886561A/en
Application granted granted Critical
Publication of CN103886561B publication Critical patent/CN103886561B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)

Abstract

A Criminisi image inpainting method based on mathematical morphology comprises the steps of inputting images to be restored, adopting specific colors to pre-mark areas to be restored of the images to be restored and preprocessing the images to be restored based on the mathematical morphology; calculating the priority of all of pixel points o the edges of the areas to be restored and confirming preferential restored pixel points; searching and filling optimum matching blocks in good areas of the preferential restored pixel points; updating the edges of the preferential restored pixel points, re-processing the edges till the areas to be restored are restored, and obtaining image inpainting results. The Criminisi image inpainting method based on the mathematical morphology s wide in image inpainting range, has high inpainting quality on different images to be restored, meet the vision demands of people and has important practical significance.

Description

Criminisi image repair methods based on mathematical morphology
Technical field
The present invention relates to image restoration field, the Criminisi image repairs based on mathematical morphology are especially related to Method.
Background technology
Image repair is the important content of image restoration, is a research heat of Digital Image Processing and computer vision Point, has been widely applied to the aspects such as reparation, removal word, the removal jamming target of incomplete photo in recent years.Its essence is with Information present in complex pattern to be repaired makes image repair whole structure meet the visual demand of people come the information for recovering to lack.
Current image repair method is broadly divided into two major classes:Image repair method based on partial differential equation and based on texture Image repair method.And the image that big area information is lacked is directed to, generally using the image repair method based on texture.Its essence is pin Block of pixels in image is repaired, centered on a pixel on damaged edge, with block of pixels existing in image Matched, come the impaired region of filling information, reached the purpose of image repair, Criminisi image repair algorithms are to be based on The representative of the image repair method of texture.
Criminisi image repairs algorithm was proposed that it was repaired and is referred to as by Criminisi et al. in 2004:Preferentially Power calculating, best match block search and filling, renewal confidence level.But the priority in Criminisi image repair algorithms Priority (p) is calculated and the search of best matching blocks has self-defect with filling, i.e.,:Confidence level can be with repairing number of times The information for increasing artwork in causing is reduced, and has the appearance influence priority of the difference of the order of magnitude, is occurred in data item vertical Phenomenon, it is zero to cause priority, the size of confidence level to priority will nonsensical and best match module more than one, System can be random selection etc..Therefore nearly ten years, there are the priority of different emphasis and the searching for best matching blocks of many Rope and the improvement filled:It is interim in electronics technology volume 23 the 1st in 2010《A kind of improved image repair side based on master drawing Method》In one text, using graded, block size selection is dynamically carried out, eliminate exploratory artificial setting module size Bother, improve operating efficiency, improve image repair effect;In CAD in 2011 and figure journal volume 23 2nd is interim《The complex region reparation of the Dunhuang frescoes based on priority innovatory algorithm》In one text, for complicated damaged area Peripheral information obscures the more Dunhuang frescoes of insincere and number, is taking into full account Dunhuang frescoes self information complexity, mural painting Repair visual effect and its repair on the basis of reasonability easily the factor such as influenceed by pixel reparation order, a kind of D-S evidences of proposition The image repair algorithm that gross data fusion method is improved to the prioritization functions of restoring area filling algorithm, repairing effect Relative to the raising that former algorithm has conspicuousness;It is interim in computer application in 2012 and software volume 29 the 9th《One kind is improved Criminisi image repair algorithms》In one text, introduce curvature to determine the choosing of the fill order and best matching blocks of object block Select, and it is every weighted sum to improve priority, and more preferable repairing effect can be obtained by changing weights, at the same avoid due to The wrong fill order that the rapid attenuation band of confidence level comes, achieves gratifying repairing effect.Above modified hydrothermal process is pin To the architectural feature of certain area to be repaired, what the calculating defect of certain Criminisi image repair algorithms was carried out, can only The accumulation of error message is reduced to a certain extent.
The content of the invention
Priority calculating and best match block search and filling in Criminisi image repair algorithms are in restoring area Carried out on the basis of mark, therefore the first step is carried out, and is the basis of follow-up work.Present invention introduces the corrosion in mathematical morphology With expansion, pre-processed, it is ensured that it is reasonable that area to be repaired marks, and having for Criminisi image repair algorithms is ensured with this Effect is carried out, and reduces the accumulation of error message, it is adaptable to the reparation of the area to be repaired of different features.
Technical solution of the present invention provides a kind of Criminisi image repair methods based on mathematical morphology, including following Step, step 1 is input into complex pattern to be repaired, and the area to be repaired of the complex pattern to be repaired is marked, treated in advance using particular color Reparation image carries out pretreatment and is shown below,
Pretreatment expression formula is shown below:
Wherein, A is complex pattern to be repaired, and B, C are not less than C for the size of the consistent structural element of shape and B, and B is tied for expansion Constitutive element, C is corrosion structure element;
Step 2, calculates priority priority (p) of each pixel at area to be repaired edge, it is determined that preferentially repairing picture Vegetarian refreshments;
Step 3, for preferential repairing pixel point, the search and filling of best matching blocks is carried out in intact region;
Step 4, updates area to be repaired edge, and return to step 2 carries out repetitive cycling operation, until area to be repaired is repaired Complete, obtain image repair result.
And, according to expansion structure element B, expansion expression formula is shown below,
Wherein, x is the pixel of the image after expansion, and a is the pixel of complex pattern A to be repaired, and b is expansion structure element B In element.
And, according to corrosion structure Elements C, corrosion expression formula is shown below,
Wherein, x is the pixel of the image after expansion, and a is the pixel of complex pattern A to be repaired, and c is expansion structure Elements C In element.
The present invention is applicable the wide range of image repair, has reparation very high for the complex pattern to be repaired of different emphasis Quality, meets the visual demand of people, with important practical significance.There is advantages below compared with prior art:
(1)The present invention need not improve the decision formula of priority and matching principle, it is only necessary in the base of artificial mark in advance On plinth, pre-processed using mathematical morphology, Criminisi image repairs algorithm is carried out on the basis of rational, can The accumulation of error message is greatly reduced, and reduces amount of calculation, realize easy, effect is significant.
(2)Improvement mathematical morphology of the invention cannot only be applied to classical Criminisi image repairs algorithm, equally In may apply to other improved Criminisi image repairs algorithms, for example with other confidence calculations modes Criminisi image repair algorithms, can equally lift repairing effect, reduce the accumulation of error message.
Brief description of the drawings
Fig. 1 is the flow chart of the embodiment of the present invention.
Specific embodiment
Technical solution of the present invention can support automatic running flow using computer software mode.Below in conjunction with accompanying drawing and implementation Example describes technical solution of the present invention in detail.
Referring to Fig. 1, the flow of embodiment is as follows:
Step 1, is input into complex pattern to be repaired, and the area to be repaired of the complex pattern to be repaired is marked in advance using particular color, Image to be repaired is pre-processed.The region that wherein φ is represented is unlabelled region, i.e., intact region;The region that Ω is represented It is the region of mark, i.e. area to be repaired;δ Ω represent the border in region to be repaired.
Specific implementation is artificial mark in advance can be carried out to the area to be repaired of image to be repaired using a kind of specific color Note, can voluntarily be selected area to be repaired to carry out handmarking, to be carried out in follow-up technical solution of the present invention by user The rim detection of area to be repaired lays the first stone.After marked the complex pattern to be repaired input of area to be repaired in advance, using this hair The flow that bright embodiment is provided is processed.Complex pattern to be repaired in the embodiment of the present invention is using white.For example, the photograph of certain personage There is supernumerary group in piece, in background, using white covering supernumerary group region.
The structural information and texture information at image edge to be repaired can be to a certain extent influenceed due to advance handmarking, because This is pre-processed using corrosion and expansion, reaches the effect of reasonable mark.Pretreatment expression formula is shown below:
Wherein, A is complex pattern to be repaired, and B, C are for the consistent structural element of shape and the size of B is not less than C, structure in principle Element is the set of element.
B is expansion structure element, and expansion expression formula is shown below:
Wherein, x is that the pixel of image after expansion, a are during the pixel of complex pattern to be repaired, b are expansion structure element B Element.
It is thicker that morphological dilation plays lines, and hole disappears, the effect of expanded images.
C is corrosion expansion structure element, and corrosion expansion expression formula is shown below:
Wherein, x is that the pixel of image after expansion, a are during the pixel of complex pattern to be repaired, c are expansion structure Elements C Element.
Morphological erosion plays lines and attenuates, expansion of pores, the effect of contractible graph picture.
Pretreatment expression formula combines expansion expression formula and corrodes expression formula, and effect is ensuring that the reasonability of mark, Ensure area to be repaired with specific color mark area to be repaired can guarantee that simultaneously, again the texture at area to be repaired edge with Structural information is interference-free, such that it is able to reduce the accumulation of error message from root.
During specific implementation, those skilled in the art can voluntarily preset the size radius of B, C, and the size of C is not more than B, 0 even can be set to, i.e., use corrosion, for example, be respectively the collar plate shape structural element that radius is 4 and 0 from B, C.
Step 2, calculates priority priority (p) of each pixel at area to be repaired edge, it is determined that preferential reparation Pixel.
Embodiment calculates each pixel at area to be repaired edge according to formula priority (p)=C (p) × D (p) Priority, choose the maximum pixel of priority and enter row major reparation.
Wherein:
Wherein, the definition of variable C (i) is C (i)=0,C (i)=1,p| represent ψpArea, ψpTable Show object block to be repaired.
Wherein, npIt is certain pixel p at area to be repaired edge on borderThe outer normal vector of the unit of Ω;Represent picture The direction and the intensity that wait radiation at vegetarian refreshments p, its expression formula isIx, IyPixel p is represented respectively in x, y Partial differential on direction;α is normalized parameter, and value is 255 in gray-scale map.
C (p) be confidence level, numerical value is bigger, and priority is higher, reflect containing artwork region information it is many, should give excellent First repair;D (p) is data item, and numerical value is bigger, and priority is higher, and it is high to reflect evolution surface linear structural strength, should give excellent First repair.
During specific implementation, C (p) and D (p) can also use other calculations.
Step 3, it is determined that after preferential repairing pixel point, the search and filling of best matching blocks are carried out in intact region φ.Can Determine that best match template is filled according to SSD matching principle global searches.
Embodiment set the preferential repairing pixel point of step 2 gained asAccordingly object block to be repaired isMatching principle is such as Shown in following formula:
Wherein,Represent object block to be repaired;ψqRepresent the sample block in intact region;Represent two blocksWith ψqKnown pixels point color difference quadratic sum;SSD matching principles are represented when object block to be repairedWith sample in intact region This block ψqKnown element quadratic sum it is minimum when, this sample block is best matching blocksAnd then according to best matching blocksTo object block to be repairedIt is filled.
During specific implementation, it would however also be possible to employ other matching principles.
Step 4, updates area to be repaired edge, finally repetitive cycling operation is constantly carried out from return to step 2, until treating Restoring area Ω is repaired and completed, then image repair is completed.During specific implementation, can first judge whether area to be repaired Ω has repaired Into, it is to terminate flow, otherwise return to area to be repaired edge, return to step 2.
The block of reparation is all on the edge of area to be repaired, therefore often one reparation of texture block of completion is just carried out more to edge Newly.Based on each pixel at remaining area to be repaired edge, new preferential repairing pixel point is selected equally to be processed.
Specific embodiment described herein is only to the spiritual explanation for example of the present invention.Technology neck belonging to of the invention The technical staff in domain can be made various modifications or supplement to described specific embodiment or be replaced using similar mode Generation, but without departing from spirit of the invention or surmount scope defined in appended claims.

Claims (1)

1. a kind of Criminisi image repair methods based on mathematical morphology, it is characterised in that comprise the following steps,
Step 1, is input into complex pattern to be repaired, and the area to be repaired of the complex pattern to be repaired is marked, treated in advance using particular color Reparation image carries out pretreatment and is shown below,
D = A ⊕ B Θ C
Wherein, A is complex pattern to be repaired, and B, C are not less than C for the size of the consistent structural element of shape and B, and B is expansion structure unit Element, C is corrosion structure element;
According to expansion structure element B, expansion expression formula is shown below,
A ⊕ B = { x | ∃ a ∈ A , b ∈ B : x = a + b }
Wherein, x is the pixel of the image after expansion, and a is the pixel of complex pattern A to be repaired, and b is in expansion structure element B Element;
According to corrosion structure Elements C, corrosion expression formula is shown below,
A Θ C = { x | ∀ c ∈ C , ∃ a ∈ A : x = a - c }
Wherein, x is the pixel of the image after expansion, and a is the pixel of complex pattern A to be repaired, and c is in expansion structure Elements C Element;
Step 2, calculates priority priority (p) of each pixel at area to be repaired edge, it is determined that preferential repairing pixel point; Implementation is as follows,
According to formula priority (p)=C (p) × D (p), the priority of each pixel at area to be repaired edge is calculated, selected Take the maximum pixel of priority and enter row major reparation,
Wherein, C (p) be confidence level, numerical value is bigger, and priority is higher, reflect containing artwork region information it is many, should give Preferential repairing;D (p) is data item, and numerical value is bigger, and priority is higher, and it is high to reflect evolution surface linear structural strength, should give Preferential repairing;
C ( p ) = Σ i ∈ ψ p ∩ φ C ( i ) | ψ p |
Wherein, the definition of variable C (i) isp| represent ψpArea, ψpRepresent to be repaired Object block;The region that φ is represented is unlabelled region, represents intact region;
D ( p ) = | ▿ I p ⊥ · n p | α
Wherein, npIt is certain pixel p at area to be repaired edge on borderThe outer normal vector of unit;Represent pixel p The direction and the intensity that wait radiation at place, expression formula isIx、IyPixel p is represented respectively on x, y direction Partial differential;α is normalized parameter;
Step 3, for preferential repairing pixel point, the search and filling of best matching blocks is carried out in intact region;
Step 4, updates area to be repaired edge, and return to step 2 carries out repetitive cycling operation, until area to be repaired has been repaired Into obtaining image repair result.
CN201410142195.3A 2014-04-09 2014-04-09 Criminisi image inpainting method based on mathematical morphology Expired - Fee Related CN103886561B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410142195.3A CN103886561B (en) 2014-04-09 2014-04-09 Criminisi image inpainting method based on mathematical morphology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410142195.3A CN103886561B (en) 2014-04-09 2014-04-09 Criminisi image inpainting method based on mathematical morphology

Publications (2)

Publication Number Publication Date
CN103886561A CN103886561A (en) 2014-06-25
CN103886561B true CN103886561B (en) 2017-05-24

Family

ID=50955436

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410142195.3A Expired - Fee Related CN103886561B (en) 2014-04-09 2014-04-09 Criminisi image inpainting method based on mathematical morphology

Country Status (1)

Country Link
CN (1) CN103886561B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104766283B (en) * 2015-04-15 2017-08-29 中北大学 A kind of Digital repair method of grave mural painting image
CN104966293B (en) * 2015-06-15 2017-12-05 裴小根 Image detail feature guard method based on PG algorithms
CN105913388A (en) * 2016-04-05 2016-08-31 杭州电子科技大学 Priority constraint colorful image sparse expression restoration method
CN106408546A (en) * 2016-09-05 2017-02-15 广东欧珀移动通信有限公司 Image restoration method, apparatus and terminal device
CN108257082B (en) * 2018-02-01 2021-08-17 北京维山科技有限公司 Method and device for removing image fingers based on fixed area
US10593024B2 (en) 2018-04-04 2020-03-17 Hong Kong Applied Science And Technology Research Institute Co., Ltd. Image inpainting on arbitrary surfaces
CN108885787B (en) * 2018-07-06 2021-11-05 达闼机器人有限公司 Method for training image restoration model, image restoration method, device, medium, and apparatus
CN112330643B (en) * 2020-11-10 2023-02-07 国网湖北省电力有限公司宜昌供电公司 Secondary equipment state identification method based on sparse representation image restoration
CN113674176B (en) * 2021-08-23 2024-04-16 北京市商汤科技开发有限公司 Image restoration method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101236603A (en) * 2008-02-28 2008-08-06 上海交通大学 Vehicle intelligent back vision method
CN103295018A (en) * 2013-05-21 2013-09-11 常州大学 Method for precisely recognizing fruits covered by branches and leaves
CN103295199A (en) * 2013-05-29 2013-09-11 西安建筑科技大学 Intelligent repair assistance system for cracks of ancient wall murals

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101236603A (en) * 2008-02-28 2008-08-06 上海交通大学 Vehicle intelligent back vision method
CN103295018A (en) * 2013-05-21 2013-09-11 常州大学 Method for precisely recognizing fruits covered by branches and leaves
CN103295199A (en) * 2013-05-29 2013-09-11 西安建筑科技大学 Intelligent repair assistance system for cracks of ancient wall murals

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Region Filling and Object Removal by Exemplar-Based Image Inpainting;Antonio Criminisi, et al.;《IEEE TRANSACTIONS ON IMAGE PROCESSING》;20040930;第13卷(第9期);第1200页摘要,第1202-1205页第III节"OUR REGION-FILLING ALGORITHM" *

Also Published As

Publication number Publication date
CN103886561A (en) 2014-06-25

Similar Documents

Publication Publication Date Title
CN103886561B (en) Criminisi image inpainting method based on mathematical morphology
CN101777178B (en) Image restoring method
CN101571950B (en) Image restoring method based on isotropic diffusion and sparse representation
CN101661613B (en) Image restoration method based on image segmentation, and system therefor
CN111402209B (en) U-Net-based high-speed railway steel rail damage detection method
CN103295199B (en) Intelligent repair assistance system for cracks of ancient wall murals
CN106934780A (en) A kind of automatic watermark minimizing technology based on image repair
CN101980285B (en) Method for restoring non-local images by combining GMRF priori
CN102142132A (en) Module-based image inpainting method
CN104680492B (en) Image repair method based on composition of sample uniformity
CN106204503B (en) Based on the image repair algorithm for improving confidence level renewal function and matching criterior
CN109242791A (en) A kind of batch restorative procedure for damaged plant leaf blade
CN104376535A (en) Rapid image repairing method based on sample
CN112270651B (en) Image restoration method for generating countermeasure network based on multi-scale discrimination
CN106023089B (en) A kind of image repair method based on Block- matching
CN106815832B (en) A kind of steel mesh automatic image registration method and system of surface mounting technology
CN103578085A (en) Image empty region inpainting method based on variable blocks
CN108197567B (en) Method, apparatus and computer readable medium for image processing
CN104966279A (en) Image synthesis restoration method based on local structure features
CN103955906A (en) Criminisi image restoration method based on bat algorithm
CN109724988A (en) A kind of pcb board defect positioning method based on multi-template matching
CN106846271A (en) A kind of method of reticulate pattern in removal identity card picture
CN105844583A (en) Portrait stone crack intelligence extraction and virtual restoration method
CN111724327A (en) Image restoration model training method and system and image restoration method
CN107358581A (en) Rapid image restorative procedure

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170524

Termination date: 20190409

CF01 Termination of patent right due to non-payment of annual fee