PDA

Click to See Complete Forum and Search --> : Help !!! urgent !


manoj
Dec 27th, 1999, 08:03 AM
I am doing a project in Image processing using Visual basic. Inorder to display an image, I am taking the position and color of each pixel and displaying it using Pset function.

Since the number of pixels that are to be plotted is very large, say 512x512, it takes a lotof time. I would like to know, how it is possible to speed up the process.

In C, we could write directlyto the video memory. How is this possible in Visual basic. Is any other method available ?

[Note : I cannot use the putimage function as each pixel has to be processed ]

Dec 27th, 1999, 08:44 PM
Try looking for big areas of color and filling them in with this statement:

LINE (X1, Y1)-(X2, Y2), C, BF

where X1 and Y1 are the upper-left coords, X2 and Y2 are the lower-right coords, and C is the color.

I'm not sure if this will work with what you are writing. What is it anyway?

manoj
Dec 28th, 1999, 08:36 AM
Thanks so much for your reply, sparkle. But I cannot use the Line function since I have to plot the color values of each pixel individually to increase the clarity of the image. This obviously takes a lot of time. So I figured if there was a way of writing the pixel values to video memory, then the whole process would be completed in a jiffy. Can anybody help ?

MikeyG
Dec 30th, 1999, 06:35 AM
I realise this won't be direcly helpful, but it might nudge either you or someone else in the right direction:

I don't think VB allows you to access memory directly, HOWEVER, I'm pretty sure I noticed that DirectX does (as an array, I think), so you could potentially use the DX7 object to do what you want to do...

Hope this isn't to unhelpful...

------------------
Mike
Software Developer

KENNNY
Jan 3rd, 2000, 06:49 PM
see my reply to your post above
(use BitBlt or if u want real speed, learn DX7) :)

------------------
cintel rules :p
www.cintelsoftware.co.uk

Tonio169
Jan 6th, 2000, 03:30 PM
manoj

i also made a project similar to what you are trying to do and encountered the same speed problem. first i take the color of a certain point in the source image with the Point function and draws it with the PSet function. what i did was made two or more lines of these to double the copying and painting process. sorry i forgot the correct syntax for the functions but here's a hint...

try comparing what finishes faster:

For i = 1 to 100000
Debug.Print i
Next i

-or-

For i = 1 to 100000 Step 4
Debug.Print i
Debug.Print i + 1
Debug.Print i + 2
Debug.Print i + 3
Next i

the second code is 4 times faster than the first one since it prints four times in one pass.

hope it helps! goodluck with your project.

KENNNY
Jan 6th, 2000, 05:28 PM
hmmm yeah that makes sense actaully. so games will draw as much as they can each loop, to speed it up? ill keep it in mind for DX7 (making a real time strategy)

------------------
cintel rules :p
www.cintelsoftware.co.uk