convert equirectangular to tiles library C# - 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.

Related

Polygon to line string coverage path

I hope that this is not the wrong place for my question, however, when I don't have anywhere else to go, SO never lets me down.
I am looking for a way to convert any given polygon on a map, to a serpentine line string. I would like to pass the polygon as a geography data type (it could be a poly string) which then takes the polygon, and generates a line string covering the entire area of the polygon.
The below images illustrates perfectly what I want to achieve in the sense that I want to provide the blue polygon and I want the green path to be returned either as a collection of points or a geography data type:
Taken from https://robotics.stackexchange.com/questions/14539/generate-a-coverage-path-given-a-polygon-region
I have scoured the internet and cannot seem to find any code examples around how to get this done. I would like to do this in C# preferable but I am not too fussy about the language. Second to C# I can look at using SQL too or even Python as a last resort.
I have read countless articles on Path planning but they all seem to be overkill in terms of what I want to achieve.
Could anybody point me in any direction as to how I can achieve this? Any information or samples will be highly appreciated.
I have thought about breaking the polygon down to its boundary lines and draw a serpentine line string across it by manually checking if a given point is within the bounds of the polygon. Surely there has to be a more efficient way to achieve this? Maybe a ready made API of some sort?

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#.

Best way to draw 'paths' to an array?

I have a question about drawing lines/paths on my own.
I use a combination of C#/WPF/Cudafy for UI and some calculations (e.g. the paths). Now I have a Byte[] array that should be filled with 'colors'/values (array-length = 4 * width * height of the result image).
I got some startpoints for the lines and one endpoint (somewhere between the startpoints). First I calculated some paths from those startpoints to the endpoints and then want to 'draw' them to the array (that will be used to construct a WriteableBitmap). The point coordinates are present in a 'reduced environment' though (since calculation of the paths needed to run a Dijkstra algorithm).
My paths are now defined by Tuples holding the point-coordinates (reduced size) and a 'linewidth'.
Since some paths may 'overlap' I thought I will do the following steps to ensure a nice looking of the result:
Merge the paths:
For that I will take one path and just keep it. Then I take the second and check if the path-points are somewhere near a path already added (like a near-neighbor search). I want to do this because in the end, I want to widen the line-width where paths overlap (3rd Tuple value).
When finished, I want to 'interpolate' the paths:
I don't really know how I should do that, since every path has a point at every (reduced-size) pixel.
One possibility would be to clear out all those path-coortinates of the paths that 'lie on a line' (and are not really necessary) and then do something like a Bezier - Interpolation. But all these steps seem to be overkill to me.
Don't you think there might be a better way to do this? If so, please share your thoughts :)
Thank's for any help!
Here's a link to an image of how it looks right now: CPVL Application

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.

Image Skeletonization using Medial Axis Transform

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

Categories

Resources