AUTO-FOCUS USING PSD ESTIMATION EFFECTIVE BANDWIDTH By Laurence G. Hassebrook

Similar documents
For the SIA. Applications of Propagation Delay & Skew tool. Introduction. Theory of Operation. Propagation Delay & Skew Tool

Auto-Teach. Vision Inspection that Learns What a Good Part Is

NENS 230 Assignment #2 Data Import, Manipulation, and Basic Plotting

The following exercises illustrate the execution of collaborative simulations in J-DSP. The exercises namely a

EDDY CURRENT IMAGE PROCESSING FOR CRACK SIZE CHARACTERIZATION

USING MATLAB CODE FOR RADAR SIGNAL PROCESSING. EEC 134B Winter 2016 Amanda Williams Team Hertz

Getting Started with the LabVIEW Sound and Vibration Toolkit

Lecture 2 Video Formation and Representation

UNIVERSITY OF BAHRAIN COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

Please feel free to download the Demo application software from analogarts.com to help you follow this seminar.

Reproducibility Assessment of Independent Component Analysis of Expression Ratios from DNA microarrays.

Getting Graphical PART II. Chapter 5. Chapter 6. Chapter 7. Chapter 8. Chapter 9. Beginning Graphics Page Flipping and Pixel Plotting...

FRAME RATE CONVERSION OF INTERLACED VIDEO

DATA COMPRESSION USING THE FFT

PulseCounter Neutron & Gamma Spectrometry Software Manual

Interlace and De-interlace Application on Video

The Lecture Contains: Frequency Response of the Human Visual System: Temporal Vision: Consequences of persistence of vision: Objectives_template

Durham Magneto Optics Ltd. NanoMOKE 3 Wafer Mapper. Specifications

ZONE PLATE SIGNALS 525 Lines Standard M/NTSC

Automatic LP Digitalization Spring Group 6: Michael Sibley, Alexander Su, Daphne Tsatsoulis {msibley, ahs1,

Table of Contents. 2 Select camera-lens configuration Select camera and lens type Listbox: Select source image... 8

Digital Correction for Multibit D/A Converters

Precise Digital Integration of Fast Analogue Signals using a 12-bit Oscilloscope

Chapter 6. Normal Distributions

Detection and demodulation of non-cooperative burst signal Feng Yue 1, Wu Guangzhi 1, Tao Min 1

Multiple-Window Spectrogram of Peaks due to Transients in the Electroencephalogram

MultiSpec Tutorial: Visualizing Growing Degree Day (GDD) Images. In this tutorial, the MultiSpec image processing software will be used to:

CHAPTER 7 BASIC GRAPHICS, EVENTS AND GLOBAL DATA

SpectraPlotterMap 12 User Guide

FPGA IMPLEMENTATION AN ALGORITHM TO ESTIMATE THE PROXIMITY OF A MOVING TARGET

The BAT WAVE ANALYZER project

Evaluating Oscilloscope Mask Testing for Six Sigma Quality Standards

PYROPTIX TM IMAGE PROCESSING SOFTWARE

Reconstruction of Ca 2+ dynamics from low frame rate Ca 2+ imaging data CS229 final project. Submitted by: Limor Bursztyn

Doubletalk Detection

ECE438 - Laboratory 1: Discrete and Continuous-Time Signals

Region Adaptive Unsharp Masking based DCT Interpolation for Efficient Video Intra Frame Up-sampling

N T I. Introduction. II. Proposed Adaptive CTI Algorithm. III. Experimental Results. IV. Conclusion. Seo Jeong-Hoon

1ms Column Parallel Vision System and It's Application of High Speed Target Tracking

EMBEDDED ZEROTREE WAVELET CODING WITH JOINT HUFFMAN AND ARITHMETIC CODING

Part 1: Introduction to Computer Graphics

Getting Images of the World

Elasticity Imaging with Ultrasound JEE 4980 Final Report. George Michaels and Mary Watts

Release Notes for LAS AF version 1.8.0

Chapter 6: Real-Time Image Formation

Delta-Sigma Modulators

DELTA MODULATION AND DPCM CODING OF COLOR SIGNALS

Peak Dynamic Power Estimation of FPGA-mapped Digital Designs

BEAMAGE 3.0 KEY FEATURES BEAM DIAGNOSTICS PRELIMINARY AVAILABLE MODEL MAIN FUNCTIONS. CMOS Beam Profiling Camera

Phone-based Plosive Detection

Multichannel Satellite Image Resolution Enhancement Using Dual-Tree Complex Wavelet Transform and NLM Filtering

ECE532 Digital System Design Title: Stereoscopic Depth Detection Using Two Cameras. Final Design Report

BER MEASUREMENT IN THE NOISY CHANNEL

ISOMET. Compensation look-up-table (LUT) and How to Generate. Isomet: Contents:

UNIVERSAL SPATIAL UP-SCALER WITH NONLINEAR EDGE ENHANCEMENT

BASIC LINEAR DESIGN. Hank Zumbahlen Editor Analog Devices, Inc. All Rights Reserved

Bias, Auto-Bias And getting the most from Your Trifid Camera.

Normalization Methods for Two-Color Microarray Data

Smart Coding Technology

Digital holographic security system based on multiple biometrics

Introduction. Edge Enhancement (SEE( Advantages of Scalable SEE) Lijun Yin. Scalable Enhancement and Optimization. Case Study:

Controlling adaptive resampling

A NEW LOOK AT FREQUENCY RESOLUTION IN POWER SPECTRAL DENSITY ESTIMATION. Sudeshna Pal, Soosan Beheshti

An Improved Fuzzy Controlled Asynchronous Transfer Mode (ATM) Network

Standard AFM Modes User s Manual

Audio-Based Video Editing with Two-Channel Microphone

Beyond the Resolution: How to Achieve 4K Standards

Data flow architecture for high-speed optical processors

Avoiding False Pass or False Fail

for Digital IC's Design-for-Test and Embedded Core Systems Alfred L. Crouch Prentice Hall PTR Upper Saddle River, NJ

Predicting the immediate future with Recurrent Neural Networks: Pre-training and Applications

MULTI-STATE VIDEO CODING WITH SIDE INFORMATION. Sila Ekmekci Flierl, Thomas Sikora

PIECEWISE PRODUCTION MACHINES

White Paper. Uniform Luminance Technology. What s inside? What is non-uniformity and noise in LCDs? Why is it a problem? How is it solved?

PCM ENCODING PREPARATION... 2 PCM the PCM ENCODER module... 4

System Identification

Sampling Worksheet: Rolling Down the River

Experiment 7: Bit Error Rate (BER) Measurement in the Noisy Channel

Design of a Speaker Recognition Code using MATLAB

DISPLAY WEEK 2015 REVIEW AND METROLOGY ISSUE

Introduction to QScan

A low-power portable H.264/AVC decoder using elastic pipeline

HV/PHA Adjustment (PB) Part

Principles of Video Compression

RF Record & Playback MATTHIAS CHARRIOT APPLICATION ENGINEER

United States Patent: 4,789,893. ( 1 of 1 ) United States Patent 4,789,893 Weston December 6, Interpolating lines of video signals

Getting Started. Connect green audio output of SpikerBox/SpikerShield using green cable to your headphones input on iphone/ipad.

TA2000B-x GHz Fast Pulse / Timing Preamplifier User Manual

SC24 Magnetic Field Cancelling System

Streamcrest Motion1 Test Sequence and Utilities. A. Using the Motion1 Sequence. Robert Bleidt - June 7,2002

CM3106 Solutions. Do not turn this page over until instructed to do so by the Senior Invigilator.

An Efficient Low Bit-Rate Video-Coding Algorithm Focusing on Moving Regions

Linrad On-Screen Controls K1JT

FSK Transmitter/Receiver Simulation Using AWR VSS

Communication Theory and Engineering

Multirate Signal Processing: Graphical Representation & Comparison of Decimation & Interpolation Identities using MATLAB

BASE-LINE WANDER & LINE CODING

Design of a Gaussian Filter for the J-PARC E-14 Collaboration

SC24 Magnetic Field Cancelling System

Signal processing in the Philips 'VLP' system

Transcription:

AUTO-FOCUS USING PSD ESTIMATION EFFECTIVE BANDWIDTH By Laurence G. Hassebrook 2-22-2012 Please follow the tutorial and reproduce the figures with your own code. We demonstrate how to use the effective bandwidth of the PSD estimate to determine the image that is most in focus. The first part of this visualization uses control noise generated from a white Gaussian noise image filtered by a Gaussian function to simulate 2-D blurring. Since the noise is stationary we use the rows of the colored noise to estimate a 1-D PSD of the blurred noise image. From this we estimate an effective bandwidth [1] by first removing dc, then taking the peak value of the PSD and forming a rectangle that is equal in area as the PSD estimate. The rectangle height is equal to the peak PSD value and the width yields the effective bandwidth. The image with the maximum effective bandwidth is considered to be most in focus. The second part of the tutorial uses real data that is blurred by repositioning the target under a microscope. The same algorithm is applied except we use a second type of effective bandwidth definition [2] better suited to signals with a fast frequency drop off. In this second case we find the bandwidth that contains 98% of the total area of the estimated PSD. We chose 98% because that is what is commonly used in Carsons rule to define the bandwidth of wideband systems having a fast drop off. 1. AUTOFOCUS SIMULATION Form an input noise image from White Gaussian Noise. clear all; % dimensions of image Nx=512; My=Nx; % form the control noise image from Gaussian distribution w=randn(my,nx); W=fft2(w); % figure(1) imagesc(w) colormap gray; axis image; axis off; title('input White Noise Pattern') xlabel('spatial X dim (pixels)'); ylabel('spatial Y dim (pixels)'); Color Noise Synthesis Page 1

Figure 1: Gaussian white noise input. Estimate the PSD by using each row as a separate run of the data. We can do this because the data is stationary in all directions. % estimate PSD along 1 dimension of the input noise pattern by averaging % the PSD of each row Wy=zeros(1,Nx); wy=zeros(1,nx); for m=1:my wy(1:nx)=w(m,1:nx); Wy=Wy+abs(fft(wy)).^2; Wy=Wy/My; Then estimate an effective bandwith based on the maximum value and total area of the PSD estimate such that: % Determine equivalent ideal lowpass E=sum(Wy); Amax=max(Wy); B2=floor(E./(2*Amax)); B2=2*B2+1; if B2>Nx B2=Nx; Heff=Amax*irect(1,B2,1,Nx); figure(2) k=1:nx; plot(k,wy,k,heff) axis([1,nx,0,1.1*max(wy)]); title('estimated White Noise PSD') xlabel('discrete Frequency'); Color Noise Synthesis Page 2

Figure 2: Effective Bandwidth and PSD estimate of Fig. 1. Now loop through a range of blurring by varying sigma of a Gaussian function based filter. Each time, estimate the PSD and effective bandwidth. Keep track of the largest bandwidth which is an indicator of which image is the most in focus. % Simulate blurring process nmax=10; deltadev=60 Nindex=floor(2*nmax+1); EffBW=zeros(1,Nindex); sigmaall=zeros(1,nindex); EffBWindex=0; EffBWmax=0; istore=0; for n=-nmax:nmax % -nmax <n1< n1=floor(abs(nmax-(abs(n)-1))); sigma=n1*deltadev; sigmaall(n+nmax+1)=sigma; Hblurr=igauss(sigma,sigma,My,Nx); wcolor=real(ifft2(hblurr.*w)); % the PSD of each row Wy=zeros(1,Nx); wy=zeros(1,nx); for m=1:my wy(1:nx)=wcolor(m,1:nx); Wy=Wy+abs(fft(wy)).^2; Wy=Wy/My; % Determine equivalent ideal lowpass E=sum(Wy); Amax=max(Wy); B2=E./(2*Amax); B2=floor(B2); B2=2*B2+1; Color Noise Synthesis Page 3

if B2>Nx B2=Nx; Heff=Amax*irect(1,B2,1,Nx); % store effective bandwidth EffBW(n+nmax+1)=B2; if B2>EffBWmax EffBWmax=B2; EffBWindex=n+nmax+1; istore=1; Notice how we store only the best so far of the color filter, blurred image and the PSD by using the istore variable. figure(3) imagesc(hblurr) colormap gray; title('blurring Filter') xlabel('dt Frequency (pixels)'); ylabel('dt Frequency (pixels)'); if istore==1 print -djpeg fig3 Figure 3: Of the range of sigma used, this transfer function gave the least blurring. % figure(4) imagesc(wcolor) colormap gray; title('output Colored Noise') xlabel('spatial X dim (pixels)'); ylabel('spatial Y dim (pixels)'); if istore==1 Color Noise Synthesis Page 4

print -djpeg fig4 Figure 4: Least blurred noise image. Figure 5: Least blurred noise PSD estimate. % figure(5) plot(k,wy,k,heff) axis([1,nx,0,1.1*max(wy)]); title('estimated Colored Noise PSD and Eff. BW') xlabel('discrete Frequency'); ylabel('psd'); if istore==1 print -djpeg fig5 istore=0; Color Noise Synthesis Page 5

Figure 6: Sigma and Eff. Bandwidth correspondence. In Fig. 6 we show how the effective bandwidth and sigma varied with image index. As expected, the larger the sigma, the larger the effective bandwidth. Bw=1:Nindex; figure(6); plot(bw,effbw,bw,sigmaall); title('effective Bandwidth and Sigma') xlabel('image Index'); ylabel('eff. Bandwidth and sigma (pixels)'); legend('eff. Bandwidth','sigma'); 2. EXPERIMENTAL AUTOFOCUS Download the set of test images. The images were blurred by changing their distance from the camera lens using a Z stage adjustment. This particular type of Z stage also introduced a change in Y position but the technique is relatively invariant to position changes because it uses a PSD estimate. %% REAL DATA Pathname='ee640data' % path or folder name in reference to your default path Filename='autofocusdataB_' % name of files not including the index or suffix Filesuffix='jpg' % suffix or image type % get size of images index=0; Fullname=sprintf('%s%c%s%d%c%s',Pathname,'\',Filename,index,'.',Filesuffix) A_bmp=double(imread(Fullname)); % load pattern#.bmp [My, Nx, Pz] =size(a_bmp); Nindex=20; k=1:nx; EffBW=zeros(1,Nindex); Color Noise Synthesis Page 6

EffBWindex=0; EffBWmax=0; istore=0; Figure 7: Blurred and in focus sample images from data set. The image names were indexed to allow automated input of each image. Note that we also zeroed out the dc component. for index=0:(nindex-1) Fullname=sprintf('%s%c%s%d%c%s',Pathname,'\',Filename,index,'.',Filesuffix) A_bmp=double(imread(Fullname)); % load pattern#.bmp [My, Nx, Pz] =size(a_bmp); Ar=A_bmp(:,:,1); Ag=A_bmp(:,:,2); Ab=A_bmp(:,:,3); Abw=Ar+Ag+Ab; Abw=Abw/max(max(Abw)); % the PSD of each row Wy=zeros(1,Nx); wy=zeros(1,nx); for m=1:my wy(1:nx)=abw(m,1:nx); Wyfft=abs(fft(wy)); % zero out dc; Wyfft(1)=0+i*0; Wy=Wy+abs(Wyfft).^2; Wy=Wy/My; Amax=max(Wy); An accumulated PSD area is formed so that the effective bandwidth is found by correspondence with 98% of the PSD area. Note that we only use half the PSD vector for this due to symmetry. % form accumulated energy Nx2=Nx/2; Color Noise Synthesis Page 7

Eaccum=zeros(1,Nx2); for n=1:nx2 for m=1:n Eaccum(n)=Eaccum(n)+Wy(m); % Determine equivalent ideal lowpass % let B2 be the index for 0.98 of total Bthresh=0.98 for n=1:nx2 if Eaccum(n)/Eaccum(Nx2) < Bthresh B2=n; B2=2*B2+1; if B2>Nx B2=Nx; Heff=Amax*irect(1,B2,1,Nx); % store effective bandwidth EffBW(index+1)=B2; if B2>EffBWmax EffBWmax=B2; EffBWindex=index+1; istore=1; Figure 8: Image 10 was found to have the highest value of effective bandwidth. figure(7); % figure 8 in this document imagesc(abw); colormap gray; title('input Image') if istore==1 title('input Image with Best Focus') print -djpeg fig7 Color Noise Synthesis Page 8

Figure 9: PSD with highest Effective Bandwidth value. % figure(8)% figure 9 in document plot(k,wy,k,heff) %axis([1,nx,0,1.1*max(wy)]); title('estimated Image PSD and Eff. BW') xlabel('discrete Frequency'); ylabel('psd'); if istore==1 title('estimated Image PSD and Eff. BW of Best Focus') print -djpeg fig8 istore=0; % loop index through figures Color Noise Synthesis Page 9

Figure 10: Correspondence between image index and effective bandwidth. %plot final results for effective bandwidth Bw=1:Nindex; figure(9); % image 10 in this document plot(bw,effbw); title('effective Bandwidth of 0.98 Emax') The final results show that the algorithm works well with the real data which had considerable structure and was much less colored than the control noise. In practice, the PSD of the test data could be used to color the test noise for a closer correspondence of the PSDs. 3. REFERENCES 1. Random Signals Detection, Estimation and Data Analysis by K. Sam Shannugan and A. M. Breipohl. John Wiley& Sons, New York. 1988 2. Carsons Rule http://en.wikipedia.org/wiki/carsons_rule Color Noise Synthesis Page 10