Forums > Jitter

scanning a mirror darkly

December 4, 2006 | 4:19 am

Hello all,
I’m sure this has an easy solution. In fact, that’s why I’m posting here! I’ve been closing in on a solution, but my life has been cluttered with vomiting children in the past few days, and I can’t quite think clearly enough for the last little bit.

So, I want to

1) use a ‘mirrored image’, such as http://imig.colorado.edu/~theodore/mirror.jpg

2) using srcdimstart etc., scan a smaller window (say 50×50 pixels) from this image, and strech it out into the final dimensions. so, I might use the following from my input image: left 0, top 0, right 50, bottom 50, and stretch that rect onto these locations of my output destination: left 0, top, 0, right 536, bottom, 300

3) slide the window along, either vertically, or horizontally, maintaining the 50×50 scanning dimensions

4) here’s the catch–I’d like to be able to seamlessly go off of one edge and wind up on the other side (the ‘asteroids’ effect). so if i send my scanning window down past the bottom of the original image, i’d like have it appear to loop back around to the top, with no discontinuity. it should be able to keep looping around forever, with no one the wiser (as if it were scanning some enormously huge tiled image).

The way I’ve been trying to do it involves two layers and alpha masking. Let’s take the example of vertical movement, imagining that we are starting the scanning rect at the top of the image, and moving down vertically. In the case where a 50×50 window give me bottom which hasn’t gone off the edge of the original image, then there is no need to mask anything. However, as soon as the bottom rect value goes past the bottom of my source image, I jump the lowest layer back up to the top of the source image, and create an alpha channel which allows this lowest layer to be seen only at the appropriate part of the window (the boundary of the bottom and top of the source image). Then, the amount of the lowest layer continues to expand, until the highest layer hits the bottom of the image and loops back around, at which time there is no need for a mask again. If I had about 10 more functioning brain cells, I could get this fully working.

However, I’m wondering, is there a better/more elegant solution, maybe even one that some kind soul who wishes to share has already implemented?

regards,
Michael

‘they wetly bow with hydrocephalitic listlessness / ants mop up their brow’

http://spot.colorado.edu/~theodorm/


December 4, 2006 | 4:26 am

You could just use jit.resamp to do everything for you. It does image
offsetting/scaling/wrapping/interpolating all in one little package.

wes

On 12/3/06, Michael Theodore wrote:
>
> Hello all,
> I’m sure this has an easy solution. In fact, that’s why I’m posting here! I’ve been closing in on a solution, but my life has been cluttered with vomiting children in the past few days, and I can’t quite think clearly enough for the last little bit.
>
> So, I want to
>
> 1) use a ‘mirrored image’, such as http://imig.colorado.edu/~theodore/mirror.jpg
>
> 2) using srcdimstart etc., scan a smaller window (say 50×50 pixels) from this image, and strech it out into the final dimensions. so, I might use the following from my input image: left 0, top 0, right 50, bottom 50, and stretch that rect onto these locations of my output destination: left 0, top, 0, right 536, bottom, 300
>
> 3) slide the window along, either vertically, or horizontally, maintaining the 50×50 scanning dimensions
>
> 4) here’s the catch–I’d like to be able to seamlessly go off of one edge and wind up on the other side (the ‘asteroids’ effect). so if i send my scanning window down past the bottom of the original image, i’d like have it appear to loop back around to the top, with no discontinuity. it should be able to keep looping around forever, with no one the wiser (as if it were scanning some enormously huge tiled image).
>
> The way I’ve been trying to do it involves two layers and alpha masking. Let’s take the example of vertical movement, imagining that we are starting the scanning rect at the top of the image, and moving down vertically. In the case where a 50×50 window give me bottom which hasn’t gone off the edge of the original image, then there is no need to mask anything. However, as soon as the bottom rect value goes past the bottom of my source image, I jump the lowest layer back up to the top of the source image, and create an alpha channel which allows this lowest layer to be seen only at the appropriate part of the window (the boundary of the bottom and top of the source image). Then, the amount of the lowest layer continues to expand, until the highest layer hits the bottom of the image and loops back around, at which time there is no need for a mask again. If I had about 10 more functioning brain cells, I could get this fully working.
>
> However, I’m wondering, is there a better/more elegant solution, maybe even one that some kind soul who wishes to share has already implemented?
>
> regards,
> Michael
>
>
>
>
> ‘they wetly bow with hydrocephalitic listlessness / ants mop up their brow’
>
> http://spot.colorado.edu/~theodorm/
>
>
>
>
>
>


December 4, 2006 | 4:36 am

Quote: wesley.hoke@gmail.com wrote on Sun, 03 December 2006 21:26
—————————————————-
> You could just use jit.resamp to do everything for you. It does image
> offsetting/scaling/wrapping/interpolating all in one little package.
>
> wes
>

cool – ’nuff said then! thanks….


Viewing 3 posts - 1 through 3 (of 3 total)