7 Replies Latest reply on Mar 21, 2017 2:52 AM by MartyG

    Object detection(RSSDK R2,Unity,PC Standalone)


      I'm trying to figure out how the object detection feature works .

      I added object detected event in SendMessageAction and then i set "Tracker 2D Path" to something like "C:\Users\Administrator\Pictures\aaa.png" or "Assets\resources\aaa.png", infinite errors came during runtime with the same message :


      Cannot set 2D image. Make sure it is a valid image (png)


      RSUnityToolkit.ObjectDetectedRule:Process(Trigger) (at Assets/RSUnityToolkit/Internals/Rules/ObjectDetectedRule.cs:110)

      RSUnityToolkit.Trigger:ProcessRules() (at Assets/RSUnityToolkit/Internals/Triggers/Trigger.cs:178)

      BaseAction:ProcessAllTriggers() (at Assets/RSUnityToolkit/Internals/Actions Utils/BaseAction.cs:278)

      SendMessageAction:Update() (at Assets/RSUnityToolkit/Actions/SendMessageAction.cs:52)


      anyone knows what's the right value i should set ?

        • 1. Re: Object detection(RSSDK R2,Unity,PC Standalone)
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello jxy0724,

          Thanks for reaching out!

          First, I would like to ask you which camera you are using. Are you using an R200? As you can see at https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?doc_or_object_recognition.html, object recognition is only present for the R200 (and as a preview, so results may vary, especially if you consider that in the R3 SDK this feature was removed), so if you are using a different camera this might explain some issues.

          Nevertheless, what confuses me is that you mention that you are selecting a picture. This makes me think that you might not be using the object recognition feature. If that is the case, could you please clarify me which feature you are using?

          We will be waiting for your response.
          Pedro M.

          • 2. Re: Object detection(RSSDK R2,Unity,PC Standalone)

            I'm using SR300 and sorry it's 2D Object Tracking not Object Recognition

            • 3. Re: Object detection(RSSDK R2,Unity,PC Standalone)
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              I understand, thank you for clarifying. Did you make sure to configure the Object Tracking as explained at https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?doc_ot_configuration_and_tracking_dat.html ?

              In case you haven't, I'd suggest you to check the link and see if you are doing anything different and if this helps you.
              Pedro M.

              • 4. Re: Object detection(RSSDK R2,Unity,PC Standalone)

                I'm doing it like just Sample 7 given in RSUnityToolkit . I found the real problem is that the 3D object , the same message appears when i was trying to get Tracking Action work too . Which GameObject the Tracking Action script attached to must be like the cube in the example , it only has a mesh filter and Tracking Action script , the real 3D object is its child . Why is is so weird ... ?

                • 5. Re: Object detection(RSSDK R2,Unity,PC Standalone)

                  I had a look at the object tracking function in TrackingAction (I think I've only used it once since RealSense was launched, so was unfamiliar with it).  There's a lack of documentation for the object tracking aspect, so that made things tricky.  It looks like you were doing the right thing in pointing it to a file location outside of Unity.


                  It is a little misleading that the message says "Make sure it is a valid image (png)", since the Object Tracking sample's location address points to a jpg file  *smiles*  My tests found that it would work without the error if you used either jpg or png.


                  Another test found that leaving the location box blank generates that error message, as does putting in a location address that Unity cannot recognize as having a valid image file.  There is a way to ensure that you get the location address in a format that Unity will accept.


                  STEP ONE

                  Go to the folder that your image is stored in.


                  STEP TWO

                  Left-click on the whitespace in the folder address bar to the right of the address.  This will cause Windows to automatically change the address into a more formal drive location.



                  STEP THREE

                  Copy the address and paste it into the 2D path box in the TrackingAction in Unity.



                  STEP FOUR

                  Manually write the image file's name, including its extension (e.g .jpg) into the box at the end of the location address.



                  STEP FIVE

                  Run the program.  If all is well, the "Make sure it is a valid image (png) message should no longer appear.  If it works, try the same process with the SendMessageAction component.

                  • 6. Re: Object detection(RSSDK R2,Unity,PC Standalone)

                    Thank you for the detailed steps .

                    But it's not the path ... I spent hours trying and I finally got it right . I found out it's "Quality Thershold" , I left it blank and that's why . It seems the error message is not very accurate .


                    • 7. Re: Object detection(RSSDK R2,Unity,PC Standalone)

                      Glad you found a solution!    The nature of Unity is that once it finds a problem that it trips up over then it can cause other errors because the script was stopped running before it could complete, and so other necessary functions are prevented from running until the problem is fixed.  You can therefore get errors about things that are not actually broken, because the script did not have the opportunity to reach the part of the code where it could run the instructions it needs to. 


                      Debugging is funfun!