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

Notification

Icon
Error

Options
Go to last post Go to first unread
le capitaine  
#1 Posted : Tuesday, January 15, 2008 1:16:14 AM(UTC)
le capitaine

Rank: Newbie

Groups: Member
Joined: 1/15/2008(UTC)
Posts: 3

I've a problem to set a value to single channel of RGB. Please help me
Alex Kon  
#2 Posted : Tuesday, January 15, 2008 2:15:20 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello,

I hope this sample will help you:

Code:
Aurigma.GraphicsMill.Bitmap bmp = 
	new Aurigma.GraphicsMill.Bitmap("x:/24bppRgb.jpg");

//
// Channel of the 24bppRGB image should be 8bppGray. 
// Its dimensions should be equal 
// to the dimensions of the bitmap.
//
Aurigma.GraphicsMill.Bitmap channel = new Aurigma.GraphicsMill.Bitmap(
	Aurigma.GraphicsMill.RgbColor.Black,
	bmp.Width, 
	bmp.Height, 
	Aurigma.GraphicsMill.PixelFormat.Format8bppGrayScale);

// ... some channel data processing skipped ...

bmp.Channels[Aurigma.GraphicsMill.ColorChannel.Blue] = channel;
bmp.Save("y:/modifiedBlueChannel.jpg");

Please note, that you cannot change channel inplace via Bitmap.Channels[i] property because it returns copy of the requested data. If your task is to modify existing data you should write something like that:

Code:
Aurigma.GraphicsMill.Bitmap bmp = 
	new Aurigma.GraphicsMill.Bitmap("x:/allformats/24bppRgb.jpg");
Aurigma.GraphicsMill.Bitmap channel = 
	bmp.Channels[Aurigma.GraphicsMill.ColorChannel.Blue];

// ... some channel data processing skipped ...

bmp.Channels[Aurigma.GraphicsMill.ColorChannel.Blue] = channel;
bmp.Save("y:/modifiedBlueChannel.jpg");

le capitaine  
#3 Posted : Thursday, January 17, 2008 5:01:32 PM(UTC)
le capitaine

Rank: Newbie

Groups: Member
Joined: 1/15/2008(UTC)
Posts: 3

tanks alex... but in this way i can't change a single value of red , gree , blue...

see this code:

Code:
dim myChannels as ChannelBalance

Private Sub trackbarRed_MouseCaptureChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TrackBar1.MouseCaptureChanged

   'if isRGB
   myChannels(0)=sender.value/100
   ApplyTransform(mychannels)
End sub

Private Sub ApplyTransform(ByVal transform As BitmapTransform)
     AddHandler transform.Progress, AddressOf Me.bitmap_Progress
     transform.ApplyTransform(bitmapViewerMainView.Bitmap)
     RemoveHandler transform.Progress, AddressOf Me.bitmap_Progress
 End Sub

if I pass 0.4 to Red channel wen i try to return to original value it don't work

WHY?????

Many Tanks

Edited by user Thursday, January 17, 2008 7:12:53 PM(UTC)  | Reason: Not specified

Alex Kon  
#4 Posted : Thursday, January 17, 2008 6:22:56 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello,

Hm... I am afraid I don't understand you ;(

Is the problem is that transform doesn't work at all, or you cannot find appropriate values?

Please, could you explain in more detail which transform do you use and what results do you expect

(maybe little sample project)? And I'll do my best to assist you with the task.

You can submit case if it will be more convenient for you.

Edited by user Thursday, May 22, 2008 2:55:34 PM(UTC)  | Reason: Not specified

le capitaine  
#5 Posted : Saturday, January 19, 2008 1:44:07 AM(UTC)
le capitaine

Rank: Newbie

Groups: Member
Joined: 1/15/2008(UTC)
Posts: 3

Ohh Alex... i'm very affraid!!!!

I attempt to explain better my problem...

i need to implement a ColorBalance routine such as photoshop - > image -> balance

in a project main.sln of graphic mill .net there are a similar routine bat if i try to set a value to one of RGB chanel it impossible to return at original image because if i set to 0.5 the value of red channel, for example, to retur at original image i must to be set to neegative number this value, consequntly -0.5 must to be a value to clean up image to the original. But don't work

Hot to implement color balance for RGB o CMYK image?

Excuse me for my english

Hi, my friend

Speak to the hand

Alex Kon  
#6 Posted : Sunday, January 20, 2008 9:03:11 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hi! ;)

In such case you should always apply transform to the original image, because ChannelBalance transform may cause information loss (for example, you can decrease values of several pixels to black (zero) and there is no way to revert this values back).

So it should be someting like that: user set parameter to -4. You apply transform with this value to original image and show the result. The user is not satisfied, he/she sets another parameter value, let it be -2. You apply transform to the original image again with this new value and show the result to user. After several iterations user will be happy! ;)

Users browsing this topic
Guest
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.