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

Home » Public Forums » archive » clever way to subregion an image?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
clever way to subregion an image? [message #70388] Fri, 09 April 2010 09:05 Go to next message
R.G.Stockwell is currently offline  R.G.Stockwell
Messages: 163
Registered: October 2004
Senior Member
I need to cut an image into 4 equal-size parts, which
obviously is very easy to do in a few lines.
image1 = im[0:nx/2-1, 0:ny/2-1]
image2 = im[0:nx/2-1, ny/2:*]
image3 = im[nx/2:*, 0:ny/2-1]
image4 = im[nx/2:*, ny/2:*]


i came across a way to do this with reform, but
it required 4 steps ( several reforms, a couple transposes)
to do it properly.

I'd be interested (just for fun) in a vectorized general way to do this
if any of you 'dimension jugglers' have any clever ideas,
for how to take an image and cut it into 4, or 16, or 64,
or 256 equal pieces (that would probably be about the maximum)

cheers,
bob
Re: clever way to subregion an image? [message #70456 is a reply to message #70388] Mon, 12 April 2010 11:46 Go to previous message
R.G.Stockwell is currently offline  R.G.Stockwell
Messages: 163
Registered: October 2004
Senior Member
"Philip Elson" <philipelson@googlemail.com> wrote in message
news:17e370fa-592b-4441-ac6f-b70fd1ddcad4@u21g2000yqc.google groups.com...
On 9 Apr, 17:05, "R.G. Stockwell" <noem...@please.com> wrote:
> I need to cut an image into 4 equal-size parts, which
> obviously is very easy to do in a few lines.
> image1 = im[0:nx/2-1, 0:ny/2-1]
> image2 = im[0:nx/2-1, ny/2:*]
> image3 = im[nx/2:*, 0:ny/2-1]
> image4 = im[nx/2:*, ny/2:*]
>
> i came across a way to do this with reform, but
> it required 4 steps ( several reforms, a couple transposes)
> to do it properly.
>
> I'd be interested (just for fun) in a vectorized general way to do this
> if any of you 'dimension jugglers' have any clever ideas,
> for how to take an image and cut it into 4, or 16, or 64,
> or 256 equal pieces (that would probably be about the maximum)
>
> cheers,
> bob

> Use the JPEG2000 object and get this cleverness for free :-)

Thank you Philip! I was not aware that existed. I'm reading through
the documentation now, sounds great.

cheers,
bob
Re: clever way to subregion an image? [message #70464 is a reply to message #70388] Mon, 12 April 2010 04:16 Go to previous message
philipelson is currently offline  philipelson
Messages: 9
Registered: March 2009
Junior Member
On 9 Apr, 17:05, "R.G. Stockwell" <noem...@please.com> wrote:
> I need to cut an image into 4 equal-size parts, which
> obviously is very easy to do in a few lines.
> image1 = im[0:nx/2-1, 0:ny/2-1]  
> image2 = im[0:nx/2-1, ny/2:*]  
> image3 = im[nx/2:*, 0:ny/2-1]  
> image4 = im[nx/2:*, ny/2:*]  
>
> i came across a way to do this with reform, but
> it required 4 steps ( several reforms, a couple transposes)
> to do it properly.
>
> I'd be interested (just for fun) in a vectorized general way to do this
> if any of you 'dimension jugglers' have any clever ideas,
> for how to take an image and cut it into 4, or 16, or 64,
> or 256  equal pieces  (that would probably be about the maximum)
>
> cheers,
> bob

Use the JPEG2000 object and get this cleverness for free :-)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: find max in 3D array -- slow
Next Topic: Printing in one line

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

Current Time: Wed Oct 08 13:51:47 PDT 2025

Total time taken to generate the page: 0.12049 seconds