#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import os
import pandas as pd


"""
This module has all the classes and methods for setting up 
the training data (coordinates and images)
"""


class DataTrain(object):
	"""
	Class for contain dataframe with coordinates and 
	image information
	"""
	def __init__(self, filename_xy, path_images, nrows=None, ids=True):
		self.filename = filename_xy
		self.path_images = path_images
		self.data = self.load_data(ids, nrows)

	def load_data(self, ids=False, nrows=None):
		df = pd.read_csv(self.filename, index_col='tag', nrows=nrows)
		#df.sort(axis=1, inplace=True)

		return df

	def get_ids(self):
		return list(self.data.index.values)

	def get_landmarks(self, id_people):
		return self.data.loc[[id_people]].values
#TODO convert this to test

def main(filename_xy, path_images):
	my_data = DataTrain(filename_xy, path_images, ids=True)
	
if __name__ == '__main__':
	package_directory = os.path.dirname(os.path.abspath(__file__))
	main(os.path.join(package_directory, "data/use.txt"), os.path.join(package_directory,"images/"))
@@ -646,124 +646,456 @@
 :%0A%09%09
-return list(self.data.index.values)%0A%0A%09def get_landmarks(self, id_people):%0A%09%09return self.data.loc%5B%5Bid_people%5D%5D.values
+%22%22%22%0A%09%09Return ids of the samples to search images or get landmarks%0A%09%09%22%22%22%0A%09%09return list(self.data.index.values)%0A%0A%09def get_landmarks(self, id_people, fullsize):%0A%09%09%22%22%22%0A%09%09Return the landmarks of some particular id, and change de origin%0A%09%09location tps diffs opencv%0A%09%09%22%22%22%0A%09%09landmarks = self.data.loc%5B%5Bid_people%5D%5D.values%5B0%5D%0A%09%09for coord in range(1, len(landmarks), 2): #only y-values%0A%09%09%09landmarks%5Bcoord%5D = fullsize%5B0%5D - landmarks%5Bcoord%5D%0A%0A%09%09return landmarks%0A
 %0A#TO

swap coordinates diff origin tps and opencv