Ejemplo n.º 1
0
void FEmotionDetector::InitEmotionCapture()
{
	pPXCSession = PXCSession::CreateInstance();
	pSenseManager = pPXCSession->CreateSenseManager();

	CaptureMgr = pSenseManager->QueryCaptureManager();
	pxcCHAR* Device = NULL;

	PXCSession::ImplDesc desc;
	memset(&desc, 0, sizeof(desc));
	desc.group = PXCSession::IMPL_GROUP_SENSOR;
	desc.subgroup = PXCSession::IMPL_SUBGROUP_VIDEO_CAPTURE;

	for (int i = 0;; i++)
	{
		PXCSession::ImplDesc desc1;
		if (pPXCSession->QueryImpl(&desc, i, &desc1) == PXC_STATUS_NO_ERROR)
		{
			PXCCapture *capture;
			if (pPXCSession->CreateImpl<PXCCapture>(&desc1, &capture) == PXC_STATUS_NO_ERROR)
			{
				for (int j = 0;; j++)
				{
					PXCCapture::DeviceInfo dinfo;
					if (capture->QueryDeviceInfo(j, &dinfo) == PXC_STATUS_NO_ERROR)
					{
						Device = dinfo.name;
						break;
					}
				}
			}
			else
			{
				break;
			}
		}
		else
		{
			break;
		}
	}

	if (Device != nullptr)
	{
		CaptureMgr->FilterByDeviceInfo(Device, 0, 0);

		pSenseManager->EnableEmotion();
		pSenseManager->Init(&Handler);
	}
}
Ejemplo n.º 2
0
std::vector<unsigned int> RealSenseSensor::connectedSensors() {
	std::vector<unsigned int> sensors;

	PXCSession* session = PXCSession::CreateInstance();

	PXCSession::ImplDesc desc1 = { };
	desc1.group = PXCSession::IMPL_GROUP_SENSOR;
	desc1.subgroup = PXCSession::IMPL_SUBGROUP_VIDEO_CAPTURE;

	for (int m = 0; ; m++) {
		PXCSession::ImplDesc desc2;
		if (session->QueryImpl(&desc1, m, &desc2) < PXC_STATUS_NO_ERROR) {
			break;
		}
		std::cout << "Module (" << m << "): " << desc2.friendlyName << std::endl;

		PXCCapture* capture = 0;
		if (session->CreateImpl<PXCCapture>(&desc2, &capture) < PXC_STATUS_NO_ERROR) {
			continue;
		}

		for (int d = 0; ; d++) {
			PXCCapture::DeviceInfo dinfo;
			if (capture->QueryDeviceInfo(d, &dinfo) < PXC_STATUS_NO_ERROR) {
				break;
			}
			std::cout << "Device (" << d << "): " << dinfo.name << std::endl;
			if (dinfo.model != PXCCapture::DEVICE_MODEL_F200 && dinfo.model != PXCCapture::DEVICE_MODEL_R200) {
				continue;
			}
			std::string serialStr = toNarrow(dinfo.serial);
			std::cout << "Found device type: " << std::hex << static_cast<int>(dinfo.model) << " with serial: " << serialStr << std::endl;
			unsigned int serial = 0;
			if (tryToNumber(serialStr, serial)) {
				sensors.push_back(serial);
			} else {
				std::cout << "Serial number " << serialStr << " could not be parsed." << std::endl;
			}
		}

		capture->Release();
	}

	session->Release();

	return sensors;
}
pxcCHAR* GesturePipeline::retrieveDeviceName()
{
    PXCSession::ImplDesc desc;
    memset(&desc, 0, sizeof(desc));
    desc.group = PXCSession::IMPL_GROUP_SENSOR;
    desc.subgroup = PXCSession::IMPL_SUBGROUP_VIDEO_CAPTURE;
    for (int i = 0;; i++) {
        PXCSession::ImplDesc desc1;
        if (_pxcSenseManager->QuerySession()->QueryImpl(&desc, i, &desc1) < PXC_STATUS_NO_ERROR) break;
        PXCCapture * capture = nullptr;
        if (_pxcSenseManager->QuerySession()->CreateImpl<PXCCapture>(&desc1, &capture) < PXC_STATUS_NO_ERROR) continue;
        for (int j = 0;; j++) {//may be should use QueryDeviceNum() if there are more than one device connected
            PXCCapture::DeviceInfo dinfo;
            if (capture->QueryDeviceInfo(j, &dinfo) < PXC_STATUS_NO_ERROR) break;
            wcscpy_s(_deviceName[i], dinfo.name);
        }
        capture->Release();
    }
    return _deviceName[0];
}