Re: Average over odd/even lines [message #51836 is a reply to message #51819] |
Wed, 06 December 2006 20:54  |
jschwab@gmail.com
Messages: 30 Registered: December 2006
|
Member |
|
|
One caveat is that I'm not exactly sure how you want to deal with the
last even numbered line. But here's what I would probably do. (I'm sure
JD, David, or someone else can probably come up with something a bit
more clever.)
; picks off the odd rows
oddlines = oldimage[*, indgen(240) * 2]
; averages odd row with odd row below it by adding the odd lines
; to themselves shifted up a row
evenlines = (oddlines + shift(oddlines, -640)) * .5
; puts the even rows after the odd rows
; and then reshapes so they are below
new_image = reform([oddlines, evenlines], 640, 480)
The shift statement moves row 3 -> row 1, and row 1 -> row 479, that
means in the final image, row 480 is the mean of row 1 and row 479,
which is probably not how you want it.
Other than the last row, I think this is a decent way, though it
doesn't use histogram. :-)
Cheers,
Josiah
Pete wrote:
> Hi All,
>
> I am trying to write an IDL program for "smoothing" over lines of image
> data acquired with an aerial CCD system. This requires reading the odd
> lines, calculating the mean and placing it in the even. The images are
> a constant 640x480 pixels.
>
> i.e.)
> line 1 : 2 2 2 2...
> line 2 : x x x x...
> line 3 : 4 4 4 4...
>
> After processing,
>
> line 1 : 2 2 2 2...
> line 2 : 3 3 3 3...
> line 3 : 4 4 4 4...
>
> I can think of several ways to implement this but I thought the group
> may point me to the most efficient.
>
> Thanks,
> Pete
|
|
|