Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 .NET4
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;
        }
Posted 21-Apr-12 0:28am
Edited 21-Apr-12 0:33am
Mehdi Gholam253.4K
v2

1 solution

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

  Print Answers RSS
0 OriginalGriff 400
1 Jochen Arndt 200
2 Richard MacCutchan 135
3 DamithSL 95
4 Maciej Los 95
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 21 Apr 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100