Click here to Skip to main content
15,888,121 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Im having problems of making rectangle in aforge blobcountingobjectprocessing.
the motion is detected however it does not draw rectangle when moving.
hope anyone can give me some advice.
this is the code im trying to work so far

video = (Bitmap)eventArgs.Frame.Clone();
            
            if (pix > 0.02)
            {
             
                if (motionProcessing.ObjectsCount > 1)
                {
                    motionProcessing.MinObjectsHeight = 10;
                    motionProcessing.MinObjectsWidth = 10;  
                    Rectangle[] rects = motionProcessing.ObjectRectangles;

                    if (rects.Length > 0)
                    {
                        Graphics graphic = Graphics.FromImage(video);
                        Rectangle objec = rects[0];
       
                        using (Pen pen = new Pen(Color.White, 3))
                        {
                            graphic.DrawRectangle(pen, objec);
                            PointF drawPoin = new PointF(objec.X, objec.Y);
                            String widthofimage = "width: " + objec.Width.ToString();
                            String heightofimage = "height: " + objec.Height.ToString();
                            callsetFrmtext(label1, label2, widthofimage, heightofimage);
                            
                        }
                   }

                        
                }
            }
            else
            {
           
                callsetFrmtext(label1, label2, Convert.ToString(0), Convert.ToString(0));
            }
            pix = motiondetector.ProcessFrame(video);


What I have tried:

i've tried using blobcounter and colorfiltering and it works but in this problem
blobcountingobjectprocessing is not working for me.
anyone please help :(
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900