35
C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images Image Compression Changing the Size Utilizing the Colors Channels of an Image Image Filters

Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 1

Image ProcessingMath with Images

• Image Compression• Changing the Size• Utilizing the Colors Channels of an Image• Image Filters

Page 2: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 2

Image Compression - Lossy Compression

• Discrete Cosine Transform(.jpeg, .heif (, video, sound, …)• 2n x 2n tiles approximates by

2D cosines

https://en.wikipedia.org/wiki/Image_compression

Page 3: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 3

Image Compression - Lossy Compression

• Discrete Cosine Transform• Wavelet Transform (JPEG 2000)

https://en.wikipedia.org/wiki/Image_compression

Page 4: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 4

Image Compression - Lossy Compression

• Discrete Cosine Transform• Wavelet Transform • Reducing the color space

• Reducing bit depth/color space vs. reduction to or summarizingoccuring colors

https://en.wikipedia.org/wiki/Color_spacehttps://en.wikipedia.org/wiki/Image_compression

Page 5: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 5

Image Compression - Lossy Compression

• Discrete Cosine Transform• Wavelet Transform • Reducing the color space

• Reducing bit depth/color space vs. reduction to or summarizingoccuring colors

• (Dithering)

https://en.wikipedia.org/wiki/Color_quantizationhttps://en.wikipedia.org/wiki/Image_compression

Original 16 colors 16 colors + dithering

Page 6: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 6

Image Compression - Lossy Compression

https://de.wikipedia.org/wiki/Dithering_(Bildbearbeitung)https://en.wikipedia.org/wiki/Image_compression

• Discrete Cosine Transform• Wavelet Transform • Reducing the color space

• Reducing bit depth/color space vs. reduction to or summarizingoccuring colors

• (Dithering)Original 16 colors 16 colors + dithering

Page 7: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 7

Image Compression - Lossy Compression

• Discrete Cosine Transform• Wavelet Transform• Reducing the color space• Chroma subsampling (JPEG)

• Stronger reduction of color informationover a reduction intensity information

https://en.wikipedia.org/wiki/Image_compression

Page 8: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 8

Image Compression - Lossy Compression

• Discrete Cosine Transform• Wavelet Transform• Reducing the color space• Chroma subsampling• Fractal compression

• Compressed self-similar (reoccuring) parts saved once

https://en.wikipedia.org/wiki/Image_compression

Page 9: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 9

Image Compression - Lossless Compression

• Run-length encoding (GIF)• Repeated lines saved once

https://en.wikipedia.org/wiki/Image_compression

Page 10: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 10

Image Compression - Lossless Compression

• Run-length encoding• Differential Pulse Code Modulation

• Calculating and saving the difference of one part of the signal with another part

https://en.wikipedia.org/wiki/Image_compression

Page 11: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 11

Image Compression - Lossless Compression

• Run-length encoding• Differential Pulse Code Modulation• Entropy encoding

• Prefix code for each „unique symbol“ in signal, saving prefix code sequence• Basis for arithmetic coding and Huffman coding

https://en.wikipedia.org/wiki/Image_compression

Page 12: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 12

Image Compression - Lossless Compression

• Run-length encoding• Differential Pulse Code Modulation• Entropy encoding• Lempel–Ziv–Welch (GIF, TIFF)

• Assemble Dictionary of signal sequences in input and where to find them

https://en.wikipedia.org/wiki/Image_compression

Page 13: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 13

Image Compression - Lossless Compression

• Run-length encoding• Differential Pulse Code Modulation• Entropy encoding• Lempel–Ziv–Welch• DEFLATE (.png, .mng, .tiff)

• Lempel–Ziv–Storer–Szymanski + Hoffmann encoding• Dictionary method + entropy encoding

https://en.wikipedia.org/wiki/Image_compression

Page 14: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 14

Image Compression - Lossless Compression

• Run-length encoding• Differential Pulse Code Modulation• Entropy encoding• Lempel–Ziv–Welch• DEFLATE• Chain code

• Saves outline of area with same greyvalue

https://en.wikipedia.org/wiki/Image_compression

Page 15: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 15

Changing the Image Size - Pixel based Images

• Several typical algorithms available• Bilinear and Bicubic• Nearest Neighbor

Functions in FIJI/ImageJ to resize images• Image Adjust Size…• Image Scale…

https://en.wikipedia.org/wiki/Bicubic_interpolationhttps://en.wikipedia.org/wiki/Image_scaling

Page 16: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 16

Changing the Image Size - Pixel based Images

• Several typical algorithms available• Bilinear and Bicubic

• Extrapolates local image intensities• Can extrapolate curved lines• May introduce artifacts

3dmix.comhttps://en.wikipedia.org/wiki/Image_scaling

Page 17: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 17

Changing the Image Size - Pixel based Images

• Several typical algorithms available• Bilinear and Bicubic• Nearest Neighbor

• Preserves image intensities andedges if image enlarged by n

• Can otherwise also create artifacts• Bad edge preservation when

reducing size• Lower pixel intensities due to

rounding down

3dmix.comhttps://en.wikipedia.org/wiki/Image_scaling

Page 18: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 18

Changing the Image Size - Pixel based Images

• Several typical algorithms available• Bilinear and Bicubic• Nearest Neighbor• Choose according to purpose/image• Always check for artifacts (at the

pixel scale)!

3dmix.comhttps://en.wikipedia.org/wiki/Image_scaling

Page 19: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 19

Changing the Image Size - Vector based Images

https://de.wikipedia.org/wiki/Vektorgrafik

• All Image information strored as primitives such aslines, circles, splines, etc. (essentially functions)

• Supported by .svg, .eps, .wmf, .ai, .pdf• Infinitely scalable• Concept also available in 3D renderings

Page 20: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 20

Changing the Image Size - Best practices

• Ideally record images of carefully chosen areas and with enough pixels(min 4M pixels!)

• Avoid small changes in image size• Change image size as few times as possible• Use Corel Draw, since pixelated images intensities are only extrapolated

once when image is saved in pixelated format• Or save as vector file

Page 21: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 21

• Up to 3 greyscale maps/images remain rather interpretable• Illustration of change between two points in time between two greyscale images

Utilizing the Color Channels of an Image

Development of [111] texture in Pt thin film due to heating

Page 22: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 22

• Up to 3 greyscale maps/images remain rather interpretable• Illustration of change between two points in time between two greyscale images• RGB channels (e.g. for three overlapping images/EDX maps)

• Maximize contrast vs quantified contrast?• Apparent intesity of different colors?

• Easiest to stick with greyscale images• Adjustments have to be stated!

Utilizing the Color Channels of an Image

Functions in FIJI/ImageJ to separate/combineimages• Image Color Merge/Split Channels• Image Stacks… Z Project• Process Image Calculator

Up to 7 color channels availableChannel operations also possible with stacks

Page 23: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 23

Image Filters - Convolutions for Noise Reduction

• At each pixel a new value is calculated based on the surrounding pixels

• #

Original noisyimage

stackexchange.comscipy-lectures.org/intro/scipy/auto_examples/plot_image_filters.html

Median ofintensities in 5x5 matrix

Page 24: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 24

Image Filters - Convolution for Edge Detection (Sobel Filter)

• Convolution with matrices for x and y direction

medium.com

Page 25: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 25

• Theshold selcted visually or basedon histogram

• Several automatic methods availblein FIJI/ImageJ

• Automatic particle anaylsis availableas well

Image Filters – Threshold based Segmentation

imagej.nih.gov

Page 26: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 26

Image Filters - Fourier Filtering

medium.com

Page 27: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 27

The Fourier Transformation

f(x) = sin (x)

Page 28: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 28

The Fourier Transformation

f(x) = sin (8*x)

Page 29: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 29

The Fourier Transformation

f(x) = sin (x) + sin (8*x)

Page 30: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 30

The Fourier Transformation

bonedo.de

Page 31: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 31

Image Filters - Fourier Filtering

B. Mei, ACS Catal. 3 2013 3041−3049.

Original Low Pass Filter Low Pass Filter(Overdone)

High and Low Pass Filter

Page 32: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 32

Image Filters - Fourier Filtering

B. Mei, ACS Catal. 3 2013 3041−3049.

Wedge Shaped FilterJust Spots

All masks created andapplied in GMS3

Page 33: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 33

Image Filters - Fourier Filtering

Page 34: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 34

The World of Scripting – Python ftw!

• All the things above!• Summing up images after aligning

them via cross-correlation!• Zoom videos consisting of extrapolated

images based on images recorded at fixed magnifications!

• Dynamic scale bars!• Create your own noise removal

techniques!• Extracting data from in situ image

series!• Data visualization!• Combining image series into single

images in creative ways!• There are no limits!

Page 35: Math with Images - Uni Siegen€¦ · C. Wiktor LMN Lehrstuhlseminar 24.06.20 1 Image Processing Math with Images • Image Compression • Changing the Size • Utilizing the Colors

C. Wiktor LMN Lehrstuhlseminar 24.06.20 35

Thank you for your attention!