Skip to content

RetrievalClient: search image

Loïc Rollus edited this page Dec 2, 2014 · 2 revisions

Search image

An indexer is a little client that add/delete pictures on a specific server. The indexer can purge, list images and storages too.

Presentation

A client can be use to search for similar images on a set of servers. The client read the image (from file, url, java object,...), process the image and search on each server. It must ask the maximum number of images in the result and it may ask to search only on some storages.s.

Execute

./client configfile servers image max

./client configfile servers image max storages

Example:

./client configClient.properties localhost:1234; localhost:1235 search.jpg 10 

./client configClient.properties servers.xml search.jpg 10 storage1,storage2

Parameters/Config

index name description type
0 configfile Path to the config file String
1 servers Servers may be a string like this 'host1:port,host2:port,...' or may be the path to a xml servers file String
2 image Path to the image String
3 max Max results for the search Integer
4 (Optional) storages Search only on these storages. Use storage1,storage2,... String

The config file contains:

name description example
NUMBEROFPATCH Number of patch for each request image (hight = better quality, less = improve speed) 1000
NUMBEROFTV Number of test vectors (max 50; hight = better quality, less = improve speed) 5
VECTORPATH Path for test vectors testsvectors/
SIZEOFPATCHRESIZEWIDTH Max width for windows 16
SIZEOFPATCHRESIZEHEIGHT Max height for windows 16
TIMEOUT Timeout for server communication (0 = no timeout) 0
RESIZEMETHOD Type of resize method for patches (1=BILL/Graphics2D, 2=PPV/Graphics2D, 3=BILL/AffineTransformOp et 4=PPV/AffineTransformOp) 3

Code

Link to the javadoc: TODO

Object servers

public RetrievalClient(ConfigClient configClient,List<RetrievalServer> servers) throws CBIRException
public RetrievalClient(ConfigClient configClient,RetrievalServer server) throws CBIRException

The ConfigClient can be build like this

new ConfigClient("testdata/configClient.properties")

Distant Servers

public RetrievalClient(ConfigClient configClient, String serversFile)
public RetrievalClient(ConfigClient configClient,ListServerInformationSocket listsServerSocket) throws CBIRException
  • The serversFile is the path to a servers XML files

  • The listsServerSocket is a job object that can be build like this:

    List servers = new ArrayList(); servers.add(new ServerInformationSocket("localhost", 6101)); servers.add(new ServerInformationSocket("localhost", 6102)); ListServerInformationSocket list = new ListServerInformationSocket(servers);

The search method:

ResultsSimilarities search(BufferedImage img, int k) throws CBIRException;
ResultsSimilarities search(BufferedImage img, int k,String[] storages) throws CBIRException;
ResultsSimilarities search(BufferedImage img, int k,List<String> storages) throws CBIRException; 
ResultsSimilarities search(BufferedImage img, int N, int k,String[] storages) throws CBIRException;
  • img: The request image
  • k: Maximum results
  • storages: search only on these storage (null = all storages)
  • N: Number of patchs (better quality), this overwrite the data from ConfigClient

Clone this wiki locally