Skip to content

Commit

Permalink
Ex 1 Feito
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcostafrf committed Mar 2, 2020
1 parent 9b70f7f commit d3fdb7d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
24 changes: 24 additions & 0 deletions comp_vis/lab01/ex_1/ex1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import numpy as np
import sys
sys.path.append('/usr/local/lib/python3.7/site-packages')
import cv2

img = cv2.imread('image0.jpeg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

h, w, _ = img.shape

src_ver = np.zeros((h, w, 3), np.uint8)
src_ver[:] = (255,0,255)

gray_alt = cv2.cvtColor(cv2.absdiff(img,src_ver), cv2.COLOR_BGR2GRAY)

print(src_ver.shape)
print(img.shape)

cv2.imshow('image',img)
cv2.imshow('gray',gray)
cv2.imshow('gray_alt',gray_alt)

cv2.waitKey()
cv2.destroyAllWindows()
Binary file added comp_vis/lab01/ex_1/image0.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added comp_vis/lab01/ex_1/image1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added comp_vis/lab01/ex_1/image2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions comp_vis/lab01/lab01tocavideo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import time
import numpy as np
import sys
sys.path.append('/usr/local/lib/python3.7/site-packages')
import cv2 as cv

cap = cv.VideoCapture('test.mp4')
while(cap.isOpened()):
ret, frame = cap.read()
if ret == True:
cv.imshow('frame',frame)
time.sleep(1/25.0)
if cv.waitKey(1) & 0xFF == ord('q'):
break
else:
break
cap.release()
cv.destroyAllWindows()

0 comments on commit d3fdb7d

Please sign in to comment.