void CameraPoseOptimization::setTransformMatForFrame(int index, mat4f& mat)
{
	if (index <= m_frameNumber)
	{
		//m_frameInfos[index - 1].frameNo = index - 1;
		for (int i = 0; i != 4; ++i)
		{
			for (int j = 0; j != 4; ++j)
			{
				m_frameInfos[index - 1].matPose(i, j) = mat(i, j);
			}
		}
	}
	else if (index == m_frameNumber + 1)
	{
		FrameInfo frameInfo;
		frameInfo.frameNo = index - 1;
		for (int i = 0; i != 4; ++i)
		{
			for (int j = 0; j != 4; ++j)
			{
				frameInfo.matPose(i, j) = mat(i, j);
			}
		}
		m_frameInfos.push_back(frameInfo);
	}
	else
	{
		cout << "Warning In setTransformMatForFrame() of CameraPoseOptimization: Input index is too large." << endl;
	}
	

}
void CameraPoseOptimization::addTransformMatForNewFrame(int index, mat4f& mat)
{
	if (index >= m_frameNumber)
	{
		FrameInfo frameInfo;
		frameInfo.frameNo = m_frameNumber;
		for (int i = 0; i != 4; ++i)
		{
			for (int j = 0; j != 4; ++j)
			{
				frameInfo.matPose(i, j) = mat(i, j);
			}
		}
		frameInfo.matOptimizedPose = frameInfo.matPose;
		m_frameInfos.push_back(frameInfo);
		m_frameNumber = (int)m_frameInfos.size();
	}
	else
	{
		cout << "Frame " << index << "does already exist and cannot be added again." << endl;
	}
}