Click here to Skip to main content
15,895,746 members

human body extracting

baskaran chellasamy asked:

Open original thread
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..
C#
 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;
        }
Tags: C# (C# 4.0), .NET4

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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