Ejemplo n.º 1
0
 public virtual void filter(DescriptorMatchVector inputMatches, DescriptorMatchVector outputMatches, KeypointArray inputKeyPoints1, KeypointArray inputKeyPoints2, Transform3Df pose1, Transform3Df pose2, Matrix3x3f intrinsicParams)
 {
     solar_api_featuresPINVOKE.IMatchesFilter_filter__SWIG_1(swigCPtr, DescriptorMatchVector.getCPtr(inputMatches), DescriptorMatchVector.getCPtr(outputMatches), KeypointArray.getCPtr(inputKeyPoints1), KeypointArray.getCPtr(inputKeyPoints2), Transform3Df.getCPtr(pose1), Transform3Df.getCPtr(pose2), Matrix3x3f.getCPtr(intrinsicParams));
     if (solar_api_featuresPINVOKE.SWIGPendingException.Pending)
     {
         throw solar_api_featuresPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 2
0
 public virtual void filter(DescriptorMatchVector inputMatches, DescriptorMatchVector outputMatches, KeypointArray keyPoints_1, KeypointArray keyPoints_2)
 {
     solar_api_featuresPINVOKE.IMatchesFilter_filter__SWIG_0(swigCPtr, DescriptorMatchVector.getCPtr(inputMatches), DescriptorMatchVector.getCPtr(outputMatches), KeypointArray.getCPtr(keyPoints_1), KeypointArray.getCPtr(keyPoints_2));
     if (solar_api_featuresPINVOKE.SWIGPendingException.Pending)
     {
         throw solar_api_featuresPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 3
0
        public virtual FrameworkReturnCode match(Frame frame, int index, DescriptorMatchVector matches)
        {
            FrameworkReturnCode ret = (FrameworkReturnCode)solar_api_relocPINVOKE.IKeyframeRetriever_match__SWIG_0(swigCPtr, Frame.getCPtr(frame), index, DescriptorMatchVector.getCPtr(matches));

            if (solar_api_relocPINVOKE.SWIGPendingException.Pending)
            {
                throw solar_api_relocPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 4
0
        public virtual bool select(Frame frame, DescriptorMatchVector matches)
        {
            bool ret = solar_api_solver_mapPINVOKE.IKeyframeSelector_select__SWIG_0(swigCPtr, Frame.getCPtr(frame), DescriptorMatchVector.getCPtr(matches));

            if (solar_api_solver_mapPINVOKE.SWIGPendingException.Pending)
            {
                throw solar_api_solver_mapPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 5
0
        public virtual FrameworkReturnCode find(Frame lastFrame, Frame currentFrame, DescriptorMatchVector current_matches, Map worldMap, Point3DfArray shared_3dpoint, Point2DfArray shared_2dpoint, DescriptorMatchVector found_matches, DescriptorMatchVector remaining_matches)
        {
            FrameworkReturnCode ret = (FrameworkReturnCode)solar_api_solver_posePINVOKE.I2D3DCorrespondencesFinder_find__SWIG_1(swigCPtr, Frame.getCPtr(lastFrame), Frame.getCPtr(currentFrame), DescriptorMatchVector.getCPtr(current_matches), Map.getCPtr(worldMap), Point3DfArray.getCPtr(shared_3dpoint), Point2DfArray.getCPtr(shared_2dpoint), DescriptorMatchVector.getCPtr(found_matches), DescriptorMatchVector.getCPtr(remaining_matches));

            if (solar_api_solver_posePINVOKE.SWIGPendingException.Pending)
            {
                throw solar_api_solver_posePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 6
0
        public virtual double triangulate(Keyframe curKeyframe, DescriptorMatchVector matches, CloudPointVector pcloud)
        {
            double ret = solar_api_solver_mapPINVOKE.ITriangulator_triangulate__SWIG_3(swigCPtr, Keyframe.getCPtr(curKeyframe), DescriptorMatchVector.getCPtr(matches), CloudPointVector.getCPtr(pcloud));

            if (solar_api_solver_mapPINVOKE.SWIGPendingException.Pending)
            {
                throw solar_api_solver_mapPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 7
0
 public virtual IDescriptorMatcher.RetCode match(DescriptorBuffer descriptors1, DescriptorBufferList descriptors2, DescriptorMatchVector matches)
 {
     IDescriptorMatcher.RetCode ret = (IDescriptorMatcher.RetCode)solar_api_featuresPINVOKE.IDescriptorMatcher_match__SWIG_1(swigCPtr, DescriptorBuffer.getCPtr(descriptors1), DescriptorBufferList.getCPtr(descriptors2), DescriptorMatchVector.getCPtr(matches));
     if (solar_api_featuresPINVOKE.SWIGPendingException.Pending)
     {
         throw solar_api_featuresPINVOKE.SWIGPendingException.Retrieve();
     }
     return(ret);
 }
Ejemplo n.º 8
0
        public virtual FrameworkReturnCode reindex(KeypointArray keypoints1, KeypointArray keypoints2, DescriptorMatchVector matches, Point2DfArray matchedKeypoints1, Point2DfArray matchedKeypoints2)
        {
            FrameworkReturnCode ret = (FrameworkReturnCode)solar_api_featuresPINVOKE.IKeypointsReIndexer_reindex(swigCPtr, KeypointArray.getCPtr(keypoints1), KeypointArray.getCPtr(keypoints2), DescriptorMatchVector.getCPtr(matches), Point2DfArray.getCPtr(matchedKeypoints1), Point2DfArray.getCPtr(matchedKeypoints2));

            if (solar_api_featuresPINVOKE.SWIGPendingException.Pending)
            {
                throw solar_api_featuresPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 9
0
        public virtual FrameworkReturnCode match(IntVector indexDescriptors, DescriptorBuffer descriptors, int indexKeyframe, DescriptorMatchVector matches)
        {
            FrameworkReturnCode ret = (FrameworkReturnCode)solar_api_relocPINVOKE.IKeyframeRetriever_match__SWIG_1(swigCPtr, IntVector.getCPtr(indexDescriptors), DescriptorBuffer.getCPtr(descriptors), indexKeyframe, DescriptorMatchVector.getCPtr(matches));

            if (solar_api_relocPINVOKE.SWIGPendingException.Pending)
            {
                throw solar_api_relocPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 10
0
        public virtual FrameworkReturnCode reindex(Contour2DfArray candidateContours, DescriptorMatchVector matches, Point2DfArray patternPoints, Point2DfArray imagePoints)
        {
            FrameworkReturnCode ret = (FrameworkReturnCode)solar_api_featuresPINVOKE.ISBPatternReIndexer_reindex(swigCPtr, Contour2DfArray.getCPtr(candidateContours), DescriptorMatchVector.getCPtr(matches), Point2DfArray.getCPtr(patternPoints), Point2DfArray.getCPtr(imagePoints));

            if (solar_api_featuresPINVOKE.SWIGPendingException.Pending)
            {
                throw solar_api_featuresPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 11
0
        public virtual FrameworkReturnCode update(Map map, Keyframe newKeyframe, CloudPointVector newCloud, DescriptorMatchVector newPointsMatches, DescriptorMatchVector existingPointsMatches)
        {
            FrameworkReturnCode ret = (FrameworkReturnCode)solar_api_solver_mapPINVOKE.IMapper_update__SWIG_0(swigCPtr, Map.getCPtr(map), Keyframe.getCPtr(newKeyframe), CloudPointVector.getCPtr(newCloud), DescriptorMatchVector.getCPtr(newPointsMatches), DescriptorMatchVector.getCPtr(existingPointsMatches));

            if (solar_api_solver_mapPINVOKE.SWIGPendingException.Pending)
            {
                throw solar_api_solver_mapPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 12
0
        public virtual FrameworkReturnCode estimate(KeypointArray pointsView1, KeypointArray pointsView2, Transform3Df poseView1, Transform3Df poseView2, DescriptorMatchVector inlierMatches)
        {
            FrameworkReturnCode ret = (FrameworkReturnCode)solar_api_solver_posePINVOKE.I3DTransformFinderFrom2D2D_estimate__SWIG_1(swigCPtr, KeypointArray.getCPtr(pointsView1), KeypointArray.getCPtr(pointsView2), Transform3Df.getCPtr(poseView1), Transform3Df.getCPtr(poseView2), DescriptorMatchVector.getCPtr(inlierMatches));

            if (solar_api_solver_posePINVOKE.SWIGPendingException.Pending)
            {
                throw solar_api_solver_posePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 13
0
        public NaturalPipeline(IComponentManager xpcfComponentManager) : base(xpcfComponentManager)
        {
            imageViewerKeypoints = Create <IImageViewer>("SolARImageViewerOpencv", "keypoints");
            imageViewerResult    = Create <IImageViewer>("SolARImageViewerOpencv");
            marker               = Create <IMarker2DNaturalImage>("SolARMarker2DNaturalImageOpencv");
            kpDetector           = Create <IKeypointDetector>("SolARKeypointDetectorOpencv");
            kpDetectorRegion     = Create <IKeypointDetectorRegion>("SolARKeypointDetectorRegionOpencv");
            descriptorExtractor  = Create <IDescriptorsExtractor>("SolARDescriptorsExtractorAKAZE2Opencv");
            matcher              = Create <IDescriptorMatcher>("SolARDescriptorMatcherKNNOpencv");
            geomMatchesFilter    = Create <IMatchesFilter>("SolARGeometricMatchesFilterOpencv");
            poseEstimationPlanar = Create <I3DTransformSACFinderFrom2D3D>("SolARPoseEstimationPlanarPointsOpencv");
            opticalFlow          = Create <IOpticalFlowEstimator>("SolAROpticalFlowPyrLKOpencv");
            projection           = Create <IProject>("SolARProjectOpencv");
            unprojection         = Create <IUnproject>("SolARUnprojectPlanarPointsOpencv");
            img_mapper           = Create <IImage2WorldMapper>("SolARImage2WorldMapper4Marker2D");
            basicMatchesFilter   = Create <IMatchesFilter>("SolARBasicMatchesFilter");
            keypointsReindexer   = Create <IKeypointsReIndexer>("SolARKeypointsReIndexer");
            overlay3DComponent   = Create <I3DOverlay>("SolAR3DOverlayOpencv");
            /* in dynamic mode, we need to check that components are well created*/
            /* this is needed in dynamic mode */
            if (new object[] { imageViewerKeypoints, imageViewerResult, marker, kpDetector, kpDetectorRegion, descriptorExtractor, matcher,
                               geomMatchesFilter, poseEstimationPlanar, opticalFlow, projection, unprojection, img_mapper,
                               basicMatchesFilter, keypointsReindexer, overlay3DComponent }.Contains(null))
            {
                LOG_ERROR("One or more component creations have failed");
                return;
            }
            LOG_INFO("All components have been created");

            // Declare data structures used to exchange information between components
            refImage         = SharedPtr.Alloc <Image>().AddTo(subscriptions);
            previousCamImage = SharedPtr.Alloc <Image>().AddTo(subscriptions);

            //kpImageCam = SharedPtr.Alloc<Image>().AddTo(subscriptions);
            refDescriptors = SharedPtr.Alloc <DescriptorBuffer>().AddTo(subscriptions);
            camDescriptors = SharedPtr.Alloc <DescriptorBuffer>().AddTo(subscriptions);
            matches        = new DescriptorMatchVector().AddTo(subscriptions);

            // where to store detected keypoints in ref image and camera image
            refKeypoints = new KeypointArray().AddTo(subscriptions);
            camKeypoints = new KeypointArray().AddTo(subscriptions);

            markerWorldCorners = new Point3DfArray().AddTo(subscriptions);

            // load marker
            marker.loadMarker().Check();
            marker.getWorldCorners(markerWorldCorners).Check();
            marker.getImage(refImage).Check();

            // detect keypoints in reference image
            kpDetector.detect(refImage, refKeypoints);

            // extract descriptors in reference image
            descriptorExtractor.extract(refImage, refKeypoints, refDescriptors);



            // initialize image mapper with the reference image size and marker size
            var img_mapper_config = img_mapper.BindTo <IConfigurable>().AddTo(subscriptions);
            var refSize           = refImage.getSize();
            var mkSize            = marker.getSize();

            img_mapper_config.getProperty("digitalWidth").setIntegerValue((int)refSize.width);
            img_mapper_config.getProperty("digitalHeight").setIntegerValue((int)refSize.height);
            img_mapper_config.getProperty("worldWidth").setFloatingValue(mkSize.width);
            img_mapper_config.getProperty("worldHeight").setFloatingValue(mkSize.height);

            // vector of 4 corners in the marker
            refImgCorners = new Point2DfArray();
            float    w = refImage.getWidth(), h = refImage.getHeight();
            Point2Df corner0 = new Point2Df(0, 0);
            Point2Df corner1 = new Point2Df(w, 0);
            Point2Df corner2 = new Point2Df(w, h);
            Point2Df corner3 = new Point2Df(0, h);

            refImgCorners.Add(corner0);
            refImgCorners.Add(corner1);
            refImgCorners.Add(corner2);
            refImgCorners.Add(corner3);
        }
Ejemplo n.º 14
0
        public virtual double triangulate(KeypointArray keypointsView1, KeypointArray keypointsView2, DescriptorBuffer descriptor1, DescriptorBuffer descriptor2, DescriptorMatchVector matches, PairUIntUInt working_views, Transform3Df poseView1, Transform3Df poseView2, CloudPointVector pcloud)
        {
            double ret = solar_api_solver_mapPINVOKE.ITriangulator_triangulate__SWIG_2(swigCPtr, KeypointArray.getCPtr(keypointsView1), KeypointArray.getCPtr(keypointsView2), DescriptorBuffer.getCPtr(descriptor1), DescriptorBuffer.getCPtr(descriptor2), DescriptorMatchVector.getCPtr(matches), PairUIntUInt.getCPtr(working_views), Transform3Df.getCPtr(poseView1), Transform3Df.getCPtr(poseView2), CloudPointVector.getCPtr(pcloud));

            if (solar_api_solver_mapPINVOKE.SWIGPendingException.Pending)
            {
                throw solar_api_solver_mapPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 15
0
 public virtual IDescriptorMatcher.RetCode matchInRegion(Point2DfArray points2D, DescriptorBufferList descriptors, Frame frame, DescriptorMatchVector matches, float radius)
 {
     IDescriptorMatcher.RetCode ret = (IDescriptorMatcher.RetCode)solar_api_featuresPINVOKE.IDescriptorMatcher_matchInRegion(swigCPtr, Point2DfArray.getCPtr(points2D), DescriptorBufferList.getCPtr(descriptors), Frame.getCPtr(frame), DescriptorMatchVector.getCPtr(matches), radius);
     if (solar_api_featuresPINVOKE.SWIGPendingException.Pending)
     {
         throw solar_api_featuresPINVOKE.SWIGPendingException.Retrieve();
     }
     return(ret);
 }
Ejemplo n.º 16
0
 public virtual void draw(Image image, Image outImage, Point2DfArray points_image1, Point2DfArray points_image2, DescriptorMatchVector matches)
 {
     solar_api_displayPINVOKE.IMatchesOverlay_draw__SWIG_4(swigCPtr, Image.getCPtr(image), Image.getCPtr(outImage), Point2DfArray.getCPtr(points_image1), Point2DfArray.getCPtr(points_image2), DescriptorMatchVector.getCPtr(matches));
     if (solar_api_displayPINVOKE.SWIGPendingException.Pending)
     {
         throw solar_api_displayPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 17
0
        public FiducialPipeline(IComponentManager xpcfComponentManager) : base(xpcfComponentManager)
        {
            binaryMarker = Create <IMarker2DSquaredBinary>("SolARMarker2DSquaredBinaryOpencv");

#if !NDEBUG
            imageViewer                 = Create <IImageViewer>("SolARImageViewerOpencv");
            imageViewerGrey             = Create <IImageViewer>("SolARImageViewerOpencv", "grey");
            imageViewerBinary           = Create <IImageViewer>("SolARImageViewerOpencv", "binary");
            imageViewerContours         = Create <IImageViewer>("SolARImageViewerOpencv", "contours");
            imageViewerFilteredContours = Create <IImageViewer>("SolARImageViewerOpencv", "filteredContours");
#endif
            overlay3DComponent = Create <I3DOverlay>("SolAR3DOverlayOpencv");

            imageFilterBinary          = Create <IImageFilter>("SolARImageFilterBinaryOpencv");
            imageConvertor             = Create <IImageConvertor>("SolARImageConvertorOpencv");
            contoursExtractor          = Create <IContoursExtractor>("SolARContoursExtractorOpencv");
            contoursFilter             = Create <IContoursFilter>("SolARContoursFilterBinaryMarkerOpencv");
            perspectiveController      = Create <IPerspectiveController>("SolARPerspectiveControllerOpencv");
            patternDescriptorExtractor = Create <IDescriptorsExtractorSBPattern>("SolARDescriptorsExtractorSBPatternOpencv");

            patternMatcher   = Create <IDescriptorMatcher>("SolARDescriptorMatcherRadiusOpencv");
            patternReIndexer = Create <ISBPatternReIndexer>("SolARSBPatternReIndexer");

            img2worldMapper = Create <IImage2WorldMapper>("SolARImage2WorldMapper4Marker2D");
            PnP             = Create <I3DTransformFinderFrom2D3D>("SolARPoseEstimationPnpOpencv");
#if !NDEBUG
            overlay2DContours = Create <I2DOverlay>("SolAR2DOverlayOpencv", "contours");
            overlay2DCircles  = Create <I2DOverlay>("SolAR2DOverlayOpencv", "circles");
#endif

            greyImage   = SharedPtr.Alloc <Image>().AddTo(subscriptions);
            binaryImage = SharedPtr.Alloc <Image>().AddTo(subscriptions);

            contours                      = new Contour2DfArray().AddTo(subscriptions);
            filtered_contours             = new Contour2DfArray().AddTo(subscriptions);
            patches                       = new ImageList().AddTo(subscriptions);
            recognizedContours            = new Contour2DfArray().AddTo(subscriptions);
            recognizedPatternsDescriptors = new DescriptorBuffer().AddTo(subscriptions);
            markerPatternDescriptor       = new DescriptorBuffer().AddTo(subscriptions);
            patternMatches                = new DescriptorMatchVector().AddTo(subscriptions);
            pattern2DPoints               = new Point2DfArray().AddTo(subscriptions);
            img2DPoints                   = new Point2DfArray().AddTo(subscriptions);
            pattern3DPoints               = new Point3DfArray().AddTo(subscriptions);
            //CamCalibration K;

            // components initialisation
            binaryMarker.loadMarker().Check();
            patternDescriptorExtractor.extract(binaryMarker.getPattern(), markerPatternDescriptor).Check();
            var binaryMarkerSize = binaryMarker.getSize();

            var patternSize = binaryMarker.getPattern().getSize();

            patternDescriptorExtractor.BindTo <IConfigurable>().getProperty("patternSize").setIntegerValue(patternSize);
            patternReIndexer.BindTo <IConfigurable>().getProperty("sbPatternSize").setIntegerValue(patternSize);

            // NOT WORKING ! initialize image mapper with the reference image size and marker size
            var img2worldMapperConf = img2worldMapper.BindTo <IConfigurable>();
            img2worldMapperConf.getProperty("digitalWidth").setIntegerValue(patternSize);
            img2worldMapperConf.getProperty("digitalHeight").setIntegerValue(patternSize);
            img2worldMapperConf.getProperty("worldWidth").setFloatingValue(binaryMarkerSize.width);
            img2worldMapperConf.getProperty("worldHeight").setFloatingValue(binaryMarkerSize.height);
        }