SIFT extraction

37 views
Skip to first unread message

swapnil

unread,
Jan 26, 2016, 2:41:55 AM1/26/16
to JFeatureLib

 Goal : Extract SIFT of each image in images folder and write output to opp10.csv file

 What I have done

 Downloaded : 

Properties file in JAR set name of sift exe is "sift.exe" therefore I have renamed SiftWin32.exe to sift.exe

and gave following command in cmd

java -jar JFeatureLib-1.6.3-jar-with-dependencies.jar -D Sift -c classA -d F:\eZen\Swapnil\images -o F:\eZen\Swapnil\op\opp10.csv

Above command is working for another feature CEDD 

For SIFT I am getting following exception 


C:\Program Files\Java\jdk1.8.0_60\bin>java -jar JFeatureLib-1.6.3-jar-with-depen
dencies.jar -D Sift -c classA -d F:\eZen\Swapnil\images -o F:\eZen\Swapnil\op\op
p10.csv
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: jFeatureLib.log (Access is denied)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
        at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
        at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java
:207)
        at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
        at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:3
07)
        at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.j
ava:172)
        at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.j
ava:104)
        at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigura
tor.java:842)
        at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigura
tor.java:768)
        at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyC
onfigurator.java:648)
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurato
r.java:514)
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurato
r.java:580)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionCon
verter.java:526)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
        at org.apache.log4j.Logger.getLogger(Logger.java:117)
        at de.lmu.ifi.dbs.jfeaturelib.utils.Extractor.<clinit>(Extractor.java:79
)
0    WARN  [pool-1-thread-3] de.lmu.ifi.dbs.jfeaturelib.features.Sift     - The
pipe is being closed
java.io.IOException: The pipe is being closed
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(FileOutputStream.java:326)
        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(Si
ftWrapper.java:229)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:130)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:104)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:81)
        at de.lmu.ifi.dbs.jfeaturelib.features.Sift.run(Sift.java:115)
        at de.lmu.ifi.dbs.jfeaturelib.utils.Extractor$ExtractionTask.run(Extract
or.java:633)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617)
        at java.lang.Thread.run(Thread.java:745)
        Suppressed: java.io.IOException: The pipe is being closed
                at java.io.FileOutputStream.writeBytes(Native Method)
                at java.io.FileOutputStream.write(FileOutputStream.java:326)
                at java.io.BufferedOutputStream.write(BufferedOutputStream.java:
122)
                at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream
.java:82)
                at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:
140)
                at java.io.FilterOutputStream.close(FilterOutputStream.java:158)

                at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.dataToPr
ocess(SiftWrapper.java:231)
                ... 10 more
4    ERROR [pool-1-thread-3] de.lmu.ifi.dbs.jfeaturelib.utils.Extractor     - In
dex: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.rangeCheck(ArrayList.java:653)
        at java.util.ArrayList.get(ArrayList.java:429)
        at de.lmu.ifi.dbs.jfeaturelib.utils.Extractor.writeOutput(Extractor.java
:506)
        at de.lmu.ifi.dbs.jfeaturelib.utils.Extractor.access$400(Extractor.java:
77)
        at de.lmu.ifi.dbs.jfeaturelib.utils.Extractor$ExtractionTask.run(Extract
or.java:643)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617)
        at java.lang.Thread.run(Thread.java:745)
8    WARN  [pool-1-thread-4] de.lmu.ifi.dbs.jfeaturelib.features.Sift     - The
pipe is being closed
java.io.IOException: The pipe is being closed
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(FileOutputStream.java:326)
        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(Si
ftWrapper.java:229)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:130)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:104)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:81)
        at de.lmu.ifi.dbs.jfeaturelib.features.Sift.run(Sift.java:115)
        at de.lmu.ifi.dbs.jfeaturelib.utils.Extractor$ExtractionTask.run(Extract
or.java:633)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617)
        at java.lang.Thread.run(Thread.java:745)
        Suppressed: java.io.IOException: The pipe is being closed
                at java.io.FileOutputStream.writeBytes(Native Method)
                at java.io.FileOutputStream.write(FileOutputStream.java:326)
                at java.io.BufferedOutputStream.write(BufferedOutputStream.java:
122)
                at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream
.java:82)
                at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:
140)
                at java.io.FilterOutputStream.close(FilterOutputStream.java:158)

                at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.dataToPr
ocess(SiftWrapper.java:231)
                ... 10 more
20   WARN  [pool-1-thread-2] de.lmu.ifi.dbs.jfeaturelib.features.Sift     - The
pipe is being closed
java.io.IOException: The pipe is being closed
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(FileOutputStream.java:326)
        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(Si
ftWrapper.java:229)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:130)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:104)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:81)
        at de.lmu.ifi.dbs.jfeaturelib.features.Sift.run(Sift.java:115)
        at de.lmu.ifi.dbs.jfeaturelib.utils.Extractor$ExtractionTask.run(Extract
or.java:633)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617)
        at java.lang.Thread.run(Thread.java:745)
        Suppressed: java.io.IOException: The pipe is being closed
                at java.io.FileOutputStream.writeBytes(Native Method)
                at java.io.FileOutputStream.write(FileOutputStream.java:326)
                at java.io.BufferedOutputStream.write(BufferedOutputStream.java:
122)
                at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream
.java:82)
                at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:
140)
                at java.io.FilterOutputStream.close(FilterOutputStream.java:158)

                at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.dataToPr
ocess(SiftWrapper.java:231)
                ... 10 more
24   WARN  [pool-1-thread-1] de.lmu.ifi.dbs.jfeaturelib.features.Sift     - The
pipe is being closed
java.io.IOException: The pipe is being closed
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(FileOutputStream.java:326)
        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(Si
ftWrapper.java:229)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:130)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:104)
        at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.getFeatures(Sift
Wrapper.java:81)
        at de.lmu.ifi.dbs.jfeaturelib.features.Sift.run(Sift.java:115)
        at de.lmu.ifi.dbs.jfeaturelib.utils.Extractor$ExtractionTask.run(Extract
or.java:633)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617)
        at java.lang.Thread.run(Thread.java:745)
        Suppressed: java.io.IOException: The pipe is being closed
                at java.io.FileOutputStream.writeBytes(Native Method)
                at java.io.FileOutputStream.write(FileOutputStream.java:326)
                at java.io.BufferedOutputStream.write(BufferedOutputStream.java:
122)
                at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream
.java:82)
                at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:
140)
                at java.io.FilterOutputStream.close(FilterOutputStream.java:158)

                at de.lmu.ifi.dbs.jfeaturelib.features.sift.SiftWrapper.dataToPr
ocess(SiftWrapper.java:231)
 
Please help on this ...

Franz

unread,
Jan 27, 2016, 2:52:49 PM1/27/16
to JFeatureLib
Hi again,

I tried it on my other machine and bam - there the error is as well.
 - Sorry I can now confirm it's a bug (in contrast to what I said in the GitHub Ticket)
I just remembered reading s.th like that a while ago: https://groups.google.com/forum/#!topic/jfeaturelib/b1e3BDdR9CI

Help is welcome. I didn't have the time to get too deep into it right now - but it's weird as the Code hasn't changed in the meantime since it last worked...

CHeers Franz

Franz

unread,
Jan 27, 2016, 4:52:59 PM1/27/16
to JFeatureLib
Hi,

can you please try with http://fgraf.de/JFeatureLib-1.6.4-jar-with-dependencies.jar and give feedback?
Maybe I've fixed the bug.

Good Night

Franz

Am Dienstag, 26. Januar 2016 08:41:55 UTC+1 schrieb swapnil:

swapnil

unread,
Jan 27, 2016, 11:48:22 PM1/27/16
to JFeatureLib
 Hi , 

               I have tried again with given 1.6.4 Jar but shows 
 Binary not executable: C:\Users\info_000\temp\sift.exe
java.io.IOException: Sift Binary not executable: C:\Users\info_000\temp\sift.exe

after that I have checked properties file of JAR , you have set path for sift.exe :- C:\Users\info_000\temp\sift.exe. 

I am unable to edit properties file of JAR , so I created the above directory in my machine and executed the command, 
Then there was another error "book.pgm" not found ,  then I got book.pgm from sift folder. 

After that it run successfully and thanks for the help. 

I think there is
1) Need to remove dependency of book.pgm (which is image  for demo purpose in SIFT folder) 
2)  Set the path as "siftWin32.exe" in properties file of JAR  and tell people to keep binary on the same path where jar resides. 

Franz Graf

unread,
Jan 28, 2016, 3:07:38 PM1/28/16
to jfeat...@googlegroups.com
HI,

ah thanks for testing so quickly.
Can you please try again? I set the path back to just "sift.exe" (btw
you _should_ be able to override the setting if you have a local
jfeaturelib.properties).
Lesson learned: don't package and publish when you're overtired.

Cheers,
Franz
> --
> 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.



--
Dr. Franz Graf
Website: http://www.Locked.de
Google+: https://plus.google.com/u/0/107945158062341260943
Xing: https://www.xing.com/profile/Franz_Graf4

visha...@gmail.com

unread,
Apr 21, 2016, 8:59:19 AM4/21/16
to JFeatureLib


I want to extract SIFT values 
I have
JFeatureLib-1.6.4-jar-with-dependencies.jar
Downloaded the sift binary
have book.pgm
kept the jar and sift binary in C:\Program Files\Java\jdk1.8.0_25\bin 
and kept book.pgm as in source folder
Also edited the properties of jar and set path to C:/Program Files/Java/jdk1.8.0_25/bin/sift.exe
I have also checked the permissions

I am running following command 
C:\Program Files\Java\jdk1.8.0_25\bin>java -jar JFeatureLib-1.6.4-jar-with-dependencies.jar -D Sift -d D:\images\ -o D:\output.csv

I am not getting any error but output.csv is empty.. does not show any output.

Please help on this.
Am I missing something?
Waiting for your response...


Vishal Ezen

unread,
Apr 26, 2016, 8:25:58 AM4/26/16
to JFeatureLib
Hi Franz,
 
I have used the surf demo provided at https://github.com/locked-fg/JFeatureLib-Demo
to get the idea of getting SIFT features. I got some code from your previous discussions and after some editing
the code worked fine.
Thanks..
code is
public class SiftTest {

    public static void main(String[] args) throws FileNotFoundException, IOException {

        BufferedImage img = ImageIO.read(new FileInputStream("D:\\images\\book.jpg"));
        ImageProcessor ip = new ColorProcessor(img);
        ip = ip.convertToByte(false);
        Sift sift = new Sift(new File("C:\\siftWin32.exe"));
        sift.run(ip);
        
        List<double[]> result = sift.getFeatures();
        System.out.println(result.size() + " features extracted...");
}
}

 Thank you so much.
I want to use SIFT features to construct a dictionary (bag of words) and then sparse code each data vector using this dictionary.After this, using the indices in the dictionary for each active basis in the sparse code I have to construct hash code for each data vector.


Can you please suggest anything for this. or how can I use JFeatureLib in this case?...
Thanks for your help.
Reply all
Reply to author
Forward
0 new messages