ImagePro>Re: using IpBlbGet(GETPOINTS)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ImagePro>Re: using IpBlbGet(GETPOINTS)



John,

As I indicated in my last email, your problem is simply that you are not
closing the annotation objects.  Please look for the line surrounded by
stars that I have added to your macro:

Sub TransferOutlines()

	Dim Outline(10000) As POINTAPI
	Dim nObjects As Integer
	Dim i As Integer
	Dim numPoints As Integer

	ret = IpAppSelectDoc(0)
	ret = IpBlbGet(GETNUMOBJ, 0, 0, nObjects)

	For i = 0 To nObjects - 1

		ret = IpAppSelectDoc(0)
		numPoints = IpBlbGet(GETPOINTS, i, 1000, Outline(0))
		ret = IpAppSelectDoc(1)
		ret = IpAnCreateObj(GO_OBJ_POLY)
		ret = IpAnPolyAddPtArray(Outline(0), numPoints)
		ret = IpAnSet(GO_ATTR_PENWIDTH, 1)
		ret = IpAnSet(GO_ATTR_PENCOLOR, 255)
		'*****************************************************
		ret = IpAnSet(GO_ATTR_CONNECT,1)
		'*****************************************************
	Next i

End Sub

Chris Tully
Senior Technical Services Engineer and Quality Assurance Analyst
Media Cybernetics, Inc. "From Images to Answers"
8484 Georgia Avenue, Suite 200
Silver Spring, MD  20910
Tel: +1 (301) 495-3305 ext. 3            Fax: +1 (301) 495-5964
E-mail: TechSupport@mediacy.com
Media Cybernetics Website: www.mediacy.com
Media Cybernetics Solutions Zone: www.solutions-zone.com


-----Original Message-----
From: Image-Pro Plus Users Email List
[mailto:imagepro-users@lists.mediacy.com]On Behalf Of John McLaughlin
Sent: Friday, November 30, 2001 1:36 PM
To: Image-Pro Plus Users Email List
Subject: ImagePro>Re: using IpBlbGet(GETPOINTS)


thanks for the quick reply stan but no that's not it.  i should
have just included all the code as I'm using it.

Sub TransferOutlines()

Dim Outline(10000) As POINTAPI
Dim nObjects As Integer
Dim i As Integer
Dim numPoints As Integer

ret = IpAppSelectDoc(0)
ret = IpBlbGet(GETNUMOBJ, 0, 0, nObjects)

For i = 0 To nObjects - 1

     ret = IpAppSelectDoc(0)
     numPoints = IpBlbGet(GETPOINTS, i, 1000, Outline(0))
     ret = IpAppSelectDoc(1)
     ret = IpAnCreateObj(GO_OBJ_POLY)
     ret = IpAnPolyAddPtArray(Outline(0), numPoints)
     ret = IpAnSet(GO_ATTR_PENWIDTH, 1)
     ret = IpAnSet(GO_ATTR_PENCOLOR, 255)

Next i

End Sub


----- Original Message -----
From: "Stan Voynick" <svoynick@selmar.com>
To: "Image-Pro Plus Users Email List" <imagepro-users@lists.mediacy.com>
Sent: Friday, November 30, 2001 10:22 AM
Subject: ImagePro>Re: using IpBlbGet(GETPOINTS)


> John:
>
> Note that when the IpBlbGet() call puts the points into the array, you
> are pointing it to put the first point into Outline(0), right?  But then
> when you print them out, you are starting your "For" loop at location
> Outline(1), since your variable "i" starts at the value 1.  What's
> happening is that you are losing the *first* point by not printing it
> out, and then you print an extra, uninitialized point from your array
> that doesn't have any data in it - that's where the (0,0) at the end
> comes from.
>
> Try changing the following line:
>
>    For i = 1 To numPoints
>
> to:
>
>    For i = 0 To (numPoints-1)
>
> and see if that shows you all of the points you expect.  This is a
> common sticky point in programming - in a given situation, do you start
> counting from zero or one?
>
> Now, as far as drawing the outline on another image, you have to realize
> that you need to "close" your polygon at the end.  Here's an example of
> what I mean.  If I tell you that I have a square with four corners, A,
> B, C, and D, and I tell you to draw it by putting your pencil down at
> the first point in the list, and then moving it to each subsequent point
> in the list like this:
>
> A  to  B  to  C  to  D,
>
> ...then you'll find you've drawn three lines and left "open" the fourth
> side of the square, right?  You need to put point "A" again at the end
> of the list, so that your drawing instructions look like this:
>
> A  to  B  to  C  to  D  to  A
>
> ... and now you'll draw the full square.
>
> To modify your code to accomplish this, I'd try:
>
> ##############################################################
> ret = IpAppSelectDoc(0)
> numPoints = IpBlbGet(GETPOINTS, i, 1000, Outline(0))
>
> ' at this point, the last point is in location (numPoints-1)
> ' so add the first point again to the end of the list
>
> Outline(NumPoints) = Outline(0)
>
> ret = IpAppSelectDoc(1)
> ret = IpAnCreateObj(GO_OBJ_POLY)
>
> ' make sure you tell it to plot the extra point that we added
> ret = IpAnPolyAddPtArray(Outline(0), numPoints+1)
>
> ret = IpAnSet(GO_ATTR_PENWIDTH, 1)
> ret = IpAnSet(GO_ATTR_PENCOLOR, 255)
> ##############################################################
>
>
> I'll warn you that I haven't tested this code to see if I made any
> mistakes here - I'm just tossing it off the top of my head - but this
> gives you the basic idea...
>
> Regards,
>
>    - Stan Voynick -
>
> --
> ------------------------------------------------------------------
>
>
>
> > John McLaughlin wrote:
> >
> > hi all,
> >
> > i've encountered a problem where if i try to take the outlines
> > from one
> > image and draw them on a different image the last point of each
> > outline is
> > always missing.  this is the code i'm using.
> >
> >
> > ret = IpAppSelectDoc(0)
> > numPoints = IpBlbGet(GETPOINTS, i, 1000, Outline(0))
> > ret = IpAppSelectDoc(1)
> > ret = IpAnCreateObj(GO_OBJ_POLY)
> > ret = IpAnPolyAddPtArray(Outline(0), numPoints)
> > ret = IpAnSet(GO_ATTR_PENWIDTH, 1)
> > ret = IpAnSet(GO_ATTR_PENCOLOR, 255)
> >
> > if i use some code to look at the points the last pair in each outline
> > is always 0, 0.
> >
> >  Debug.Print numpoints
> >  For i = 1 To numPoints
> >      Debug.Print Outline(i).x
> >      Debug.Print outline(i).y
> >  Next i
> >
> > Any suggestions?
> >
> > thanks,
> > John McLaughlin
> > Rigel, Inc.
> > 240 East Grand Avenue
> > South San Francisco, CA
> > 94080
>
> ***********************************************************
> Need an Image-Pro macro or driver? Find it at
http://www.Solutions-Zone.com
> Got an Image-Pro macro or driver? Add it to http://www.Solutions-Zone.com
> ***********************************************************
>
> This message is sent to you because you are subscribed to
<imagepro-users@lists.mediacy.com>.
> To unsubscribe, email to: <imagepro-users-off@lists.mediacy.com>
> To switch to the DIGEST mode, email to
<imagepro-users-digest@lists.mediacy.com>
> To switch to the INDEX mode, email to
<imagepro-users-index@lists.mediacy.com>
> Send administrative queries to  <imagepro-users-request@lists.mediacy.com>
> To subscribe or unsubscribe visit
http://www.solutions-zone.com/ipednld/subscriber.asp


***********************************************************
Need an Image-Pro macro or driver? Find it at http://www.Solutions-Zone.com
Got an Image-Pro macro or driver? Add it to http://www.Solutions-Zone.com
***********************************************************

This message is sent to you because you are subscribed to
<imagepro-users@lists.mediacy.com>.
To unsubscribe, email to: <imagepro-users-off@lists.mediacy.com>
To switch to the DIGEST mode, email to
<imagepro-users-digest@lists.mediacy.com>
To switch to the INDEX mode, email to
<imagepro-users-index@lists.mediacy.com>
Send administrative queries to  <imagepro-users-request@lists.mediacy.com>
To subscribe or unsubscribe visit
http://www.solutions-zone.com/ipednld/subscriber.asp


***********************************************************
Need an Image-Pro macro or driver? Find it at http://www.Solutions-Zone.com
Got an Image-Pro macro or driver? Add it to http://www.Solutions-Zone.com
***********************************************************

This message is sent to you because you are subscribed to <imagepro-users@lists.mediacy.com>.
To unsubscribe, email to: <imagepro-users-off@lists.mediacy.com>
To switch to the DIGEST mode, email to <imagepro-users-digest@lists.mediacy.com>
To switch to the INDEX mode, email to <imagepro-users-index@lists.mediacy.com>
Send administrative queries to  <imagepro-users-request@lists.mediacy.com>
To subscribe or unsubscribe visit http://www.solutions-zone.com/ipednld/subscriber.asp



Search this Archive