Pro/Forums

Pro/Forums (http://forums.procooling.com/vbb/index.php)
-   Random Nonsense / Geek Stuff (http://forums.procooling.com/vbb/forumdisplay.php?f=15)
-   -   converting text data to an image file (http://forums.procooling.com/vbb/showthread.php?t=11325)

Incoherent 03-01-2005 10:46 AM

converting text data to an image file
 
I want to convert a (large) table of data e.g a 100x1000 matrix into a 100x1000pix grayscale image. I can then analyse the data as an image and perform various image processing tricks on it.

Does anyone have any ideas/converters/links??

Brians256 03-01-2005 12:35 PM

Why go into an image format? Image processing is REALLY simple. Why not use something simple like this and just code it up? That way, you can do any sort of processing you want instead of relying on some 3rd party app to have the flexibility you need (but it probably doesn't have).

#include <stdio.h>

void ReadMyData(double *pData, int *pWidth, int *pHeight)
{
// insert code to read data here
*pWidth = 1000;
*pHeight = 100;
pData = malloc(sizeof(double) * (*pWidth) * (*pHeight));
}

// Example image proc code here
void PerformBlur(double *pData, int width, int height)
{
// insert blur code here
}

int main()
{
double *data;
int width, height;
ReadMyData(data, &width, &height);
PerformBlur(); // or whatever code you want
// insert code to write out data
}

redleader 03-01-2005 12:54 PM

The GD libraries can create pngs from data. I've used it in perl to make graphs of data. Theres probably some way to just start setting pixel values.

Incoherent 03-01-2005 03:11 PM

Quote:

Originally Posted by Brians256
Why go into an image format?
}

I have some very dense measurement data files that I want to use some image processing software to analyse (Image Pro) It has some pretty powerful capabilities (FFT etc) which will help me with the analysis. I can do it in Excel but the memory requirements choke the computer.

Thanks for the replies. Unfortunately the code is double dutch to me. I am programmatically challenged. Any tips in English? :)

Long Haired Git 03-01-2005 03:41 PM

I'll hack up some java on the train on the way in - there's a canvas demo that should be easy to convert.
What's the data - comma seperated values or fixed length fields?

Incoherent 03-01-2005 03:45 PM

Quote:

Originally Posted by Long Haired Git
I'll hack up some java on the train on the way in - there's a canvas demo that should be easy to convert.
What's the data - comma seperated values or fixed length fields?

Doesn't matter, its Tab delimited in it's raw form but I can put it into any kind of text format. CSV would be great.

Cheers

Long Haired Git 03-01-2005 10:29 PM

Just going to draw it onscreen - you can capture it using Alt-Prtscn or your OS equiv.
No error handling, so if you have 999 rows on one row, I neatly Seg-V. :D
PM me an email addy for java class and src files.

Brians256 03-02-2005 04:43 PM

1 Attachment(s)
Well, who knows if this will work. But at least it compiles and you have src.

It parses tab delimited files of numbers and spits out a PNG file.


All times are GMT -5. The time now is 09:15 AM.

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
(C) 2005 ProCooling.com
If we in some way offend you, insult you or your people, screw your mom, beat up your dad, or poop on your porch... we're sorry... we were probably really drunk...
Oh and dont steal our content bitches! Don't give us a reason to pee in your open car window this summer...