Skip to content

Instantly share code, notes, and snippets.

@pranjalAI
Created September 11, 2020 04:16
Show Gist options
  • Save pranjalAI/174fa9db0e65caf87b35be5b7d7bb57b to your computer and use it in GitHub Desktop.
Save pranjalAI/174fa9db0e65caf87b35be5b7d7bb57b to your computer and use it in GitHub Desktop.
# Importing Libraries
import os
import numpy as np
import cv2
import argparse
import time
from tqdm import tqdm
#convert from Yolo_mark to opencv format
def yoloFormattocv(x1, y1, x2, y2, H, W):
bbox_width = x2 * W
bbox_height = y2 * H
center_x = x1 * W
center_y = y1 * H
voc = []
voc.append(center_x - (bbox_width / 2))
voc.append(center_y - (bbox_height / 2))
voc.append(center_x + (bbox_width / 2))
voc.append(center_y + (bbox_height / 2))
return [int(v) for v in voc]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment