interactive frequency filtering program geoff franz

Post on 17-Jan-2016

218 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Interactive Frequency Filtering Program

Geoff Franz

Overview

Concept and Problem Statement Solution User’s Guide Program Components Suggestions for Future Revisions Demo

Concept and Problem Statement

Sometimes you find images that suffer from obvious frequency-domain artifacts (e.g., halftoning, banding, etc)

I don’t know of any programs that let someone interactively filter in the frequency domain and see the results in real time

Solution

Write my own!

User’s Guide – Startup Screen

This is what the user sees when the program is launched.

User’s Guide – Opening an Image

This is what the user sees when a large image is opened.

User’s Guide – Opening an Image

This is what the user sees when a small image is opened.

User’s Guide – Drawing the Mask

The white lines are what the user sees when drawing with a small brush.

User’s Guide – Drawing the Mask

The white lines are what the user sees when drawing with a large brush.

User’s Guide – Drawing the Mask

The black areas are the result of drawing the mask.

User’s Guide – Mask Smoothing

The program can also create smoothed masked areas.

User’s Guide – Final Result

This is an example of a possible end result.

Program Components

These are the procedures and functions I wrote to solve the problem

Gaus, Show_FFT, Image_Display, Drawline_Draw_Events, Wid_Base_0_Event, IFF_GUI

Info structure They are explained in the following slides

Gaus

Returns a Gaussian function given an input.

Equation:

The Gaus function has obvious applications outside of this program, although it’s been written many times before

2xe

Show_FFT

Prepares a shifted FFT array for displayZeroes out the DC componentApplies an overall logarithmic brightness

transformApplies a radially-dependent brightness

transform Displays the modified FFT in the chosen

window

Image_Display

Reads in an image Computes the FFT and creates a mask Initializes an “info” structure that is used for the

remainder of the program Displays the image in the left and right panels,

and calls Show_FFT to display the FFT in the center panel

Enables button events in the center draw widget

Info Structure info = {image:image, $ ;the image itself pixID:-1, $ ;window ID of the hidden pix map fftimage:fftimage,$ ;FFT of the image wid0:wid0, wid1:wid1, wid2:wid2, $ ; window IDs imageID:WID_DRAW_0,$ ;left draw widget ID drawID:WID_DRAW_1,$ ;center draw widget ID filtID:WID_DRAW_2, $ ;right draw widget ID xsize:xs, ysize:ys, $ ;dimensions of the image xstart:-1, ystart:-1,$ ;starting location of the drawn line mask:mask, $ ;mask for the FFT xmid:xmid, ymid:ymid, $ ;central pixel location xvalues:ptr_new(),yvalues:ptr_new(),$ ;vertices for drawing the line buttonUsed:'None', $ ;which mouse button is currently selected ;this could be used to enable different ;functionality from the right mouse button drawColor:!D.N_colors-1} ;set the draw color to white

Drawline_Draw_Events

Loosely based on David Fanning’s drawline.pro example

This code handles all mouse events in the center draw widget

Uses the IDL PlotS procedure to draw the lines on the screen

Reads the slider to determine brush thickness Modifies the mask and updates the screen

Wid_Base_0_Event

Handles all other events (buttons and slider)

The following code is contained within this procedure:Testing if an image is valid before openingSaving the filtered image Smoothing the maskRevert back to the original state

IFF_GUI

This is where the widgets are created. Not too exciting.

Suggestions for Future Revisions

All of my suggestions fall into one of three categories:

Robustness and bug fixes Features (low-hanging fruit) Aesthetics

Suggestions: Robustness

Properly handle TIFF, PNG, GIF, and color images of all kinds

Fix the bug where if the user clicks outside the draw widget, drags the mouse inside, and releases, the program crashes when it tries to dereference a null pointer

Fix the bug where it crashes if a user clicks on a button (other than open image) before an image is loaded

Suggestions: Features

Undo last line drawn button Display color images and work on the

channels individually Add the ability to draw boxes and circles Add the ability to save to different file

formats other than PNG

Suggestions: Aesthetics

Make the GUI shrink to accommodate smaller images, so less space is wasted

Demo

The following is a demonstration of my program

top related