free-style "usesrcdim" mode on a matrix , sort of reversed cornerpin


    Feb 20 2014 | 11:26 am
    hi everybody , i thought i could get it ,but still can't find a way...
    i would like to resize an image in a matrix , as if i was using "srcdimstart" and "srcdimend" , but ,
    the difference is that i would like not to be constrained by 90 degrees angles , at all .
    i would like to be able to point any location in the matrix , and link it to one of the corners of my new matrix (which will be a rectangle , but with extrapolated pixels from the 4 corners --> the new """"texture coordinates"""") and do the same for the 3 other points (as if i was using a sort of reversed cornerpin ) .
    i'm not sure i'm clear , ... i want my matrix to keep the same dimensions , but its pixels to be extrapolated from new coordinates , inside this same matrix .
    that will add duplicate pixels in the matrix , and that' s what i'm looking for .
    mxform2d and jit.repos seem to be , maybe , the good boxes , but i would like a click and drag-style method .
    i have put a jit.gl.cornerpin to point on a gl context , (i get the coordinates with "getstate") and a videoplane which exactly fits the window's borders , the normalized coordinates of the cornerpin's corners is then scaled to the window's resolution , giving me the x and y coordinates in the image .
    so that i should get the exactly same image , inside the jit.gl.cornerpin , and on the videoplane , wherever i would move the corners , IIIIIIFFFFFF , i had the answer to my question , which is not the case .
    here is a patch
    am i clear enough ? still not sure ...
    Matthieu

    • Feb 20 2014 | 4:55 pm
      mmm , i wasn' t very clear , i think .
      i also think one possibility is jit.repos . i would have to send its first inlet the "full" matrix , and the right inlet a matrix with 2 planes .
      #first plane -first row would go from top_left cornerpin x scaled value to top_right cornerpin x scaled value . -last row would go from lower_left cornerpin x scaled value to lower_right x scaled value . all the rows between , would have to interpolate between these two rows , vertically.
      #second plane exactly the same , replacing "x" with "y" , and "vertically" with "horizontally"
      if , by any chance , i' m saying something that can work , would anybody lead me to the right jit.expr formula to achieve this ? the one that will , with 4 pairs of coordinates , create the magic matrix !
      here is another patch , nearly the same as the previous one , but this one goes far beyond the end of my jit.expr universe .
      anyway , have fun Matthieu
      .
    • Feb 20 2014 | 5:07 pm
      mmm , maybe i should better directly use the normalized coordinates , without scaling , and work with float32 matrix ,and then convert to char matrix just before jit.repos ...