CN108305212A - Image mixing method, storage medium, electronic equipment and system - Google Patents
Image mixing method, storage medium, electronic equipment and system Download PDFInfo
- Publication number
- CN108305212A CN108305212A CN201810017906.2A CN201810017906A CN108305212A CN 108305212 A CN108305212 A CN 108305212A CN 201810017906 A CN201810017906 A CN 201810017906A CN 108305212 A CN108305212 A CN 108305212A
- Authority
- CN
- China
- Prior art keywords
- image
- background image
- pixel
- center
- foreground
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 23
- 238000004590 computer program Methods 0.000 claims description 10
- 238000004364 calculation method Methods 0.000 claims description 4
- 239000000203 mixture Substances 0.000 description 4
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003190 augmentative effect Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/04—Context-preserving transformations, e.g. by using an importance map
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a kind of image mixing method, storage medium, electronic equipment and systems, are related to image processing field, and this method includes:Mixed pantograph ratio is obtained, the pantograph ratio includes width pantograph ratio α and height pantograph ratio β;Determine the center point coordinate Center (x, y) of Mixed Zone on background image;Determine in background image mixing in need pixel;Determine the corresponding pixel point coordinates of Mixed Zone pixel D (x, y) in all in foreground image and background image;It will be mixed between corresponding pixel in foreground image and background image, complete the mixing of foreground image and background image.The present invention realizes the mixing of foreground image any position arbitrary proportion on background image.
Description
Technical field
The present invention relates to image processing fields, and in particular to a kind of image mixing method, storage medium, electronic equipment and is
System.
Background technology
Image blend is by two images, and one of which is foreground, and another is background, and the two is added to same figure
The technology of picture.
Current common image blend scheme is to be thoroughly mixed two images, i.e., sets the blend range of foreground image
Blend range for whole image, background image is also set to whole image, and this scheme is realized fairly simple, it is only necessary to by foreground
Weighted sum just can be realized according to a certain percentage for image and background image.But this simple hybrid plan, which can not meet, to be regarded
The demand of frequency business, such as need to need to increase AR in some fixed position product placement picture or video in video
(augmented reality special efficacy) paster etc..
Invention content
In view of the deficiencies in the prior art, the purpose of the present invention is to provide a kind of image mixing methods, before realization
The mixing of scape image any position arbitrary proportion on background image.
To achieve the above objectives, the technical solution adopted by the present invention is that, including:
Mixed pantograph ratio is obtained, the pantograph ratio includes width pantograph ratio α and height pantograph ratio β;
Determine the center point coordinate Center (x, y) of Mixed Zone on background image;
Determine in background image mixing in need pixel, need mixed pixel in the background image
Coordinate D (x, y) meets:
(Center.x- α * 0.5) < D.x≤(Center.x+ α * 0.5)
(Center.y- β * 0.5) < D.y≤(Center.y+ β * 0.5);
Determine the corresponding pixel point coordinates of Mixed Zone pixel D (x, y) in all in foreground image and background image,
Meet with the coordinate E (x, y) of the corresponding pixels of pixel D (x, y) in the foreground image:
E.x=(D.x-Center.x+ α * 0.5)/α
E.y=(D.y-Center.y+ β * 0.5)/β;
It will be mixed between corresponding pixel in foreground image and background image, complete the mixed of foreground image and background image
It closes.
Based on the above technical solution, when some fixed area being superimposed upon foreground image in background image,
The width pantograph ratio α=w3/w1, height pantograph ratio β=h3/h1, wherein w2 are the width of foreground image, and h2 is foreground image
Height, w3 be background image in fixed area width, h3 be background image in fixed area height.
Based on the above technical solution, when some that the original size of foreground image is superimposed upon in background image is consolidated
When positioning is set, the width pantograph ratio α=w2/w1, height pantograph ratio β=h2/h1, wherein w1 is the width of background image, h1
For the height of background image.
Based on the above technical solution, for certain point in Mixed Zone image after foreground image and background image mixing
The pixel value H of pixel, calculation formula are:
H=(1.0- θ) * F+ θ * G
Wherein, θ is mixed coefficint, and value range is [0.0,1.0], and F is to correspond to this pixel pixel in background image
Pixel value, G are the pixel value that this pixel pixel is corresponded in foreground image.
Based on the above technical solution,
When the value of θ is 1.0, the figure in the region whole display foreground image of foreground image and background image mixing
Picture;
When the value of θ is 0, the region of foreground image and background image mixing all shows the image in background image.
The present invention also provides a kind of storage medium, computer program, the computer program are stored on the storage medium
Method described above is realized when being executed by processor.
The present invention also provides a kind of electronic equipment, including memory and processor, stored on a processor on memory
The computer program of operation, the processor realize method described above when executing the computer program.
The present invention also provides a kind of vision mixing systems, including:
Acquisition module is used to obtain mixed pantograph ratio, and the pantograph ratio includes width pantograph ratio α and height pantograph ratio
β;
Execution module is used for:
Determine the center point coordinate Center (x, y) of Mixed Zone on background image;
Determine in background image mixing in need pixel, need mixed pixel in the background image
Coordinate D (x, y) meets:
(Center.x- α * 0.5) < D.x≤(Center.x+ α * 0.5)
(Center.y- β * 0.5) < D.y≤(Center.y+ β * 0.5);
Determine the corresponding pixel point coordinates of Mixed Zone pixel D (x, y) in all in foreground image and background image,
Meet with the coordinate E (x, y) of the corresponding pixels of pixel D (x, y) in the foreground image:
E.x=(D.x-Center.x+ α * 0.5)/α
E.y=(D.y-Center.y+ β * 0.5)/β;
Mixing module is used to mix between corresponding pixel in foreground image and background image, completes foreground image
With the mixing of background image.
Based on the above technical solution, when some fixed area being superimposed upon foreground image in background image,
The width pantograph ratio α=w3/w1, height pantograph ratio β=h3/h1, wherein w2 are the width of foreground image, and h2 is foreground image
Height, w3 be background image in fixed area width, h3 be background image in fixed area height.
Based on the above technical solution, when some that the original size of foreground image is superimposed upon in background image is consolidated
When positioning is set, the width pantograph ratio α=w2/w1, height pantograph ratio β=h2/h1, wherein w1 is the width of background image, h1
For the height of background image.
Compared with the prior art, the advantages of the present invention are as follows:According to pantograph ratio, by determining Mixed Zone on background image
Center point coordinate, in background image all in the pixel and foreground image of mixing in need mixed with background image
The corresponding pixel point coordinates of area pixel point realizes that foreground image any position on background image can carry out in any proportion
Mixing, and mixing is mixed based on the corresponding relationship of pixel, thus it can be as needed at some in practical application
Some fixed position of image is implanted into specific image.
Description of the drawings
Fig. 1 is a kind of flow chart of image mixing method in the embodiment of the present invention;
Fig. 2 is the structural schematic diagram of a kind of electronic equipment in the embodiment of the present invention.
Specific implementation mode
Invention is further described in detail with reference to the accompanying drawings and embodiments.
Shown in Figure 1, the embodiment of the present invention provides a kind of image mixing method, for foreground image to be mixed into background
In image, to form the Mixed Zone for covering entire background image or covering part background image, i.e., by foreground image according to
It is integrally positioned over after proportional zoom on background image and carries out being mixed to form Mixed Zone, Mixed Zone can be fallen on background image.
It specifically includes:
S1:Mixed pantograph ratio is obtained, pantograph ratio includes width pantograph ratio α and height pantograph ratio β;
When some fixed area being superimposed upon foreground image in background image, width pantograph ratio α=w3/w1, height
Pantograph ratio β=h3/h1, wherein w2 are the width of foreground image, and h2 is the height of foreground image, and w3 is fixed area in background image
Field width degree, h3 are the height of fixed area in background image.It is superimposed upon in background image when by the original size of foreground image
When some fixed position, width pantograph ratio α=w2/w1, height pantograph ratio β=h2/h1, wherein w1 is the width of background image,
H1 is the height of background image.
S2:The center point coordinate Center (x, y) of Mixed Zone on background image is determined, as true in background image
The center point coordinate of the fixed fixed area by foreground image superposition;
S3:Determine in background image mixing in need pixel, the seat of mixed pixel is needed in background image
D (x, y) is marked to meet:
(Center.x- α * 0.5) < D.x≤(Center.x+ α * 0.5)
(Center.y- β * 0.5) < D.y≤(Center.y+ β * 0.5);
In the embodiment of the present invention, statement of the axis value in formula for coordinate points, such as Center.x denotation coordinations
The size of the X-axis value of Center (x, y), the size of the y-axis value of Center.y denotation coordination Center (x, y), hereinafter with regard to D
The statement meaning of (x, y) is similar.
S4:Determine that the corresponding pixels of Mixed Zone pixel D (x, y) are sat in all in foreground image and background image
Mark, i.e., will form after mixed image that pixel corresponding on background image is found out in foreground image, form mixed image
Pixel in background image is the pixel of Mixed Zone on background image, opposite with pixel D (x, y) in foreground image
The coordinate E (x, y) for the pixel answered meets:
E.x=(D.x-Center.x+ α * 0.5)/α
E.y=(D.y-Center.y+ β * 0.5)/β;
S5:It will be mixed between corresponding pixel in foreground image and background image, complete foreground image and background image
Mixing.
For the pixel value H of certain point pixel in Mixed Zone image after foreground image and background image mixing, calculation formula
For:
H=(1.0- θ) * F+ θ * G
Wherein, θ is mixed coefficint, and value range is [0.0,1.0], and F is to correspond to this pixel pixel in background image
Pixel value, G are the pixel value that this pixel pixel is corresponded in foreground image.
When the value of θ is 1.0, the figure in the region whole display foreground image of foreground image and background image mixing
Picture;When the value of θ is 0, the region of foreground image and background image mixing all shows the image in background image.
The image mixing method of the embodiment of the present invention, according to pantograph ratio, by determining on background image in Mixed Zone
In heart point coordinates, background image it is all with Mixed Zone in background image in the pixel and foreground image of mixing in need
The corresponding pixel point coordinates of pixel realizes that foreground image any position on background image can be mixed in any proportion
It closes, and mixing is mixed based on the corresponding relationship of pixel, thus it can be as needed in some figure in practical application
Some fixed position of picture is implanted into specific image, meets some fixed position product placement picture or video in video
The middle demand for needing to increase AR pasters.
In addition, corresponding above-mentioned image mixing method is stored with meter the present invention also provides a kind of storage medium on storage medium
Calculation machine program, when computer program is executed by processor realize the various embodiments described above described in image mixing method the step of.It needs
It is noted that the storage medium includes USB flash disk, mobile hard disk, ROM (Read-Only Memory, read-only memory), RAM
Various Jie that can store program code such as (Random Access Memory, random access memory), magnetic disc or CD
Matter.
Shown in Figure 2, corresponding above-mentioned image mixing method, the present invention also provides a kind of thing electronic equipments, including storage
Device and processor, the computer program run on a processor is stored on memory, and processor executes real when computer program
The image mixing method of existing the various embodiments described above.
The present invention also provides a kind of vision mixing systems based on above-mentioned image mixing method, including acquisition module, execution
Module and mixing module.
For acquisition module for obtaining mixed pantograph ratio, the pantograph ratio includes width pantograph ratio α and height pantograph ratio β;
Execution module is used for:
Determine the center point coordinate Center (x, y) of Mixed Zone on background image;
Determine in background image mixing in need pixel, need mixed pixel in the background image
Coordinate D (x, y) meets:
(Center.x- α * 0.5) < D.x≤(Center.x+ α * 0.5)
(Center.y- β * 0.5) < D.y≤(Center.y+ β * 0.5);
Determine the corresponding pixel point coordinates of Mixed Zone pixel D (x, y) in all in foreground image and background image,
Meet with the coordinate E (x, y) of the corresponding pixels of pixel D (x, y) in the foreground image:
E.x=(D.x-Center.x+ α * 0.5)/α
E.y=(D.y-Center.y+ β * 0.5)/β;
Mixing module completes foreground image and the back of the body for will be mixed between corresponding pixel in foreground image and background image
The mixing of scape image.
When some fixed area being superimposed upon foreground image in background image, the width pantograph ratio α=w3/w1,
Height pantograph ratio β=h3/h1, wherein w2 are the width of foreground image, and h2 is the height of foreground image, and w3 is solid in background image
Determine peak width, h3 is the height of fixed area in background image.When the original size of foreground image is superimposed upon background image
In some fixed position when, the width pantograph ratio α=w2/w1, height pantograph ratio β=h2/h1, wherein w1 is Background
The width of picture, h1 are the height of background image.
The vision mixing system of the embodiment of the present invention, acquisition module obtain pantograph ratio, Background are determined by execution module
As in the center point coordinate of upper Mixed Zone, background image mixing in need pixel and foreground image in it is all with the back of the body
Pixel corresponding pixel point coordinates in Mixed Zone in scape image realizes that foreground image any position on background image can press
Arbitrary proportion is mixed, and mixing is mixed based on the corresponding relationship of pixel.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from
Under the premise of the principle of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as the protection of the present invention
Within the scope of.The content not being described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.
Claims (10)
1. a kind of image mixing method, for foreground image to be mixed into background image, which is characterized in that including:
Mixed pantograph ratio is obtained, the pantograph ratio includes width pantograph ratio α and height pantograph ratio β;
Determine the center point coordinate Center (x, y) of Mixed Zone on background image;
Determine in background image mixing in need pixel, the coordinate of mixed pixel is needed in the background image
D (x, y) meets:
(Center.x- α * 0.5) < D.x≤(Center.x+ α * 0.5)
(Center.y- β * 0.5) < D.y≤(Center.y+ β * 0.5);
Determine the corresponding pixel point coordinates of Mixed Zone pixel D (x, y) in all in foreground image and background image, it is described
Meet with the coordinate E (x, y) of the corresponding pixels of pixel D (x, y) in foreground image:
E.x=(D.x-Center.x+ α * 0.5)/α
E.y=(D.y-Center.y+ β * 0.5)/β;
It will be mixed between corresponding pixel in foreground image and background image, complete the mixing of foreground image and background image.
2. a kind of image mixing method as described in claim 1, it is characterised in that:When foreground image is superimposed upon background image
In some fixed area when, the width pantograph ratio α=w3/w1, height pantograph ratio β=h3/h1, wherein w2 are foreground image
Width, h2 is the height of foreground image, and w3 is fixed area width in background image, and h3 is fixed area in background image
Highly.
3. a kind of image mixing method as claimed in claim 2, it is characterised in that:It is superimposed when by the original size of foreground image
When some fixed position in background image, the width pantograph ratio α=w2/w1, height pantograph ratio β=h2/h1, wherein
W1 is the width of background image, and h1 is the height of background image.
4. a kind of image mixing method as described in claim 1, it is characterised in that:Foreground image and background image are mixed
Certain in the image of Mixed Zone puts the pixel value H of pixel afterwards, and calculation formula is:
H=(1.0- θ) * F+ θ * G
Wherein, θ is mixed coefficint, and value range is [0.0,1.0], and F is the pixel that this pixel pixel is corresponded in background image
Value, G are the pixel value that this pixel pixel is corresponded in foreground image.
5. a kind of image mixing method as claimed in claim 4, it is characterised in that:
When the value of θ is 1.0, the image in the region whole display foreground image of foreground image and background image mixing;
When the value of θ is 0, the region of foreground image and background image mixing all shows the image in background image.
6. a kind of storage medium, computer program is stored on the storage medium, it is characterised in that:The computer program is located
Reason device realizes method described in any one of claim 1 to 5 when executing.
7. a kind of electronic equipment, including memory and processor, the computer journey run on a processor is stored on memory
Sequence, it is characterised in that:The processor realizes method described in any one of claim 1 to 5 when executing the computer program.
8. a kind of vision mixing system, which is characterized in that including:
Acquisition module is used to obtain mixed pantograph ratio, and the pantograph ratio includes width pantograph ratio α and height pantograph ratio β;
Execution module is used for:
Determine the center point coordinate Center (x, y) of Mixed Zone on background image;
Determine in background image mixing in need pixel, the coordinate of mixed pixel is needed in the background image
D (x, y) meets:
(Center.x- α * 0.5) < D.x≤(Center.x+ α * 0.5)
(Center.y- β * 0.5) < D.y≤(Center.y+ β * 0.5);
Determine the corresponding pixel point coordinates of Mixed Zone pixel D (x, y) in all in foreground image and background image, it is described
Meet with the coordinate E (x, y) of the corresponding pixels of pixel D (x, y) in foreground image:
E.x=(D.x-Center.x+ α * 0.5)/α
E.y=(D.y-Center.y+ β * 0.5)/β;
Mixing module is used to mix between corresponding pixel in foreground image and background image, completes foreground image and the back of the body
The mixing of scape image.
9. a kind of vision mixing system as claimed in claim 8, it is characterised in that:When foreground image is superimposed upon background image
In some fixed area when, the width pantograph ratio α=w3/w1, height pantograph ratio β=h3/h1, wherein w2 are foreground image
Width, h2 is the height of foreground image, and w3 is fixed area width in background image, and h3 is fixed area in background image
Highly.
10. a kind of vision mixing system as claimed in claim 9, it is characterised in that:It is folded when by the original size of foreground image
When some fixed position being added in background image, the width pantograph ratio α=w2/w1, height pantograph ratio β=h2/h1,
In, w1 is the width of background image, and h1 is the height of background image.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810017906.2A CN108305212A (en) | 2018-01-09 | 2018-01-09 | Image mixing method, storage medium, electronic equipment and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810017906.2A CN108305212A (en) | 2018-01-09 | 2018-01-09 | Image mixing method, storage medium, electronic equipment and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108305212A true CN108305212A (en) | 2018-07-20 |
Family
ID=62868782
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810017906.2A Pending CN108305212A (en) | 2018-01-09 | 2018-01-09 | Image mixing method, storage medium, electronic equipment and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108305212A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113989123A (en) * | 2021-12-23 | 2022-01-28 | 广州市新文溯科技有限公司 | Electronic seal stamping method and system, electronic equipment and readable medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107038680A (en) * | 2017-03-14 | 2017-08-11 | 武汉斗鱼网络科技有限公司 | The U.S. face method and system that adaptive optical shines |
CN107122774A (en) * | 2017-03-28 | 2017-09-01 | 武汉斗鱼网络科技有限公司 | A kind of adaptive chart pasting method moved with key point in image and system |
-
2018
- 2018-01-09 CN CN201810017906.2A patent/CN108305212A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107038680A (en) * | 2017-03-14 | 2017-08-11 | 武汉斗鱼网络科技有限公司 | The U.S. face method and system that adaptive optical shines |
CN107122774A (en) * | 2017-03-28 | 2017-09-01 | 武汉斗鱼网络科技有限公司 | A kind of adaptive chart pasting method moved with key point in image and system |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113989123A (en) * | 2021-12-23 | 2022-01-28 | 广州市新文溯科技有限公司 | Electronic seal stamping method and system, electronic equipment and readable medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3664443A1 (en) | Panoramic image generation method and device | |
CN106971165B (en) | A kind of implementation method and device of filter | |
US8849013B2 (en) | System and method of image processing | |
US8055101B2 (en) | Subpixel registration | |
CN110914873A (en) | Augmented reality method, device, mixed reality glasses and storage medium | |
CN105427244B (en) | A kind of joining method and device of remote sensing image | |
CN104866755B (en) | Setting method and device for background picture of application program unlocking interface and electronic equipment | |
CN105389801A (en) | Figure outline setting method, shooting terminal, figure image blurring method and system | |
CN101213574A (en) | Content-based Gaussian noise reduction for still image, video and film | |
US20200175648A1 (en) | Panoramic image mapping method | |
CN106295652A (en) | A kind of linear feature matching process and system | |
CN105894470A (en) | Image processing method and device | |
CN109302618A (en) | Live streaming picture rendering method, device and storage medium in mobile terminal | |
CN104933679A (en) | A method for enlarging an image and a system corresponding to the method | |
CN105913488A (en) | Three-dimensional-mapping-table-based three-dimensional point cloud rapid reconstruction method | |
DE102019215387A1 (en) | CIRCULAR FISH EYE CAMERA ARRAY CORRECTION | |
CN103035019B (en) | Image processing method and device | |
CN110070515A (en) | Image composition method, device and computer readable storage medium | |
CN110288521A (en) | Image beautification method, device and electronic equipment | |
CN108305212A (en) | Image mixing method, storage medium, electronic equipment and system | |
CN110119504B (en) | Electronic document perforation stamping method | |
CN108305224A (en) | A kind of distortion correction method of image, device and television set | |
CN107609162A (en) | A kind of method that two-dimensional map symbol batch is imported in panorama | |
US20180144438A1 (en) | Image blending apparatus and method thereof | |
CN108681989A (en) | A kind of image data Enhancement Method and device |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180720 |
|
RJ01 | Rejection of invention patent application after publication |