ccd image processing: issues & solutions...1. bad pixels – dead, hot, flickering… 2....

Post on 04-Oct-2020

2 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

CCD Image Processing:CCD Image Processing:Issues & SolutionsIssues & Solutions

2

[ ] [ ], ,r x y d x y−

Correction of Raw ImageCorrection of Raw Imagewith Bias, Dark, Flat Imageswith Bias, Dark, Flat Images

Flat Field Image

Bias Image

OutputImage

Dark Frame

Raw File [ ],r x y

[ ],d x y

[ ],f x y

[ ],b x y

[ ] [ ], ,f x y b x y−

“Flat” − “Bias”

“Raw” − “Dark”

[ ] [ ][ ] [ ]

, ,, ,

r x y d x yf x y b x y

−−

“Raw” − “Dark”“Flat” − “Bias”

3

[ ] [ ], ,r x y b x y−

Correction of Raw ImageCorrection of Raw Imagew/ Flat Image, w/o Dark Imagew/ Flat Image, w/o Dark Image

Flat Field Image

Bias Image

OutputImage

Raw File

[ ],r x y

[ ],f x y

[ ],b x y[ ] [ ], ,f x y b x y−

“Flat” − “Bias”

[ ] [ ][ ] [ ]

, ,, ,

r x y b x yf x y b x y

−−

“Raw” − “Bias”“Flat” − “Bias”

“Raw” − “Bias”

Assumes Small Dark Current(Cooled Camera)

4

CCDsCCDs: Noise Sources: Noise Sources• Sky “Background”

– Diffuse Light from Sky (Usually Variable)• Dark Current

– Signal from Unexposed CCD– Due to Electronic Amplifiers

• Photon Counting– Uncertainty in Number of Incoming Photons

• Read Noise– Uncertainty in Number of Electrons at a Pixel

5

Problem with Sky Problem with Sky ““BackgroundBackground””

• Uncertainty in Number of Photons from Source– “How much signal is actually from the

source object instead of from intervening atmosphere?

6

Solution for Sky Background Solution for Sky Background

• Measure Sky Signal from Images– Taken in (Approximately) Same Direction

(Region of Sky) at (Approximately) Same Time

– Use “Off-Object” Region(s) of Source Image

• Subtract Brightness Values from Object Values

7

Problem: Dark CurrentProblem: Dark Current

• Signal in Every Pixel Even if NOT Exposed to Light– Strength Proportional to Exposure Time

• Signal Varies Over Pixels– Non-Deterministic Signal = “NOISE”

8

Solution: Dark CurrentSolution: Dark Current

• Subtract Image(s) Obtained Without Exposing CCD – Leave Shutter Closed to Make a “Dark Frame”– Same Exposure Time for Image and Dark

Frame• Measure of “Similar” Noise as in Exposed Image• Actually Average Measurements from Multiple

Images– Decreases “Uncertainty” in Dark Current

9

Digression on Digression on ““NoiseNoise””

• What is “Noise”?• Noise is a “Nondeterministic” Signal

– “Random” Signal– Exact Form is not Predictable– “Statistical” Properties ARE (usually)

Predictable

10

Statistical Properties of NoiseStatistical Properties of Noise

1. Average Value = “Mean” ≡ µ2. Variation from Average = “Deviation” ≡ σ

• Distribution of Likelihood of Noise– “Probability Distribution”

• More General Description of Noise than µ, σ– Often Measured from Noise Itself

• “Histogram”

11

Histogram of Histogram of ““Uniform DistributionUniform Distribution””• Values are “Real Numbers” (e.g., 0.0105)• Noise Values Between 0 and 1 “Equally” Likely• Available in Computer Languages

Var

iatio

n

Mea

n µ

Mean µ = 0.5

Mean µ

Variation

Noise Sample Histogram

12

Histogram of Histogram of ““GaussianGaussian””DistributionDistribution

• Values are “Real Numbers”• NOT “Equally” Likely• Describes Many Physical Noise Phenomena

Mean µ = 0Values “Close to” µ “More Likely”

Var

iatio

n

Mea

n µ

Mean µ

Variation

13

Histogram of Histogram of ““PoissonPoisson”” DistributionDistribution• Values are “Integers” (e.g., 4, 76, …)• Describes Distribution of “Infrequent” Events,

e.g., Photon Arrivals

Mean µ = 4Values “Close to” µ “More Likely”

“Variation” is NOT Symmetric

Var

iatio

n

Mea

n µ

Mean µ

Variation

14

Histogram of Histogram of ““PoissonPoisson”” DistributionDistribution

Mean µ = 25

Var

iatio

n

Mea

n µ

Mean µ

Variation

15

How to Describe How to Describe ““VariationVariation””: 1: 1

• Measure of the “Spread” (“Deviation”) of the Measured Values (say “x”) from the “Actual” Value, which we can call “µ”

• The “Error” ε of One Measurement is:

(which can be positive or negative)

( )xε µ= −

16

Description of Description of ““VariationVariation””: 2: 2

• Sum of Errors over all Measurements:

Can be Positive or Negative• Sum of Errors Can Be Small, Even If

Errors are Large (Errors can “Cancel”)

( )n nn n

xε µ= −∑ ∑

17

Description of Description of ““VariationVariation””: 3: 3

• Use “Square” of Error Rather Than Error Itself:

Must be Positive

( )22 0xε µ= − ≥

18

Description of Description of ““VariationVariation””: 4: 4

• Sum of Squared Errors over all Measurements:

• Average of Squared Errors

( ) ( )2 2 0n nn n

xε µ= − ≥∑ ∑

( )( )2

21 0n

nn

n

x

N N

µε

−= ≥∑

19

Description of Description of ““VariationVariation””: 5: 5

• Standard Deviation σ = Square Root of Average of Squared Errors

( )2

0n

nx

N

µσ

−≡ ≥∑

20

Effect of Averaging on Deviation Effect of Averaging on Deviation σσ• Example: Average of 2 Readings from

Uniform Distribution

21

Effect of Averaging of 2 Samples:Effect of Averaging of 2 Samples:Compare the HistogramsCompare the Histograms

• Averaging Does Not Change µ• “Shape” of Histogram is Changed!

– More Concentrated Near µ– Averaging REDUCES Variation σ

σ ≅ 0.289

Mean µ Mean µ

22

Averaging Reduces Averaging Reduces σσ

σ ≅ 0.289 σ ≅ 0.205

σ is Reduced by Factor: 41.1205.0289.0

23

Averages of 4 and 9 SamplesAverages of 4 and 9 Samples

σ ≅ 0.144 σ ≅ 0.096

Reduction Factors01.2

144.0289.0

≅ 01.3096.0289.0

24

Averaging of Random Noise Averaging of Random Noise REDUCES the Deviation REDUCES the Deviation σσ

3.012.011.41Reduction in Deviation σ

N = 9N = 4N = 2Samples Averaged

Observation: One Sample

Average of N Samples Nσ

σ =

25

Why Does Why Does ““DeviationDeviation”” Decrease Decrease if Images are Averaged?if Images are Averaged?

• “Bright” Noise Pixel in One Image may be “Dark” in Second Image

• Only Occasionally Will Same Pixel be “Brighter” (or “Darker”) than the Average in Both Images

• “Average Value” is Closer to Mean Value than Original Values

26

Averaging Over Averaging Over ““TimeTime”” vs. vs. Averaging Over Averaging Over ““SpaceSpace””

• Examples of Averaging Different Noise Samples Collected at Different Times

• Could Also Average Different Noise Samples Over “Space” (i.e., Coordinate x)– “Spatial Averaging”

27

Comparison of Histograms After Comparison of Histograms After Spatial AveragingSpatial Averaging

Uniform Distributionµ = 0.5

σ ≅ 0.289

Spatial Average of 4 Samples

µ = 0.5σ ≅ 0.144

Spatial Average of 9 Samples

µ = 0.5σ ≅ 0.096

28

Effect of Averaging on Dark Effect of Averaging on Dark CurrentCurrent

• Dark Current is NOT a “Deterministic”Number– Each Measurement of Dark Current “Should

Be” Different– Values Are Selected from Some Distribution of

Likelihood (Probability)

29

Example of Dark CurrentExample of Dark Current

• One-Dimensional Examples (1-D Functions)– Noise Measured as Function of One

Spatial Coordinate

30

Example of Dark Current Example of Dark Current ReadingsReadings

Var

iatio

n

Reading of Dark Current vs. Positionin Simulated Dark Image #1

Reading of Dark Current vs. Positionin Simulated Dark Image #2

31

Averages of Independent Dark Averages of Independent Dark Current ReadingsCurrent Readings

Var

iatio

n

Average of 2 Readings of Dark Current vs. Position

Average of 9 Readings of Dark Current vs. Position

“Variation” in Average of 9 Images ≅ 1/√9 = 1/3 of “Variation” in 1 Image

32

Infrequent Photon ArrivalsInfrequent Photon Arrivals

• Different Mechanism– Number of Photons is an “Integer”!

• Different Distribution of Values

33

Problem: Photon Counting Problem: Photon Counting StatisticsStatistics

• Photons from Source Arrive “Infrequently”– Few Photons

• Measurement of Number of Source Photons (Also) is NOT Deterministic– Random Numbers– Distribution of Random Numbers of “Rarely

Occurring” Events is Governed by Poisson Statistics

34

Simplest Distribution of IntegersSimplest Distribution of Integers

• Only Two Possible Outcomes:– YES– NO

• Only One Parameter in Distribution – “Likelihood” of Outcome YES– Call it “p”– Just like Counting Coin Flips– Examples with 1024 Flips of a Coin

35

Example with Example with p = p = 0.50.5

N = 1024Nheads = 511

p = 511/1024 < 0.5

String of Outcomes Histogram

36

N = 1024Nheads = 522

µ = 522/1024 > 0.5

String of Outcomes Histogram

Second Example with Second Example with pp = 0.5= 0.5

“H”“T”

37

What if Coin is What if Coin is ““UnfairUnfair””??pp ≠≠ 0.50.5

String of Outcomes Histogram“H”“T”

38

What Happens to Deviation What Happens to Deviation σσ??

• For One Flip of 1024 Coins:– p = 0.5 ⇒ σ ≅ 0.5– p = 0 ⇒ ?– p = 1 ⇒ ?

39

Deviation is Largest if Deviation is Largest if pp = 0.5!= 0.5!

• The Possible Variation is Largest if p is in the middle!

40

Add More Add More ““TossesTosses””

• 2 Coin Tosses ⇒ More Possibilities for Photon Arrivals

41

N = 1024

µ = 1.028

String of Outcomes Histogram

Sum of Two Sets with Sum of Two Sets with pp = 0.5= 0.5

3 Outcomes: • 2 H• 1H, 1T (most likely)• 2T

42

N = 1024

String of Outcomes Histogram

Sum of Two Sets with Sum of Two Sets with pp = 0.25= 0.25

3 Outcomes: • 2 H (least likely)• 1H, 1T• 2T (most likely)

43

Add More Flips with Add More Flips with ““UnlikelyUnlikely””HeadsHeads

Most “Pixels” Measure 25 Heads (100 × 0.25)

44

Add More Flips with Add More Flips with ““UnlikelyUnlikely””Heads (1600 with Heads (1600 with p = p = 0.25)0.25)

Most “Pixels” Measure 400 Heads (1600 × 0.25)

45

Examples of Poisson Examples of Poisson ““NoiseNoise””Measured at 64 PixelsMeasured at 64 Pixels

Average Value µ = 25 Average Values µ = 400AND µ = 25

1. Exposed CCD to Uniform Illumination2. Pixels Record Different Numbers of Photons

46

““VariationVariation”” of Measurement of Measurement Varies with Number of PhotonsVaries with Number of Photons

• For Poisson-Distributed Random Number with Mean Value µ = N:

• “Standard Deviation” of Measurement is:

σ = √N

47

Average Value µ = 400Variation σ = √400 = 20

Histograms of Two Poisson Histograms of Two Poisson DistributionsDistributions

µ = 25 µ=400

Variation VariationAverage Value µ = 25Variation σ = √25 = 5

(Note: Change of Horizontal Scale!)

48

““QualityQuality”” of Measurement of of Measurement of Number of Photons Number of Photons

• “Signal-to-Noise Ratio”– Ratio of “Signal” to “Noise” (Man, Like What

Else?)

SNR µσ

49

SignalSignal--toto--Noise Ratio for Noise Ratio for Poisson DistributionPoisson Distribution

• “Signal-to-Noise Ratio” of Poisson Distribution

• More Photons ⇒ Higher-Quality Measurement

NSNR NN

µσ

≡ = =

50

Solution: Photon Counting Solution: Photon Counting StatisticsStatistics

• Collect as MANY Photons as POSSIBLE!!• Largest Aperture (Telescope Collecting Area)• Longest Exposure Time • Maximizes Source Illumination on Detector

– Increases Number of Photons• Issue is More Important for X Rays than for

Longer Wavelengths– Fewer X-Ray Photons

51

Problem: Read NoiseProblem: Read Noise

• Uncertainty in Number of Electrons Counted– Due to Statistical Errors, Just Like Photon

Counts• Detector Electronics

52

Solution: Read NoiseSolution: Read Noise

• Collect Sufficient Number of Photons so that Read Noise is Less Important Than Photon Counting Noise

• Some Electronic Sensors (CCD-“like”Devices) Can Be Read Out “Nondestructively”– “Charge Injection Devices” (CIDs)– Used in Infrared

• multiple reads of CID pixels reduces uncertainty

53

CCDsCCDs: artifacts and defects: artifacts and defects1. Bad Pixels

– dead, hot, flickering…2. Pixel-to-Pixel Differences in Quantum

Efficiency (QE)

– 0 ≤ QE < 1 – Each CCD pixel has its “own” unique QE– Differences in QE Across Pixels ⇒ Map of CCD

“Sensitivity”• Measured by “Flat Field”

# of electrons createdQuantum Efficiency # of incident photons

=

54

CCDsCCDs: artifacts and defects: artifacts and defects3. Saturation

– each pixel can hold a limited quantity of electrons (limited well depth of a pixel)

4. Loss of Charge during pixel charge transfer & readout

– Pixel’s Value at Readout May Not Be What Was Measured When Light Was Collected

55

Bad PixelsBad Pixels• Issue: Some Fraction of Pixels in a CCD are:

– “Dead” (measure no charge)– “Hot” (always measure more charge than

collected)• Solutions:

– Replace Value of Bad Pixel with Average of Pixel’s Neighbors

– Dither the Telescope over a Series of Images• Move Telescope Slightly Between Images to Ensure that

Source Fall on Good Pixels in Some of the Images• Different Images Must be “Registered” (Aligned) and

Appropriately Combined

56

PixelPixel--toto--Pixel Differences in QEPixel Differences in QE

• Issue: each pixel has its own response to light• Solution: obtain and use a flat field image to

correct for pixel-to-pixel nonuniformities– construct flat field by exposing CCD to a uniform

source of illumination • image the sky or a white screen pasted on the dome

– divide source images by the flat field image• for every pixel x,y, new source intensity is now

S’(x,y) = S(x,y)/F(x,y) where F(x,y) is the flat field pixel value; “bright” pixels are suppressed, “dim” pixels are emphasized

57

Issue: SaturationIssue: Saturation• Issue: each pixel can only hold so many electrons

(limited well depth of the pixel), so image of bright source often saturates detector– at saturation, pixel stops detecting new photons (like overexposure)– saturated pixels can “bleed” over to neighbors, causing streaks in

image

• Solution: put less light on detector in each image– take shorter exposures and add them together

• telescope pointing will drift; need to re-register images• read noise can become a problem

– use neutral density filter• a filter that blocks some light at all wavelengths uniformly• fainter sources lost

58

Solution to SaturationSolution to Saturation• Reduce Light on Detector in Each Image

– Take a Series of Shorter Exposures and Add Them Together

• Telescope Usually “Drifts”– Images Must be “Re-Registered”

• Read Noise Worsens

– Use Neutral Density Filter• Blocks Same Percentage of Light at All Wavelengths• Fainter Sources Lost

59

Issue: Loss of Electron ChargeIssue: Loss of Electron Charge

• No CCD Transfers Charge Between Pixels with 100% Efficiency– Introduces Uncertainty in Converting to

Light Intensity (of “Optical” Visible Light) or to Photon Energy (for X Rays)

60

• Build Better CCDs!!!• Increase Transfer Efficiency

• Modern CCDs have charge transfer efficiencies ≥ 99.9999%– some do not: those sensitive to “soft” X Rays

• longer wavelengths than short-wavelength “hard” X Rays

Solution to Loss of Electron Solution to Loss of Electron ChargeCharge

# of electrons transferred to next pixelTransfer Efficiency # of electrons in pixel

=

61

Digital Processing of Digital Processing of Astronomical ImagesAstronomical Images

• Computer Processing of Digital Images• Arithmetic Calculations:

– Addition– Subtraction– Multiplication– Division

62

Digital ProcessingDigital Processing

• Images are Specified as “Functions”, e.g., r [x,y]

means the “brightness” r at position [x,y]• “Brightness” is measured in “Number of Photons”• [x,y] Coordinates Measured in:

– Pixels – Arc Measurements (Degrees-ArcMinutes-

ArcSeconds)

63

• “Summation” = “Mathematical Integration”• To “Average Noise”

Sum of Two ImagesSum of Two Images

[ ] [ ] [ ]1 2, , ,r x y r x y g x y+ =

64

• To Detect Changes in the Image, e.g., Due to Motion

Difference of Two ImagesDifference of Two Images

[ ] [ ] [ ]1 2, , ,r x y r x y g x y− =

65

• m[x,y] is a “Mask” Function

Multiplication of Two ImagesMultiplication of Two Images

[ ] [ ] [ ], , ,r x y m x y g x y× =

66

• Divide by “Flat Field” f[x,y]

Division of Two ImagesDivision of Two Images

[ ][ ] [ ],

,,

r x yg x y

f x y=

67

Data PipeliningData Pipelining• Issue: now that I’ve collected all of these

images, what do I do?• Solution: build an automated data processing

pipeline– Space observatories (e.g., HST) routinely process raw

image data and deliver only the processed images to the observer

– ground-based observatories are slowly coming around to this operational model

– RIT’s CIS is in the “data pipeline” business• NASA’s SOFIA• South Pole facilities

top related