the issue with SIFT wrapper

184 views
Skip to first unread message

Phoenix Bai

unread,
Oct 21, 2014, 8:05:33 AM10/21/14
to jfeat...@googlegroups.com
Hi,

I am trying to call Sift class to in my code.
I downloaded the binary version of the sift from David Lowe`s website. And using linux version of the sift file. 

the issue is that, when I call sift binary, it always throw: 

phoenix@PhoenixBai:~/Downloads/siftDemoV4$ ls sift
sift
phoenix@PhoenixBai
:~/Downloads/siftDemoV4$ ./sift
bash
: ./sift: No such file or directory

I googled a bit, and it seems that this binary file cannot run on my current os.

here are the two pieces of information about the file and my os:
phoenix@PhoenixBai:~/Downloads/siftDemoV4$ file sift
sift
: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, for SuSE 9.1, not stripped

phoenix@PhoenixBai
:~/Downloads/siftDemoV4$ uname -a
Linux PhoenixBai 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

And my question is,
1) is this binary file cannot run on my current os? the 32bit cannot run on 64bit issue? if so, how could I fix it? 
or is it possible to get a 64bit version of sift binary file that could run on my os somewhere else? 

2) is it possible to use siftWin32.exe instead ? (I actually tried it by calling your SIFT class, and it doesn`t work either). 
I am guessing someone else might have encountered the same issue as me, so wondering, if could shed some light on this issue!

thank you all in advance!

Johannes Niedermayer

unread,
Oct 21, 2014, 9:22:54 AM10/21/14
to jfeat...@googlegroups.com
Hi,

I think that I used to have the same problem, although I am not totally sure how I fixed it. I think that you have to install the 32bit libraries which should be possible on a 64bit system as well (you will simply have both versions, 32bit and 64bit installed). Probably the web provides some more information on this.

Cheers

Johannes
--
You received this message because you are subscribed to the Google Groups "JFeatureLib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jfeaturelib...@googlegroups.com.
To post to this group, send email to jfeat...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Phoenix Bai

unread,
Oct 22, 2014, 8:08:42 AM10/22/14
to jfeat...@googlegroups.com
I installed the i386 related library and it seems work fine now, below is a test:

phoenix@PhoenixBai:~/Downloads/siftDemoV4$ ./sift -display <book.pgm>result.pgm
Finding keypoints...
882 keypoints found.
PGM file output
.


when I call it from the JFeatureLib interfaces, I get error below:

2014-10-22 19:32:50,042 [main] WARN  [de.lmu.ifi.dbs.jfeaturelib.features.Sift] - Stream closed
java
.io.IOException: Stream closed
 at java
.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:434)
 at java
.io.OutputStream.write(OutputStream.java:116)
 at java
.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
 at java
.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
 at java
.io.BufferedOutputStream.write(BufferedOutputStream.java:95)
 at de
.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.dataToProcess(SiftWrapper.java:229)
 at de
.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(SiftWrapper.java:130)
 at de
.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(SiftWrapper.java:104)
 at de
.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(SiftWrapper.java:81)
 at de
.lmu.ifi.dbs.jfeaturelib.features.Sift.run(Sift.java:115)

Not sure what goes wrong here. Could anyone help?

thanks

Franz Graf

unread,
Oct 22, 2014, 12:40:12 PM10/22/14
to jfeat...@googlegroups.com, Phoenix Bai
Hi,

Hm that is really strange.
Have you ensured that the sift path in JFeatureLib properties really points to the correct (same) binary of the SIFT executable? I mean the same executable as in the Shell test.

Regards
Franz
Dr. Franz Graf
http://www.Locked.de

Phoenix Bai

unread,
Oct 23, 2014, 5:25:27 AM10/23/14
to jfeat...@googlegroups.com, mingz...@gmail.com
Hi, 

I figure out the reason, it is because the pgm file created by the JFeaturelib code cannot be processed with sift binary.
here is the error message:

phoenix@PhoenixBai:~/Downloads/siftDemoV4$ ./sift -display <abc.pgm> abc.pgm
Finding keypoints...
ERROR
: Input is not a standard raw PGM file.
Use xv or PNM tools to convert file to 8-bit PGM format.

abc.pgm is the file that is created using the code below:

 public List<double[]> getFeatures(ImageProcessor ip) throws IOException,
            InterruptedException {
       
File tmpFile = File.createTempFile(PREFIX, SUFFIX);
       
List<double[]> features;
       
try {
           
ImagePlus iPlus = new ImagePlus(tmpFile.getAbsolutePath());
            iPlus
.setProcessor("", ip);
           
new FileSaver(iPlus).saveAsPgm(tmpFile.getAbsolutePath());
            features
= getFeatures(tmpFile);
       
} finally {();
       
}
       
return features;
   
}

And the ImageProcessor I pass in is Using the below code:

new ColorProcessor(new BufferedImage(...))

So, how could I fix this?
or am I doing anything wrong?

thanks

Franz Graf

unread,
Oct 23, 2014, 8:14:44 AM10/23/14
to jfeat...@googlegroups.com, mingz...@gmail.com
Hi,

hm this is wired! Have you tried another image? Maybe it's something
with the colormap/format.
Maybe you could try it with one of the images from the test cases:
https://github.com/locked-fg/JFeatureLib/tree/master/src/test/resources

Thanks for trying!
Franz
--
Website: http://www.Locked.de
Google+: https://plus.google.com/u/0/107945158062341260943
Xing: https://www.xing.com/profile/Franz_Graf4

Phoenix Bai

unread,
Oct 28, 2014, 6:25:10 AM10/28/14
to jfeat...@googlegroups.com, mingz...@gmail.com
No, it is not working either.

the sift binary I am using is the linux version and downloaded from David Lowe`s website.
And my os is Ubuntu 14.04.

it seems that sift binary is working fine, because I try it out using the pgm file it provided.
when I use jfeaturelib`s methods to create pgm file out of my rgb image or the ones jfeaturelib provided under resource directory,
whichever I use, the file created seems not correct.

Could anyone tell me how I should generate pgm using other tools or how could I check the correctness of the file.
Also, if possible, could anyone give it a try?

begging for enlightenment. 

Thanks in advance.

Franz Graf

unread,
Oct 30, 2014, 5:21:52 AM10/30/14
to jfeat...@googlegroups.com, Phoenix Bai, mingz...@gmail.com
Hi,

That's really strange. Do you use the Oracle Jdk? My last tests were on Jdk 7.

Maybe that is an issue?
I won't have the possibility to check the issue before next week, sorry.

Cheers Franz

Phoenix Bai

unread,
Oct 30, 2014, 10:48:54 PM10/30/14
to jfeat...@googlegroups.com, mingz...@gmail.com
my java version is below:

java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)


I really want to get this working, so that I could get it running on spark.
so, really appreciate your help and I definitely will wait.

at the same time as local testing, I am using python package cv2, so no rush.

thanks again!

Franz Graf

unread,
Oct 31, 2014, 3:30:34 AM10/31/14
to jfeat...@googlegroups.com, Phoenix Bai
Hm okay. Have you tripple checked if it isn't a simple path problem?
Where's your sift binary and what's the jfeaturelib.properties file like?
If you downloaded the jfeaturelib source you could also add a
file.exists-check in the sift wrapper - just to check if the program
cannot find sift, if it can't execute it or if it can't interprete the
output.

Unfortunately I will not be able to validate the bug with this setting
before next week. So I can just try to help by mail.

Thanks for your patience!
Franz

Franz Graf

unread,
Nov 8, 2014, 9:05:13 AM11/8/14
to jfeat...@googlegroups.com
Hi Johannes (and all others),

I wanted to reproduce & check the issue but ran into the same issue.

Am 21.10.2014 15:23, schrieb Johannes Niedermayer:
> I think that I used to have the same problem, although I am not totally
> sure how I fixed it. I think that you have to install the 32bit
> libraries which should be possible on a 64bit system as well (you will
> simply have both versions, 32bit and 64bit installed). Probably the web
> provides some more information on this.

Can you tell me a bit more about it?
What do I need to do to get SIFT run on an Ubuntu x64?

Franz
--
Dr. Franz Graf
Homepage: http://www.Locked.de
G+: https://plus.google.com/+FranzGraf

Johannes Niedermayer

unread,
Nov 8, 2014, 2:30:52 PM11/8/14
to jfeat...@googlegroups.com
Hi Franz,

so what I think is generating this problem is that Lowe's SIFT binary
has been initially compiled for 32 bit systems. On a 64 bit system the
corresponding dynamically linked libraries are not found such that the
executable fails. The best solution would be recompiling for x86/64, but
as we don't have access to the source code, it seems that it has to be
done using multiarch libraries. I am not totally sure how to solve this
issue as SIFT runs on my current Ubuntu 14.4 (which is also 64-bit,
however probably I have already installed the dependencies).

I think that the problem can be solved by installing ia32-libs:
https://packages.debian.org/de/wheezy/ia32-libs

On more recent systems it seems to be lib32z1:
https://support.humblebundle.com/hc/en-us/articles/202759400-Installing-32-bit-libs-on-a-64-bit-Linux-system

On my system, the first one is not available and the second one not
installed, but as I said it is still working. Something seems to be
already installed (locate ia32 returns over 100 results). Can you check
if one of the two packages above solve your problem? If they don't we
will have to find an other solution.

Cheers

Johannes

Franz Graf

unread,
Nov 13, 2014, 12:34:41 PM11/13/14
to jfeat...@googlegroups.com, Johannes Niedermayer
Heyo Johannes,

Thanx a lot. Have you tried just fireing up a Ubuntu 32 bit ISO vm?
That's what I would try in the next step before I start hacking around this issue.

Cheers Franz

Phoenix Bai

unread,
Nov 14, 2014, 2:51:06 AM11/14/14
to jfeat...@googlegroups.com
Sorry for responding this late.

To run the 32-bit binary on 64-bit ubuntu, you could try follow below steps, it works for me:

//add i386 support to run 32bit binary file
sudo apt
-get install gcc-multilib

sudo dpkg
--add-architecture i386
sudo apt
-get update
sudo apt
-get install libc6:i386 libncurses5:i386 libstdc++6:i386

./sift -display <book.pgm >result.pgm

Hope this helps.
Again, thank you very much for trying persistently.

Johannes Niedermayer

unread,
Nov 14, 2014, 7:59:35 AM11/14/14
to jfeat...@googlegroups.com
Hi Franz,

no, I didn't give that a try. However I am pretty sure that I solved the problem in the past similar to Phoenix Bai by installing additional libraries (however I don't know which ones). So, considering the results from Phoenix and myself, I am pretty sure that it is an architecture problem

I also think that is not JFeatureLib related, it could just happen with any binary on Linux. Therefore the only solution from JFL would be to add a comment in the error message.

Cheers

Johannes
Reply all
Reply to author
Forward
0 new messages