image allocated memory

Blitz3D Forums/Blitz3D Beginners Area/image allocated memory

orion one(Posted 2006) [#1]
hi, i am looking for informations regarding the memory where an image loaded with loadimage is stored. in fact, i actually have to process let's say 1000 jpegs taken from human CTSCANs and render them in 3D, in particular the bone structure. until now i load and draw each and every image with loadimage and drawimage, then check each pixel to see if it is bone or not with the getcolor function. but that takes an enormous time. could i access all these pixel info directly from the memory allocated to the loaded images? thanks for your help!!


Ross C(Posted 2006) [#2]
I think there was a .dll that allowed something like this. From just within blitz, it's pretty hard to do this i'm afraid.

Have you tried the readpixelfast command?

Also, if memory isn't a problem, then, how about processing each image, and storing the bone co-ords in an array? or storing the entire image in an array. Then you can grab the array and read through it. That would be just like directly accessing memory.


orion one(Posted 2006) [#3]
thanks for your quick help Ross,

1° i've been working with 256Mg Ram until this afternoon, now i benefit from my brand new 2Gigs and it's still slow as you thought

2° readpixelfast does not help much

3° now i have 2 gigs i can store every image in arrays, but reading each pixel on screen remains the slowest part of the process, that's why i thought using the allocated memory would help

i will begin my search of that .dll you spoke of

thanks very much again!


Jams(Posted 2006) [#4]
AFAIK, this will do what you want http://www.blitzbasic.com/codearcs/codearcs.php?code=1732


b32(Posted 2006) [#5]
If the images are all .bmp with the same size, you could try and scan the files yourself using readbytes.


Ross C(Posted 2006) [#6]
Yeah, what i meant, was scanning all the files into arrays at teh start of the program. you would only need to do this once :o) If you lock the buffer and read with readpixelfast, it shouldn't take too long. depends on your texture size though :o)


orion one(Posted 2006) [#7]
already done that Bram, it's still too long scanning the jpegs (usually 700-1000 jpegs format 512x512), writing the files, then scanning them - it takes a day! hehe i am trying to figure out how iam going to try the FreeImage dll (thanks Jams!)


b32(Posted 2006) [#8]
Okay, hope it works. If you still need to find about out the allocation of image memory, here is a link
http://www.blitzcoder.com/cgi-bin/ubb-cgi/postdisplay.cgi?forum=Forum6&topic=001266


orion one(Posted 2006) [#9]
ok thank you all, the more i learn about blitz3D, the more i find it easy hehe. i now work with readbyte and readbytes, problem for now solved. but i still have to figure how to use freeimage and the last url you sent me, bram.


Andy(Posted 2006) [#10]
>2° readpixelfast does not help much

readpixelfast requires locked buffers!


Andy


orion one(Posted 2006) [#11]
hi andy
i locked the buffers but hmmmyeah pixelfast does not help much; i now use readbytes, and will use readbytes directly in a RAM bank asap