I am trying to create a map application, something like google maps, that shows a portion of a large map and lets you navigate north east up west, zoom in and out, etc...
I encountered a critical problem in the beginning: XNA does not allow importing images larger than a top maximum size limit, even in HiDef mode. And my map image size is much larger than the limit.
I was thinking I could split the map (manually, in photoshop) into smaller pieces and paste them one by one in the game, so they will make up a the whole map.
Is there a better way to do that?
Yes. That is a better way of doing it.
If you wanted to get fancy, you could probably do it in a content processor / importer (rather than doing it manually each time the image changed).
This would involve creating a type that contained a collection of your tiles.
You'd then create a new content importer that could take an image file, and split it up into chunks (maybe of configurable size).
It would produce an instance of your newly create type which you could load at runtime.
Check out the Content Pipeline posts on Shawn Hargreaves' blog.
Related
I need to capture audio data from the computer mic, process it and then plot it in real time. Processing each frame will produce a 1-D array which I want to display in an image where each value in the array is mapped to a color. The next audio frame is processed similarly and is then displayed on the next row of the image and so on. In matlab, one can achieve this using imagesc function. I also want the user to be able to scroll up and down to see current or previous data.
I believe I will need to buffer the processed data in a file or database and then asynchronously update the plot as mentioned above.
I'm trying to achieve all the above using C#.
My question is: what is the best way to generate the image/plot? I've done a lot of research (Microsoft Chart, VTK, several codeproject articles..) but couldn't find exactly what I want.
Also, what would be the best database to use in such case?
I do not think that there is a component that does exactly the things you've described. In most frameworks/bundles all the images get visualized by native system calls (in the end) which accept strides, buffers and so on, driving all by HANDLE. So, either you generate next time new image with new rows or just draw it yourself by stacking prev image to new one.
Scrolling (AKA windowing) is not trivial but possible again with already pre-created image in memory which is fixed. However, please note, that GDI+ based images (.NET Bitmap) is kind of limited for more than 9000px size. Please consider using alternative like IPP, AForge images.
I recommend you draw rows yourself because in your task re-sizing in going to be an issue because of rows bluring.
So, all in all, you might need to do it yourself.
At the end of my process, I need to upload several paged .tiff file images to a website. The files need to be very small, 500kb or less when i upload them.
The problem is, even with me resizing them a lot but at the same time being able to read a few lines of text that are in some of them, they are around 1mb each or so.
I first resize all images going into the tiff files but it's not enough. I need a way to change the quality of them to decrease their size as well.
Can C# do this or would I need a third party software to do it?
The files being uploaded MUST be .tiff.
You don't provide much detail about your data, so can only make some guesses as to what you might need to look at.
First, can you loose some resolution? Can you make the images smaller?
Second, can you loose some color depth? Are you saving the files in a color format when bilevel or greyscale images would suffice?
Third, how clean are these images? Are they photos, scanned documents, what? If they are scanned documents of text or drawings, then some pre-processing to remove noise can make a significant difference in size.
Lastly, what compression method are you saving the file with? Only a lossy format is going to give you the highest degree of compression is most circumstances.
Based on your follow-up:
1) If you can make smaller, this of course saves significant storage space. Determine what is the minimum acceptable resolution that they need to be and standardize on that.
2) If you need to persist color, then this step might not be as effective, since you would have to algorithmically decrease the dynamic range of colors used in the image to an acceptable level before compressing. If you are not sure what this means, then you would probably best skip considering this completely unless you can spend time learning more about image processing and/or using a image processing library that will simplify this for you.
3) I don't think you addressed this in your comments. If you want more precise help, you should update your original question and add much more detail about what you are trying to accomplish. Provide some explanations of what/why you need to do in order to help determine what tradeoffs make sense.
4) Yes, JPG is a lossy format, but I think you may be confusing a few different things (or I may not be understanding your intent from your description). If you are first resizing your original images down into a new JPG file (an intermediate image file), then you are building a TIFF file and inserting the resized JPG as a source image into a multi-page TIFF and saving that, then you need to realize that the process of how the files are compressed in the intermediate files do not necessarily have any correlation with the compression format used in the TIFF file. Depending on what you are using to build and create the TIFF file, the compression format used in the TIFF is done separately and you probably need to specify those parameters when you save that file. If this is what you are doing, then the intermediary process of saving the JPG files may be increasing the size a bit.
I have an objective: I need to join, for example 2 pictures like http://imgur.com/9G0fV and http://imgur.com/69HUg. In the result there has to be and image like http://imgur.com/SCG1X not http://imgur.com/LO4fh.
I'll explain in words: I have some images with the same areas and I need to find the area, crop it in one image and after this join them.
Take a look at this article, it's explains a possible solutions using the C# Aforge.NET image processing library
What you want to do is read the pixel values into arrays,
then find overlapping area using an algorithm like correlation
or min cut.
After finding coordinates of overlap, write out both images into
new array, use coordinates relative to large image minus
position of overlap in that source image plus position in destination image.
C# is not a factor in solving this, unless you meant
to ask about existing .NET frameworks that can help.
I am developing .NET library called SharpStitch (commercial) which can do the job.
It uses feature-based image alignment for general purpose image stitching.
I have 6 images
Each image is part of a 180 degree (or so) panorama. The images overlap. The task is to write a program in C# that will import the images, determine where the images overlap and merge the images together to form a single image.
Write the program in such a way that the user can import as many images as he or she would like to have merged into one image.
There should be some function in the program that will determine if given 2 images the 2 images overlap and to what amount.
Also, the input images may not necessarily be constructed from a strict linear axis of revolution, and their orientation may not be the same (you will need to consider rotation and both X and Y offsets to the overlap region as part of the program).
This is quite a large project. You might want to take a look at the source code for Hugin for inspiration. Unless you're really set on doing it yourself, you might just want to use (and possibly contribute improvements) to Hugin instead of starting over.
OTOH, Hugin isn't written in C#, so if that's a requirement, you probably will have to start over. Offhand I don't remember if the source to Autopano-SIFT is available, but if so it would be a good start (it already handles one of the most complex parts of the task).
I know I am probably being dense here but I need some help.
I am working on a program that handles mapping of an area, I need to have the map be GEOref'd so I can gather the MGRS coords for any point on the map. I already have a lib I wrote that does this working with images I import one by one using upper left and bottom right coords. I then simply calculate the number of pixels and their offset from the top left and bottom right of the image.
What I am trying to do is create a dragable map like GoogleMaps or any number of other mapping systems.
Here's the kicker. The system is running on a closed network with no access to Google or any other online resource for the maps.
I have 500gb worth of map data that I can work with but the format is something I am not familiar with, a XML file with some georef data, and a truck load of files with .tileset extension.
I assume I need to create some sort of tile stitching routine similar to what you would see in a game engine, but I have no experience with such engines.
Can anyone give me some advice or libs or directions to start researching to parse and use these tileset files and get this function going?