Example #1
0
std::map<int, Quad> find(const cv::Mat &inputImage){
    auto greyscaleImage = mEnsureGreyscale(inputImage);

    std::map<int, Quad> tags;

    for (const auto & quad : mFindQuads(greyscaleImage)) {
        auto refinedQuad = mRefine(greyscaleImage, quad);
        auto tag = mDecode(mReadBits(greyscaleImage, refinedQuad), refinedQuad);
        if (tag.first != Decode::INVALID_TAG) tags[tag.first] = tag.second;
        else {
            tag = mDecode(mReadBits(greyscaleImage, quad), quad);
            if (tag.first != Decode::INVALID_TAG) tags[tag.first] = tag.second;
        }
    }
    return mFilter(tags);
};
Example #2
0
//打开文件
void PCLVisualizer::fileOpenSlot()
{
	//系统风格对话框
	QString mCaption("Open");
	QString mDir(".");
	QStringList mFilters;
	mFilters<<"All types (*)"
		<<"3D Point cloud (*.txt)"
		<<"3DC point cloud format (*.3dc *.asc)"
		<<"3D Studio model format (*.3ds)"
		<<"AC3D Database format (*.ac)"
		<<"BSP files (*.bsp)"
		<<"Biovision motion hierarchical file (*.bvh)"
		<<"COLLADA 1.4.x DAE format (*.dae)"
		<<"COLLADA 1.4.x ZAE format (*.zae)"
		<<"dicom image format (*.mag *.ph *.ima *.dic *.dcm *.dicom)"
		<<"Designer Workbench model format (*.dw)"
		<<"Autodesk DXF format (*.dxf)"
		<<"FBX format (*.fbx)";
	QString mFilter(mFilters.join(";;"));
	QString mSelectedFilter("All types (*)");
	QString mQFilePath = QFileDialog::getOpenFileName(0,mCaption,mDir,mFilter,&mSelectedFilter,0);
	if(!mQFilePath.isNull())
	{
		//显示窗口初始化
		//QHBoxLayout *mHLayoutOne = new QHBoxLayout;
		//ui.displayWindow->setLayout(mHLayoutOne);
		//mHLayoutOne->addWidget(ui.displayWindow);
		PointCloudWithNormals::Ptr mObjectAllCloud(new PointCloudWithNormals);
		cloudReader(mQFilePath, mObjectAllCloud);
		mPclViewer->addPointCloud(mObjectAllCloud, ColorHandlerT(mObjectAllCloud, 255.0, 0.0, 0.0), "object");
		vtkSmartPointer<vtkRenderWindow> mRenderWindows;

		mRenderWindows = mPclViewer->getRenderWindow();
		ui.qvtkWidget->SetRenderWindow(mRenderWindows);
		ui.qvtkWidget->update();
		//visu.setPosition(ui.displayWindow->x(), ui.displayWindow->y());
		//visu.setSize(ui.displayWindow->width(), ui.displayWindow->height());
		//visu.addPointCloud (mObjectAllCloud, ColorHandlerT(mObjectAllCloud, 255.0, 0.0, 0.0), "object");//红色
		////visu.addPointCloud (mSceneAllCloudN,  ColorHandlerT(mSceneAllCloudN, 0.0, 255.0, 0.0), "scene");//绿色
		//visu.spin();
	}
}
// internal call, for use in avoiding lookup
bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPtr pNotification)
{	
	std::string cmd = payload["sigtype"];
	LLNotificationSet::iterator foundItem = mItems.find(pNotification);
	bool wasFound = (foundItem != mItems.end());
	bool passesFilter = mFilter(pNotification);
	
	// first, we offer the result of the filter test to the simple
	// signals for pass/fail. One of these is guaranteed to be called.
	// If either signal returns true, the change processing is NOT performed
	// (so don't return true unless you know what you're doing!)
	bool abortProcessing = false;
	if (passesFilter)
	{
		abortProcessing = mPassedFilter(payload);
	}
	else
	{
		abortProcessing = mFailedFilter(payload);
	}
	
	if (abortProcessing)
	{
		return true;
	}
	
	if (cmd == "load")
	{
		// should be no reason we'd ever get a load if we already have it
		// if passes filter send a load message, else do nothing
		assert(!wasFound);
		if (passesFilter)
		{
			// not in our list, add it and say so
			mItems.insert(pNotification);
			abortProcessing = mChanged(payload);
			onLoad(pNotification);
		}
	}
	else if (cmd == "change")
	{
		// if it passes filter now and was found, we just send a change message
		// if it passes filter now and wasn't found, we have to add it
		// if it doesn't pass filter and wasn't found, we do nothing
		// if it doesn't pass filter and was found, we need to delete it
		if (passesFilter)
		{
			if (wasFound)
			{
				// it already existed, so this is a change
				// since it changed in place, all we have to do is resend the signal
				abortProcessing = mChanged(payload);
				onChange(pNotification);
			}
			else
			{
				// not in our list, add it and say so
				mItems.insert(pNotification);
				// our payload is const, so make a copy before changing it
				LLSD newpayload = payload;
				newpayload["sigtype"] = "add";
				abortProcessing = mChanged(newpayload);
				onChange(pNotification);
			}
		}
		else
		{
			if (wasFound)
			{
				// it already existed, so this is a delete
				mItems.erase(pNotification);
				// our payload is const, so make a copy before changing it
				LLSD newpayload = payload;
				newpayload["sigtype"] = "delete";
				abortProcessing = mChanged(newpayload);
				onChange(pNotification);
			}
			// didn't pass, not on our list, do nothing
		}
	}
	else if (cmd == "add")
	{
		// should be no reason we'd ever get an add if we already have it
		// if passes filter send an add message, else do nothing
		assert(!wasFound);
		if (passesFilter)
		{
			// not in our list, add it and say so
			mItems.insert(pNotification);
			abortProcessing = mChanged(payload);
			onAdd(pNotification);
		}
	}
	else if (cmd == "delete")
	{
		// if we have it in our list, pass on the delete, then delete it, else do nothing
		if (wasFound)
		{
			abortProcessing = mChanged(payload);
			mItems.erase(pNotification);
			onDelete(pNotification);
		}
	}
	return abortProcessing;
}
Example #4
0
std::map<std::string, cv::Matx44d> estimate(const std::map<int, Quad> &tags) {

    std::map<std::string, cv::Matx44d> objects;

    std::map<
        const std::string,     //name of the object
        std::pair<
            std::vector<cv::Point3f>,      //points in object
            std::vector<cv::Point2f> > >   //points in frame
    objectToPointMapping;


    auto configurationIt = mId2Configuration.begin();
    auto configurationEnd = mId2Configuration.end();
    for (const auto &tag : tags) {
        int tagId = tag.first;
        const cv::Mat_<cv::Point2f> corners(tag.second);

        while (configurationIt != configurationEnd
               && configurationIt->first < tagId)
            ++configurationIt;

        if (configurationIt != configurationEnd) {
            if (configurationIt->first == tagId) {
                const auto &configuration = configurationIt->second;
                if (configuration.second.mKeep) {
                    computeTransformation(cv::format("tag_%d", tagId),
                                          configuration.second.mLocalcorners,
                                          corners,
                                          objects);
                }
                auto & pointMapping = objectToPointMapping[configuration.first];
                pointMapping.first.insert(
                    pointMapping.first.end(),
                    configuration.second.mCorners.begin(),
                    configuration.second.mCorners.end());
                pointMapping.second.insert(
                    pointMapping.second.end(),
                    corners.begin(),
                    corners.end());
            } else if (!mOmitOtherTags) {
                computeTransformation(cv::format("tag_%d", tagId),
                                      mDefaultTagCorners,
                                      corners,
                                      objects);
            }

        } else if (!mOmitOtherTags) {
            computeTransformation(cv::format("tag_%d", tagId),
                                  mDefaultTagCorners,
                                  corners,
                                  objects);
        }
    }

    for (auto& objectToPoints : objectToPointMapping) {
        computeTransformation(objectToPoints.first,
                              objectToPoints.second.first,
                              cv::Mat_<cv::Point2f>(objectToPoints.second.second),
                              objects);
    }

    return mFilter(objects);
}
Example #5
0
 void operator()(F first,Args... args) {
     mRaw(mFilter(first),args...);
 }
Example #6
0
 R operator()(F first,Args... args) {
     return mRaw(mFilter(first),args...);
 }
Example #7
0
 void operator()(Args...args) {
     return mFilter(mRaw(args...));
 }
Example #8
0
	bool CustomRealtimeLeaf::isRealtimeActive() const
	{
		return mFilter();
	}
Example #9
0
	bool CustomEventLeaf::isEventActive(const sf::Event& event) const
	{
		return mFilter(event);
	}