Пример #1
0
void MyModuleInit(RTC::Manager* manager)
{
    FaceDetectInit(manager);
    RTC::RtcBase* comp;

    // Create a component
    comp = manager->createComponent("FaceDetect");

    if (comp==NULL)
    {
        std::cerr << "Component create failed." << std::endl;
        abort();
    }

    // Example
    // The following procedure is examples how handle RT-Components.
    // These should not be in this function.

    // Get the component's object reference
//  RTC::RTObject_var rtobj;
//  rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp));

    // Get the port list of the component
//  PortServiceList* portlist;
//  portlist = rtobj->get_ports();

    // getting port profiles
//  std::cout << "Number of Ports: ";
//  std::cout << portlist->length() << std::endl << std::endl;
//  for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
//  {
//    PortService_ptr port;
//    port = (*portlist)[i];
//    std::cout << "Port" << i << " (name): ";
//    std::cout << port->get_port_profile()->name << std::endl;
//
//    RTC::PortInterfaceProfileList iflist;
//    iflist = port->get_port_profile()->interfaces;
//    std::cout << "---interfaces---" << std::endl;
//    for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
//    {
//      std::cout << "I/F name: ";
//      std::cout << iflist[i].instance_name << std::endl;
//      std::cout << "I/F type: ";
//      std::cout << iflist[i].type_name << std::endl;
//      const char* pol;
//      pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
//      std::cout << "Polarity: " << pol << std::endl;
//    }
//    std::cout << "---properties---" << std::endl;
//    NVUtil::dump(port->get_port_profile()->properties);
//    std::cout << "----------------" << std::endl << std::endl;
//  }

    return;
}
Пример #2
0
JNIEXPORT void JNICALL NAME(Init)(JNIEnv * jenv, jclass s)
{
	if(mLastretValue == ERR_SDKNOINIT) {
		int retValue;
		try {
			// Initialize
			msg_Err("#---00000 mFullPathname=%s", mFullPathname);
			retValue = FaceDetectSetLibPath(mFullPathname);
			retValue |= FaceDetectInit();
			if (ERR_NONE != retValue)
				throw retValue;

			retValue = FaceAlignmentSetLibPath(mFullPathname);
			retValue |= FaceAlignmentInit();
			if (ERR_NONE != retValue) {
				FaceDetectUninit();
				throw retValue;
			}

			msg_Err("#---1111");
			retValue = SetDeepFeatLibPath(mFullPathname);
			msg_Err("#---22222");
			retValue |= InitDeepFeat("BeautyModel.dat", &hFace);
			retValue |= InitDeepFeat("XCModel.dat", &hXiaci);
			retValue |= InitDeepFeat("PFModel.dat", &hSkin);
			retValue |= InitDeepFeat("NNModel.dat", &hAge);
			retValue |= InitDeepFeat("BQModel.dat", &hHappy);
			if (ERR_NONE != retValue) {
				FaceDetectUninit();
				FaceAlignmentUninit();
				throw retValue;
			}
		}
		catch (const std::bad_alloc &) {
			retValue = ERR_MEMORYALLOC;
		}
		catch (const int &errCode) {
			retValue = errCode;
		}
		catch (...) {
			retValue = ERR_UNKNOWN;
		}
		mLastretValue = retValue;
	}
}