Convert C++ OpenCV code to Java - java

I have a C/C++ OpenCV source code (which works fine) and I am rewritting it in Java using OpenCV (not JavaCV). I cannot find the correspoding Java class for CvBGCodeBookModel.
I have searched thoroughly the OpenCV-Java site and many results from Google, I have also looked in many files in the OpenCV directory for any clues.
The closest that I have found is class Algorithm
(http://docs.opencv.org/java/2.4.2/org/opencv/core/Algorithm.html &
http://docs.opencv.org/java/org/opencv/core/Algorithm.html )
but I cannot find how to use some methods e.g.:
- cvBGCodeBookUpdate
- cvBGCodeBookClearStale
- cvBGCodeBookDiff
(The program was not initially written by me and I do not fully understand it but I have managed to add some functionality in the C/C++ version. If you need the source code inform me.)
Can anyone help me?
Thanks in advance

Related

Wrapping C++ code with SWIG to be used in Processing.org

I'd like to use some C++ libraries in a Processing project but I am not sure how to do it (I am completely newbie in Processing and Java).
The way I proceeded is by using SWIG to create a shared library (.so) that can be then loaded (using the System.load command) in a Java application in the same way as explained in the tutorial:
http://www.swig.org/tutorial.html
This might be a super basic question, but my doubt is (I have not been able to find a solution in Google or Stackoverflow) how do I import this library into Processing?
Using the example provided in the link, neither:
# I compiled the library with .so rather than .dll, I am using Mac OS X
System.load("/path/to/example.so")
nor
# Putting the example.so file in the library folder
System.loadLibrary("example")
seem to actually import the library. When I try to do something like:
double var = example.fact(5);
Processing complains saying that "Cannot find anything named example". Could you help me with this? Any hint or resource that explains on how to import .so libraries in Processing would be greatly appreciated.
Many thanks!
#Tryskele

Reed-Solomon algorithm usage in java

I'm currently working on a school project related to QR Codes generation, and i have a really huge problem with the error correction system. I found this website http://www.pclviewer.com/rs2/calculator.html, it works like a charm but it's an online tool, and i need this exact functionality ported in Java. Is there any way i can found this ? I tried the zxing class but i can't figure how to only use the Reed-Solomon part (because of course it's the only part i can use).
Thanks you all for answers, and have a good day.
You should use the implemenation in zxing. I know you say you couldn't figure it out, but, surely if you look at the code you see the API. It doesn't get much simpler than:
https://code.google.com/p/zxing/source/browse/trunk/core/src/main/java/com/google/zxing/common/reedsolomon/ReedSolomonEncoder.java#52
https://code.google.com/p/zxing/source/browse/trunk/core/src/main/java/com/google/zxing/common/reedsolomon/ReedSolomonDecoder.java#58
You can see how these are used, even, in QR codes:
https://code.google.com/p/zxing/source/browse/trunk/core/src/main/java/com/google/zxing/qrcode/decoder/Decoder.java#191

incorporating .w files into a Java program

I am having trouble finding out what these .w files are and how to using them with my Java code: see Assignment1.zip at http://see.stanford.edu/see/materials/icspmcs106a/assignments.aspx
I would post a screenshot of my files, but I don't have enough "reputation points" to post an image on this site--I usually just read answers from others b/c I'm just learning. I can't open these .w files or else I would paste some of their contents in here.
For the past year, I've worked a good amount with Python and C++, but I decided to learn some Java from these free Stanford online lectures: http://see.stanford.edu/see/lecturelist.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111.
I've looked all over and simply cannot find out what .w files are, and I haven't been able to open them. I realize they're clearly worlds for the graphical robot to move around in, but I can't get the .java & .class files to function with these .w (or "world") files.
I would be happy to post some of my code in here as well, if you want. And I could post an image of the files & folders once I get a good enough reputation.
Could someone please help me?
You seem to be missing the documentation for karel.jar. There is already code for reading and working with these files, in sandford.karel.KarelWorld there is a load(File) method. But you will need to be working with the rest of the classes in the jar file, too, so you'll need to look for documentation (maybe given in the lecture videos?) or you'll have a very frustrating time.

Sphinx4 Beta API Problems With Eclipse

I'm trying to set up a simple helloworld demo with Sphinx 4.0 (which is apparently a beta?) I downloaded the source and added it as source to Eclipse, but the problem is, it doesn't recognize a lot of the classes. I've been looking, and as far as I can tell, the classes it wants just aren't there! For example, the line:
import javax.speech.Central;
throws a compiler error, saying something about how the import couldn't be resolved. Is this a part of a bigger API I was supposed to download before trying to do Sphinx4? It didn't say anything about any other API but I'm open to the possibility.
If you want, I can post a list of all the imports that can't be resolved, I will, but that means looking through all the code which is kind of a pain. I have a hunch that I need to download the JSAPI, but I don't know which implementation would be good for Sphinx4.
Links to Sphinx4 downloads:
http://sourceforge.net/projects/cmusphinx/files/sphinx4/1.0%20beta6/
http://cmusphinx.sourceforge.net/
EDIT: In addition, I've found a few lines that I think might mean I need to download JUnit? Again, I'm not totally sure how to set this up.
The great thing about this site is that the simple act of typing out a question and nervously analyzing it before finalizing any revisions (because, after all, someone WILL read this!) 95% of the time I answer my own question within 5 minutes of posting it.
Anyways, the solution was simple, I downloaded junit4-10.jar and jsapi.jar and added them to my Java build path. Then, I got more errors, and I said TO HECK with building from the source (which I was doing with sphinx4 here) and I just downloaded the already-built library and it works great. Got the HelloWorld I wanted!

AccessBridgeDebug.h missing?

I'm at my wits end with this Java Bridge, after trying to force it to do what I want in C# I've abandoned the idea and started to stagger my way through Visual C++, however I'm running into constant problems which I'm slowly resolving. Except this one!
I'm missing an include file called AccessBridgeDebug.h. << TL:DR read here.
I can't even compile ANYTHING that uses the includes for AccessBridge because they all reference the debug file, and it just flat out does not come with the package I downloaded, or the one prior to it on the website. Google yields 0 results for the search term "AccessBridgeDebug.h" which has caused me to realise I rely on google far too much.
Please, someone, help.
For those who have the same problem, the solution was fairly simple. The Java Access Bridge 2.0.2 only contains updated files, not the entire package. Furthermore, there is no readily available download link to the 2.0.2 full installer.
To fix it, go here: https://www.oracle.com/java/technologies/java-archive-downloads-java-client-downloads.html#accessbridge-2.0.1-oth-JPR (Located accessbridge-2_0_1-manual_install\src\bridge\src\AccessBridgeDebug.h)
And download the 2.0.1 full source. All the missing header/c++ files can be found in here.

Categories

Resources