comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Changing the order of true color images
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Changing the order of true color images [message #28838 is a reply to message #28824] Tue, 15 January 2002 02:01 Go to previous messageGo to previous message
Martin Downing is currently offline  Martin Downing
Messages: 136
Registered: September 1998
Senior Member
Hi Ronn,
Flipping an image in Y really is very trivial C code, but maybe if you are
not used to image data it seems hard. I'll do it for 2d for
you below, extending to 3d when pixel interleaved will be just a matter of
setting
sx = dim_x*3

excuse any sytax errors as Im writting this on the fly and am a little rusty
on my C code :), but I'd hope anyone using C could correct it!
ps: Byte == unsigned char

void flipY(Byte *image, int sx, int sy) // image block , x_size, y_size
{
int i,j, hy;
Byte tmp; // temp storage for
hy = sy/2; // halfway though the image

for (j = 0;j <hy;j++) {
for (i = 0;i <sx;i++) {
// SWAP PIXELS [i,j] <=> [i,sy-j]
tmp = image[i+sx*j];
image[i+sx*j]= image[i+sx*(sy-j)]);
image[i+sx*(sy-j)]) = tmp;
} // END FOR I
}// END FOR J

} // END FUNCTION


--
----------------------------------------
Martin Downing,
Clinical Research Physicist,
Grampian Orthopaedic RSA Research Centre,
Woodend Hospital, Aberdeen, AB15 6LS.
m.downing@abdn.ac.uk

"ronn kling" <ronn@rlkling.com> wrote in message
news:B868C3C9.409F%ronn@rlkling.com...
> ?
>>
>> Have you tried the TRANSPOSE function?
>>
>> For example, to change the dimensions from (3, m, n) to (m, n, 3):
>>
>> a = transpose(temporary(a), [1, 2, 0])
>>
> Hi Liam,
>
> I guess I should have been clearer... Right now I can rotate the image
once
> I get it back into IDL, but I would prefer to rotate it on the C side.
Speed
> isn't the issue, having a clean interface for the user is.
>
> I know it is just loops and such, but I was hoping that someone had
already
> solved it.
>
> Thanks,
> Ronn
>
>
> --
> Ronn Kling
> KRS, inc.
> email: ronn@rlkling.com
> "Application Development with IDL" programming book updated for IDL5.5!
> "Calling C from IDL, Using DLM's to extend your IDL code" NEW BOOK!
> http://www.rlkling.com/
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Segmentation of Multiple ROIs
Next Topic: Re: problem after upgrading

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:10:45 PDT 2025

Total time taken to generate the page: 0.37082 seconds