generated from insper-classroom/221_robot_aps1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex1.py
43 lines (26 loc) · 864 Bytes
/
ex1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Este NÃO é um programa ROS
from __future__ import print_function, division
import cv2
import os,sys, os.path
import numpy as np
print("Rodando Python versão ", sys.version)
print("OpenCV versão: ", cv2.__version__)
print("Diretório de trabalho: ", os.getcwd())
def equaliza(gray):
"""Não mude ou renomeie esta função
deve receber uma imagem e devolver uma imagem nova com o histograma equalizado
"""
res = gray.copy()
return res
if __name__ == "__main__":
img = cv2.imread("RinTinTin.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Faz o processamento
saida = equaliza(img)
cv2.imwrite("saida_ex1.png", saida)
# NOTE que a OpenCV terminal trabalha com BGR
cv2.imshow('entrada', img)
cv2.imshow('saida', saida)
cv2.waitKey(0)