OpenCV Simple Blob Detection

Trying to get the OPenCV for Unity asset to do simple blob detection on a web cam image. The examples all work great - but I can’t get it working on my own. Hoping someone has done some work with this asset and might now the problem.

This is my Update method - the blobDetector has been created in Start like so():

 blobDetector = FeatureDetector.create(FeatureDetector.SIMPLEBLOB);            
            blobDetector.read(Utils.getFilePath("blobparams.yml"));
void Update()
        {
            if (webCamTextureToMatHelper.isPlaying() && webCamTextureToMatHelper.didUpdateThisFrame())
            {
                webCamMat = webCamTextureToMatHelper.GetMat();

                Mat outImgMat = new Mat();

                MatOfKeyPoint keypoints = new MatOfKeyPoint();
              
                blobDetector.detect(webCamMat, keypoints);
               
                Features2d.drawKeypoints(webCamMat, keypoints, outImgMat);
              
                Texture2D texture = new Texture2D(outImgMat.cols(), outImgMat.rows(), TextureFormat.RGBA32, false);

                Utils.matToTexture2D(outImgMat, texture);

                gameObject.GetComponent<Renderer>().material.mainTexture = webCamTextureToMatHelper.GetWebCamTexture();
            }
        }

The problem is that keypoints has a size of 0x0 after the blobDetector.detect runs. I guess it’s not finding any blobs… but it should so I must be doing something wrong.

Got it. I had to convert the image from the webcam to grayscale before giving it to the blob detector.

Do you have this open source? Or have any problems using the current version of OpenCV for unity?

Sorry, but I haven’t used OpenCV / Unity for a while. Is it not working for you?

Im trying to use the modern version of OpenCV from the asset store and it does not contain any blob tracking examples just the class BlobTracking

hi gamersamer - did you ever get this working - I get an error on the SimpleBlobExample becasue Utils.getFilePath(“blobparams.yml”) returns nothing.

oh fixed that. didn’t take the streaming assets folder out into assets doh.