Searching for Graphic libraries to draw seismic data in C# - c#

I am searching for graphic libraries that can draw seismic data; which is a large number of curves drawn vertically and gives you a shape like this:
alt text http://img237.imageshack.us/my.php?image=seismicdataxb2.png
and I need it to do be able to:
1) select each curve with mouse and return a value that tells me which curve that I have selected.
2) label the scale with more than one value.
thanx in advance.

Have you thought about creating a WPF application? This probably gives you what you need.

Sorry, old question I know; but INT sell a series of visualization libraries (including .NET) for this type of thing:
http://www.int.com/
Their C++ libraries are also cross-platform: I used to work for a company that used them in X Windows and MS Windows. This was a big deal in those days (circa. 2000).

Related

Render DMD in Unity3D

I want to render a custom display from an emulation. Think like a dot matrix display from pinball machines.
How would i effectively go about this? (Think about actually writing to a texture that size will probably run way too slow)
There has to be a good way to get this to render, but i have trouble finding a way that actually performs properly as well.
There are many options to do this but without further details (DMD screen resolution, number of colors, animated or not, etc) it's not easy to help. Here are a bunch of options popped into my mind, hope the one you are looking for is somewhere here :)
1) There was a similar question, you can find it along with the answer here
2) If you want to display text only, there's a wide range of sites offering DMD fonts for free, e.g. here
3) You can also edit/extend the font set you download and display 'special characters' as graphics, or just use the standard ASCII table for the purpose if that's enough for your needs. e.g. ▓ █ ╔ ═ ╗ and similar "drawing characters"
You can find inspiration and ASCII art (including animated ones) e.g. here
4) Might be slow (again, "depends") but you can go for bitmap and .SetPixels with a Texture2D and DrawTexture
5) A bit "hacky", but you can save your anim phases into either bitmap data/array (readonly/constant variables for example, or read from disc in a managed way, or draw with the help of a free asset from the store, like this one here, etc) and do Graphics.DrawTexture
6) If the thing you want to display is 100% static (i.e. it's not actual data like score, but "hardcoded" animations like "TILT" text or such), you can create a Sprite Animation
7) You can mix the above and e.g. go for a font (#2) to display dynamic data on a canvas, and play the static animation around it making it look like the whole thing is dynamic
Hm. That's all right off the top of my head :)
Hope this helps!

How to write quadratic equation on Label in C# WinForms?

We are making statistical software. Everywhere we need to put formula such as ax2+bx+c How to make ax2 means x square 2. I want to display 2 on upper side of x. Same with πc I want to display c at suffix.
Do you have a fixed list of formulas that users can choose but cannot edit? Then generate an image for each formula, store them in your application, and display them in a PictureBox.
If you expect users to be able to type in arbitrary formulas and render them interactively, you will have to implement a visual formula editor control. These controls take markup such as MathML or TeX and render them as graphics. Several are described in the link I provided, but I do not know of any such .Net controls for WinForms.
for the "upper" 2 and 3 there are symbols: a², a³ (even on a german keyboard but you will find them in your symboltable in windows too) - the lower c will be harder - I would consider using pictures for those more complex formulas (if you need dynamic formulas it you might have to create them with Graphics in code)

Drawing a waveform in C#

I want to be able to display a WaveForm in C#, along with some simple features such as zooming and selection. I already have the data as a short[] of amplitude values.
However, I am an amateur when it comes to hardcoding GUI. I have already found a possible helper class WaveFormClass that may help me achieve this but as a backup, I want to learn how to manually do it.
So may I ask for some methods and possibly some links that will help? Thanks!
NAudio has a WPF sample app that displays waveforms - you can get the source code from codeplex, the author also has an article about the topic here.
As with any chart, you'll have to iterate through X values and draw appropriate Y value taken from the sample array that you have.
If you will want to pan left and right through the audio, you'll have to offset getting the data from the array. If you will ad zoom out capability - so one pixel on the screen corresponds to some samples (try with integer numbers for start), you'll have to average some values and then draw appropriate value.
If word PIXEL and SAMPLE isn't yet in your vocabulary, before drawing the waveform you should get familiar with them, because no amount of others' people code will teach you how to do it.

Detecting a blob of color in an image

I have an image that is a depth heatmap that I've filtered out anything further away than the first 25% of the image.
It looks something like this:
There are two blobs of color in the image, one is my hand (with part of my face behind it), and the other is the desk in the lower left corner. How can I search the image to find these blobs? I would like to be able to draw a rectangle around them if possible.
I can also do this (ignore shades, and filter to black or white):
Pick a random pixel as a seed pixel. This becomes area A. Repeatedly expand A until A doesn't get any bigger. That's your area.
The way to expand A is by looking for neighbor pixels to A, such that they have similar color to at least one neighboring pixel in A.
What "similar color" means to you is somewhat variable. If you can make exactly two colors, as you say in another answer, then "similar" is "equal". Otherwise, "similar" would mean colors that have RGB values or whatnot where each component of the two colors is within a small amount of each other (i.e. 255, 128, 128 is similar to 252, 125, 130).
You can also limit the selected pixels so they must be similar to the seed pixel, but that works better when a human is picking the seed. (I believe this is what is done in Photoshop, for example.)
This can be better than edge detection because you can deal with gradients without filtering them out of existence, and you don't need to process the resulting detected edges into a coherent area. It has the disadvantage that a gradient can go all the way from black to white and it'll register as the same area, but that may be what you want. Also, you have to be careful with the implementation or else it will be too slow.
It might be overkill for what you need, but there's a great wrapper for C# for the OpenCV libraries.
I have successfully used OpenCV in C++ for blob detection, so you might find it useful for what you're trying to do.
http://www.emgu.com/wiki/index.php/Main_Page
and the wiki page on OpenCV:
http://en.wikipedia.org/wiki/OpenCV
Edited to add: Here is a blobs detection library for Emgu in C#. There is even some nice features of ordering the blobs by descending area (useful for filtering out noise).
http://www.emgu.com/forum/viewtopic.php?f=3&t=205
Edit Again:
If Emgu is too heavyweight, Aforge.NET also includes some blob detection methods
http://www.aforgenet.com/framework/
If the image really is only two or more distinct colours (very little blur between colours), it is an easy case for an edge detection algorithm.
You can use something like the code sample from this question : find a color in an image in c#
It will help you find the x/y of specific colors in your image. Then you could use the min x/max x and the min y/max y to draw your rectangles.
Detect object from image based on object color by C#.
To detect a object based on its color, there is an easy algorithm for that. you have to choose a filtering method. Steps normally are:
Take the image
Apply ur filtering
Apply greyscalling
Subtract background and get your objects
Find position of all objects
Mark the objects
First you have to choose a filtering method, there are many filtering method provided for C#. Mainly I prefer AForge filters, for this purpose they have few filter:
ColorFiltering
ChannelFiltering
HSLFiltering
YCbCrFiltering
EuclideanColorFiltering
My favorite is EuclideanColorFiltering. It is easy and simple. For information about other filters you can visit link below. You have to download AForge dll for apply these in your code.
More information about the exact steps can be found here: Link

2d graphics optimization tips

do u know any techniques allowing to speed up 2d primitives such as lines and circles?
i develop application that allow to edit images containing such primitives. they can be moved and selected in the same way as windows desktop icons are (including group selection by rectangle). also objects that cursor is on are highlighted.
it seems that there are many display updated involved when mouse is used. so i need to do it smartly.
i know that:
changing GDI+ to D3D can speed up display greately
dirty rects allow to restrict updates to only those rectangles that changed. (major drawback is that rectangles containing lines can be as big as display area)
xor technique allow to clear primitive by drawing it second time. (drawback is that it seems to be useless with multicolor images and primitives with common points)
thanks for useful tips & links.
Take a look at Michael Abrash's Graphics Programming Black Book

Categories

Resources