ImagePro>Re: IpBlbGet(GETRANGESTATS . . .)?


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

ImagePro>Re: IpBlbGet(GETRANGESTATS . . .)?



Brian,

The  GETRANGESTATS command has been added to IpBlbGet (as of v4.1 I
believe), but if you are asking for Count/Size data for two or more
different color ranges (i.e. red objects vs. Green objects), then you are
out of luck... Sort of.  I do have a macro that I could dig up and send out
that prompts a user to define or adjust 2 or more different color ranges,
and then splits the color ranges into multiple single ranges for the
purposes of knowing which color an object belongs to in the count data.
Alternatively, you count measure the mean density in the three channels
(RGB) and use those to discriminate objects, but that is MUCH more
difficult.

The one problem with my macro code is that it will sometimes create split
files that the Segmentation tool cannot read, for no apparent reason.
Anybody who wants this code can contact me direct at
mailto://cptully@mediacy.com and I will send it out under "use at your own
risk" conditions.

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 Anderson, Brian D
(AS)
Sent: Wednesday, December 12, 2001 3:15 PM
To: Image-Pro Plus Users Email List
Subject: ImagePro>IpBlbGet(GETRANGESTATS . . .)?


Hi,

  I was just wondering if this function has been added to image-pro.  I was
in need of obtaining the measurement statistics for different color ranges,
and was having problems.  I did a search on the list and found the
following.  I'd like to know if this has been added, and I missed it . . .
or if it is still being worked on.  Thanks . . . and a big thumbs up to this
list, and the searchable archive . . . they've come in very handy.

-Brian Anderson


Jean-Paul Martin" <jp@mediacy.com> writes:

Aryeh,

In IPP 4.0, the class number argument in IpBlbGet refers to the
classes found by the two measurement-based classification
functions in Count/Size: Auto-Classification and Single Variable
Classification. It does not refer to the intensity or color
range number.

For all its worth, IPP 4.0 allows you to display both the Range
Statistics table and the classification table. This was made
possible by separating the range number from the class number.
IPP 3.0 did not allow you to do so, and class numbers were
overwritten by range numbers when Range Statistics were
displayed.

Until we release a new version of IpBlbGet with a new command
(GETRANGESTATS) to get the range statistics, you can use Data
Collector as Lou suggested, or you can call the macro below (For
IPP4.0/IPBasic only):

Jean-Paul Martin.

Type BLOBSTATS
    Min As Single
    Max As Single
    Range As Single
    Sum As Single
    Mean As Single
    StdDev As Single
    tagmin As Integer
    tagmax As Integer
    Count As Integer
End Type

' Low level function called by IPP to get statistics.
' Declaration must remain on one single line.
Declare Function BlbControl& Lib "halblb32" (ByVal hblob%, ByVal
blbcmd%, ByVal objid%, ByVal lParam&, lpParam As Any)

' This function gets intensity range statistics
' rangeId: 0-based range number
' rstats: array of at least 9 singles
' return: 0 if success, -1 if failed
Function RangeStats(ByVal rangeId%, rstats!()) As Integer
  RangeStats = -1
  ' check there is a count and that rangeId is correct
  Dim numranges%
  ret = IpBlbGet(GETNUMRANGES, 0, 0, numranges)
  If RangeId < 0 Or RangeId >= numranges Then Exit Function
  ' set active range
  ret = IpBlbRange(rangeId)
  ' get blob environment for active range
  Dim hblob&
  ret = IpBlbGet(GETHBLOB, 0, 0, hblob)
  ' get stats
  Dim bstats As BLOBSTATS
  ret = BlbControl(hblob, 10, 0, 0, bstats)
  rstats(0) = bstats.Mean : rstats(1) = bstats.StdDev
  rstats(2) = bstats.Min : rstats(3) = bstats.Max
  rstats(4) = bstats.Range : rstats(5) = bstats.Sum
  rstats(6) = bstats.tagmin : rstats(7) = bstats.tagmax
  rstats(8) = bstats.Count
  ' reset active range
  ret = IpBlbRange(0)
  RangeStats = 0
End Function

' example macro using RangeStats()
Sub Get_Range_Stats()
  Dim stats(10) As Single
  ' ask stats for second range
  ret = RangeStats(1, stats)
  If ret < 0 Then Exit Sub
  ' display mean value
  Debug.Print stats(0)
  '...
End Sub

***********************************************************
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