changes
|
Before Width: | Height: | Size: 229 KiB After Width: | Height: | Size: 258 KiB |
BIN
detec/foscam/1.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
detec/foscam/10.jpg
Normal file
|
After Width: | Height: | Size: 264 KiB |
BIN
detec/foscam/10.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
detec/foscam/11.jpg
Normal file
|
After Width: | Height: | Size: 241 KiB |
BIN
detec/foscam/11.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 245 KiB |
BIN
detec/foscam/2.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 213 KiB After Width: | Height: | Size: 240 KiB |
BIN
detec/foscam/3.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 269 KiB |
BIN
detec/foscam/4.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 224 KiB After Width: | Height: | Size: 277 KiB |
BIN
detec/foscam/5.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
detec/foscam/6.jpg
Normal file
|
After Width: | Height: | Size: 254 KiB |
BIN
detec/foscam/6.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
detec/foscam/7.jpg
Normal file
|
After Width: | Height: | Size: 268 KiB |
BIN
detec/foscam/7.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
detec/foscam/8.jpg
Normal file
|
After Width: | Height: | Size: 266 KiB |
BIN
detec/foscam/8.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
detec/foscam/9.jpg
Normal file
|
After Width: | Height: | Size: 247 KiB |
BIN
detec/foscam/9.png
Normal file
|
After Width: | Height: | Size: 1022 KiB |
BIN
detec/foscam/calibresult1.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
detec/foscam/calibresult10.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
detec/foscam/calibresult11.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
detec/foscam/calibresult2.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
detec/foscam/calibresult3.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
detec/foscam/calibresult4.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
detec/foscam/calibresult5.png
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
detec/foscam/calibresult6.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
detec/foscam/calibresult7.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
detec/foscam/calibresult8.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
detec/foscam/calibresult9.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
@@ -1,30 +0,0 @@
|
||||
import numpy as np
|
||||
import cv2
|
||||
import time
|
||||
|
||||
cap = cv2.VideoCapture('cams/10s.mp4')
|
||||
|
||||
# if (cap.isOpened()== False):
|
||||
# print("Error opening video stream or file")
|
||||
|
||||
# while(cap.isOpened()):
|
||||
# ret, frame = cap.read()
|
||||
# if ret == True:
|
||||
# cv2.imshow('Frame',frame)
|
||||
# if cv2.waitKey(25) & 0xFF == ord('q'):
|
||||
# break
|
||||
# else:
|
||||
# break
|
||||
|
||||
# cap.release()
|
||||
# cv2.destroyAllWindows()
|
||||
|
||||
while True:
|
||||
ret, image = cap.read()
|
||||
# this is the part to add to your code
|
||||
cv2.rectangle(image, (0, 0), (200, 200), (0, 0, 0), -1)
|
||||
|
||||
cv2.imshow("My Video", image)
|
||||
|
||||
if cv2.waitKey(1) & 0xFF == ord('q'):
|
||||
cv2.destroyAllWindows()
|
||||
29
detec/saveframes.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import cv2
|
||||
import time
|
||||
|
||||
cap = cv2.VideoCapture('cams/new/cut1.mp4')
|
||||
folder_path = "cams/new/frames"
|
||||
|
||||
frame_nb = 0
|
||||
|
||||
if (cap.isOpened()== False):
|
||||
print("Error opening video stream or file")
|
||||
while(cap.isOpened()):
|
||||
|
||||
ret, frame = cap.read()
|
||||
if ret == True:
|
||||
|
||||
if frame_nb == 300:
|
||||
cv2.imwrite('frame.png', frame)
|
||||
|
||||
frame_nb = frame_nb + 1
|
||||
|
||||
else:
|
||||
break
|
||||
|
||||
print(frame_nb)
|
||||
cap.release()
|
||||
cv2.destroyAllWindows()
|
||||
@@ -10,7 +10,7 @@ objp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2)
|
||||
objpoints = [] # 3d point in real world space
|
||||
imgpoints = [] # 2d points in image plane.
|
||||
# images = glob.glob('detec/foscam/*.png')
|
||||
images = glob.glob('detec/data/*.jpg')
|
||||
images = glob.glob('detec/foscam/*.jpg')
|
||||
|
||||
|
||||
for fname in images:
|
||||
@@ -27,11 +27,19 @@ for fname in images:
|
||||
cv.drawChessboardCorners(img, (7,6), corners2, ret)
|
||||
cv.imshow('img', img)
|
||||
cv.waitKey(500)
|
||||
cv.destroyAllWindows()
|
||||
# cv.destroyAllWindows()
|
||||
|
||||
ret, mtx, dist, rvecs, tvecs = cv.calibrateCamera(objpoints, imgpoints, gray.shape[::-1], None, None)
|
||||
|
||||
for i in range(1,12):
|
||||
img = cv.imread(f'detec/foscam/{i}.jpg')
|
||||
h, w = img.shape[:2]
|
||||
newcameramtx, roi = cv.getOptimalNewCameraMatrix(mtx, dist, (w,h), 1, (w,h))
|
||||
|
||||
img = cv.imread('detec/data/1.jpg')
|
||||
h, w = img.shape[:2]
|
||||
newcameramtx, roi = cv.getOptimalNewCameraMatrix(mtx, dist, (w,h), 1, (w,h))
|
||||
|
||||
# undistort
|
||||
dst = cv.undistort(img, mtx, dist, None, newcameramtx)
|
||||
# crop the image
|
||||
x, y, w, h = roi
|
||||
dst = dst[y:y+h, x:x+w]
|
||||
cv.imwrite(f'calibresult{i}.png', dst)
|
||||