High-quality interpolation possible in Jitter?


    Feb 09 2006 | 12:04 am
    I'm having trouble with getting decent-quality interpolation when downscaling hi-res JPEGs and TIFFs (source is either full or cropped photo from 3000 x 2000 from Nikon D70 or approx. 5800 x 3700 from Nikon slide scanner) to a Jitter output that is arbitrarily smaller, such as 720 x 480 for DVD or 1024 x 768 for computer display. (For the sake of being complete, I'll also say that there will also always be subsequent compositing operations with other downscaled photos or portions thereof.) I'm a Jitter newbie, but in my experiments with jit.matrix so far, turning on the interpolation option (per Jitter Tutorial 14) does little to eliminate the jaggies when scaling the image down to a smaller jit.matrix and subsequent jit.window. I seem to get the same results whether I use a "read" or "importmovie" command at the front end. I've just started to look into the GPU processing, but am still unclear what provision Jitter has under either CPU or GPU for smooth interpolation when downsizing large images... hopefully something approximating Photoshop's interpolation capabilities (even if there's a tradeoff in processing time).
    Any thoughts are much appreciated!
    Jeff

    • Feb 09 2006 | 12:15 am
      Your best bet is to do the downscaling in something like photoshop and then bring it in to jitter.
      wes
    • Feb 09 2006 | 12:24 am
      jit.matrix only exposes linear interpolation which doesn't do much for significant downsampling. We might expose something like cubic, sinc, or mitchell filters in a later release. There are a few ways to deal with this.
      1. If appropriate, use an averaging downsample like this
      2. Use the JS Image class for which we use a Mitchell filter for scaling when interpolation is on. (note the fromnamedmatrix() and tonamedmatrix() methods demonstrated in jsui_matriximage-example.pat)
      3. Draw it in jit.lcd, since when downsampling QD uses a lanczos-sinc filter.
      4. Make clever use of jit.convolve to perform arbitrary filters.
      Hope this helps somewhat.
      -Joshua
    • Feb 09 2006 | 12:25 am
      Thanks, Wes, but I'm hoping for a solution in Jitter... even if not as good as Photoshop, better than what I'm seeing so far with the interpolate attribute for jit.matrix. My project needs to randomly pull cropped areas of the hi-res photos and display them at lower res on the fly... and still look good enough that it doesn't appear downsampled or jaggy.
      Any other ideas out there?
      Thanks!
      Jeff
    • Feb 09 2006 | 12:56 am
      You may also be able to use some JAVA libraries if speed isn't too much of an issue. Other quick solutions might include running command line image scaling operations that use GD (through PHP) or ImageMagick which is quite nice for cammand line image processing.
      wes