/
sat1988
/
MachineVision
Обзор
Документация
Войти
/
sat1988
/
MachineVision
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
task07/open.py
22 строки
746 B
Oleg Chorakaev
Добавлен 7 пример
26 июл 2025, 16:13
26 июл 2025, 16:13
0a00484
Код
Авторство
О чём код?
import pandas as pd import cv2 import os csv_file = "annotations.csv" data = pd.read_csv(csv_file, sep=',') print(data.head()) data = data.sample(frac=1) print(data.head()) #data = data[:3] i = 0 for row in data.itertuples(): _, image_filename, xc_r, yc_r, w_r, h_r = row print(image_filename) image = cv2.imread(image_filename) img_h, img_w = image.shape[:2] answer = (img_w * xc_r, img_h * yc_r, img_w * w_r, img_h * h_r) print(answer) cv2.rectangle(image, (int(answer[0]-answer[2]/2),int(answer[1]-answer[3]/2)), (int(answer[0]+answer[2]/2),int(answer[1]+answer[3]/2)), (0,128,128), 2) #cv2.imshow('1',image) cv2.imwrite("test/"+image_filename,image) cv2.imwrite(image_filename, image) cv2.waitKey()