Re: Faster way?

new topic     » goto parent     » topic index » view thread      » older message » newer message

This is a bit faster...

for i = 1 to length(image) do
    image_row = image[i]
    back_row = background[i]
    x = find(255,image_row)
    while x do
        image_row[x] = back_row[x]
        x = find(255,image_row)
    end while
    image[i] = image_row
end for

The difference is that you use the image sequence and not the resultant
background sequence.
It also assumes that 255 is not in the background sequence.

----------------
cheers,
Derek Parnell
----- Original Message -----
From: <dubetyrant at hotmail.com>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, December 25, 2002 9:12 AM
Subject: Faster way?



Hello,
I'm wondering if there is a more efficient(meaning faster) way of
comparing each element of a sequence with each element of another
sequence of the same size.Im matching an image with a background image,and
any whitespace I find,I want to convert to the background image.




sequence image

sequence background

for i= 1 to length(image) by 1 do

 for j=1  to length(image[1]) by 1 do
 temp=compare(image[i][j],background[1][j])

 if image[i][j]=255 then
 image[i][j]=background[1][j]

 end if

  end for
end for


Note:Sorry I havent been able to help on some of the other problems
posted here,its just that I really don't have much experience with
programming.Maybe someday I'll be able to help out more
                                   Thanks,
                                      JDUBE

==^^===============================================================
This email was sent to: ddparnell at bigpond.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu