This shows you the differences between two versions of the page.
|
ps:labs_python:06 [2023/11/02 12:31] constantin.savu1510 changed download paths |
ps:labs_python:06 [2023/11/07 01:14] (current) ionut.gorgos |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Laboratorul 06. ===== | ===== Laboratorul 06. ===== | ||
| - | <hidden> | + | /*<hidden>*/ |
| ==== SNR, decibeli și DFT ==== | ==== SNR, decibeli și DFT ==== | ||
| **<hidden>** | **<hidden>** | ||
| Line 81: | Line 81: | ||
| Pentru a asculta sunetul stocat în vectorul //s//, folosiți codul următor: | Pentru a asculta sunetul stocat în vectorul //s//, folosiți codul următor: | ||
| <code> | <code> | ||
| - | from scipy.io.wavfile import write | ||
| import sounddevice as sd | import sounddevice as sd | ||
| import time | import time | ||
| sd.play(s, fs) | sd.play(s, fs) | ||
| - | plt.show() | + | time.sleep(T) # Ne asigură că putem auzi tot semnalul, unde T = durata semnalului s |
| - | time.sleep(T) | + | |
| sd.stop() | sd.stop() | ||
| </code> | </code> | ||
| Line 118: | Line 116: | ||
| În acest exercițiu veți face următoarele: | În acest exercițiu veți face următoarele: | ||
| - | - încărcați și afișați o imagine folosind funcția imread din matplotlib.image: ex:<code> | + | - Încărcați și afișați o imagine folosind funcția imread din matplotlib.image: ex:<code> |
| import matplotlib.image as image | import matplotlib.image as image | ||
| import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||
| Line 129: | Line 127: | ||
| plt.show() | plt.show() | ||
| </code> | </code> | ||
| - | - Convertiți imaginea RGB în imagine gri și normalizați (daca este nevoie). Pentru a converti imaginea în gri puteți folosi următoarea funcție:<code> | + | - Convertiți imaginea RGB în imagine gri și normalizați (dacă este nevoie). Pentru a converti imaginea în gri puteți folosi următoarea funcție:<code> |
| def rgb2gray(rgb): | def rgb2gray(rgb): | ||
| return np.dot(rgb[..., :3], [0.2989, 0.5870, 0.1140]) | return np.dot(rgb[..., :3], [0.2989, 0.5870, 0.1140]) | ||
| Line 151: | Line 149: | ||
| {{:ps:labs:lab07_imagine_high_pass.png?300|}} | {{:ps:labs:lab07_imagine_high_pass.png?300|}} | ||
| - | </hidden> | + | /*</hidden>*/ |