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

Home » Public Forums » archive » Re: programmatically guess image dimensions?
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: programmatically guess image dimensions? [message #45116] Thu, 11 August 2005 10:44
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
Here's a couple ideas that might get you going. First, you might want
to try looking at the prime factorizations of the number of elements.
This is essentially what you did in your 9 x 4 case. 36 breaks down
into 2 x 2 x 3 x 3... which then can be recombined into 3 x 3 x 4 or 2 x
3 x 6 or 2 x 2 x 9. If I understand you correctly, you'd want the most
cube shaped, or put another way, the one with the least variance in edge
size. I want to say that if you just sum up the edge lengths, the
smallest total will be the most cube-like. I think there's some
geometry formula about that, but I can't remember it off the top of my head.

If your prime factorization doesn't yield very good results, then add
one to your number of elements and repeat. You'll need some rule to
indicate whether the cube you come up with is okay or if you should try
again with the next number in the sequence. For example, which is
better if you have 14 elements? Is 1 x 2 x 7 with no empty spaces or is
it 1 x 3 x 5 with one empty space or is it 2 x 2 x 4 with two empty
spaces? Whatever the case, you'll need a rule to determine whether to
stop or to try again.

HTH,
Mike


Jeff N. wrote:
> Hi everyone,
>
> I have managed to run across several situations where I've wanted to
> take tabular data and make a "pseudo-image" cube out of the data so
> that I could easily use some of ENVI's statisical routines. What I want
> to do is write code that, given the number of records in the tabular
> data, comes up with the best dimensions for the pseudo-image cube. So,
> for example, if i have 9 records with 4 columns of tabular data, i'd
> like my code to tell me that this should end up being a 3x3x4 cube. If
> I have 13 records, I'd like it to tell me to arrange those in a 3x5
> grid, with 2 "empty" pixels containing 0's. So my question is, does
> anyone know a good way to come up with the largest rectangle I can make
> to use as my image dimensions, with the fewest number of empty pixels?
> I won't have a huge number of records, so I don't *think* I need to
> make computational efficiency top priority. Anybody have any ideas to
> get me started?
>
> Thanks!
> Jeff
>
[Message index]
 
Read Message
Previous Topic: programmatically guess image dimensions?
Next Topic: Re: stereo in window

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

Current Time: Thu Oct 09 22:44:56 PDT 2025

Total time taken to generate the page: 0.16264 seconds