Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Intel RealSense ID Face recognition callback
Forum Updated to NodeBB v4.3 + New Features

Intel RealSense ID Face recognition callback

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 258 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    addebito
    wrote on last edited by
    #1

    Hi all,
    I'm playing with the Intel Real Sense ID SDK for face recognition.
    https://www.intelrealsense.com/facial-authentication/

    I'm trying to integrate in a QT widget application but when I have to call the authentication procedure I have to pass a "callback class" like this:

    RealSenseID::FaceAuthenticator authenticator;
    auto status = authenticator.Connect({"COM9"});
    if (status == RealSenseID::Status::Ok)
    {
        MyAuthClbk auth_clbk;
        authenticator.Authenticate(auth_clbk); // <-- I HAVE TO PASS THE CALLBACK
    }
    

    and this is the callback class

    class MyAuthClbk : public RealSenseID::AuthenticationCallback
    {
    public:
        void OnResult(const RealSenseID::AuthenticateStatus status, const char* user_id) override
        {
            if (status == RealSenseID::AuthenticateStatus::Success)
                std::cout << "Authenticated " << user_id << std::endl;
        }
    
        void OnHint(const RealSenseID::AuthenticateStatus hint) override
        {
            std::cout << "OnHint " << hint << std::endl;
        }
    
        void OnFaceDetected(const std::vector<RealSenseID::FaceRect>& faces, const unsigned int ts) override
        {
            for (auto& face : faces)
            {
                printf("** Detected face %u,%u %ux%u (timestamp %u)\n", face.x, face.y, face.w, face.h, ts);
            }
        }
    };
    

    When the callback is invoked how do I call my QT object or window by signal?
    Eg. instead the line

     std::cout << "Authenticated " << user_id << std::endl;
    

    I want to call a signal with a QString of the user id
    Thank you for any suggestion...

    JonBJ 1 Reply Last reply
    0
    • A addebito

      Hi all,
      I'm playing with the Intel Real Sense ID SDK for face recognition.
      https://www.intelrealsense.com/facial-authentication/

      I'm trying to integrate in a QT widget application but when I have to call the authentication procedure I have to pass a "callback class" like this:

      RealSenseID::FaceAuthenticator authenticator;
      auto status = authenticator.Connect({"COM9"});
      if (status == RealSenseID::Status::Ok)
      {
          MyAuthClbk auth_clbk;
          authenticator.Authenticate(auth_clbk); // <-- I HAVE TO PASS THE CALLBACK
      }
      

      and this is the callback class

      class MyAuthClbk : public RealSenseID::AuthenticationCallback
      {
      public:
          void OnResult(const RealSenseID::AuthenticateStatus status, const char* user_id) override
          {
              if (status == RealSenseID::AuthenticateStatus::Success)
                  std::cout << "Authenticated " << user_id << std::endl;
          }
      
          void OnHint(const RealSenseID::AuthenticateStatus hint) override
          {
              std::cout << "OnHint " << hint << std::endl;
          }
      
          void OnFaceDetected(const std::vector<RealSenseID::FaceRect>& faces, const unsigned int ts) override
          {
              for (auto& face : faces)
              {
                  printf("** Detected face %u,%u %ux%u (timestamp %u)\n", face.x, face.y, face.w, face.h, ts);
              }
          }
      };
      

      When the callback is invoked how do I call my QT object or window by signal?
      Eg. instead the line

       std::cout << "Authenticated " << user_id << std::endl;
      

      I want to call a signal with a QString of the user id
      Thank you for any suggestion...

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @addebito said in Intel RealSense ID Face recognition callback:

      When the callback is invoked how do I call my QT object or window by signal?

      I want to call a signal with a QString of the user id

      I don't really understand what you are asking for, perhaps someone else will do so better. But if it helps: you "raise"/"call" a signal in Qt via emit, like emit someSignal(something) or someObject->emit(something). You can only pass, say, a QString as a parameter if the signal has been defined to take that parameter. You cannot change the inbuilt Qt signals' parameters to something they don't expect, just because you feel like doing so. But you can write your own signals if you wish.

      1 Reply Last reply
      0
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by VRonin
        #3

        C++ allows multiple inheritance:
        class MyAuthClbk : public QObject, public RealSenseID::AuthenticationCallback

        Now you can define and emit signals from the callback class (don't forget the Q_OBJECT macro)

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        6
        • A Offline
          A Offline
          addebito
          wrote on last edited by
          #4

          Thank you @JonB , thank you @VRonin.

          I know about the multiple inheritance in C++, but in the past I used it on my classes w/o mixing "my object" and QObject.
          I'll try.

          Thanks again for your fast reply.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved