April 05 Prof. Ismael H. F. Santos - [email protected] 1 Computação Gráfica Módulo I –...
-
Upload
caue-mancia -
Category
Documents
-
view
220 -
download
4
Transcript of April 05 Prof. Ismael H. F. Santos - [email protected] 1 Computação Gráfica Módulo I –...
![Page 1: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/1.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 1
Computação GráficaMódulo I – Imagem
UniverCidade - Prof. Ismael H F Santos
![Page 2: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/2.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 2
Considerações Gerais
Objetivo:Objetivo: Discutir os principais conceitos eos princípios básicos dos Sistemas Gráficos e a Programação em OpenGL.
A quem se destina :A quem se destina : Alunos e Profissionais que desejem aprofundar seus conhecimentos sobre Computação Grafica e suas aplicações.
![Page 3: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/3.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 3
Computação Gráfica Volume 1. Jonas Gomes e Luiz Velho. Instituto de Matemática Pura e Aplicada – IMPA.
Introdução a Computação Gráfica - Paulo Roma http://www.lcg.ufrj.br/compgraf1/downloads/apostila.pdfhttp://www.lcg.ufrj.br/compgraf1/downloads/apostila.ps.gz
Notas do Curso ministrado na Universidade de Maryland pelo Prof. David Mount
ftp://ftp.cs.umd.edu/pub/faculty/mount/427/427lects.ps.gzhttp://www.lcg.ufrj.br/~esperanc/CG/427lects.ps.gz
Apostila Fundamentos da Imagem Digital – Antonio Scuri Computer Graphics: Principles and Practice, Second Edition. James
Foley, Andries van Dam, Steven Feiner, John Hughes. Addison-Wesley.
OpenGL Programming Guide, 2nd Edition. Mason Woo, Jackie Neider, Tom Davis. Addison Wesley.
Bibliografia
![Page 4: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/4.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 4
Bibliografia OpenGL
OpenGL® Programming Guide, 2nd Edition. Mason Woo, Jackie Neider, Tom Davis. Addison Wesley. http://www.lcg.ufrj.br/redbook
Manual de referência online http://www.lcg.ufrj.br/opengl
Sítio oficial do OpenGL www.opengl.org
![Page 5: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/5.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 5
Paradigma dos 4 Universos
UniversoFísico
Universo deRepresentação
Universo deImplementação
UniversoMatemático
Exemplo:VOZ HUMANA
879987987898
8 9 8 7 8 9 7 8 9 9 7 8
Discretização(Amostragem)
Representação(Vetor)
![Page 6: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/6.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 6
Paradigma dos 4 Universos
UniversoFísico
Universo deRepresentação
Universo deImplementação
UniversoMatemático
Imagens no Universo Físico
Amostragem e Quantização
Codificação e Formatos
Funçõesno Espaço de Cor
Cores no Universo Físico
Representação de Cor
Especificação de Cor
Modelos Matemáticos de Cor (Espaço)
COR IMAGEM
![Page 7: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/7.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 7
Imagens como Funções• Uma linha de uma imagem PB: Domínio 1D
• Uma imagem Colorida: Domínio 3D (?)
• Uma imagem PB: Domínio 2D
![Page 8: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/8.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 8
Imagem - Modelo Matemático: Função
u
v
L
L(u,v)
Função
0%
20%
40%
60%
80%
100%
Nív
eis
de c
inza
Posição ao longo da linha x
C 2,0,0: hwL
Lvu
![Page 10: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/10.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 10
Imagem coloridas como 3 canais de cor
canal vermelho
canal verde
canal azul
![Page 11: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/11.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 11
Imagem Digital
Amostragem, quantização e codificação
![Page 12: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/12.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 12
Imagem Digital: Histogramas
Uma outra maneira de ver a informação da imagem: probabilidade deocorrência de um determinado valor, uso do intervalo [0,255], contraste,...
![Page 14: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/14.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 14
Propriedades básicas de uma Imagem Digital
![Page 15: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/15.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 15
Amostragem, quantização e codificação de f(x)
x
f(x)
amostra
partição do eixo x
![Page 16: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/16.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 16
codificação = (3, 4, 5, 5, 4, 2, 2, 3, 5, 5, 4, 2)
Amostragem, quantização e codificação de f(x)
0
1
2
3
4
5
6
x
f(x)
amostraquantizada
![Page 17: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/17.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 17
Digitalização de ImagensDiscretização espacial (amostragem) - Resolução (X x Y pixels)
![Page 18: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/18.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 18
Resolução geométrica Interpolação e Filtragem
Resolução de Vídeos
![Page 19: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/19.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 19
Processos básicos
Imagem de tons contínuos
64x54
Imagem amostrada
amostragem
64x54 - 16 cores
Imagem amostrada equantizada
quantização55 55 55 55 55 55 5555 20 22 23 45 55 5555 55 10 09 11 55 5555 55 43 42 70 55 5555 55 28 76 22 55 5555 55 55 55 55 55 55
codificação8*55, 1*20, 1*22, 1*23, ….
Imagem amostrada, quantizada e codificada
![Page 20: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/20.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 20
(a) aumento de resolução
Problemas associados a re-amostragem de um sinal digital f(x)
x
f(x)
função reconstruídapelo vizinho mais próximo
função reconstruídapor interpolação linear
0
1
2
3
4
5
6 função original
![Page 21: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/21.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 21
Re-amostragem de f(x)
x
f(x)
função reconstruídapelo vizinho mais próximo
função reconstruídapor interpolação linear
função original
(b) redução de resolução0
1
2
3
4
5
6
![Page 23: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/23.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 23
Quantização• Discretização no espaço de cores (redução das cores usadas)
• Critérios para escolha das cores (exemplos em 256 cores):
• Quantização Uniforme (256 cores) • Algoritmo de Populosidade (16 cores)
• Quantização por Aglumeração (16 cores) Imagem Original (24 bits)
![Page 24: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/24.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 24
Digitalização de Imagens
amostragem15 15 15 15 15 15 15
15 10 12 13 5 15 15
15 15 10 09 11 15 15
15 15 13 12 10 15 15
15 15 08 06 12 15 15
15 15 15 15 15 15 15
quantização
315x260 – 256 cores
64x53 - 16 corescodificação
64x53 – 256 cores
![Page 25: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/25.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 25
Codificação e armazenamento de Imagens
compressão e formatos de arquivos
![Page 26: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/26.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 26
Codificação
• Imagem no Universo de Codificação:• Palette de cores• RGBRGB• RRGGBB• Compressão• formato PPM• formato BMP
Obs: Imagens em formato raster (não vetorias)
![Page 27: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/27.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 27
Palette de Cores
206206206
313665
132148198
222231247
198214231
165193214
159173179
116124124
105109105
17588
454388
16371198
14399202
125123132
149148180
00255
BlueGreenRed
• Geralmente com 256, 16 ou 4 cores
15 15 15 15 15 15 15
15 10 12 13 5 15 15
15 15 10 09 11 15 15
15 15 13 12 10 15 15
15 15 08 06 12 15 15
15 15 15 15 15 15 15
Palette
Os pixels da imagem fazem referência aos índices da Palette
![Page 28: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/28.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 28
RRGGBB
Verm.
Verde
Azul
Pixe
l 2
Plano de Cores
00 01 02 060503 04
07 08 09 . . .
Pixe
l 0
Pixe
l 5
Pixe
l 4
Pixe
l 3
Pixe
l 1
06
06
Organização dos pixels de uma imagem por planos de cores
Banc
os
(Jav
a)
Informação é uma componente da cor
![Page 29: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/29.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 29
RRGGBB
• Declaração em C das matrizes R, G e B de uma imagem colorida com resolução 200x300?
• Qual o tipo a ser usado?• int, float, char, double ou void ?• short ou long ?• unsigned ?
unsigned char R[60000], G[60000], B[60000];
• Atenção! Normalmente são ponteiros cujo espaço são alocados dinamicamente (malloc).
![Page 30: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/30.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 30
RGBRGB
00 01 02 0807060503 04 1009 110 1 2
...
1312 14w-1
15 16 17 18 ...
x
y Pixel (x,y) de uma imagem WxH – formato PPMunsigned char *rgb_vector;
offset=3*(w*y+x);red = rgb_vector[offset];green = rgb_vector[offset+1];blue = rgb_vector[offset+2];
012
h-1
3
...
![Page 31: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/31.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 31
Compressão de imagens
Compressão deImagens
Sem Perda Com Perda
Preserva exatamente o conteúdo da imagem
Taxas de compressão 3 : 1
Preserva de forma controlada o nível de qualidade da imagem
Taxas de compressão que chegam a valores de mais de 100 : 1
![Page 32: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/32.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 32
Métodos de compressãoSem perdas
Run length encoding (RLE) - repetiçãoHuffman coding - histogramaPredictive coding - diferençasBlock coding (LZW) - dicionário
Com perdasTruncation coding - reduz a representaçãoPredictive coding - descarta diferenças altasBlock coding - dicionário aproximado Transform coding - descarta frequencias altas
![Page 33: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/33.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 33
Processo de compressão e descompressão
Dados da Imagem Original
32, 45, 57, 68, 23, 100,98, ...
32, 45, 57, 68, 23, 100,98, ...
Imagem Comprimida
32, 45, 57, 68, 23, 100,98, ...
Dados da Imagem Original
Compressãoda imagem
Imagem Comprimida
32, 45, 57, 68, 23, 100,98, ...
Transporte e/ouArmazenamento
Descompressãoda imagem
![Page 34: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/34.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 34
Fundamentos da Compressão de Imagens
codificação
entre pixels
psico-visual
A compressão de uma imagem é obtida quando se elimina a redundância de:
![Page 35: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/35.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 35
Redundância entre pixels
640 colunas x 480 linhas x 1 byte/pixel = 300 KBytes
480*(1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0) = ~18 Kbytes
onde 1 = 32 bytes de preto e 0 = 32 bytes de branco
![Page 36: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/36.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 36
Compressão - RLEObjetivo
Reduzir a quantidade de dados redundantes.
Exemplo AAAAAAxxx 6A3x
CaracterísiticasSimples e rápido, porém a eficiência depende da imagem a ser comprimida.
![Page 37: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/37.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 37
Run-Length Encoding
76 76 76 76 76 78 79 79 79 79 80 80
76 | 5 78 | 1 79 | 4 80 | 2
imagem binária
0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0
7 4
1. . .
5
![Page 38: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/38.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 38
Codificação uniforme
Uniforme
tons # pixels código tam. # bits
0 1900 000 3 5700
1/7 2500 001 3 7500
2/7 2100 010 3 6300
3/7 1600 011 3 4800
4/7 800 100 3 2400
5/7 600 101 3 1800
6/7 300 110 3 900
1 200 111 3 600
TOTAL 30000
Podemos melhorar?
![Page 39: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/39.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 39
Codificação de Huffman
Tabela de Codificações de uma imagem 100×100 com oito tons de cinza.
A codificação de Huffman é feita com base numa árvore binária na qual as folhas são ostons e, o código, o caminho para se chegar da raiz até elas, como ilustra a figura a seguir para o exemplo da Tabela acima.
![Page 40: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/40.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 40
Codificação de Huffman Árvore de Huffman.
A idéia básica para construir esta árvore consiste em colocar os tons mais freqüentes pertoda raiz e os tons menos freqüentes mais distantes. O algoritmo de construção da árvore deHuffman para isto pode ser descrito da seguinte maneira:
Comece criando uma tabela dos tons e do número de vezes que eles aparecem na imagem (colunas 1 e 2 da Tabela ).
• Repita até que a tabela não tenha mais nenhuma linha:
1. Ordene a tabela de forma decrescente segundo o número de vezes que os tons aparecem na imagem;
2. Combine as duas últimas linhas da tabela (tons menos freqüentes) em uma única linha, somando o número de ocorrências dos tons combinados;
3. Armazene cada combinação como sendo um nó de uma árvore binária cujos filhosvsão as linhas combinadas.
• Numere cada folha da árvore de acordo com o caminho para se chegar da folha até ele
![Page 42: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/42.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 42
Codificação de Huffman
s pa2 0.4 0.4 0.4 0.4 0.6a6 0.3 0.3 0.3 0.3 0.4a1 0.1 0.1 0.2 0.3a4 0.1 0.1 0.1a3 0.06 0.1a5 0.04
s probabilidadea2 0.4 1 0.4 1 0.4 1 0.4 1 0.6 0a6 0.3 00 0.3 00 0.3 00 0.3 00 0.4 1a1 0.1 011 0.1 011 0.2 010 0.3 01a4 0.1 0100 0.1 0100 0.1 011a3 0.06 01010 0.1 0101a5 0.04 01011
![Page 43: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/43.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 43
Redundância de Codificação
r p(r) Code 1 l(r) l(r)p(r) Code 2 l(r) l(r)p(r)0 0.19 000 3 0.57 11 2 0.38
1/7 0.25 001 3 0.75 01 2 0.502/7 0.21 010 3 0.63 10 2 0.423/7 0.16 011 3 0.48 001 3 0.484/7 0.08 100 3 0.24 0001 4 0.325/7 0.06 101 3 0.18 00001 5 0.306/7 0.03 110 3 0.09 000001 6 0.18
1 0.02 111 3 0.06 000000 6 0.121.00 Lavg= 3.00 2.70
rk = tons de cinza em uma imagem, k=0, 1, ...,
p(rk) = nk / n
onde nk = número de pixels com tom rk
n = número de pixels da imagem
Lavg=
kk
kavg rprlL
1
0
111001
001
0001
00001
000001000000
![Page 44: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/44.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 44
Resultado da Teoria da Informação
bitsdenúmerorp
rlk
kopt
1log2
r p(r) Code 1 l(r) l(r)p(r) Code 2 l(r) l(r)p(r) log(1/p) log(1/p)*p0 0.19 000 3 0.57 11 2 0.38 2.4 0.461/7 0.25 001 3 0.75 01 2 0.50 2.0 0.502/7 0.21 010 3 0.63 10 2 0.42 2.3 0.473/7 0.16 011 3 0.48 001 3 0.48 2.6 0.424/7 0.08 100 3 0.24 0001 4 0.32 3.6 0.295/7 0.06 101 3 0.18 00001 5 0.30 4.1 0.246/7 0.03 110 3 0.09 000001 6 0.18 5.1 0.151 0.02 111 3 0.06 000000 6 0.12 5.6 0.11
=1.00 Lavg = 3.00 2.70 Lopt = 2.65Lavg =
![Page 46: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/46.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 46
Aplicações são tecnologicamente complexas - exemplo: algoritmo do JPEG
FDCT
SourceImage
Quantizer EntropyEncoder
TableTable
Compressedimage data
DCT-based encoding
8x8 blocks
R
BG
![Page 47: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/47.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 47
![Page 48: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/48.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 48
![Page 49: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/49.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 49
![Page 50: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/50.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 50
Equations for JPEG DCT Forward DCT:
Inverse DCT:
.1, otherwise ;0yfor x, 2
1 where
16)12(cos
16)12(cos),(
41),(
7
0
7
0
yxyx
x yyx
CCCC
yjxijiSpixelCCyxDCT
.1, otherwise ;0,for 2
1, where
)12(cos16
)12(cos),(41),(
7
0
7
0
jiji
x yji
CCjiCC
iyjxjiDCTCCyxpixel
![Page 51: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/51.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 51
Visualization of Basis Functions
Increasing frequency
Incr
easi
ng fr
eque
ncy
![Page 52: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/52.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 52
Tipo Abstrato ImagemImage *imgCreate (int w, int h);void imgDestroy (Image *image);
int imgGetWidth(Image * image);int imgGetHeight(Image * image);float * imgGetRGBData(Image * image);
void imgSetPixel3fv(Image *image, int x, int y, float * color);void imgSetPixel3ubv(Image *image, int x, int y, unsigned char *color);void imgGetPixel3fv(Image *image, int x, int y, float *color);void imgGetPixel3ubv(Image *image, int x, int y, unsigned char *color);
Image * imgReadBMP(char *filename);int imgWriteBMP(char *filename, Image * image);
Image * imgCopy(Image * image);Image * imgGrey(Image * image);Image * imgResize(Image * img0, int w1, int h1);
/*- implementação do tipo Imagem */
struct image_imp
int width; /* largura (width) em pixels */
int height; /* altura (height) em pixels */
float *buf; /* buffer RGB */
;
![Page 53: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/53.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 53
Arquivos Targa RGBA
Cabeçalho Pixels (bgra,bgra, …,bgra)
/* escreve o cabecalho */ putc(byteZero,filePtr); /* no. de caracteres no campo de id da imagem */ putc(byteZero,filePtr); /* imagem nao tem palheta de cores */ putc(imageType,filePtr); /* = 2 -> imagem "true color" (RGBA) */ putuint(shortZero,filePtr);/* info sobre a tabela de cores (inexistente) */ putuint(shortZero,filePtr); /* idem */ putc(byteZero,filePtr); /* idem */ putuint(shortZero,filePtr); /* =0 origem em x */ putuint(shortZero,filePtr); /* =0 origem em y */ putuint(img->width,filePtr); /* largura da imagem em pixels */ putuint(img->height,filePtr); /* altura da imagem em pixels */ putc(bitDepth,filePtr); /* numero de bits de um pixel */ putc(byteZero, filePtr); /* origem canto inf esquedo sem entrelacamento */
unsigned char imageType=2 /* RGB(A) sem compressão */unsigned char bitDepth=32; /* 32 bits por pixel */unsigned char byteZero=0; /* usado para escrever um byte zero no arquivo */short int shortZero=0; /* usado para escrever um short int zero no arquivo */
![Page 54: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/54.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 54
Formato PPM• File_signature "P6". • White_space (blanks, TABs, CRs, LFs). • Width, w, (ASCII decimal characters). • White_space (blanks, TABs, CRs, LFs). • Height, h, (ASCII decimal characters). • White_space (blanks, TABs, CRs, LFs). • Max_color, max, (ASCII decimal characters). • White_space (blanks, TABs, CRs, LFs). • Pixels, (3*w*h bytes rgb components of pixels)• Comments from # to the end of line• lines 70 characters
![Page 55: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/55.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 55
Organização de pixels num arrayno formato PPM (o mais simples)
00 01 02 0807060503 04 1009 110 1 2
...
1312 14w-1
15 16 17 18 ...
x
y Pixel (x,y)unsigned char *rgb_vector;…offset=3*(w*y+x);red = rgb_vector[offset];green = rgb_vector[offset+1];blue = rgb_vector[offset+2];
012
h-1
3
...
![Page 56: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/56.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 56
Formato PPM
• File_signature "P6". • White_space (blanks, TABs, CRs, LFs). • Width, w, (ASCII decimal characters). • White_space (blanks, TABs, CRs, LFs). • Height, h, (ASCII decimal characters). • White_space (blanks, TABs, CRs, LFs). • Max_color, max, (ASCII decimal characters). • White_space (blanks, TABs, CRs, LFs). • Pixels, (3*w*h bytes rgb components of pixels)
• Comments from # to the end of line• lines 70 characters
![Page 57: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/57.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 57
Formato PPM
P6# Created by Paint Shop Pro358 539255=?:?A<AC>CE@EFAFGBGHCGHCGHB . . .
exemplo
![Page 58: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/58.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 58
Gravação em PPMint ppm_write(int w, int h, unsigned char *rgb, char *file_name) FILE *fp;
fp = fopen(file_name, "wb"); if (fp == NULL) return 0;
if (fprintf(fp, "P6\n%d %d\n255\n", w, h) <= 0) fclose(fp); return 0;
if (fwrite(rgb, 3*w*h, 1, fp) != 1) fclose(fp); return 0;
fclose(fp); return 1;
![Page 59: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/59.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 59
Leitura em PPMint ppm_read(int *p_w, int *p_h, unsigned char **p_rgb, char *file_name) FILE *fp; char line[80]; int rgb_size; int max;
fp = fopen(file_name, "rb"); if (fp == NULL) printf(”Error reading %s",file_name); return 0; fgets(line,80,fp); if(strcmp(line,"P6\n")) printf(”Wrong signature\n"); return 0;
while (fscanf( fp, " %d ", p_w ) != 1) fgets(line, 80, fp); while (fscanf( fp, " %d ", p_h ) != 1) fgets(line, 80, fp); while (fscanf( fp, " %d", &max ) != 1) fgets(line, 80, fp); fgetc(fp);
rgb_size=3*(*p_w)*(*p_h); (*p_rgb) = (unsigned char *) calloc(rgb_size, 1); if ((*p_rgb) != NULL) fread( (*p_rgb), rgb_size, 1, fp ); fclose(fp); return 1;
![Page 60: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/60.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 60
Programa Simplesvoid main(void) int w, h; // dimensões da imagem unsigned char *rgb; // bytes de rgb unsigned char r,g,b,grey; // componentes de cor int x,y; long int k;
if (ppm_read(&w,&h,&rgb,"test_in.ppm")==0) return; for (y = 0; y < h; y++) for (x = 0; x < w; x++) k = 3*(y*w+x); r = rgb[k]; g = rgb[k+1]; b = rgb[k+2]; grey = (unsigned char)(0.3*r+0.6*g+0.1*b); rgb[k] = grey; rgb[k+1] = grey; rgb[k+2] = grey; ppm_write(w, h, rgb, "test_out.ppm"); free(rgb);
![Page 61: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/61.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 61
Arquivo BMP
00 01 02 0807060503 04 1009 11
Pixel 0 Pixel 1 Pixel 2 Pixel 3
1312 14
Pixel 415
16 17 18 ...
colocado para garantir múltiplo de 4
Organização dos pixels de uma imagem RGB no arquivo BMP
![Page 62: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/62.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 62
Microsoft Windows Bitmap - BMPCaracterísticas Principais
Mono, 4-bit, 8-bit, 24-bitTipo de compressão: RLE / não comprimidoTamanho máximo: 64K x 64K pixelsSeções (versão 3):
HeaderInfo. Header
PaletteBitmap Data
![Page 63: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/63.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 63
BMP - Headertypedef struct _Win3xBitmapHeader
WORD Type; /* Image file type 4D42h (“BM”)*/DWORD FileSize; /* File size (bytes) */WORD Reserved1; /* Reserved (always 0) */WORD Reserved2; /* Reserved (always 0) */DWORD Offset; /* Offset to bitmap data in bytes */
WIN3XHEAD;
![Page 64: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/64.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 64
BMP - Information Headertypedef struct _Win3xBitmapInfoHeader
DWORD Size; /* Size of this Header (40) */DWORD Width; /* Image width (pixels) */DWORD Height; /* Image height (pixels) */WORD Planes; /* Number of Planes (always=1) */WORD BitCount; /* Bits per pixel (1/4/8 or 24)*/DWORD Compression; /* Compression (0/1/2) */DWORD SizeImage; /* Size of bitmap (bytes) */DWORD XPelsPerMeter; /* Horz. resol.(pixels/m) */DWORD YPelsPerMeter; /* Vert. resol.(pixels/m) */DWORD ClrUsed; /* Num of colors in the image */DWORD ClrImportant; /* Num of important colors */
WIN3XINFOHEADER;
![Page 65: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/65.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 65
BMP - Palettetypedef struct _Win3xPaletteRGBQUAD Palette[ ]; /* 2, 16, or 256 elem. */
WIN3XPALETTE;
typedef struct _Win3xRgbQuadBYTE Blue; /* 8-bit blue component */BYTE Green; /* 8-bit green component */BYTE Red; /* 8-bit red component */BYTE Reserved; /* Reserved (= 0) */
RGBQUAD;
![Page 66: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/66.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 66
BMP - Image DataNotas
Cada scan line em um arquivo BMP é sempre um múltiplo de 4.
Imagens com1-, 4-, e 8-bits usam uma palheta de cores.
Imagens com 24-bits guardam a cor diretamente, na ordem azul, verde e vermelho (RGBRGB).
O armazenamento da imagem é sempre feito a partir do canto esquerdo inferior.
![Page 67: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/67.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 67
Processamento de Imagens
Processamentos apenas no espaço das cores
![Page 68: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/68.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 68
Correção gamaAjustes de contraste e iluminação
![Page 70: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/70.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 70
Probabilidade
0 1 x
DF(x)
x0 x1
1
0
)( 10
x
x
dxxDFxxxP x
dxxDFxxPxCDF0
)(0)(
)()( xCDFdxdxDF
Função de densidade de probabilidade
0 1 x
CDF(x)
1
x
Função de densidade acumulada de probabilidade
![Page 71: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/71.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 71
Mudança de variavel y = f (x)
)()( yCDFdydyDF
0 1 x
y=f(x)1
0 1 y
1)(1 yfx
)()( xCDFxf )(xDFdxdy
1)()()(
xDFxDFyDF
0 1 x
DF(y)1
Transformação monotônica e limitada ao intervalo [0,1]
dydxxCDF
dxd )(
dydxxDF )(
![Page 72: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/72.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 72
Equalização de Histograma
L
j
j
nn
LfL0
)('
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1 2 3 4 5 6 7 8 9 10 11
nn j
L
![Page 74: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/74.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 74
Tons de cinza e negativo
Lx,y = 0.299Rx,y + 0.587Gx,y + 0.114Bx,y
tons de cinza
Lx,y = 255 - Lx,y
![Page 75: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/75.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 75
Processamento de Imagens
Eliminação de ruídos e realce de arestas
![Page 76: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/76.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 76
Redução de ruídos Dada uma imagem I com um ruído n, reduza n o máximo
que puder (preferencialmente elimine n completamente) sem alterar significativamente I.
),(),(),(ˆ jinjiIjiI
n
sSNR
n
sdBSNR
10log10
100n
s
20 dB significam
![Page 77: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/77.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 77
Dois tipos básicos de ruídos
Ruído Gaussiano branco : processo estocástico de média zero, independente do tempo e dos espaço.
2
2
2
21)(
x
exG
0),( jin
),(~),( 00 jjiinjin é o mesmo processo estocástico que não varia no tempo.
),( jin é uma variável aleatória com a distribuição:
![Page 78: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/78.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 78
Dois tipos básicos de ruídos Ruído impulsivo: causado por erro de transmissão,
CCDs defeituosos, etc... Também chamado de pico e de sal e pimenta.
lxiiyi
lxjinsp )(
0),(
minmaxmin
1,0, yx são v.a. uniformemente distribuídas
imin, imax, e l são parâmetos de controle da quantidade de ruídos.
![Page 79: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/79.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 79
Exemplo de ruído Gaussiano (=5) e Impulsivo ( =0.99)
![Page 80: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/80.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 80
![Page 81: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/81.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 81
Imagem com ruído impulsivo
223 204 204 204 204 204 204 204 204 204 204 204 204 223
171 120 120 120 18 120 50 120 120 120 120 120 120 171
171 120 120 120 116 120 120 120 120 120 120 120 120 171
138 120 120 120 120 120 50 120 97 120 120 120 120 171
171 120 120 120 120 120 120 120 120 120 187 120 120 242
172 120 120 120 120 120 120 120 120 120 120 120 120 171
171 120 120 120 120 120 179 120 120 120 120 167 120 171
171 120 120 120 120 120 120 235 120 120 120 120 120 171
171 120 120 120 120 120 120 235 120 76 175 120 120 171
171 120 120 120 120 120 120 120 120 120 120 120 120 171
171 120 120 120 120 120 120 120 123 120 120 214 120 114
171 120 120 120 120 120 120 120 120 120 120 120 143 171
171 120 120 120 232 120 120 198 120 120 120 120 120 171
203 171 171 171 171 171 171 171 171 205 171 171 171 203
Uso da mediana
Iij = mediana Ωij
![Page 82: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/82.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 82
Sinal com ruído := ( )f3 x 10 ( )cos 2 x 6 ( )sin 10 x .8 ( )cos 40 x
-20
-15
-10
-5
0
5
10
15
20
![Page 83: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/83.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 83
Filtragem Gaussiana – Suavização
-20
-15
-10
-5
0
5
10
15
20
w1+w2+w3 filtro w1+w2
42 11
iiii
fffh
![Page 84: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/84.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 84
Filtro
Um filtro é um operador que atenua ou realça uma determinada freqüência
Fácil de visualizar no domínio da freqüência onde:
)()()( GFH
)()( tfF
)()( Hth h(t) é o f(t) filtrado
![Page 85: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/85.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 85
Tipos de Filtros
F G
=
=
=
H
Passa baixa
Passa alta
Passa banda
![Page 88: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/88.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 88
Filtragem no domínio espacial
Filtragem no domínio espacial é obtida pela convolution (e vice-versa).
)()()( GFH )()( xfF
)()( Hxh
)()( xgG
duuxgufgfxh )()()(
ou:
Na realidade é ao contrário: a TF é uma ferramenta para filtragem.
![Page 89: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/89.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 89
Mascara ou Filtro
42 11
iiii
fffh
1
0)(
n
kiiki fgh
1014/104/214/110
lselselselselse
gl
ou:
![Page 90: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/90.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 90
Discretização da Gaussiana 1D
0.1
0.2
0.3
-4 -3 -2 -1 0 1 2 3 4
2
2
2
21)(
x
exG
12141
14641161
1615201561641
![Page 91: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/91.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 91
Discretização da Gaussiana 2D
2
22
2
21),(
yx
eyxG
121242121
161
1474141626164726412674162616414741
2731
![Page 92: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/92.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 92
Separabilidade do filtro gaussiano207 247 38 131 38
62 90 129 234 231
211 175 44 1 26
236 58 75 128 112
210 141 125 168 58
121242121
161
130 117 129
125 90 88
129 93 92
12141
12141
185 113 84
93 145 207
151 66 18
107 84 111
154 140 130
130 117 129
125 90 88
129 93 92
![Page 93: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/93.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 93
Transformada normalizada de Fourier
1
0
1
0
)//(2),(1),(w
x
h
y
hyswxrieyxfwh
srF
1
0
1
0
)//(2),(1),(w
r
h
s
hyswxriesrFwh
yxf
![Page 94: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/94.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 94
Transformada normalizada de Fourier: separação
)/(21
0
1
0
)/(2),(11),( wxriw
x
h
y
hysi eeyxfhw
srF
1
0
1
0
)//(2),(1),(w
x
h
y
hyswxrieyxfwh
srF
),( sxT
![Page 95: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/95.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 95
Transformada normalizada de Fourier: Matriz H
1
0
)/(21),(),(h
y
hysieh
yxfsxT
),( syHsy
hi
hysi eh
eh
syH
2)/(2 11),(
![Page 96: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/96.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 96
)1(0)1)(1(1)1(0)1(
)1(11110
)1(00100
hhhhh
h
h
ffff
ffffff
f
fHT
Transformada normalizada de Fourier: Matriz H
![Page 97: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/97.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 97
)1()1(21)1(20)1(2
)1(12112012
)1(02102002
1
hh
hih
hih
hi
h
hi
hi
hi
h
hi
hi
hi
eee
eee
eee
h
H
fHT
![Page 98: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/98.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 98
1
0
2
),(1),(w
x
rx
wi
sxTew
srF
),( xrWxr
wi
ew
xrW
21),(
![Page 99: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/99.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 99
)1()1(21)1(20)1(2
)1(12112012
)1(02102002
1
ww
hiw
hiw
hi
w
hi
hi
hi
w
hi
hi
hi
eee
eee
eee
w
H
WfHWTF
![Page 100: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/100.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 100
Problemas com a Transformada de Fourier
)(2121
21),(),( bkakiekkFbxaxf
),(),( 2121 kkFxxf
),(1),( 2121
kkFxxf
)cossin,sincos(
)cossin,sincos(
2121
2121
kkkkF
xxxxf
![Page 101: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/101.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 101
Transformada de Mellin
0
1)()( dxxxfsM s
deefdxxxfsM ss )()()(0
1
ex dedx
eefdeeefiM i )()()( 2
wis 2
))(())(( axfMxfM
![Page 102: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/102.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 102
Transformada de Mellin
0 0
1121
21),(),( dxdyyxyxfzzM zz
dedxex dedyey
))((),(
),(
)1()1(
21
21 dedeeeeef
zzM
zz
![Page 103: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/103.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 103
Transformada de Mellin
ddeeeefzzM zz 21),(),( 21
uiz 21 viz 22
ddeeeefvuM viui 22),(),(
![Page 104: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/104.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 104
Transformada de Mellin
1
0
1
0
22lnln ),(1),(
w
x
h
y
sh
irw
iyx eeeefwh
srM
ddeeeefvuM viui 22),(),(
xwu
1yh
v
1
![Page 105: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/105.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 105
)1()1(21)1(20)1(2
)1(12112012
)1(02102002
1
ww
hiw
hiw
hi
w
hi
hi
hi
w
hi
hi
hi
eee
eee
eee
w
H
WfHWTF
![Page 106: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/106.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 106
Transformada de Mellin
0 0
1121
21),(),( dxdyyxyxfzzM zz
dedxex dedyey
0 0
1212),(),( dxdyyxyxfsrM siri
riz 21 siz 22
![Page 107: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/107.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 107
xln
dedyey
0 0
1212),(),( dxdyyxyxfsrM siri
dedxex
0 0
1212),(),( dxdyeeeefsrM siri
Transformada de Mellin
![Page 109: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/109.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 109
Quantização de cores
Quantização de 24 para 8 bits
![Page 113: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/113.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 113
Estudo de sinais digitais
Transformadas para o domínio da freqüencia Teorema de Nyquist e Alias
![Page 114: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/114.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 114
Harmônicos
t+
)cos( tA
-8
-6
-4
-2
0
2
4
6
8
0 0.01 0.02 0.03 0.04 0.05A-A
T
)(1 HzT
f
revisão
)(22 radtT
ftt
A
![Page 115: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/115.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 115
Integrais de senos e cosenos em [-,]
cos(nx) sin(nx)
n = 1
n = 2
sin(nx)cos(nx)
revisão
Áreas se compensam.Integrais resultam em 0.
![Page 116: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/116.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 116
Integrais de senos e cosenos em [-,]
Funções ortogonais
revisão
![Page 117: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/117.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 117
Série de Fourier
)2sin2cos(2)(1
0 Tktb
Tktaatf k
kk
t
f(t)
0 T
Jean Baptiste Joseph Fourier (1768-1830) Paper de 1807 para o Institut de France: Joseph Louis Lagrange (1736-1813), and Pierre Simon de Laplace (1749-1827).
![Page 118: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/118.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 118
Exemplo: Série de harmônicos
-0,25
-0,05
0,15
0,35
0,55
0,75
0,95
1,15
-0,25
-0,05
0,15
0,35
0,55
0,75
0,95
1,15
-0, 25
-0, 05
0,15
0, 35
0, 55
0, 75
0, 95
1, 15
![Page 119: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/119.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 119
Série de Fourier: cálculo de a0
T
k
T
k
T
k
T
o dtT
ktbdtTnktadtadttf
01
000)2sin()2cos()(
00)(0 0 T
Tadttf T
dttfT
a00 )(1
)2sin2cos(2)(1
0 Tktb
Ttkaatf k
kk
t
f(t)
0 T
![Page 120: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/120.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 120
Série de Fourier: an e bn
T
dttfT
tn0
)()2cos(
T
n dtT
tntfT
a0
)2cos()(1
T
n dtT
tntfT
b0
)2sin()(1
...
)2sin2cos(2)(1
0 Tktb
Ttkaatf k
kk
t
f(t)
0 T
0)2cos()2cos(200
1
T
kn dt
Ttk
Ttna
nTa
![Page 121: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/121.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 121
Resumindo
)2sin2cos(2)(1
0 Tktb
Tktaatf k
kk
T
k kdtT
kttfT
a0
,...3,2,1,0)2cos()(1
T
k kdtT
kttfT
b0
,...3,2,1)2sin()(1
t
f(t)
0 T
Tk
k 2
T 2
![Page 122: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/122.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 122
Domínios
t
f(t)
0 T
T 2
w
ak
0
w
bk
0
tempo ou espaço
freqüencia
![Page 123: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/123.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 123
Coeficientes de funções pares e ímpares
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
0 0.2 0.4 0.6 0.8 1
cos cos sin sin
f-ímpar ak= 0
f-par bk= 0
![Page 124: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/124.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 124
Periodicidade da Série de Fourier
)()(2sin)(2cos2)(1
0 tfTtT
kbTtT
kaaTtfk
kk
t
f(t)
0 T
t
f(t)
0 T
![Page 125: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/125.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 125
Números complexos
x é a parte real y é a parte imaginária A é a magnitude é a fase
A
xeixo real
eixo imagnário
y
)sin(cos iAiyxz 1i
revisão
![Page 126: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/126.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 126
Operação básicas com complexos
)()( 2211 iyxiyx
))(( 2211 iyxiyx
))(( iyxiyx
22
11
iyxiyx
iayax )()( 2121 yyixx )( iyxa
)()( 21122121 yxyxiyyxx )()( 2112212
21 yxyxiyyixx 12 i
2222 )()( yxxyxyiyx
2222
2211
iyxiyxiyxiyx
221122
22
1 iyxiyxyx
sincos iei
revisão
![Page 127: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/127.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 127
Derivada de eit
titi eiedtd
tittitdtd cossinsincos
)cossin1( tti
i
i1
)cossin( ttii
C.Q.D.
2ii ii
1
revisão
![Page 128: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/128.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 128
Outras propriedades úteis
sincos iei
1ie
iei
2
i
-1 1
revisão
![Page 129: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/129.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 129
Outras propriedades úteis (2)
sincos iei sincos ie i
)(cos 21 ii ee
revisão
)(cos 21 titi eet
t
t
1-1
i
-i
o cosseno corresponde a média de dois harmônicos de freqüênciasw e -w
![Page 130: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/130.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 130
Outras propriedades úteis (2)
sincos iei sincos ie i
)()(sin 221 iiiiii eeee
revisão
i1
2ii ii
1
tt
1-1
i
-i
o seno também corresponde a dois harmônicos:w e -w
![Page 131: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/131.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 131
Outras propriedades úteis (3)
)sin(cos 111111 iAeAz i
)sin(cos 222222 iAeAz i
)(2121
21 ieAAzz
)(
2
1
2
1 21 ieAA
zz
revisão
![Page 132: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/132.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 132
Amplitude e fase de complexos
sinA
A-A
Dado um valor:iyxiAz )sin(cos
zzyxA 222
xy
tan
Amplitude
Fase
cosA
revisão
![Page 133: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/133.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 133
Série de Fourier com números complexos
10
2sin2cos2)(k
nk Tktb
Tktaatf
2cos
ii ee
iee ii
2sin
1
22
0)(k
Tkti
kT
kti
k eFeFFtf
nnkkkk ibaFibaFaF ,,00
k
Tkti
keFtf2
)(
kk FF
1
2222
0)(k
Tkti
Tkti
kTkti
Tkti
k eei
beeaatf
1
22
0)(k
Tkti
kk
Tkti
kk e
ibae
ibaatf
T
Tkti
k kdtetfT
F0
)2(,...3,2,1)(1
i1
2ii ii
1
![Page 134: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/134.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 134
Escrevendo em complexos
k
Tkti
kkk
k eFTktb
Tktaatf
2
10 )2sin2cos(2)(
T T
kk kdtTkttf
Tbdt
Tkttf
Ta
0 0,...3,2,1,0)2sin()(1,)2cos()(1
T
Tkti
k kdtetfT
F0
)2(,...3,2,1,0)(1
kkk ibaF
)2sin()2cos()2(
Tkti
Tkte T
kti
![Page 136: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/136.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 136
Sinal discreto
t0 1 2 3 4 5 6 N-1
rf
r
)(tf
tNT
ttrt
,,,,,,,, 1221 NNro ffffff
![Page 137: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/137.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 137
T
k dtTkttf
Ta
0)2cos()(1
01 2 3 4 5 N
)2cos()(Tkttf
tt
trtr
ttN
tkrftN
N
rk
1
0
2cos1
TtNT
1
0
)2cos(1 N
rrk N
rkfN
a
1
0
2sin1 N
rkk N
rkfN
b . . .
![Page 138: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/138.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 138
1
0
)2cos(1 N
rrk N
rkfN
a
1
0
2sin1 N
rkk N
rkfN
b
1
1
0
)1)(1(1)1(0)1(
)1(11110
)1(00100
1
1
0
1
NNNNN
N
N
N f
ff
ccc
cccccc
Na
aa
)2cos(N
krckr
onde:
1
1
0
)1)(1(1)1(0)1(
)1(11110
)1(00100
1
1
0
1
NNNNN
N
N
N f
ff
sss
ssssss
Nb
bb
)2sin(N
krskr
onde:
![Page 139: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/139.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 139
1
0
)2(1 N
s
Nksi
skkk efN
ibaF
1
1
0
)1)(1(1)1(0)1(
)1(11110
)1(00100
1
1
0
1
NNNNN
N
N
N f
ff
EEE
EEEEEE
NF
FF
Nkri
kr eE2
onde:
1
0
)2(N
r
Nkri
rk eFf
1
1
0
)1)(1(1)1(0)1(
)1(11110
)1(00100
1
1
0
'''
''''''
NNNNN
N
N
N F
FF
EEE
EEEEEE
f
ff
Nkri
kr eE2
'
onde:
![Page 140: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/140.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 140
1
0
)2(1 N
s
Nsri
sr efN
F
1
0
)2(N
r
Nrki
rk eFf
onde:
1
0
)2(1
0
)2(1
0
)2( 1N
r
NkriN
s
Nrsi
s
N
r
Nrki
rk eefN
eFf
1
0
1
0
)2()2(1
0
1
0
)2()2( 11 N
s
N
r
Nkri
Nrsi
s
N
r
N
s
Nkri
Nrsi
s eefN
eefN
1
0
1
0
)(21 N
s
N
r
Nskri
s efN
Qual o valor?
Inversa da inversa
![Page 141: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/141.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 141
rN
r
NskiN
r
Nskri
ee
1
0
)(21
0
)(2N
skiN eqqqq)(2
121
Se s=k
1
0
1
0
)(2
1111N
r
N
r
Nskri
Ne
Se s ≠ k é a soma de uma PG de N termos e razão q.11
q
qSomaN
Mas 1)(2)(2
ski
N
NskiN eeq
0111
q
Soma
![Page 142: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/142.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 142
1
0
)2(1 N
s
Nsri
sr efN
F
1
0
)2(N
r
Nrki
rk eFf
onde:
1
0
)2(1
0
)2(1
0
)2( 1N
r
NkriN
s
Nrsi
s
N
r
Nrki
rk eefN
eFf
1
0
1
0
)2()2(1
0
1
0
)2()2( 11 N
s
N
r
Nkri
Nrsi
s
N
r
N
s
Nkri
Nrsi
s eefN
eefN
1
0
1
0
)(21 N
s
N
r
Nskri
s efN
Qual o valor?kk fNf
N
1
C.Q.D.
![Page 143: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/143.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 143
real
imaginário
ie1
Nki
Nke N
ki 2sin2cos)2(
N=3 N=4 N=5 N=6
?1
0
)2(
N
k
Nki
e
![Page 144: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/144.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 144
Transformada Discreta
)102sin()( ttf
256N
sec005.01
aft
sec28.1256005.0 T
T - não é o período do sinal!
Hzfa 200
-1.5
-1
-0.5
0
0.5
1
1.5
0 0.2 0.4 0.6 0.8 1 1.2 1.4
afNtNT
-1.5
-1
-0.5
0
0.5
1
1.5
0 0.2 0.4 0.6 0.8 1 1.2 1.4
)102sin(NsTf s
![Page 145: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/145.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 145
Transformada Discreta de Fourier
1
0
)2(1 N
s
Nksi
sk efN
F
/sec0.78131
Tf
/sec91.42 radT
-1.5
-1
-0.5
0
0.5
1
1.5
0 0.2 0.4 0.6 0.8 1 1.2 1.4
ampl
10.15625, 0.46776
0
0.1
0.2
0.3
0.4
0.5
0 20 40 60 80 100
)102sin(NsTf s
1k
todas as feqüências computadas são multiplas destas
![Page 146: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/146.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 146
Outro exemplo
-20
-15
-10
-5
0
5
10
15
20
:= ( )f3 t 10 ( )cos 2 t 6 ( )sin 10 t .8 ( )cos 40 t
![Page 147: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/147.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 147
Transformada fk
-20
-15
-10
-5
0
5
10
15
20
0 0.2 0.4 0.6 0.8 1 1.2 1.4
ampl
0.78
, 4.5
24.
69, 2
.41
20.3
1, 0
.35
0
1
2
3
4
5
0 20 40 60 80 100 120
1
0
)2(1 N
s
Nski
sk efN
F
1
0
)2(N
r
Nrki
rk eFf
![Page 149: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/149.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 149
Tutorial com o Excel
http://www.me.psu.edu/me82/Learning/FFT/FFT.html
![Page 150: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/150.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 150
Discrete Cosine Transformation (DCT)
0201
)(kk
k
1
0 2)12(cos)( N
ssk N
ksfNkC
1
0 2)12(cos)(N
krs N
ksCNkf
![Page 151: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/151.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 151
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
Nks
2)12(cos
)()cos( 2 sen o cosseno pode substituir o seno
![Page 152: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/152.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 152
Transformada de Fourier
dwewFxf wxi 2)()(
dxexfwF wxi 2)()(
![Page 153: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/153.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 153
Exemplo 1: Função caixa (box)f(x)
x
]2,202[20
)( bbxsebxseabxse
xf
a
dxexfwF wxi 2)()(
2/2/
2
2b
bwxie
wia
2/
2/
2b
b
wxi dxea
wbiwbi eewi
a
2
iee
wa wbiwbi
2
)sin( wb
wa
b
wbwbabwF
)sin()(
![Page 154: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/154.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 154
Transformada da função box
bwbwabwF
)sin()(
F(w)
0 1/b 2/b 3/b-1/b-2/b-3/b
ab
w
sinc(bw)
wbwbabwF
)sin()(
f(x)
x
a
b
![Page 155: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/155.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 155
Distribuição normal: Gaussiana
2
2
22
1)(
x
exGaus
:= ( )gaus x e( ) x2
![Page 156: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/156.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 156
Exemplo 2: Gaussiana
-0, 02
0,03
0,08
0,13
0,18
-0, 02
0,03
0,08
0,13
0,18
2
2
2
21)(
x
exf
2
2
12)(
w
ewF
f(x)
x
|| F(w) ||
w
1
![Page 157: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/157.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 157
Transformada da Gaussiana
dxeewF wxix
22 2
2
21)(
dxwxiwxex
)2sin()2cos(2
1 2
2
2
dxwxex
)2cos(2
2
22
1
222 xe
21
212 2
2
2
w
e
![Page 158: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/158.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 158
Exemplo 3: Delta de Dirac f(x)
xb/2-b/2
1/b ]2,20
2[/120
lim)(0
bbxse
bxsebbxse
xb
2
,2
),(2/2/lim)(1lim)()(0
2/
2/0
bbfb
bbdxxfb
dxxxfb
b
bb
)0()()( fdxxxf
![Page 159: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/159.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 159
Delta de Dirac de Gaussianas
22
31
9
x
e
22
21
4
x
e
22
11
1
x
e
2
2
20
1lim)(
x
ex
![Page 160: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/160.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 160
Transformada do Delta de Dirac
f(x)
x
1)()( 02
edxexwF wxi (x)
|| F(w) ||
w
1
![Page 161: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/161.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 161
Transformada do cosseno
dxexwwF wxi 2cos()(
dxwxiwxxw )2sin()2cos()cos(
2
20
)2cos()cos( wwse
wwsedxwxxw
-1,5
-1
-0,5
0
0,5
1
1,5)cos( tw
x
![Page 162: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/162.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 162
Exemplo 4: Cosseno
)
2()
2(
21)(
wwwwwF
|| F(w) ||
ww w
)( ww )( ww
-1,5
-1
-0,5
0
0,5
1
1,5)cos( tw
x
![Page 163: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/163.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 163
Exemplo 5: Sequência de impulsos
w
f(x)
x1b 2b3b-1b-2b
|| F(w) ||
1/b 2/b2/b-1/b-2/b
f(x)
x1b 2b 3b-1b-2b
|| F(w) ||
w1/b2/b2/b-1/b-2/b
![Page 166: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/166.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 166
Convolução
t
t
dtxfxtgxh )()()(
1
0)(
n
kiiki fgh
duuxgufgfxh )()()(
![Page 167: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/167.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 167
Ilustação da convolução
t
t
dtxfxtgxh )()()(
![Page 168: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/168.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 168
Ilustração da convolução
t
t
dtxfxtgxh )()()(
![Page 169: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/169.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 169
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1.5
-1
-0.5
0
0.5
1
1.5
2sin(28t), SR = 8.5 Hz
An undersampled signal
http://lcni.uoregon.edu/fft/fft.ppt
![Page 170: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/170.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 170
Amostragem e Reconstrução
Observando os domínio do espaço e das freqüências
![Page 171: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/171.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 171
Sinal original
domínio do espaço domínio das freqüências
![Page 172: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/172.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 172
Amostragemdomínio do espaço domínio das freqüências
produto convolução
![Page 173: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/173.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 173
Sinal discretizado
domínio do espaço domínio das freqüências
![Page 174: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/174.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 174
Reconstruçãodomínio do espaço domínio das freqüências
convolução produto
![Page 175: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/175.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 175
Retorno ao sinal original
domínio do espaço domínio das freqüências
![Page 176: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/176.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 176
Sinal original com mais altas freqüências
domínio do espaço domínio das freqüências
![Page 177: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/177.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 177
Mesma taxa de amostragemdomínio do espaço domínio das freqüências
produto convolução
![Page 178: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/178.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 178
Sinal amostrado
domínio do espaço domínio das freqüências
Não temos como reconstruir sem introduzir artefatos!
![Page 179: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/179.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 179
Teorema de Nyquist
Para que um sinal de banda limitada (i.e. aqueles cuja a transformada resultam em zero para freqüências f > B) seja reconstruido plenamente ele precisa ser amostrado numa freqüência f >= 2B. Um sinal amostrado na freqüência (f=2B) é dito amostrado por Nyquist e f=2B é a freqüência de Nyquist.
Não há perda de informação nos sinais amostrados na freqüência de Nyquist, e não adicionamos nenhuma informação se amostrarmos numa freqüência maior.
![Page 180: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Computação Gráfica Módulo I – Imagem UniverCidade - Prof. Ismael H F Santos.](https://reader036.fdocumentos.tips/reader036/viewer/2022062818/5706383e1a28abb8238f072a/html5/thumbnails/180.jpg)
April 05 Prof. Ismael H. F. Santos - [email protected] 180
Aliasing Esta mistura de espectros é chamada de aliasing. Existem duas maneiras de lidarmos com aliasing.
Passar um filtro passa-baixa no sinal.
Aumentar a freqüência de amostragem.