Re: Maximum value array resampling [message #45026 is a reply to message #45025] |
Fri, 05 August 2005 12:18   |
b_efremova@yahoo.com
Messages: 18 Registered: July 2005
|
Junior Member |
|
|
Hi,
I'm not able to do it without loops, but I can do it with less loops.
Here's a program that makes it in two ways. The first is what I think
you probably are doing, and the second is twice faster for an array
2048x2048 ...you probably figured that much yourself, but since I did
it... here it is:
PRO test,im,y1,y2
x=im
ss=size(im,/dimensions)
n1=ss[0]/2.
n2=ss[1]/2.
y1=fltarr(n1,n2)
y2=y1
;--------- first way-----------
t10=systime(1)
for i=0,n1-1 do for j=0,n2-1 do begin
y1[i,j]=x[2*i,2*j] > x[2*i+1,2*j] > x[2*i,2*j+1]>x[2*i+1,2*j+1]
end
print,'time1=',systime(1)-t10
;--------- secon way-------------
t20=systime(1)
for i=0,n1-1 do x[i,*]=x[2*i,*] > x[2*i+1,*]
for i=0,n2-1 do y2[*,i]=x[0:n1-1,2*i] > x[0:n1-1,2*i+1]
print,'time2=',systime(1)-t20
;------
END
|
|
|