Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Is there any idea to improve execute time?
Started by tcc5936 at 05-03-2007 11:24. Topic has 3 replies.

Print Search « Previous Thread Next Thread »
  05-03-2007, 11:24
tcc5936 is not online. Last active: 5/3/2007 4:14:28 PM tcc5936

Not Ranked
Joined on 05-03-2007
Posts 2
Is there any idea to improve execute time?
Reply Quote

below codes is to slow(when picture size is 320X240 then execute time about 2 sec.)      

        Dim nHeight As Long = view.Raster.BitmapHeight
        Dim nWidth As Long = view.Raster.BitmapWidth
        Dim x As Long = 0
        Dim y As Long = 0

        Dim picArray(320, 240) As Long

        For y = 0 To nHeight - 1

            For x = 0 To nWidth - 1

                picArray(x, y) = CLng(view.Raster.Pixel(x, y))

            Next

        Next

Is there any idea to improve execute time?

Thanks a lot.

 

Beat regards.,

JACKY


   Report 
  05-03-2007, 14:59
GregR is not online. Last active: 10/10/2008 11:46:18 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,621
Re: Is there any idea to improve execute time?
Reply Quote
What LEADTOOLS version and interface (API, CLIB, OCX, etc.) are you using?

Your code above is quite simple, so there's really not much refactoring you can do to improve it's speed.  Either way you're going to be executing picArray(x,y) = CLng(view.Raster.pixel(x,y)) 76,800 times.  The only thing I can see that might increase execution time is to use a variable for nHeight -1 rather than calculating it at the for loop.  Even so, this would only shave off a few microseconds...possibly even only nanoseconds depending on your processor.

Dim yMax as Long = nHeight -1
Dim xMax as Long = nWidth - 1

For y = 0 To yMax

            For x = 0 To xMax

                picArray(x, y) = CLng(view.Raster.Pixel(x, y))

            Next

        Next

What exactly are you trying to do?  There might be a better way to do it if you explain your goals in more detail.
Greg Ross
LEADTOOLS Technical Support
   Report 
  05-04-2007, 19:30
tcc5936 is not online. Last active: 5/3/2007 4:14:28 PM tcc5936

Not Ranked
Joined on 05-03-2007
Posts 2
Re: Is there any idea to improve execute time?
Reply Quote

 Thanks GregR!

I use ocx version.

is there any method that quick copy pixels data to a two dimension array?  

Beast Regards.,

jacky


   Report 
  05-07-2007, 14:17
GregR is not online. Last active: 10/10/2008 11:46:18 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,621
Re: Is there any idea to improve execute time?
Reply Quote
I've spoken with some of my colleagues and they agree that what you are currently doing is already the best way to copy the pixel data into a two-dimensional array.

Greg Ross
LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » Enduser » LEADViEW » Is there any idea to improve execute time?

Powered by Community Server, by Telligent Systems