You may need to redo your path configurations (which seem correct to
me) for this profile.
Best regards,
--
Ricardo Niederberger Cabral
http://www.imgseek.net/
ricardo.cabral at imgseek.net
skype: rnc000
Also dont forget to include a reference on the linker preferences to
the imagemagick (something like "magick") object library (.lib) and to
python. Open the original MSVC solution from the source release (or
svn) and look at the release link and compiler configurations.
--
Ricardo Niederberger Cabral
http://www.imgseek.net/
ricardo.cabral at imgseek.net
skype: rnc000
The MSVC solution file that comes with this module compiles into
imgdb.pyd, which can be used on python programs with a statement like
"import imgdb" (see the source of isk-daemon.py for its usage).
--
Ricardo Niederberger Cabral
http://www.imgseek.net/
ricardo.cabral at imgseek.net
skype: rnc000
On 12/03/2008, at 05:04, Louis LEVY wrote:
> I have finally decided to use Python. But I dont understand how I
> can import
> the imgdb core module into Python. So far, I have inserted the
> "imgdb Object
> File Library" I have obtained through compiling the imgdb source
> code with
> MSVC directly into Python's libraries.
> Then I have tried the command line "import imgdb" : without any
> success.
imgdb.pyd (MSVC build output) should be on the same path where
imgdb.py (provided on the source distribution) is.
Place both of these on python global module path or on the same
directory of the python program doing an "import imgdb".
>
>
> Besides, I cant see where the function "query for similar image"
> found in
> Image Seek is defined in the source code. The closest I have found
> was in
> imgdb.cpp : double calcAvglDiff(const int dbId, long int id1, long
> int id2).
if you're talking about the c++ imgdb module found on the "classic"
desktop imgseek, try one of these
extern void queryImgID(long ,int );
extern int queryImgFile(char *,int ,int );
and these for retrieving query results:
extern int getNumResults();
extern long getResultID();
extern double getResultScore();
Thank you for your mail.
If I take it correctly, there are two different imgdb modules :
- The "classic" desktop imgseek, let's refer to it as Desktop module, located in https://imgseek.svn.sourceforge.net/svnroot/imgseek/trunk/imgseek-python/imgSeekLib/
- Another one, let's refer to it as Server module, located in
https://imgseek.svn.sourceforge.net/svnroot/imgseek/trunk/net.imgseek.imgdb/src/net/imgseek/imgdb/core/
While the Server module does not include the main queryImg function I am loooking for, the Desktop module does. Is that right ?
Thanks to your help, I have finally managed to import the Server module in Python. However, how am I suppoded to import the Desktop module ? Here is what I have tried so far : I have directly used the imgdb.pyd available in
https://imgseek.svn.sourceforge.net/svnroot/imgseek/trunk/imgseek-python/imgSeekLib/.
Since I could not find the corresponding imgdb.py in the same location, I have tried to use the imgdb.py available in
https://imgseek.svn.sourceforge.net/svnroot/imgseek/trunk/net.imgseek.imgdb/src/net/imgseek/imgdb/core/.
It did not work.
I have therefore two questions :
1) Can I directly use this imgdb.pyd without building the Desktop imgdb C++ code against Python ? I have tried to build it anyway by using the following files :
- imgdb.cpp, imgdb.h, haar.cpp, haar.h, imgdb_wrap.cxx located in https://imgseek.svn.sourceforge.net/svnroot/imgseek/trunk/imgseek-python/imgSeekLib/
- imgdb_wrap.h (by the way I added #include <imgdb_warp.h> inside imgdb_wrap.cxx since I could not find any preprocessor command line for any header file in it), bloom_filter.cpp, bloom_filter.h located in https://imgseek.svn.sourceforge.net/svnroot/imgseek/trunk/net.imgseek.imgdb/src/net/imgseek/imgdb/core/
It did not work. I had to install Platform SDK (to get the windows.h header). Eventually, I had the following errors :
------------------------------------------------------------------------------------------------------------------------------------------------------
2) Where can I find the Desktop module's corresponding imgdb.py ?
On 13/03/2008, at 05:20, Louis LEVY wrote:
`
On 16/03/2008, at 10:45, Louis LEVY wrote:
> Hello Ricardo,
>
> Thank you for your last answer. I am now using the Server module.
>
> I have first tried to use the classes and functions defined in
> iskdaemon.py. While I succeeded in creating an ImgDB instance, I
> could not understand the use of the parameter settings in
> __init__(self, settings). I input a random int value. I was then
> able to create a DB using createdb, save it, load it etc. However, I
> was unable to add any image using addImage(self, dbId, fname,newid =
> None)
The ImgDB constructor may be buggy. Try using the simpler (and more
declarative) API as exemplified on the unit tests and sample clients
distributed with the source code. Which is what you mentioned as using
the imgdb module functions directly.
> I then tried to use upstream the imgdb module's functions. This
> time, I was able to create DBs, save, load DB, add images, use the
> functions double calcDiff(const int dbId, long int id1, long int
> id2), and std::vector<double> queryImgIDKeywords(const int dbId,
> long int id, int numres, int kwJoinType, int_vector keywords).
>
> Here are my command lines:
>
> from imgdb import *
> initDbase(1)
> addImage(1,1,"C:\\Python25\\ImgDB\\test.jpg")
> addImage(1,2,"C:\\Python25\\ImgDB\\test2.jpg")
> savedb(1,"C:\\Python25\\ImgDB\\Img.txt")
sounds right
>
> print calcDiff(1,1,2)
> print queryImgID(1,1,10)
>
> Both images test and test2 are identical.
> I obtained two surprising results :
> - To calcDiff, the output was -35.8500005752. Since the images are
> identical, I would have expected the result to be 0. What is the
> meaning of this result ?
The [0,1] scale (as calculated by the python wrapper) is artificial.
Internally, the similarity ratio for a given image, given as a result
of running the querying algorithm described on the paper is a float
number with no absolute meaning (this similarity result of -35... that
you mentioned). It should be considered only relatively to other
images. So if sim(x,y) > sim(x,z) then x is more similar to y than it
is to z. That's the only kind of conclusion you should get at.
Internally imgSeek will normalize the output score calculated for each
indexed candidate image by considering the max similarity as being the
average similarity achieved by running several similar tests as you
did and adding a marging of error so we don't run the risk of getting
a result greater than 1. Furthermore, I'm not entirely sure that
score(x,x) > score(x,y) for each images x and y.
>
> - To queryImg, the output was ( ). I take it that an error occurred
> somewhere, which would explain this blank result (I have checked
> beforehand that both images were indeed loaded inside the DB). Could
> you help me figure it out ?
Are those the only two images in the database? It may return an empty
result list if you request for more result images (on your example:
10) than there is on the database. Try adding more images.
I am also wondering:
Since sim(x,y)>sim(x,x) for each images x and y, would not that mean that sim(x,y)>sim(x,z) implies z is more similar to x than y is similar to x. It would therefore be the other way around of what you wrote to me. I am bit confused...
2008/3/19, Louis LEVY <louis...@gmail.com>:I added a couple of few images as you advised me and indeed it worked !
I obtained results like the kind below :
print queryImgID(1,5,9)
(9.0, 0.070145299138105521, 4.0, -5.9702660339192128, 7.0, -6.8460502249184003, 8.0, -6.8523225166971358, 6.0, -7.3811261267682884, 1.0, -8.1248547762653516, 3.0, -9.7831398425691418, 2.0, -11.96115838770644, 5.0, -38.91000035405159)
print queryImgID(1,7,9)
(6.0, -4.0120659777273113, 5.0, -6.8460502249184003, 1.0, -7.5921484994136454, 9.0, -8.6838044103783858, 2.0, -9.3101353053709026, 3.0, -9.5282856254401516, 8.0, -9.8236064434255965, 4.0, -9.8542157684696541, 7.0, -36.700000464916229)
Using relative comparisons, the conclusions I can draw are :
- As sim(9,5)>sim(4,5)>sim(7,5)>sim(8,5)>etc, img9 is more similar to img5 than img4 is, img4 is in turn more similar to img5 than img7 etc.
- Similarly sim(6,7)>sim(5,7)>sim(1,7)>sim(9,7)>etc., img6 is more similar to img7 than img5 is, img5 is in turn more similar to img7 than img1 is etc.
However, can I make aboslute comparisons as well :
- Since sim(9,5)>sim(6,7), is img9 more similar to img5 than img6 is similar to img7 ?
- More generally does sim(x,y)>sim(z,t) imply that x more similar to y than z is similar to t ?
Following this idea of absolute comparison, I have noticed that sim(x,y) can take positive values (ike sim(9,5)). What is the range of sim(x,y) ?
It seems that sim(x,y) has been defined so that sim(x,y)>sim(x,x) for each images x and y. However, we dont have sim(x,x) = sim(y,y) for each images x and y - for instance sim(7,7)>sim(5,5). That is why I am not so sure that I can make aboslute comparisons like the one above.
Thank you again for your help !
Louis