Class WarpGrid


  • public class WarpGrid
    extends java.lang.Object
    A warp grid. From "A simplified approach to Image Processing" by Randy Crane
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int cols  
      int rows  
      float[] xGrid  
      float[] yGrid  
    • Constructor Summary

      Constructors 
      Constructor Description
      WarpGrid​(int rows, int cols, int w, int h)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addCol​(int before)
      Add a new column to the grid.
      void addRow​(int before)
      Add a new row to the grid.
      protected void interpolateSpline​(float[] xKnots, float[] yKnots, int offset, int length, float[] splineY, int splineOffset, int splineLength)  
      protected void interpolateSpline2​(float[] xKnots, float[] yKnots, int offset, float[] splineY, int splineOffset, int splineLength)  
      void lerp​(float t, WarpGrid destination, WarpGrid intermediate)  
      void removeCol​(int r)
      Remove a column from the grid.
      void removeRow​(int r)
      Remove a row from the grid.
      void warp​(int[] inPixels, int cols, int rows, WarpGrid sourceGrid, WarpGrid destGrid, int[] outPixels)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • xGrid

        public float[] xGrid
      • yGrid

        public float[] yGrid
      • rows

        public int rows
      • cols

        public int cols
    • Constructor Detail

      • WarpGrid

        public WarpGrid​(int rows,
                        int cols,
                        int w,
                        int h)
    • Method Detail

      • addRow

        public void addRow​(int before)
        Add a new row to the grid. "before" must be in the range 1..rows-1. i.e. you can only add rows inside the grid.
        Parameters:
        before - The row before
      • addCol

        public void addCol​(int before)
        Add a new column to the grid. "before" must be in the range 1..cols-1. i.e. you can only add columns inside the grid.
        Parameters:
        before - The column before.
      • removeRow

        public void removeRow​(int r)
        Remove a row from the grid.
        Parameters:
        r - The row to remove.
      • removeCol

        public void removeCol​(int r)
        Remove a column from the grid.
        Parameters:
        r - The column to remove.
      • lerp

        public void lerp​(float t,
                         WarpGrid destination,
                         WarpGrid intermediate)
      • warp

        public void warp​(int[] inPixels,
                         int cols,
                         int rows,
                         WarpGrid sourceGrid,
                         WarpGrid destGrid,
                         int[] outPixels)
      • interpolateSpline

        protected void interpolateSpline​(float[] xKnots,
                                         float[] yKnots,
                                         int offset,
                                         int length,
                                         float[] splineY,
                                         int splineOffset,
                                         int splineLength)
      • interpolateSpline2

        protected void interpolateSpline2​(float[] xKnots,
                                          float[] yKnots,
                                          int offset,
                                          float[] splineY,
                                          int splineOffset,
                                          int splineLength)