Go Back   Pro/Forums > ProCooling Geek Bits > Random Nonsense / Geek Stuff
Password
Register FAQ Members List Calendar JavaChat Mark Forums Read

Random Nonsense / Geek Stuff All those random tech ramblings you can't fit anywhere else!

Reply
Thread Tools
Unread 03-01-2005, 10:46 AM   #1
Incoherent
Cooling Savant
 
Join Date: Sep 2003
Location: Vallentuna, Sweden
Posts: 410
Default 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??
Incoherent is offline   Reply With Quote
Unread 03-01-2005, 12:35 PM   #2
Brians256
Pro/Staff
 
Brians256's Avatar
 
Join Date: Oct 2001
Location: Klamath Falls, OR
Posts: 1,439
Default

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
}
Brians256 is offline   Reply With Quote
Unread 03-01-2005, 12:54 PM   #3
redleader
Thermophile
 
Join Date: Jun 2001
Location: The deserts of Tucson, Az
Posts: 1,264
Default

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.
redleader is offline   Reply With Quote
Unread 03-01-2005, 03:11 PM   #4
Incoherent
Cooling Savant
 
Join Date: Sep 2003
Location: Vallentuna, Sweden
Posts: 410
Default

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?
Incoherent is offline   Reply With Quote
Unread 03-01-2005, 03:41 PM   #5
Long Haired Git
Cooling Savant
 
Long Haired Git's Avatar
 
Join Date: Jan 2003
Location: Sydney, Oz
Posts: 336
Default

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?
__________________
Long Haired Git
"Securing an environment of Windows platforms from abuse - external or internal - is akin to trying to install sprinklers in a fireworks factory where smoking on the job is permitted." (Prof. Gene Spafford)
My Rig, in all its glory, can be seen best here
AMD XP1600 @ 1530 Mhz | Soyo Dragon + | 256 Mb PC2700 DDRAM | 2 x 40 Gb 7200rpm in Raid-0 | Maze 2, eheim 1250, dual heater cores! | Full specifications (PCDB)

Long Haired Git is offline   Reply With Quote
Unread 03-01-2005, 03:45 PM   #6
Incoherent
Cooling Savant
 
Join Date: Sep 2003
Location: Vallentuna, Sweden
Posts: 410
Default

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
Incoherent is offline   Reply With Quote
Unread 03-01-2005, 10:29 PM   #7
Long Haired Git
Cooling Savant
 
Long Haired Git's Avatar
 
Join Date: Jan 2003
Location: Sydney, Oz
Posts: 336
Default

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.
PM me an email addy for java class and src files.
__________________
Long Haired Git
"Securing an environment of Windows platforms from abuse - external or internal - is akin to trying to install sprinklers in a fireworks factory where smoking on the job is permitted." (Prof. Gene Spafford)
My Rig, in all its glory, can be seen best here
AMD XP1600 @ 1530 Mhz | Soyo Dragon + | 256 Mb PC2700 DDRAM | 2 x 40 Gb 7200rpm in Raid-0 | Maze 2, eheim 1250, dual heater cores! | Full specifications (PCDB)

Long Haired Git is offline   Reply With Quote
Unread 03-02-2005, 04:43 PM   #8
Brians256
Pro/Staff
 
Brians256's Avatar
 
Join Date: Oct 2001
Location: Klamath Falls, OR
Posts: 1,439
Default

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.
Attached Files
File Type: rar TabDelimDataToFromImage.rar (23.1 KB, 4 views)
Brians256 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:29 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...