CN109472763B - Image synthesis method and device - Google Patents

Image synthesis method and device Download PDF

Info

Publication number
CN109472763B
CN109472763B CN201710801070.0A CN201710801070A CN109472763B CN 109472763 B CN109472763 B CN 109472763B CN 201710801070 A CN201710801070 A CN 201710801070A CN 109472763 B CN109472763 B CN 109472763B
Authority
CN
China
Prior art keywords
effective
mixed
pixels
pixel
pixel set
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710801070.0A
Other languages
Chinese (zh)
Other versions
CN109472763A (en
Inventor
盛雪芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sanechips Technology Co Ltd
Original Assignee
Sanechips Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sanechips Technology Co Ltd filed Critical Sanechips Technology Co Ltd
Priority to CN201710801070.0A priority Critical patent/CN109472763B/en
Publication of CN109472763A publication Critical patent/CN109472763A/en
Application granted granted Critical
Publication of CN109472763B publication Critical patent/CN109472763B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

A method of image synthesis, comprising: respectively determining neighborhoods of pixels to be mixed in an image to be synthesized, and determining a neighborhood candidate pixel set from the neighborhoods; analyzing effective pixels in the neighborhood candidate pixel set, and determining the effective pixels and the pixels to be mixed as an effective pixel set; determining an effective coefficient matrix corresponding to a neighborhood pixel set of the pixels to be mixed according to effective identifications corresponding to elements in the effective pixel set; obtaining an effective mixed value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix; and synthesizing the images to be synthesized according to the effective mixing values of the pixels to be mixed of the images to be synthesized and a mixed mode algorithm. An apparatus for image synthesis. The scheme can realize mixing of special images, and is high in flexibility and wide in application.

Description

Image synthesis method and device
Technical Field
The invention relates to the technical field of image processing, in particular to an image synthesis method and device.
Background
The blend mode may combine images with colors between images to create a variety of effects. The mixed mode is widely applied in the technical field of image processing, for example, a drawing tool and an editing and adjusting tool can be applied to the mixed mode to perform aliasing on two or more images, so that the mixed mode is effectively and flexibly applied, and the images are dazzling and colorful.
With the deep development and application of image processing technology, an image synthesis-based method is a long-lasting research hotspot. Poisson blending as described in the related art may result in color change and blending edge non-smoothness due to excessive force on maintaining the gradient of the original image under certain conditions. The related technology is further expanded on the basis of Poisson mixing to solve the phenomena of color change and unsmooth mixed edge. However, the image blending just performs aliasing based on the rule followed by most images, and blending is performed for special images, which lacks flexibility and wide applicability.
Disclosure of Invention
The embodiment of the invention provides an image synthesis method and device, which are used for mixing special images.
A method of image synthesis, comprising:
respectively determining neighborhoods of pixels to be mixed in an image to be synthesized, and determining a neighborhood candidate pixel set from the neighborhoods;
analyzing effective pixels in the neighborhood candidate pixel set, and determining the effective pixels and the pixels to be mixed as an effective pixel set;
determining an effective coefficient matrix corresponding to a neighborhood pixel set of the pixels to be mixed according to effective identifications corresponding to elements in the effective pixel set;
obtaining an effective mixed value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix;
and synthesizing the images to be synthesized according to the effective mixing values of the pixels to be mixed of the images to be synthesized and a mixed mode algorithm.
Optionally, the neighborhood candidate pixel set includes all pixels except for the pixel to be mixed in the neighborhood of the pixel to be mixed, and the neighborhood pixel set includes all pixels in the neighborhood candidate pixel set and the pixel to be mixed.
Optionally, the analyzing the valid pixels in the neighborhood candidate pixel set includes:
analyzing whether each pixel in the neighborhood candidate pixel set is valid according to the coefficient matrix of the neighborhood pixel set;
and determining effective pixels in the neighborhood candidate pixel set according to threshold values of all channels of the three primary colors.
Optionally, the determining effective pixels in the neighborhood candidate pixel set according to the threshold of each channel of the three primary colors includes:
determining an effective interval of each channel value of the three primary colors according to each channel value of the three primary colors corresponding to the pixel to be mixed and each channel threshold value of the three primary colors;
and if the channel values of the three primary colors corresponding to the pixels in the neighborhood candidate pixel set are in the corresponding effective interval, determining the pixels as effective pixels.
Optionally, the obtaining an effective blending value of the pixel to be blended according to the effective pixel set and the effective coefficient matrix includes:
and carrying out weighted average according to all elements in the effective pixel set and the coefficients of the effective coefficient matrix corresponding to the elements to obtain an effective mixed value of the pixel to be mixed.
Optionally, the mixed mode algorithm is:
Pout=P″1×α+P″2x (255-a), wherein,
Poutis the result of the output after image blending, P ″)1Is an effective blending value, P ″, of the pixel to be blended of a first image to be synthesized2Alpha is a transparency coefficient, which is an effective blending value of the pixels to be blended of the second image to be synthesized.
An apparatus for image synthesis, comprising:
the first determining module is used for respectively determining neighborhoods of pixels to be mixed in the images to be synthesized and determining a neighborhood candidate pixel set from the neighborhoods;
the analysis module is used for analyzing effective pixels in the neighborhood candidate pixel set and determining the effective pixels and the pixels to be mixed as an effective pixel set;
a second determining module, configured to determine, according to the effective identifier corresponding to the element in the effective pixel set, an effective coefficient matrix corresponding to a neighborhood pixel set of the pixel to be mixed;
the obtaining module is used for obtaining an effective mixed value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix;
and the synthesis module is used for synthesizing the images to be synthesized according to the effective mixing values of the pixels to be mixed of the images to be synthesized and the mixed mode algorithm.
Optionally, the neighborhood candidate pixel set includes all pixels except for the pixel to be mixed in the neighborhood of the pixel to be mixed, and the neighborhood pixel set includes all pixels in the neighborhood candidate pixel set and the pixel to be mixed.
Optionally, the analyzing module analyzes the valid pixels in the neighborhood candidate pixel set, and includes: analyzing whether each pixel in the neighborhood candidate pixel set is valid according to the coefficient matrix of the neighborhood pixel set; and determining effective pixels in the neighborhood candidate pixel set according to threshold values of all channels of the three primary colors.
Optionally, the determining, by the analysis module, effective pixels in the neighborhood candidate pixel set according to threshold values of channels of three primary colors includes: determining an effective interval of each channel value of the three primary colors according to each channel value of the three primary colors corresponding to the pixel to be mixed and each channel threshold value of the three primary colors; and if the channel values of the three primary colors corresponding to the pixels in the neighborhood candidate pixel set are in the corresponding effective interval, determining the pixels as effective pixels.
Optionally, the obtaining module obtains the effective blending value of the pixel to be blended according to the effective pixel set and the effective coefficient matrix, and includes: and carrying out weighted average according to all elements in the effective pixel set and the coefficients of the effective coefficient matrix corresponding to the elements to obtain an effective mixed value of the pixel to be mixed.
Optionally, the synthesis module is configured to, according to a mixed-mode algorithm: pout=P″1×α+P″2X (255- α), wherein PoutIs the result of the output after image blending, P ″)1Is an effective blending value, P ″, of the pixel to be blended of a first image to be synthesized2Alpha is a transparency coefficient, which is an effective blending value of the pixels to be blended of the second image to be synthesized.
An apparatus for image synthesis, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the steps of:
respectively determining neighborhoods of pixels to be mixed in an image to be synthesized, and determining a neighborhood candidate pixel set from the neighborhoods;
analyzing effective pixels in the neighborhood candidate pixel set, and determining the effective pixels and the pixels to be mixed as an effective pixel set;
determining an effective coefficient matrix corresponding to a neighborhood pixel set of the pixels to be mixed according to effective identifications corresponding to elements in the effective pixel set;
obtaining an effective mixed value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix;
and synthesizing the images to be synthesized according to the effective mixing values of the pixels to be mixed of the images to be synthesized and a mixed mode algorithm.
In summary, embodiments of the present invention provide an image synthesis method and apparatus, which can mix special images, and have high flexibility and wide application.
Drawings
Fig. 1 is a flowchart of an image synthesis method according to a first embodiment of the present invention;
FIG. 2 is a diagram illustrating an image synthesis method according to a second embodiment of the present invention;
FIG. 3 is a diagram illustrating a determination of a neighborhood range according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an image synthesizing apparatus according to a second embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
Example one
Fig. 1 is a flowchart of an image synthesis method according to an embodiment of the present invention, and as shown in fig. 1, the method of this embodiment includes the following steps:
step 11, respectively determining neighborhoods of pixels to be mixed in the image to be synthesized, and determining a neighborhood candidate pixel set from the neighborhoods;
step 12, analyzing effective pixels in the neighborhood candidate pixel set, and determining the effective pixels and the pixels to be mixed as an effective pixel set;
step 13, determining an effective coefficient matrix corresponding to a neighborhood pixel set of the pixels to be mixed according to effective identifications corresponding to the elements in the effective pixel set;
step 14, obtaining an effective mixing value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix;
and step 15, synthesizing the images to be synthesized according to the effective mixing values of the pixels to be mixed of the images to be synthesized and the mixed mode algorithm.
The method of the embodiment overcomes the limitation of the prior art, mixes any sample image by using the pixel area, and can overcome the phenomena of color change and unsmooth edge. The threshold value can be customized or selected according to the pixel value, the neighborhood of the mixed pixel and the neighborhood coefficient matrix can be mixed, and the flexibility of the mixing rule can be improved.
Example two
The technical solution of the embodiment of the present invention is described in detail with a specific embodiment.
As shown in fig. 2, the method of the present embodiment includes the following steps:
step 101, determining a pixel neighborhood, and determining an N × M neighborhood of a pixel point P according to neighborhood range parameters h _ l, h _ r, v _ u and v _ d and a coordinate of the point P based on a coordinate (x, y) of a current mixed pixel point P.
And (3) setting the current mixed pixel point as P, setting the coordinate of the pixel point as (x, y), and confirming the N multiplied by M neighborhood range of the mixed pixel point P through 4 neighborhood range parameters of h _ l, h _ r, v _ u and v _ d.
Wherein h _ l represents the distance between the coordinate x of the pixel P and the left boundary of the neighborhood, h _ r represents the distance between the coordinate x of the pixel P and the right boundary of the neighborhood, v _ u represents the distance between the coordinate y of the pixel P and the upper boundary of the neighborhood, and v _ d represents the distance between the coordinate y of the pixel P and the lower boundary of the neighborhood, so that the horizontal domain of the mixed pixel P is [ x-h _ l, x + h _ r ], the vertical domain is [ y-v _ u, x + v _ d ], and the neighborhood is shown in fig. 3.
Step 102, determining a neighborhood candidate pixel set;
the neighborhood candidate pixel set is the non-P in the NxM neighborhood of the current mixed pixel point P as the candidate pixel set.
The pixel set S in the neighborhood of the point P can be determined from the coordinates (x, y) of the current mixed pixel point P and the neighborhood range parameters h _ l, h _ r, v _ u, and v _ d described in step 101As shown in table 1.
TABLE 1
Figure GDA0002680473370000061
The P neighborhood candidate pixel set of the point is a set of all non-P pixels in the P neighborhood of the mixed pixel point, and is recorded as U based on the neighborhood candidate pixel set。
Step 103, analyzing effective pixels;
set S of pixels from neighborhood of pixel point PCoefficient matrix DpCalculating a candidate set of pixels UWhether each pixel in the previous result is valid is further confirmed based on each channel threshold value, and then a candidate pixel set U is used for judging whether each pixel in the previous result is validThe middle effective pixel and the pixel point P form an effective pixel set of the P point。
Let each channel threshold of three primary colors be Rmin、Rmax、Gmin、Gmax、Bmin、BmaxMixed pixel P neighborhood set SCoefficient matrix is Dp。Rmin、Rmax、Gmin、Gmax、Bmin、Bmax、 DpThe parameter is a candidate pixel set U as a neighborhood of the point PWhether each pixel in (a) is a valid metric.
The effective pixel analysis can be divided into the following steps:
step 103.1, from the set of pixels SCoefficient matrix is DpComputing a set of candidate pixels UWhether each pixel in (1) is valid;
set of pixels SCoefficient matrix is DpAre known and will not be described here.
Assuming that the width of the neighborhood of point P is n and the height is m, it can be obtained from step 101:
n=h_l+h_r+1,
m=v_u+v_d+1,
there is a mixed pixel P neighborhood set SCorresponding coefficient matrix DpComprises the following steps:
Figure GDA0002680473370000071
f for installationUMatrix representation pixel set UWhether each pixel in (1) is valid, FUComprises the following steps:
Figure GDA0002680473370000072
at FUIn the matrix, the coordinate P of the current mixed pixel point is an effective flag corresponding to (x, y)i,jAnd (wherein i ═ x-h _ l +1, j ═ y-v _ u +1) is always 1. And candidate pixel set UMiddle pixel Pi,jThe corresponding valid flag is flagi,jWherein i is more than or equal to 1 and less than or equal to n, i is not equal to x-h _ l +1, j is more than or equal to 1 and less than or equal to m, and j is not equal to y-v _ u + 1. Based on candidate pixel set UMiddle pixel Pi,jCorresponding coefficient matrix is DpIn di,jWherein i is not less than 1 and not more than n and i is not equal to x-h _ l +1, j is not less than 1 and not more than m and j is not equal to y-v _ u +1, if di,j0, then the corresponding flagi,j=0。
Step 103.2, calculating candidate pixel set U based on each channel threshold valueWhether each pixel in (1) is valid;
let each channel value corresponding to the current mixing point P be rp、gp、bpCandidate set of pixels UMiddle pixel Pi,jCorresponding each channel value is ri,j、gi,j、bi,jWherein i is more than or equal to 1 and less than or equal to n, i is not equal to x-h _ l +1, j is more than or equal to 1 and less than or equal to m, and j is not equal to y-v _ u + 1. By calculating rp、gp、bpAnd a threshold value Rmin,Rmax,Gmin,Gmax,Bmin,BmaxRespectively obtaining the effective intervals of the r channel values
Figure GDA0002680473370000081
Valid interval of values of g-channel
Figure GDA0002680473370000082
Valid interval of b channel value
Figure GDA0002680473370000083
Valid interval of r channel values
Figure GDA0002680473370000084
Valid interval of values of g-channel
Figure GDA0002680473370000085
Valid interval of b channel value
Figure GDA0002680473370000086
Figure GDA0002680473370000087
Step 103.3, based on the valid intervals respectively corresponding to r, g and b
Figure GDA0002680473370000088
By judging candidate pixel set UMiddle pixel Pi,jCorresponding each channel value is ri,j、gi,j、bi,jWhether or not it falls within the valid interval
Figure GDA0002680473370000089
Figure GDA00026804733700000810
Further calculation of F in step 103.1UElement flag in matrixi,jWhether the value is 0. If Pi,jCorresponding flagi,jIs 1, then Pi,jAre valid candidates. And the current mixed pixel P is always the effective pixel, then P isi,jAnd the pixel point P forms an effective pixel set of the P point。
Step 104, determine blendingSet of pixels S in neighborhood of pixel PThe corresponding significant coefficient matrix D ″P
From the set of active pixels in step 103Effective identification corresponding to middle element determines pixel set SThe corresponding significant coefficient matrix D ″P. Confirmation of F from step 103.2UFlag in matrixi,jThe value (i is more than or equal to 1 and less than or equal to n, j is more than or equal to 1 and less than or equal to m) determines DpWhether each element is valid.
Let effective coefficient matrix DPComprises the following steps:
Figure GDA00026804733700000811
then there are:
Figure GDA00026804733700000812
wherein i is more than or equal to 1 and less than or equal to n, and j is more than or equal to 1 and less than or equal to m.
Step 105, determining an effective mixing value;
the effective blending value being a set of effective pixelsAnd carrying out weighted average on all the elements and the corresponding coefficients to obtain an effective mixed value of the mixed pixel point P.
Setting effective pixel setThe sum of the weights corresponding to the elements is count _ num, and the effective mixed value corresponding to the current mixed pixel P point is P', then:
Figure GDA0002680473370000091
step 106, image mixing is carried out, and P' of the foreground image (src) is passedsrcAnd P "of the background image (dst)dstAnd carrying out image aliasing by using the transparency coefficient alpha, wherein the formula is as follows:
Pout=P″src×α+P″dst×(255-α)
foreground image neighborhood parameter hsrcAnd vsrcIs a mixed pixel point PsrcNeighborhood zonesrcWidth and height ofPast current mixed pixel point PsrcCoordinate (x) ofsrc,ysrc) And neighborhood range parameter h _ lsrc、h_rsrc、v_usrcAnd v _ dsrcCalculating to obtain a mixed pixel point PsrcNeighborhood of (2)src. Then mix pixel point PsrcIn the horizontal direction of [ x ]src-h_lsrc,xsrc+h_rsrc]The vertical direction field is [ ysrc-v_usrc,ysrc+ v_dsrc]。
Background image neighborhood parameter hdstAnd vdstIs a mixed pixel point PdstNeighborhood zonedstBy the current mixed pixel point PdstCoordinate (x) ofdst,ydst) And neighborhood range parameter h _ ldst、h_rdst、v_udstAnd v _ ddstCalculating to obtain a mixed pixel point PdstNeighborhood of (2)dst. Then mix pixel point PdstIn the horizontal direction of [ x ]dst-h_ldst,xdst+h_rdst]The vertical direction field is [ ydst-v_udst,ydst+ v_ddst]。
Neighborhood of foreground imagessrcIs UsrcNeighborhood of background imagedstIs the set of candidate pixels in
Figure GDA0002680473370000092
Foreground image neighborhoodsrcSet of pixels SsrcIs recorded as a coefficient matrix of
Figure GDA0002680473370000094
The threshold value of each channel of the three primary colors is respectively
Figure GDA00026804733700000918
By
Figure GDA0002680473370000096
And determining candidate pixel set by three primary color each channel threshold value
Figure GDA0002680473370000097
Of the effective pixel, candidate pixel set UsrcEffective pixel and point PsrcEffective pixel set constituting foreground image
Figure GDA0002680473370000098
Thereby obtaining a pixel set
Figure GDA0002680473370000099
Corresponding significant coefficient matrix
Figure GDA00026804733700000919
Background image neighborhood candidate pixel set
Figure GDA00026804733700000910
Is recorded as a coefficient matrix of
Figure GDA00026804733700000911
The threshold value of each channel of the three primary colors is respectively
Figure GDA00026804733700000912
By
Figure GDA00026804733700000913
And determining candidate pixel set by three primary color each channel threshold value
Figure GDA00026804733700000914
Of the effective pixel, a candidate pixel set
Figure GDA00026804733700000915
Effective pixel and point PdstEffective pixel set constituting dst
Figure GDA00026804733700000916
Thereby obtaining a pixel set
Figure GDA00026804733700000917
Corresponding significant coefficient matrix
Figure GDA0002680473370000101
From the above-mentioned set of pixels SsrcCorresponding significant coefficient matrix
Figure GDA0002680473370000102
And a set of pixels
Figure GDA0002680473370000103
Corresponding significant coefficient matrix
Figure GDA0002680473370000104
An effective pixel set can be obtained
Figure GDA0002680473370000105
The sum of the corresponding weights of the elements is sumsrcAnd an effective pixel set
Figure GDA0002680473370000106
The sum of the corresponding weights of the elements is sumdst
There is a foreground image mixed pixel point PsrcThe corresponding effective mixing value is P ″)srcComprises the following steps:
Figure GDA0002680473370000107
background image mixed pixel point PdstThe corresponding effective mixing value is P ″)dstComprises the following steps:
Figure GDA0002680473370000108
p' through the foreground imagesrcAnd P' of background imagedstAnd coefficient alpha is used for carrying out image aliasing to obtain Pout
Pout=P″src×α+P″dst×(255-α)
Compared with the prior art, the method provided by the embodiment of the invention has the advantages that the threshold value is customized or the threshold value, the neighborhood of the mixed pixel and the neighborhood coefficient matrix are selected according to the pixel value, so that the flexibility and the wide applicability of image mixing are improved while the image edge is smooth, the color change phenomenon is avoided, and the texture of the image is kept.
Fig. 4 is a schematic diagram of an image synthesizing apparatus according to an embodiment of the present invention, and as shown in fig. 4, the apparatus of the embodiment includes:
the first determining module is used for respectively determining neighborhoods of pixels to be mixed in the images to be synthesized and determining a neighborhood candidate pixel set from the neighborhoods;
the analysis module is used for analyzing effective pixels in the neighborhood candidate pixel set and determining the effective pixels and the pixels to be mixed as an effective pixel set;
a second determining module, configured to determine, according to the effective identifier corresponding to the element in the effective pixel set, an effective coefficient matrix corresponding to a neighborhood pixel set of the pixel to be mixed;
the obtaining module is used for obtaining an effective mixed value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix;
and the synthesis module is used for synthesizing the images to be synthesized according to the effective mixing values of the pixels to be mixed of the images to be synthesized and the mixed mode algorithm.
The device of the embodiment overcomes the limitation of the prior art, utilizes the pixel area to mix any sample image, and can overcome the phenomena of color change and uneven edge. The threshold value can be customized or selected according to the pixel value, the neighborhood of the mixed pixel and the neighborhood coefficient matrix can be mixed, and the flexibility of the mixing rule can be improved.
In an embodiment, the neighborhood candidate set of pixels includes all pixels in the neighborhood of the pixel to be mixed except the pixel to be mixed, and the neighborhood set of pixels includes all pixels in the neighborhood candidate set of pixels and the pixel to be mixed.
In one embodiment, the analyzing module analyzes the valid pixels in the neighborhood candidate set, including: analyzing whether each pixel in the neighborhood candidate pixel set is valid according to the coefficient matrix of the neighborhood pixel set; and determining effective pixels in the neighborhood candidate pixel set according to threshold values of all channels of the three primary colors.
In an embodiment, the determining, by the analysis module, effective pixels in the neighborhood candidate pixel set according to threshold values of channels of three primary colors includes: determining an effective interval of each channel value of the three primary colors according to each channel value of the three primary colors corresponding to the pixel to be mixed and each channel threshold value of the three primary colors; and if the channel values of the three primary colors corresponding to the pixels in the neighborhood candidate pixel set are in the corresponding effective interval, determining the pixels as effective pixels.
In an embodiment, the obtaining module obtains the effective blending value of the pixel to be blended according to the effective pixel set and the effective coefficient matrix, and includes: and carrying out weighted average according to all elements in the effective pixel set and the coefficients of the effective coefficient matrix corresponding to the elements to obtain an effective mixed value of the pixel to be mixed.
In one embodiment, the synthesis module is based on a mixed-mode algorithm that:
Pout=P″1×α+P″2x (255-a), wherein,
Poutis the result of the output after image blending, P ″)1Is an effective blending value, P ″, of the pixel to be blended of a first image to be synthesized2Alpha is a transparency coefficient, which is an effective blending value of the pixels to be blended of the second image to be synthesized.
An embodiment of the present invention further provides an image synthesis apparatus, including: memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the steps of:
respectively determining neighborhoods of pixels to be mixed in an image to be synthesized, and determining a neighborhood candidate pixel set from the neighborhoods;
analyzing effective pixels in the neighborhood candidate pixel set, and determining the effective pixels and the pixels to be mixed as an effective pixel set;
determining an effective coefficient matrix corresponding to a neighborhood pixel set of the pixels to be mixed according to effective identifications corresponding to elements in the effective pixel set;
obtaining an effective mixed value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix;
and synthesizing the images to be synthesized according to the effective mixing values of the pixels to be mixed of the images to be synthesized and a mixed mode algorithm.
Embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions, which when executed implement the method for image synthesis.
It will be understood by those skilled in the art that all or part of the steps of the above methods may be implemented by instructing the relevant hardware through a program, and the program may be stored in a computer readable storage medium, such as a read-only memory, a magnetic or optical disk, and the like. Alternatively, all or part of the steps of the above embodiments may be implemented using one or more integrated circuits. Accordingly, each module/unit in the above embodiments may be implemented in the form of hardware, and may also be implemented in the form of a software functional module. The present invention is not limited to any specific form of combination of hardware and software.
The foregoing is only a preferred embodiment of the present invention, and naturally there are many other embodiments of the present invention, and those skilled in the art can make various corresponding changes and modifications according to the present invention without departing from the spirit and the essence of the present invention, and these corresponding changes and modifications should fall within the scope of the appended claims.

Claims (9)

1. A method of image synthesis, comprising:
respectively determining neighborhoods of pixels to be mixed in an image to be synthesized, and determining a neighborhood candidate pixel set from the neighborhoods;
analyzing effective pixels in the neighborhood candidate pixel set, and determining the effective pixels and the pixels to be mixed as an effective pixel set;
determining an effective coefficient matrix corresponding to a neighborhood pixel set of the pixels to be mixed according to effective identifications corresponding to elements in the effective pixel set;
obtaining an effective mixed value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix;
synthesizing the images to be synthesized according to the effective mixed values of the pixels to be mixed of the images to be synthesized and a mixed mode algorithm;
wherein said analyzing the active pixels in the neighborhood candidate set comprises:
analyzing whether each pixel in the neighborhood candidate pixel set is valid according to the coefficient matrix of the neighborhood pixel set;
determining an effective interval of each channel value of the three primary colors according to each channel value of the three primary colors corresponding to the pixel to be mixed and each channel threshold value of the three primary colors;
and if the channel values of the three primary colors corresponding to the pixels in the neighborhood candidate pixel set are in the corresponding effective interval, determining the pixels as effective pixels.
2. The method of claim 1, wherein:
the neighborhood candidate pixel set comprises all pixels except the pixel to be mixed in the neighborhood of the pixel to be mixed, and the neighborhood pixel set comprises all pixels in the neighborhood candidate pixel set and the pixel to be mixed.
3. The method of claim 1, wherein: the obtaining the effective mixing value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix comprises:
and carrying out weighted average according to all elements in the effective pixel set and the coefficients of the effective coefficient matrix corresponding to the elements to obtain an effective mixed value of the pixel to be mixed.
4. The method of claim 1, wherein: the mixed mode algorithm is as follows:
Pout=P″1×α+P″2x (255-a), wherein,
Poutis the result of the output after image blending, P ″)1Is an effective blending value, P ″, of the pixel to be blended of a first image to be synthesized2Alpha is a transparency coefficient, which is an effective blending value of the pixels to be blended of the second image to be synthesized.
5. An apparatus for image synthesis, comprising:
the first determining module is used for respectively determining neighborhoods of pixels to be mixed in the images to be synthesized and determining a neighborhood candidate pixel set from the neighborhoods;
the analysis module is used for analyzing effective pixels in the neighborhood candidate pixel set and determining the effective pixels and the pixels to be mixed as an effective pixel set;
a second determining module, configured to determine, according to the effective identifier corresponding to the element in the effective pixel set, an effective coefficient matrix corresponding to a neighborhood pixel set of the pixel to be mixed;
the obtaining module is used for obtaining an effective mixed value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix;
the synthesis module is used for synthesizing the images to be synthesized according to the effective mixed values of the pixels to be mixed of the images to be synthesized and a mixed mode algorithm;
the analysis module analyzes the valid pixels in the neighborhood candidate set of pixels, including: analyzing whether each pixel in the neighborhood candidate pixel set is valid according to the coefficient matrix of the neighborhood pixel set; determining an effective interval of each channel value of the three primary colors according to each channel value of the three primary colors corresponding to the pixel to be mixed and each channel threshold value of the three primary colors; and if the channel values of the three primary colors corresponding to the pixels in the neighborhood candidate pixel set are in the corresponding effective interval, determining the pixels as effective pixels.
6. The apparatus of claim 5, wherein:
the neighborhood candidate pixel set comprises all pixels except the pixel to be mixed in the neighborhood of the pixel to be mixed, and the neighborhood pixel set comprises all pixels in the neighborhood candidate pixel set and the pixel to be mixed.
7. The apparatus of claim 5, wherein:
the obtaining module obtains the effective mixing value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix, and includes: and carrying out weighted average according to all elements in the effective pixel set and the coefficients of the effective coefficient matrix corresponding to the elements to obtain an effective mixed value of the pixel to be mixed.
8. The apparatus of any one of claims 5-7, wherein:
the synthesis module is based on a mixed mode algorithm as follows: pout=P″1×α+P″2X (255- α), wherein PoutIs the result of the output after image blending, P ″)1Is an effective blending value, P ″, of the pixel to be blended of a first image to be synthesized2Alpha is a transparency coefficient, which is an effective blending value of the pixels to be blended of the second image to be synthesized.
9. An apparatus for image synthesis, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the steps of:
respectively determining neighborhoods of pixels to be mixed in an image to be synthesized, and determining a neighborhood candidate pixel set from the neighborhoods;
analyzing effective pixels in the neighborhood candidate pixel set, and determining the effective pixels and the pixels to be mixed as an effective pixel set;
determining an effective coefficient matrix corresponding to a neighborhood pixel set of the pixels to be mixed according to effective identifications corresponding to elements in the effective pixel set;
obtaining an effective mixed value of the pixel to be mixed according to the effective pixel set and the effective coefficient matrix;
synthesizing the images to be synthesized according to the effective mixed values of the pixels to be mixed of the images to be synthesized and a mixed mode algorithm;
wherein said analyzing the active pixels in the neighborhood candidate set comprises:
analyzing whether each pixel in the neighborhood candidate pixel set is valid according to the coefficient matrix of the neighborhood pixel set;
determining an effective interval of each channel value of the three primary colors according to each channel value of the three primary colors corresponding to the pixel to be mixed and each channel threshold value of the three primary colors;
and if the channel values of the three primary colors corresponding to the pixels in the neighborhood candidate pixel set are in the corresponding effective interval, determining the pixels as effective pixels.
CN201710801070.0A 2017-09-07 2017-09-07 Image synthesis method and device Active CN109472763B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710801070.0A CN109472763B (en) 2017-09-07 2017-09-07 Image synthesis method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710801070.0A CN109472763B (en) 2017-09-07 2017-09-07 Image synthesis method and device

Publications (2)

Publication Number Publication Date
CN109472763A CN109472763A (en) 2019-03-15
CN109472763B true CN109472763B (en) 2020-12-08

Family

ID=65657592

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710801070.0A Active CN109472763B (en) 2017-09-07 2017-09-07 Image synthesis method and device

Country Status (1)

Country Link
CN (1) CN109472763B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5630037A (en) * 1994-05-18 1997-05-13 Schindler Imaging, Inc. Method and apparatus for extracting and treating digital images for seamless compositing
CN1217126A (en) * 1996-04-30 1999-05-19 Cfb(新图象设计中心)有限公司 Device and process for producing composite picture
CN1510656A (en) * 2002-11-27 2004-07-07 松下电器产业株式会社 Displaying device, method and programm
CN105578094A (en) * 2015-12-18 2016-05-11 深圳市帅映科技有限公司 Image edge fusion processing system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5630037A (en) * 1994-05-18 1997-05-13 Schindler Imaging, Inc. Method and apparatus for extracting and treating digital images for seamless compositing
CN1217126A (en) * 1996-04-30 1999-05-19 Cfb(新图象设计中心)有限公司 Device and process for producing composite picture
CN1510656A (en) * 2002-11-27 2004-07-07 松下电器产业株式会社 Displaying device, method and programm
CN105578094A (en) * 2015-12-18 2016-05-11 深圳市帅映科技有限公司 Image edge fusion processing system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Multiscaled Texture Synthesis Using Multisized Pixel Neighborhoods;Feng Dong等;《 IEEE Computer Graphics and Applications》;20070507;第27卷(第3期);41-47 *
高效图像合成技术研究;吴昊;《中国博士学位论文全文数据库信息科技辑》;20140515(第5期);I138-38 *

Also Published As

Publication number Publication date
CN109472763A (en) 2019-03-15

Similar Documents

Publication Publication Date Title
WO2020038124A1 (en) Image contrast enhancement method and apparatus, and device and storage medium
TWI467516B (en) Method for color feature extraction
JP5567063B2 (en) Method for processing highlight and saturation regions in digital images
US20150022518A1 (en) Image process device, image process method, and image process program
US20150077639A1 (en) Color video processing system and method, and corresponding computer program
MX2008001154A (en) Image blending.
CN102722872B (en) Method for eliminating local highlight blooming of digital image
US9292732B2 (en) Image processing apparatus, image processing method and computer program product
JP2010066803A (en) Image processing apparatus and method, and program
CN107871303A (en) A kind of image processing method and device
WO2012121412A1 (en) Methods of image upscaling based upon directional interpolation
US20130121565A1 (en) Method and Apparatus for Local Region Selection
CN103942756B (en) A kind of method of depth map post processing and filtering
CN105763768A (en) Image processing method, device and system
CN110111342B (en) Optimized selection method and device for matting algorithm
CN106875328B (en) Image processing method and device
JP2004523839A (en) Dynamic chain-based thresholding
CN109472763B (en) Image synthesis method and device
Maslennikova et al. Interactive local color transfer between images
KR20100122381A (en) Apparatus and method for painterly rendering
JP2009050035A (en) Image processing method, image processing system, and image processing program
CN110035267B (en) Image enhancement circuit and method
CN107886550B (en) Image editing propagation method and system
JP6126054B2 (en) Image signal processing method and image signal processing apparatus
JP2013178749A (en) Image processing device, image processing method, and image processing program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant