Rank: Newbie
Groups: Guest
Joined: 1/15/2008(UTC) Posts: 3
|
I've a problem to set a value to single channel of RGB. Please help me
|
|
|
|
Rank: Advanced Member
Groups: Guest
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");
|
|
|
|
|
Rank: Newbie
Groups: Guest
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
|
|
|
|
Rank: Advanced Member
Groups: Guest
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 |
|
|
|
|
Rank: Newbie
Groups: Guest
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
|
|
|
|
Rank: Advanced Member
Groups: Guest
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! ;) |
|
|
|
|
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.