Rank: Member
Groups: Guest
Joined: 11/5/2007(UTC) Posts: 3
|
I tried converting this function up to VB .NET but it doesn't seem to want to work.. so many references seem to have changed since the version that this code was made for: http://www.aurigma.com/Forums/Topic62-3-1.aspxCould someone possibly provide a .NET version of this? Thanks!
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello, API of Graphics Mill for .NET is not fully compatible with Graphics Mill for ActiveX. The main concept of algorithm is correct but there should be changes in code lines for getting histogram. In .NET version you should use Bitmap.Statistics.GetSumHistogram(Int32). Please, try it out. Edited by user Monday, February 25, 2008 6:37:14 PM(UTC)
| Reason: Not specified |
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 1/31/2005(UTC) Posts: 458
Was thanked: 5 time(s) in 5 post(s)
|
Hi, Here is an equivalent of the mentioned ActiveX sample: Code:'Loading source image
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("x:/tests/Rgb24.jpg")
bv.Bitmap = bitmap
'Get histogram for each channel to calculate average
'intensity of an appropriate channel.
Dim histogram As Aurigma.GraphicsMill.Histogram
Dim avgRed, avgGreen, avgBlue As Integer
histogram = bitmap.Statistics.GetSumHistogram(Aurigma.GraphicsMill.ColorChannel.Red)
avgRed = System.Math.Round(histogram.Mean)
histogram.Dispose()
histogram = bitmap.Statistics.GetSumHistogram(Aurigma.GraphicsMill.ColorChannel.Green)
avgGreen = System.Math.Round(histogram.Mean)
histogram.Dispose()
histogram = bitmap.Statistics.GetSumHistogram(Aurigma.GraphicsMill.ColorChannel.Blue)
avgBlue = System.Math.Round(histogram.Mean)
histogram.Dispose()
'After we calculate average intensities of each channel,
'combine them into one RGB color.
Dim color As Aurigma.GraphicsMill.Color = Aurigma.GraphicsMill.Color.FromRgb(avgRed, avgGreen, avgBlue)
'Display this color. Let's draw the square 30x30 filled with average color
'we calculated.
Dim g As Aurigma.GraphicsMill.Drawing.GdiGraphics = bitmap.GetGdiGraphics()
Try
Dim brush As New Aurigma.GraphicsMill.Drawing.SolidBrush(color)
g.FillRectangle(brush, 0, 0, 100, 100)
Finally
g.Dispose()
End Try
Edited by user Monday, December 17, 2007 9:47:35 AM(UTC)
| Reason: Not specified |
|
|
|
|
Rank: Member
Groups: Guest
Joined: 11/5/2007(UTC) Posts: 3
|
Great! That works just fine. Now, I've dug up another 'classic' from your forums: http://www.aurigma.com/Forums/Topic77-3-1.aspxThis one doesn't seem to be .NET 2.0, would it be possible to have this one in the latest format? Thanks a lot.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 1/31/2005(UTC) Posts: 458
Was thanked: 5 time(s) in 5 post(s)
|
Hello, You can find the updated version of the sample in this topic. |
|
|
|
|
Forum Jump
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.