Oracle Visual Information Retrieval Java Classes User's Guide and Reference
Release 8.1.7

Part Number A85333-01

Library

Product

Contents

Index

Go to previous page Go to next page

3
ORDVir Reference Information

Oracle Visual Information Retrieval Java Classes describes the ORDVir object type.

Methods invoked at the ORDVir level that are handed off for processing to the database source plug-in have byte[ ] ctx[ ] as a context parameter. In cases where a client system is connecting to a database server, the space for the parameter is created by the client (in the reference examples, 4000 bytes of space), but the content of the context parameter is generated by the server. The context parameter is passed from the client to the server for the processing of context information.


Note:

In the current release, not all source plug-ins will use or generate the context parameter, but if you include the parameter as previously described, your application should work with any current or future source plug-in. 


See Oracle Visual Information Retreival User's Guide and Reference for more information.

3.1 Prerequisites

You will need to include the following import statements in your Java file to run Visual Information Retrieval methods:

import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
import oracle.sql.*;
import oracle.ord.im.*;

The examples in this reference chapter are based on the assumption that the following operations have already been performed:

For examples of making a connection and populating a local object, see Section 2.2.2.

3.2 Reference Information

This section presents reference information on the methods that operate on ORDVir objects.


analyze( )

Format

public void analyze( )

Description

Sets the value for the application ORDVir object signature attribute based on the image data.

Parameters

None.

Return Value

None.

Exceptions

SQLException

Example

virObj.analyze( );


checkProperties( )

Format

public boolean checkProperties( )

Description

Checks whether or not the properties stored in the media data of the local object are consistent with the attributes of the local object.

Parameters

None.

Return Value

This method returns TRUE if the attribute values stored in the object attributes are the same as the properties stored in the image data; otherwise, this method returns FALSE.

Exceptions

java.sql.SQLException

Example

if(virObj.checkProperties( ))
     System.out.println("checkProperties successful");


clearLocal( )

Format

public void clearLocal( )

Description

Clears the source local field of the application ORDVir object.

Parameters

None.

Return Value

None.

Exceptions

java.sql.SQLException

Example

virObj.clearLocal( );


convert( )

Format

public int convert(String operations)

Description

Converts the application ORDVir object signature data to a format usable on the database server (host) machine.

Parameters

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 order of the host machine, regardless of its initial state. 

Return Value

This method returns 0 if successful; otherwise, this method returns a non-zero integer.

Exceptions

SQLException

Example

int i = virObj.convert("BYTEORDER");
if(i == 0)
     System.out.println("convert successful");

where:


convert( ) (static)

Format

public static int convert(byte[ ] signature, String operations, OracleConnection connection)

Description

Converts the application ORDVir object signature data to a format usable on the database server (host) machine.

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

signature

The signature of the image, as created by the analyze( ) method.

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 order of the host machine, regardless of its initial state. 

connection

An object that represents the connection to the database.

Return Value

This method returns 0 if successful; otherwise, this method returns a non-zero integer.

Exceptions

SQLException

Example

int i = virObj.convert(signature,"BYTEORDER",connection);
if(i == 0)
     System.out.println("convert successful");

where:


copy( )

Format

public void copy(OrdVir dest)

Description

Copies image data from the application ORDVir object source to a destination ORDVir object on the server.

Parameters

dest

The ORDVir object to which the data will be copied.

Return Value

None.

Exceptions

java.sql.SQLException

Example

//create and populate an object named virObj2
virObj.copy(virObj2);

where:


deleteContent( )

Format

public void deleteContent( )

Description

Deletes the media data in the BLOB in the application ORDVir object.

Parameters

None.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.deleteContent( );


export( )

Format

public void export (byte[ ] ctx[ ], String sourceType, String sourceLocation, String sourceName)

Description

Exports the data from the application ORDVir object to the location specified in the parameters. The location is of the form sourceType://sourceLocation/sourceName.

This method will only work if you are running Oracle database release 8.1.7 or higher.

See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

Parameters

ctx[ ]

The source plug-in context information. It is set to NULL if there is no context information.

sourceType

The source type to which the content will be exported. Only "FILE" is natively supported.

sourceLocation

The location on the database server to which the content will be exported.

sourceName

The source name to which the content will be exported.

Return Value

None.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx = new byte[4000][1];
virObj.export(ctx,"FILE","IMAGEDIR","image.gif");

where:


getBFILE( )

Format

public oracle.sql.BFILE getBFILE( )

Description

Gets the BFILE attribute of the application ORDVir object.

Parameters

None.

Return Value

This method returns the BFILE.

Exceptions

java.sql.SQLException

Example

BFILE imageBFILE = virObj.getBFILE( );


getCompressionFormat( )

Format

public String getCompressionFormat( )

Description

Gets the compression format attribute of the application ORDVir object as a String.

Parameters

None.

Return Value

This method returns the compression format attribute, as a String.

Exceptions

java.sql.SQLException

Example

String compression = virObj.getCompressionFormat( );


getContent( )

Format

public oracle.sql.BLOB getContent( )

Description

Gets the LOB locator from the application ORDVir object.

Parameters

None.

Return Value

This method returns the LOB locator of the application object.

Exceptions

java.sql.SQLException

Example

BLOB localContent = virObj.getContent( );


getContentFormat( )

Format

public String getContentFormat( )

Description

Gets the content format attribute of the application ORDVir object as a String.

Parameters

None.

Return Value

This method returns the content format attribute, as a String.

Exceptions

java.sql.SQLException

Example

String format = virObj.getContentFormat( );


getContentLength( )

Format

public int getContentLength( )

Description

Gets the content length of the media data in the application ORDVir object.

Parameters

None.

Return Value

This method returns the content length of the media data, in bytes.

Exceptions

java.sql.SQLException

Example

int length = virObj.getContentLength( );


getDataInByteArray( )

Format

public byte[ ] getDataInByteArray( )

Description

Gets data from the LOB locator of the application ORDVir object and puts it in a local byte array.

Parameters

None.

Return Value

This method returns the byte array from which the data will be read.

Exceptions

java.sql.SQLException

java.io.IOException

java.lang.OutOfMemoryError

Example

byte[ ] byteArr = virObj.getDataInByteArray( );


getDataInFile( )

Format

public boolean getDataInFile(String filename)

Description

Gets data from the LOB locator of the application ORDVir object and puts it in a local file.

Parameters

filename

The name of the file that the data will be downloaded into.

Return Value

This method returns TRUE if loading is successful; otherwise, this method returns FALSE.

Exceptions

java.sql.SQLException

java.io.IOException

Example

boolean load = virObj.getDataInFile("output1.dat");
if(load)
     System.out.println("getDataInFile completed successfully");
else
     System.out.println("Error in getDataInFile");

where:


getDataInStream( )

Format

public InputStream getDataInStream( )

Description

Gets data from the LOB locator of the application ORDVir object and puts it in a local input stream.

Parameters

None.

Return Value

This method returns the input stream from which the data will be read.

Exceptions

java.sql.SQLException

Example

InputStream inpStream = virObj.getDataInStream( );


getFormat( )

Format

public String getFormat( )

Description

Gets the format attribute of the application ORDVir object as a String.

Parameters

None.

Return Value

This method returns the format attribute as a String.

Exceptions

java.sql.SQLException

Example

String format = virObj.getFormat( );


getHeight( )

Format

public int getHeight( )

Description

Gets the height of the application ORDVir object.

Parameters

None.

Return Value

This method returns the height of the ORDVir object, in pixels.

Exceptions

java.sql.SQLException

Example

int height = virObj.getHeight( );


getImage( )

Format

public OrdImage getImage( )

Description

Gets the application ORDVir object ORDImage object information.

Parameters

None.

Return Value

This method returns the ORDImage object.

Exceptions

java.sql.SQLException

Example

ORDImage imgObj = virObj.getImage( );


getMimeType( )

Format

public String getMimeType( )

Description

Gets the MIME type of the application ORDVir object as a String.

Parameters

None.

Return Value

This method returns the MIME type of the ORDVir object, as a String.

Exceptions

java.sql.SQLException

Example

String mime = virObj.getMimeType( );


getSignature( )

Format

public byte[ ] getSignature( )

Description

Gets the signature of the application ORDVir object.

Parameters

None.

Return Value

This method returns the signature of the application ORDVir object.

Exceptions

java.sql.SQLException

Example

byte[ ] sig = virObj.getSignature( );


getSource( )

Format

public String getSource( )

Description

Gets the application ORDVir object source information, including the source location, name, and type.

Parameters

None.

Return Value

This method returns a String containing the object source information.

Exceptions

java.sql.SQLException

Example

String sourceName = virObj.getSource( );


getSourceLocation( )

Format

public String getSourceLocation( )

Description

Gets the application ORDVir object source location as a String.

Parameters

None.

Return Value

This method returns a String containing the object source location.

Exceptions

java.sql.SQLException

Example

String location = virObj.getSourceLocation( );


getSourceName( )

Format

public String getSourceName( )

Description

Gets the application ORDVir object source name as a String.

Parameters

None.

Return Value

This method returns a String containing the object source name.

Exceptions

java.sql.SQLException

Example

String name = virObj.getSourceName( );


getSourceType( )

Format

public String getSourceType( )

Description

Gets the application ORDVir object source location as a String.

Parameters

None.

Return Value

This method returns a String containing the object source type.

Exceptions

java.sql.SQLException

Example

String type = virObj.getSourceType( );


getUpdateTime( )

Format

public java.sql.Timestamp getUpdateTime( )

Description

Gets a Timestamp object that contains information on when the application ORDVir object was most recently updated.

Parameters

None.

Return Value

This method returns a Timestamp object that contains the time of the most recent update.

Exceptions

java.sql.SQLException

Example

Timestamp time = virObj.getUpdateTime( );


getWidth( )

Format

public int getWidth( )

Description

Gets the width of the application ORDVir object.

Parameters

None.

Return Value

This method returns the width of the ORDVir object, in pixels.

Exceptions

java.sql.SQLException

Example

int width = virObj.getWidth( );


importData( )

Format

public void importData(byte[ ] ctx[ ])

Description

Imports data from an external source into the application ORDImage object.

The srcType, srcLocation, and srcName attributes must all be defined for this method to work.

Parameters

ctx[ ]

The source plug-in context information. It is set to NULL if there is no context information.

Return Value

None.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx = new byte[4000][1];
virObj.importData(ctx)

where:


importFrom( )

Format

public void importFrom(byte[ ] ctx[ ], String sourceType, String sourceLocation, String sourceName)

Description

Imports data from an external source into the application ORDVir object. The location of the external source is of the form sourceType://sourceLocation/sourceName.

Parameters

ctx[ ]

The source plug-in context information. See Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

sourceType

The source type from which the data will be imported.

sourceLocation

The source location from which the data will be imported.

sourceName

The source name from which the data will be imported.

Return Value

None.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx = new byte[4000][1];
virObj.importFrom("FILE","IMAGEDIR","testimg.dat");

where:


isLocal( )

Format

public boolean isLocal( )

Description

Checks if the application ORDVir object local attribute is set.

Parameters

None.

Return Value

This method returns TRUE if the ORDVir object local attribute is set; otherwise, this method returns FALSE.

Exceptions

java.sql.SQLException

Example

if(virObj.isLocal( ))
     System.out.println("local attribute is true");
else
     System.out.println("local attribuite is false");


loadDataFromByteArray( )

Format

public boolean loadDataFromByteArray(byte[ ] byteArr)

Description

Loads data from the local byte buffer into the database ORDVir object LOB locator and into the application object. It also calls setLocal( ), which sets the local field of the application ORDVir object, but not the database object, and setUpdateTime(null), which sets the updateTime attribute to the SYSDATE of the database server.

Parameters

byteArr

The name of the local byte array from which to load data.

Return Value

This method returns TRUE if loading is successful; otherwise, this method returns FALSE.

Exceptions

java.sql.SQLException

java.io.IOException

Example

byte[ ] data = new byte[32000];
FileInputStream fStream = new FileInputStream("testimg.dat");
fStream.read(data,0,32300);
boolean success = virObj.loadDataFromByteArray(data);
if(success)
     System.out.println("loadDataFromByteArray was successful");
else
     System.out.println("loadDataFromByteArray was unsuccessful");

where:


loadDataFromFile( )

Format

public boolean loadDataFromFile(String filename)

Description

Loads data from the local file into the database ORDVir object LOB locator and into the application object. It also calls setLocal( ), which sets the local field of the application ORDVir object, but not the database object, and setUpdateTime(null), which sets the updateTime attribute to the SYSDATE of the database server.

Parameters

filename

The name of the local file from which to load data.

Return Value

This method returns TRUE if loading is successful; otherwise, this method returns FALSE.

Exceptions

java.sql.SQLException

java.io.IOException

Example

virObj.loadDataFromFile("testimg.dat");

where:


loadDataFromInputStream( )

Format

public boolean loadDataFromInputStream(InputStream inpStream)

Description

Loads data from the local input stream into the database ORDVir object LOB locator and into the application object. It also calls setLocal( ), which sets the local field of the application ORDVir object, but not the database object, and setUpdateTime(null), which sets the updateTime attribute to the SYSDATE of the database server.

Parameters

inpStream

The name of the local input stream from which to load data.

Return Value

This method returns TRUE if loading is successful; otherwise, this method returns FALSE.

Exceptions

java.sql.SQLException

java.io.IOException

Example

FileInputStream fStream = new FileInputStream("testimg.dat");
virObj.loadDataFromInputStream(fStream);

where:


OrdVir( )

Format

public OrdVir( )

Description

Creates an ORDVir object.

This method is the default ORDVir constructor.

Parameters

None.

Return Value

None.

Exceptions

None.

Example

None.


process( )

Format

public void process(String command)

Description

Executes a given command on the application ORDVir object.

For more information on the commands that can be processed, see Oracle8i interMedia Audio, Image, and Video User's Guide and Reference.

Parameters

command

The command to be executed.

Return Value

None.

Exceptions

java.sql.SQLException

Example

virObj.process("fileFormat=JFIF");

where:


processCopy( )

Format

public void processCopy(String command, OrdVir dest)

Description

Copies data from the application ORDVir object to a destination ORDVir object and modifies the copy according to the specified command.

Parameters

command

The command to be executed.

dest

The object that will receive the results of the command.

Return Value

None.

Exceptions

java.sql.SQLException

Example

//create and populate an OrdVir object named virObj2
virObj.processCopy("maxScale=32 32, fileFormat= GIFF", virObj2);

where:


score( )

Format

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

Description

Compares the image signature of the application ORDVir object to the signature stored in signature2 using the weights stored in attrWeights.

Parameters

signature2

The signature to be compared with the signature of the application ORDVir object.

attrWeights

A list of weights to apply to each visual attribute. The following attributes can be specified. You must specify a value greater than 0.0 for at least one attribute. There is no mandatory value that the weights must add to; however, it is recommended that you ensure that you are consistent with the total used in your application. The visual attributes are the following:

Attribute  Description 

globalcolor 

The weight value assigned to the global color visual attribute.
Data type is String.
Default is 0.0. 

localcolor 

The weight value assigned to the local color visual attribute.
Data type is String.
Default is 0.0. 

texture 

The weight value assigned to the texture visual attribute.
Data type is String.
Default is 0.0. 

structure 

The weight value assigned to the structure visual attribute.
Data type is String.
Default is 0.0. 

Return Value

This method returns the score, which is a value between 0.0 and 100.0.

Exceptions

java.sql.SQLException

Example

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

where:


score( ) (static)

Format

public static float score(byte[ ] signature1, byte[ ] signature2, String attrWeights,
OracleConnection connection)

Description

Compares the image signature stored in signature1 to the signature stored in signature2 using the weights stored 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

The first signature.

signature2

The second signature, which will be compared to signature1.

attrWeights

A list of weights to apply to each visual attribute. The following attributes can be specified. You must specify a value greater than 0.0 for at least one attribute. There is no mandatory value that the weights must add to; however, it is recommended that you ensure that you are consistent with the total used in your application. The visual attributes are the following:

Attribute  Description 

globalcolor 

The weight value assigned to the global color visual attribute.
Data type is String.
Default is 0.0. 

localcolor 

The weight value assigned to the local color visual attribute.
Data type is String.
Default is 0.0. 

texture 

The weight value assigned to the texture visual attribute.
Data type is String.
Default is 0.0. 

structure 

The weight value assigned to the structure visual attribute.
Data type is String.
Default is 0.0. 

connection

An object that represents the connection to the database.

Return Value

This method returns the score, which is a value between 0.0 and 100.0.

Exceptions

java.sql.SQLException

Example

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

where:


setCompressionFormat( )

Format

public void setCompressionFormat(String CompressionFormat)

Description

Sets the compression format attribute of the application ORDVir object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). This method will set only the attribute value; it does not change the media file itself.

Parameters

CompressionFormat

The compression format to be set.

Return Value

None.

Exceptions

java.sql.SQLException

Example

None.


setContentFormat( )

Format

public void setContentFormat(String ContentFormat)

Description

Sets the content format attribute of the application ORDVir object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). This method will set only the attribute value; it does not change the media file itself.

Parameters

ContentFormat

The content format to be set.

Return Value

None.

Exceptions

java.sql.SQLException

Example

None.


setContentLength( )

Format

public void setContentLength(int newContentLength)

Description

Sets the content length of the media data in the application ORDVir object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). This method will set only the attribute value; it does not change the media file itself.

Parameters

newContentLength

The new content length to be set, in bytes.

Return Value

None.

Exceptions

java.sql.SQLException

Example

None.


setFormat( )

Format

public void setFormat(String Format)

Description

Sets the format attribute of the application ORDVir object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). This method will set only the attribute value; it does not change the media file itself.

Parameters

Format

The format of the contents of the ORDVir object, as a String object.

Return Value

None.

Exceptions

java.sql.SQLException

Example

None.


setHeight( )

Format

public void setHeight(int newHeight)

Description

Sets the height of the application ORDVir object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). This method will set only the attribute value; it does not change the media file itself.

Parameters

newHeight

The new height to be set, in pixels.

Return Value

None.

Exceptions

java.sql.SQLException

Example

virObj.setHeight(24);

where:


setImage( )

Format

public void setImage(OrdImage image)

Description

Sets the ORDImage object in the application ORDVir object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). This method will set only the attribute value; it does not change the media file itself.

Parameters

image

The ORDImage object to be set.

Return Value

None.

Exceptions

java.sql.SQLException

Example

//create and populate an OrdImage object named imgObj
virObj.setImage(imgObj);

where:


setLocal( )

Format

public void setLocal( )

Description

Sets the source local field of the application ORDVir object.

Parameters

None

Return Value

None.

Exceptions

java.sql.SQLException

Example

virObj.setLocal( );


setMimeType( )

Format

public void setMimeType(String MimeType)

Description

Sets the MIME type of the application ORDVir object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). This method will set only the attribute value; it does not change the media file itself.

Parameters

MimeType

The MIME type of the contents of the ORDVir object, as a String.

Return Value

None.

Exceptions

java.sql.SQLException

Example

virObj.setMimeType("image/bmp");

where:


setProperties( )

Format

public void setProperties( )

Description

Reads the image data, extracts attributes, and sets the application ORDVir object attributes according to the values stored in the content data header.

The properties to be set include height, width, data size of the on-disk image, file type, image type, compression type, and MIME type.

Parameters

None.

Return Value

None.

Exceptions

java.sql.SQLException

Example

virObj.setProperties( );

setProperties(String)

Format

public void setProperties(String command)

Description

Sets the application ORDVir object attributes according to the values stored in the given String. This method is used for foreign image files. The properties that can be set are listed in Oracle8i interMedia Audio, Image, and Video User's Guide and Reference.

Parameters

command

The object attribute values to be set.

Return Value

None.

Exceptions

java.sql.SQLException

Example

String properties = "width=123 height=321 compressionformat=NONE 
     userString=DJM dataOffset=128 scanlineorder=INVERSE 
     pixelorder=REVERSE interleaving=BIL numberOfBands=1 
     defaultChannelSelection=1";
virObj.setProperties(properties);

where:


setSignature( )

Format

public void setSignature(byte[ ] signature)

Description

Sets the signature of the application ORDVir object. This signature must be generated by the analyze( ) method.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). This method will set only the attribute value; it does not change the media file itself.

Parameters

signature

The signature to be set.

Return Value

None.

Exceptions

java.sql.SQLException

Example

virObj.setSignature(imgSignature);

where:


setSource( )

Format

public void setSource(String sourceType, String sourceLocation, String sourceName)

Description

Sets the application ORDVir object source information.

Parameters

sourceType

The type of the source.

sourceLocation

The location of the source.

sourceName

The name of the source.

Return Value

None.

Exceptions

java.sql.SQLException

Example

virObj.setSource("FILE","IMAGEDIR","jdoe.gif");

where:


setUpdateTime( )

Format

public void setUpdateTime(java.sql.Timestamp currentTime)

Description

Sets the update time in the application ORDVir object to the current time.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). This method will set only the attribute value; it does not change the media file itself.

Parameters

currentTime

The current time, which will be set in the ORDVir object. This value should be set to null; the method will then use the system date (SYSDATE) of the database server.

Return Value

None.

Exceptions

java.sql.SQLException

Example

virObj.setUpdateTime(null);

setWidth( )

Format

public void setWidth(int newWidth)

Description

Sets the width of the application ORDVir object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). This method will set only the attribute value; it does not change the media file itself.

Parameters

newWidth

The width to be set, in pixels.

Return Value

None.

Exceptions

java.sql.SQLException

Example

virObj.setWidth(24);

where:


similar( )

Format

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

Description

Compares the image signatures in the application ORDVir object and signature2, using the weights provided. If the result of the comparison is less than or equal to the provided threshold, the images are considered a match.

Parameters

signature2

The signature to be compared to the signature of the application ORDVir object.

attrWeights

A list of weights to apply to each visual attribute. The following attributes can be specified. You must specify a value greater than 0.0 for at least one attribute. There is no mandatory value that the weights must add to; however, it is recommended that you ensure that you are consistent with the total used in your application. The visual attributes are the following:

Attribute  Description 

globalcolor 

The weight value assigned to the global color visual attribute.
Data type is String.
Default is 0.0. 

localcolor 

The weight value assigned to the local color visual attribute.
Data type is String.
Default is 0.0. 

texture 

The weight value assigned to the texture visual attribute.
Data type is String.
Default is 0.0. 

structure 

The weight value assigned to the structure visual attribute.
Data type is String.
Default is 0.0. 

threshold

The value that must be attained to be considered a match.

Return Value

This method returns 1 if the images match; otherwise, this method returns 0.

Exceptions

java.sql.SQLException

Example

int i = virObj.similar(signature2, "localcolor=1.0", 10);

where:


similar( ) (static)

Format

public static int similar(byte[ ] signature1, byte[ ] signature2, String attrWeights, float threshold,
OracleConnection connection)

Description

Compares the image signatures in signature1 and signature2, using the weights provided. If the result of the comparison is less than or equal to the provided threshold, the images are considered a match.

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

The first signature.

signature2

The second signature, which will be compared to signature1.

attrWeights

A list of weights to apply to each visual attribute. The following attributes can be specified. You must specify a value greater than 0.0 for at least one attribute. There is no mandatory value that the weights must add to; however, it is recommended that you ensure that you are consistent with the total used in your application. The visual attributes are the following:

Attribute  Description 

globalcolor 

The weight value assigned to the global color visual attribute.
Data type is String.
Default is 0.0. 

localcolor 

The weight value assigned to the local color visual attribute.
Data type is String.
Default is 0.0. 

texture 

The weight value assigned to the texture visual attribute.
Data type is String.
Default is 0.0. 

structure 

The weight value assigned to the structure visual attribute.
Data type is String.
Default is 0.0. 

threshold

The value that must be attained to be considered a match.

connection

An object that represents the connection to the database.

Return Value

This method returns 1 if the images match; otherwise, this method returns 0.

Exceptions

java.sql.SQLException

Example

int i = virObj.similar(signature1, signature2, "localcolor=1.0", 10, 
     connection);

where:


Go to previous page Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index