MATLAB Examples

The Droste Effect

The Droste Effect is when an image recursively includes itself. The basic method is to insert a scaled copy of the image, but more interesting results can be acheived via conformal mapping. This demo shows some effects that can be created by varying parameters of the Droste Effect.

Droste Effect Tool GUI

This GUI can load an image, set a rectangular region for the effect, apply the Droste Effect, adjust parameters of the effect, and save the final image back to disk. The GUI uses droste_effect.m, which is a stand alone function for applying the Droste Effect.

```imshow('droste_gui.png') ```

Create Demo Image

The rest of this demo will call droste_effect.m directly and process the image created below.

```% construct an image img = zeros(600); img(181:421,181:421) = 1; img(201:400,201:400) = 0; for i = 40:40:size(img,1) img(i,:) = 1; img(:,i) = 1; end % define region to apply Droste effect reg = [201 201 200 200]; % show image imshow(img) ```

Default Droste Parameters

```img_out = droste_effect(img, reg); imshow(img_out) ```

Zoom = 1.5

```img_out = droste_effect(img, reg, 'zoom', 1.5); imshow(img_out) ```

Hshift = 0.3, Vshift = 0.4

```img_out = droste_effect(img, reg, 'hshift', 0.3, 'vshift', 0.4); imshow(img_out) ```

Rotate = 45 degrees

```img_out = droste_effect(img, reg, 'rotate', 45); imshow(img_out) ```

Spirals = 2

```img_out = droste_effect(img, reg, 'nspiral', 2); imshow(img_out) ```

Number of copies = 2

```img_out = droste_effect(img, reg, 'ncopies', 2); imshow(img_out) ```

Max recursion = 1

```img_out = droste_effect(img, reg, 'maxrecur', 1); imshow(img_out) ```

Width = 400 px

```img_out = droste_effect(img, reg, 'width', 400); imshow(img_out) ```

Anti-aliasing factor = 4

```img_out = droste_effect(img, reg, 'aafactor', 4); imshow(img_out) ```

Put it all together

```img_out = droste_effect(img, reg, ... 'zoom', 1.5, ... 'hshift', 0.3, ... 'vshift', 0.4, ... 'rotate', 45, ... 'nspiral', 2, ... 'ncopies', 2, ... 'maxrecur', 10, ... 'width', 600, ... 'aafactor', 4); imshow(img_out) ```