Image Histogram
Hi,
I need to get the image histogram info (RGB image).
I tried this code
I need to get the image histogram info (RGB image).
I tried this code
'---------------------------------------------------------------------- Dim hist As MediaCy.IQL.Operations.McHistogram = ImEmpty.Histogram Dim dMedia As Double = hist.Mean <---- Error Type mismatch (10080) Dim dMinimo As Double = hist.Min<---- Error Type mismatch (10080) Dim dMassimo As Double =hist.Max<---- Error Type mismatch (10080) Dim dStdDev As Double = hist.StdDev<---- Error Type mismatch (10080) Dim dModa As Double = hist.Mode<---- Error Type mismatch (10080) '---------------------------------------------------------------------- NOTE ImEmpty is a McImage instance According to the IQL reference the Mean is a double parameter In case of AOI presence on the image should I use the region access method ( some think similar at the follow code)? Dim ra As McRegionAccess=ImEmpty.CreateRegionAccess()If yes which is the correct sintax to be used ? Thank you Maurizio
ra.RegionMask=ImEmpty.Aoi'process only active ROI
0
Answers
-
Hi Maurizio,
If image is color, the Mean will be an array of values for every channel:Public Sub TestHist Dim hist As MediaCy.IQL.Operations.McHistogram = ThisApplication.ActiveImage.Histogram Dim dMedia As Double() = hist.Mean Debug.Print ThisApplication.GlobalTools.McToText(dMedia).Value End Sub
If you don't know what output type is, I recommend using Object :
Public Sub TestHist2 Dim hist As MediaCy.IQL.Operations.McHistogram = ThisApplication.ActiveImage.Histogram Dim dMedia As Object = hist.Mean Debug.Print ThisApplication.GlobalTools.McToText(dMedia).Value End Sub
Regards,
Yuri0 -
Regarding ROI: histogram always uses ROI boundaries by default, so you don't have to do anything.
Yuri0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions