[go: up one dir, main page]

CN102568015A - Method and device for realizing special effect of water drop ripple - Google Patents

Method and device for realizing special effect of water drop ripple Download PDF

Info

Publication number
CN102568015A
CN102568015A CN2011104488576A CN201110448857A CN102568015A CN 102568015 A CN102568015 A CN 102568015A CN 2011104488576 A CN2011104488576 A CN 2011104488576A CN 201110448857 A CN201110448857 A CN 201110448857A CN 102568015 A CN102568015 A CN 102568015A
Authority
CN
China
Prior art keywords
pixels
location
wave amplitude
zone
frame image
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
Application number
CN2011104488576A
Other languages
Chinese (zh)
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.)
Shenzhen Wondershare Software Co Ltd
Original Assignee
Shenzhen Wondershare Software 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 Shenzhen Wondershare Software Co Ltd filed Critical Shenzhen Wondershare Software Co Ltd
Priority to CN2011104488576A priority Critical patent/CN102568015A/en
Publication of CN102568015A publication Critical patent/CN102568015A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

The embodiment of the invention discloses a method for realizing the special effect of water drop ripple. The method comprises the steps of acquiring a wave source point, and determining a ripple area on a water surface in the current frame area according to the wave source point and a preset ripple degree; calculating the wave amplitude of each pixel position in the ripple area on the water surface in the current frame area according to a first preset formula; determining the offset of the pixel according to the wave amplitude of each pixel position in the current frame area, and copying each pixel in the image of the last frame to a corresponding pixel position in the current frame area according to the offset of the pixel, so as to obtain a current frame image. The embodiment also discloses a device for realizing the special effect of water drop ripple. By adopting the method and the device, the dynamic special effect of water drop ripple can be added to a video or an image simply and quickly, and the effect is vivid and equals to the effect of playing in water, thereby increasing the use interest of users and promoting user experience.

Description

A kind of ripple method and apparatus of special efficacy of water droplet of realizing
Technical field
The present invention relates to visual effect technical field, relate in particular to a kind of ripple method and apparatus of special efficacy of water droplet of realizing based on video or image.
Background technology
Along with growth in the living standard, the user has been not content with and has recorded or watched video or image monotonously, and hopes to give video or image to increase colourful special efficacy, thereby heightens the enjoyment.Therefore, the electronic product manufacturer more and more pays attention to user's experience, because the product of those visual experiences that can bring to the user, the iphone mobile phone such as Apple often can occupy very big market.
But, in current popular on the market various electronic products, can only add static special efficacy to video or image, and can not add some more interesting dynamic special efficacys.
Summary of the invention
Embodiment of the invention technical matters to be solved is, a kind of ripple method and apparatus of special efficacy of water droplet of realizing is provided.Can add dynamic special efficacy to video or image, increase user's use enjoyment, promote user experience.
In order to solve the problems of the technologies described above, the embodiment of the invention provides a kind of ripple method of special efficacy of water droplet that realizes, comprising:
Obtain the wave source point, and confirm the zone of rippling on the water surface in the present frame zone according to said wave source point and the preset degree of rippling;
Calculate the wave amplitude of each location of pixels in the zone of rippling on the water surface in the said present frame zone according to the first preset formula; Said first formula is: location of pixels (x in the present frame zone; Y) (wherein said present frame zone is identical with said previous frame size of images for x, wave amplitude the y)+preset height that ripples for location of pixels in wave amplitude=previous frame image; The width in 0 < x < present frame zone, the height in 0 < y < present frame zone;
Wave amplitude according to each location of pixels in the said present frame zone is confirmed the pixel-shift amount, and according to said pixel-shift amount with the pixel position corresponding in the present frame zone of each copied pixels in the previous frame image, obtain current frame image.
Wherein, said method also comprises:
Calculate the wave amplitude of this location of pixels in the next frame zone respectively according to the wave amplitude of each location of pixels in the current frame image and adjacent pixels position thereof, wherein said next frame zone is measure-alike with said current frame image.
Wherein, said wave amplitude according to each location of pixels in the current frame image and adjacent pixels position thereof the step of calculating the wave amplitude of this location of pixels in the next frame zone respectively specifically comprises:
(said second formula is for x, desirable wave amplitude y): location of pixels (x in the next frame zone according to location of pixels in second formula calculating next frame zone; Y) desirable wave amplitude=(location of pixels (x-1 in the current frame image; Y-1) location of pixels in wave amplitude+current frame image (x-1, location of pixels in wave amplitude+current frame image y) (x-1, location of pixels (x in wave amplitude+current frame image y+1); Y-1) location of pixels (x in wave amplitude+current frame image; Y+1) location of pixels in wave amplitude+current frame image (x+1, location of pixels in wave amplitude+current frame image y-1) (x+1, location of pixels (x+1 in wave amplitude+current frame image y); Y+1) wave amplitude)/the 2-current frame image in location of pixels (x, wave amplitude y);
(x, desirable wave amplitude y) multiply by attenuation coefficient, obtains location of pixels in the said next frame zone (x, wave amplitude y) with location of pixels in the said next frame zone.
Wherein, the zone of rippling on the water surface is the zone in the circle that is the center of circle with said wave source point, is radius with the said preset degree of rippling on the water surface in the said present frame zone.
Wherein, said wave amplitude according to each location of pixels in the said present frame zone is confirmed the pixel-shift amount, and according to said pixel-shift amount the step of pixel position corresponding in the present frame zone of each copied pixels in the previous frame image is specifically comprised:
With location of pixels (x-1 in the said present frame zone; Location of pixels in wave amplitude y) and the said present frame zone (x+1, the difference of wave amplitude y) is as location of pixels in the previous frame image (x, y) the horizontal offset dx of last pixel; With location of pixels (x in the said present frame zone; Location of pixels in wave amplitude y-1) and the said present frame zone (x, the difference of wave amplitude y+1) is as location of pixels in the previous frame image (x, y) the vertical offset dy of last pixel;
(x+dx, (x y), obtains current frame image to the location of pixels of the copied pixels on y+dy) in the said present frame zone with location of pixels in the said previous frame image.
Correspondingly, the embodiment of the invention also provides a kind of ripple device of special efficacy of water droplet of realizing, comprising:
The trigger module that ripples is used to obtain the wave source point, and confirms the zone of rippling on the water surface in the present frame zone according to said wave source point and the preset degree of rippling;
First wave amplitude computing module ripples; Be used for calculating according to the first preset formula wave amplitude of each location of pixels in the zone of rippling on the water surface of said present frame zone, said first formula is: location of pixels in the present frame zone (x, location of pixels (x in wave amplitude y)=previous frame image; Y) the wave amplitude+preset height that ripples; Wherein said present frame zone is identical with said previous frame size of images, the width in 0 < x < present frame zone, the height in 0 < y < present frame zone;
The image generation module; Be used for confirming the pixel-shift amount according to the wave amplitude of each location of pixels in said present frame zone; And according to said pixel-shift amount with the pixel position corresponding in the present frame zone of each copied pixels in the previous frame image, obtain current frame image.
Wherein, said device also comprises:
Ripple and continue the wave amplitude computing module; Be used for calculating respectively according to the wave amplitude of each location of pixels of current frame image and adjacent pixels position thereof the wave amplitude of this location of pixels in the next frame zone, wherein said next frame zone is measure-alike with said current frame image.
Wherein, the said lasting wave amplitude computing module that ripples specifically comprises:
Desirable wave amplitude computing module is used for calculating next frame zone location of pixels (x, desirable wave amplitude y) according to second formula; Said second formula is: location of pixels in the next frame zone (x, desirable wave amplitude y)=(location of pixels in the current frame image (x-1, location of pixels (x-1 in wave amplitude+current frame image y-1); Y) location of pixels (x-1 in wave amplitude+current frame image; Y+1) location of pixels in wave amplitude+current frame image (x, location of pixels in wave amplitude+current frame image y-1) (x, location of pixels (x+1 in wave amplitude+current frame image y+1); Y-1) location of pixels (x+1 in wave amplitude+current frame image; Y) location of pixels (x, wave amplitude y) in location of pixels in wave amplitude+current frame image (x+1, wave amplitude y+1))/2-current frame image;
Decaying wave amplitude computing module is used for that (x, desirable wave amplitude y) multiply by attenuation coefficient, obtains location of pixels in the said next frame zone (x, wave amplitude y) with said next frame zone location of pixels.
Wherein, the zone of rippling on the water surface is the zone in the circle that is the center of circle with said wave source point, is radius with the said preset degree of rippling on the water surface in the said present frame zone.
Wherein, said image generation module specifically comprises:
The side-play amount computing module; Be used for said present frame zone location of pixels (x-1; Location of pixels in wave amplitude y) and the said present frame zone (x+1, the difference of wave amplitude y) is as location of pixels in the previous frame image (x, y) the horizontal offset dx of last pixel; With location of pixels (x in the said present frame zone; Location of pixels in wave amplitude y-1) and the said present frame zone (x, the difference of wave amplitude y+1) is as location of pixels in the previous frame image (x, y) the vertical offset dy of last pixel;
The copied pixels module is used for that (x+dx, (x y), obtains current frame image to the location of pixels of the copied pixels on y+dy) in the said present frame zone with said previous frame image location of pixels.
Embodiment of the present invention embodiment; Has following beneficial effect: through calculate the wave amplitude of each location of pixels in the present frame zone according to the wave amplitude of each location of pixels in the previous frame image; And according to the wave amplitude calculating pixel side-play amount of each location of pixels in the present frame zone, again according to the pixel-shift amount with the pixel position corresponding in the present frame zone of the copied pixels in the previous frame image, can add the dynamic special efficacy that water droplet ripples to video or image quickly and easily; Effect is true to nature; Seem in the scene of when raining raindrop such as water, thereby increased user's use enjoyment, promoted user experience.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art; To do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below; Obviously, the accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills; Under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the ripple first embodiment process flow diagram of method of special efficacy of realization water droplet provided by the invention;
Fig. 2 is the ripple second embodiment process flow diagram of method of special efficacy of realization water droplet provided by the invention;
Fig. 3 is ripple the 3rd embodiment process flow diagram of method of special efficacy of realization water droplet provided by the invention;
Fig. 4 is the ripple first example structure synoptic diagram of device of special efficacy of realization water droplet provided by the invention;
Fig. 5 is the ripple second example structure synoptic diagram of device of special efficacy of realization water droplet provided by the invention;
Fig. 6 is ripple the 3rd example structure synoptic diagram of device of special efficacy of realization water droplet provided by the invention.
Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the technical scheme in the embodiment of the invention is carried out clear, intactly description, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
Referring to Fig. 1, be the ripple first embodiment process flow diagram of method of special efficacy of realization water droplet provided by the invention, this method comprises:
At step S100, obtain the wave source point, and confirm the zone of rippling on the water surface in the present frame zone according to this wave source point and the preset degree of rippling.
At step S101, calculate the wave amplitude of each location of pixels in the zone of rippling on the water surface in the present frame zone according to the first preset formula.Wherein, First formula can be location of pixels (x in the present frame zone; Y) (wherein the present frame zone is identical with the previous frame size of images for x, wave amplitude the y)+preset height that ripples for location of pixels in wave amplitude=previous frame image; The width in 0 < x < present frame zone, the height in 0 < y < present frame zone.
At step S102, confirm the pixel-shift amount according to the wave amplitude of each location of pixels in the present frame zone, and according to the pixel-shift amount with the pixel position corresponding in the present frame zone of each copied pixels in the previous frame image, obtain current frame image.
The ripple method of special efficacy of the realization water droplet that the embodiment of the invention provides; Through calculate the wave amplitude of each location of pixels in the present frame zone according to the wave amplitude of each location of pixels in the previous frame image; And according to the wave amplitude calculating pixel side-play amount of each location of pixels in the present frame zone, again according to the pixel-shift amount with the pixel position corresponding in the present frame zone of the copied pixels in the previous frame image, can add the dynamic special efficacy that water droplet ripples to video or image quickly and easily; Effect is true to nature; Seem in the scene of when raining raindrop such as water, thereby increased user's use enjoyment, promoted user experience.
Referring to Fig. 2, be the ripple second embodiment process flow diagram of method of special efficacy of realization water droplet provided by the invention, this method comprises:
At step S200, obtain the wave source point, and confirm the zone of rippling on the water surface in the present frame zone according to this wave source point and the preset degree of rippling.Particularly, can be with the contact point of the water droplet that generates at random and the water surface as the wave source point.The span of the preset degree of rippling can be 0 ~ 100.
At step S201,, calculate the wave amplitude of each location of pixels in the zone of rippling on the water surface in the present frame zone according to the first preset formula.Wherein, First formula can be location of pixels (x in the present frame zone; Y) (wherein the present frame zone is identical with the previous frame size of images for x, wave amplitude the y)+preset height that ripples for location of pixels in wave amplitude=previous frame image; The width in 0 < x < present frame zone, the height in 0 < y < present frame zone.The wave amplitude that does not belong to the regional location of pixels that ripples in the present frame zone is identical with the wave amplitude of same pixel position in the previous frame image.Particularly, the water surface is a plane when original state, and the primary wave amplitude of each location of pixels is 0.The span of the preset height that ripples can be 0 ~ 1000.
At step S202, confirm the pixel-shift amount according to the wave amplitude of each location of pixels in the present frame zone, and according to the pixel-shift amount with the pixel position corresponding in the present frame zone of each copied pixels in the previous frame image, obtain current frame image.Because the refraction of water, not with our sight line perpendicular the time, the scenery under water that we saw not is under observation point, and has certain skew when the water surface.Therefore, carry out pixel-shift and handle back regeneration current frame image, can obtain effect more true to nature, seem just as playing at the bottom.
At step S203, calculate the wave amplitude of this location of pixels in the next frame zone respectively according to the wave amplitude of each location of pixels in the current frame image and adjacent pixels position thereof, wherein next frame zone and current frame image is measure-alike.Calculate the wave amplitude of each location of pixels in the next frame through the continued of rippling for the first time that causes at the wave source point, the time lengthening of rippling that can a wave source point be caused realizes that ripple rises and falls, the effect of rippling more really.
In step S204, that the next frame zone is regional as present frame.Return step S202 then.
In the practical implementation process; Two interim storage space A and B can be set; Be that (width is the width of image for bufA [width*height] and bufB [width*height]; Height is the height of image), the size of storage space A and B is big or small the same with original image, is respectively applied for the previous moment of each point on the preservation water surface and the wave amplitude data in a back moment.That is to say that interim storage space A and B are respectively applied for the wave amplitude of the point on the water surface in two adjacent two field pictures of storage.
Referring to Fig. 3, be ripple the 3rd embodiment process flow diagram of method of special efficacy of realization water droplet provided by the invention, Fig. 3 is to more detailed explanation embodiment illustrated in fig. 2.As shown in Figure 3, this method comprises:
At step S300, obtain the wave source point, and confirm the zone of rippling on the water surface in the present frame zone according to this wave source point and the preset degree of rippling.Particularly, can be with the contact point of the water droplet that generates at random and the water surface as the wave source point.This wave source point causes ripple the zone can be for being the center of circle with this wave source point, being the zone in the circle of radius with the preset degree of rippling on the water surface.The span of the preset degree of rippling can be 0 ~ 100.
At step S301,, calculate the wave amplitude of each location of pixels in the zone of rippling on the water surface in the present frame zone according to the first preset formula.Wherein, First formula can be location of pixels (x in the present frame zone; Y) (wherein the present frame zone is identical with the previous frame size of images for x, wave amplitude the y)+preset height that ripples for location of pixels in wave amplitude=previous frame image; The width in 0 < x < present frame zone, the height in 0 < y < present frame zone.The wave amplitude that does not belong to the regional location of pixels that ripples in the present frame zone is identical with the wave amplitude of same pixel position in the previous frame image.Particularly, the water surface is a plane when original state, and the primary wave amplitude of each location of pixels is 0.The span of the preset height that ripples can be 0 ~ 1000.
At step S302, with location of pixels in the present frame zone (x-1, location of pixels (x+1 in wave amplitude y) and the present frame zone; The difference of wave amplitude y) is as location of pixels (x in the previous frame image; Y) the horizontal offset dx of last pixel is with location of pixels in the present frame zone (x, location of pixels (x in wave amplitude y-1) and the present frame zone; The difference of wave amplitude y+1) is as location of pixels in the previous frame image (x, y) the vertical offset dy of last pixel.Because degree and the slope of ripples, the refractive index of water and the degree of depth of water etc. of the skew that refraction causes all have relation, if calculate accurately, obviously are very unpractical.Therefore, we only need do linear approximate processing just.Because the water surface tilts more; The side-play amount of being seen of scenery under water is just big more; So represent the side-play amount of the water-bed scenery of being seen approx with the difference of the wave amplitude of all around two location of pixels of certain location of pixels on the water surface; Not only ensured effect true to nature, and accelerated arithmetic speed, reduced requirement hardware.
At step S303, (x+dx, (x y), obtains current frame image to the location of pixels of the copied pixels on y+dy) in the present frame zone with location of pixels in the previous frame image.
At step S304, calculate location of pixels (x, desirable wave amplitude y) in the next frame zone according to second formula.Wherein, Second formula is: location of pixels in the next frame zone (x, desirable wave amplitude y)=(location of pixels in the current frame image (x-1, location of pixels (x-1 in wave amplitude+current frame image y-1); Y) location of pixels (x-1 in wave amplitude+current frame image; Y+1) location of pixels in wave amplitude+current frame image (x, location of pixels in wave amplitude+current frame image y-1) (x, location of pixels (x+1 in wave amplitude+current frame image y+1); Y-1) location of pixels (x+1 in wave amplitude+current frame image; Y) location of pixels (x, wave amplitude y) in location of pixels in wave amplitude+current frame image (x+1, wave amplitude y+1))/2-current frame image.
At step S305, (x, desirable wave amplitude y) multiply by attenuation coefficient, obtains location of pixels in the next frame zone (x, wave amplitude y) with location of pixels in the next frame zone.Preferably, attenuation coefficient is 2/3.But attenuation coefficient is not limited to 2/3.Because glassware for drinking water has resistance, the wave amplitude of certain location of pixels all should be than the last one wave amplitude decay of this location of pixels constantly constantly for each, and the amplitude that like this water droplet is rippled is more and more littler, reaches real simulated effect more.
In step S306, that the next frame zone is regional as present frame.Return step S302 then.
In the embodiment shown in Fig. 2-3, can obtain other one or more wave source points when not finishing as yet rippling of causing of a wave source point, realize enriching more real animation effect.For example, can be through regulating the number that water droplet density is regulated wave source point, the span of water droplet density can be 0 ~ 10.Again for example, after step S204 or step S306, can comprise step: judging whether that new wave source point produces, is then to return step S200 or step S300 if be judged as; If be judged as not, then return step S202 or S302.
Referring to Fig. 4, be the ripple first example structure synoptic diagram of device of special efficacy of realization water droplet provided by the invention, this device comprises:
The trigger module 410 that ripples is used to obtain the wave source point, and confirms the zone of rippling on the water surface in the present frame zone according to this wave source point and the preset degree of rippling.
The first wave amplitude computing module 420 that ripples is used for calculating according to the first preset formula wave amplitude of each location of pixels in the zone of rippling on the water surface of present frame zone.Wherein, First formula can be location of pixels (x in the present frame zone; Y) (wherein the present frame zone is identical with the previous frame size of images for x, wave amplitude the y)+preset height that ripples for location of pixels in wave amplitude=previous frame image; The width in 0 < x < present frame zone, the height in 0 < y < present frame zone.
Image generation module 430; Be used for confirming the pixel-shift amount according to the wave amplitude of each location of pixels in present frame zone; And according to the pixel-shift amount with the pixel position corresponding in the present frame zone of each copied pixels in the previous frame image, obtain current frame image.
The ripple device of special efficacy of the realization water droplet that the embodiment of the invention provides; Through calculate the wave amplitude of each location of pixels in the present frame zone according to the wave amplitude of each location of pixels in the previous frame image; And according to the wave amplitude calculating pixel side-play amount of each location of pixels in the present frame zone, again according to the pixel-shift amount with the pixel position corresponding in the present frame zone of the copied pixels in the previous frame image, can add the dynamic special efficacy that water droplet ripples to video or image quickly and easily; Effect is true to nature; Seem in the scene of when raining raindrop such as water, thereby increased user's use enjoyment, promoted user experience.
Referring to Fig. 5, be the ripple second example structure synoptic diagram of device of special efficacy of realization water droplet provided by the invention, this device comprises:
The trigger module 510 that ripples is used to obtain the wave source point, and confirms the zone of rippling on the water surface in the present frame zone according to this wave source point and the preset degree of rippling.Particularly, rippling trigger module 510 can be with the contact point of the water droplet that generates at random and the water surface as the wave source point.The span of the preset degree of rippling can be 0 ~ 100.
The first wave amplitude computing module 520 that ripples is used for according to the first preset formula, calculates the wave amplitude of each location of pixels in the zone of rippling on the water surface in the present frame zone.Wherein, First formula can be location of pixels (x in the present frame zone; Y) (wherein the present frame zone is identical with the previous frame size of images for x, wave amplitude the y)+preset height that ripples for location of pixels in wave amplitude=previous frame image; The width in 0 < x < present frame zone, the height in 0 < y < present frame zone.The wave amplitude that does not belong to the regional location of pixels that ripples in the present frame zone is identical with the wave amplitude of same pixel position in the previous frame image.Particularly, the water surface is a plane when original state, and the primary wave amplitude of each location of pixels is 0.The span of the preset height that ripples can be 0 ~ 1000.
Image generation module 530; Be used for confirming the pixel-shift amount according to the wave amplitude of each location of pixels in present frame zone; And according to the pixel-shift amount with the pixel position corresponding in the present frame zone of each copied pixels in the previous frame image, obtain current frame image.Because the refraction of water, not with our sight line perpendicular the time, the scenery under water that we saw not is under observation point, and has certain skew when the water surface.Therefore, carry out pixel-shift and handle back regeneration current frame image, can obtain effect more true to nature, seem just as playing at the bottom.
Ripple and continue wave amplitude computing module 540; Be used for calculating respectively according to the wave amplitude of each location of pixels of current frame image and adjacent pixels position thereof the wave amplitude of this location of pixels in the next frame zone, wherein next frame zone and current frame image is measure-alike.Calculate the wave amplitude of each location of pixels in the next frame through the continued of rippling for the first time that causes at the wave source point, the time lengthening of rippling that can a wave source point be caused realizes that ripple rises and falls, the effect of rippling more really.
In the practical implementation process; This device can also comprise two interim storage space A and B; Be that (width is the width of image for bufA [width*height] and bufB [width*height]; Height is the height of image), the size of storage space A and B is big or small the same with original image, is respectively applied for the previous moment of each point on the preservation water surface and the wave amplitude data in a back moment.That is to say that interim storage space A and B are respectively applied for the wave amplitude of the point on the water surface in two adjacent two field pictures of storage.
Referring to Fig. 6, be ripple the 3rd example structure synoptic diagram of device of special efficacy of realization water droplet provided by the invention, Fig. 6 is to more detailed explanation embodiment illustrated in fig. 5.As shown in Figure 6, this device comprises:
The trigger module 610 that ripples is used to obtain the wave source point, and confirms the zone of rippling on the water surface in the present frame zone according to this wave source point and the preset degree of rippling.Particularly, rippling trigger module 610 can be with the contact point of the water droplet that generates at random and the water surface as the wave source point.This wave source point causes ripple the zone can be for being the center of circle with this wave source point, being the zone in the circle of radius with the preset degree of rippling on the water surface.The span of the preset degree of rippling can be 0 ~ 100.
The first wave amplitude computing module 620 that ripples is used for according to the first preset formula, calculates the wave amplitude of each location of pixels in the zone of rippling on the water surface in the present frame zone.Wherein, First formula can be location of pixels (x in the present frame zone; Y) (wherein the present frame zone is identical with the previous frame size of images for x, wave amplitude the y)+preset height that ripples for location of pixels in wave amplitude=previous frame image; The width in 0 < x < present frame zone, the height in 0 < y < present frame zone.The wave amplitude that does not belong to the regional location of pixels that ripples in the present frame zone is identical with the wave amplitude of same pixel position in the previous frame image.Particularly, the water surface is a plane when original state, and the primary wave amplitude of each location of pixels is 0.The span of the preset height that ripples can be 0 ~ 1000.
Image generation module 630 comprises side-play amount computing module 631 and copied pixels module 632.
Side-play amount computing module 631 is used for present frame zone location of pixels (x-1, location of pixels (x+1 in wave amplitude y) and the present frame zone; The difference of wave amplitude y) is as location of pixels (x in the previous frame image; Y) the horizontal offset dx of last pixel is with location of pixels in the present frame zone (x, location of pixels (x in wave amplitude y-1) and the present frame zone; The difference of wave amplitude y+1) is as location of pixels in the previous frame image (x, y) the vertical offset dy of last pixel.Because degree and the slope of ripples, the refractive index of water and the degree of depth of water etc. of the skew that refraction causes all have relation, if calculate accurately, obviously are very unpractical.Therefore, we only need do linear approximate processing just.Because the water surface tilts more; The side-play amount of being seen of scenery under water is just big more; So represent the side-play amount of the water-bed scenery of being seen approx with the difference of the wave amplitude of all around two location of pixels of certain location of pixels on the water surface; Not only ensured effect true to nature, and accelerated arithmetic speed, reduced requirement hardware.
Copied pixels module 632 is used for that (x+dx, (x y), obtains current frame image to the location of pixels of the copied pixels on y+dy) in the present frame zone with previous frame image location of pixels.
The lasting wave amplitude computing module 640 that ripples comprises desirable wave amplitude computing module 641 and decaying wave amplitude computing module 642.
Desirable wave amplitude computing module 641 is used for calculating next frame zone location of pixels (x, desirable wave amplitude y) according to second formula.Wherein, Second formula is: location of pixels in the next frame zone (x, desirable wave amplitude y)=(location of pixels in the current frame image (x-1, location of pixels (x-1 in wave amplitude+current frame image y-1); Y) location of pixels (x-1 in wave amplitude+current frame image; Y+1) location of pixels in wave amplitude+current frame image (x, location of pixels in wave amplitude+current frame image y-1) (x, location of pixels (x+1 in wave amplitude+current frame image y+1); Y-1) location of pixels (x+1 in wave amplitude+current frame image; Y) location of pixels (x, wave amplitude y) in location of pixels in wave amplitude+current frame image (x+1, wave amplitude y+1))/2-current frame image.
Decaying wave amplitude computing module 642 is used for that (x, desirable wave amplitude y) multiply by attenuation coefficient, obtains location of pixels in the next frame zone (x, wave amplitude y) with next frame zone location of pixels.Preferably, attenuation coefficient is 2/3.But attenuation coefficient is not limited to 2/3.Because glassware for drinking water has resistance, the wave amplitude of certain location of pixels all should be than the last one wave amplitude decay of this location of pixels constantly constantly for each, and the amplitude that like this water droplet is rippled is more and more littler, reaches real simulated effect more.
In the embodiment shown in Fig. 5-6, the trigger module 510 or 610 that ripples can obtain other one or more wave source points rippling of causing of a wave source point when not finishing as yet, realize enriching more real animation effect.For example, can be through regulating the number that water droplet density is regulated wave source point, the span of water droplet density can be 0 ~ 10.Again for example, this device can also comprise judge module, is used to judge whether that new wave source point produces, and is then to notify the trigger module 510 or 610 that ripples to obtain new wave source point if be judged as; If be not judged as not, then notify image generation module 530 or 630 with the next frame zone as the present frame zone, generate current frame image.
One of ordinary skill in the art will appreciate that all or part of flow process that realizes in the foregoing description method; Be to instruct relevant hardware to accomplish through computer program; Described program can be stored in the computer read/write memory medium; This program can comprise the flow process like the embodiment of above-mentioned each side method when carrying out.Wherein, described storage medium can be magnetic disc, CD, read-only storage memory body (Read-Only Memory, ROM) or at random store memory body (Random Access Memory, RAM) etc.
Above disclosedly be merely a kind of preferred embodiment of the present invention; Certainly can not limit the present invention's interest field with this; One of ordinary skill in the art will appreciate that all or part of flow process that realizes the foregoing description; And, still belong to the scope that invention is contained according to the equivalent variations that claim of the present invention is done.

Claims (10)

1. realize the ripple method of special efficacy of water droplet for one kind, it is characterized in that, comprising:
Obtain the wave source point, and confirm the zone of rippling on the water surface in the present frame zone according to said wave source point and the preset degree of rippling;
Calculate the wave amplitude of each location of pixels in the zone of rippling on the water surface in the said present frame zone according to the first preset formula; Said first formula is: location of pixels (x in the present frame zone; Y) (wherein said present frame zone is identical with said previous frame size of images for x, wave amplitude the y)+preset height that ripples for location of pixels in wave amplitude=previous frame image; The width in 0 < x < present frame zone, the height in 0 < y < present frame zone;
Wave amplitude according to each location of pixels in the said present frame zone is confirmed the pixel-shift amount, and according to said pixel-shift amount with the pixel position corresponding in the present frame zone of each copied pixels in the previous frame image, obtain current frame image.
2. the ripple method of special efficacy of realization water droplet according to claim 1 is characterized in that said method also comprises:
Calculate the wave amplitude of this location of pixels in the next frame zone respectively according to the wave amplitude of each location of pixels in the current frame image and adjacent pixels position thereof, wherein said next frame zone is measure-alike with said current frame image.
3. the ripple method of special efficacy of realization water droplet according to claim 2; It is characterized in that the step that said wave amplitude according to each location of pixels in the current frame image and adjacent pixels position thereof calculates the wave amplitude of this location of pixels in the next frame zone respectively specifically comprises:
(said second formula is for x, desirable wave amplitude y): location of pixels (x in the next frame zone according to location of pixels in second formula calculating next frame zone; Y) desirable wave amplitude=(location of pixels (x-1 in the current frame image; Y-1) location of pixels in wave amplitude+current frame image (x-1, location of pixels in wave amplitude+current frame image y) (x-1, location of pixels (x in wave amplitude+current frame image y+1); Y-1) location of pixels (x in wave amplitude+current frame image; Y+1) location of pixels in wave amplitude+current frame image (x+1, location of pixels in wave amplitude+current frame image y-1) (x+1, location of pixels (x+1 in wave amplitude+current frame image y); Y+1) wave amplitude)/the 2-current frame image in location of pixels (x, wave amplitude y);
(x, desirable wave amplitude y) multiply by attenuation coefficient, obtains location of pixels in the said next frame zone (x, wave amplitude y) with location of pixels in the said next frame zone.
4. the ripple method of special efficacy of realization water droplet according to claim 1 is characterized in that the zone of rippling in the said present frame zone on the water surface is the zone in the circle that is the center of circle with said wave source point, is radius with the said preset degree of rippling on the water surface.
5. the ripple method of special efficacy of realization water droplet according to claim 1; It is characterized in that; Said wave amplitude according to each location of pixels in the said present frame zone is confirmed the pixel-shift amount, and according to said pixel-shift amount the step of pixel position corresponding in the present frame zone of each copied pixels in the previous frame image is specifically comprised:
With location of pixels (x-1 in the said present frame zone; Location of pixels in wave amplitude y) and the said present frame zone (x+1, the difference of wave amplitude y) is as location of pixels in the previous frame image (x, y) the horizontal offset dx of last pixel; With location of pixels (x in the said present frame zone; Location of pixels in wave amplitude y-1) and the said present frame zone (x, the difference of wave amplitude y+1) is as location of pixels in the previous frame image (x, y) the vertical offset dy of last pixel;
(x+dx, (x y), obtains current frame image to the location of pixels of the copied pixels on y+dy) in the said present frame zone with location of pixels in the said previous frame image.
6. realize the ripple device of special efficacy of water droplet for one kind, it is characterized in that, comprising:
The trigger module that ripples is used to obtain the wave source point, and confirms the zone of rippling on the water surface in the present frame zone according to said wave source point and the preset degree of rippling;
First wave amplitude computing module ripples; Be used for calculating according to the first preset formula wave amplitude of each location of pixels in the zone of rippling on the water surface of said present frame zone, said first formula is: location of pixels in the present frame zone (x, location of pixels (x in wave amplitude y)=previous frame image; Y) the wave amplitude+preset height that ripples; Wherein said present frame zone is identical with said previous frame size of images, the width in 0 < x < present frame zone, the height in 0 < y < present frame zone;
The image generation module; Be used for confirming the pixel-shift amount according to the wave amplitude of each location of pixels in said present frame zone; And according to said pixel-shift amount with the pixel position corresponding in the present frame zone of each copied pixels in the previous frame image, obtain current frame image.
7. the ripple device of special efficacy of realization water droplet according to claim 6 is characterized in that said device also comprises:
Ripple and continue the wave amplitude computing module; Be used for calculating respectively according to the wave amplitude of each location of pixels of current frame image and adjacent pixels position thereof the wave amplitude of this location of pixels in the next frame zone, wherein said next frame zone is measure-alike with said current frame image.
8. the ripple device of special efficacy of realization water droplet according to claim 7 is characterized in that, said rippling continues the wave amplitude computing module and specifically comprise:
Desirable wave amplitude computing module is used for calculating next frame zone location of pixels (x, desirable wave amplitude y) according to second formula; Said second formula is: location of pixels in the next frame zone (x, desirable wave amplitude y)=(location of pixels in the current frame image (x-1, location of pixels (x-1 in wave amplitude+current frame image y-1); Y) location of pixels (x-1 in wave amplitude+current frame image; Y+1) location of pixels in wave amplitude+current frame image (x, location of pixels in wave amplitude+current frame image y-1) (x, location of pixels (x+1 in wave amplitude+current frame image y+1); Y-1) location of pixels (x+1 in wave amplitude+current frame image; Y) location of pixels (x, wave amplitude y) in location of pixels in wave amplitude+current frame image (x+1, wave amplitude y+1))/2-current frame image;
Decaying wave amplitude computing module is used for that (x, desirable wave amplitude y) multiply by attenuation coefficient, obtains location of pixels in the said next frame zone (x, wave amplitude y) with said next frame zone location of pixels.
9. the ripple device of special efficacy of realization water droplet according to claim 6 is characterized in that the zone of rippling in the said present frame zone on the water surface is the zone in the circle that is the center of circle with said wave source point, is radius with the said preset degree of rippling on the water surface.
10. the ripple device of special efficacy of realization water droplet according to claim 6 is characterized in that said image generation module specifically comprises:
The side-play amount computing module; Be used for said present frame zone location of pixels (x-1; Location of pixels in wave amplitude y) and the said present frame zone (x+1, the difference of wave amplitude y) is as location of pixels in the previous frame image (x, y) the horizontal offset dx of last pixel; With location of pixels (x in the said present frame zone; Location of pixels in wave amplitude y-1) and the said present frame zone (x, the difference of wave amplitude y+1) is as location of pixels in the previous frame image (x, y) the vertical offset dy of last pixel;
The copied pixels module is used for that (x+dx, (x y), obtains current frame image to the location of pixels of the copied pixels on y+dy) in the said present frame zone with said previous frame image location of pixels.
CN2011104488576A 2011-12-29 2011-12-29 Method and device for realizing special effect of water drop ripple Pending CN102568015A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011104488576A CN102568015A (en) 2011-12-29 2011-12-29 Method and device for realizing special effect of water drop ripple

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011104488576A CN102568015A (en) 2011-12-29 2011-12-29 Method and device for realizing special effect of water drop ripple

Publications (1)

Publication Number Publication Date
CN102568015A true CN102568015A (en) 2012-07-11

Family

ID=46413359

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011104488576A Pending CN102568015A (en) 2011-12-29 2011-12-29 Method and device for realizing special effect of water drop ripple

Country Status (1)

Country Link
CN (1) CN102568015A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108900904A (en) * 2018-07-27 2018-11-27 北京市商汤科技开发有限公司 Method for processing video frequency and device, electronic equipment and storage medium
CN111586444A (en) * 2020-06-05 2020-08-25 广州繁星互娱信息科技有限公司 Video processing method and device, electronic equipment and storage medium
WO2025119233A1 (en) * 2023-12-04 2025-06-12 北京字跳网络技术有限公司 Video processing method and apparatus, and device, computer-readable storage medium and computer program product

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004310797A (en) * 2004-08-03 2004-11-04 Fujitsu Ltd Video generator
CN101814006A (en) * 2010-04-28 2010-08-25 中兴通讯股份有限公司 Method and device for realizing water ripple special effect

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004310797A (en) * 2004-08-03 2004-11-04 Fujitsu Ltd Video generator
CN101814006A (en) * 2010-04-28 2010-08-25 中兴通讯股份有限公司 Method and device for realizing water ripple special effect

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈和平 等: "水波特效模拟原理及其快速实现方法", 《计算机应用研究》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108900904A (en) * 2018-07-27 2018-11-27 北京市商汤科技开发有限公司 Method for processing video frequency and device, electronic equipment and storage medium
CN111586444A (en) * 2020-06-05 2020-08-25 广州繁星互娱信息科技有限公司 Video processing method and device, electronic equipment and storage medium
CN111586444B (en) * 2020-06-05 2022-03-15 广州繁星互娱信息科技有限公司 Video processing method and device, electronic equipment and storage medium
WO2025119233A1 (en) * 2023-12-04 2025-06-12 北京字跳网络技术有限公司 Video processing method and apparatus, and device, computer-readable storage medium and computer program product

Similar Documents

Publication Publication Date Title
CN102592296A (en) Method and device for realizing special water wave rippling effect
US8368688B2 (en) Method for rendering fluid
CN104618663B (en) Method for processing video frequency, terminal and system
US9378590B2 (en) Augmented reality auction platform
US20130344966A1 (en) Method and system for providing video game content
CN101243694B (en) A stereoscopic display apparatus
KR20180068874A (en) Method and device for determining points of interest in an immersive content
CN101814006A (en) Method and device for realizing water ripple special effect
CN111111172B (en) Surface processing method and device for game scene, processor and electronic device
CN103559713A (en) Method and terminal for providing augmented reality
CN102568015A (en) Method and device for realizing special effect of water drop ripple
KR102108244B1 (en) Image processing method and device
GB2502686A (en) Hybrid Client-Server Graphical Content Delivery
CN106814886A (en) The methods of exhibiting and device of banner banner pictures
CN107823881B (en) Special effect display method and device
CN110876079A (en) Video processing method, device and equipment
CN104159120A (en) Video image stabilization method, device and system
CN103034969B (en) A kind of display method and system and display device for cartoon
CN105187737A (en) Image special effect processing display method, system and shooting terminal
CN108268138A (en) Processing method, device and the electronic equipment of augmented reality
CN105578035A (en) Image processing method and electronic device
Nguyen et al. A web-based augmented reality plat-form using pictorial QR code for educational purposes and beyond
CN102088571B (en) Caption displaying method and terminal equipment
CN106533916A (en) Live broadcast message display method and device
CN113359988A (en) Information display method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent of invention or patent application
CB02 Change of applicant information

Address after: 518000 Guangdong city of Shenzhen province Nanshan District Gao Xin Road, room 9 building on the north side of block A901 No. 006 TCL Industry Research Institute building A A Building 8 floor

Applicant after: Shenzhen Wondershare Information Technology Co., Ltd.

Address before: 518000 Guangdong city of Shenzhen province Nanshan District Gao Xin Road Building A block 8 Building TCL

Applicant before: Shenzhen Wondershare Software Co., Ltd.

COR Change of bibliographic data

Free format text: CORRECT: APPLICANT; FROM: SHENZHEN WONDERSHARE SOFTWARE CO., LTD. TO: SHENZHEN WONDERSHARE INFORMATION TECHNOLOGY CO., LTD.

C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20120711