Differences between revisions 1 and 5 (spanning 4 versions)
Revision 1 as of 2008-12-08 12:17:36
Size: 719
Editor: anonymous
Comment:
Revision 5 as of 2008-12-08 12:38:42
Size: 985
Editor: anonymous
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
= Random variables = = Image statistics =
Line 9: Line 9:
The measurements that form an image show statistical fluctuations. The image is characterised by a probability density function (PDF). The PDF ''f'' describes the probability of the occurrence of a discrete grey level ''q'' in the range of grey levels ''Q''.
The image is characterised by a probability density function (PDF). The PDF ''f'' describes the probability of the occurrence of a discrete grey level ''q'' in the range of grey levels ''Q''.
Line 12: Line 13:
$\sum_{q=1}^Qf_q=1$ $\sum_{q=0}^Qf_q=1$
Line 15: Line 16:
== Probability density functions and histograms == == Example ==
{{attachment:landsat_b80.png}}
Line 17: Line 19:
The PDF of an image can be calculated and displayed using the {{{pylab.hist}}} function or it can be
calculated using the {{{scipy.histogram}}} function.
Line 20: Line 20:
[[attachment:landsat_b80.png]] The following code calculates the PDF {{{pdf}}} for a ''byte'' image {{{img}}} in the intervall {{{[0,255]}}}

{{{#!python
h=histogram(img,bins=256,range=[0,255],normed=True)
pdf,x=h[0],h[1]
}}}

The expression {{{normed=True}}} is used for the normalization of the PDF.
{{{#!latex
$\sum_{q=0}^{255}pdf_q=1$
}}}

The anti-derivative of the PDF is the cumulative density function (CDF). It can be approximated from the cumulative sum
{{{#!python
cdf=pdf.cumsum()
}}}

{{attachment:landsat_b80_pdfcdf.png}}

Image statistics

The image is characterised by a probability density function (PDF). The PDF f describes the probability of the occurrence of a discrete grey level q in the range of grey levels Q.

latex error! exitcode was 2 (signal 0), transscript follows:

Example

landsat_b80.png

The following code calculates the PDF pdf for a byte image img in the intervall [0,255]

   1 h=histogram(img,bins=256,range=[0,255],normed=True)
   2 pdf,x=h[0],h[1]

The expression normed=True is used for the normalization of the PDF.

latex error! exitcode was 2 (signal 0), transscript follows:

The anti-derivative of the PDF is the cumulative density function (CDF). It can be approximated from the cumulative sum

   1 cdf=pdf.cumsum()

landsat_b80_pdfcdf.png

LehreWiki: Python/Lesson6 (last edited 2008-12-08 13:15:56 by anonymous)