An Autonomous Agent

exploring the noosphere

Removing Bad, Hot, Dead Pixels – GIMP

My 5MP A3550UPA Omax CCD has about 20 bad (hot or dead) pixel groups in every image. They seem to be identical through time and are noticeable on my raw images. Typically, the panoramas I create are composed of between 80 and 200 individual images that I stitch together manually. Before stitching I go through the images with the GIMP blur tool in order to remove these bad CCD pixels. Thus, I have to blur between 1,600 and 4,000 pixel groups. A tedious task! This takes between one and two weeks to complete, depending on my free time.

Bad CCD Example

Bad CCD Example – Blue

My patience for this corrective task has run dry. Since I knew that GIMP was theoretically capable of performing such a repetitive task via a custom script, I decided to develop such a script. The final result is a tiny piece of code. Its brevity masks the hours of frustration and hopeless despair I encountered while learning Scheme and integrating the commands into GIMP as a valid working procedure. My work has paid off. I now have a script which corrects all my bad pixels.

Github – Bad CCD Fix Script

At first I tried to develop a script based on layer masks and Gaussian blurring. The results were never what I wanted. For instance a Gaussian blur mask on only the bad pixels still contained some of the original RGB color information from the bad pixels. I then tried doing the Gaussian blur preceded by a selection remove of the bad pixels. However, this had a problem – the Gaussian blur is not fully colored in the removed bad pixel areas, i.e. transparency issues remain in the removed pixel holes. The final result had colors were not quite correct.

Gaussian Blur Without Bad Pixel

Gaussian Blur Without Bad Pixel

Isolate the Pixel

Isolate the Pixel

I thought I had reached a brick wall and that I may have to do the pixel correction manually as before.

After a little research I found the work of Dr. Paul Harrison, who has created an amazing GIMP Python plugin designed for complex pixel correction. You can read about this plugin and all its cool features at Pat David’s blog.

The final code flows from this discovery and the entire script is centered around the Heal Selection plugin. The script loops through a set of images and prepares them for the Heal Selection function.

The selection is based off a static file containing the black points in the precise locations of the bad CCD pixels. The script takes this reference file and using the GIMP “Alpha to Selection” creates a selection based on the black points.

Black Point Example

Black Point Example

The manual GIMP steps for the script are:

  1. Open the image
  2. Add the “black points” PNG image as a layer
  3. Right click on the “black points” layer and click “Alpha to Selection”
  4. Merge layers, aka flatten
  5. Click Heal Selection plugin and enter desired parameters
  6. Clear selection
  7. Save

Thanks to this script I can turn a week or two of work into an hour or less. NOTE: I was only able to successfully run the script via the GIMP internal console.

I have included test images and example commands in the Github folder.

The Coming War on China – John Pilger

John Pilger’s upcoming film The Coming War on China (Consider supporting via the link on his Indiegogo page)

The link on YouTube keeps getting removed. Once an official version is posted I’ll update this post with a fresh link. Until then…

The Scientist – Raphael Mechoulam

The Scientist details the life and work of Raphael Mechoulam, the grandfather of delta-9-tetrahydrocannabinol (THC). He stands in that class of wonderful thinkers which includes people like Albert Hofmann, Alexander Shulgin, among others.

Mycelium Running: How Mushrooms Can Help Save the World – Paul Stamets

Know nothing about mushrooms, fungi, or mycelia? — Paul Stamet’s Mycelium Running opens a door to an exotic universe beneath your feet. Fungi and their interaction with ecosystems upturn all of what you thought you knew about the button mushrooms on your salad or pizza. Fungi, simply and truely, are incredibly important and amazing organisms. And as Stamets proves, they are a powerful tool to maintain the world for all of our descendants — not to mention their ability to provide a healthy and functioning human immune system.

Fungi Perfecti is Stamet’s family owned company for those interested in supporting mycoremediation, mycoforestry, mycofiltration, or mycopesticides.

Paul Stamets Videos

Paul Stamets speaks about the power and importance of mushrooms:

Younger Stamets talking about Psilocybin Mushrooms:

Great Lecture about Fungi:

Mushrooms as medicine for humans (and bees!):

Page 1 of 69

Powered by WordPress & Theme by Anders Norén