How to track the time taken to convert the color of an image?
Hi Guys,
I have a question here. I have a program that converts an image from its original color to another pseudo color using a color look-up table. I have used different methods to achieve this, ie VB routines or API routines.
So, I would like to know how do I add a timer that can starts counting when I clicked on the cmdConvert button and stops the moment it finishes the conversion?
Can somebody help me with this??
Thanks alot guys.... :D
[484 byte] By [
ootnitsuj] at [2007-11-11 8:18:31]

# 1 Re: How to track the time taken to convert the color of an image?
if u meen the timmer controler then put "Doevents" lots of places in your convert code
"Doevents" tells the computer to catch up on what it needs to do such a timmer counting
Let me know if this works :)
# 2 Re: How to track the time taken to convert the color of an image?
If you simply want to determine elapsed time, you can do this:
Dim StartTime As Double
Dim EndTime As Double
' Store start time in variable "StartTime"
StartTime = Timer
' Call code to be timed here
' Store end time in variable "EndTime"
EndTime = Timer
' Print execution time to the debug window
Debug.Print "Execution time in seconds: ", EndTime - StartTime
# 3 Re: How to track the time taken to convert the color of an image?
Hi Phil,
I have tried your method:
Dim StartTime As Double
Dim EndTime As Double
' Store start time in variable "StartTime"
StartTime = Timer
'Image Conversion Code
For x = 0 to picPicture1.Width - 1
For y = 0 to picPicture1.Height - 1
.......
Next y
Next x
' Store end time in variable "EndTime"
EndTime = Timer
'To show the time elasped in a textbox
txtConversionTime = EndTime - StartTime
But some how, the value is always shown to be 0. Is it that the time taken is so much smaller than a second thats why? Is the time elasped always in seconds? Can i change it to ms or even us?
Can somebody help?? Thanks alot guys.
Regards,
Justin
# 4 Re: How to track the time taken to convert the color of an image?
Yes, the conversion is taking less time than the resolution of VB's Timer function. You might try one of these techniques: http://www.google.com/search?q=vb+high+resolution+timer