Page 1 of 1

[Solved]ExtractBlobsImage can't extract blob.image to bitmap

PostPosted: Thu May 18, 2017 3:12 am
by counov
This is my code
Code: Select all
                Bitmap Ftemp = source.Clone() as Bitmap;
                FiltersSequence fseq = new FiltersSequence();
                fseq.Add(new Mean());
                fseq.Add(Grayscale.CommonAlgorithms.BT709);
                fseq.Add(new Threshold(150));
                fseq.Add(new Invert());
                Ftemp = fseq.Apply(Ftemp);

                BlobCounter bc = new BlobCounter();
                bc.FilterBlobs = true;
                bc.MinHeight = bc.MinWidth = 11;
                bc.MaxHeight = bc.MaxWidth = 47;
                bc.ProcessImage(Ftemp);
                Blob[] blobs = bc.GetObjectsInformation();
                debugmsg +="Got" + blobs.Length + " blob";
                bc.ExtractBlobsImage(Ftemp, blobs[0], false);
                Bitmap Btemp = blobs[0].Image.ToManagedImage();
                debugmsg += Btemp.Width + " " + Btemp.Height + "\r\n";

Uh.. It is working
I forget check Btemp null before I show it on picturebox