WO2012075729A1 - Method and device for removing selected image in picture automatically - Google Patents

Method and device for removing selected image in picture automatically Download PDF

Info

Publication number
WO2012075729A1
WO2012075729A1 PCT/CN2011/071073 CN2011071073W WO2012075729A1 WO 2012075729 A1 WO2012075729 A1 WO 2012075729A1 CN 2011071073 W CN2011071073 W CN 2011071073W WO 2012075729 A1 WO2012075729 A1 WO 2012075729A1
Authority
WO
WIPO (PCT)
Prior art keywords
boundary
point
replaced
block
image
Prior art date
Application number
PCT/CN2011/071073
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
Application filed by 上海杰图软件技术有限公司 filed Critical 上海杰图软件技术有限公司
Publication of WO2012075729A1 publication Critical patent/WO2012075729A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/143Segmentation; Edge detection involving probabilistic approaches, e.g. Markov random field [MRF] modelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation

Definitions

  • the present invention relates to an image processing method and apparatus, and more particularly to a method and apparatus for automatically removing selected images appearing in an image. Background technique
  • This technique has a good effect on filling large missing blocks in the image, and can also preserve the structure of the image, but the speed is very slow. For a picture of 1200*1200 size, it usually takes a few minutes or even half an hour to repair the 200*200 area. . Therefore, the above techniques have great limitations for local image removal or repair applications.
  • An object of the present invention is to solve the above problems and to provide a method for automatically removing selected images in an image, which has the advantages of fast repair speed and good repair effect.
  • Another object of the present invention is to provide an apparatus for automatically removing selected images from an image.
  • the technical solution of the present invention is:
  • the present invention discloses a method for automatically removing selected images in an image, including:
  • the maximum value of the feature similarity between the 8 adjacent pixels of the point q' and the point p' is assigned to the point p'; the step of finding the point with the highest confidence is found, and the confidence is found in the block where the unprocessed boundary point is located. The highest point until all the boundaries to be replaced have been processed.
  • An embodiment of the method for automatically removing selected images in an image according to the present invention further includes: before setting a boundary to be replaced on the original image:
  • the original image is reduced so that the subsequent processing object is the reduced original image.
  • the original image is reduced by an interpolation algorithm.
  • An embodiment of a method of automatically removing selected images in an image in accordance with the present invention finding points and points After that, according to the original image reduction ratio, find the corresponding two points p and ⁇ in the original image and the corresponding blocks and ⁇ of the two points p and ⁇ , replace 3 ⁇ 4 ⁇ with ⁇ , and 8 adjacent pixels and points of point g
  • the feature similarity maximum value compared between ⁇ is assigned to point P.
  • the boundary to be replaced in the step of setting a boundary to be replaced on the original image, is marked as a color different from the background color to make the background color
  • the borders with different colors become the boundaries to be replaced.
  • the present invention also discloses an apparatus for automatically removing selected images in an image, including:
  • a boundary setting module which sets a boundary to be replaced on the original image to cover the selected image
  • a block setting module in which the boundary point is located, coupled to the boundary setting module, and set a block in which the boundary point centered on the point on the boundary to be replaced is located;
  • the confidence processing module is coupled to the confidence processing module to find the point with the highest confidence of the block in all the boundary points, and the block corresponding to the boundary point of the point // is ⁇
  • the boundary expansion module is coupled to the confidence processing module to expand the boundary to be replaced to form an outer boundary
  • the processing module coupled to the outer boundary of the expansion module, the expansion of the outer boundary of the range to identify the boundary points and the point where the block // ⁇ ⁇ 'feature similarity compared to the maximum point where the block boundary ⁇ , ⁇ q' corresponding to The boundary point is q', and the block where the boundary point is located is replaced by the block ⁇ where ⁇ ⁇ ';
  • the assignment module is coupled to the replacement processing module and the confidence processing module, and assigns the maximum value of the feature similarity between the 8 adjacent pixels of the point to the point/, and returns to the confidence processing module for processing, and is processed by the confidence degree.
  • the module looks for the point with the highest confidence in the block where the unprocessed boundary points are located until all the boundaries to be replaced are processed.
  • An embodiment of the apparatus for automatically removing selected images in an image according to the present invention further comprising an image reduction module coupled to the boundary setting module, the image reduction module reducing the original image for subsequent processing
  • the object is the original image after reduction.
  • an interpolation processing unit is provided in the image reduction module to reduce the original image by operation of an interpolation algorithm in the interpolation processing unit.
  • An embodiment of the apparatus for automatically removing selected images in an image according to the present invention further includes an original map mapping unit in the replacement processing module, the replacement processing module starting the original map mapping unit after finding the dot/and the dot ⁇ ',
  • the original map mapping unit finds the corresponding two points ⁇ and g in the original image according to the original map reduction ratio and this Two points p and ⁇ correspond to the block and ⁇ , so that ⁇ replaces 3 ⁇ 4 ⁇ , and points in the assignment module
  • the maximum value of the feature similarity between the adjacent pixels and the point p is assigned to the point p.
  • the boundary to be replaced is marked as a color different from the background color so that a boundary different from the background color is to be replaced. boundary.
  • the present invention has the following beneficial effects: the invention can automatically remove the image of the selected area in the image, so that the original image provider can more easily remove the image of the selected area, thereby solving the original image processing selected area. Image removal relies too much on manpower, inefficiency, and cost.
  • FIG. 1 is a flow chart of a first embodiment of a method of automatically removing selected images from an image of the present invention.
  • 2 is a flow chart of a second embodiment of a method of automatically removing selected images from an image of the present invention.
  • Figure 3 is a detailed flow chart of the embodiment of Figure 2.
  • FIG. 4 is a schematic diagram of a first embodiment of an apparatus for automatically removing selected images from an image of the present invention.
  • Figure 5 is a schematic diagram of a second embodiment of the apparatus for automatically removing selected images from an image of the present invention.
  • FIG. 1 illustrates an embodiment of a method of automatically removing selected images in an image of the present invention. Referring to FIG. 1, the following is a detailed description of the steps of the method for automatically removing selected images in an image of the present embodiment.
  • Step S10 Set the boundary to be replaced on the original image to cover the selected image.
  • the border to be replaced can be marked as a uniform color, covering the background color on the original image. That is, the boundary to be replaced is marked as a color different from the background color, so that the boundary different from the background color can be judged as the boundary to be replaced.
  • Step S11 Set a block in which the boundary point centered on the point on the boundary to be replaced is located. In a certain pixel range around any point on the boundary to be replaced, a block centered on the point is set for subsequent comparison and replacement, and the size of the block can be arbitrarily set.
  • Step S12 Find the point with the highest confidence of the block among all the unprocessed boundary points, and the block where the corresponding boundary point is // is ⁇ .
  • Step S13 The boundary to be replaced is externally expanded to form an outer expanded boundary.
  • the outer boundary is (r + areasize ) X (m ten areasize ), where areasize is a parameter indicating how many pixels are expanded outside the boundary to be replaced. Find block images that can be replaced in this range.
  • the unique pixel RGB value (that is, the color) set in step S10 for marking the boundary to be replaced is completely different from the RGB value of each pixel in the original image in the extended boundary range.
  • Step S14 Find the point with the highest degree of confidence in the range of the expanded boundary; / the block ⁇ , compared with the block with the largest feature similarity, ⁇ , ⁇ , the corresponding boundary point is ⁇ , with ⁇ To replace ⁇ ⁇ ,
  • Step S15 assigning the maximum value of the feature similarity between the adjacent pixels of the point ⁇ ' and the point // to the point
  • step Sl l After the end of this step, go to step Sl l until all the boundaries to be replaced are all queried.
  • FIG. 2 illustrates a second embodiment of a method of automatically removing selected images in an image of the present invention.
  • Step S20 The original image is reduced so that the subsequent processing object is the reduced original image.
  • a size range (n X n) can be preset. If the original image itself is within this size range, no further scaling is required, and the original image is substituted for subsequent operations.
  • an interpolation algorithm is employed, scaled to a size range of n X n , and the reduced image is stored separately.
  • the purpose of downsizing is to increase the speed of the calculation, and to ensure that the number of traversals is greatly reduced when searching for related matching points and regions.
  • Step S21 Determine the boundary to be replaced after the original image is reduced.
  • the border to be replaced can be marked as a uniform color, covering the background color on the original image. That is, the boundary to be replaced is marked as a color different from the background color, so that the boundary different from the background color can be judged as the boundary to be replaced.
  • Step S22 Set a block in which the boundary point centered on the point on the boundary to be replaced is located.
  • a block centered on the point is set for subsequent comparison and replacement, and the size of the block can be arbitrarily set.
  • Step S23 Find the point with the highest confidence of the block in all the unprocessed boundary points, and the block where the corresponding boundary point is // is ⁇ .
  • Step S24 The boundary to be replaced is externally expanded to form an outer expanded boundary.
  • the outer boundary is (r + areasize ) X (m ten areasize ), where areasize is a parameter indicating how many pixels are expanded outside the boundary to be replaced. Find block images that can be replaced in this range.
  • the unique pixel RGB value that is, the color
  • the RGB value of each pixel in the original image in the extended boundary range is different from the RGB value of each pixel in the original image in the extended boundary range.
  • Step S25 Find the point with the highest degree of confidence in the range of the expanded boundary; / the block ⁇ , compared with the block where the feature similarity is the largest, ⁇ , ⁇ , the corresponding boundary point is ⁇ , according to the original
  • the graph is scaled down to find the corresponding two points p and g in the original graph and the blocks ⁇ and ⁇ q corresponding to the two points p and g, which are replaced by ⁇ .
  • Step S26 Assign the maximum value of the feature similarity between the 8 adjacent pixels of the point q and the point p to the point p. After the end of this step, the process jumps to step S22 until all the boundaries to be replaced are all queried. In this step, there is also a need to use a technical means to block the block where the boundary point has been processed (for example
  • ⁇ ⁇ ' is excluded from the search range of the next loop to ensure that the boundary that has been processed is not searched again when jumping to step S22.
  • Such a technical means is, for example, to set the confidence level of the point to 0 (see the embodiment of FIG. 3 for details).
  • a loop is performed between steps S22 to S26 until the boundary to be replaced described in step S21 is processed.
  • Refinement of the second embodiment of the method of automatically removing selected images in an image Fig. 3 shows a further refinement of the above-described embodiment of Fig. 2. Referring to Fig. 3, the following is a detailed description of each step in the refinement flow of the method of the second embodiment.
  • Step S30 Select the area to be repaired from the original image.
  • the boundary to be repaired can be marked as a uniform color, covering the background color, and whether the boundary to be replaced is judged by the boundary on which the color is different from other colors.
  • Step S31 Determine whether both W and ⁇ are greater than ⁇ .
  • is a preset value, for example, 300 pixels, which is a suitable value to ensure the efficiency of the operation. If both W and ⁇ are larger than ⁇ pixels, step S312 is performed, otherwise step S314 is performed.
  • Step S312 Acquire W and the maximum ratio of H to n is rate.
  • rate max (W/n, H/n).
  • Step S314 Assign rate to 1.
  • Step S316 According to the ratio obtained in step S312, an interpolation algorithm is introduced into the original image, and the original image is reduced, and the reduction ratio is rate.
  • the interpolation algorithm used in this step can be bilinear, thereby reducing pixel loss.
  • Step S33 Let block ⁇ ' size be t*t, ⁇ ' be a confidence level, and ⁇ ' value be 0.
  • the block ⁇ ' is a block with a side length of ?, which is a natural number, for example, the value is
  • Step S34 Judging the point; ? ' is the area to be repaired as specified in step S30.
  • the basis for determining in this step is whether the RGB value of the point is the pixel value of the area to be repaired. For example, if the pixel of the area to be repaired set in step S30 is green, then here is whether the RGB value of the point is green. If it is green, step S342 is performed, and if it is not green, step S344 is performed.
  • Step S342 Find the point;? The confidence level of the 'block ⁇ '.
  • a is the area of ⁇ '.
  • a is the image normalization factor, which defaults to 255.
  • is the area to be repaired, w, is orthogonal to the point; 'Unit vector of tangent direction. For the ?? point of the illuminance line.
  • CO represents the confidence value of point u
  • u represents a pixel which is determined ') of the point P' where the blocks ⁇ ⁇ 'confidence.
  • Step S344 Find the next pixel in the reduced image (size '*H').
  • step S345 is performed, otherwise step S348 is performed.
  • Step S345 Set to the next pixel in the reduced image (size '*H'). After this step is completed, step S34 is performed.
  • Step S346 The confidence in step S342 confidence obtained in ⁇ p ⁇ p and compared.
  • step S347 if the confidence level of ⁇ ⁇ ' is greater than the confidence of max ⁇ ⁇ ', step S347 is performed, and if the confidence level of ⁇ ⁇ ' is less than or equal to the confidence of ⁇ ⁇ ⁇ , step S35 is performed.
  • Step S348 The removal of the selected image is completed, and the method ends.
  • Step S347 Assign the confidence of ⁇ ' to the confidence of ax ⁇ ', and then proceed to step S35. In this step, the save point is simultaneously used to bring the operation performed in step S37.
  • Step S35 If the pixel point is the last pixel found in the reduced image (size is '*H') If yes, go to step S36, otherwise go back to step S345 to find the next pixel.
  • Step S36 Extend the areos/ze pixels in the outermost rectangle of the current boundary curve, and define the outer region, and the size is (r+a easize)*(m+a easize).
  • the circumscribed rectangle is a rectangle * j formed by the outer edge of the area to be repaired as described in S30.
  • the value of ar size is set to 35, for example, and this value can improve the efficiency of the subsequent steps when the operation is carried.
  • Step S37 Set a point in the area other than the area to be repaired in step S30 in the expanded area (size r+areo ⁇ eJYm+areo ⁇ e) in step S36.
  • the block be the point-centered block area, the size of the block is t*t, and the sum of the squares of the Euclidean distance of ⁇ is infinite.
  • the value of the side length t of the block is set to, for example, 10, which is the same as the side length of the block ⁇ '. It is convenient to replace the pixel of the block ⁇ ' in the block q' in the subsequent step.
  • Step S38 It is judged whether there is still a block ⁇ in the extended area, if yes, step S382 is performed, and if not, step S384 is performed.
  • Step S382 judging the point and the point; the square distance sum of the 'European distance' (the magnitude of the sum of the squares of the Euclidean distance of l q ⁇ gb -I p ⁇ b f and min, if the square of the Euclidean distance of the point and the point is smaller than the European style If the distance is squared, then step S386 is performed, otherwise step S384 is performed, where / ⁇ 3 ⁇ 4 represents the pixel value of q' point RGB, and Ip , rgb represents the pixel value of p' point RGB.
  • Step S386 ji q'rgb f is assigned to ⁇ q, the sum of squared Euclidean distances. A point will also be retained in this step, which will be taken to the next step S3
  • step S38 After this step is completed, the judgment of step S38 will be continued.
  • Step S384 If the rate value is equal to 1, proceed to step S387, otherwise proceed to step S388.
  • the rate value described in this step is the value obtained in step S312 or step S314.
  • Step S387 Copy the pixel of the block where the point is located to the point; ? 'in the block ⁇ '.
  • This step will cause the pixels of the block where the point is to be replaced, and the removal of the selected image in this block is completed. After this step is completed, the subsequent step S392 will be performed.
  • the rate value described in this step is the value obtained in step S312 or step S314.
  • step S389 will be performed.
  • Step S389 Copy the pixel of the block where the point q is located to the block ⁇ where the point P is located.
  • step S394 will be performed.
  • Step S392 Assign the Euclidean squared minimum of the adjacent pixel of the point to the point of the ?? point. After this step is completed, the process proceeds to step S39.
  • Step S394 Assign the Euclidean squared minimum value of the 8 adjacent pixels of the point q to the P point to the point P. After this step is completed, the process proceeds to step S39.
  • Step S39 Set the confidence level of the point to 0.
  • This step makes the value judged in the subsequent step S346 always negative, so that the subsequent steps can be performed.
  • FIG. 4 illustrates the principle of a first embodiment of an apparatus for automatically removing selected images from an image of the present invention. Referring to Figure 4, the following is a detailed description of the principles of the apparatus of the present embodiment.
  • the apparatus for automatically removing selected images in an image of the embodiment includes the following modules: a boundary setting module
  • the block setting module in the boundary point 1 1.
  • the connection relationship between the modules is: the boundary setting module 10 is coupled to the block setting module 1 where the boundary point is located, and the block setting module 1 1 where the boundary point is located is coupled to the confidence processing module 12, and the confidence processing module 12 is coupled to the boundary expansion.
  • the module 13 , the boundary expansion module 13 is coupled to the replacement processing module 14
  • the replacement processing module 14 is coupled to the evaluation module 15 .
  • the evaluation module is coupled to the confidence processing module 12 in addition to the replacement processing module 14 .
  • the boundary setting module 10 is configured to set a boundary to be replaced on the original image to cover the selected image.
  • the border to be replaced can be marked as a uniform color, covering the background color on the original image. That is, the boundary to be replaced is marked as a color different from the background color, so that the boundary different from the background color can be determined as the edge to be replaced. Boundary.
  • the block setting module 11 in which the boundary point is located is used to set a block in which the boundary point centered on the point on the boundary to be replaced is located.
  • a block centered on the point is set for subsequent comparison and replacement, and the size of the block can be arbitrarily set.
  • the point with the highest confidence of the block is found among all the unprocessed boundary points; /, the block where the point/corresponding boundary point is located is ⁇ .
  • the calculation of the block confidence is a conventional technical means and is described in detail in the refinement of the second embodiment of the method.
  • the boundary outer expansion module 13 expands the boundary to be replaced to form an outer expanded boundary. For example, if the original boundary to be replaced is (r X m), then the outer boundary is (r + areasize ) X (m+areasize ), where areasize is a parameter indicating how many pixels are expanded outside the boundary to be replaced. Find block images that can be replaced in this range.
  • the unique pixel RGB value (that is, the color) set in the boundary setting module 10 for marking the boundary to be replaced is completely different from the RGB value of each pixel in the original image in the extended boundary range.
  • the block where the point with the highest degree of confidence is located in the range of the outer-expanded boundary is located, and the boundary point where the feature similarity is the largest is ⁇ , ⁇ , and the corresponding boundary point is ⁇ , ⁇ , to replace i ⁇ .
  • the dot is completed; the image of the block is replaced, but in order to prevent pixel loss during replacement, subsequent module processing is required to ensure that the replaced image is completely fused with the surrounding image.
  • the assignment module 15 assigns the maximum value of the feature similarity between the 8 adjacent pixels of the point q' and the point p' to the point p'.
  • the jump to the confidence processing module 12 is performed by the confidence processing module 12 to find the point with the highest confidence in the block of the unprocessed boundary point until all the boundaries to be replaced are all queried.
  • the confidence processing module 12 it is necessary to exclude the block in which the boundary point has been processed (for example, ⁇ , ) from the search range of the next loop by a technical means to ensure that the boundary that has been processed is not found again.
  • a technical means is, for example, to set the confidence level of the point to 0 (see the embodiment of Fig. 3 for details).
  • FIG. 5 illustrates the principles of a second embodiment of the apparatus for automatically removing selected images from an image of the present invention. Referring to Figure 5, the following is a detailed description of the principles of the apparatus of the present embodiment.
  • the apparatus for automatically removing selected images in the image of the embodiment includes the following modules: an image reduction module 20, a boundary setting module 21, a block setting module 22 where a boundary point is located, a confidence processing module 23, a boundary expansion module 24, and a replacement.
  • the processing module 25 and the evaluation module 26 are provided.
  • the connection relationship between the modules is: the image reduction module 20 is coupled to the boundary setting module 21, the boundary setting module 21 is coupled to the block setting module 22 where the boundary point is located, and the block setting module 22 where the boundary point is located is coupled to the confidence processing module 23,
  • the degree processing module 23 is coupled to the boundary expansion module 24, the boundary expansion module 24 is coupled to the replacement processing module 25, and the replacement processing module 25 is coupled to the evaluation module 26.
  • the evaluation module 26 is coupled to the replacement processing module 25 to couple the confidence.
  • An interpolation processing unit 200 is provided in the image reduction module 20, and an original map mapping unit 250 is provided in the replacement processing module 25.
  • the image reduction module 20 reduces the original image so that the subsequent processing object is the reduced original image.
  • a size range (n X n) can be preset. If the original image itself is within this size range, no further scaling is required, and the original image is substituted for subsequent operations.
  • the interpolation processing unit 200 is operated, and the interpolation processing unit 200 employs an interpolation algorithm to scale the original picture to the size range of n X n and separately store the reduced image.
  • the purpose of downsizing is to increase the speed of the calculation, and to ensure that the number of traversals is greatly reduced when searching for related matching points and regions.
  • the boundary setting module 21 is configured to judge the boundary to be replaced after the original image is reduced to cover the selected image.
  • the border to be replaced can be marked as a uniform color, covering the background color on the original image. That is, the boundary to be replaced is marked as a color different from the background color, so that the boundary different from the background color can be judged as the boundary to be replaced.
  • the block setting module 22 in which the boundary point is located is used to set a block in which the boundary point centered on the point on the boundary to be replaced is located.
  • a block centered on the point is set for subsequent comparison and replacement, and the size of the block can be arbitrarily set.
  • the point with the highest confidence of the block is found among all the unprocessed boundary points; /, the block where the point/corresponding boundary point is located is ⁇ .
  • the calculation of the block confidence is a conventional technical means and is described in detail in the refinement of the second embodiment of the method.
  • the boundary outer expansion module 24 expands the boundary to be replaced to form an outer expanded boundary.
  • the replacement boundary is (r X m)
  • the outer-expanded boundary is (r + areas i ze ) X (m+areas i ze ), where area i ze is a parameter indicating how many pixels are expanded outside the boundary to be replaced , will find the block image that can be replaced in this range.
  • the pixel-only RGB value (that is, the color) set in the boundary setting module 21 for marking the boundary to be replaced is completely different from the RGB value of each pixel in the original image in the extended boundary range.
  • the block where the point with the highest degree of confidence is located in the range of the expanded boundary is located, and the block where the feature similarity is the largest, ⁇ , ⁇ , the corresponding boundary point is ⁇ .
  • the original map mapping unit 250 finds the corresponding two points p and g in the original picture and the blocks and ⁇ corresponding to the two points according to the original picture reduction ratio. Replace with ⁇ .
  • the assignment module 26 assigns the maximum value of the feature similarity between the 8 adjacent pixels of the point q and the point p to the point
  • a jump to the confidence processing module 23 is performed by the confidence processing module 23 to find the point with the highest confidence in the block of the unprocessed boundary point until all the boundaries to be replaced are all queried.
  • the confidence processing module 23 it is necessary to use a technical means to block the block where the boundary point has been processed (for example, to exclude the search range of the next cycle, so as to ensure that the boundary that has been processed is not found again.
  • Such technical means for example.
  • the block confidence of the point p is set to 0 (see the embodiment of Fig. 3 for details).

Abstract

A method and device for removing selected images in a picture automatically are provided, and the method includes: setting boundaries to be replaced in an original picture, so as to mask selected images; setting boundary-point-located blocks centered on the points on the boundaries to be replaced; finding a point p' with the highest block confidence among all of the boundary points, and the boundary-point-located block corresponding to the point p' being Ψ p' ; extending the boundaries to be replaced to form extended boundaries; finding a boundary-point-located block Ψ q' having the largest feature similarity compared with the boundary-point-located block of the point p', the boundary point corresponding to Ψ q' being q', and replacing Ψ p' with Ψ q' ; assigning the maximum value of the feature similarity compared between eight neighbor pixels of the point q' and the point p' to the point p'; and returning to the step for searching the point with the highest confidence, and searching the point with the highest confidence in the unprocessed boundary points, until all of the boundaries to be replaced have been processed.

Description

自动移除图像中选定影像的方法和装置 发明领域  Method and apparatus for automatically removing selected images in an image
本发明涉及一种图像处理方法和装置, 尤其涉及将图像中出现的选定影像 进行自动化移除的方法和装置。 背景技术  The present invention relates to an image processing method and apparatus, and more particularly to a method and apparatus for automatically removing selected images appearing in an image. Background technique
在图像拍摄时, 经常会在影像中不可避免的出现所不希望保存的局部影像, 这就会对用户的视觉感受带来很大的损失。 现有的处理方法是通过手动移除来完 成, 具体方式是在需要去除的局部影像中, 通过图像编辑工具, 手动抠图的方式, 对局部影像区域进行修复。 这种操作方式极大耗费人力。 增加了后期处理的负担。  In image shooting, it is often inevitable that partial images that are not desired to be saved appear in the image, which will cause great loss to the user's visual experience. The existing processing method is completed by manual removal. The specific method is to repair the local image area by means of an image editing tool and a manual image in the partial image to be removed. This type of operation is extremely labor intensive. Increased the burden of post processing.
传统的修复图像技术分为两类。 一类是基于几何图像模型的图像修补 (inpainting)技术,该类技术利用偏微分方程和物理热扩散原理,对图像进行修复, 代表的有: M. Bertalmio^ A. L. Bertozzi等. 《 Navier- stokes, fluid dynamics, and image and video inpainting》 ; C. Ballester ^ V. Casel les 等 《A variational model for fi ll ing - in gray level and color images》 ; T. F. Chan and J. Shen《 Non- texture inpainting by curvature- driven diffusions (CDD)》。 该类技术能够保存图像的线性结构, 但只适用于修补图像中的小尺度缺损;对于稍 大的区域效果非常糟糕, 常常在修复区域出现明显的模糊。另一类是基于纹理合成 的图像补全(completion)技术,其中代表性的有: L. Liang, C. Liu等《 Real-time texture synthesi s by patch-based sampl ing》 ; A. Efros and W. T. Freeman 《 Image qui lting for texture synthes is and transfer》 ; M. Ashikhmin 《 Synthesizing natural textures)) ; 该类技术优点是速度快, 但缺点不能很 好的保存图像线性结构。 之后的作者在借鉴 inpainting的思想, 对此进行改进, 比如 A. Criminisi等 ((Object removal by exemplar-based inpainting)) ; D. Simakov等 ((Summarizing visual data using bidirectional simi larity)) . CHO, T. S.等 ((The patch transform and its appl ications to image editing)) ; KOMODAKIS, N.等 ((Image completion using efficient bel ief propagation via priority schedul ing and dynamic pruning)) ; KUMAR, N.等 « What is a good nearest neighbors algorithm for finding simi lar patches in images?)) ; RUBINSTEIN, M.等 《 Improved seam carving for video retargeting》 ; WEXLER, Y等 《Space-time completion of video)) 。 该技术对于填充图像中大的丢失块有 较好的效果, 也能保存图像的结构, 但速度非常慢, 对于一张 1200*1200大小的图 片,修复 200*200区域常常需要几分钟甚至半小时。因此上述技术对于局部影像去 除或修复应用来说, 都具有很大的局限性。 Traditional repair image technologies fall into two categories. One type is the image inlaying technique based on geometric image model. This technique uses partial differential equations and physical thermal diffusion principles to repair images. Representatives are: M. Bertalmio^ AL Bertozzi et al. Navier-stokes, Fluid dynamics, and image and video inpainting; C. Ballester ^ V. Casel les et al "A variational model for fi ll ing - in gray level and color images"; TF Chan and J. Shen " Non- texture inpainting by curvature- Driven diffusions (CDD). This type of technique preserves the linear structure of the image, but is only suitable for patching small-scale defects in the image; it works very badly for slightly larger areas, often with significant blurring in the repair area. The other is image compretion technology based on texture synthesis. Among them are: L. Liang, C. Liu et al., Real-time texture synthesi s by patch-based sampling; A. Efros and WT Freeman "Image qui lting for texture synthes is and transfer"; M. Ashikhmin "Synthesizing natural textures"); This type of technical advantage is fast, but the shortcomings do not save the linear structure of the image well. Later authors have improved on the idea of inpainting, such as A. Criminisi et al. ((Object removal by exemplar-based inpainting); D. Simakov et al. (Summarizing visual data using bidirectional simi larity). CHO, TS (The post transform and its appl ications to image editing); KOMODAKIS, N. et al. ((Image completion using efficient bel ief propagation via priority scheduling ing and dynamic pruning); KUMAR, N., etc. « What is a good Nearest neighbors algorithm for finding simi lar patches in images?)) ; RUBINSTEIN, M. et al. "Improved seam carving for video retargeting"; WEXLER, Y and other "Space-time completion of video"). This technique has a good effect on filling large missing blocks in the image, and can also preserve the structure of the image, but the speed is very slow. For a picture of 1200*1200 size, it usually takes a few minutes or even half an hour to repair the 200*200 area. . Therefore, the above techniques have great limitations for local image removal or repair applications.
所以, 如何自动去除或修复选定影像区域, 是个急需解决的问题。 发明概述  Therefore, how to automatically remove or repair selected image areas is an urgent problem to be solved. Summary of invention
本发明的目的在于解决上述问题, 提供了一种自动移除图像中选定影像的方 法, 具有修复速度快且修复效果好的优点。  SUMMARY OF THE INVENTION An object of the present invention is to solve the above problems and to provide a method for automatically removing selected images in an image, which has the advantages of fast repair speed and good repair effect.
本发明的另一目的在于提供了一种自动移除图像中选定影像的装置。  Another object of the present invention is to provide an apparatus for automatically removing selected images from an image.
本发明的技术方案为:本发明揭示了一种自动移除图像中选定影像的方法,包 括:  The technical solution of the present invention is: The present invention discloses a method for automatically removing selected images in an image, including:
设置原始图上的待替换边界, 以遮盖选定影像;  Set the boundary to be replaced on the original image to cover the selected image;
设置以待替换边界上的点为中心的边界点所在块;  Set the block where the boundary point centered on the point on the boundary to be replaced is located;
在所有的边界点中找出块置信度最高的点 / , 点 / 对应的边界点所在块是 Find the point with the highest confidence of the block in all the boundary points / , the block where the point / corresponding boundary point is located
ΨΡ' ·, Ψ Ρ ' ·,
将待替换边界进行外扩, 形成外扩后边界;  Extending the boundary to be replaced to form an outer expanded boundary;
在外扩后边界的范围内找出和点/ /的边界点所在块^ 相较特征相似度最大 的边界点所在块^,, ^,对应的边界点是 用 ^,来替换  Find the block where the boundary point of the point / / is located in the range of the outer boundary of the outer expansion. The block where the feature similarity is the largest is ^, ^, and the corresponding boundary point is replaced by ^.
将点 q'的 8邻接像素与点 p'之间比较的特征相似度最大值赋给点 p'; 返回査找置信度最高的点的步骤,在未处理过的边界点所在块中査找置信度最 高的点, 直到所有的待替换边界处理完毕。  The maximum value of the feature similarity between the 8 adjacent pixels of the point q' and the point p' is assigned to the point p'; the step of finding the point with the highest confidence is found, and the confidence is found in the block where the unprocessed boundary point is located. The highest point until all the boundaries to be replaced have been processed.
根据本发明的自动移除图像中选定影像的方法的一实施例,在设置原始图上的 待替换边界之前还包括:  An embodiment of the method for automatically removing selected images in an image according to the present invention further includes: before setting a boundary to be replaced on the original image:
将原始图进行缩小, 以使后续的处理对象是缩小后的原始图。  The original image is reduced so that the subsequent processing object is the reduced original image.
根据本发明的自动移除图像中选定影像的方法的一实施例,通过插值算法将原 始图进行缩小。  In accordance with an embodiment of the method of automatically removing selected images from an image in accordance with the present invention, the original image is reduced by an interpolation algorithm.
根据本发明的自动移除图像中选定影像的方法的一实施例,在找到点 和点 之后, 根据原始图缩小比例找到原始图中对应的两个点 p和 ^以及这两个点 p和 ^ 所对应的块 和^, 用^替换 ¾^, 并将点 g的 8 邻接像素与点 ρ之间比较 的特征相似度最大值赋给点 P。 An embodiment of a method of automatically removing selected images in an image in accordance with the present invention, finding points and points After that, according to the original image reduction ratio, find the corresponding two points p and ^ in the original image and the corresponding blocks and ^ of the two points p and ^, replace 3⁄4^ with ^, and 8 adjacent pixels and points of point g The feature similarity maximum value compared between ρ is assigned to point P.
根据本发明的自动移除图像中选定影像的方法的一实施例,在设置原始图上的 待替换边界的步骤中,将待替换边界标记为和背景色不同的颜色, 以使与背景色颜 色不同的边界成为待替换边界。  According to an embodiment of the method for automatically removing selected images in an image according to the present invention, in the step of setting a boundary to be replaced on the original image, the boundary to be replaced is marked as a color different from the background color to make the background color The borders with different colors become the boundaries to be replaced.
本发明还揭示了一种自动移除图像中选定影像的装置, 包括:  The present invention also discloses an apparatus for automatically removing selected images in an image, including:
边界设置模块, 设置原始图上的待替换边界, 以遮盖选定影像;  a boundary setting module, which sets a boundary to be replaced on the original image to cover the selected image;
边界点所在块设置模块,耦接边界设置模块,设置以待替换边界上的点为中心 的边界点所在块;  a block setting module in which the boundary point is located, coupled to the boundary setting module, and set a block in which the boundary point centered on the point on the boundary to be replaced is located;
置信度处理模块,耦接置信度处理模块,在所有的边界点中找出块置信度最高 的点 / , 点//对应的边界点所在块为^  The confidence processing module is coupled to the confidence processing module to find the point with the highest confidence of the block in all the boundary points, and the block corresponding to the boundary point of the point // is ^
边界外扩模块, 耦接置信度处理模块, 将待替换边界进行外扩, 形成外扩后边 界;  The boundary expansion module is coupled to the confidence processing module to expand the boundary to be replaced to form an outer boundary;
替换处理模块, 耦接该边界外扩模块, 在外扩后边界的范围内找出和点 //的 边界点所在块 ΨΡ'相较特征相似度最大的边界点所在块 Ψ , ¥q'对应的边界点是 q', 用边界点所在块 Ψ 替换边界点所在块 ΨΡ'; Alternatively the processing module, coupled to the outer boundary of the expansion module, the expansion of the outer boundary of the range to identify the boundary points and the point where the block // Ψ Ρ 'feature similarity compared to the maximum point where the block boundary Ψ, ¥ q' corresponding to The boundary point is q', and the block where the boundary point is located is replaced by the block 所在 where 边界Ρ ';
赋值模块,耦接替换处理模块和置信度处理模块,将点 ^ '的 8邻接像素与点 之间比较的特征相似度最大值赋给点 / , 返回置信度处理模块进行处理, 由置信 度处理模块在未处理过的边界点所在块中査找置信度最高的点,直到所有的待替换 边界处理完毕。  The assignment module is coupled to the replacement processing module and the confidence processing module, and assigns the maximum value of the feature similarity between the 8 adjacent pixels of the point to the point/, and returns to the confidence processing module for processing, and is processed by the confidence degree. The module looks for the point with the highest confidence in the block where the unprocessed boundary points are located until all the boundaries to be replaced are processed.
根据本发明的自动移除图像中选定影像的装置的一实施例,该装置还包括图像 缩小模块, 耦接在边界设置模块之前, 该图像缩小模块将原始图进行缩小, 以使后 续的处理对象是缩小后的原始图。  An embodiment of the apparatus for automatically removing selected images in an image according to the present invention, the apparatus further comprising an image reduction module coupled to the boundary setting module, the image reduction module reducing the original image for subsequent processing The object is the original image after reduction.
根据本发明的自动移除图像中选定影像的装置的一实施例,在图像缩小模块中 设有一插值处理单元, 通过插值处理单元中的插值算法的运行将原始图进行缩小。  In accordance with an embodiment of the apparatus for automatically removing selected images from an image in accordance with the present invention, an interpolation processing unit is provided in the image reduction module to reduce the original image by operation of an interpolation algorithm in the interpolation processing unit.
根据本发明的自动移除图像中选定影像的装置的一实施例,在替换处理模块中 还包括原始图映射单元,该替换处理模块在找到点/ 和点 ^ '之后启动原始图映射单 元, 原始图映射单元根据原始图缩小比例找到原始图中对应的两个点 ρ和 g以及这 两个点 p和 ^所对应的块 和^, 以使^替换 ¾^, 并在赋值模块中将点 的An embodiment of the apparatus for automatically removing selected images in an image according to the present invention further includes an original map mapping unit in the replacement processing module, the replacement processing module starting the original map mapping unit after finding the dot/and the dot ^ ', The original map mapping unit finds the corresponding two points ρ and g in the original image according to the original map reduction ratio and this Two points p and ^ correspond to the block and ^, so that ^ replaces 3⁄4^, and points in the assignment module
8邻接像素与点 p之间比较的特征相似度最大值赋给点 p。 The maximum value of the feature similarity between the adjacent pixels and the point p is assigned to the point p.
根据本发明的自动移除图像中选定影像的装置的一实施例, 在边界设置模块 中,将待替换边界标记为和背景色不同的颜色, 以使与背景色颜色不同的边界成为 待替换边界。 本发明对比现有技术有如下的有益效果:本发明可自动移除图像中选定区域的 图像,使得原始影像的提供者更容易去除选定区域的影像,从而解决了原始图像处 理选定区域影像去除过于依赖人力、 效率低下、 成本过高的问题。 附图说明  According to an embodiment of the apparatus for automatically removing selected images in an image according to the present invention, in the boundary setting module, the boundary to be replaced is marked as a color different from the background color so that a boundary different from the background color is to be replaced. boundary. Compared with the prior art, the present invention has the following beneficial effects: the invention can automatically remove the image of the selected area in the image, so that the original image provider can more easily remove the image of the selected area, thereby solving the original image processing selected area. Image removal relies too much on manpower, inefficiency, and cost. DRAWINGS
图 1是本发明的自动移除图像中选定影像的方法的第一实施例的流程图。 图 2是本发明的自动移除图像中选定影像的方法的第二实施例的流程图。 图 3是图 2实施例的细化流程图。  1 is a flow chart of a first embodiment of a method of automatically removing selected images from an image of the present invention. 2 is a flow chart of a second embodiment of a method of automatically removing selected images from an image of the present invention. Figure 3 is a detailed flow chart of the embodiment of Figure 2.
图 4是本发明的自动移除图像中选定影像的装置的第一实施例的原理图。 图 5是本发明的自动移除图像中选定影像的装置的第二实施例的原理图。 发明的详细说明  4 is a schematic diagram of a first embodiment of an apparatus for automatically removing selected images from an image of the present invention. Figure 5 is a schematic diagram of a second embodiment of the apparatus for automatically removing selected images from an image of the present invention. Detailed description of the invention
下面结合附图和实施例对本发明作进一步的描述。 自动移除图像中选定影像的方法的第一实施例 图 1示出了本发明的自动移除图像中选定影像的方法的实施例。 请参见图 1, 下面是对本实施例的自动移除图像中选定影像的方法的各个步骤的详细描述。  The invention will now be further described with reference to the drawings and embodiments. First Embodiment of Method of Automatically Removing Selected Images in an Image FIG. 1 illustrates an embodiment of a method of automatically removing selected images in an image of the present invention. Referring to FIG. 1, the following is a detailed description of the steps of the method for automatically removing selected images in an image of the present embodiment.
步骤 S10: 设置原始图上的待替换边界, 以遮盖选定影像。  Step S10: Set the boundary to be replaced on the original image to cover the selected image.
待替换边界可标记为统一的颜色, 遮盖住原始图上的背景色。 也就是说, 将 待替换边界标记为和背景色不同的颜色,这样与背景色颜色不同的边界就可被判定 为待替换边界。  The border to be replaced can be marked as a uniform color, covering the background color on the original image. That is, the boundary to be replaced is marked as a color different from the background color, so that the boundary different from the background color can be judged as the boundary to be replaced.
步骤 S11 : 设置以待替换边界上的点为中心的边界点所在块。 在待替换边界上的任意点的周围一定像素范围内, 设置以该点为中心的块, 用来进行后续的对比和替换, 块的大小可任意设定。 Step S11: Set a block in which the boundary point centered on the point on the boundary to be replaced is located. In a certain pixel range around any point on the boundary to be replaced, a block centered on the point is set for subsequent comparison and replacement, and the size of the block can be arbitrarily set.
步骤 S12 :在所有未处理过的边界点中找出块置信度最高的点 //,此时点 //对 应的边界点所在块为 ί^ 。  Step S12: Find the point with the highest confidence of the block among all the unprocessed boundary points, and the block where the corresponding boundary point is // is ί^.
步骤 S13 : 将待替换边界进行外扩, 形成外扩后边界。  Step S13: The boundary to be replaced is externally expanded to form an outer expanded boundary.
例如, 原来的待替换边界是(r X m) , 则外扩后边界是(r + areasize ) X (m 十 areasize ) , 其中 areasize是一个参数, 表示在待替换边界范围外扩大多少个 像素, 将在这一范围内査找可供替换的块影像。  For example, if the original boundary to be replaced is (r X m), then the outer boundary is (r + areasize ) X (m ten areasize ), where areasize is a parameter indicating how many pixels are expanded outside the boundary to be replaced. Find block images that can be replaced in this range.
值得注意的是, 在步骤 S10 中设定的用于标记待替换边界范围内的唯一像素 RGB值 (也就是颜色) 与在外扩后边界范围内原图的各像素 RGB值全不相同。  It should be noted that the unique pixel RGB value (that is, the color) set in step S10 for marking the boundary to be replaced is completely different from the RGB value of each pixel in the original image in the extended boundary range.
步骤 S14:在外扩后边界的范围内找出和当前置信度最高的点; /所在块^,相 较特征相似度最大的边界点所在块 ^,, ^,对应的边界点是 ^, 用^,来替换 ΨΡStep S14: Find the point with the highest degree of confidence in the range of the expanded boundary; / the block ^, compared with the block with the largest feature similarity, ^, ^, the corresponding boundary point is ^, with ^ To replace Ψ Ρ ,
在本步骤中, 完成了点//所在块的影像替换, 但这时为防止替换时的像素损 失, 需要进行后续的步骤, 将保证替换得到的影像与周围的影像完全融合。  In this step, the image replacement of the block/location block is completed. However, in order to prevent pixel loss during replacement, a subsequent step is required to ensure that the replaced image is completely fused with the surrounding image.
步骤 S15 : 将点 ^ '的 8邻接像素与点 //之间比较的特征相似度最大值赋给点 Step S15: assigning the maximum value of the feature similarity between the adjacent pixels of the point ^ ' and the point // to the point
Ρ、 ° Ρ, °
本步骤结束后跳转到步骤 Sl l, 直至所有的待替换边界全部査询完毕。  After the end of this step, go to step Sl l until all the boundaries to be replaced are all queried.
在本步骤中, 还需要通过一种技术手段将已经处理的边界点所在块 (例如 ψρ' )排除在下一次循环的査找范围之外, 以保证在跳转到步骤 S11的时候不用再 査找已经处理过的边界。 这样的技术手段例如是将点 的置信度设为 0 (具体可参 见图 3的实施例) 。 In this step, it is also necessary to exclude the block in which the boundary point has been processed (for example, ψ ρ ') from the search range of the next loop by a technical means, so as to ensure that it is not necessary to search again when jumping to step S11. Processed boundaries. Such a technical means is, for example, to set the confidence level of the point to 0 (see the embodiment of FIG. 3 for details).
在本实施例中, 在步骤 S11至 S15之间进行循环, 直到步骤 S10中所述的待 替换边界处理完毕。 自动移除图像中选定影像的方法的第二实施例 图 2示出了本发明的自动移除图像中选定影像的方法的第二实施例。 请参见 图 2, 下面是对本实施例的方法中的各个步骤的详细描述。 步骤 S20: 将原始图进行缩小, 以使后续的处理对象是缩小后的原始图。 可以预设一个尺寸范围 (n X n) , 如果原始图本身就在这个尺寸范围内, 则 不需要再进行缩放, 而用原始图代入后续的运算。 In the present embodiment, a loop is performed between steps S11 to S15 until the boundary to be replaced described in step S10 is processed. Second Embodiment of Method of Automatically Removing Selected Images in an Image FIG. 2 illustrates a second embodiment of a method of automatically removing selected images in an image of the present invention. Referring to Figure 2, the following is a detailed description of the various steps in the method of the present embodiment. Step S20: The original image is reduced so that the subsequent processing object is the reduced original image. A size range (n X n) can be preset. If the original image itself is within this size range, no further scaling is required, and the original image is substituted for subsequent operations.
如果原始图本身不在这个尺寸范围内, 则采用插值算法, 将其缩放到 n X n的 尺寸范围内, 并单独存储该缩小的图像。缩小尺寸的目的在于提高运算的速度, 保 证査找相关匹配点及区域的时候, 造成的遍历次数大大减少。  If the original image itself is not within this size range, an interpolation algorithm is employed, scaled to a size range of n X n , and the reduced image is stored separately. The purpose of downsizing is to increase the speed of the calculation, and to ensure that the number of traversals is greatly reduced when searching for related matching points and regions.
步骤 S21 : 判断原始图缩小后的待替换边界。  Step S21: Determine the boundary to be replaced after the original image is reduced.
待替换边界可标记为统一的颜色, 遮盖住原始图上的背景色。 也就是说, 将 待替换边界标记为和背景色不同的颜色,这样与背景色颜色不同的边界就可被判定 为待替换边界。  The border to be replaced can be marked as a uniform color, covering the background color on the original image. That is, the boundary to be replaced is marked as a color different from the background color, so that the boundary different from the background color can be judged as the boundary to be replaced.
步骤 S22 : 设置以待替换边界上的点为中心的边界点所在块。  Step S22: Set a block in which the boundary point centered on the point on the boundary to be replaced is located.
在待替换边界上的任意点的周围一定像素范围内, 设置以该点为中心的块, 用来进行后续的对比和替换, 块的大小可任意设定。  In a certain pixel range around any point on the boundary to be replaced, a block centered on the point is set for subsequent comparison and replacement, and the size of the block can be arbitrarily set.
步骤 S23 :在所有未处理过的边界点中找出块置信度最高的点 //,此时点 //对 应的边界点所在块为 ί^ 。  Step S23: Find the point with the highest confidence of the block in all the unprocessed boundary points, and the block where the corresponding boundary point is // is ί^.
步骤 S24: 将待替换边界进行外扩, 形成外扩后边界。  Step S24: The boundary to be replaced is externally expanded to form an outer expanded boundary.
例如, 原来的待替换边界是(r X m) , 则外扩后边界是(r + areasize ) X (m 十 areasize ) , 其中 areasize是一个参数, 表示在待替换边界范围外扩大多少个 像素, 将在这一范围内査找可供替换的块影像。  For example, if the original boundary to be replaced is (r X m), then the outer boundary is (r + areasize ) X (m ten areasize ), where areasize is a parameter indicating how many pixels are expanded outside the boundary to be replaced. Find block images that can be replaced in this range.
值得注意的是, 在步骤 S21 中的用于标记待替换边界范围内的唯一像素 RGB 值 (也就是颜色) 与在外扩后边界范围内原图的各像素 RGB值全不相同。  It should be noted that the unique pixel RGB value (that is, the color) used to mark the boundary to be replaced in step S21 is different from the RGB value of each pixel in the original image in the extended boundary range.
步骤 S25 :在外扩后边界的范围内找出和当前置信度最高的点; /所在块^,相 较特征相似度最大的边界点所在块 ^,, ^,对应的边界点是 ^, 根据原始图缩小 比例找到原始图中对应的两个点 p和 g以及这两个点 p和 g所对应的块 Ψρ和 ¥q, 用^来替换 。 Step S25: Find the point with the highest degree of confidence in the range of the expanded boundary; / the block ^, compared with the block where the feature similarity is the largest, ^, ^, the corresponding boundary point is ^, according to the original The graph is scaled down to find the corresponding two points p and g in the original graph and the blocks Ψρ and ¥ q corresponding to the two points p and g, which are replaced by ^.
在本步骤中, 完成了点 p所在块的影像替换, 但这时为防止替换时的像素损 失, 需要进行后续的步骤, 将保证替换得到的影像与周围的影像完全融合。  In this step, the image replacement of the block where the point p is located is completed. However, in order to prevent pixel loss during replacement, a subsequent step is required to ensure that the replaced image is completely fused with the surrounding image.
步骤 S26:将点 q的 8邻接像素与点 p之间比较的特征相似度最大值赋给点 p。 本步骤结束后跳转到步骤 S22, 直至所有的待替换边界全部査询完毕。 在本步骤中, 还需要通过一种技术手段将已经处理的边界点所在块 (例如Step S26: Assign the maximum value of the feature similarity between the 8 adjacent pixels of the point q and the point p to the point p. After the end of this step, the process jumps to step S22 until all the boundaries to be replaced are all queried. In this step, there is also a need to use a technical means to block the block where the boundary point has been processed (for example
ΨΡ' )排除在下一次循环的査找范围之外, 以保证在跳转到步骤 S22的时候不用再 査找已经处理过的边界。 这样的技术手段例如是将点 的置信度设为 0 (具体可参 见图 3的实施例) 。 Ψ Ρ ' ) is excluded from the search range of the next loop to ensure that the boundary that has been processed is not searched again when jumping to step S22. Such a technical means is, for example, to set the confidence level of the point to 0 (see the embodiment of FIG. 3 for details).
在本实施例中, 在步骤 S22至 S26之间进行循环, 直到步骤 S21中所述的待 替换边界处理完毕。 自动移除图像中选定影像的方法的第二实施例的细化 图 3示出了上述的图 2实施例的进一步细化流程。请参见图 3, 以下是第二实 施例的方法的细化流程中各个步骤的详细描述。  In the present embodiment, a loop is performed between steps S22 to S26 until the boundary to be replaced described in step S21 is processed. Refinement of the second embodiment of the method of automatically removing selected images in an image Fig. 3 shows a further refinement of the above-described embodiment of Fig. 2. Referring to Fig. 3, the following is a detailed description of each step in the refinement flow of the method of the second embodiment.
步骤 S30: 从原始图中选取待修复区域。  Step S30: Select the area to be repaired from the original image.
例如原始图为 (W X H) , 待修复的边界可标记为统一的颜色, 遮盖住背景色, 是否是待替换边界的判断依据是其上的颜色与其他颜色不同的边界。  For example, if the original image is (W X H), the boundary to be repaired can be marked as a uniform color, covering the background color, and whether the boundary to be replaced is judged by the boundary on which the color is different from other colors.
步骤 S31 : 判断 W和 Η是否均大于 η。  Step S31: Determine whether both W and Η are greater than η.
η是一个预设值,例如为 300像素值,这是一个比较适合的保证运算效率的值。 若 W和 Η均大于 η像素, 则进行步骤 S312 , 否则进行步骤 S314。  η is a preset value, for example, 300 pixels, which is a suitable value to ensure the efficiency of the operation. If both W and Η are larger than η pixels, step S312 is performed, otherwise step S314 is performed.
步骤 S312 : 获取 W和 H与 n的最大比值为 rate。  Step S312: Acquire W and the maximum ratio of H to n is rate.
本步骤采用的公式为 rate = max (W/n, H/n) 。  The formula used in this step is rate = max (W/n, H/n).
步骤 S314: 将 rate赋值为 1。  Step S314: Assign rate to 1.
步骤 S316: 根据步骤 S312所得比率, 对原始图像引入插值算法, 将原始图进 行缩小, 缩小率为 rate。  Step S316: According to the ratio obtained in step S312, an interpolation algorithm is introduced into the original image, and the original image is reduced, and the reduction ratio is rate.
本步骤采用的插值算法可以为双线性, 从而减少像素的损失。  The interpolation algorithm used in this step can be bilinear, thereby reducing pixel loss.
步骤 S32 : 采用公式 ' =_^,// ' = ^_进行缩小运算, 获得 W'和 H'。  Step S32: Perform a reduction operation using the formula ' =_^, / / ' = ^_ to obtain W' and H'.
rate rate 在本步骤中, 若依步骤 S314, 则 rate值为 1, '值等于 Pf, //'值等于 //。 步骤 S33 : 设块^ '大小为 t*t, ^'为置信度, ^'值为 0。  Rate rate In this step, if the value is 1, according to step S314, the value is equal to Pf, and the value of // is equal to //. Step S33: Let block ^' size be t*t, ^' be a confidence level, and ^' value be 0.
本步骤中块^ '为以点;? '为中心, 边长为 的块, 是自然数, 例如取值为 In this step, the block ^ ' is a block with a side length of ?, which is a natural number, for example, the value is
10。 10.
步骤 S34: 判断点;? '是否为步骤 S30中所标定的待修复区域。 本步骤中判断的依据为点的 RGB值是否为待修复区域的像素值, 例如在步骤 S30中设定的待修复区域的像素是绿色,则在这里就是判断点的 RGB值是否为绿色。 若为绿色, 则进行步骤 S342, 若不为绿色, 则进行步骤 S344。 Step S34: Judging the point; ? ' is the area to be repaired as specified in step S30. The basis for determining in this step is whether the RGB value of the point is the pixel value of the area to be repaired. For example, if the pixel of the area to be repaired set in step S30 is green, then here is whether the RGB value of the point is green. If it is green, step S342 is performed, and if it is not green, step S344 is performed.
步骤 S342: 求点;? '所在块^ '的置信度。  Step S342: Find the point;? The confidence level of the 'block ^'.
块^'的置信度的计算是一种公知技术, 例如:  The calculation of the confidence of the block ^' is a well-known technique, such as:
P(p^ = C(p^D(p^)  P(p^ = C(p^D(p^))
Figure imgf000010_0001
Figure imgf000010_0001
a 这里 为^'的面积。 a为图像归一化因子, 这里默认为 255。 Ώ为待修 复区域, w,为正交于点;?'切线方向的单位向量。 为;? '点的等照度线。 a Here is the area of ^'. a is the image normalization factor, which defaults to 255. Ώ is the area to be repaired, w, is orthogonal to the point; 'Unit vector of tangent direction. For the ?? point of the illuminance line.
P P
CO)表示点 u的置信度值, u表示某个像素 其中求出的 ')为点 P '所在块 ΨΡ '的置信度。 CO) represents the confidence value of point u, u represents a pixel which is determined ') of the point P' where the blocks Ψ Ρ 'confidence.
步骤 S344: 在缩小的图像 (尺寸为 '*H') 中寻找下一个像素点。  Step S344: Find the next pixel in the reduced image (size '*H').
本步骤中若存在下一个像素点, 则进行步骤 S345, 否则进行步骤 S348。  If there is a next pixel in this step, step S345 is performed, otherwise step S348 is performed.
步骤 S345: 在缩小的图像 (尺寸为 '*H') 中将 设为下一个像素点。 本步骤进行完后, 进行步骤 S34。  Step S345: Set to the next pixel in the reduced image (size '*H'). After this step is completed, step S34 is performed.
步骤 S346:将在步骤 S342中所获得的 Ψ p 的置信度与 ηιαχψ p 的置信度进行 比较。 Step S346: The confidence in step S342 confidence obtained in ηιαχψ p Ψ p and compared.
本步骤中,若的 ΨΡ'的置信度大于 max Ψρ'的置信度则进行步骤 S347,若 Ψ ρ' 的置信度小于或等于 ηιαχψ ρ 的置信度则进行步骤 S35。 In this step, if the confidence level of Ψ Ρ ' is greater than the confidence of max Ψ ρ ', step S347 is performed, and if the confidence level of Ψ ρ ' is less than or equal to the confidence of ηια χψ ρ , step S35 is performed.
步骤 S348: 完成选定影像的移除, 本方法结束。  Step S348: The removal of the selected image is completed, and the method ends.
步骤 S347: 将^'的置信度赋值给 ax ί^'的置信度, 然后进行步骤 S35。 本步骤中同时将保存点 , 用以带入步骤 S37所进行的运算。  Step S347: Assign the confidence of ^' to the confidence of ax ί^', and then proceed to step S35. In this step, the save point is simultaneously used to bring the operation performed in step S37.
步骤 S35: 若像素点为缩小的图像(尺寸为 '*H') 中最后一个査找过的像素 点, 则进行步骤 S36, 否则回到步骤 S345以査找下一个像素点。 Step S35: If the pixel point is the last pixel found in the reduced image (size is '*H') If yes, go to step S36, otherwise go back to step S345 to find the next pixel.
步骤 S36: 在当前边界曲线最外接矩形 外再外扩 areos/ze个像素, 划定外 扩区域, 尺寸为 (r+a easize)*(m+a easize)。  Step S36: Extend the areos/ze pixels in the outermost rectangle of the current boundary curve, and define the outer region, and the size is (r+a easize)*(m+a easize).
本步骤中外接矩形 为 S30所述的待修复区域的外沿所形成的矩形 * j。 本步骤中 ar size的值例如设为 35, 此数值在带入运算的时候可以提高后续 步骤的运算效率。  In this step, the circumscribed rectangle is a rectangle * j formed by the outer edge of the area to be repaired as described in S30. In this step, the value of ar size is set to 35, for example, and this value can improve the efficiency of the subsequent steps when the operation is carried.
步骤 S37:设点 为步骤 S36所述外扩区域(尺寸为 r+areo^eJYm+areo^e ) 中除步骤 S30所述待修复区域之外的区域中的点。 设块 为以点 为中心的块 区域, 块 的大小为 t*t, 设 ^的欧式距离平方和为无穷大。  Step S37: Set a point in the area other than the area to be repaired in step S30 in the expanded area (size r+areo^eJYm+areo^e) in step S36. Let the block be the point-centered block area, the size of the block is t*t, and the sum of the squares of the Euclidean distance of ^ is infinite.
本步骤中, 块 的边长 t的值例如设为 10, 与块^ '的边长相同。 便于后 续步骤中块 q'对块 Ψρ'的像素替换。  In this step, the value of the side length t of the block is set to, for example, 10, which is the same as the side length of the block ^'. It is convenient to replace the pixel of the block Ψρ' in the block q' in the subsequent step.
步骤 S38: 判断在外扩区域中是否还有块 ^^, 若存在则进行步骤 S382, 若 不存在则进行步骤 S384。 步骤 S382:判断点 和点;?'的欧式距离平方和 ^(lq^gb-Ip^bf 与 min 的 欧式距离平方和的大小, 若点 和点 的欧式距离平方和^ 小于 的欧式距离平方和, 则进行步骤 S386, 否则进行步骤 S384, 其中 /^¾表 示 q'点 RGB的像素值, Ip,rgb表示 p'点 RGB的像素值。 步骤 S386: 将 ji q'rgb
Figure imgf000011_0001
f 赋值到 ύηψ q、的欧式距离平方和。 本步骤中还将保留 点, 该点将带入后续步骤 S387或 S388。
Step S38: It is judged whether there is still a block ^^ in the extended area, if yes, step S382 is performed, and if not, step S384 is performed. Step S382: judging the point and the point; the square distance sum of the 'European distance' (the magnitude of the sum of the squares of the Euclidean distance of l q ^ gb -I p ^ b f and min, if the square of the Euclidean distance of the point and the point is smaller than the European style If the distance is squared, then step S386 is performed, otherwise step S384 is performed, where /^ 3⁄4 represents the pixel value of q' point RGB, and Ip , rgb represents the pixel value of p' point RGB. Step S386: ji q'rgb
Figure imgf000011_0001
f is assigned to 欧式ηψ q, the sum of squared Euclidean distances. A point will also be retained in this step, which will be taken to the next step S387 or S388.
本步骤进行完后, 将继续进行步骤 S38的判断。  After this step is completed, the judgment of step S38 will be continued.
步骤 S384: 若 rate值等于 1则进行步骤 S387, 否则进行步骤 S388。  Step S384: If the rate value is equal to 1, proceed to step S387, otherwise proceed to step S388.
本步骤中所述的 rate值为步骤 S312或步骤 S314中得到的 rate值。  The rate value described in this step is the value obtained in step S312 or step S314.
步骤 S387: 将点 所在块 的像素拷贝到点;? '所在的块^ '中。  Step S387: Copy the pixel of the block where the point is located to the point; ? 'in the block ^'.
本步骤将使点 所在块 的像素被替换, 完成本块中选定影像的移除。 本步骤完成后将进行后续步骤 S392。  This step will cause the pixels of the block where the point is to be replaced, and the removal of the selected image in this block is completed. After this step is completed, the subsequent step S392 will be performed.
步骤 S388: 在原始图 (尺寸为 V*ff) 中找到点和点。 此步骤为一个线性的映 射关系采用公式为 P =rate * /? n g =rate * '。 Step S388: Find points and points in the original picture (size is V*ff). This step is a linear reflection The relationship is plotted as P = rate * /? ng = rate * '.
本步骤中所述的 rate值为步骤 S312或步骤 S314中得到的 rate值。  The rate value described in this step is the value obtained in step S312 or step S314.
本步骤进行完后将进行步骤 S389。  After this step is completed, step S389 will be performed.
步骤 S389: 将点 q所在块 的像素拷贝到点 P所在的块 Ψρ中。  Step S389: Copy the pixel of the block where the point q is located to the block Ψρ where the point P is located.
本步骤将使点 Ρ所在块 ΨΡ的像素被替换, 完成本块中选定影像的移除。 本步骤进行完后将进行步骤 S394。 This step will replace the pixel of the block Ψ Ρ in the block, and complete the removal of the selected image in this block. After this step is completed, step S394 will be performed.
步骤 S392: 将点 的 8邻接像素与;? '点比较的欧式平方最小值赋给点 。 本步骤进行完后将继续进行步骤 S39。  Step S392: Assign the Euclidean squared minimum of the adjacent pixel of the point to the point of the ?? point. After this step is completed, the process proceeds to step S39.
步骤 S394: 将点 q的 8邻接像素与 P点比较的欧式平方最小值赋给点 P 。 本步骤进行完后将继续进行步骤 S39。  Step S394: Assign the Euclidean squared minimum value of the 8 adjacent pixels of the point q to the P point to the point P. After this step is completed, the process proceeds to step S39.
步骤 S39: 将点 的置信度设为 0。  Step S39: Set the confidence level of the point to 0.
本步骤使得后续步骤 S346中判断得到的值总为否, 从而得以进行后续的步骤 This step makes the value judged in the subsequent step S346 always negative, so that the subsequent steps can be performed.
S35。 S35.
本步骤进行完后将进行步骤 S344。 自动移除图像中选定影像的装置的第一实施例 图 4示出了本发明的自动移除图像中选定影像的装置的第一实施例的原理。 请参见图 4, 下面是对本实施例的装置的原理的详细描述。  After this step is completed, step S344 will be performed. First Embodiment of Apparatus for Automatically Removing Selected Images in an Image FIG. 4 illustrates the principle of a first embodiment of an apparatus for automatically removing selected images from an image of the present invention. Referring to Figure 4, the following is a detailed description of the principles of the apparatus of the present embodiment.
本实施例的自动移除图像中选定影像的装置包括以下的模块: 边界设置模块 The apparatus for automatically removing selected images in an image of the embodiment includes the following modules: a boundary setting module
10、 边界点所在块设置模块 1 1、 置信度处理模块 12、 边界外扩模块 13、 替换处理 模块 14以及赋值模块 15。 这些模块之间的连接关系是: 边界设置模块 10耦接边 界点所在块设置模块 1 1,边界点所在块设置模块 1 1耦接置信度处理模块 12,置信 度处理模块 12耦接边界外扩模块 13, 边界外扩模块 13耦接替换处理模块 14, 替 换处理模块 14耦接赋值模块 15, 赋值模块除了耦接替换处理模块 14外还耦接置 信度处理模块 12。 10. The block setting module in the boundary point 1 1. The confidence processing module 12, the boundary expansion module 13, the replacement processing module 14, and the evaluation module 15. The connection relationship between the modules is: the boundary setting module 10 is coupled to the block setting module 1 where the boundary point is located, and the block setting module 1 1 where the boundary point is located is coupled to the confidence processing module 12, and the confidence processing module 12 is coupled to the boundary expansion. The module 13 , the boundary expansion module 13 is coupled to the replacement processing module 14 , and the replacement processing module 14 is coupled to the evaluation module 15 . The evaluation module is coupled to the confidence processing module 12 in addition to the replacement processing module 14 .
边界设置模块 10用于设置原始图上的待替换边界, 以遮盖选定影像。 待替换 边界可标记为统一的颜色, 遮盖住原始图上的背景色。也就是说, 将待替换边界标 记为和背景色不同的颜色, 这样与背景色颜色不同的边界就可被判定为待替换边 界。 The boundary setting module 10 is configured to set a boundary to be replaced on the original image to cover the selected image. The border to be replaced can be marked as a uniform color, covering the background color on the original image. That is, the boundary to be replaced is marked as a color different from the background color, so that the boundary different from the background color can be determined as the edge to be replaced. Boundary.
边界点所在块设置模块 11用于设置以待替换边界上的点为中心的边界点所在 块。在待替换边界上的任意点的周围一定像素范围内, 设置以该点为中心的块, 用 来进行后续的对比和替换, 块的大小可任意设定。  The block setting module 11 in which the boundary point is located is used to set a block in which the boundary point centered on the point on the boundary to be replaced is located. In a certain pixel range around any point on the boundary to be replaced, a block centered on the point is set for subsequent comparison and replacement, and the size of the block can be arbitrarily set.
置信度处理模块 12中,在所有未处理过的边界点中找出块置信度最高的点;/, 此时点 / 对应的边界点所在块为 ί^ 。 块置信度的计算是传统的技术手段, 并且 在方法第二实施例的细化中有详细描述。  In the confidence processing module 12, the point with the highest confidence of the block is found among all the unprocessed boundary points; /, the block where the point/corresponding boundary point is located is ί^. The calculation of the block confidence is a conventional technical means and is described in detail in the refinement of the second embodiment of the method.
边界外扩模块 13将待替换边界进行外扩, 形成外扩后边界。 例如, 原来的待 替换边界是 (r X m) , 则外扩后边界是 (r + areasize ) X (m+areasize ) , 其中 areasize 是一个参数, 表示在待替换边界范围外扩大多少个像素, 将在这一范围 内査找可供替换的块影像。  The boundary outer expansion module 13 expands the boundary to be replaced to form an outer expanded boundary. For example, if the original boundary to be replaced is (r X m), then the outer boundary is (r + areasize ) X (m+areasize ), where areasize is a parameter indicating how many pixels are expanded outside the boundary to be replaced. Find block images that can be replaced in this range.
需要注意的是, 在边界设置模块 10中设定的用于标记待替换边界范围内的唯 一像素 RGB值 (也就是颜色)与在外扩后边界范围内原图的各像素 RGB值全不相同。  It should be noted that the unique pixel RGB value (that is, the color) set in the boundary setting module 10 for marking the boundary to be replaced is completely different from the RGB value of each pixel in the original image in the extended boundary range.
替换处理模块 14中, 外扩后边界的范围内找出和当前置信度最高的点 所在 块^ 相较特征相似度最大的边界点所在块^,, ί^,对应的边界点是 ^, 用^, 来替换 i^ 。  In the replacement processing module 14, the block where the point with the highest degree of confidence is located in the range of the outer-expanded boundary is located, and the boundary point where the feature similarity is the largest is ^, ί^, and the corresponding boundary point is ^, ^, to replace i^.
在本模块中, 完成了点;/所在块的影像替换, 但这时为防止替换时的像素损 失, 需要进行后续模块的处理, 将保证替换得到的影像与周围的影像完全融合。  In this module, the dot is completed; the image of the block is replaced, but in order to prevent pixel loss during replacement, subsequent module processing is required to ensure that the replaced image is completely fused with the surrounding image.
赋值模块 15将点 q'的 8邻接像素与点 p'之间比较的特征相似度最大值赋给点 p'。  The assignment module 15 assigns the maximum value of the feature similarity between the 8 adjacent pixels of the point q' and the point p' to the point p'.
在赋值模块 15处理之后, 跳转到置信度处理模块 12, 由置信度处理模块 12 在未处理过的边界点所在块中査找置信度最高的点,直至所有的待替换边界全部査 询完毕。  After processing by the evaluation module 15, the jump to the confidence processing module 12 is performed by the confidence processing module 12 to find the point with the highest confidence in the block of the unprocessed boundary point until all the boundaries to be replaced are all queried.
在置信度处理模块 12中, 需要通过一种技术手段将已经处理的边界点所在块 (例如 ί^, )排除在下一次循环的査找范围之外, 以保证不用再査找已经处理过的 边界。这样的技术手段例如是将点 的置信度设为 0 (具体可参见图 3的实施例)。  In the confidence processing module 12, it is necessary to exclude the block in which the boundary point has been processed (for example, ί^, ) from the search range of the next loop by a technical means to ensure that the boundary that has been processed is not found again. Such a technical means is, for example, to set the confidence level of the point to 0 (see the embodiment of Fig. 3 for details).
自动移除图像中选定影像的装置的第二实施例 图 5示出了本发明的自动移除图像中选定影像的装置的第二实施例的原理。请 参见图 5, 下面是对本实施例的装置的原理的详细描述。 A second embodiment of an apparatus for automatically removing selected images in an image Figure 5 illustrates the principles of a second embodiment of the apparatus for automatically removing selected images from an image of the present invention. Referring to Figure 5, the following is a detailed description of the principles of the apparatus of the present embodiment.
本实施例的自动移除图像中选定影像的装置包括以下的模块: 图像缩小模块 20、 边界设置模块 21、 边界点所在块设置模块 22、 置信度处理模块 23、 边界外扩 模块 24、替换处理模块 25以及赋值模块 26。这些模块之间的连接关系是: 图像缩 小模块 20耦接边界设置模块 21,边界设置模块 21耦接边界点所在块设置模块 22, 边界点所在块设置模块 22耦接置信度处理模块 23, 置信度处理模块 23耦接边界 外扩模块 24, 边界外扩模块 24耦接替换处理模块 25, 替换处理模块 25耦接赋值 模块 26, 赋值模块 26除了耦接替换处理模块 25外还耦接置信度处理模块 23。 在 图像缩小模块 20内设有插值处理单元 200,在替换处理模块 25内设有原始图映射 单元 250。  The apparatus for automatically removing selected images in the image of the embodiment includes the following modules: an image reduction module 20, a boundary setting module 21, a block setting module 22 where a boundary point is located, a confidence processing module 23, a boundary expansion module 24, and a replacement. The processing module 25 and the evaluation module 26 are provided. The connection relationship between the modules is: the image reduction module 20 is coupled to the boundary setting module 21, the boundary setting module 21 is coupled to the block setting module 22 where the boundary point is located, and the block setting module 22 where the boundary point is located is coupled to the confidence processing module 23, The degree processing module 23 is coupled to the boundary expansion module 24, the boundary expansion module 24 is coupled to the replacement processing module 25, and the replacement processing module 25 is coupled to the evaluation module 26. The evaluation module 26 is coupled to the replacement processing module 25 to couple the confidence. Processing module 23. An interpolation processing unit 200 is provided in the image reduction module 20, and an original map mapping unit 250 is provided in the replacement processing module 25.
图像缩小模块 20将原始图进行缩小,以使后续的处理对象是缩小后的原始图。 在图像缩小模块 20中, 可以预设一个尺寸范围 (n X n) , 如果原始图本身就 在这个尺寸范围内, 则不需要再进行缩放, 而以原始图代入后续的运算。  The image reduction module 20 reduces the original image so that the subsequent processing object is the reduced original image. In the image reduction module 20, a size range (n X n) can be preset. If the original image itself is within this size range, no further scaling is required, and the original image is substituted for subsequent operations.
如果原始图本身不在这个尺寸范围内, 则运行插值处理单元 200, 插值处理单 元 200采用插值算法, 将原始图缩放到 n X n的尺寸范围内, 并单独存储该缩小的 图像。 缩小尺寸的目的在于提高运算的速度, 保证査找相关匹配点及区域的时候, 造成的遍历次数大大减少。  If the original picture itself is not within this size range, the interpolation processing unit 200 is operated, and the interpolation processing unit 200 employs an interpolation algorithm to scale the original picture to the size range of n X n and separately store the reduced image. The purpose of downsizing is to increase the speed of the calculation, and to ensure that the number of traversals is greatly reduced when searching for related matching points and regions.
边界设置模块 21用于判断原始图在缩小处理后的待替换边界, 以遮盖选定影 像。 待替换边界可标记为统一的颜色, 遮盖住原始图上的背景色。 也就是说, 将待 替换边界标记为和背景色不同的颜色,这样与背景色颜色不同的边界就可被判定为 待替换边界。  The boundary setting module 21 is configured to judge the boundary to be replaced after the original image is reduced to cover the selected image. The border to be replaced can be marked as a uniform color, covering the background color on the original image. That is, the boundary to be replaced is marked as a color different from the background color, so that the boundary different from the background color can be judged as the boundary to be replaced.
边界点所在块设置模块 22用于设置以待替换边界上的点为中心的边界点所在 块。在待替换边界上的任意点的周围一定像素范围内, 设置以该点为中心的块, 用 来进行后续的对比和替换, 块的大小可任意设定。  The block setting module 22 in which the boundary point is located is used to set a block in which the boundary point centered on the point on the boundary to be replaced is located. In a certain pixel range around any point on the boundary to be replaced, a block centered on the point is set for subsequent comparison and replacement, and the size of the block can be arbitrarily set.
置信度处理模块 23中,在所有未处理过的边界点中找出块置信度最高的点;/, 此时点 / 对应的边界点所在块为 ί^ 。 块置信度的计算是传统的技术手段, 并且 在方法第二实施例的细化中有详细描述。  In the confidence processing module 23, the point with the highest confidence of the block is found among all the unprocessed boundary points; /, the block where the point/corresponding boundary point is located is ί^. The calculation of the block confidence is a conventional technical means and is described in detail in the refinement of the second embodiment of the method.
边界外扩模块 24将待替换边界进行外扩, 形成外扩后边界。 例如, 原来的待 替换边界是 (r X m) , 则外扩后边界是 (r + areas i ze ) X (m+areas i ze ) , 其中 areas i ze 是一个参数, 表示在待替换边界范围外扩大多少个像素, 将在这一范围 内査找可供替换的块影像。 The boundary outer expansion module 24 expands the boundary to be replaced to form an outer expanded boundary. For example, the original waiting The replacement boundary is (r X m), then the outer-expanded boundary is (r + areas i ze ) X (m+areas i ze ), where area i ze is a parameter indicating how many pixels are expanded outside the boundary to be replaced , will find the block image that can be replaced in this range.
需要注意的是, 在边界设置模块 21中设定的用于标记待替换边界范围内的唯 —像素 RGB值 (也就是颜色)与在外扩后边界范围内原图的各像素 RGB值全不相同。  It should be noted that the pixel-only RGB value (that is, the color) set in the boundary setting module 21 for marking the boundary to be replaced is completely different from the RGB value of each pixel in the original image in the extended boundary range.
替换处理模块 25中, 外扩后边界的范围内找出和当前置信度最高的点 所在 块^ 相较特征相似度最大的边界点所在块^,, ^,对应的边界点是 ^。  In the replacement processing module 25, the block where the point with the highest degree of confidence is located in the range of the expanded boundary is located, and the block where the feature similarity is the largest, ^, ^, the corresponding boundary point is ^.
在找到了点 和点 之后,由原始图映射单元 250根据原始图缩小比例找到原 始图中对应的两个点 p和 g以及这两个点对应的块 和^。 用^来替换 。  After the points and points are found, the original map mapping unit 250 finds the corresponding two points p and g in the original picture and the blocks and ^ corresponding to the two points according to the original picture reduction ratio. Replace with ^.
在本模块中,完成了点 ρ所在块的影像替换,但这时为防止替换时的像素损失, 需要进行后续模块的处理, 将保证替换得到的影像与周围的影像完全融合。  In this module, the image replacement of the block where the point ρ is located is completed. However, in order to prevent pixel loss during replacement, subsequent module processing is required to ensure that the replaced image is completely fused with the surrounding image.
赋值模块 26将点 q的 8邻接像素与点 p之间比较的特征相似度最大值赋给点 The assignment module 26 assigns the maximum value of the feature similarity between the 8 adjacent pixels of the point q and the point p to the point
P ° P °
在赋值模块 26处理之后, 跳转到置信度处理模块 23, 由置信度处理模块 23 在未处理过的边界点所在块中査找置信度最高的点,直至所有的待替换边界全部査 询完毕。  After processing by the assignment module 26, a jump to the confidence processing module 23 is performed by the confidence processing module 23 to find the point with the highest confidence in the block of the unprocessed boundary point until all the boundaries to be replaced are all queried.
在置信度处理模块 23中, 需要通过一种技术手段将已经处理的边界点所在块 (例如 排除在下一次循环的査找范围之外, 以保证不用再査找已经处理过的 边界。这样的技术手段例如是将点 p的块置信度设为 0(具体可参见图 3的实施例)。 上述实施例是提供给本领域普通技术人员来实现或使用本发明的,本领域普通 技术人员可在不脱离本发明的发明思想的情况下,对上述实施例做出种种修改或变 化, 因而本发明的保护范围并不被上述实施例所限,而应该是符合权利要求书提到 的创新性特征的最大范围。  In the confidence processing module 23, it is necessary to use a technical means to block the block where the boundary point has been processed (for example, to exclude the search range of the next cycle, so as to ensure that the boundary that has been processed is not found again. Such technical means, for example. The block confidence of the point p is set to 0 (see the embodiment of Fig. 3 for details). The above embodiments are provided to those of ordinary skill in the art to implement or use the present invention, and those skilled in the art can In the case of the inventive concept of the present invention, various modifications and changes are made to the above-described embodiments, and thus the scope of the present invention is not limited by the above embodiments, but should be the largest in accordance with the innovative features mentioned in the claims. Scope.

Claims

权 利 要 求 书 Claim
1、 一种自动移除图像中选定影像的方法, 包括: 1. A method for automatically removing selected images in an image, comprising:
设置原始图上的待替换边界, 以遮盖选定影像;  Set the boundary to be replaced on the original image to cover the selected image;
设置以待替换边界上的点为中心的边界点所在块;  Set the block where the boundary point centered on the point on the boundary to be replaced is located;
在所有的边界点中找出块置信度最高的点 / , 点 / 对应的边界点所在块是 Find the point with the highest confidence of the block in all the boundary points / , the block where the point / corresponding boundary point is located
ΨΡ' ·, Ψ Ρ ' ·,
将待替换边界进行外扩, 形成外扩后边界;  Extending the boundary to be replaced to form an outer expanded boundary;
在外扩后边界的范围内找出和点/ /的边界点所在块^ 相较特征相似度最大 的边界点所在块^,, ^,对应的边界点是 用 ^,来替换  Find the block where the boundary point of the point / / is located in the range of the outer boundary of the outer expansion. The block where the feature similarity is the largest is ^, ^, and the corresponding boundary point is replaced by ^.
将点 q'的 8邻接像素与点 p'之间比较的特征相似度最大值赋给点 p'; 返回査找置信度最高的点的步骤,在未处理过的边界点所在块中査找置信度最 高的点, 直到所有的待替换边界处理完毕。  The maximum value of the feature similarity between the 8 adjacent pixels of the point q' and the point p' is assigned to the point p'; the step of finding the point with the highest confidence is found, and the confidence is found in the block where the unprocessed boundary point is located. The highest point until all the boundaries to be replaced have been processed.
2、 根据权利要求 1所述的自动移除图像中选定影像的方法, 其特征在于, 在 设置原始图上的待替换边界之前还包括: 2. The method for automatically removing selected images in an image according to claim 1, wherein before the boundary to be replaced on the original image is set, the method further comprises:
将原始图进行缩小, 以使后续的处理对象是缩小后的原始图。  The original image is reduced so that the subsequent processing object is the reduced original image.
3、 根据权利要求 2所述的自动移除图像中选定影像的方法, 其特征在于, 通 过插值算法将原始图进行缩小。 3. A method of automatically removing selected images from an image according to claim 2, wherein the original image is reduced by an interpolation algorithm.
4、 根据权利要求 2所述的自动移除图像中选定影像的方法, 其特征在于, 在 找到点 p'和点 q'之后, 根据原始图缩小比例找到原始图中对应的两个点 p和 ^以及 这两个点 P和 g所对应的块 和^, 用^替换 ¾^, 并将点 g的 8邻接像素与 点 p之间比较的特征相似度最大值赋给点 p。 4. The method for automatically removing selected images in an image according to claim 2, wherein after finding the point p' and the point q', finding corresponding two points in the original image according to the original image reduction ratio And ^ and the blocks and ^ corresponding to the two points P and g, replace the 3⁄4^ with ^, and assign the maximum value of the feature similarity between the 8 adjacent pixels of the point g and the point p to the point p.
5、 根据权利要求 1所述的自动移除图像中选定影像的方法, 其特征在于, 在 设置原始图上的待替换边界的步骤中, 将待替换边界标记为和背景色不同的颜色, 以使与背景色颜色不同的边界成为待替换边界。 5. The method of automatically removing selected images in an image according to claim 1, wherein in the step of setting a boundary to be replaced on the original image, marking the boundary to be replaced as a color different from the background color, The boundary that is different from the background color is made to be the boundary to be replaced.
6、 一种自动移除图像中选定影像的装置, 包括: 6. A device for automatically removing selected images in an image, comprising:
边界设置模块, 设置原始图上的待替换边界, 以遮盖选定影像;  a boundary setting module, which sets a boundary to be replaced on the original image to cover the selected image;
边界点所在块设置模块,耦接边界设置模块,设置以待替换边界上的点为中心 的边界点所在块;  a block setting module in which the boundary point is located, coupled to the boundary setting module, and set a block in which the boundary point centered on the point on the boundary to be replaced is located;
置信度处理模块,耦接置信度处理模块,在所有的边界点中找出块置信度最高 的点 / , 点//对应的边界点所在块为^  The confidence processing module is coupled to the confidence processing module to find the point with the highest confidence of the block in all the boundary points, and the block corresponding to the boundary point of the point // is ^
边界外扩模块, 耦接置信度处理模块, 将待替换边界进行外扩, 形成外扩后边 界;  The boundary expansion module is coupled to the confidence processing module to expand the boundary to be replaced to form an outer boundary;
替换处理模块, 耦接该边界外扩模块, 在外扩后边界的范围内找出和点 //的 边界点所在块 ΨΡ'相较特征相似度最大的边界点所在块 Ψ , ¥q'对应的边界点是 q', 用边界点所在块 Ψ 替换边界点所在块 ΨΡ'; Alternatively the processing module, coupled to the outer boundary of the expansion module, the expansion of the outer boundary of the range to identify the boundary points and the point where the block // Ψ Ρ 'feature similarity compared to the maximum point where the block boundary Ψ, ¥ q' corresponding to The boundary point is q', and the block where the boundary point is located is replaced by the block 所在 where 边界Ρ ';
赋值模块,耦接替换处理模块和置信度处理模块,将点 ^ '的 8邻接像素与点 之间比较的特征相似度最大值赋给点 / , 返回置信度处理模块进行处理, 由置信 度处理模块在未处理过的边界点所在块中査找置信度最高的点,直到所有的待替换 边界处理完毕。  The assignment module is coupled to the replacement processing module and the confidence processing module, and assigns the maximum value of the feature similarity between the 8 adjacent pixels of the point to the point/, and returns to the confidence processing module for processing, and is processed by the confidence degree. The module looks for the point with the highest confidence in the block where the unprocessed boundary points are located until all the boundaries to be replaced are processed.
7、 根据权利要求 6所述的自动移除图像中选定影像的装置, 其特征在于, 该 装置还包括图像缩小模块,耦接在边界设置模块之前, 该图像缩小模块将原始图进 行缩小, 以使后续的处理对象是缩小后的原始图。 The device for automatically removing selected images in an image according to claim 6, wherein the device further comprises an image reduction module, which is coupled to the boundary setting module, and the image reduction module reduces the original image. So that the subsequent processing object is the reduced original image.
8、 根据权利要求 7所述的自动移除图像中选定影像的装置, 其特征在于, 在 图像缩小模块中设有一插值处理单元,通过插值处理单元中的插值算法的运行将原 始图进行缩小。 8. The apparatus for automatically removing selected images in an image according to claim 7, wherein an interpolation processing unit is provided in the image reduction module, and the original image is reduced by operation of an interpolation algorithm in the interpolation processing unit. .
9、 根据权利要求 7所述的自动移除图像中选定影像的装置, 其特征在于, 在 替换处理模块中还包括原始图映射单元,该替换处理模块在找到点/ /和点 之后启 动原始图映射单元,原始图映射单元根据原始图缩小比例找到原始图中对应的两个 点 ρ和 g以及这两个点 ρ和 g所对应的块 和^, 以使^替换 ¾^, 并在赋值 模块中将点 g的 8邻接像素与点 p之间比较的特征相似度最大值赋给点 p。 9. The apparatus for automatically removing selected images in an image according to claim 7, wherein the replacement processing module further includes an original map mapping unit that starts the original after finding the dot//and the point The map mapping unit, the original map mapping unit finds the corresponding two points ρ and g in the original image and the blocks and ^ corresponding to the two points ρ and g according to the original map reduction ratio, so that ^ is replaced by 3⁄4^, and is assigned In the module, the maximum value of the feature similarity between the 8 adjacent pixels of the point g and the point p is assigned to the point p.
10、根据权利要求 6所述的自动移除图像中选定影像的装置, 其特征在于, 在 边界设置模块中,将待替换边界标记为和背景色不同的颜色, 以使与背景色颜色不 同的边界成为待替换边界。 10. The apparatus for automatically removing selected images in an image according to claim 6, wherein in the boundary setting module, the boundary to be replaced is marked as a color different from the background color so as to be different from the background color. The boundary becomes the boundary to be replaced.
PCT/CN2011/071073 2010-12-08 2011-02-18 Method and device for removing selected image in picture automatically WO2012075729A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010577484.8 2010-12-08
CN2010105774848A CN102005060B (en) 2010-12-08 2010-12-08 Method and device for automatically removing selected images in pictures

Publications (1)

Publication Number Publication Date
WO2012075729A1 true WO2012075729A1 (en) 2012-06-14

Family

ID=43812398

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/071073 WO2012075729A1 (en) 2010-12-08 2011-02-18 Method and device for removing selected image in picture automatically

Country Status (2)

Country Link
CN (1) CN102005060B (en)
WO (1) WO2012075729A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10296646B2 (en) 2015-03-16 2019-05-21 International Business Machines Corporation Techniques for filtering content presented in a web browser using content analytics

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521786B (en) * 2011-12-01 2013-12-18 中国科学院自动化研究所 Method for removing watermarks of photos based on color detection and fast matching method
CN111524076B (en) * 2020-04-07 2023-07-21 咪咕文化科技有限公司 Image processing method, electronic device, and computer-readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030174773A1 (en) * 2001-12-20 2003-09-18 Dorin Comaniciu Real-time video object generation for smart cameras
CN101266685A (en) * 2007-03-14 2008-09-17 中国科学院自动化研究所 A method for removing unrelated images based on multiple photos
CN101326514A (en) * 2005-12-09 2008-12-17 微软公司 Background removal in a live video
CN101482968A (en) * 2008-01-07 2009-07-15 日电(中国)有限公司 Image processing method and equipment
CN102005036A (en) * 2010-12-08 2011-04-06 上海杰图软件技术有限公司 Method and device for automatically removing tripod afterimage in panoramic image

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100458846C (en) * 2005-07-14 2009-02-04 北京航空航天大学 A method of image restoration
US7834917B2 (en) * 2005-08-15 2010-11-16 Sony Corporation Imaging apparatus, noise reduction apparatus, noise reduction method, and noise reduction program
CN101355648A (en) * 2008-06-26 2009-01-28 天津市亚安科技电子有限公司 Method for reducing image noise and enhancing image
CN101360246B (en) * 2008-09-09 2010-06-02 西南交通大学 Video error masking method combined with 3D human face model
CN101571950B (en) * 2009-03-25 2011-10-12 湖南大学 Image restoring method based on isotropic diffusion and sparse representation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030174773A1 (en) * 2001-12-20 2003-09-18 Dorin Comaniciu Real-time video object generation for smart cameras
CN101326514A (en) * 2005-12-09 2008-12-17 微软公司 Background removal in a live video
CN101266685A (en) * 2007-03-14 2008-09-17 中国科学院自动化研究所 A method for removing unrelated images based on multiple photos
CN101482968A (en) * 2008-01-07 2009-07-15 日电(中国)有限公司 Image processing method and equipment
CN102005036A (en) * 2010-12-08 2011-04-06 上海杰图软件技术有限公司 Method and device for automatically removing tripod afterimage in panoramic image

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10296646B2 (en) 2015-03-16 2019-05-21 International Business Machines Corporation Techniques for filtering content presented in a web browser using content analytics
US10303729B2 (en) 2015-03-16 2019-05-28 International Business Machines Corporation Techniques for filtering content presented in a web browser using content analytics

Also Published As

Publication number Publication date
CN102005060B (en) 2012-11-14
CN102005060A (en) 2011-04-06

Similar Documents

Publication Publication Date Title
US8437567B2 (en) Image inpainting apparatus and method using restricted search region
WO2018032783A1 (en) Image processing method and apparatus
WO2016155382A1 (en) Mosaic image generation method and device
AU2016225778A1 (en) Dehazing photos and videos using visual artifact suppression
WO2015085636A1 (en) Super-resolution processing method for video
WO2012075729A1 (en) Method and device for removing selected image in picture automatically
WO2022147964A1 (en) Image distortion rendering method and apparatus
CN108133492B (en) Image matching method, device and system
CN110570367A (en) Fisheye image correction method, electronic device and storage medium
CN107909544A (en) A kind of method for correcting image and system
JP2006018465A5 (en)
WO2017215194A1 (en) Image processing method and device and storage medium thereof
CN110136092B (en) Image processing method, device and storage medium
CN102523387A (en) Method and device for realizing special flame effect in video
WO2021218467A1 (en) Identity photo manufacturing method, terminal, and storage medium
AU2018211310A1 (en) Local color range selection
CN104159035B (en) A kind of method and device of star orbital shooting effect Automatic Optimal
TWI339527B (en) Method and apparatus for enhancing image quality
CN102005036B (en) Method and device for automatically removing tripod afterimage in panoramic image
CN107395970A (en) A kind of photographic method and camera arrangement for intelligent terminal
KR101264358B1 (en) Method and System for Automated Photomosaic Image Generation
KR101146015B1 (en) Image processing method for backlight image judgment and image compensation on cell phone camera
WO2011015029A1 (en) Method and system for rapidly vectorizing image by gradient meshes based on parameterization
JP2004159171A (en) Image compressing method and apparatus thereof
CN115082324B (en) Video image local rotation processing method, system, terminal and medium

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

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 24-09-2013)

122 Ep: pct application non-entry in european phase

Ref document number: 11846536

Country of ref document: EP

Kind code of ref document: A1