def cor(imagem): ImgOriginal = utils.LerImage('Image_(3a)') img = colori.color(ImgOriginal) fig, [ax1, ax2] = plt.subplots(1, 2) ax1.imshow(ImgOriginal, cmap='gray') ax2.imshow(img) plt.show()
def filterRGB(imagem, m=3, n=3): ImgOriginal = utils.LerImage(imagem) # imagem = np.uint8(ruido.average(ImgOriginal,m,n)) # imagem = np.uint8(ruido.Median(imagem,m,n)) imagem = np.uint8(ruido.Median(ImgOriginal, m, n)) # imagem = np.uint8(ruido.min_max(imagem,m,n)) imagem = np.uint8(ruido.midpoint(imagem, m, n)) fig, [ax1, ax2] = plt.subplots(1, 2) ax1.imshow(ImgOriginal) ax2.imshow(imagem) plt.show()
def filterHSI(imagem, m=3, n=3): ImgOriginal = utils.LerImage(imagem) img = utils.rgb2hsi(ImgOriginal) # img = ruido.average(img,m,n) # img = ruido.Median(img,m,n) # img = ruido.Median(img,m,n) img = ruido.midpoint(img, m, n) img = utils.hsi2rgb(img) fig, [ax1, ax2] = plt.subplots(1, 2) ax1.imshow(ImgOriginal) ax2.imshow(img) plt.show()
def Quant(imagem, bit): ImgOriginal = utils.LerImage(imagem) aux = np.shape(ImgOriginal) img = np.zeros(aux) norma = (255 - ImgOriginal) / 255 img = np.floor(bit - (bit * norma)) img = img.astype(int) plt.imsave('../Resultados/{}_{}'.format(imagem, bit), img, cmap='gray', vmin=0, vmax=bit) return img
def Huffman(imagem): img = utils.LerImage(imagem) p = utils.Probabilidade(img) mem = np.zeros(256) count = 0 for i in range(256): for j in range(i, 256): if p[i] < p[j]: mem[i] = i aux = p[i] p[i] = p[j] p[j] = aux new_p = [] new_p.append(p) while np.size(new_p[-1]) > 2: huff = np.zeros(np.size(new_p[-1]) - 1) for t in range(np.size(new_p[-1]) - 2): huff[t] = new_p[-1][t] huff[-1] = new_p[-1][-1] + new_p[-1][-2] new_p.append(huff) for i in range(np.size(new_p[-1])): for t in range(i, np.size(new_p[-1])): if new_p[-1][i] < new_p[-1][t]: aux = new_p[-1][i] new_p[-1][i] = new_p[-1][t] new_p[-1][t] = aux # for h in range(np.shape(new_p)[0]-1,-1,-1): # if h == np.shape(new_p)[0]-1: huffcode = new_p return huffcode
def clarear(imagem, m): ImgOriginal = utils.LerImage(imagem) fig, [ax1, ax2] = plt.subplots(1, 2) ax1.imshow(ImgOriginal) ax2.imshow(iluminacao.clarear(ImgOriginal, m)) plt.show()
def escurecer(imagem, m): ImgOriginal = utils.LerImage('Image_(1b)') fig, [ax1, ax2] = plt.subplots(1, 2) ax1.imshow(ImgOriginal) ax2.imshow(iluminacao.escurecer(ImgOriginal, m)) plt.show()
ax2.imshow(img, cmap='gray') ax3.imshow(a,cmap='gray') plt.show() def test(img): teste = project.TCC(img) fig, [ax1,ax2] = plt.subplots(1,2,figsize=(20,10)) ax1.imshow(img) ax2.imshow(teste,cmap='gray') plt.show() if __name__ == '__main__': for i in range(1,68): img = utils.LerImage(str(i)) # img = utils.rgb2gray(img) # print(img) # sobel(img) # canny_banda(img) # r(img) # aryell(img) aryell2(img) # test(img) # plt.imshow(result,cmap='gray')