# Block Chromatic Noise

I love photography and image processing and this little project, that I wish to share with you, I finished way back in April 2012. I recently found this in my old dropbox account and thought I would share this with you.

The idea behind this “illusion” is very clever and comes from FIAP, the Fédération Internationale de l’Art Photographique, translated to the International Federation of Photographic Art, see video below.

The video shows how you should use a digital camera on a tripod with the shutter open for 1 second. The tv screen seems to be showing random noise, but when you look in the viewfinder on the image you just took, it will show you a clear, hidden photo. Somehow the noise has disappeared.

Here is the original video

For the benefit of this article, I will call the effect “Block Chromatic noise”, because the colored noise is confined to within blocks… I thought it needed a catchy name.

There are no instructions on how they do it, but what I can gather from the video, the people at FIAP use a grid to divide the image into tinted blocks. Say we have a white image and the block is the size of the image. If we open the shutter for 1 second, i.e. 30 frames, the block will have to expose Red, Green and Blue for the same amount of time, say 10 frames each. If we add black blocks, which simply delays the exposure and makes the image darker, we can let it be exposed for 10 frames also. If we run this clip, the resulting photograph will be white, or gray depending on the settings on the camera. Take this idea and divide the image into small blocks and randomize the order the colors are exposed, it will look more like noise, but the resulting colors are effectively accumulated during that 1 second and bring us the original image. We basically transform from 1 image to 30 images of Red Green Blue and Black tinted blocks. Needless to say, this method of storing an image is not very efficient.

Anyway, the method is essentially turning on and off blocks and tinting the blocks. My idea is to set each Red component of each block to 255 (maximum intensity) and let that block be shown that way, then set the Green component to 255 and let that be exposed, the same goes for Blue. The result will be that these modifications will not count, because Red+Green+Blue = White, so it will only brighten the photo. The reason I do this, is because I wish to create as noisy animation as possible. With black blocks it will darken the photo, so we need to balance these two. The photo that remains, shows the unaffected other components, see results below.

In order to make the noise random, I create a random “start matrix” used by the blocks. Then it is simply a matter of stepping through the animation. This is the responsibility of cm, the “colormap” variable. Because I want a kind of “white noise”, I choose to let the tint for each block be controlled by a periodic function

cm = cos( angle(k) – mask(i, j) );

where k is iteration variable, angle is the vector of angles and mask is the random matrix offset for each block. It is possible to use modulo instead, but I found that the resulting image is much clearer with cos. The idea behind the mask, is to let each block start from different positions of this cosine function. For specific positions on this cosine, I map (hence the name cm) tint colors with angle. Here is a part of the code:

tmp = im; %reset for each frame

for i = 1: 2*bs+1 :r-bs
for j = 1: 2*bs+1 :c-bs

cm = cos( angle(k) - mask(i, j) ); %near perfect exposure

if cm > 1-angle_scale && cm < 1
tmp(i:i+2*bs, j:j+2*bs, 3) = 255;

elseif cm < -1+angle_scale && cm > -1
tmp(i:i+2*bs, j:j+2*bs, 2) = 255;

elseif cm > -2*angle_scale && cm <= 2*angle_scale
tmp(i:i+2*bs, j:j+2*bs, 1) = 255;

else %dark for every other value
tmp(i:i+2*bs, j:j+2*bs, 1) = 0;
tmp(i:i+2*bs, j:j+2*bs, 2) = 0;
tmp(i:i+2*bs, j:j+2*bs, 3) = 0;
end
end
end

It is important to note that we spread the colors over the cosine values for min, max and near 0, so we get a more random animation. We also need to double the range in the second elseif. The angle_scale is responsible for how much spreading we have.

It is time to put the algorithm to the test. I created the noisy version of the image below and added it first in the video. The resulting image can be seen below. The rest of the sequences you can try out for yourself, it’s so much fun to do, hehe.

Image of a “big sister” from the video game Bioshock 2 developed by 2K Marin.

I attempted to upload a video to Youtube but compression artifacts really destroys the video, so I have a link directly to the file, right-click and download to view it with Media Player Classic or VLC which is better than Firefox built-in viewer.

(will replace link with video soon)

To debug the color mapping scheme I used a matrix to keep track on how much each color had been exposed. In the image below, the exposed matrix is tinted blue, possibly because of the camera setting (fluorescent light). The perfect exposure matrix should be very bright white. Worth mentioning is that If we change variable angle_scale to 0.01 we will have a very noisy render with lots of black blocks, but on the other hand we will have a very noisy exposure matrix.

The resulting image from a 1 second exposure (left) with the exposure matrix (right). Click on the image to see a larger version.