image

Chapter 1
ImageComparator

package com.c3d.image;

Abstract method of comparing images. No constraint as to how this is done, only that it imposes a distance metric on images.

public interface ImageComparator{
  public double difference(Jimage a, Jimage b);
}

Chapter 2
Jimage

package com.c3d.image;
import com.c3d.structured.*;
import com.c3d.operators.*;
import com.c3d.util.atomic.*;
//import com.c3d.Kparser.*;
import java.awt.*;
import java.awt.image.*;
import java.util.*;
import java.io.*;

import java.awt.Toolkit;
//
//
// Jimage
//
//

The class Jimage1 is an abstract class to support image processing operations. It also implements the java.awt ImageConsumer class enabling it to be loaded with image data from the java system.

If Jimages are to be displayed, one obtains a statdard awt ImageProducer from the Jimage useing the getProducer method. This can then be used to construct images that can be displayed in java awt windows.

Numeric representation of pixels

The Java language only supports signed bytes and signed shorts. The internal representation of pixels is therefore always as signed numbers. Since the accuracy to which pixels are stored may vary between subclasses of the Jimage type, the following conventions are addopted.
  1. When pixels are treated as real numbers, they are considered to be in the range -1.0 to plus 1.0. All arithmetic operations on pixels should be compatible with this model.
  2. When 8 bit pixel data is input to the Jimage from the Java AWT, the 8 bit AWT data is interpreted such that a pixel value of 0 is treated as equal to -1.0 and a pixel value of 255 is treated as equal to 1.0.
  3. When data is stored internally as 16 bit pixels, these are treated as fixed point signed binary fractions.

Table 2.1: Table mapping different representations of pixels
unsigned bytes shorts float
min value 0 -128 -2048 0
maxval 255 127 20477 1
medianval m127.5 -0.5 -0.5 0
range r255 255 255 1

As shown in table a pixel prin representation r is converted to a pixel Ps in representation s by the operation:

ps = ms+(rs(pr-mr))¸(rr)
public abstract class Jimage 
implements Subscriptable,ImageConsumer ,Struct,Universal
{    static final int alphamask =0xff000000;
		
lowest value of an unsigned pixel
    public static final int umin =0;
    static final int bmin =-128;
    public static final int smin = -2048;
    public static final float fmin =-1;
    static final int umax = 255;
    static final int bmax = 127;
      public static final int smax = 2047;
      
      static final int shortshift =11;
    public static final float fmax= 1;
		
unsigned byte pixel range

    public static final int urho = umax-umin+1; 
		
signed byte pixel range

    public static final int brho = bmax-bmin+1; 
		
signed short pixel range

    public static final int srho = smax-smin+1;
    public static final float frho = fmax-fmin;
		
unsigned byte pixel median

    static final float umu = (float)0.5*(urho)+umin;
		
byte median

    static final float bmu = (float)0.5*(brho)+bmin;
		
short median

    static final float smu = (float)0.5*(srho)+smin;
		
float median

    public static final float fmu = (float)0.5*(frho)+fmin;
		
required by image consumer but not used

        public int hints;              
    public ColorModel colorModel=ColorModel.getRGBdefault();  
		 
The number of pixels high and wide that the image occupies.

    public int height,width,planes;
    //public Hashtable properties= new Hashtable();
		
convert float pixel to byte pixel
    static float frhorecip = 1/frho;

    public static byte fpixelTobpixel(float fpixel)
    
    
convert a 12 bit short pixel to a signed byte
    public static final byte spixelTobpixel(short s)
    
    /* convert a signed byte to a 12 bit short */
    public static final short bpixelTospixel(short b)
    
    public static int bpixelToupixel(byte b)
    public static byte upixelTobpixel(int upixel)
    
		
convert short pixel from unsigned

    public static short upixelTospixel(int upixel)
    
          static final float  stouscale =((float)urho)/srho;
		
convert short pixel to unsigned
    public static int spixelToupixel(int spixel)
    
    
    static final float utofscale = frho/urho;
    
    public static  float upixelTofpixel(int upixel)
    

    static final float btofscale = frho/brho;
    public static float bpixelTofpixel(byte bpixel)
    
		 
ps = ms+(rs(pr-mr))¸(rr)
    public static short fpixelTospixel(float fpixel)
    

     
       public static float spixelTofpixel(int spixel)
       
  
    public static int fpixelToupixel(float fpixel)
    
    
		
convert short pixel to float pixel
    static final float stofscale = frho/srho;
    public static float spixelTofpixel(short spixel)
    
		
return i within the range of float pixels (i < fmin?fmin:(i > fmax?fmax:i))
    public static float fsaturate(float i)
    public static float fsaturate(double i)

		
Return i in the range of byte pixels
      public static byte bsaturate(double i)
	    
Return i in the rang eof short pixels
      public static short ssaturate(double i)
      public static int usaturate(double i)

        abstract Jimage getPlane(int k);
        	
Returns the pixel in the range -1 to +1.

      public abstract float fpixel(int x, int y, int plane);
  
		 
TeX Returns the pixel in the range -128 to + 127. see fpixel for equivalent floating point value.
       
    abstract byte bpixel(int x, int y, int plane);
		
return signed short pixel
    public abstract short spixel(int x, int y, int plane);
      public abstract void setPixel(int x,int y, int plane,double pix);
      public void setPixel(int x,int y, int plane, int p);
      public   void setPixel(int x, int y, int plane, short p);
    public abstract int   upixel(int x, int y, int plane);
		
Converts the plane information into a pixel in the direct colour model of java. It has to convert from the signed form of pixels to an unsigned representation before packing into an integer. If the image is monochrome return the same brightness in all of the portions of the pixel


    public int rgbpixel(int x, int y)
		

Images dx and dy contain the discrepancy in x and y positions from which source pixels to be obtained let r be the result, s the source then

ri,j = si+dxi,j,j+dyi,j
    public Jimage warp(Jimage dx, Jimage dy)throws CloneNotSupportedException
    
    public abstract Universal Upixel(int x,int y, int plane);
    public abstract  Jimage convolve(double [][]kernel);
		 
convolve with symetrical seperable kernel.

    public Jimage convolve (double []k) 
    
    
    public abstract Jimage abs();
    public abstract Jimage subImage(int x, int y, int dx, int dy);
		
Update an area of an image with another one. The other one must not run off the edge of the one being written to. The source of the copying is the 0th plane of the source jimage.
    public void setSubImage(int x, int y,int z, Jimage im)
    
    public Jimage sqr()
		
first sum the planes to a grey scale image and then return the sum of the absolute values of the pixels
    
    public float l1Norm()
    
		
first sum the planes to a grey scale image and then return the sqrt of the sum of the squared values of the pixels
    

    public float l2Norm()
    
		
Return the sum of the floating point pixels in the z plane
    public float sum(int z)
    
		
Denote x.fmodulus() by |x|. Returns the square root of the sum of values of the pixels

        public float fmodulus()
        
        
This reduces all planes of the image by the operator returning a tuple of results.
    /*   public Subscriptable preduce(Doperator op)
        */

         
        
The members ar the planes, so that op / i for i an image will reduce the image to one with a single plane
    public  Enumeration members()

    public static final int REDPLANE=0;
    public static final int GREENPLANE=1;
    public static final int BLUEPLANE=2;
    public static final int ALPHAPLANE=3;
    public static final int MONOCHROME=1;
    public static final int RGB=3;
    private int status=0;
		

y = 0.6 g + 0.3 r + 0.1 b
u = b-y
0 = r-y-v
    public Jimage RGB2YUV()
    
    

		

b = u+y
r = u+v
g = (y-0.3r-0.1b)/0.6
    public Jimage YUV2RGB()
    

    //private ImageProducer producer=null;
    public synchronized Image getAWTImage()
    
    /* Returns a awt compatible buffered image 
        public BufferedImage getBufferedImage()
    */
    public ImageProducer getProducer()
		
Returns an instance of the particular sub class of images to which the parent belongs
    public abstract Jimage oneOfThese();
    Jimage rescale(int nwidth,int nheight )
    
    Jimage smooth(double factor)
    
    Jimage xsmooth(double factor)
    
    Jimage ysmooth(double factor)
    
    
This method allows the depth as well as area of an image to be altered if it is reduced the planes are aggregated if increased they are interpolated
    public Jimage getScaledInstance(int nwidth,int nheight,int ndepth)
    
    Jimage getnewdepth(int ndepth)
    
    float aweight(float step, float d)
    
    Jimage aggregateplanes(int ndepth)
    
    Jimage interpolateplanes(int ndepth)
    
		
This replicates the functionality of the get scaled instance method of the AWT image class.

    public Jimage getScaledInstance(int nwidth,int nheight )
    

       
Load the image from the specified file. The file must be jpeg or gif.
    public synchronized boolean getImage(String fileName)
    
		
Outputs the image to a jpeg file
    public synchronized void putJPEGImage(String fileName, int quality)
    throws IOException
     
    public void setProperties(Hashtable props)
    public void setHints(int h)
    public void setColorModel(ColorModel cm)
    public synchronized void imageComplete(int s)
	 
Subscription by a number returns the Ith plane of the image. Subscription by a 3tuple returns the pixel at position [plane,x,y]. All other case raise an array bounds exception.

    public Universal subscript(Universal I)
      
    
		
Returns the ith plane
    public Universal subscript(int i)
		
Returns the number of planes in an image.
 
    public  int arity()
		
Returns the number of pixels in an image
    public  double cardinality()
			
one image less than another if all pixels less than corresponding ones, thus it can be implemented by injecting < between the elements of a and b, and then applying ×/ to the result

    public  boolean lessthan (Universal b)
  
    
     
    public Jimage shift(int i)
    
    void checksync()throws AWTException
    
Methods implementing Struct
  public Numeric numberOfElements()
  
  public String toString(char c)
  public String toString()
  //public float fmodulus()
  public Numeric modulus()
  public Universal reduce(Doperator op)
  
public int hashCode()
    
  
  

  /*
  public static Universal fromFile(String fn)
  throws  FileNotFoundException,IOException,KSyntaxError
     */
  public Universal times(double n)
  public Universal plus(double n)
  public Universal minus(double n)
  public Universal divide(double n)
  public Universal concat(Universal b)
}

class JimageProducer implements ImageProducer {
    

    Vector consumers = new Vector();
    Hashtable properties = new Hashtable();
    Jimage theImage;
    int pixels[];

    JimageProducer(Jimage ji) 
        

    public synchronized void addConsumer(ImageConsumer ic) 

    public synchronized boolean isConsumer(ImageConsumer ic) 

    public synchronized void removeConsumer(ImageConsumer ic) 

    
    public void startProduction(ImageConsumer ic) 

    private void produce(ImageConsumer ic) 

    public void requestTopDownLeftRightResend(ImageConsumer ic) 
  

}
class Jupit implements Enumeration{
  int i;
  Jimage t;
  public boolean hasMoreElements()
  public Object nextElement()
  public Jupit(Jimage t1)
}

Chapter 3
ShortImage



ShortImage © Turing Institute, 1998, W P Cockshott.

A byte image is one that stores its information as a vector of shorts. This is necessary in order to handle the numeric range 0..255 in Java which does not support unsigned bytes. It is initialised by explicitly passing in the shorts.

package com.c3d.image;
import com.c3d.util.atomic.*;
import com.c3d.structured.*;
import com.c3d.operators.*;
import java.awt.image.*;
public class ShortImage extends Jimage
{
	

3.0.1  Data Fields


	public short data[][];	
The data is stored as linear array of shorts for each plane
	public int startindata;
The position in the data at which the image origin ( top left ) occurs
	public int scanlinelength;
The number of shorts in a single scan line of the image data.

  
	

3.0.2  Constructors

  public ShortImage()
  
  boolean isleaf()
  public Jimage oneOfThese()
  public ShortImage(int plane)
	
Creates an image of size zero with right number of planes
  
  public ShortImage(short d[][], int dx, int dy)
    
  public ShortImage(short d[][], int dx, int dy, int linewidth, int start)
		
Create an image sharing the data with size dx, dy at offset start *
  
  public ShortImage(int x, int y, int z)
  
  public Universal concat(Universal a)

  public Jimage subImage(int x, int y, int dx, int dy)
    
  
	

3.0.3  Inherited from ImageConsumer

  public void setDimensions(int w, int h)
  
    protected  Object clone() throws CloneNotSupportedException
  
public Jimage abs()
  
  public void setPixel(int x, int y, int z, double p)
   
  public float sum(int z)
    

    public void setPixel(int x,int y, int z, short p)
    public void setPixel(int x, int y, int z, int p)

  public synchronized void setPixels(int srcX, int srcY, int srcW, int srcH,
    ColorModel cm, byte pixels[], int srcOff, int srcScan)
  
  public synchronized void setPixels(int srcX, int srcY, int srcW, int srcH,
    ColorModel cm, int pixels[], int srcOff, int srcScan)
  
	
fSubscription by a scalar returns the appropriate pixel in the 0th plane of the image, allowing for the offset of this image from the start of the image data.

  public float fsubscript(int I);
 
  

	

3.0.4  Methods Inherited from Structured

   public  Universal Inject(Universal b,Doperator op)
	
combine two structured classes under a dydaic operator
   
  public Universal minus(Universal b)
		

When a numeric is subtracted from a Jimage, the result is formed by explicit subtraction, otherwise, operator injection is used.

  
	public  Universal plus (Universal b)
implements +
	

When a numeric is added to a Jimage, the result is formed by addition explicitly, otherwise, operator injection is used.

  
  public short[][] newData()
  
	public Universal times (Universal b)
implements ×
    
	public  Universal divide (Universal b)
implements ¸
  



	

3.0.5  Methods Inherited from Jimage

	int pa(int x,int y)
Calculates pixel address, checking bounds.
  
  public  float fpixel(int x, int y , int plane)
		
ps = ms+(rs(pr-mr))¸(rr)
    
  public int upixel(int x, int y, int plane)
    
  public short spixel(int x, int y , int plane)
    
  public int rgbpixel(int x, int y)
Converts the plane information into a pixel in the direct colour model of java. It has to convert from the signed form of pixels to an unsigned representation before packing into an integer.

	
Convert a pixel in the range 0-255 to one in the range -128 to 127.
  public byte bpixel(int x, int y, int plane)
  
  public  Universal Upixel(int x, int y, int plane)
    
  public  Jimage convolve(double [][]kernel)
  
    public Universal Map(Moperator op)
  
public Jimage  getPlane(int k)
   

}

Chapter 4
FloatImage

package com.c3d.image;

import com.c3d.structured.*;
import com.c3d.util.atomic.*;
import com.c3d.operators.*;
import java.awt.image.*;
import java.awt.*;
//
//
// FloatImage
//
//

FloatImage © Turing Institute, 1998, W P Cockshott.

A float image is one that stores its information as a vector of floats. It is initialised by explicitly passing in either bytes or floats.


public class FloatImage extends Jimage
{



	

4.0.1  Data Fields


 The data is stored as linear array of bytes for each plane 

  public float data[][];
	
The position in the data at which the image origin ( top left ) occurs

	public int startindata;
The number of floats in a single scan line of the image data.

  public int scanlinelength;
returns true if it is a region of interest of a larger image
        public boolean isROI()
        
  
	

4.0.2  Constructors

  public FloatImage()
  
 
   public Jimage getPlane(int k)
   
   
Creates an image of size zero with right number of planes

  public FloatImage(int plane)
  
  
  public Jimage oneOfThese()
  public FloatImage(float d[][], int dx, int dy)
    
  
  
  public FloatImage(byte d[][], int dx, int dy)
  
		
Create an image sharing the data with size dx, dy at offset start *

  private FloatImage(float d[][], int dx, int dy, int linewidth, int start)
  
  
  public Universal concat(Universal a)
  public Jimage subImage(int x, int y, int dx, int dy)
    
	
compute sum of abs values of the image
   public float fmodulus()
   
  public synchronized void setDimensions(int w, int h)
  
  public Universal Map(Moperator o)
   
  public void setPixel(int x, int y, int z, double p)
   
  public synchronized void setPixels(int srcX, int srcY, int srcW, int srcH,
    ColorModel cm, byte pixels[], int srcOff, int srcScan)
  
  public synchronized void setPixels(int srcX, int srcY, int srcW, int srcH,
    ColorModel cm, int pixels[], int srcOff, int srcScan)
  
	

4.0.3  Methods Inherited from Subscriptable

Subscription by a scalar returns the appropriate pixel in the image, allowing for the offset of this image from the start of the image data.

  public float fsubscript(int I); 
  

   
	
combine two structured classes under a dydaic operator

   public  Universal Inject(Universal b,Doperator op)
   
	 

When a numeric is subtracted from a Jimage, the result is formed by explicit subtraction, otherwise, operator injection is used.


  public Universal minus(Universal b)
    
  
	
implements + When a numeric is added to a Jimage, the result is formed by addition explicitly, otherwise, operator injection is used.

  public  Universal plus (Universal b)
  
	
implements ×

  public Universal times (Universal b)
    
	
implements ¸

  public  Universal divide (Universal b)
  



   
  public Jimage abs()
  
Calculates pixel address, checking bounds.

  int pa(int x,int y)
  
  public float sum(int z)
    

	
ps = ms+(rs(pr-mr))¸(rr)

  public  byte bpixel(int x, int y , int plane)
    
    
  public short spixel(int x, int y, int plane)
  
  public int upixel(int x, int y, int plane)
  
  public  float fpixel(int x, int y , int plane)
  
  public  Universal Upixel(int x, int y, int plane)
		
This replicates the functionality of the get scaled instance method of the AWT image class.

  public Jimage getfScaledInstance(int nwidth,int nheight )
    
    

  public  synchronized Jimage convolve(double [][]kernel)
  
}





Chapter 5
IntelImage

package com.c3d.image;
import com.c3d.operators.*;
import com.c3d.util.atomic.*;

//IntelImage.java
/** Class that implements short integer images using mmx processor to speed things up.
Requires intel IPL.DLL */
public class IntelImage extends ShortImage
{   /** Convert a jimage to an intel image */ 
    public IntelImage(Jimage src)
    
    

Creates an image of size zero with 3 planes



    public  IntelImage()
    
    
Creates an image of size zero with right number of planes

  public IntelImage(int plane)
  
  
  public Jimage oneOfThese()
	
Create an image sharing the data with size dx, dy at offset start *

  public IntelImage (short d[][], int dx, int dy, int linewidth, int start)
    
  
  public  IntelImage(int x, int y, int z)
  
   
public Jimage  getPlane(int k)
   

  public ShortImage MkIntelImage (short d[][], int dx, int dy)
  
  public ShortImage MkIntelImage(int plane)
	
Creates an image of size zero with right number of planes
  
  public ShortImage replica()
  
  
  public Jimage subImage(int x, int y, int dx, int dy)
    
 
Combine two structured classes under a dydaic operator. If they are short images, combine using MMX.


   public  synchronized Universal Inject(Universal b,Doperator op)
  
   

When a numeric is subtracted from a Jimage, the result is formed by explicit subtraction, otherwise, operator injection is used.


   synchronized Universal dyad(Universal b, Doperator op)
    
  
  //public float l1Norm()
  //
  
   // public float l2Norm()
  //
  
 
   public Universal minus(Universal b)
   public Universal plus(Universal b)
  // public Universal times(Universal b)
public Universal times (Universal b)
implements ×
// this implementation used because of a bug in intel scalar
// multiplication
    
   

  public Jimage shift(int i)
  
  public  synchronized Jimage convolve(double [][]kernel)
  

	
convolve with symetrical seperable kernel.
        public Jimage convolve(double []k)
  public Jimage sepconvolve (double []k)
    
This replicates the functionality of the get scaled instance method of the AWT image class.

  public Jimage getScaledInstance(int nwidth,int nheight )
    
    
     
public Jimage abs()
  


5.0.1  JNI methods implemented in C

native static void intelsq(ImageTransfer a, ImageTransfer result);
native static void intelAbs(ImageTransfer a, ImageTransfer result);
//native static void intelRGB2HSV(ImageTransfer a,ImageTransfer result);
//native static void intelHSV2RGB(ImageTransfer a,ImageTransfer result);
native static double intelNorm(ImageTransfer a, int b);
 
native static void intelResize(ImageTransfer a, ImageTransfer b,
 int xsrc,int ysrc, int xdest,int ydest);

native static void intelDyad(int OP,
  ImageTransfer a,ImageTransfer b,ImageTransfer result);
native static void intelconvolve(ImageTransfer x, 
  ImageTransfer z, int [] kernel, int Kx, int Ky);
native static void intelsepconvolve(ImageTransfer x,
  ImageTransfer z, int [] kernel,int []ykernel, int Kx, int Ky);

native static void intelscalar(int OP,ImageTransfer a,short b,ImageTransfer result);
native static void intelshift(ImageTransfer a,int b,ImageTransfer result);

static

  
}

Chapter 6
ByteImage



ByteImage © Turing Institute, 1998, W P Cockshott.

A byte image is one that stores its information as a vector of signed bytes. This is necessary in order to handle the numeric range 0..255 in Java which does not support unsigned bytes. It is initialised by explicitly passing in the bytes.

package com.c3d.image;
import com.c3d.util.atomic.*;
import com.c3d.structured.*;
import com.c3d.operators.*;
import java.awt.image.*;
public class ByteImage extends Jimage
{
	

6.0.1  Data Fields


	public byte data[][];	
The data is stored as linear array of bytes for each plane
	public int startindata;
The position in the data at which the image origin ( top left ) occurs
	public int scanlinelength;
The number of bytes in a single scan line of the image data.

  
	

6.0.2  Constructors

  public ByteImage()
  
  boolean isleaf()
  public Jimage oneOfThese()
  public ByteImage(int plane)
	
Creates an image of size zero with right number of planes
  
  public ByteImage(byte d[][], int dx, int dy)
    
  public ByteImage(byte d[][], int dx, int dy, int linewidth, int start)
		
Create an image sharing the data with size dx, dy at offset start *
  
  public ByteImage(int x, int y, int z)
  
  public Universal concat(Universal a)

  public Jimage subImage(int x, int y, int dx, int dy)
    
  
	

6.0.3  Inherited from ImageConsumer

  public void setDimensions(int w, int h)
  
    protected  Object clone() throws CloneNotSupportedException
  
public Jimage abs()
  
  public void setPixel(int x, int y, int z, double p)
   
  public float sum(int z)
    

    public void setPixel(int x,int y, int z, byte p)
    public void setPixel(int x, int y, int z, int p)

  public synchronized void setPixels(int srcX, int srcY, int srcW, int srcH,
    ColorModel cm, byte pixels[], int srcOff, int srcScan)
  
  public synchronized void setPixels(int srcX, int srcY, int srcW, int srcH,
    ColorModel cm, int pixels[], int srcOff, int srcScan)
  
	
fSubscription by a scalar returns the appropriate pixel in the 0th plane of the image, allowing for the offset of this image from the start of the image data.

  public float fsubscript(int I);
 
  

	

6.0.4  Methods Inherited from Structured

   public  Universal Inject(Universal b,Doperator op)
	
combine two structured classes under a dydaic operator
   
  public Universal minus(Universal b)
		

When a numeric is subtracted from a Jimage, the result is formed by explicit subtraction, otherwise, operator injection is used.

  
	public  Universal plus (Universal b)
implements +
	

When a numeric is added to a Jimage, the result is formed by addition explicitly, otherwise, operator injection is used.

  
  public byte[][] newData()
  
	public Universal times (Universal b)
implements ×
    
	public  Universal divide (Universal b)
implements ¸
  



	

6.0.5  Methods Inherited from Jimage

	int pa(int x,int y)
Calculates pixel address, checking bounds.
  
  public short spixel(int x,int y,int plane)
  
  public  float fpixel(int x, int y , int plane)
    /**Tex $$p_s=\mu_s+\frac$$
   */
    
  public int upixel(int x, int y, int plane)
    
  public byte bpixel(int x, int y , int plane)
    
  public int rgbpixel(int x, int y)
Converts the plane information into a pixel in the direct colour model of java. It has to convert from the signed form of pixels to an unsigned representation before packing into an integer.

   

  public  Universal Upixel(int x, int y, int plane)
    
  public  Jimage convolve(double [][]kernel)
  
    public Universal Map(Moperator op)
  
public Jimage  getPlane(int k)
   

}

Chapter 7
IntelBImage

package com.c3d.image;
import com.c3d.operators.*;
import com.c3d.util.atomic.*;

//IntelImage.java
/** Class that implements short integer images using mmx processor to speed things up.
Requires intel IPL.DLL */
public class IntelBImage extends ByteImage
{   /** Convert a jimage to an intel image */ 
    public IntelBImage(Jimage src)
    
    

Creates an image of size zero with 3 planes



    public  IntelBImage()
    
    
Creates an image of size zero with right number of planes

  public IntelBImage(int plane)
  
  
  public Jimage oneOfThese()
	
Create an image sharing the data with size dx, dy at offset start *

  public IntelBImage (byte d[][], int dx, int dy, int linewidth, int start)
    
  
  public  IntelBImage(int x, int y, int z)
  
   
public Jimage  getPlane(int k)
   

  public ByteImage MkIntelBImage (byte d[][], int dx, int dy)
  
  public ByteImage MkIntelBImage(int plane)
	
Creates an image of size zero with right number of planes
  
  public ByteImage replica()
  
  
  public Jimage subImage(int x, int y, int dx, int dy)
    
 
Combine two structured classes under a dydaic operator. If they are byte images, combine using MMX.


   public  synchronized Universal Inject(Universal b,Doperator op)
  
   

When a numeric is subtracted from a Jimage, the result is formed by explicit subtraction, otherwise, operator injection is used.


   synchronized Universal dyad(Universal b, Doperator op)
    
  
  //public float l1Norm()
  //
  
   // public float l2Norm()
  //
  
 
   public Universal minus(Universal b)
   public Universal plus(Universal b)
  // public Universal times(Universal b)
public Universal times (Universal b)
implements ×
// this implementation used because of a bug in intel scalar
// multiplication
    
   

  public Jimage shift(int i)
  
  public  synchronized Jimage convolve(double [][]kernel)
  

	
convolve with symetrical seperable kernel.
        public Jimage convolve(double []k)
  public Jimage sepconvolve (double []k)
    
This replicates the functionality of the get scaled instance method of the AWT image class.

  public Jimage getScaledInstanceIntel(int nwidth,int nheight )
    
    
     
public Jimage abs()
  


7.0.1  JNI methods implemented in C

native static void intelsq(ImageTransfer a, ImageTransfer result);
native static void intelAbs(ImageTransfer a, ImageTransfer result);
//native static void intelRGB2HSV(ImageTransfer a,ImageTransfer result);
//native static void intelHSV2RGB(ImageTransfer a,ImageTransfer result);
native static double intelNorm(ImageTransfer a, int b);
 
native static void intelResize(ImageTransfer a, ImageTransfer b,
 int xsrc,int ysrc, int xdest,int ydest);

native static void intelDyad(int OP,
  ImageTransfer a,ImageTransfer b,ImageTransfer result);
native static void intelconvolve(ImageTransfer x, 
  ImageTransfer z, int [] kernel, int Kx, int Ky);
native static void intelsepconvolve(ImageTransfer x,
  ImageTransfer z, int [] kernel,int []ykernel, int Kx, int Ky);

native static void intelscalar(int OP,ImageTransfer a,byte b,ImageTransfer result);
native static void intelshift(ImageTransfer a,int b,ImageTransfer result);

static

  
}

Chapter 8
ImageTransfer

package com.c3d.image;

//ImageTransfer.java

The ImageTransfer class is designed to provide a means of passing one plane of data to the intel image processing library for treatment with the MMX hardware.

public class ImageTransfer
{  public int height,width;
	public short data[];	
The data is stored as linear array of shorts for each plane
  public float  fdata[];
  public  int datatype; 
1= byte datatype 2 = short, 4 = float
	public int Start;
The position in the data at which the image origin ( top left ) occurs
	public int Line;
The number of shorts in a single scan line of the image data.
  
  public byte bdata[];
    public ImageTransfer(int dx, int dy, float[] d, int start, int linelen)
  
   public ImageTransfer(int dx, int dy, byte [] d, int start, int linelen)
  
  public ImageTransfer(int dx, int dy, short [] d, int start, int linelen)
  
}


Footnotes:

1 © Turing Institute, 1998


File translated from TEX by TTH, version 1.30.