Old 03-08-2022, 03:16 PM   #1
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,368
Default Corner Pin possible?

hi
i found the corner pin filter in shotcut (a video editor )
Quote:
Corner Pin Video Filter ... This filter lets you transform (change the size, position, and shape) to fit inside a shape defined by four points.
can i do this with the actual video processor ?
i had no success here, i get curved or rhombic output .

greetings

Last edited by bobobo; 03-08-2022 at 03:55 PM.
bobobo is offline   Reply With Quote
Old 03-08-2022, 04:45 PM   #2
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by bobobo View Post
hi
i found the corner pin filter in shotcut (a video editor )


can i do this with the actual video processor ?
i had no success here, i get curved or rhombic output .

greetings
I have this experimental preset I made a year ago in an attempt to understand gfx_deltablit(). I think it does what you're looking for (and a lot more...) not easy to control though!

Code:
//Overlay: DeltaBlit image
//@param1:zoom_x 'alpha' 1 0 1 0.5 0.01
//@param2:zoom_x 'zoom x%' 100 0.1 400 100 0.1
//@param3:zoom_y 'zoom% y%' 100 0.1 400 100 0.1
//@param4:paral_x 'paral x' 0 -4 4 0 0.01
//@param5:paral_y 'paral y' 0 -4 4 0 0.01
//@param6:curve_x 'curv x' 0 -4 4 0 0.01
//@param7:curve_y 'curv y' 0 -4 4 0 0.01

//@param9:srcx 'src off x' 0 -10 10 0 0.001
//@param10:srcy 'src off y' 0 -10 10 0 0.001
//@param11:dstx 'dst off x' 0 -10 10 0 0.001
//@param12:dsty 'dst off y' 0 -10 10 0 0.001

//@param14:degr_ax  'alpha dx' 0 -10 10 0 0.01
//@param15:degr_ay  'alpha dy' 0 -10 10 0 0.01

// formules magiques
zoom_x/=100;
zoom_y/=100;
project_wh_valid ?  (w=project_w; h=project_h;) : input_info(0,w,h); 
bgi=input_track(0);
srci=0;

srci != bgi ? colorspace='RGBA';
input_info(bgi,img1w,img1h) && project_wh_valid===0 ?  ( project_w = img1w; project_h = img1h; );

srci != bgi && input_info(srci,sw,sh) ? (

srcx*=sw; dstx*=sw;
srcy*=sh; dsty*=sh;
curve_x/=1000; curve_y/=1000; // attenuation des courbures
degr_ax/=1000; degr_ay/=1000;
gfx_mode=0x10000 | 0x100;
gfx_a=1;
gfx_blit(bgi,1); 
gfx_deltablit(srci, 
              dstx,dsty,sw*2,sh*2,
              -srcx,-srcy,
              1/zoom_x, paral_y,  
              paral_x, 1/zoom_y, 
              curve_x, curve_y,
              degr_ax,degr_ay
              );
);
papagirafe is offline   Reply With Quote
Old 03-08-2022, 11:27 PM   #3
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,368
Default

hi papagirafe,
thanks for chiming in

i already played arround with your code (*) (and made a own script in a more scientific way with all values parametered) but couldn't get something like the star wars crawl effect.
from this

to that


with the deltablit thing using your code i got something like this


to get this the way i want i have to turn it upside down (no problem) and get rid of the curves (that is a problem)

i tested your other script "item opacity/zoom/pan/stretch v2"
a gfx_xformblit-wrapper which i like a lot. dragging the corners can be done with it. but the result is always curvy too.





may be i'm missing something or get lost in the parameterhell of the gfx_xformblit-thing

(*)in line 2 value zoom named 'alpha' a typo?
bobobo is offline   Reply With Quote
Old 03-09-2022, 03:04 AM   #4
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by bobobo View Post
hi papagirafe,
thanks for chiming in

i already played arround with your code (*) (and made a own script in a more scientific way with all values parametered) but couldn't get something like the star wars crawl effect.
...<snip>...
to get this the way i want i have to turn it upside down (no problem) and get rid of the curves (that is a problem)
...<snip>..
i tested your other script "item opacity/zoom/pan/stretch v2"
a gfx_xformblit-wrapper which i like a lot. dragging the corners can be done with it. but the result is always curvy too.
may be i'm missing something or get lost in the parameter hell of the gfx_xformblit-thing
Now I get what you're looking for! gfx_deltablit() can only do trapezes. In the item-stretch filter, I use a 4 coordinates table (2x2) to guide xformblit(). If you use a 2x64 guiding table instead, the curvature should be imperceptible. (BTW 64 seems to be the maximum number of divisions). Good luck!
papagirafe is offline   Reply With Quote
Old 03-09-2022, 06:13 AM   #5
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,368
Default

hi papagirafe,

i have feared your answer. a gigantic tabfield to make lines straight could help , i had spent some braintime over it. but this is too complex for me.


a possibility of mapping a source (rectangular) onto a target canvas (initial rectangular) whose corners can be moved could be worth a feature request here.

Got to Feature Request


greetings

Last edited by bobobo; 03-09-2022 at 06:27 AM.
bobobo is offline   Reply With Quote
Old 03-09-2022, 06:53 AM   #6
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by bobobo View Post
hi papagirafe,

i have feared your answer. a gigantic tabfield to make lines straight could help , i had spent some braintime over it. but this is too complex for me.
<snip>
Hehehe... Actually a xform table is not so desperately esoteric once you realize how a neutral (a.k.a no transform) table is built: you just put the coordinates in the bitmap where the grid intersect. Any deviation from this will push the grid intersection in that direction.
papagirafe is offline   Reply With Quote
Old 03-09-2022, 09:55 AM   #7
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,368
Default

Hi papagirafe
sure, that works with the gfx_xformblit

but only with extreme effort and an ultimately unsightly result, since you can't iron out these humps enough to make them no longer noticeable.
And it's not nice in terms of changeability.

Making things edgy and ironing out those edges by building new edging feels so wrong just writing it down here.


greetz
bobobo is offline   Reply With Quote
Old 03-09-2022, 10:30 AM   #8
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by bobobo View Post
Hi papagirafe
sure, that works with the gfx_xformblit

but only with extreme effort and an ultimately unsightly result, since you can't iron out these humps enough to make them no longer noticeable.
And it's not nice in terms of changeability.

Making things edgy and ironing out those edges by building new edging feels so wrong just writing it down here.


greetz
What you're looking is definitely a good feature request as I just realized (with xformblit()) that not only the x coordinates need to be compressed but also the y ones with a gradual "density" proportional to the perspective. If I ever succeed before Reaper 7 I'll let you know :-))

In the mean time a loop(height) of 1 pixel high gfx_blits() should do the trick...
**edit** the answer is no! the perspective is wrong!

I guessed a few compensation formulas for xformblit() and came up with this result:

Code:
//test trapeze
div=64;
input_info(0,w,h);
gfx_set(0,0,0,1,0x100,-1);
project_w=w; project_h=h;
gfx_fillrect(0,0,w,h);
lx=0;ly=1;rx=2;ry=3;
i=0; loop(div,(
  xti=i*4;
  dw=-exp(i/div*1.5)*10^2.5;
  xft[lx+xti]=0+dw; xft[rx+xti]=w-dw;
  a=(i+1)/div;
  xft[ly+xti]=xft[ry+xti]=(i*h)/(div-1)*a;
  i+=1;
));
gfx_xformblit(0,0,0,w,h,2,div,xft);

Last edited by papagirafe; 03-09-2022 at 04:47 PM. Reason: code update
papagirafe is offline   Reply With Quote
Old 03-10-2022, 01:54 AM   #9
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,368
Default

hi papagirafe

wow, i'm baffeld
and i wish i had your brain


i guess this
dw=-(exp(i/div*1.5)*10^2.5);
is crucial here

what do i have to change to make it below broad and small in the top?

greetings
bobobo is offline   Reply With Quote
Old 03-10-2022, 02:18 AM   #10
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Replacing 1.5 by -1.5 changes it, but I don't know how to tweak it.
vitalker is online now   Reply With Quote
Old 03-10-2022, 03:49 AM   #11
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by bobobo View Post
hi papagirafe

wow, i'm baffeld
and i wish i had your brain


i guess this
dw=-(exp(i/div*1.5)*10^2.5);
is crucial here

what do i have to change to make it below broad and small in the top?

greetings
Quote:
Originally Posted by vitalker View Post
Replacing 1.5 by -1.5 changes it, but I don't know how to tweak it.
Quite frankly, I just had an intuition that an "invert" exponential function of some kind could nullify the xformblit() curve and exp() is the one I always try first! To invert vertically the effect, I suggest creating a counter loop variable (j=div, j-=1) and replace i in the "dw" & "a" formulas. As for tweaks changing the exponent 10^x leads to very interesting effets even with negative values...
papagirafe is offline   Reply With Quote
Old 03-10-2022, 03:55 AM   #12
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,368
Default

yes .. top

i got some result with this
Code:
//papagirafe gfx_xformblit .. up down
//test trapeze
div=64;
input_info(0,w,h);
gfx_set(0,0,0,1,0x100,-1);
project_w=w; project_h=h;
gfx_fillrect(0,0,w,h);
lx=0;ly=1;rx=2;ry=3;
i=0; loop(div,(
  xti=i*4;
  dw=2*(exp(i/div/-1.5)*10^2.5); // upsidedown, but don't know why :)
  //dw=-exp(i/div*1.5)*10^2.5;
  xft[lx+xti]=0-dw; xft[rx+xti]=w+dw;
  a=(i+1)/div;
  xft[ly+xti]=xft[ry+xti]=(i*h)/(div-1);  //*a causes deformations
  i+=1;
));
gfx_xformblit(0,0,0,w,h,2,div,xft);
not ideal but goes in the right direction (codewise)

greetings

greetings
bobobo is offline   Reply With Quote
Old 03-10-2022, 04:12 AM   #13
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,368
Default

Quote:
Originally Posted by papagirafe View Post
.. I suggest creating a counter loop variable (j=div, j-=1) and replace i in the "dw" & "a" formulas. ...
this doesn' t change the overall appearance starts from small to big at the top but with more distortions.
shoukldn't be much a direrence if the tab field runs from top to bottom or bottom to top
as it is rendered in the gfx_xfromblit line

greetz
bobobo is offline   Reply With Quote
Old 03-10-2022, 09:46 AM   #14
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by bobobo View Post
this doesn' t change the overall appearance starts from small to big at the top but with more distortions.
shoukldn't be much a direrence if the tab field runs from top to bottom or bottom to top
as it is rendered in the gfx_xfromblit line

greetz
Here is the last adjustment until I can find a mathematician to help me with this.



Code:
//test trapeze inversion B
//@param vcomp vcomp 1.3 1 2 0 0.001 
//@param tpinch "top pinch" 2.08 0 10 0 0.001 
//@param wampl wampl 2.6 1 100 0 0.001 

div=64;
input_info(0,w,h);
gfx_set(0,0,0,1,0x100,-1);
project_w=w; project_h=h;
gfx_fillrect(0,0,w,h);
lx=0;ly=1;rx=2;ry=3;
i=0; loop(div,(
  r=i*4;
  dw=-exp((div-i)/div*tpinch)*10^wampl;  
  xft[lx+r]=0+dw; xft[rx+r]=w-dw;
  dh=vcomp^(div-i)/h;
  xft[ly+r]=xft[ry+r]=(i*h/div)-dh;
  i+=1;
));
gfx_xformblit(0,0,0,w,h,2,div,xft);

Last edited by papagirafe; 03-10-2022 at 09:55 AM. Reason: adding image
papagirafe is offline   Reply With Quote
Old 03-10-2022, 11:26 AM   #15
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,368
Default

ha great!
a little fidgety in the settings, but works if it's not overdone

bobobo is offline   Reply With Quote
Old 03-10-2022, 12:33 PM   #16
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Super! It's the category of project specific-saving-tinkering presets though! :-))
papagirafe is offline   Reply With Quote
Old 03-10-2022, 10:15 PM   #17
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,368
Default

yepp,

i stumbled upon the gfx_transformblit in jsfx, doing the same as the gfx_xfromblit. use this demo as jsfx effect.
Code:
desc:gfx_transformblit ... gfx_xformblit in videoprocessor
slider1:test<-1500,1500,1>x topleft
@gfx 500 500
gfx_clear;
gfx_r=0.4;gfx_g=0.2;gfx_b=0.3;
gfx_rect(0,0,500,500);

gfx_r=0.1;gfx_g=0.5;gfx_b=0.1;
gfx_rect(100,100,200,200,1);
gfx_r=1;
gfx_x=100;gfx_y=100;
gfx_setfont(1,"Futura",24);
gfx_drawstr("test
test test test");
t[0]=slider1;t[1]=0; t[2]=500;t[3]=0;
t[4]=0;t[5]=500; t[6]=500;t[7]=500;

gfx_transformblit(-1,0,0,500,500,2,2,t);
i haven't found any jsfx using gfx_transformblit (original REAPER and reapack). So this is my first-man-on-the-moon moment

anyhow

i found
gfx_transformblit in the Lightweight Image Compositing Engine (LICE) used in wdl
LICE_transformblit can be found in the lice.h

and there you find all those blit- and other functions used in jsfx (and maybe similar defined elsewhere in videoprocessor)

you can dive deep if your lungs are big enough.

Last edited by bobobo; 03-10-2022 at 10:30 PM.
bobobo is offline   Reply With Quote
Old 03-11-2022, 04:26 AM   #18
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by bobobo View Post
yepp,
i stumbled upon the gfx_transformblit in jsfx, doing the same as the gfx_xfromblit. use this demo as jsfx effect.
<snip...<snip>
and there you find all those blit- and other functions used in jsfx (and maybe similar defined elsewhere in videoprocessor)

you can dive deep if your lungs are big enough.
Yes I do know about these and there is a larger collection of gfx primitives out there. Unfortunately They are restricted to the jsfx gui itself or for action scripts. I tried passing images from JSFX to video processor with gmem but the "sandbox" isolation of jsfx (the video processor is one of them) prevents that (which is a good thing btw).

Last edited by papagirafe; 03-11-2022 at 07:10 AM. Reason: typo
papagirafe is offline   Reply With Quote
Old 03-11-2022, 04:57 AM   #19
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Quote:
Originally Posted by papagirafe View Post
Yes I do not know about these and there is a larger collection of gfx primitives out there. Unfortunately They are restricted to the jsfx gui itself or for action scripts. I tried passing images from JSFX to video processor with gmem but the "sandbox" isolation of jsfx (the video processor is one of them) prevents that (which is a good thing btw).
There is a plugin to peek samples JS: misc/video_sample_peeker and another one to make something with it "Decorative Oscilloscope with Blitter (requires JSFX video sample peeker" preset for video processor. So it is somehow possible.
vitalker is online now   Reply With Quote
Old 03-11-2022, 05:49 AM   #20
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by vitalker View Post
There is a plugin to peek samples JS: misc/video_sample_peeker and another one to make something with it "Decorative Oscilloscope with Blitter (requires JSFX video sample peeker" preset for video processor. So it is somehow possible.
Yes but the jsfx sample peeker only sends sample spectral information to the video preset, it does not perform any graphical operation.
papagirafe is offline   Reply With Quote
Old 03-11-2022, 06:00 AM   #21
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Quote:
Originally Posted by papagirafe View Post
Yes but the jsfx sample peeker only sends sample spectral information to the video preset, it does not perform any graphical operation.
Ah yeah, you're right. It just converts audio to video.
vitalker is online now   Reply With Quote
Old 03-11-2022, 03:19 PM   #22
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,293
Default

The sample peeker sticks values in gmem slots. You can’t pass a reference to an image space, but if you really wanted to, you could pass an image back and forth pixel-by-pixel.
ashcat_lt is offline   Reply With Quote
Old 04-04-2024, 10:55 AM   #23
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,368
Default


finally


thanks to https://forum.cockos.com/showthread.php?p=2772200
bobobo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.