Search code examples
scalaactionscript-3computer-vision

ASSURF - Haar-Cascades Decoder and Apparat; How to use Apparat from Command Line (Scala Problems)?


This a shot in the dark as both these projects seem to be defunct. But I need help installing and using a project named Apparat for use with ASSURF.

I have a project that I am doing involving computer vision. I came across a project called ASSURF: ASSURF

For my purposes, I am looking into using Haar Cascades and so I would like to compile and use the HaarCascadesDecoder example from the project: HaarsCascadesDetector

If you follow the link to the demo, you will instead be lead to download the entire library, in which you have dig in various locations to find the necessary libraries and files needed to build the project.

Finally, the wiki for the demo says you have to post process the swf file using Apparat. This is where I am having trouble. Because in order to use Apparat, you must install a programming language called Scala.

Does anyone know how to run Apparat from the command Line? According to the project website, you need to use TDSI as such:

Apparat: https://github.com/joa/apparat

tdsi -i input.swf -o output.swf

But when I run TDSI from the command line in Windows 10 with my swf, I get the following errors:

java.lang.ClassNotFoundException: scala.ScalaObject
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at apparat.tools.tdsi.TurboDieselSportInjection.main(TurboDieselSportInjection.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at scala.reflect.internal.util.ScalaClassLoader.$anonfun$run$2(ScalaClassLoader.scala:98)
        at scala.reflect.internal.util.ScalaClassLoader.asContext(ScalaClassLoader.scala:32)
        at scala.reflect.internal.util.ScalaClassLoader.asContext$(ScalaClassLoader.scala:30)
        at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:129)
        at scala.reflect.internal.util.ScalaClassLoader.run(ScalaClassLoader.scala:98)
        at scala.reflect.internal.util.ScalaClassLoader.run$(ScalaClassLoader.scala:90)
        at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:129)
        at scala.tools.nsc.CommonRunner.run(ObjectRunner.scala:22)
        at scala.tools.nsc.CommonRunner.run$(ObjectRunner.scala:21)
        at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:39)
        at scala.tools.nsc.CommonRunner.runAndCatch(ObjectRunner.scala:29)
        at scala.tools.nsc.CommonRunner.runAndCatch$(ObjectRunner.scala:28)
        at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:39)
        at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:61)
        at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:88)
        at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:99)
        at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:104)
        at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

I've added both Scala and Apparat as paths in my system variables. Not sure where to go from here.


I am using Adobe Animate (previously Flash Pro). When I compile the project, i get the following errors when testing the code:

Error: Error #1023: Stack overflow occurred.
    at apparat.memory::Memory$/writeByte()

and

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at ru.inspirit.haar::HaarCascadesDetector/detectStep()
    at ru.inspirit.haar::HaarCascadesDetector/nextFrame()
    at DemoFaceDetect/onRender()

I'm under the impression that applying Apparat to the resulting swf will take care of the stackoverflow error.

Not sure.

Has anyone successfully used this or any demo from ASSURF? Any links to any tutorials?


Tl;DR

Does anyone know how to run Apparat from the command line in windows to use TDSI on a swf?

Has anyone successfully used a demo from ASSURF? Any links to any tutorials?

As for Apparat, I am aware of this tutorial:

http://www.webdevotion.be/blog/2010/06/02/how-to-get-up-and-running-with-apparat/

But that doesn't help as I am using Adobe Animate and would like to avoid FDT and ANT etc if possible.

Thanks in advance.


Solution

  • I found the developer of Apparat on Google Code/Groups and posted a topic there too: https://groups.google.com/forum/#!msg/apparat-framework/VlYNx8lIsyw/RBAxQjV8BwAJ

    To get things running, I had to downgrade Scala to v2.9.2 and also Java v1.7.79.

    You'd have to download and recompile the Apparat project with the new Scala version if you wanted it to work with newer versions of Scala but I don't have the time to do that. Maybe someone else has done it.

    Hope this helps anyone else trying to do something similar.