本文介绍了人体提取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友.
下面的代码我用来从摄像头图像中跟踪人体,但它无法准确地跟踪它,而且我还需要从摄像头图像中获取两个颈点的像素值.请帮助我.
谢谢
代码是..

hi friends.
below code i am using to track huaman body from webcam image.but it cannot accuratly track it and also i need to get pixel value of two neck points from webcam image.please help me.
thank you
the code is..

 Bitmap aq = (Bitmap)pbx_WebCam.Image.Clone();
           
            Invert a = new Invert();
            aq = a.Apply(aq);
            AForge.Imaging.Image.FormatImage(ref aq);

            /// apply grayscale
            IFilter filter = Grayscale.CommonAlgorithms.BT709;
            aq = filter.Apply(aq);

            Threshold th = new Threshold(230);
            aq = th.Apply(aq);
BlobCounter bl = new BlobCounter(aq);
            int i = bl.ObjectsCount;
            ExtractBiggestBlob fil2 = new ExtractBiggestBlob();
                 
            int x = 0, y = 0, h = 0,w=0;
            if (i > 0)
            {
                fil2.Apply(aq);
                x = fil2.BlobPosition.X;
                y = fil2.BlobPosition.Y;
                h = fil2.Apply(aq).Height;
                w = fil2.Apply(aq).Width;
   }
            System.Drawing.Bitmap bitmapsource = (Bitmap)pbx_WebCam.Image.Clone() ;
             Rectangle section = new Rectangle(new System.Drawing.Point(x , y ), new Size( 3*w, 3* h));
            Bitmap croppediamge = CropImage(bitmapsource, section);
 }
        public Bitmap CropImage(Bitmap source, Rectangle sect)
        {
            Bitmap bmp = new Bitmap(sect.Width, sect.Height);
            Graphics g = Graphics.FromImage(bmp);
            g.DrawImage(source, 0, 0, sect, GraphicsUnit.Pixel);


            return bmp;
        }

推荐答案


这篇关于人体提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 21:43