<commit_before>
/**
 * \file SWTrack.cpp
 * \brief defines SWTrack 
 * \author <NAME>
 * \date 05/12/12
 */

#include "track/SWTrack.h"

#include "opencvUtility.h"

using namespace cv;
using namespace std;
using namespace swTrack;
using namespace swExcept;

SWTrack::SWTrack()
{
    m_CFaceDetectionPtr = SWFaceDetectionPtr(new swDetect::SWFaceDetection(cv::Size(80,80)));
	
	m_CTrackFlowPtr = SWTrackFlowPtr(new SWTrackFlow());
	
	m_ui32NumFrame = 0;
	m_ui32NumberOfFramesBeforeFaceDetection	= 15;
}


bool SWTrack::trackFace(const Mat &oPreRgbFrame, const Mat &oCurrRgbFrame, Rect &oFaceRect)
{	
	m_bTracked = false;
	
	if(oPreRgbFrame.rows * oPreRgbFrame.cols != oPreRgbFrame.rows * oPreRgbFrame.cols)
	{
		cerr << "Previous frame and current frame mush have the same size, the tracking can't be done. " << endl;
		return false;
	}
	
	try
	{	
		// retrieve the mat contening the face detected with haar cascade
		// if(m_ui32NumFrame % m_ui32NumberOfFramesBeforeFaceDetection == 0 && m_ui32NumFrame != 0)
		// {
			if(m_CFaceDetectionPtr->detect(oCurrRgbFrame)) // if face detection is successfull
			{
				m_oFaceRect = m_CFaceDetectionPtr->faceRect();

				oFaceRect = m_oFaceRect;
				
				m_ui32NumFrame++;
				
				return true;
			}
			else
			{
				
				oFaceRect = m_oFaceRect;
				
				m_ui32NumFrame++;
				
				return false;<commit_msg>[face detection]<commit_after>
/**
 * \file SWTrack.cpp
 * \brief defines SWTrack 
 * \author <NAME>
 * \date 05/12/12
 */

#include "track/SWTrack.h"

#include "opencvUtility.h"

using namespace cv;
using namespace std;
using namespace swTrack;
using namespace swExcept;

SWTrack::SWTrack()
{
    m_CFaceDetectionPtr = SWFaceDetectionPtr(new swDetect::SWFaceDetection(cv::Size(80,80)));
	
	m_CTrackFlowPtr = SWTrackFlowPtr(new SWTrackFlow());
	
	m_ui32NumFrame = 0;
	m_ui32NumberOfFramesBeforeFaceDetection	= 15;
}


bool SWTrack::trackFace(const Mat &oPreRgbFrame, const Mat &oCurrRgbFrame, Rect &oFaceRect)
{	
	m_bTracked = false;
	
	if(oPreRgbFrame.rows * oPreRgbFrame.cols != oPreRgbFrame.rows * oPreRgbFrame.cols)
	{
		cerr << "Previous frame and current frame mush have the same size, the tracking can't be done. " << endl;
		return false;
	}
	
	try
	{	
		// retrieve the mat contening the face detected with haar cascade
		// if(m_ui32NumFrame % m_ui32NumberOfFramesBeforeFaceDetection == 0 && m_ui32NumFrame != 0)
		// {
            if(m_CFaceDetectionPtr->detectFace(oCurrRgbFrame)) // if face detection is successfull
			{
				m_oFaceRect = m_CFaceDetectionPtr->faceRect();

				oFaceRect = m_oFaceRect;
				
				m_ui32NumFrame++;
				
				return true;
			}
			else
			{
				
				oFaceRect = m_oFaceRect;
				
				m_ui32NumFrame++;
				
				return false;
{'fraction_non_alphanumeric': 0.10685335298452468, 'fraction_numerical': 0.021370670596904937, 'mean_word_length': 3.6891191709844557, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3507166', 'n_tokens_mistral': 1148, 'n_tokens_neox': 965, 'n_words': 212}