Oracle8i Visual Information Retrieval Java Client User's Guide and Reference
Release 8.1.5

A67300-01

Library

Product

Contents

Index

Prev Next

2
OrdVir Class Library

The Oracle8i Visual Information Retrieval Java Client class library contains information about the OrdVir object type:

The OrdVir object type and class library are based on the OrdImage object type, which are, in turn, based on the OrdMultiMedia object type. OrdMultiMedia contains the OrdSource object type. This guide describes only information unique to the Visual Information Retrieval product. Any inherited methods or other characteristics are discussed in their own documentation.

The Oracle8i interMedia Audio, Image, and Video Java Client User's Guide and Reference describes the OrdImage, OrdMultiMedia, and OrdSource object types.

2.1 OrdVir Object Type

The OrdVir object type supports the storage and management of image data.


Note:

In the following code, some methods will begin with "public". This indicates that the method can be called by all classes in all packages. Methods that begin with "protected" are visible to all classes in the package, plus all subclasses.  


This object type is defined by Oracle8i Visual Information Retrieval as follows:


package oracle.ord.media;

import java.sql.*;

import java.io.*;

import oracle.jdbc.driver.*;

import oracle.sql.*;

import oracle.ord.media.*;



public class OrdVir extends OrdImage {



// OrdVir class attribute

byte[] signature;



// OrdVir Default Constructor

public OrdVir() {}

 

public OrdVir(Connection connection)

{  }



int bindInSQLParams(int start, OracleCallableStatement stmt)

throws SQLException

{  }



String defineSQLResults(String var)

{  }



int declareSQLResults(int start, OracleCallableStatement stmt)

throws SQLException

{  }



String setSQLParams(String var)

{  }



int getSQLResults(int start, OracleCallableStatement stmt)

throws SQLException

{  }



String getMediaType()

{  }



String getFormatStr()

{  }



String getUpdStr()

{  }



String getSourceStr()

{  }



String getContentLengthAPI()

{  }



public void refresh(boolean forUpdate) throws SQLException

{  }



public void flush() throws SQLException

  {  }



public void analyze() throws SQLException

{  }



public int similar(byte [] signature2, String attrWeights, float threshold) 

throws SQLException

{  }



public float score(byte [] signature2, String attrWeights) 

throws SQLException

{  }



public int convert(String operations) 

throws SQLException

{  }



// Vir Operators:

public static int similar(byte [] signature1, byte [] signature2,

                          String attrWeights, float threshold,

                          Connection connection)

throws SQLException

{  }



public static float score(byte [] signature1, byte [] signature2,

                          String attrWeights, Connection connection)

throws SQLException

{  }



public static int convert(byte [] signature, String operations,
Connection connection) throws SQLException { } // Accessor functions for local OrdVir attributes public byte[] getSignature() throws SQLException { } public void setSignature(byte[] value) throws SQLException { } }

Where the base image attributes included from OrdImage.java are defined as follows:

Three additional attributes of special note are defined in the included files, oracle.ord.media.*:

See Oracle8i interMedia Audio, Image, and Video Java Client User's Guide and Reference for information about the oracle.ord.media.* files and the OrdMultiMedia abstract class.

2.2 Methods

This section presents OrdVir reference information on the methods used for image data manipulation.

The OrdVir methods are described in the following groupings:

OrdVir Methods for Visual Information Retrieval

OrdVir Methods for Communication Between the Client and Server

2.2.1 Inherited Methods

The following methods are inherited through the OrdMultiMedia package. See Oracle8i interMedia Audio, Image, and Video Java Client User's Guide and Reference for further information on these methods.

OrdVir Methods Associated with Image Attributes

OrdVir Methods Associated with the Source Attribute

OrdVir Methods Associated with Properties Set and Check Operations

OrdVir Methods Associated with Copy Operations

OrdVir Methods Associated with Processing Image Data

OrdVir Methods Associated with the Media Type

OrdVir Methods Associated with Locking

OrdVir Methods Associated with the SQL Type

OrdVir Methods Associated with Generating SQL Queries

2.2.2 OrdVir Methods for Visual Information Retrieval

This section presents reference information on the OrdVir methods associated directly with visual information retrieval.

The methods described in this chapter show examples based on the instantiation of an OrdVir object. For the examples in this section, please consult the following Java code:


import oracle.ord.media.mediaClass;



public class clientProgram {

     public static void main(String[] args){

          The code in the examples should be placed here.

     }

}

In each example, the parameter connection is a connection to an Oracle8i database.


analyze Method

Format


public void analyze( ) 

throws SQLException

Scope

public

Description

Sets the value for both the server- and client-side signature attributes based on the image data.

Parameter

None.

Returns

None.

Exception

java.sql.SQLException

Usage


try{

     OrdVir  imageObj = new OrdVir (connection);

     .

     .

     .

     imageObj.analyze();

   }

catch(SQLException e){

     .

     .

     .

 }


convert Method

Format


public int convert(string operations) 

throws SQLException

Scope

public

Description

Converts the server-side signature data to a format usable on the database server (host) machine.

Parameter

operations

The type of processing done to the image signature. The following operations are available:

Operation Keyword   Description  

BYTEORDER  

Converts the signature to the natural byte order of the host machine.  

VIISAGE  

Converts the signature from the format used for Viisage facial image recognition to a signature usable by the score( ) and similar( ) operators.  

Returns

None.

Exception

java.sql.SQLException

Usage

When the operation is BYTEORDER, the signature is converted to the format of the host machine regardless of its initial state.

This method is useful if your signature data was created on a system with a different byte order than the system to which you are currently bound (the system where you intend to perform similar( ) and score( ) operations). If your host machine is from Sun Microsystems, Inc., the Convert( ) operator sets the signature to the big endian byte order. On an Intel Corporation machine, the operator converts the signature to the little endian byte order. Note that the images themselves are system-independent; only the signatures need to be converted.

When the operator is VIISAGE, the signature is converted from the format used by Viisage Technology for facial image recognition to the format usable by this product for score and similar operations.




try{

     OrdVir  imageObj = new OrdVir (connection);

     .

     .

     .

     ImageObj.convert("BYTEORDER");

   }

catch(SQLException e){

     .

     .

     .

     }


convert Method (static)

Format


public static int convert(byte []    signature,

                          string     operations,

                          connection connection ) 

throws SQLException

Scope

public

Description

Converts the client-side signature data to a format usable on the host machine. This is a static function not within the context of a particular image object.

Unlike the non-static version of this function, the static function can directly operate on signature data without any instance of an OrdVir object.

Parameters

signature

The signature of the image, as created by the analyze( ) method or by Viisage software. Data type is RAW(2000).

operation

The type of processing done to the image signature. The following operations are available:

Operation Keyword   Description  

BYTEORDER  

Converts the signature to the natural byte order of the host machine.  

VIISAGE  

Converts the signature from the format used for Viisage facial image recognition to a signature usable by the score( ) and similar( ) operators.  

connection

An object representing a connection to the server.

Returns

None.

Exception

java.sql.SQLException

Usage

When the operation is BYTEORDER, the signature is converted to the format of the host machine regardless of its initial state.

If your host machine is from Sun Microsystems, Inc., the Convert( ) operator sets the signature to the big endian byte order. On an Intel Corporation machine, the operator converts the signature to the little endian byte order. Note that the images themselves are system-independent; only the signatures need to be converted.

When the operator is VIISAGE, the signature is converted from the format used by Viisage Technology for facial image recognition to the format usable by this product for score( ) and similar( ) operations.


try{

     byte[] imgSignature = new byte[2000];

     .

     .

     .

     OrdVir.convert(imgSignature,"BYTEORDER",connection);

   }

catch(SQLException e){

     .

     .

     .

     }


score Method

Format


public float score(byte [] cmpSignature,

                   string  attrWeights) 

throws SQLException

Scope

public

Description

Compares the client-side image signature of the current OrdVir object to the cmpSignature signature using the weights provided in attrWeights.

Parameters

cmpSignature

The signature of the comparison image.

attrWeights

A list of weights to apply to each visual attribute. Data type is VARCHAR2. The following attributes can be specified, with a value of 0.0 specifying no importance and a value of 1.0 specifying highest importance. You must specify a value greater than zero for at least one of the attributes. The facial attribute is not compatible with any other attributes.

Attribute   Description  

globalcolor  

The weight value (0.0 to 1.0) assigned to the global color visual attribute.
Data type is NUMBER.
Default is 0.0.  

localcolor  

The weight value (0.0 to 1.0) assigned to the local color visual attribute.
Data type is NUMBER.
Default is 0.0.  

texture  

The weight value (0.0 to 1.0) assigned to the texture visual attribute. Data type is NUMBER.
Default is 0.0.  

structure  

The weight value (0.0 to 1.0) assigned to the structure visual attribute.
Data type is NUMBER.
Default is 0.0.  

facial  

A value of 1 indicates that this is a facial signature.
Data type is NUMBER.
Default is 0.0.  


Note:

When specifying parameter values that include floating-point numbers, you should use double quotation marks (" ") around the value. If you do not, this may result in incorrect values being passed, and you will get incorrect results.  


Returns

A floating-point number between 0.0 and 100.0, representing the weighted sum of the distances between the visual attributes.

Exception

java.sql.SQLException

Usage

The connection string of the two image objects must be the same.


try{

     byte signature2 = new byte[2000];

     .

     .

     .

     float score= OrdVir.score(signature2, "localcolor=1.0",connection);

   }

catch(SQLException e){

     .

     .

     .   }


score Method (static)

Format


public static float score(byte []    signature1,

                          byte []    signature2,

                          string     attrWeights

                          connection connection) 

throws SQLException

Scope

public

Description

Compares two client-side image signatures using the weights provided in
attrWeights.

Unlike the non-static version of this function, the static function can directly operate on signature data without an instance of an OrdVir object.

Parameters

signature1, signature2

The signatures of the two images.

attrWeights

A list of weights to apply to each visual attribute. Data type is VARCHAR2. The following attributes can be specified, with a value of 0.0 specifying no importance and a value of 1.0 specifying highest importance. You must specify a value greater than zero for at least one of the attributes. The facial attribute is not compatible with any other attributes

Attribute   Description  

globalcolor  

The weight value (0.0 to 1.0) assigned to the global color visual attribute.
Data type is NUMBER.
Default is 0.0.  

localcolor  

The weight value (0.0 to 1.0) assigned to the local color visual attribute.
Data type is NUMBER.
Default is 0.0.  

texture  

The weight value (0.0 to 1.0) assigned to the texture visual attribute. Data type is NUMBER.
Default is 0.0.  

structure  

The weight value (0.0 to 1.0) assigned to the structure visual attribute.
Data type is NUMBER.
Default is 0.0.  

facial  

A value of 1 indicates that this is a facial signature.
Data type is NUMBER.
Default is 0.0.  

connection

An object representing a connection to the server.

Returns

A floating-point number between 0.0 and 100.0, representing the weighted sum of the distances between the visual attributes.

Exception

java.sql.SQLException

Usage


Note:

When specifying parameter values that include floating-point numbers, you should use double quotation marks (" ") around the value. If you do not, this may result in incorrect values being passed, and you will get incorrect results.  


The connection string of the two image objects must be the same.


try{

     byte signature1 = new byte[2000];

     byte signature2 = new byte[2000];

     .

     .

     .

     float score= OrdVir.score(signature1,signature2,
"localcolor=1.0",connection); } catch(SQLException e){ . . . }

similar Method

Format


public int similar( byte [] cmpSignature, 

                    string  attrWeights, 

                    float   threshold) 

throws SQLException

Scope

public

Description

Compares the current client-side image to a signature provided in cmpSignature, using the weights provided in attrWeights.

Parameters

cmpSsignature

The signature of the image stored in cmpImg.

attrWeights

A list of weights to apply to each visual attribute. Data type is VARCHAR2. The following attributes can be specified, with a value of 0.0 specifying no importance and a value of 1.0 specifying highest importance. You must specify a value greater than zero for at least one of the attributes. The facial attribute is not compatible with any other attributes.

Attribute   Description  

globalcolor  

The weight value (0.0 to 1.0) assigned to the global color visual attribute.
Data type is NUMBER.
Default is 0.0.  

localcolor  

The weight value (0.0 to 1.0) assigned to the local color visual attribute.
Data type is NUMBER.
Default is 0.0.  

texture  

The weight value (0.0 to 1.0) assigned to the texture visual attribute. Data type is NUMBER.
Default is 0.0.  

structure  

The weight value (0.0 to 1.0) assigned to the structure visual attribute.
Data type is NUMBER.
Default is 0.0.  

facial  

A value of 1 indicates that this is a facial signature.
Data type is NUMBER.
Default is 0.0.  

connection

An object representing a connection to the server.

threshold

The threshold value with which the weighted sum of the distances is to be compared. If the weighted sum is less than or equal to the threshold value, the images are considered to match. The range of this parameter is from 0.0 to 100.0.

Returns

The result of the comparison. If the result is less than or equal to the threshold, this method returns 1. Otherwise, this method returns 0.

Exception

java.sql.SQLException

Usage


try{

     OrdVir  imageObj = new OrdVir (connection);

     byte    signature2 = new byte[2000];

     .

     .

     .

     int result = imageObj.similar(signature2, "localcolor=1.0",connection, 10);

   }

catch(SQLException e){

     .

     .

     .

     }


similar Method (static)

Format


public static int similar( byte []    signature1,

                           byte []    signature2, 

                           string     attrWeights, 

                           float      threshold

                           connection connection) 

throws SQLException

Scope

public

Description

Compares the two client-side image signatures using the weights provided in attrWeights.

Unlike the non-static version of this function, the static function can directly operate on signature data without an instance of an OrdVir object.

Parameters

signature1, signature2

The signatures of the images to be compared.

attrWeights

A list of weights to apply to each visual attribute. Data type is VARCHAR2. The following attributes can be specified, with a value of 0.0 specifying no importance and a value of 1.0 specifying highest importance. You must specify a value greater than zero for at least one of the attributes. The facial attribute is not compatible with any other attributes.

Attribute   Description  

globalcolor  

The weight value (0.0 to 1.0) assigned to the global color visual attribute.
Data type is NUMBER.
Default is 0.0.  

localcolor  

The weight value (0.0 to 1.0) assigned to the local color visual attribute.
Data type is NUMBER.
Default is 0.0.  

texture  

The weight value (0.0 to 1.0) assigned to the texture visual attribute. Data type is NUMBER.
Default is 0.0.  

structure  

The weight value (0.0 to 1.0) assigned to the structure visual attribute.
Data type is NUMBER.
Default is 0.0.  

facial  

A value of 1 indicates that this is a facial signature.
Data type is NUMBER.
Default is 0.0.  

threshold

The threshold value with which the weighted sum of the distances is to be compared. If the weighted sum is less than or equal to the threshold value, the images are considered to match. The range of this parameter is from 0.0 to 100.0.

connection

An object representing a connection to the server.

Returns

The result of the comparison. If the result is less than or equal to the threshold, this method returns 1. Otherwise, this method returns 0.

Exception

java.sql.SQLException

Usage


try{

     OrdVir  imageObj = new OrdVir (connection);

     byte    signature1 = new byte[2000];

     byte    signature2 = new byte[2000];

     .

     .

     .

     int result = imageObj.similar(signature1, signature2, 
"localcolor=1.0",connection, 10); } catch(SQLException e){ . . . }

getSignature Method

Format


public byte [] getSignature( ) 

throws SQLException

Scope

public

Description

Reads the signature of the OrdVir object stored on the client side.

Parameter

None.

Returns

Returns the signature of the OrdVir object stored on the client side .

Exception

java.sql.SQLException

Usage


try{

     OrdVir  imageObj = new OrdVir (connection);  

     .

     .

     .

     byte[] imgSignature = imageObj.getSignature();

   }

catch(SQLException e){

     .

     .

     .

     }


setSignature Method

Format


public void setSignature(byte [] value) 

throws SQLException

Scope

public

Description

Sets the signature field of the client OrdVir object. The signature value must be generated by either the analyze( ) method or Viisage software.

Parameter

None.

Returns

None.

Exception

java.sql.SQLException

Usage


try{

     OrdVir  imageObj = new OrdVir (connection);

     byte[]  imgSignature = new byte[2000];

     .

     .

     .

     imageObj.setSignature(imgSignature);

   }

catch(SQLException e){

     .

     .

     .

     }



2.2.3 OrdVir Methods for Communication Between the Client and Server

This section presents reference information on the OrdVir methods associated with the communication between the client and server.

The methods described in this section show examples based on the instantiation of an OrdVir object. For the examples in this section, please consult the following Java code:


import oracle.ord.media.mediaClass;



public class clientProgram {

     public static void main(String[] args){

          The code in the examples should be placed here.

     }

}



In each example, the parameter connection is a connection to an Oracle8i database.


flush( ) Method

Format


public void flush()

throws SQLException

Scope

public

Description

Sends information from the client-side OrdVir object to the server-side OrdVir object.

Parameter

None.

Returns

None.

Exception

java.sql.SQLException

Usage


try{

     OrdVir imageObj = new OrdVir(connection);

     .

     .

     .

     imageObj.flush();

}

catch(SQLException e){

     .

     .

     .

}


refresh( ) Method

Format


public void refresh(boolean forUpdate)

throws SQLException

Scope

public

Description

Sends information from the server-side OrdVir object to the client-side OrdVir object with or without locking the database row.

Parameter

forUpdate

Indicates whether or not the option is selected to be updated. It is set to true if it is selected to be updated; false otherwise.

Returns

None.

Exception

java.sql.SQLException

Usage


try{

     OrdVir imageObj = new OrdVir(connection);

     .

     .

     .

     imageObj.refresh(false);

}

catch(SQLException e){

     .

     .

     .

}

where:




Prev

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index