void HaarDetectorBody::PartitionateFace(const cv::Rect& fullRect, cv::Rect* partitionRect)
{
    if(GetInstanceName() == "leftEye")
    {
        partitionRect->x = cvRound(fullRect.x + fullRect.width * 0.5);
        partitionRect->y = cvRound(fullRect.y + fullRect.height * 0.1);
        partitionRect->width = cvRound(fullRect.width * 0.5);
        partitionRect->height = cvRound(fullRect.height * 0.5);
    }
    else if(GetInstanceName() == "rightEye")
    {
        partitionRect->x = fullRect.x;
        partitionRect->y = cvRound(fullRect.y + fullRect.height * 0.1);
        partitionRect->width = cvRound(fullRect.width * 0.5);
        partitionRect->height = cvRound(fullRect.height * 0.5);
    }
    else if(GetInstanceName() == "nose")
    {
        partitionRect->x = cvRound(fullRect.x + fullRect.width * 0.15);
        partitionRect->y = cvRound(fullRect.y + fullRect.height * 0.35);
        partitionRect->width = cvRound(fullRect.width * 0.60);
        partitionRect->height = cvRound(fullRect.height * 0.45);
    }
    else if(GetInstanceName() == "mouth")
    {
        partitionRect->x = cvRound(fullRect.x + fullRect.width * 0.10);
        partitionRect->y = cvRound(fullRect.y + fullRect.height * 0.65);
        partitionRect->width = cvRound(fullRect.width * 0.8);
        partitionRect->height = cvRound(fullRect.height * 0.3);
    }
    else
    {
        *partitionRect = fullRect;
    }
}
Example #2
0
EXPORT_C void CHuiLayout::DumpTree() const
    {
    // Dump children.
    TBuf<100> myName;
    TBuf<100> childName;

    CHuiVisual::DumpTree();

    GetInstanceName(myName);

    TInt count = Count();
    for(TInt i = 0; i < count; ++i)
        {
        iHuiLayoutPrivateData->iChildren[i]->GetInstanceName(childName);
        CHuiStatic::Printf(_L("%S -> %S;"), &myName, &childName);

        iHuiLayoutPrivateData->iChildren[i]->DumpTree();
        }
    }
Example #3
0
VertexInputNode::VertexInputNode(void) : DataNode(std::vector<DataLine>(), GetInstanceName()) { }
Example #4
0
FragmentInputNode::FragmentInputNode(void) : DataNode(std::vector<DataLine>(), GetInstanceName()) { }
Example #5
0
//===========================================
void AnlgDirectFormFir::Initialize(void)
{
  *DebugFile << "Now in AnlgDirectFormFir::Initialize()" << endl;

  Proc_Block_Size = In_Sig->GetBlockSize();
  Samp_Intvl = In_Sig->GetSampIntvl();
  char subord_name[40];
  char response_fnam[120];
  strcpy(subord_name,GetModelName());
  strcat(subord_name,":fir_design\0");
   double *coeff;
  int i;

  //Kind_Of_Filter_Resp = 0;
  switch (Kind_Of_Filter_Resp)
    {
    case 0: // raised cosine
      Filter_Design = new FirFilterDesign(  subord_name, 
                                            Kind_Of_Filter_Resp,
                                            Samp_Intvl);
      //DebugFile << "Samp_Intvl = " << Samp_Intvl << endl;
      //Filter_Design->DumpCoefficients(&DebugFile);
      //exit(0);
      break;
    case 1: // root raised cosine
      Filter_Design = new FirFilterDesign(  subord_name, 
                                            Kind_Of_Filter_Resp,
                                            Samp_Intvl);
      //DebugFile << "Samp_Intvl = " << Samp_Intvl << endl;
      //Filter_Design->DumpCoefficients(&DebugFile);
      //exit(0);
      break;
    case 2: // pure delay
      Filter_Design = new FirFilterDesign(  subord_name, 
                                            Kind_Of_Filter_Resp,
                                            Samp_Intvl);
      //Filter_Design->DumpCoefficients(&DebugFile);
      //exit(0);
      break;
   case 3: // custom
/*      coeff[0] = coeff[24] = -0.00406909;
      coeff[1] = coeff[23] = -0.0103673;
      coeff[2] = coeff[22] = -0.00180157;
      coeff[3] = coeff[21] = 0.0152348;
      coeff[4] = coeff[20] = 0.00321361;
      coeff[5] = coeff[19] = -0.0275724;
      coeff[6] = coeff[18] = -0.00511918;
      coeff[7] = coeff[17] = 0.0494654;
      coeff[8] = coeff[16] = 0.00700851;
      coeff[9] = coeff[15] = -0.0969915;
      coeff[10] = coeff[14] = -0.00831958;
      coeff[11] = coeff[13] = 0.315158;
      coeff[12] = 0.50881;
      */
/*      coeff[0] = coeff[18] = -0.033637;
      coeff[1] = coeff[17] = -0.023387;
      coeff[2] = coeff[16] = 0.026728;
      coeff[3] = coeff[15] = 0.050455;
      coeff[4] = coeff[14] = 0.0;
      coeff[5] = coeff[13] = 0.075683;
      coeff[6] = coeff[12] = -0.062366;
      coeff[7] = coeff[11] = 0.093549;
      coeff[8] = coeff[10] = 0.302731;
      coeff[9] = 0.40;
      */

      Coeff_File = new ifstream(Coeff_Fname, ios::in);
      *Coeff_File >> Num_Taps;

      coeff = new double[Num_Taps];

      for( i=0; i<Num_Taps; i++) {
         *Coeff_File >> coeff[i];
      }


      Filter_Design = new FirFilterDesign(  Num_Taps, 
                                            coeff);      
      break;
    default:
      // error 
      cout << "illegal value for 'Kind_Of_Filter_Resp' " << endl;
      exit(1);
    } // end of switch on Kind_Of_Filter_Resp
  Num_Taps = Filter_Design->GetNumTaps();
  Coeff = new float[Num_Taps];
  Filter_Design->CopyCoefficients(Coeff);
  Input_Mem = new float[Num_Taps];
  for(int n=0; n< Num_Taps; n++) Input_Mem[n] = 0.0;
  //
  //---------------------------------------------
  // compute magnitude response of filter and write to a file
  response_fnam[0] = 0;
  strcpy(response_fnam,"resp_\0");
  strcat(response_fnam,GetInstanceName());
  strcat(response_fnam,".txt\0");
  FirFilterResponse* response = 
            new FirFilterResponse(  Filter_Design,
                                    500,
                                    1, //dB scale enabled
                                    1, //normalization enabled
                                    response_fnam);
   response->ComputeMagResp();
   response->DumpMagResp();
}
XnStatus XnSensorProductionNode::NotifyExState(XnNodeNotifications* pNotifications, void* pCookie)
{
	XnStatus nRetVal = XN_STATUS_OK;
	
	// get all properties
	XN_PROPERTY_SET_CREATE_ON_STACK(props);
	nRetVal = m_pSensor->GetAllProperties(&props, FALSE, GetModuleName());
	XN_IS_STATUS_OK(nRetVal);

	XnActualPropertiesHash* pPropsHash = props.pData->begin().Value();

	// filter properties (remove the ones already exposed as OpenNI interfaces)
	FilterProperties(pPropsHash);

	const XnChar* astrIntProps[200] = {0};
	const XnChar* astrRealProps[200] = {0};
	const XnChar* astrStringProps[200] = {0};
	const XnChar* astrGeneralProps[200] = {0};

	XnUInt32 nIntProps = 0;
	XnUInt32 nRealProps = 0;
	XnUInt32 nStringProps = 0;
	XnUInt32 nGeneralProps = 0;

	// enumerate over properties
	for (XnActualPropertiesHash::Iterator it = pPropsHash->begin(); it != pPropsHash->end(); ++it)
	{
		XnProperty* pProp = it.Value();

		switch (pProp->GetType())
		{
		case XN_PROPERTY_TYPE_INTEGER:
			{
				XnActualIntProperty* pIntProp = (XnActualIntProperty*)pProp;
				pNotifications->OnNodeIntPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pIntProp->GetValue());
				astrIntProps[nIntProps++] = pProp->GetName();
			}
			break;
		case XN_PROPERTY_TYPE_REAL:
			{
				XnActualRealProperty* pRealProp = (XnActualRealProperty*)pProp;
				pNotifications->OnNodeRealPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pRealProp->GetValue());
				astrRealProps[nRealProps++] = pProp->GetName();
			}
			break;
		case XN_PROPERTY_TYPE_STRING:
			{
				XnActualStringProperty* pStrProp = (XnActualStringProperty*)pProp;
				pNotifications->OnNodeStringPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pStrProp->GetValue());
				astrStringProps[nStringProps++] = pProp->GetName();
			}
			break;
		case XN_PROPERTY_TYPE_GENERAL:
			{
				XnActualGeneralProperty* pGenProp = (XnActualGeneralProperty*)pProp;
				pNotifications->OnNodeGeneralPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pGenProp->GetValue().nDataSize, pGenProp->GetValue().pData);
				astrGeneralProps[nGeneralProps++] = pProp->GetName();
			}
			break;
		default:
			XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DEVICE_SENSOR, "Unknown property type: %d", pProp->GetType());
		}
	}

	// TODO: also register to these properties, and if changed, notify.

	// store notifications object
	m_pNotifications = pNotifications;
	m_pCookie = pCookie;

	return (XN_STATUS_OK);
}
Example #7
0
TimeNode::TimeNode(void) : DataNode(std::vector<DataLine>(), GetInstanceName()){ }