11.07.2019       Выпуск 290 (08.07.2019 - 14.07.2019)       Статьи

Собираем timelapse с помощью OpenCV opencv

Читать>>




Экспериментальная функция:

Ниже вы видите текст статьи по ссылке. По нему можно быстро понять ссылка достойна прочтения или нет

Просим обратить внимание, что текст по ссылке и здесь может не совпадать.

Time Collapse of San Francisco

A few years ago, I had a camera looking out over San Francisco. It was hooked up to a Raspberry Pi that snapped a photo every minute and posted it. When there was a good sunset, I went back and made a time lapse video from the photos:

After a while of collecting photos, I started thinking about what else I could do. Inspired by photo projects that show the same scene throughout different seasons of the year, I decided to create a single photo from 24 hours of photos using OpenCV and Python:

import numpy as np
import cv2

filenames = ["file1.jpg", ... ]
columns = []

for i, filename in enumerate(filenames):
img: np.array = cv2.imread(f"p/{filename}")
height: int = len(img)
width: int = len(img[0])
column_start = 2 * i
column_end = 2 * i + 2
print(f"filename: {filename}, height: {height}, width: {width}, {column_start}-{column_end}")
column = img[0:height, column_start:column_end]
columns.append(column)

matrix = [[] for _ in range(height)]

for row_idx in range(height):
row = []
for col_idx in range(len(columns)):
pixels = columns[col_idx][row_idx]
matrix[row_idx] += list(pixels)

new_img = np.array([np.array(list(row)) for row in matrix])
cv2.imwrite('output.jpg', new_img)
























I wouldn’t call the resulting image pretty, but I do think it’s interesting.

*It’s not clear if time collapsing is the proper term for this technique, but it makes sense to me






Разместим вашу рекламу

Пиши: mail@pythondigest.ru

Нашли опечатку?

Выделите фрагмент и отправьте нажатием Ctrl+Enter.

Система Orphus