microsoft / VoTT

Visual Object Tagging Tool: An electron app for building end to end Object Detection Models from Images and Videos.
MIT License
4.29k stars 838 forks source link

Picture Rotation meta #840

Open thepian opened 5 years ago

thepian commented 5 years ago

Describe the bug The tool only considers the raw jpeg and ignore rotation attribute. Will the label rects follow the raw coordinates or rotated in the frameworks consuming the output. Even if it will work it is uncertain when tagging the picture, and they are shown the wrong way around.

To Reproduce Steps to reproduce the behavior:

  1. Add image with rotation set by the producing camera such as iPad
  2. Tag it with rect

Expected behavior Options to control how to handle rotation.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

srinath1999 commented 4 years ago

The output following raw coordinates as of now.

For those who I can help: If you happen to know which are the rotated images, then annotate them as it is. Then it can be translated to the actual bounding box coordinates by doing this

import numpy as np
import cv2
import pandas as pd

df = pd.read_csv('Annotations-export.csv')
df_copy = df.copy()

length = df.index.size
width = np.zeros((length))
for i, name in enumerate(df['image']):
    width[i] = cv2.imread(name).shape[1]
df['xmin'] = width - df_copy['ymax']
df['ymin'] = df_copy['xmin']
df['xmax'] = width - df_copy['ymin']
df['ymax'] = df_copy['xmax']
df.to_csv('Corrected_annotations.csv', index = False)