Image Skeletonization using Medial Axis Transform - c#

My requirement is something like this:
Lets take there is a Bitmap with a big letter 'A'.
The Bitmap is two colors (Either Black or White).
I need to skeletonize the big 'A'. (see: http://en.wikipedia.org/wiki/Topological_skeleton)
Using "Medial Axis Transforming" algorithm.
I tried my best in googling but i ended up being lost in finding a C#, C++ or at least pseudo code implementation of this algorithm.
I would like if someone could help me on this.

This page http://www.cs.sunysb.edu/~algorith/files/thinning.shtml has some sources you may wish to review.

The following two articles are the ones where the Medial Axis Transform was first proposed, so I think that you can find the algorithm to implement there. Do not expect a C++/C# implementation though.
A transformation for extracting new descriptors of shape
Shape description using weighted symmetric axis features
For the first one I was able to find a URL to a pdf. For the second one you will have to have access to ScienceDirect to download.
Another approach that you can use to extract the skeleton of a shape is by the Image Foresting Transform (IFT). It consists in representing the binary image as a graph. I made an implementation of the skeletonization by IFT in Matlab using the following article:
Multiscale skeletons by image foresting transform and its applications to neuromorphometry

Related

pattern recognition inside a matrix

say I have these boxes, some of which are black and some white.
The image shows a U shape drawn with the black boxes. Now say I have a matrix of 1s and 0s (it can be a huge matrix) like this:
111111111111111111
111111111111111111
111111111111111111
111111111101111111
111111111101111111
111011111101111111
111011111101111111
111011111101111111
111011111101111111
111011111101111111
111011111101111111
111100000011111111
111111111111111111
which shows zeros forming roughly the shape shown in the image. The image and the matrix are just examples. The image is a screen shot of a software where we should draw patterns, which would then need to be located in given matrices (inside simple text files).
What I'm looking for is a guidance on how to get started on this, cuz I have never programmed anything related to pattern recognitions, which this problem clearly seems to be related to. This is all that I have to do, a pattern given, to be matched with matrix of 0s and 1s. I dont think I can write it on my own in a few days, I'm writing code in c# vs 2013, so hoping I can find some libraries that would let me achieve this with minimal dependencies. Thanks
I think you need to provide a bit more information on what exactly you're looking for. Are the shapes all letters or arbitrary shapes?
Whatever you're looking for I'd start with emguCV. It's a pretty comprehensive library that isn't too difficult to use.
EmguCV has a lot of OCR (optical character recognition) functions which should be able to pick out letters pretty well.
I don't have as much experience using it for arbitrary shape detection but I think SURF detection, something which emguCV also does, might be a good way to go. It attempts to match a given image with features in another image.
People never draw at the exact same place and scale as your stored data.
The things you want are often done with neural networks (its also in aforge).
But it might be hard to A understand it and B use it in your code.
So maybe you could try it like this, get the first position, then record the delta position.
Try to find long lines, and their next direction; store the general direction changes.
above sample would be "down right up", you might also store some length info.
Then there is some math to check how much different sets are, for example string comparisons distance of strings (like in php the levenshtein function); cant think of a levenshtein func in c# dough i dont think c# is that rich with string functions but once you see that i'm sure you can derive something for C#.

C# generate soundwave at real time

i would like to start some project for fun, and found my interest in sounds.
So i would like to make some things move with sound rhythm. But i don't know, e.g., how winamp (in image) generates values to draw those bars. How could i make it happen in C#? Can anybody give me some tips ?
edit: i will figure out this: http://wpfsvl.codeplex.com/
You should read up on Fast Fourier Transforms.
A fast Fourier transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) and its inverse.
and
A DFT decomposes a sequence of values into components of different frequencies
With the FFT, you can split up a soundwave into it's component frequencies, ie: you can see the levels of different frequencies in the original soundwave, and then graph them in some sort of fancy bar chart, like in your image.
The following question is related to FFT's and C#:
An implementation of the fast Fourier transform (FFT) in C#

convert equirectangular to tiles library C#

I want to create tiles out of a equirectangular image. So I want the image to be split into 4 lateral faces+up and bottom. Does anyone know any library that I can import into my c# project and which is able to do something like this?
Depending on your original image format, System.Drawing.Bitmap.Clone(Rectangle, PixelFormat) should do the trick.
More information here.
EDIT:
First, let me say that this is not going to answer your question either (not even close), you're seeking a library that already exists for this purpose and I don't know of one personally.
Equirectangular projection is the same as plate carrée (wow, that's humbling), so it's a very simple projection to work with in code.
Here is an example of it's use in a GIS application. I don't know what your purposes are, but the math is the same.
One way to do it is to deproject each pixel then draw it on a new image, but understand that to do this you will still require some sort of projection because you're changing from 3 dimensions to 2 dimensions.
I wasn't able to find a good example, but an easier or faster way might be to first use a matrix transform (again, to change projections), then cut the image into the regions you need.
Like I said, this isn't an asnwer, but if nothing else it will give you more keywords to goggle for.

C# - Image question

What would be the appropriate way to determine if 2 taken images match in the color gamma terms?
I need to differ the images taken in one series (panorama-like) from completely other images.
This somehow correlates with color-distinct features of Google when doing image search, could someone suggest any approach?
Thank you.
A simple solution. You may try to calculate HSV color histograms of images and then compare query's histogram to all images histogram to find best match using some of comparing methods (some methods are listed here).
However In your case it seems that CLD is more suitable since it takes into account spacial features of image.

Collection of Various Color Matrices for Bitmap Manipulation

I've been messing around a bit with some low-level bitmap manipulation and having been creating some various color matrices to apply to bitmap data to add "filters" (for lack of a better term).
I have seen a number of tutorials online in C# and AS3 about applying various color matrices to bitmaps, but was curious if anyone simply had a collection of these color matrices that map to specific filter styles (black and white, sepia, etc.).
quasimondo did a great job with his colormatrix
see it in action here:
http://www.quasimondo.com/archives/000565.php
an as3 version here (methods' names are self explanatory :) )
http://www.quasimondo.com/archives/000671.php
maybe you'll be interested in convolution filters ( rather than matrices )
here's a little "explorer" done by Sakri:
http://www.sakri.net/blog/2007/06/12/convolutionfilter-explorer/
still those are just 'tools', if you need to look into a given effect, you can try things like : http://msdn.microsoft.com/en-gb/magazine/cc163866.aspx and grab the settings.
the good you have the values, the good thing is that you can inject them and see the result immediately. say you want to perform a Sobel filter ( which convolution matrix is [-1,-2,-1, 0,0,0, 1,2,1 ] and the same rotated 90° ) then you can copy paste the matrix values and try right away :)

Categories

Resources