interactive frequency filtering program geoff franz

25
Interactive Frequency Filtering Program Geoff Franz

Upload: roxanne-gray

Post on 17-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Interactive Frequency Filtering Program Geoff Franz

Interactive Frequency Filtering Program

Geoff Franz

Page 2: Interactive Frequency Filtering Program Geoff Franz

Overview

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

Page 3: Interactive Frequency Filtering Program Geoff Franz

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

Page 4: Interactive Frequency Filtering Program Geoff Franz

Solution

Write my own!

Page 5: Interactive Frequency Filtering Program Geoff Franz

User’s Guide – Startup Screen

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

Page 6: Interactive Frequency Filtering Program Geoff Franz

User’s Guide – Opening an Image

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

Page 7: Interactive Frequency Filtering Program Geoff Franz

User’s Guide – Opening an Image

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

Page 8: Interactive Frequency Filtering Program Geoff Franz

User’s Guide – Drawing the Mask

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

Page 9: Interactive Frequency Filtering Program Geoff Franz

User’s Guide – Drawing the Mask

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

Page 10: Interactive Frequency Filtering Program Geoff Franz

User’s Guide – Drawing the Mask

The black areas are the result of drawing the mask.

Page 11: Interactive Frequency Filtering Program Geoff Franz

User’s Guide – Mask Smoothing

The program can also create smoothed masked areas.

Page 12: Interactive Frequency Filtering Program Geoff Franz

User’s Guide – Final Result

This is an example of a possible end result.

Page 13: Interactive Frequency Filtering Program Geoff Franz

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

Page 14: Interactive Frequency Filtering Program Geoff Franz

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

Page 15: Interactive Frequency Filtering Program Geoff Franz

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

Page 16: Interactive Frequency Filtering Program Geoff Franz

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

Page 17: Interactive Frequency Filtering Program Geoff Franz

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

Page 18: Interactive Frequency Filtering Program Geoff Franz

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

Page 19: Interactive Frequency Filtering Program Geoff Franz

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

Page 20: Interactive Frequency Filtering Program Geoff Franz

IFF_GUI

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

Page 21: Interactive Frequency Filtering Program Geoff Franz

Suggestions for Future Revisions

All of my suggestions fall into one of three categories:

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

Page 22: Interactive Frequency Filtering Program Geoff Franz

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

Page 23: Interactive Frequency Filtering Program Geoff Franz

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

Page 24: Interactive Frequency Filtering Program Geoff Franz

Suggestions: Aesthetics

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

Page 25: Interactive Frequency Filtering Program Geoff Franz

Demo

The following is a demonstration of my program