C++ / Java / C# Image processing library - c#

What would be the best library choice for finding similar parts in images and similarity matching?
Thank you.

It sounds like the Scale Invariant Feature Transform (SIFT) is probably the algorithm you're really looking for. Offhand, I don't know of any general-purpose image processing library that includes it, but there are definitely standalone implementations to be found (and knowing the name should make Googling for it relatively easy).

ImageJ fastest image processing library in Java.

OpenCV is certainly a solid choice as always.
That said, VLFeat is also very good. It includes many popular feature detectors (including SIFT, MSER, Harris, etc.) as well as clustering algorithms like (kd-trees and quickshift). You can piece together something like a bag of words classifier using that very quickly.
While SIFT is certainly a solid general purpose solution, it actually is a pipeline composed of a feature detector (which points are interesting in the image), a feature descriptor (for each interesting point in the image, what's a good representation), and a feature matcher (given a descriptor and a database of descriptors, how do I determine what is the best match).
Depending upon your application, you may want to break apart this pipeline and swap in different components. VLFeat's SIFT implementation is very modular and lets you experiment with doing so easily.

Never did image processing, but I've heard from friends OpenCV is quite good, they usually use C++

Related

Need an audio analysis library to create real time feedback from audio file?

Real-time is not necessarily required, however I am creating a game for my final year project and I wish to use the power of audio to create dynamic levels based solely on a music track that is playing. I aim to create this game for the PS Vita using playstation mobile and C#, but if i want i can switch to C++ and PSP.
I can use a WAV file, and hopefully extract the amplitude of the waveform, as well as calculating other characteristics like average frequency and approximate BPM from this data to create a level.
I have no qualms about trying to work with this raw data, I just want to know a way I can actually GET that information first. If i can extract the samples and assertain different characteristics of these samples, I can store them and work out changes in loudness, pitch and more to create notes etc.
I am using C#, but if at all possible i can either use p/invoke or switch my project to another device that uses C++ instead of C#.
I'm panicking a bit here, cos I really am a bit stumped.
Many thanks guys.
Unfortunately i don't think you'll be able to use C# to do this - AFAIK, there is no JIT compiler for it. I remember reading about something for Mono, which would make it available to use with C#, but i'm not sure right now.
That said - i would go with c++. If you go that way, you can make use of a vast amount of audio analysis libraries, like CLAM (http://clam-project.org/).
Don't panic (imagine big, friendly letters.) Envision the necessary parts for the project step by step, tackle one by one, and you'll be done in no time. =)
The problem you describe here is one of music/audio feature extraction and a substantial body of academic work exists that you can draw on. Another useful term of art with which to search is Music Information Retrieval (MIR).
The list of 'features' that researchers have attempted to retrieve from recordings is large and varied, from deterministic things such as pitch and key through emotional characteristics, such as 'energy'.
Most of these turn out to be more difficult than you might imagine, and typically only about 60-70% accurate - although for your requirements, this is probably adequate.
A good entry point might be download Sonic Visualiser, for which a large number of feature extraction plug-ins exist, and are open-source. You'll at least get a feel for what's possible.
Update: Another useful term of art is Onset detection - this is typically used to describe beat detection algorithms.
Aubio is a C/C++ library that does pitch tracking, onset detection and bpm tracking, among other things.
As for "extracting the amplitude of the waveform", the waveform is amplitude, i.e., you could just pick the audio sample with the greatest absolute value every n samples and use that value to do the "amplitude" part of the visualization.
Here's some code that might help you get started reading WAVE data in C#.
Here's some information about writing a C# wrapper for the FFTW library.

4x4 Matrix decomposition algorithm

I'm working on a very large project and I'm trying to revisit and solve a problem that I've been having for quite a while: a 4x4 matrix decomposition algorithm.
I'm writing a commercial game & simulation engine. It is an API and platform-agnostic engine written entirely in C#. It uses SlimDX as its DirectX back-end, and I'm probably going to stick with OpenTK for the OpenGL back-end. Since I cannot depend on DirectX's or OpenGL's math libraries or data types (e.g., Vector2, Vector3, Quaternion, Matrix, etc) I'm having to write my own types for the engine. I've gotten everything finished up and pretty well optimized; and the API is semantically similar to XNA because I (and many other people) liked XNA's "feel" and felt it was very elegant and powerful. But don't be confused; this project does not use and has nothing to do with XNA. Anyway, I was able to handle everything except ONE thing... Matrix.Decompose!!!
The problem is, I simply have no idea what I'm doing on this... I am a self-taught programmer, and self-taught at virtually everything else (business finance, day trading, German, etc). That's just how I learn. I only had one year and one semester of college, so I have no formal education in complex mathematics. So when I go on Wikipedia and look at formulas for Matrix decomposition it's all Greek to me.... a bunch of funny symbols and diagrams that mean nothing to me lol. I was always a poor math student because math simply escapes me if I can't practically apply it to something (like game programming). For instance, I can write a complex ballistics physics simulation but couldn't even help my girlfriend with her basic physics and calculus homework lol, because it's a bunch of "high-level" theoretical math and I cant bridge the gap to practicality or programming. So I'm just very lost, don't know what I'm doing and highly frustrated...
What I need to do, specifically, is mirror the functionality of Matrix.Decompose found in the XNA Framework and DirectX. I tried to look for the implementation in SlimDX's source and OpenTK's source, but neither had it implemented! SlimDX just defers the work to the native DirectX libraries and OpenTK simply doesn't even have it. As this algorithm is one big, hideously complex beast, I'm not surprised neither development team wanted to implement their own. But I have to.
I've tried turning those whacky formulas on Wikipedia and other sites into a working C# algorithm but I just can't make heads or tails of it. I really need to see a working implementation of it in C, C++ or C#, or have someone help me understand this with pseudo-code or something. I just cannot grasp these formulas and "high-level" mathematics theories. If there's anything you can do to help (a link, a working implementation, some pseudo-code, etc) it would be greatly appreciated.
Check out DotNetMatrix which is a C# library for doing all types of matrix transformations, including the Cholesky Decomposition, which is what I believe you are looking for. In addition, its free and source code is included!
Your best bet is to use an existing matrix library. Check out ILNumerics, for example. It supports many common matrix decompositions (there is no one 'matrix decomposition'): http://ilnumerics.net/$FeatureList.html
That's a commercial license, but because you are selling your engine, maybe it won't be a problem for you.
A free one is Math.NET, but the 'Decompositions & Least Squares Problems' section is empty which leads me to believe that they haven't implemented it yet.

Simple library for Natural Language Processing in C#

I am working on a project which requires simple sort of NLP. The features that I need include:
Sentence splitter
Phrase splitter (not word splitter)
Phrase nature identifier (common noun, proper noun, verb etc.)
I am aware of libraries like SharpNLP, NLPTK and Antelope but all of them are too big and fancy for my project. Can someone suggest a simple one that provides only the above mentioned features. If it is a bit bigger and provides other features that's ok but I guess having a 139MB large library for this simple stuff might not be a good idea, especially when this project is already going to be complex in other areas.
Thanks in advance for any ideas.

How do I visualize a complex graph in .Net?

I need to visualize a graph. I don't know how to name it (by the way, if you know - I'll appreciate if you tell me). It would be ideal for graph elements to be clickable (so that when user clicks on a block, I can handle an event with the element id specified) but I can survive even without any interactivity. I may like to be able to focus on a particular node and layout all others to view from its perspective. Are there any components available good for this task? If no, what should I look for to help me to develop an algorithm for drawing such a graph with visually-comfortable layout?
Practical nature of this graph is pretty common: each block represents a derivation from 2 operands. Orange circles are references to 2 operands, green circles are connection points to consumers. It can be significant to distinguish an operand position (left or right), for example if a derivation represents a mathematical operation of difference or division (in this particular case a block can be triangular, but in other cases an operand itself can make use of being aware of for what blocks is it a left operand and for what blocks is it a right). Another common application is intersecting sets with complex relations.
You could take a look at Graph#, but I'm not sure how well it'll handle composite nodes like that. It could be a good starting point though.
I also would like to point you to graphviz. It is not a .NET solution but you can feed it files that are easy enough to write in order to create graphs. I don't think layouting is a very simple thing to do, especially with increasing node count, so it should be a good thing to find some tool for that.
As It seems Microsoft itself has done a really good job on graph visualization called automatic-graph-layout.
Here's the link https://github.com/microsoft/automatic-graph-layout.
Well, you first need to represent it somehow in memory, there are many ways, like adjacency list. Then you need to draw it. While generally drawing a graph is simple, it's not that simple if you need to layout it. Looks like in your case, that's exactly what you need to do to come to that nice representation. It ain't going to be easy.
EDIT: Interesting, there seems to be a library made by Microsoft Research.
I don't know how useful it will be in this particular scenario, but you might want to take a look at http://quickgraph.codeplex.com/
Graphviz4Net provides WPF component for graphs visualization. It depends on GraphViz (open source command line graph visualization tool).
I can not find this component and i decided writen my own control, line and head, and use them to visualization my graph's
If the needed your i can give it's component and program to demonstrate him/
I writen component and program's in visual studio 2008 language C#
This is a fairly new and maintained .NET wrapper for Graphviz: https://github.com/Rubjerg/Graphviz.NetWrapper
(Disclaimer: I'm the author)
This wrapper works differently from other wrappers, since it makes direct function calls to the native Graphviz code. This means you can not only programatically construct your graph in C# code, but also read the layout attributes back out in C# code and render it any way you want. The latter sounds specifically like something you would be interested in.
A quite good looking one is the Diagram tool from Nevron. But it's not for free!
I'm currently using the charts and user interfaces from them and they work quite good.
Have used this commercial product with success: GoDiagram
It support the multiple ports on the nodes like you have shown.

artificial intelligence - Creative Writing

I am trying to find information (and hopefully c# source code) about trying to create a basic AI tool that can understand english words, grammar and context.
The Idea is to train the AI by using as many written documents as possible and then based on these documents, for the AI to create its own creative writitng in proper english that makes sense to a human.
While the idea is simple, I do realise that the hurdles are huge, any starting points or good resoueces will be appriacted.
A basic AI tool that you can use to do something like this is a Markov Chain. It's actually not too tricky to write!
See: http://pscode.com/vb/scripts/ShowCode.asp?txtCodeId=2031&lngWId=10
If that's not enough, you might be able to store WordNet synsets in your Markov chain instead of just words. This gives you some sense of the meaning of the words.
To be able to recompose a document you are going to have to have away to filter through the bad results.
Which means:
You are going to have to write a program that can evaluate if the output is valid (grammatically and syntactically is the best you can do reliablily) (This would would NLP)
You would need lots of training data and test data
You would need to watch out for overtraining (take a look at ROC curves)
Instead of writing a tool you could:
Manually score the output (will take a long time to properly train the algorigthm)
With this using the Amazon Mechanical Turk might be a good idea
The irony of this: The computer would have a difficult time "Creatively" composing something new. All of its worth will be based on its previous experiences [training data]
Some good references and reading at this Natural Language article.
As others said, Markov chain seems to be most suitable for such a task. Nice description of implementing Markov chain can be found in Kernighan & Pike, The Practice of Programming, section 3.1. Nice description of text-generating is also present in Programming Pearls.
One thing, though not quite what you need, would be a Markov chain of words. Here's a link I found by a quick search: http://blog.figmentengine.com/2008/10/markov-chain-code.html, but you can find much more information by searching for it.
Take a look at http://www.nltk.org/ (Natural Language Toolkit), lots of powerful tools there. They use Python (not C#) but Python is easy enough to pick up. Much easier to pick up than the breadth and depth of natural language processing, at least.
I agree, that you will have troubles in creating something creative. You could possibly also use a keyword spinner on certain words. You might also want to implement a stop word filter to remove anything colloquial.

Categories

Resources