Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
zymm  
#1 Posted : Monday, November 5, 2007 4:52:22 AM(UTC)
zymm

Rank: Member

Groups: Member
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.aspx

Could someone possibly provide a .NET version of this?

Thanks!

Dmitry  
#2 Posted : Monday, November 5, 2007 2:20:01 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Member, Administration, Moderator
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

Sincerely yours,

Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!

Alex Kon  
#3 Posted : Tuesday, November 6, 2007 4:25:33 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups:
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

zymm  
#4 Posted : Tuesday, November 6, 2007 8:28:17 PM(UTC)
zymm

Rank: Member

Groups: Member
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.aspx

This one doesn't seem to be .NET 2.0, would it be possible to have this one in the latest format?

Thanks a lot.

Alex Kon  
#5 Posted : Thursday, November 8, 2007 6:31:19 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups:
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.

Users browsing 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.