putting the kaleidoscope together

We now create a rather versatile kaleidoscope. Upon starting, the program lets us choose an image file and we will look through the kaleidoscope at this image. To get a large variety of pictures we interactively manipulate the input image with the mouse. Keeping the left mouse key pressed, we shift the input image around. With the right key pressed we rotate it and the mouse wheel changes its scale. Instead of the wheel we can also use the up and down arrow keys. Pressing the “s”-key, we get and save a high-resolution copy of the screen image. Afterwards, you will need to use other programs to enhance contrast and color range.

You find the code of the main tab in the next post. It needs “ColorLookup“, “Coordinates“, “Kaleidoscope“, “MakeOutputImage“, “MakeScreenImage“, “ProgressReport“, “Vector” and “readWriteImages“.

In “MakeOutputImage” we have to change the “theImage”-function into:

  color theImage(float i,float j){
    Vector vec=outputCoordinates.getVector(i,j);
    vec=mapping(vec);
    color c=inputColor.cubicInterpolation(inputCoordinates.getPixel(vec));
    return c;
  }

the “mapVector”-function in MakeScreenImage should be

 Vector mapVector(float i,float j){
   Vector vec=screenCoordinates.getVector(i,j);
    vec=mapping(vec);
   return vec;
 }

and the “colorFromVector”-function in MakeScreenImage should be (this is a correction I added the 4th february … Now it is complete.)

  color colorFromVector(Vector in){
    return inputColor.nextPixel(inputCoordinates.getPixel(in));
  }

The “mapping”-function of the main tab simply uses the kaleidodoscope object, but we can extend it to create other, even more interesting images.

This entry was posted in Kaleidoscopes, programming and tagged , , . Bookmark the permalink.

One Response to putting the kaleidoscope together

  1. Reblogged this on Symmorphmetry and commented:
    So good

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s