Recently Im trying to make a software who can detect multiple faces in the some time.

but not only faces. Eyes, Nose, mouth.
saw some vids in youtube but they show no code or how to do it, more the finished project.

What Im currently trying to do is, the software detect your face, eyes, mouth, nose.
Also detect if the person mood is angry, happy, normal etc.
with what I saw in youtube/google some of those people put points at special parts of the face (the program detect by it self)
and and check if the dots are upper than the normal the mood is happy, if are lower the person is sad.

How to do this?

Also Using OpenCV

Dani AI

Generated

Short, practical plan that fits what asked for (live camera, box that follows the face, plus eyes/nose/mouth and simple mood cues). is right that you must check frames continuously; ’s pointers to static-image tutorials are useful for learning the basics, but video needs detection + tracking and some engineering to be smooth.

Suggested pipeline:

  1. Grab frames from the camera at a modest resolution (320×240 or 640×480).
  2. Run a fast face detector on each frame (Haar/LBP for speed, or a DNN-based detector for robustness).
  3. For each detected face run a landmark/shape detector (68-point or similar) to locate eyes, nose, mouth.
  4. Between heavy detections use a tracker (KCF/CSRT/MOSSE or optical flow) so the rectangle follows the head without redetecting every frame.
  5. For “mood”, start with geometric rules on landmarks (mouth height/width ratio, eyebrow distance, eyelid opening) and then move to a small classifier (SVM/NN) if you need better accuracy. Smooth outputs over a short time window to avoid flicker.

Practical tips for VB.NET / OpenCV:

  • Use EmguCV or OpenCvSharp as the .NET bridge to OpenCV. Acquire frames with VideoCapture, convert to grayscale and equalize histogram before detection.
  • To improve speed: resize frames, limit minSize in the detector, detect every Nth frame and track the rest, and do detection on a background thread.
  • Tuning: reduce false positives by increasing minNeighbors and minSize; if boxes jitter, apply a simple exponential smoothing or a Kalman filter.

Tiny VB.NET / EmguCV sketch (detection + draw) — adapt to your UI and add landmark/tracker code as a next step:

' Requires Emgu.CV and a PictureBox named pic
Imports Emgu.CV
Imports Emgu.CV.Structure
Imports System.Drawing

Dim cap As New VideoCapture(0)
Dim faceCascade As New CascadeClassifier("haarcascade_frontalface_default.xml")

Sub ProcessFrame()
  Using mat = cap.QueryFrame()
    If mat Is Nothing OrElse mat.IsEmpty Then Return
    Dim img = mat.ToImage(Of Bgr, Byte)()
    Dim gray = img.Convert(Of Gray, Byte)()
    CvInvoke.EqualizeHist(gray, gray)
    Dim faces() As Rectangle = faceCascade.DetectMultiScale(gray, 1.1, 4, New Size(60,60), Size.Empty)
    For Each r In faces
      img.Draw(r, New Bgr(Color.Lime), 2)
    Next
    pic.Image = img.Bitmap
  End Using
End Sub

Start with detection + landmarking, then add a tracker and a tiny classifier for expressions. Expect lighting, pose and occlusion to be the hardest real-world problems.

Recommended Answers

All 6 Replies

no no Im trying to make something like.
your camera is open and you see a box in your face, when you move your face, the box moves too.

There are multiple topics on this in both languages you have posted this under on codeproject which I found in about 10 seconds using Google.

Why do you want to use OpenCV over some of the other libraries available?

wht other libraries can be used for this?

I know, but I want to follow a video tutorial or a good explanation how to do that, because the project wont be only for face detection, but eye and other part. and I want to learn how to do it, not just get it from someone else

does it work only when import photos?
because Im trying to make it with moving video camera.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.