Monday, October 30, 2017

What's a Moiré ?

When the moon hits your eye like a big pizza pie that's a Moiré.
-   Dean Martin
Actually, Dean said "That's amore"
Amore is Italian for love.
Moiré is a more recent word that came into use around 1958 after we began using  color TVs.





A moiré pattern is the result of drawing fine lines on two transparencies and moving one over the other.
Any time there are two repeating patterns they can interfere with each other.

On a color TV, fine lines can cause color moiré patters by interference with the rows and columns of red, green and blue dots. That is why newscasters wear solid ties, shirts and jackets, never pinstripes.

Fine lined repeating patterns displayed on a computer monitor interfere with the rows and columns of  RGB dots.

Printers produce moiré patterns when the image interferes with the pattern the ink jet nozzles make when they pass in straight lines across the paper.

Moiré effects can be a bothersome side effect that ruins photos and video.

I recently decided to explore using patterns to create moiré effects in animated wallpapers.Here is one screen of notes from my experiments.
Click to enlarge
Simple moiré patterns can simulate waves on a lake, a waterfall, a flickering candle, or a forest fire.
In this case I wanted a hypnotic pattern on a sun.
The usual frame animation approach presents huge problems.
Consider a sun that is 300 pixels in diameter. That's 300 x 300 = 90,000 pixels.
We need three 8-bit bytes for each pixel so that is 24 bits times 90,000, or 2,160,000 bits.
So we need a little more than two megabits per frame.
At 30 frames per second for a pattern that lasts 15 seconds before it repeats, we need a total of  450 frames. Multiply 450 times 2,160,00 bits and get 97,200,000 bits, (12 megabytes)

Obviously, twelve megabytes of images being loaded from disk one frame at a time would kill the hard drive, or use up a lot of cache memory.  If I load the entire set of frames into memory then the processor can put them on the screen one frame at a time. But, that uses up a lot of ram and 30 frames per second, the CPU has to move 8 MB per second into the display memory. Testing shows it uses about 9 percent of my CPU on my laptop. It can  easily do it, but seems a total waste for a wallpaper.

Moiré to the rescue.
To create the moiré effect, I only need one 300x300 image. I display it twice, one on top of the other. Then 30 times a second., the CPU rotates the bottom image 1 degree. This requires almost no effort on the part of the CPU, The actual task of rendering the pattern is done by the GPUs in the video card.

By comparison, to the 9% CPU usage for the frame method, the task manager shows less than 1% CPU usage and a GPU usage increase to only 2% for the moiré effect.

Since most of the work is done by the video cards GPUs, this is called "Offloading" the work to the GPU to free up processor resources.

.... But is that what is really happening?


Here is the only image I loaded.

It is just straight lines.

There are NO curved lines
or hypnotic patterns.

Where did the pattern get rendered?

It was Offloaded to a neural network.

.....     The organic one 
.....              between your ears.






Tuesday, August 29, 2017

For the 7/29/2017 show I'll be talking about fake news on the web and being a Microsoft insider.

To listen, go to 1300WTLS com Tuesday 7:45AM and replay in the PM.

Tuesday, June 13, 2017

Teaching an AI to draw "Me".
Here is a gif  animation I created from just a few snapshots of an AI as it learns to paint a picture of  me. The first picture it outputs is just a grey square 200 by 200 pixels. Each attempt is compared to a picture of me and the AI is told how close it is to looking like me. I let the AI try 500,000 times. It took 3 hours. Considering that the AI only has 123 neurons, it did a pretty good job. It would need to have at least 4,000 neurons to paint an exact copy of the photo, but that is not the point. I just wanted to get a feel for how it learns.
I didn't use a massive super computer with billions of cores. I used my quad core Surface Book.
I didn't write any code. I used a Javas script AI that runs in a browser. The browser page lets you change a few lines of code to increase the depth and size of the neural networks and see how it relates to the speed and quality of the learning process,
If you want to watch AI's learning to play games, recognize characters, draw pictures and more, you can start here,   http://cs.stanford.edu/people/karpathy/convnetjs/index.html

Tuesday, June 6, 2017

Tuesday, April 25, 2017

Last Access Date Fix

In the windows explorer detail view you can sort your files by date created. Just click on the "Date Created" column heading.

Did you know you can also sort by date modified or date accessed?

Date modified is easy. Right click on any column heading in the detailed view of file explorer. Then add a check in the box next to "Date Modified". A new column will be added to your details view.

You might want to drag that column heading next to the "date Created" column.

Now finding a photo you cropped or tweaked a couple days ago is easy. Click the "Date Modified" column heading to sort the files, and it will be near the top of the list.

Now about finding a photo or document you loaded, but did not edit?
Right click a column heading. At the bottom of that list is "more", click it. Scroll down and locate "Date Accessed" and check it's box.

Now you don't have to edit a document or photo to have the date updated. Simply opening a photo or document will alter its "Date Accessed". Go ahead, Try it!

What! You say it doesn't work?

That is because Microsoft disabled the updateing last accessed date startin with windows 7.
You need to turn it back on.

1   Click or tap the windows button.
2   Type "command prompt"
3   Right click the Command Prompt Desktop App and select "Run as administrator"
4   At the prompt, type:
                                  fsutil behavior set DisableLastAccess 0
5   Press the enter key.
6    Close the command window.

Now, if you open a file and close it without modifying it. the Date Accessed column can be sorted to find the file.