Find image in another image using javacv - image

I want to find an image in another image. I already tried a "template matching" approach, but i didn't know how make it invariant to changes in scale, rotation, perspective, etc.
I have read about feature detection and suspect that usage of sift-features might be the best approach. Beside that i need an implementation of using feature detection using javacv not opencv.
Is there any implementation using feature detection or any other proposal for my problem?

If you understand the basics of JavaCV you can look at the ObjectFinder example of JavaCV.
ObjectFinder # code.google.com
This example shows you, how to do the important steps to solve your problem.
Before using the ObjectFinder you have to call the following method to load the non free modules (e.g. SURF):
com.googlecode.javacv.cpp.opencv_nonfree.initModule_nonfree();

Just for completeness. You can use the image feature matching capabilities provided by opencv, described here. There is even a full implementation of a well working matcher with javacv (in scala though, but it's easily portable into java).

Related

Processing Movie background change

I had another question about processing and a project i'm making. I would like to play a movie in a loop on the background. I managed to do this by initializing a Movie and putting it in an image the size of my app. But now I would like to load in multiple movies and add a button to change the background when pressed with the leap motion. Is this possible ? Or should I use a different library for this ?
Thanks in advance!
Kind regards,
DarthSwedo
It's really hard to answer general "how do I do this" type questions. Stack Overflow is designed more for specific "I tried X, expected Y, but got Z instead" type questions. You'll have much better luck if you just try something and post an MCVE if you get stuck.
That being said, I'm going to try to clear up some of the general confusion you seem to have.
Step 1: You need to figure out what library or libraries you're using. In all of your questions, you seem to not be sure which library you're using. Which Leap Motion library are you using? How did you set it up? Where is its documentation? You say you're using a Movie class. Where is that coming from? Are you sure it's not from the Video library?
If you have more specific questions in the future, please provide this information. We can't really help you without it. But more importantly, you need to know the answers to these questions if any of this is ever going to make any sense.
Step 2: Read the documentation for those libraries. Processing comes with the reference. The Video library comes with its own documentation page. I'm sure whatever Leap Motion library you're using has something similar. You need to read about the functions available to you. That's a huge part of programming. Right now your question is just asking whether something possible, and the honest answer to that is, well, what happened when you googled it?
Step 3: Try something. After you read through the documentation, just try something. Write some code based on the examples in the documentation. Even if that code doesn't work, that's okay, because then you can use it as an MCVE and ask a more specific question.
Good luck.

Screen scraping in clojure

I googled, but I can't find a satisfactory answer. This SO question is related but kinda old as well as the exact opposite of what I am looking for: a way to do screen-scraping using XPath, not CSS selectors.
I've used enlive for some basic screen-scraping but sometimes one needs the power of XPath selectors. So here it is:
Is there any equivalent to Nokogiri or lxml for clojure (java)? What is the state of the "pure java Nokogiri"? Any way to use the library from clojure? Any better alternatives than this hack?
There are a couple of possibilities here.
Several of these require semi-well formed XML to work. If you don't have it, I would pair clj-tagsoup with hiccup to produce the XML (parse with clj-tag-soup, which produces a form that hiccup and write out as XML) and work with that.
First, just use the native JDK capabilities. Assuming the document is well formed enough, try using clj-xpath which provides a wrapper around the native JDK parsing.
If that doesn't suffice, consider taking a more Clojure data structure based route. A simpler path could just use the output of TagSoup and a combination of maps, filters, and nths.
If you need something more advanced, consider using zippers to provide structure around the data, making it easier to manipulate. Use clojure.xml/parse and clojure.zip/xml-zip to produce the zipper, and go from there. An example can be found at http://techbehindtech.com/2010/06/25/parsing-xml-in-clojure/.
Using the native structures is my preferred route for anything complicated, as you can bring the full power of the language to bear.
If you provide a sample of why you need XPath, I can provide some sample code.

Scala dynamic class management

I would like to know if the following is possible in Scala (but I think the question can be applied also to Java):
Create a Scala file dynamically (ok, no problem here)
Compile it (I don't think this would be a real problem)
Load/Unload the new class dynamically
Aside from knowing if dynamic code loading/reloading is possible (it's possible in Java so I think it's feasible also in Scala) I would like also to know the implication of this in terms of performance degradation (I could have many many classes, with no name clash but really many of them!).
TIA!
P.S.: I know other questions about class loading in Scala exist, but I haven't been able to find an answer about performance!
Yes, everything you want to do is certainly possible. You might like to take a look at ScalaMock, which is an example of creating Scala source code dynamically. And at SBT which is an example of calling the compiler from code. And then there are many different systems that load classes dynamically - look at the documentation for loadLibrary as a starting point.
But, depending on what you want to achieve, you might like to look at Scala Macros instead. They provide the same kind of flexibility as you would get by generating source code and then compiling it, but without many of the downsides of that approach. The original version of ScalaMock used to work by generating source code, but I'm in the process of moving to using macros instead.
It's all possible in Scala, as is clearly demonstrated by the REPL. It's even going to be relatively easy with Scala 2.10.

Load package in Scheme48, how to get first, word variable, etc

I just installed the scheme48 package from macports and have started experiencing. I was watching this youtube video, link here and was attempting to perform some of the examples. In the lecture the professor is running scheme on a Sun terminal. For example, I attempt to do '(first 473)' and get 'Error: undefined variable first'. Now, I'm assuming I haven't loaded the correct package / library or what ever it is called in scheme but am not sure what the syntax and library is. I believe that scheme48 and the scheme version on that sun terminal in the video are not the same and could be part of the problem.
So, what library do I need to use and how do I load it?
Those lecture notes are based on a book called Simply Scheme, and you can find the library code that is used in the book here. Specifically, you need simply.scm.
(But whether it is a good idea to have these kind of overloading functions is debatable. Specifically, note that first is used in a way that is different from many other languages.)

Using XTS algorithm within Botan library for encryption/decryption

The Botan library (botan.randombit.net/) has a number of algorithms for encryption/decryption. I am interested in using the XTS algorithm for encryption/decryption that is available within Botan. However, there is no example provided for XTS usage in the downloaded Botan library. I need to know the XTS algorithm for encryption/decryption from within Botan. I have been able to compile the Botan library on Windows using MSVC. I am also able to build a sample application that links with this library and use the LibraryInitializer function. From this point onwards, I am at loss.
Regards, Saif
This should be all you need to get started with Botan, regardless of what algorithm you're using:
http://botan.randombit.net/filters.html
I'll just put this here...
http://botan.randombit.net/pbkdf.html

Resources