Is there a way to learn both the CLASS and the ID for a BLOB clicked on by the USER?
All --
The IMAGE-PRO PLUS SUBROUTINE below will return the ID for the BLOB that is clicked on by the user.
If there is more than one CLASS within the COUNT / SIZE, there can be more than one BLOB with the same ID.
Is there a way to learn both the CLASS and the ID for a BLOB clicked on by the USER?
Thanks.
-- Matt
********************************************************************
Sub zzz()
'Declare required variables
Dim MyPoint1 As POINTAPI
Dim MyDocID1 As Integer
Dim MyBlobID1 As Long
Debug.Print Now
'Ask the user to select an object on the original image
MyDocID1 = _
IpDocClick _
( _
"Please CLICK within the INCLUSIONS you want to" & _
vbCr & vbCr & _
"ACCEPT" & _
vbCr & vbCr & _
"Press CONTINUE to complete this operation!", _
MyPoint1 _
)
Debug.Print "MyDocID1 = " & Str(MyDocID1)
'Determine which blob the point was within
MyBlobID1 = IpBlbHitTest (MyPoint1.X, MyPoint1.Y)
Debug.Print "MyBlobID1 = " & Str(MyBlobID1)
'Error trap
If ( Not(MyDocID1 > -1 And MyBlobID1 > -1) ) Then
'Jump to the end of the subroutine
GoTo MYENDER
End If
MYENDER:
End Sub
The IMAGE-PRO PLUS SUBROUTINE below will return the ID for the BLOB that is clicked on by the user.
If there is more than one CLASS within the COUNT / SIZE, there can be more than one BLOB with the same ID.
Is there a way to learn both the CLASS and the ID for a BLOB clicked on by the USER?
Thanks.
-- Matt
********************************************************************
Sub zzz()
'Declare required variables
Dim MyPoint1 As POINTAPI
Dim MyDocID1 As Integer
Dim MyBlobID1 As Long
Debug.Print Now
'Ask the user to select an object on the original image
MyDocID1 = _
IpDocClick _
( _
"Please CLICK within the INCLUSIONS you want to" & _
vbCr & vbCr & _
"ACCEPT" & _
vbCr & vbCr & _
"Press CONTINUE to complete this operation!", _
MyPoint1 _
)
Debug.Print "MyDocID1 = " & Str(MyDocID1)
'Determine which blob the point was within
MyBlobID1 = IpBlbHitTest (MyPoint1.X, MyPoint1.Y)
Debug.Print "MyBlobID1 = " & Str(MyBlobID1)
'Error trap
If ( Not(MyDocID1 > -1 And MyBlobID1 > -1) ) Then
'Jump to the end of the subroutine
GoTo MYENDER
End If
MYENDER:
End Sub
0
Best Answer
-
Yuri --
Thank you for your prompt response and for the example code.
I don't think this addresses the issue though.
If I have an image with 25 objects in RANGE 1 and 25 objects in RANGE 2, then I can have:
** 2 objects with ID 1
** 2 objects with ID 2
.
.
.
** 2 objects with ID 25
If I use
IpBlbHitTest
as shown in SUBROUTINE ZZZ, IPP7 will give me the
DOC ID
and
OBJ ID
for a clicked on object but I do not know which of the two possible objects with the ID has been clicked.
The only way I see to do this is to strip out the RANGE 1 objects into IMAGE 1 and strip out the RANGE 2 objects into IMAGE 2 and then perform the
IpBlbHitTest
within IMAGES 1 and 2 and find out which IMAGE / RANGE returns the
DOC ID
and
OBJ ID
If you can think of a more elegant way to do this, it would be much appreciated.
Thanks.
-- Matt
0
Answers
There is BLBM_SRANGE measurement that returns object range. You can look at IpBlbGet page of Auto-Pro help that has a sample macro showing how to get range and id of the object.
Here is the sample macro:
Yuri