PERF_TEST_P(DevInfo, StereoBeliefPropagation, testing::ValuesIn(devices()))
{
    DeviceInfo devInfo = GetParam();

    setDevice(devInfo.deviceID());

    Mat img_l_host = readImage("gpu/stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
    Mat img_r_host = readImage("gpu/stereobm/aloe-R.png", CV_LOAD_IMAGE_GRAYSCALE);

    ASSERT_FALSE(img_l_host.empty());
    ASSERT_FALSE(img_r_host.empty());

    GpuMat img_l(img_l_host);
    GpuMat img_r(img_r_host);

    GpuMat dst;

    StereoBeliefPropagation bp(128);

    declare.time(10.0);

    SIMPLE_TEST_CYCLE()
    {
        bp(img_l, img_r, dst);
    }

    Mat dst_host(dst);
    
    SANITY_CHECK(dst_host);
}
PERF_TEST_P(DevInfo, StereoConstantSpaceBP, testing::ValuesIn(devices()))
{
    DeviceInfo devInfo = GetParam();

    setDevice(devInfo.deviceID());

    Mat img_l_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    Mat img_r_host = readImage("gpu/perf/aloeR.jpg", CV_LOAD_IMAGE_GRAYSCALE);

    ASSERT_FALSE(img_l_host.empty());
    ASSERT_FALSE(img_r_host.empty());

    GpuMat img_l(img_l_host);
    GpuMat img_r(img_r_host);

    GpuMat dst;

    StereoConstantSpaceBP bp(128);

    declare.time(10.0);

    SIMPLE_TEST_CYCLE()
    {
        bp(img_l, img_r, dst);
    }

    Mat dst_host(dst);
    
    SANITY_CHECK(dst_host);
}
Exemple #3
0
QTcpSocket* ServerCore::createSocket(QString deviceUID)
{
	DeviceInfo info = DeviceManagerModule()->GetDeviceInfo(deviceUID);
	QTcpSocket *socket = new QTcpSocket(this);
	socket->connectToHost(info.getIP(), PORT_SERVER_BROADCAST, QIODevice::ReadWrite);
	return socket;
}
PERF_TEST_P(DevInfo, StereoBM, testing::ValuesIn(devices()))
{
    DeviceInfo devInfo = GetParam();

    setDevice(devInfo.deviceID());

    Mat img_l_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    Mat img_r_host = readImage("gpu/perf/aloeR.jpg", CV_LOAD_IMAGE_GRAYSCALE);

    ASSERT_FALSE(img_l_host.empty());
    ASSERT_FALSE(img_r_host.empty());

    GpuMat img_l(img_l_host);
    GpuMat img_r(img_r_host);

    GpuMat dst;

    StereoBM_GPU bm(0, 256);

    declare.time(0.5).iterations(100);

    SIMPLE_TEST_CYCLE()
    {
        bm(img_l, img_r, dst);
    }

    Mat dst_host(dst);
    
    SANITY_CHECK(dst_host);
}
PERF_TEST_P(DevInfo, DisparityBilateralFilter, testing::ValuesIn(devices()))
{
    DeviceInfo devInfo = GetParam();

    setDevice(devInfo.deviceID());

    Mat img_host = readImage("gpu/stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
    Mat disp_host = readImage("gpu/stereobm/aloe-disp.png", CV_LOAD_IMAGE_GRAYSCALE);

    ASSERT_FALSE(img_host.empty());
    ASSERT_FALSE(disp_host.empty());

    GpuMat img(img_host);
    GpuMat disp(disp_host);

    GpuMat dst;

    DisparityBilateralFilter f(128);

    declare.time(0.5).iterations(100);

    SIMPLE_TEST_CYCLE()
    {
        f(disp, img, dst);
    }

    Mat dst_host(dst);
    
    SANITY_CHECK(dst_host);
}
void SettingsTechnicalInfo::fillInfo(){

    qDebug() << Q_FUNC_INFO;
    DeviceInfo *deviceInfo = DeviceInfo::getInstance();
    Storage *storageInfo = Storage::getInstance();
    Wifi *wifiInfo = Wifi::getInstance();

    MACaddressValLbl->setText(wifiInfo->getMacAddress());
    internalMemValLbl->setText(human_readable_filesize(storageInfo->getTotalInternalMemory(), 2));
    if (storageInfo->getRemovablePartition() && storageInfo->getRemovablePartition()->isMounted())
        externalMemValLbl->setText(human_readable_filesize(storageInfo->getTotalExternalMemory(), 2));
    else
        externalMemValLbl->setText("--");

    batteryValLbl->setText(QString::number(battery->getLevel()) + "%");

    QHash<QString, QString> extraInformation = deviceInfo->getSpecificDeviceInfo();

    qDebug() << extraInformation;

    QHash<QString, QString> specificInfo = deviceInfo->getSpecificDeviceInfo();

    internalVersionValLbl->setText(specificInfo.value("Internal Revision"));
    rootFsValLbl->setText(specificInfo.value("Static rootfs version")
                            + "/" + specificInfo.value("Actual rootfs version")
                            + "/" + specificInfo.value("Private repo version"));
    kernelVersionVaLbl->setText(specificInfo.value("Kernel version"));
    softwareValLbl->setText(specificInfo.value("Software version"));
    QString serialNum = deviceInfo->getSerialNumber();
    if(serialNum.startsWith("SN-")) // Remove prefix if present
        serialNum.remove(0,3);
    idDeviceValLbl->setText(serialNum);
}
Exemple #7
0
void RPCClient::request(JsonBox::Value& json, char* method, JsonBox::Object params)
{
	string result = "";
	stringstream sstream("");
	
	DeviceInfo *dev = ((AppDelegate*)cocos2d::CCApplication::sharedApplication())->getDeviceInfo();
	JsonBox::Object device;
	dev->getJSONString(device);
	
	params["authkey"] = JsonBox::Value(dev->getAuthKey());
	params["device"] = JsonBox::Value(device);
	
	JsonBox::Object data;
	data["jsonrpc"] = JsonBox::Value("2.0");
	data["id"] = JsonBox::Value("1");
	data["method"] = JsonBox::Value(method);
	data["params"] = JsonBox::Value(params);

	sstream << data;

	if(_send(sstream.str()))
		_recv(result);
	
	sstream.flush();

	json.loadFromString(result);
}
Exemple #8
0
bool DeviceIndex::fill_device_info (DeviceInfo& info) const
{
    if (!info.get_serial().empty())
    {
        for (const auto& d : device_list)
        {
            if (info.get_serial() == d.get_serial())
            {
                info = d;
                return true;
            }
        }
        return false;
    }

    if (!info.get_identifier().empty())
    {
        for (const auto& d : device_list)
        {
            if (info.get_identifier() == d.get_identifier())
            {
                info = d;
                return true;
            }
        }
    }
    return false;
}
PERF_TEST_P(DevInfo_Size_MatType, transpose, testing::Combine(testing::ValuesIn(devices()), 
                                                              testing::Values(GPU_TYPICAL_MAT_SIZES), 
                                                              testing::Values(CV_8UC1, CV_32SC1, CV_64FC1)))
{
    DeviceInfo devInfo = std::tr1::get<0>(GetParam());
    Size size = std::tr1::get<1>(GetParam());
    int type = std::tr1::get<2>(GetParam());

    setDevice(devInfo.deviceID());

    Mat src_host(size, type);

    declare.in(src_host, WARMUP_RNG);

    GpuMat src(src_host);
    GpuMat dst(size.width, size.height, type);

    declare.time(0.5).iterations(100);

    SIMPLE_TEST_CYCLE()
    {
        transpose(src, dst);
    }

    Mat dst_host(dst);

    SANITY_CHECK(dst_host);
}
Exemple #10
0
void WmdmLister::WMDMDeviceAdded(const QString& canonical_name) {
  ScopedWCharArray name(canonical_name);

  IWMDMDevice* device = NULL;
  if (thread_->manager()->GetDeviceFromCanonicalName(name, &device)) {
    qLog(Warning) << "Error in GetDeviceFromCanonicalName for" << canonical_name;
    return;
  }

  IWMDMDevice2* device2 = NULL;
  if (device->QueryInterface(IID_IWMDMDevice2, (void**) &device2)) {
    qLog(Warning) << "Error getting IWMDMDevice2 from device";
    device->Release();
    return;
  }
  device->Release();

  DeviceInfo info = ReadDeviceInfo(device2);
  if (info.is_suitable_) {
    QString id = info.unique_id();
    {
      QMutexLocker l(&mutex_);
      devices_[id] = info;
    }
    emit DeviceAdded(id);
  } else {
    device2->Release();
  }
}
Exemple #11
0
QImage TwoDModelEngineApi::areaUnderSensor(const PortInfo &port, qreal widthFactor) const
{
	DeviceInfo device = mModel.robotModels()[0]->configuration().type(port);
	if (device.isNull()) {
		device = mModel.robotModels()[0]->info().specialDevices()[port];
		if (device.isNull()) {
			return QImage();
		}
	}

	const QPair<QPointF, qreal> neededPosDir = countPositionAndDirection(port);
	const QPointF position = neededPosDir.first;
	const qreal direction = neededPosDir.second;
	const QRect imageRect = mModel.robotModels()[0]->info().sensorImageRect(device);
	const qreal width = imageRect.width() * widthFactor / 2.0;

	const QRectF sensorRectangle = QTransform().rotate(direction).map(QPolygonF(QRectF(imageRect))).boundingRect();
	const qreal rotationFactor = sensorRectangle.width() / imageRect.width();

	const qreal realWidth = width * rotationFactor;
	const QRectF scanningRect = QRectF(position.x() - realWidth, position.y() - realWidth
			, 2 * realWidth, 2 * realWidth);
	const QImage image(mFakeScene->render(scanningRect));
	const QPoint offset = QPointF(width, width).toPoint();
	const QImage rotated(image.transformed(QTransform().rotate(-(90 + direction))));
	const QRect realImage(rotated.rect().center() - offset + QPoint(1, 1), rotated.rect().center() + offset);
	QImage result(realImage.size(), QImage::Format_RGB32);
	result.fill(Qt::white);
	QPainter painter(&result);
	painter.drawImage(QRect(QPoint(), result.size()), rotated, realImage);
	painter.end();
	return result;
}
DlgLogin::DlgLogin(QWidget *parent) :
    QWebView(parent)
{
    setWindowTitle(tr("Ingress Login"));
    resize(1024,600);

    QVariantMap xM;
    xM["nemesisSoftwareVersion"]=VersionNemisis;
    xM["deviceSoftwareVersion"]=VersionDevice;

    //DecompAsmX86 xDC;xDC.Do();return;

    DeviceInfo xD;
    /*xM["a"]=*/xD.ToHandshakeEncoded();
    //return;

    QString sJ=QString::fromUtf8(QtJson::Json::serialize(xM).toPercentEncoding());
    QString sURL=API::ms_URL+"handshake?json="+sJ;

    m_pxNetMgrWWW=new QNetworkAccessManager(this);
    connect(m_pxNetMgrWWW,SIGNAL(finished(QNetworkReply*)),this, SLOT(OnHttpDoneWWW(QNetworkReply*)));

    m_pxCookies=new NetworkCookieJar(this);
    m_pxCookies->FromVariant(DataCfg::Get()->m_xUserCfg.GetLoginCookies());
    m_pxCookies->DoEndSession();

    m_pxNetMgrWWW->setCookieJar(m_pxCookies);

    connect(this,SIGNAL(urlChanged(QUrl)),this,SLOT(OnURLChanged(QUrl)));
    connect(this,SIGNAL(loadFinished(bool)),this,SLOT(OnLoadFinished(bool)));

    qDebug() << "Login:" << sURL;
    page()->setNetworkAccessManager(m_pxNetMgrWWW);
    load(QUrl(sURL));
}
Exemple #13
0
//! [les-devicediscovery-3]
void Device::addDevice(const QBluetoothDeviceInfo &info)
{
    if (info.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
        DeviceInfo *d = new DeviceInfo(info);
        devices.append(d);
        setUpdate("Last device added: " + d->getName());
    }
}
void cv::gpu::BFMatcher_GPU::knnMatch2Collection(const GpuMat& query, const GpuMat& trainCollection,
    GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance,
    const GpuMat& maskCollection, Stream& stream)
{
    if (query.empty() || trainCollection.empty())
        return;

    using namespace cv::gpu::device::bf_knnmatch;

    typedef void (*caller_t)(const PtrStepSzb& query, const PtrStepSzb& trains, const PtrStepSz<PtrStepb>& masks,
                             const PtrStepSzb& trainIdx, const PtrStepSzb& imgIdx, const PtrStepSzb& distance,
                             int cc, cudaStream_t stream);

    static const caller_t callersL1[] =
    {
        match2L1_gpu<unsigned char>, 0/*match2L1_gpu<signed char>*/,
        match2L1_gpu<unsigned short>, match2L1_gpu<short>,
        match2L1_gpu<int>, match2L1_gpu<float>
    };
    static const caller_t callersL2[] =
    {
        0/*match2L2_gpu<unsigned char>*/, 0/*match2L2_gpu<signed char>*/,
        0/*match2L2_gpu<unsigned short>*/, 0/*match2L2_gpu<short>*/,
        0/*match2L2_gpu<int>*/, match2L2_gpu<float>
    };
    static const caller_t callersHamming[] =
    {
        match2Hamming_gpu<unsigned char>, 0/*match2Hamming_gpu<signed char>*/,
        match2Hamming_gpu<unsigned short>, 0/*match2Hamming_gpu<short>*/,
        match2Hamming_gpu<int>, 0/*match2Hamming_gpu<float>*/
    };

    CV_Assert(query.channels() == 1 && query.depth() < CV_64F);
    CV_Assert(norm == NORM_L1 || norm == NORM_L2 || norm == NORM_HAMMING);

    const caller_t* callers = norm == NORM_L1 ? callersL1 : norm == NORM_L2 ? callersL2 : callersHamming;

    const int nQuery = query.rows;

    ensureSizeIsEnough(1, nQuery, CV_32SC2, trainIdx);
    ensureSizeIsEnough(1, nQuery, CV_32SC2, imgIdx);
    ensureSizeIsEnough(1, nQuery, CV_32FC2, distance);

    if (stream)
        stream.enqueueMemSet(trainIdx, Scalar::all(-1));
    else
        trainIdx.setTo(Scalar::all(-1));

    caller_t func = callers[query.depth()];
    CV_Assert(func != 0);

    DeviceInfo info;
    int cc = info.majorVersion() * 10 + info.minorVersion();

    func(query, trainCollection, maskCollection, trainIdx, imgIdx, distance, cc, StreamAccessor::getStream(stream));
}
Exemple #15
0
QMap<PortInfo, DeviceInfo> WaitBlock::usedDevices() const
{
	DeviceInfo const deviceInfo = device();
	PortInfo const portInfo = RobotModelUtils::findPort(mRobotModel, port(), deviceInfo.direction());
	QMap<PortInfo, DeviceInfo> result;
	if (!deviceInfo.isNull() && portInfo.isValid()) {
		result[portInfo] = deviceInfo;
	}

	return result;
}
void cv::gpu::BFMatcher_GPU::matchSingle(const GpuMat& query, const GpuMat& train,
    GpuMat& trainIdx, GpuMat& distance,
    const GpuMat& mask, Stream& stream)
{
    if (query.empty() || train.empty())
        return;

    using namespace cv::gpu::device::bf_match;

    typedef void (*caller_t)(const PtrStepSzb& query, const PtrStepSzb& train, const PtrStepSzb& mask,
                             const PtrStepSzi& trainIdx, const PtrStepSzf& distance,
                             int cc, cudaStream_t stream);

    static const caller_t callersL1[] =
    {
        matchL1_gpu<unsigned char>, 0/*matchL1_gpu<signed char>*/,
        matchL1_gpu<unsigned short>, matchL1_gpu<short>,
        matchL1_gpu<int>, matchL1_gpu<float>
    };
    static const caller_t callersL2[] =
    {
        0/*matchL2_gpu<unsigned char>*/, 0/*matchL2_gpu<signed char>*/,
        0/*matchL2_gpu<unsigned short>*/, 0/*matchL2_gpu<short>*/,
        0/*matchL2_gpu<int>*/, matchL2_gpu<float>
    };

    static const caller_t callersHamming[] =
    {
        matchHamming_gpu<unsigned char>, 0/*matchHamming_gpu<signed char>*/,
        matchHamming_gpu<unsigned short>, 0/*matchHamming_gpu<short>*/,
        matchHamming_gpu<int>, 0/*matchHamming_gpu<float>*/
    };

    CV_Assert(query.channels() == 1 && query.depth() < CV_64F);
    CV_Assert(train.cols == query.cols && train.type() == query.type());
    CV_Assert(norm == NORM_L1 || norm == NORM_L2 || norm == NORM_HAMMING);

    const caller_t* callers = norm == NORM_L1 ? callersL1 : norm == NORM_L2 ? callersL2 : callersHamming;

    const int nQuery = query.rows;

    ensureSizeIsEnough(1, nQuery, CV_32S, trainIdx);
    ensureSizeIsEnough(1, nQuery, CV_32F, distance);

    caller_t func = callers[query.depth()];
    CV_Assert(func != 0);

    DeviceInfo info;
    int cc = info.majorVersion() * 10 + info.minorVersion();

    func(query, train, mask, trainIdx, distance, cc, StreamAccessor::getStream(stream));
}
void
PartitionCoreModule::createPartitionTable( Device* device, PartitionTable::TableType type )
{
    DeviceInfo* info = infoForDevice( device );
    // Creating a partition table wipes all the disk, so there is no need to
    // keep previous changes
    info->forgetChanges();

    PartitionModel::ResetHelper helper( partitionModelForDevice( device ) );
    CreatePartitionTableJob* job = new CreatePartitionTableJob( device, type );
    job->updatePreview();
    info->jobs << Calamares::job_ptr( job );

    refresh();
}
void GraphicsWatcherManager::updateSensorsList(const QString &currentRobotModel)
{
	mWatcher->clearTrackingObjects();
	int index = 0;
	for (const PortInfo &port : configuredPorts(currentRobotModel)) {
		const DeviceInfo device = currentConfiguration(currentRobotModel, port);
		/// @todo It must depend on port, port must return its variable
		const QString variableName = port.reservedVariable();
		if (!device.isNull() && !variableName.isEmpty()) {
			mWatcher->addTrackingObject(index, variableName, QString("%1: %2").arg(port.name()
					, device.friendlyName()));
			++index;
		}
	}
}
jobject JniDeviceInfo::toJava(DeviceInfo &deviceInfo)
{
    if (!m_env)
        return nullptr;

    static jmethodID deviceInfoCtor = m_env->GetMethodID(gSimulatorClassRefs.deviceInfoCls, "<init>",
                                      "()V");
    jobject jDeviceInfo = m_env->NewObject(gSimulatorClassRefs.deviceInfoCls, deviceInfoCtor);
    setFieldValue(jDeviceInfo, "mName", deviceInfo.getName());
    setFieldValue(jDeviceInfo, "mID", deviceInfo.getID());
    setFieldValue(jDeviceInfo, "mSpecVersion", deviceInfo.getSpecVersion());
    setFieldValue(jDeviceInfo, "mDMVVersion", deviceInfo.getDataModelVersion());

    return jDeviceInfo;
}
void cv::gpu::BruteForceMatcher_GPU_base::matchCollection(const GpuMat& query, const GpuMat& trainCollection,
    GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance,
    const GpuMat& masks, Stream& stream)
{
    if (query.empty() || trainCollection.empty())
        return;

    using namespace ::cv::gpu::device::bf_match;

    typedef void (*caller_t)(const DevMem2Db& query, const DevMem2Db& trains, const DevMem2D_<PtrStepb>& masks,
                             const DevMem2Di& trainIdx, const DevMem2Di& imgIdx, const DevMem2Df& distance,
                             int cc, cudaStream_t stream);

    static const caller_t callers[3][6] =
    {
        {
            matchL1_gpu<unsigned char>, 0/*matchL1_gpu<signed char>*/,
            matchL1_gpu<unsigned short>, matchL1_gpu<short>,
            matchL1_gpu<int>, matchL1_gpu<float>
        },
        {
            0/*matchL2_gpu<unsigned char>*/, 0/*matchL2_gpu<signed char>*/,
            0/*matchL2_gpu<unsigned short>*/, 0/*matchL2_gpu<short>*/,
            0/*matchL2_gpu<int>*/, matchL2_gpu<float>
        },
        {
            matchHamming_gpu<unsigned char>, 0/*matchHamming_gpu<signed char>*/,
            matchHamming_gpu<unsigned short>, 0/*matchHamming_gpu<short>*/,
            matchHamming_gpu<int>, 0/*matchHamming_gpu<float>*/
        }
    };

    CV_Assert(query.channels() == 1 && query.depth() < CV_64F);

    const int nQuery = query.rows;

    ensureSizeIsEnough(1, nQuery, CV_32S, trainIdx);
    ensureSizeIsEnough(1, nQuery, CV_32S, imgIdx);
    ensureSizeIsEnough(1, nQuery, CV_32F, distance);

    caller_t func = callers[distType][query.depth()];
    CV_Assert(func != 0);

    DeviceInfo info;
    int cc = info.majorVersion() * 10 + info.minorVersion();

    func(query, trainCollection, masks, trainIdx, imgIdx, distance, cc, StreamAccessor::getStream(stream));
}
void CommonRobotModel::configureDevice(const PortInfo &port, const DeviceInfo &deviceInfo)
{
	if (!availablePorts().contains(port)) {
		return;
	}

	if (deviceInfo.isNull()) {
		mConfiguration.clearDevice(port);
		return;
	}

	robotParts::Device * const device = createDevice(port, deviceInfo);
	if (device) {
		mConfiguration.configureDevice(device);
	} else {
		QLOG_WARN() << "Can not create device for" << deviceInfo.toString();
	}
	/// @todo Handle error
}
Exemple #22
0
void cv::gpu::remap(const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap, int interpolation, int borderMode, Scalar borderValue, Stream& stream)
{
    using namespace cv::gpu::device::imgproc;

    typedef void (*func_t)(PtrStepSzb src, PtrStepSzb srcWhole, int xoff, int yoff, PtrStepSzf xmap, PtrStepSzf ymap, PtrStepSzb dst, int interpolation,
                           int borderMode, const float* borderValue, cudaStream_t stream, int cc);

    static const func_t funcs[6][4] =
    {
        {remap_gpu<uchar>      , 0 /*remap_gpu<uchar2>*/ , remap_gpu<uchar3>     , remap_gpu<uchar4>     },
        {0 /*remap_gpu<schar>*/, 0 /*remap_gpu<char2>*/  , 0 /*remap_gpu<char3>*/, 0 /*remap_gpu<char4>*/},
        {remap_gpu<ushort>     , 0 /*remap_gpu<ushort2>*/, remap_gpu<ushort3>    , remap_gpu<ushort4>    },
        {remap_gpu<short>      , 0 /*remap_gpu<short2>*/ , remap_gpu<short3>     , remap_gpu<short4>     },
        {0 /*remap_gpu<int>*/  , 0 /*remap_gpu<int2>*/   , 0 /*remap_gpu<int3>*/ , 0 /*remap_gpu<int4>*/ },
        {remap_gpu<float>      , 0 /*remap_gpu<float2>*/ , remap_gpu<float3>     , remap_gpu<float4>     }
    };

    CV_Assert(src.depth() <= CV_32F && src.channels() <= 4);
    CV_Assert(xmap.type() == CV_32F && ymap.type() == CV_32F && xmap.size() == ymap.size());
    CV_Assert(interpolation == INTER_NEAREST || interpolation == INTER_LINEAR || interpolation == INTER_CUBIC);
    CV_Assert(borderMode == BORDER_REFLECT101 || borderMode == BORDER_REPLICATE || borderMode == BORDER_CONSTANT || borderMode == BORDER_REFLECT || borderMode == BORDER_WRAP);

    const func_t func = funcs[src.depth()][src.channels() - 1];
    CV_Assert(func != 0);

    int gpuBorderType;
    CV_Assert(tryConvertToGpuBorderType(borderMode, gpuBorderType));

    dst.create(xmap.size(), src.type());

    Scalar_<float> borderValueFloat;
    borderValueFloat = borderValue;

    DeviceInfo info;
    int cc = info.majorVersion() * 10 + info.minorVersion();

    Size wholeSize;
    Point ofs;
    src.locateROI(wholeSize, ofs);

    func(src, PtrStepSzb(wholeSize.height, wholeSize.width, src.datastart, src.step), ofs.x, ofs.y, xmap, ymap,
         dst, interpolation, gpuBorderType, borderValueFloat.val, StreamAccessor::getStream(stream), cc);
}
QString DevicesConfigurationManager::save() const
{
	QDomDocument result;
	QDomElement rootElement = result.createElement("devicesConfiguration");
	result.appendChild(rootElement);
	for (QString const &robotModel : configuredModels()) {
		QDomElement robotModelElement = result.createElement("robotModel");
		robotModelElement.setAttribute("name", robotModel);
		rootElement.appendChild(robotModelElement);
		for (PortInfo const &port : configuredPorts(robotModel)) {
			DeviceInfo const device = currentConfiguration(robotModel, port);
			QDomElement configurationElement = result.createElement("configuration");
			configurationElement.setAttribute("port", port.toString());
			configurationElement.setAttribute("device", device.toString());
			robotModelElement.appendChild(configurationElement);
		}
	}

	return result.toString();
}
void SessionHandlerTest::regression_NB153701_02()
{
    // regression_NB153701_02:
    // Test handling of source device when receiving server initiated
    // sync message with unknown source device and local device name is set

    MockTransport transport( "transport" );

    SyncAgentConfig config;
    DeviceInfo deviceInfo;
    config.setTransport( &transport );
    config.setStorageProvider( this );
    config.setDatabaseFilePath( DBFILE );
    deviceInfo.setDeviceID( NB153701SOURCEDEVICE );
    config.setDeviceInfo(deviceInfo);
    config.setLocalDeviceName( NB153701FORCEDEVICE );

    // Prepare
    ClientSessionHandler sessionHandler( &config, NULL );
    QList<Fragment*> fragments;

    // Receive header
    HeaderParams* hp1 = new HeaderParams();
    hp1->verDTD = SYNCML_DTD_VERSION_1_2;
    hp1->sourceDevice = NB153701TARGETDEVICE;
    hp1->targetDevice = NB153701UNKNOWNDEVICE;
    hp1->sessionID = "1";
    hp1->msgID = 1;
    hp1->meta.maxMsgSize = DEFAULT_MAX_MESSAGESIZE;
    fragments.append(hp1);

    sessionHandler.handleNotificationXML(fragments);
    QVERIFY(fragments.isEmpty());

    QCOMPARE( sessionHandler.getDevInfHandler().getLocalDeviceInfo().getDeviceID(), NB153701SOURCEDEVICE );
    QCOMPARE( sessionHandler.params().localDeviceName(), NB153701FORCEDEVICE );
    QCOMPARE( sessionHandler.getResponseGenerator().getHeaderParams().sourceDevice, NB153701FORCEDEVICE );
    QCOMPARE( sessionHandler.params().remoteDeviceName(), NB153701TARGETDEVICE );
    QCOMPARE( sessionHandler.getResponseGenerator().getHeaderParams().targetDevice, NB153701TARGETDEVICE );

}
void SensorsConfiguration::serialize(QDomElement &robot, QDomDocument &document) const
{
	QDomElement sensorsElem = document.createElement("sensors");
	robot.appendChild(sensorsElem);

	for (const PortInfo &port: mSensorsInfo.keys()) {
		const DeviceInfo device = currentConfiguration(mRobotModelName, port);
		const SensorInfo sensor = mSensorsInfo.value(port);
		QDomElement sensorElem = document.createElement("sensor");
		sensorsElem.appendChild(sensorElem);
		sensorElem.setAttribute("port", port.toString());
		sensorElem.setAttribute("type", device.toString());

		sensorElem.setAttribute("position"
				, QString::number(sensor.position.x()) + ":" + QString::number(sensor.position.y()));

		sensorElem.setAttribute("direction", QString::number(sensor.direction));
	}

	robot.appendChild(sensorsElem);
}
Exemple #26
0
void DeviceIndex::fire_device_lost (const DeviceInfo& d)
{
    mtx.lock();
    for (auto& c : callbacks)
    {
        if (c.serial.empty() || c.serial.compare(d.get_serial()) == 0)
        {
            c.callback(d, c.data);
        }
    }
    mtx.unlock();
}
PERF_TEST_P(DevInfo, HOGDescriptor, testing::ValuesIn(devices()))
{
    DeviceInfo devInfo = GetParam();

    setDevice(devInfo.deviceID());

    Mat img_host = readImage("gpu/hog/road.png", CV_LOAD_IMAGE_GRAYSCALE);

    GpuMat img(img_host);
    vector<Rect> found_locations;

    declare.time(0.5).iterations(100);

    gpu::HOGDescriptor hog;
    hog.setSVMDetector(gpu::HOGDescriptor::getDefaultPeopleDetector());

    SIMPLE_TEST_CYCLE()
    {
        hog.detectMultiScale(img, found_locations);
    }
}
Exemple #28
0
void CAppInterface::CreateServerApp()
{
    //connect ServerCore Signal
    QObject::connect(ServerCore::GetInstance(), &ServerCore::deviceAdded, [=](QString uid)
    {
        if (m_DevicesInfoListModel->isExist(uid))
        {
            DeviceHandle* kDevicesIfo = new DeviceHandle;
            DeviceInfo kInfo = ServerCore::GetInstance()->queryDeviceInfo(uid);
            kDevicesIfo->setUID(uid);
            kDevicesIfo->setIP(kInfo.getIP());
            kDevicesIfo->setName(kInfo.getName());
            kDevicesIfo->setCmdKeys(kInfo.getSupportCommands());

            QList<QString> kDisplayName;
            for (auto i : kDevicesIfo->getCmdKeys())
            {
                DeviceCommand kCmd = kInfo.getDeviceCommandDetail(i);
                kDisplayName.append(kCmd.getCommandDisplayName());
            }
            kDevicesIfo->setCmdDisplayName(kInfo.getSupportCommands());

            m_DevicesInfoListModel->addDevice(*kDevicesIfo);
            m_DeviceCmdListModel->addDevice(*kDevicesIfo);
        }
    });

    QObject::connect(ServerCore::GetInstance(), &ServerCore::commandReturned, [=](QString uid, QVariantMap retMap)
    {
        QString kText(uid + " returns:\n");
        for (QString key : retMap.keys())
        {
            kText+= key + ": " + retMap[key].toString()+"\n";
        }

        Q_EMIT m_pSender->commandReturned(kText);
    });
    /*
    QObject::connect(ServerCore::GetInstance(), &ServerCore::dataWrittenToDevice, [=]
    {
    });
    QObject::connect(ui.GetStatusButton, &QPushButton::clicked, [=]
    {
        QVariantMap paramMap;
        paramMap.insert("command", "queryDisplayInfo");
        ServerCore::GetInstance()->sendCommandToDevice("az0000", paramMap);
    });

    QObject::connect(ServerCore::GetInstance(), &ServerCore::commandReturned, [=](QString uid, QVariantMap retMap)
    {
        ui.plainTextEdit->appendPlainText(uid + " returns: ");

        for (QString key : retMap.keys())
        {
            ui.plainTextEdit->appendPlainText(key + ": " + retMap[key].toString());
        }
    });
    */
    ServerCore::GetInstance()->startServer();
}
Exemple #29
0
// new DeviceInfo object, transfers ownership of strings, 
DeviceInfo *DeviceInfo::NewDevice(enum DevType aDevType, 
    enum DevState aDevState, FILETIME aNow, wchar_t *aSerialnumber, wchar_t *aPortName,
    wchar_t *aFriendlyName, wchar_t *aHardwareId, int aPortNumber, wchar_t *aContainerId,
    unsigned aUsbHub, unsigned aUsbPort, BOOL aUsbValid, unsigned aScanId, DeviceInfo *aDevNext,
    BOOL aIsWinSerial, SerialType aSerialType)
{
    DeviceInfo *newDev = NULL;

    // decide if new device should be DevArrived rather than DevPresent
    if ((aDevState == DevPresent) && !gdevTracker->CheckInitialScanFlag(aDevType)) {
        aDevState = DevArrived;
    }

    newDev = new DeviceInfo(aDevType, aDevState, aNow, aSerialnumber, aPortName,
        aPortNumber, aContainerId, aFriendlyName, aHardwareId,
        aUsbHub, aUsbPort, aUsbValid, aScanId, aDevNext,
        aIsWinSerial, aSerialType);

    if (newDev) {
        TCHAR   buffer[20];

        // update double linked list
        if (aDevNext) {
            aDevNext->devPrev = newDev;
        }
        gdevTracker->SetPortList(newDev);

        StringCbPrintf(buffer, sizeof(buffer), 
            (newDev->DeviceState() == DevArrived) ? _T("%s 0min") : _T("%s"), newDev->StateName());

        // display update shouldn't fail, but check anyway
        if (!gdevTracker->AddViewItem(newDev->DisplayName(), newDev->devImage,
                newDev->DevTypeName(), buffer, newDev->LocationString(), aSerialnumber,
                (LPARAM)newDev)) {
            newDev->Destroy();
            newDev = NULL;
        } else {
            if ((aDevState == DevArrived) || (aDevState == DevPresent)) {
                // update count
                newDev->IncDeviceTypeCount();
            }

            // update DeviceTracker counts, decide on notifications 
            gdevTracker->DetermineArrivalNotifications(aDevType, aDevState);
        }
    }

    return newDev;
}
PERF_TEST_P(DevInfo, solvePnPRansac, testing::ValuesIn(devices()))
{
    DeviceInfo devInfo = GetParam();

    setDevice(devInfo.deviceID());

    Mat object(1, 10000, CV_32FC3);
    Mat image(1, 10000, CV_32FC2);

    declare.in(object, image, WARMUP_RNG);

    Mat rvec, tvec;

    declare.time(3.0);

    SIMPLE_TEST_CYCLE()
    {
        solvePnPRansac(object, image, Mat::ones(3, 3, CV_32FC1), Mat(1, 8, CV_32F, Scalar::all(0)), rvec, tvec);
    }

    SANITY_CHECK(rvec);
    SANITY_CHECK(tvec);
}