Skip Headers

Oracle® interMedia Java Classes User's Guide and Reference
Release 9.2
Part No. A96121-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Previous Next

6
OrdImageSignature Reference Information

The OrdImageSignature class is used to represent an instance of the ORDSYS.ORDImageSignature database type in a Java application. The OrdImageSignature class includes a method to generate an image signature, as well as static methods to compare two image signatures.

If your application modifies the OrdImageSignature object, you must perform a SQL update operation to make those changes permanent.


Note :

To take advantage of the increased performance that is possible using image matching with image signature indexes on the underlying tables, use the IMGSimilar and IMGScore SQL operators.

See Oracle interMedia User's Guide and Reference for more information about image signature indexes.


6.1 Prerequisites

You will need to include the following import statements in your Java file to run interMedia 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:

6.2 Reference Information

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


evaluateScore( )

Format

public static float evaluateScore(OrdImageSignature signature1, OrdImageSignature signature2,
String attrWeights)

Description

Compares two image signatures, returning a score that indicates the degree of difference between the image signatures. This method compares the image signatures in signature1 and signature2 using weights specified for one or more visual attributes. Returns a score between 0.0 and 100.0, where a lower value indicates a closer match.

Specify a weight in the range 0.0 to 1.0 for one or more of the following visual attributes: color, shape, texture, location.

You must specify a value greater than 0.0 for at least one of the following attributes: color, shape, or texture. The location attribute indicates the importance of the distribution of the color, shape, or texture features in the images. During processing, the values are normalized such that they total 1.0. For example:

color=0.7,shape-0.3


Note :

The ORDImageSignature evaluateScore( ) method operates on two image signatures, not on indexes on database tables. Therefore, this method cannot take advantage of the increased performance that is possible using image matching with image signature indexes on the underlying tables. To use image signature indexes, use the IMGSimilar and IMGScore SQL operators.

See Oracle interMedia User's Guide and Reference for more information about image signature indexes.


Parameters

signature1

The first OrdImageSignature.

signature2

An OrdImageSignature to be compared to signature1.

attrWeights

A String that specifies a list of one or more visual attributes and the weight to be applied to each attribute.

Return Value

This method returns the score, as a floating-point value.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs calling the evaluateScore( ) method in the database.

Examples

float score = matchObj.evaluateScore(signature1, signature2, "color=1.0");

where:


generateSignature( )

Format

public void generateSignature(OrdImage img)

Description

Generates an image signature for the specified image.

Parameters

img

An OrdImage object from which to generate the signature.

Return Value

None.

Exceptions

SQLException

This exception is thrown if an error occurs calling the generateSignature( ) method in the database.

Examples

matchObj.generateSignature(imgObj);

where:


getFactory( )

Format

public static oracle.sql.CustomDatumFactory getFactory( )

Description

Returns the OrdImageSignature CustomDatumFactory interface for use by the getCustomDatum( ) method. Specify the getFactory( ) method as the factory parameter of the getCustomDatum( ) method when retrieving an OrdImageSignature object from an OracleResultSet or OracleCallableStatement object.

Parameters

None.

Return Value

This method returns the OrdImageSignature implementation of the CustomDatumFactory interface.

Exceptions

None.

Examples

OrdImageSignature sig = (OrdImageSignature)rset.getCustomDatum( 1, OrdImageSignature.getFactory() );


isSimilar( )

Format

public static int isSimilar(OrdImageSignature signature1, OrdImageSignature signature2,
String attrWeights, float threshold)

Description

Compares two image signatures, returning a status that indicates if the degree of difference between the image signatures is within a specified threshold. This method compares the image signatures in signature1 and signature2 using weights specified for one or more visual attributes. The result of the comparison is a score between 0.0 and 100.0, where a lower value indicates a closer match. If the score is less than or equal to the specified threshold, the images are considered a match and the method returns 1; otherwise, the method returns 0.

Specify a weight in the range 0.0 to 1.0 for one or more of the following visual attributes: color, shape, texture, location.

You must specify a value greater than 0.0 for at least one of the following attributes: color, shape, or texture. The location attribute indicates the importance of the distribution of the color, shape, or texture features in the images. During processing, the values are normalized such that they total 1.0. For example:

color=0.7,shape-0.3


Note :

The ORDImageSignature isSimilar( ) method operates on two image signatures, not on indexes on database tables. Therefore, this method cannot take advantage of the increased performance that is possible using image matching with image signature indexes on the underlying tables. To use image signature indexes, use the IMGSimilar and IMGScore SQL operators.

See Oracle interMedia User's Guide and Reference for more information about image signature indexes.


Parameters

signature1

The first OrdImageSignature.

signature2

An OrdImageSignature to be compared to signature1.

attrWeights

A String that specifies a list of one or more visual attributes and the weight to be applied to each attribute.

threshold

A floating-point value that specifies the degree of similarity required for the two images to be considered a match.

Return Value

This method returns an integer value of 1 if the images match; otherwise, it returns 0.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs calling the isSimilar( ) method in the database.

Examples

int i = matchObj.isSimilar(signature1, signature2, "color=0.5,shape=0.5", 10);

where:




Previous Next
Oracle Logo
Copyright © 1999, 2002 Oracle Corporation

All rights reserved
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback