Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, March 7, 2013 7:39:13 PM(UTC)


Groups: Registered
Posts: 3

I am trying to compare two regions within the same RasterImage and determine (on a relative basis) which has more or less black or white pixels. The regions will not be the same size. I basically want to sum the darker pixels and sum the lighter pixels and divide each by total pixels in the region. This will give a DarkerRatio and a LighterRatio that I can use to compare the regions of interest.

How exactly can I do this? The RasterImage.GetData() method returns a Byte Array, but I am not sure this is what I need. Can I use this? If so, how exactly? If not, what exactly do I need to do?

Some sample code would be helpful.

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, March 10, 2013 7:56:50 AM(UTC)


Groups: Registered, Tech Support
Posts: 179

Although you can get the pixel contents, there is a much easier approach.

You may use the HistogramCommand (which is region aware) to get the information about occurrence of each intensity value. See the following online help topic:

You can then sum the upper entries in the table to get the light pixels and sum the lower entries to get the dark pixels.

Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.176 seconds.