This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
from functools import cache | |
MOODLE_SESSION = '' | |
FILENAME = 'readme.md' | |
@cache | |
def file_content(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################### | |
# Por: Guilherme S Salustiano # | |
# Eng da Computação 2020 # | |
###################################################### | |
using Measurements | |
temperatura_da_agua_graus = 30 ± 0.5 | |
distancia_tubos_pilot_centros = 5.4e-3 | |
distancia_tubos_pilot_parede_centro = distancia_tubos_pilot_centros/2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 as cv | |
import matplotlib.pyplot as plt | |
import numpy as np | |
img = cv.imread('passarinho.jpg',0) | |
sobel = cv.Sobel(img, -1, 1, 1) | |
fig, ax = plt.subplots(ncols=2,figsize=(15,5)) | |
ax[0].imshow(img, cmap = 'gray') | |
ax[0].set_title('Original') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
def rgbToGray(img): | |
# Baseado em https://pillow.readthedocs.io/en/3.2.x/reference/Image.html#PIL.Image.Image.convert | |
return np.matmul(img, [0.2989, 0.5870, 0.1140]).astype(np.uint()) | |
def convolution(img: np.ndarray, filt: np.ndarray): | |
iw, ih = img.shape |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gaussian_kernel(size, sigma=1): | |
center = size//2 | |
x, y = np.mgrid[-center:center+1, -center:center+1] | |
return np.exp(-((x**2 + y**2) / (2*sigma**2))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convolution(img: np.ndarray, filt: np.ndarray): | |
iw, ih = img.shape | |
kw, kh = filt.shape | |
assert(kw % 2 == 1 and kh % 2 == 1) # Garante que o filtro tenha um centro | |
kcx, kcy = kw//2, kh//2 # Calcula a posição central | |
out = np.zeros(img.shape) | |
for x, y in np.ndindex(*out.shape): | |
#Pega os pixels que serão usados na operação com o filtro | |
sub_img = img[max(0, x-kcx): min(iw, x-kcx + (kw)), | |
max(0, y-kcy): min(ih, y-kcy + (kh))] |
NewerOlder