Open samos123 opened 8 years ago
HI, just tested it with plain Java and a call from the commandline
public class SurfDemo {
public static void main(String[] args) throws IOException, URISyntaxException {
// load the image
InputStream stream = SurfDemo.class.getClassLoader().getResourceAsStream("test.jpg");
ColorProcessor image = new ColorProcessor(ImageIO.read(stream));
// initialize the descriptor
SURF descriptor = new SURF();
// run the descriptor and extract the features
descriptor.run(image);
// obtain the features
List<double[]> features = descriptor.getFeatures();
// print the features to system out
for (double[] feature : features) {
System.out.println(Arrays2.join(feature, ", ", "%.5f"));
}
}
}
Works without errors. Any Idea? Otherwise I tend to think it's a sbt issue,
Thanks for confirming it's working as expected I will try to switch to Java and report back :)
It's working like you said. So it seems related to sbt / scala..
I've updated the repo jFeatureLib examples to fix some issues and add the surf demo there: https://github.com/locked-fg/JFeatureLib-Demo/pull/1
@locked-fg I'm opening it again as I can reproduce the issue in my repo: https://github.com/samos123/scala-feature-extraction
When using maven to build the scala project everything works as expected but when using sbt it fails with the log4j class not found exception.
I will be sticking with Maven for now but may investigate more into this later on. Any feedback would be appreciated :)
Thanks for your energy in that point. I'm trying to find a colleague who's willing to invest some energy ( @muuki88 - if you feel bored, feel free to join ;-)
I'm trying to extract Surf features without success. It seems it's missing a log4j dependency.
The code that I'm using:
build.sbt
Error that's seen: java -jar opencv2-scala-test-assembly-0.1-SNAPSHOT.jar Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger at de.lmu.ifi.dbs.jfeaturelib.features.surf.IJFacade.(IJFacade.java:41)
at de.lmu.ifi.dbs.jfeaturelib.features.SURF.run(SURF.java:97)
at Surf$delayedInit$body.apply(Surf.scala:20)
at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:71)
at scala.App$$anonfun$main$1.apply(App.scala:71)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
at scala.App$class.main(App.scala:71)
at Surf$.main(Surf.scala:14)
at Surf.main(Surf.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 12 more