Face Detection on Advantech AIIS-1200P and most x64 Windows systems

This guide shows you how easy it is to create a face-detection programm on a x64 Windows machine like Advantech's AIIS-1200P


In this short guide I will show you how easy it is to create a face detection script with OpenCV and Python 3 on a WIndows x64 mashine like the Advantech AIIS-1200P.


  1. This Guide will use a Basler Dart camera. If you prefer any other Camera brand, make sure you have a proper alternative to Pylons Python interface to get images as a Numpy array.
  2. Before you start with this guide you will need to have OpenCV 3, Numpy and PyPylon up and running. Therefore follow this guide:
    From Zero to Python OpenCV 3 on Windows x64

Camera setup

In the following snippet you can see how to setup a Basler camera within Python. Basically you can edit the same things like described in the C++ documentation of Pylon. This is just a minor demonstration.

# Simply get the first available pylon device.
first_device = py.TlFactory.GetInstance().CreateFirstDevice()
instant_camera = py.InstantCamera(first_device)

# You can change settings like this also in the Pylon Viewer and save them to the default profile.
instant_camera.PixelFormat = "RGB8"


Face recognition

Now its time to use some very easy OpenCV to recognise faces. We will create a loop for this, which permanently will grab new camera images, find and mark faces in it, and finally show the result.

while True:
    # Update current image in video window.
    # Grab one image.
    img = np.zeros((1, 1))
    if instant_camera.NumReadyBuffers:
        res = instant_camera.RetrieveResult(1000)
        if res:
                if res.GrabSucceeded():
                    currImg = res.Array

    faces = face_cascade.detectMultiScale(currImg, 1.3, 5)
    for (x, y, w, h) in faces:
        cv2.rectangle(currImg, (x, y), (x + w, y + h), (255, 0, 0), 2)

    # Display new image in video window.
    cv2.imshow('Video', currImg)
    # Wait 1 ms.


You can find the Sample Code on Github.


GitHub Repository



Back to top

Your comments, please!

Want to comment this ... Show more