/usr/bin/gift-mrml-client.pl is in gnuift-perl 0.1.14-12.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | #!/usr/bin/perl -w # -*- mode: perl -*-
# GIFT, a flexible content based image retrieval system.
# Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# A simple one-shot-query to GIFT
#
#############################################################
#
# if you need printouts for what happens inside CFeedbackClient,
# modify CFeedbackClient.pre-pm:
#
# the hash vDEBUG (line 98) in CFeedbackClient.pre-pm
# will be of interest for you
#
#############################################################
# Author of this file: Wolfgang Müller 2000-02-18
require 5.002;
#use strict;
use lib '/usr/bin'; # for including CFeedbackClient
use Getopt::Long;
%lOptions=();
GetOptions(\%lOptions,
"help",
"cgi",
"user-id=s",
"algorithm-id=s",
"collection-id=s",
"additional-algorithm-attributes=s",
);
if($lOptions{help}){
print "
gift-mrml-client.pl: this program starts a one-shot-query to a given MRML server
Usage: gift-mrml-client.pl host:port? output-file? (image-url image-relevance)*
--help shows this string
--cgi this script is run by a CGI script
--user-id the user-id to be used when connecting
--algorithm-id the algorithm-id to be used when configuring
--collection-id the collection-id to be used when configuring
--additional-algorithm-attributes
the string given will be passed through
to the algorithm in place of an attribute.
(see configuration documentation about this)
";
exit;
}
my $lUserID= $lOptions{"user-id"} || "-perl-one-shot-query-" ;
my $lAlgorithmID= $lOptions{"algorithm-id"};
my $lCollectionID=$lOptions{"collection-id"};
my $lAdditionalAlgorithmAttributes=$lOptions{"additional-algorithm-attributes"};
#$lAdditionalAlgorithmAttributes="BLABLA";
use CFeedbackClient;
package main;
my @dummy=(
'file:/home/muellerw/TestCase/TSR500/b_1000_scaled.gif',
'file:/home/muellerw/TestCase/TSR500/b_1015_scaled.gif',
'file:/home/muellerw/TestCase/TSR500/b_1030_scaled.gif',
'file:/home/muellerw/TestCase/TSR500/b_1040_scaled.gif',
'file:/home/muellerw/TestCase/TSR500/b_1050_scaled.gif',
'file:/home/muellerw/TestCase/TSR500/b_1060_scaled.gif',
'file:/home/muellerw/TestCase/TSR500/b_1070_scaled.gif',
'file:/home/muellerw/TestCase/TSR500/b_1080_scaled.gif',
'file:/home/muellerw/TestCase/TSR500/b_1090_scaled.gif',
);
my @dummy2=('file:/home/muellerw/TSR2500/tsr1_0046_small.jpg');
my @dummy3=('file:/home/muellerw/TSR2500/tsr1_0046_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0047_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0048_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0049_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0050_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0051_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0052_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0053_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0054_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0055_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0056_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0057_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0058_small.jpg',
'file:/home/muellerw/TSR2500/tsr1_0059_small.jpg'
);
#
# how to use the automatic benchmark
#
# if(1==1){
# my $lFeedbackClient=new CFCMovingTargetTest();
# $lFeedbackClient->doQueryGroup(\@dummy2);
# }else{
# my $lFeedbackClient=new CFeedbackClient();
# $lFeedbackClient->doQueryGroup(\@dummy3);
# }
#
# At present no choice of algorithm
#
print "Usage: gift-mrml-client.pl host:port? output-file? (image-url image-relevance)*\n" ;
#
# Read the images from the command line
#
{#for scoping
my $lHost= shift || "localhost:12789";
my $OUTFILE=shift || "gift-mrml-client-outfile.html";
$OUTFILE=">$OUTFILE";
my @lQuery;
#we are making a list of
#pairs from the flat list of
#arguments
# a default query
@lQuery=([(shift || "http://gift.unige.ch/images//TSR500/b_1007_scaled_small.jpg"),
1]);
while(scalar(@_)){
push @lQuery,[shift,shift];
}
#
# Our gift feedback client
# we should be able to tell it the port
#
my $lFeedbackClient=new CFeedbackClient();
#the following line is redundant, because
#this is the default
$lFeedbackClient->setAddress($lHost);
$lFeedbackClient->setResultSize(20);# set the size of the desired query result
$lFeedbackClient->startSession($lUserID);
$lFeedbackClient->configureSession(
$lFeedbackClient->getSessionID(),
$lAlgorithmID,
$lCollectionID,
$lAdditionalAlgorithmAttributes
);#take the defaults
print "Making query\n";
my $lQueryToSend=$lFeedbackClient->makeQueryString(
\@lQuery,
$lFeedbackClient->getSessionID(),
$lAlgorithmID,
$lCollectionID,
);
# SENDING THE QUERY and
# printing the MRML we got back from the query
print "MRML-----xx-----------------------------------\n";
print $lFeedbackClient->sendQueryString($lQueryToSend);
print "MRML-----xx-----------------------------------\n";
#
#now transform the results into HTML
#
my $lResultList=$lFeedbackClient->getResultList();
open OUTFILE, $OUTFILE or die "\ncould not open $OUTFILE\n$!";
print OUTFILE "
<html>
<head>One shot query</head>\n
<body>
<H1> One shot query </H1>
<p>
<table>
<thead>
<td>URL
</td>
<td>Relevance
</td>
</thead>
<tbody>
";
foreach $i (@lQuery){
my($lImage,$lRelevance)=@$i;
print "QUERY: $lImage, $lRelevance\n";
print OUTFILE "<tr><td><a href=\"$lImage\">$lImage</a></td><td><code>$lRelevance</code></td><tr>\n";
}
print OUTFILE "</tbody></table></p><p>
<!-- RESULTS -->
<table><tbody><tr>
";
my $i;
my $lCount=0;
foreach $i (@$lResultList){
if(!($lCount%4)){
print OUTFILE "</tr><tr>";
}
my($lImage,$lRelevance)=@$i;
print "RESULT: $lImage, $lRelevance\n";
print OUTFILE "<td><image src=\"$lImage\"><center>$lRelevance</center></td>\n";
# <center>$lImage</center> insert this into print statement if you want to be able to read the URL
$lCount++;
}
print OUTFILE "
</tr></tbody></table>
</body>
</html>
";
}
print "
Simple MRML client:
Usage: gift-mrml-client.pl host:port? output-file? (image-url image-relevance)*\n" ;
|