Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
6th May 2013, 10:33 | #1 | Link |
Registered User
Join Date: Jan 2013
Posts: 3
|
How to make an image rotates about its own axis?
Hello!
I have an image and a clip. I overlay the image on the clip, but the image only stand still, I want to make it rotates about its own axis (like earth), rotates in and out also. But I don't know how to do it. Please help me! Sorry for my bad English |
6th May 2013, 13:52 | #2 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Not sure if this is what you want but look here (quad - quadrilateral transform):-
http://forum.doom9.org/showthread.php?t=165978 And to see what it can do, a small ~1.4MB MP4 clip @ this post in same thread:- http://forum.doom9.org/showthread.ph...59#post1602759 If you really mean rotate like earth (spinning globe), then you would need a series of images (or clip) and not just one.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 6th May 2013 at 15:37. |
6th May 2013, 17:07 | #3 | Link |
Registered User
Join Date: Jan 2013
Posts: 3
|
I don't know how to explain. I want the image appears in 30 frames. Use a straight that go through center of the image from top to bottom as an axis. And the image rotates around this axis (10 frames), stand still (10 frames), then rotates again (10 frames) and disappears.
|
6th May 2013, 17:31 | #4 | Link | ||
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
sort of like this? Quote:
or can you find a video (maybe youtube) that describes what you want to do ? Last edited by poisondeathray; 6th May 2013 at 17:40. |
||
6th May 2013, 19:24 | #6 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
Alternatively you could use an image editor like gimp to save out an image sequence that rotates the layer http://registry.gimp.org/node/25104 Or maybe blender EDIT: another free one that can do this is debugmode wax Last edited by poisondeathray; 6th May 2013 at 19:49. |
|
6th May 2013, 23:04 | #7 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
I'm sure somebody could do better than this, but first time I've used quad.
Code:
#ImageSource("D:\avs\a.png").ConvertToRGB32() ColorBars() PI2=PI*2.0 CYCLE = 30 V = 0.2 # Tilt tim = PI2 / CYCLE ScriptClip(""" c=last t=tim*current_frame t1x= 0.5 - 0.5 * cos(t) # BOTH Left t2x= 0.5 + 0.5 * cos(t) # BOTH Right # t1y= 0.0 - V * sin(t) # ] both Top's opposite sign t2y= 0.0 + V * sin(t) # ] t3y= 1.0 + V * sin(t) # [ both Bottoms opposite sign t4y= 1.0 - V * sin(t) # [ quad(t1x,t1y, t2x,t2y, t2x,t3y, t1x,t4y, normal=true) """) Return Last Code:
#ImageSource("D:\avs\a.png").ConvertToRGB32() ColorBars() PI2=PI*2.0 CYCLE = 30 V = 0.2 # Tilt tim = PI2 / CYCLE ScriptClip(""" c=last t=tim*current_frame t1x= 0.5 - 0.5 * cos(t) # BOTH Left t2x= 0.5 + 0.5 * cos(t) # BOTH Right # t1y= 0.0 + V * sin(t) # ] both Top's opposite sign t2y= 0.0 - V * sin(t) # ] t3y= 1.0 + V * sin(t) # [ both Bottoms opposite sign t4y= 1.0 - V * sin(t) # [ quad(t1x,t1y, t2x,t2y, t2x,t3y, t1x,t4y, normal=true) """) Return Last
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 6th May 2013 at 23:40. |
6th May 2013, 23:49 | #9 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Yep, it dont seem quite right but I dont see any problem in coords.
Perhaps David will pop along presently. EDIT: Might just be an optical illusion.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 6th May 2013 at 23:53. |
7th May 2013, 00:16 | #10 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
I tried to line this example up to your 2nd script for comparison purposes (lagarith RGB, 3MB), as an example of pure Y-axis rotation http://www.mediafire.com/?n0vmur3s6qdbvmm (and here is the test image used) http://www.mediafire.com/view/?4z2g19oqs9mss4n |
|
7th May 2013, 00:49 | #11 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
You are correct, definite cylindrical roll involved. Although I'm not sure that I'm using current version, used the non SSE version.
Think maybe Mr Horman might like to comment on this. By the way, nice pic, did you paint it yourself? Code:
ImageSource("D:\avs\Mona_00.png").ConvertToRGB32() #ImageSource("D:\avs\a.png").ConvertToRGB32() #ColorBars() HALFCYCLE=10 # Frames in 1 HALF rotation (spinning clip) NSPIN = 1 # Number of HALF rotations in spinning clip NSTILL = 10 # Frames in STILL clip V = 0.2 # Tilt/Yaw tim = PI / HALFCYCLE ScriptClip(""" c=last t=tim*current_frame t1x= 0.5 - 0.5 * cos(t) # BOTH Left t2x= 0.5 + 0.5 * cos(t) # BOTH Right # t1y= 0.0 + V * sin(t) # ] both Top's opposite sign t2y= 0.0 - V * sin(t) # ] t3y= 1.0 + V * sin(t) # [ both Bottoms opposite sign t4y= 1.0 - V * sin(t) # [ quad(t1x,t1y, t2x,t2y, t2x,t3y, t1x,t4y, normal=true) """) SPIN=Trim(0,-(NSPIN*HALFCYCLE +1)) # Spinning clip, + 1 to complete last spin STILL=SPIN.Trim(SPIN.FrameCount-1,-1).Loop(NSTILL,0,0) SPIN2=Trim((NSPIN%2 ==0)?0:HALFCYCLE,-(NSPIN*HALFCYCLE +1)) SPIN ++ STILL ++ SPIN2 Return Last
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 7th May 2013 at 10:28. |
7th May 2013, 10:54 | #12 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,496
|
Briefly:
Faulty maths For example, at an extreme angle, the gap from the left side of the video to the left side of the spun image is the same as on the right, but if perspective was taken into account, it shouldn't be. I'm too busy to work it out just now, but I have a filter at home called rpntransform3d (or something like that) which would be pretty useful here. Also to consider: some kind of varying blur to avoid aliasing (or perform at 2^n res and reduceby2 n times) David |
7th May 2013, 18:22 | #13 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Thankyou Mr.H, thought it might be something like that. When you do get time, would love to hear a correction on supplied math, and why.
Also, thanx for the plug, most interesting.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 7th May 2013 at 19:17. |
8th May 2013, 00:31 | #14 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
For a correct perspective view, I believe the coordinates t1x (etc) in the script should be set as follows:
Code:
c = cos(t) vs = V*sin(t) t1x = 0.5*(1 - c/(1+vs)) t2x = 0.5*(1 + c/(1-vs)) t1y = 0.5*vs/(1+vs) t2y = -0.5*vs/(1-vs) t3y = 1.0 - t2y t4y = 1.0 - t1y I don't have time to explain the calculations, but basically it involves treating the image as a 2D object moving in 3D space, and projected onto a screen viewed from a finite distance. At each point of the animation, you need to determine the 3D location of each corner, then project those points onto the screen, as shown here. EDIT: StainlessS - looking again at your version, I see it actually represents an orthogonal projection (observer at infinity) of an image tilted into the screen and rotating on its axis. That's why it appears to rotate about a cylinder. Last edited by Gavino; 8th May 2013 at 08:47. |
8th May 2013, 09:55 | #15 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,496
|
You may need to avoid even values of HALFCYCLE as it looks like quad can go a bit mental when two or more corners of the target quadrilateral occupy the same point (I think it's something to do with a matrix ending up a with a determinant of 0, or something).
|
8th May 2013, 11:46 | #16 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
The four corners always occupy different points (in both my version and StainlessS's one), but when the angle of rotation is 90 degrees, they all lie in a straight line (the central axis), which is probably equally problematic as the quadrilateral reduces to zero width.
|
|
|