# Path: src/DroneVision/DroneVision_src/imgProcessing/frameTools/frameTools.py
# def GetShape(frame):
# 	'''
# 	 @brief Get shape of frame, regardless of depth dimension.
# 
# 	 @param frame 
# 	 
# 	 return (height, width)
# 	'''
# 	return frame.shape[:2]


import numpy as np
from src.DroneVision.DroneVision_src.imgProcessing.frameTools.frameTools import GetShape
from MsgParserRecv.keypointsConverter import keypoints_to_list, list_to_keypoints
	def GetContentRequestPointList(self, content, error=False):
		'''
		 @brief Get unpacked/packet content for point list request.

		 @param content
		 @param error (True/False)

		 if master:
		 	@return keypoints, descriptors, valid (Return: keypoints = point keys data, descriptors = point description data, valid = True/False)
		 else: (slave)
		 	@return content
		'''
		keypoints 	= None
		descriptors = None
		und_shape 	= None
		if self.__master_or_slave: # True = master 
			valid = content['valid']
			error = content['error']
			if valid:
				und_shape 	= content['und_shape']
				keypoints 	= content['keypoints']
				descriptors = content['descriptors']
				keypoints 	= list_to_keypoints(keypoints)
				descriptors = np.array(descriptors)
			return und_shape, keypoints, descriptors, valid, error
		else:
			valid = False
			if not(isinstance(content, type(None))):
				valid = True
				original_frame, original_sl_frame, frame_un, delta_frame, keypoints, descriptors = content

# Path: src/DroneVision/DroneVision_src/imgProcessing/frameTools/frameTools.py
# def GetShape(frame):
# 	'''
# 	 @brief Get shape of frame, regardless of depth dimension.
# 
# 	 @param frame 
# 	 
# 	 return (height, width)
# 	'''
# 	return frame.shape[:2]


# Path: src/MasterSlave/Requests.py
import numpy as np
from src.DroneVision.DroneVision_src.imgProcessing.frameTools.frameTools import GetShape
from MsgParserRecv.keypointsConverter import keypoints_to_list, list_to_keypoints

	def GetContentRequestPointList(self, content, error=False):
		'''
		 @brief Get unpacked/packet content for point list request.

		 @param content
		 @param error (True/False)

		 if master:
		 	@return keypoints, descriptors, valid (Return: keypoints = point keys data, descriptors = point description data, valid = True/False)
		 else: (slave)
		 	@return content
		'''
		keypoints 	= None
		descriptors = None
		und_shape 	= None
		if self.__master_or_slave: # True = master 
			valid = content['valid']
			error = content['error']
			if valid:
				und_shape 	= content['und_shape']
				keypoints 	= content['keypoints']
				descriptors = content['descriptors']
				keypoints 	= list_to_keypoints(keypoints)
				descriptors = np.array(descriptors)
			return und_shape, keypoints, descriptors, valid, error
		else:
			valid = False
			if not(isinstance(content, type(None))):
				valid = True
				original_frame, original_sl_frame, frame_un, delta_frame, keypoints, descriptors = content

				und_shape 	= GetShape(frame_un)