T O P I C R E V I E W |
pierrotsc |
Posted - May 11 2020 : 19:57:41 i extract 3 layers from an rgb image using: Blue := ImageEnVect_RGB.Proc.GetRGBChannel(iecBlue); Green := ImageEnVect_RGB.Proc.GetRGBChannel(iecGreen); Red := ImageEnVect_RGB.Proc.GetRGBChannel(iecRed);
So i get 3 black and white images. If i modify one channel and want to merge them back to recreate the modified RGB, how would i do that ?
Thanks Pierre |
20 L A T E S T R E P L I E S (Newest First) |
xequte |
Posted - Jun 01 2020 : 01:28:57 Hi
Contrast is a visual property (i.e. does not modify the image, just changes the way it is shown). To actually change the image, you need to apply the contrast, with ImageEnView1.IEBitmap.FixContrast.
Of course, if you do that you will constantly be applying more contrast (applying contrast to an image that has already contrast applied), so you should store an original image or channel image and apply contrast to that.
I don't really follow your demo, but this is the method to apply the contrast showing in ImageEnViewDest to the selected layer in ImageEnViewSrc:
procedure TForm1.btnApplyContrastClick(Sender: TObject);
begin
// Apply the contrast
ImageEnViewDest.IEBitmap.FixContrast;
ImageEnViewDest.Update;
ImageEnViewSrc.layers[ImageEnViewSrc.LayersCurrent].Bitmap.Assign( ImageEnViewDest.IEBitmap );
ImageEnViewSrc.Update();
end;
Another option would be to simultaneously update the contrast of both of your views:
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
ImageEnViewDest.IEBitmap.Contrast := TrackBar1.Position;
ImageEnViewDest.Update;
ImageEnViewSrc.CurrentLayer.Bitmap.Contrast := TrackBar1.Position;
ImageEnViewSrc.Update;
end;
Nigel Xequte Software www.imageen.com
|
pierrotsc |
Posted - May 31 2020 : 16:57:01 Nigel, i have modified the demo. Just run it, open an image On the right you should see the blue channel displayed Drag the trackbar to change the contrast. Now click on the green channel and back on the blue channel. The blue channel is back the way it was. When i move the trackbar, i would like the RGB channel to be modified
Best
attach/pierrotsc/2020531165652_202051335024_RGBChannels.zip 8.7 KB |
pierrotsc |
Posted - May 21 2020 : 17:41:09 i can modify the demo to look more my program and upload it. will do that tomorrow best |
xequte |
Posted - May 21 2020 : 16:54:06 Hi
Can you forward me your latest demo and tell me in what way it is not working?
Nigel Xequte Software www.imageen.com
|
pierrotsc |
Posted - May 21 2020 : 16:34:05 not sure if i understand. the image is loaded into a temprary buffer that has 4 layers. the rgb, r,g and b. the layerview is mapped to the imageenview buffer. when i select a layer, i assigned the corresponding of one of the 4 layers to my main imageenview. i do all the processes on my main imageenview. it is not linked at all to the buffer image. i need to do the way back. that means re assign the current imageenview back to the correct of the 4 layers in the buffer. i do not do any processing on the imdividual channel. |
xequte |
Posted - May 21 2020 : 16:08:27 Why not just check whether the channels have been initialized or not? (they are not nil, or use a field for your current state: Uninitialized, EditingChannelR, etc.)
Nigel Xequte Software www.imageen.com
|
pierrotsc |
Posted - May 21 2020 : 09:49:01 looks like i cannot. program crashes when it starts. i guess the event is called before the commands inside have been initialized. i'll try to find another event to update each channels when image processes have occured. thanks |
xequte |
Posted - May 20 2020 : 22:03:34 Hi
Yes, I have your demo open in front of me. It is just my demo with a TImageEnMView added, so I don't really understand what it is trying to do.
The OnImageChangeEx occurs whenever the image changes, so can you not use that?
Nigel Xequte Software www.imageen.com
|
pierrotsc |
Posted - May 20 2020 : 20:43:50 Nigel, have you looked my demo? I think that other was I am doing. I guess I have to update the buffer image every time I make a modification of there is no way to tell the image has been changed or does the onimagechange is triggered? |
xequte |
Posted - May 20 2020 : 20:32:57 In that case, maybe you should have some TIEBitmap fields that store the state of each channel, and then you can assign the "original" channel or the edited one.
Nigel Xequte Software www.imageen.com
|
pierrotsc |
Posted - May 20 2020 : 20:03:09 Nigel, how should i handle a statement like that to be sure it sticks to the layer? (Red for example) imageenview.IEBitmap.FixContrast();
Best right now if i switch to the blue and back to the red, the modifications i made on the red are gone. |
pierrotsc |
Posted - May 19 2020 : 17:31:03 I was talking about the built-in image processes that has a gui built-in to modify an image. I will look at the help section. Thank |
xequte |
Posted - May 19 2020 : 16:44:57 Hi
Those sounds like methods where you are calling the code to make the change, so the most efficient way is just to call your update code after completing the operation.
Otherwise use the OnImageChangeEx event and look for Proc changes, for example.
https://www.imageen.com/help/TImageEnView.OnImageChangeEx.html
Nigel Xequte Software www.imageen.com |
pierrotsc |
Posted - May 19 2020 : 16:18:03 Thanks Nigel. It worked great. but i guess it would not work with procedure like brightness or contrast and so on. What should i do when using image processing command.? Best |
xequte |
Posted - May 19 2020 : 15:51:06 Hi
The update is delayed because at the time you assign the image the painting is still active and has not yet been applied to the image.
Use the on OnUserInteraction and if it's ieiPaintEnd then update ImageEnViewSrc.
https://www.imageen.com/help/TImageEnView.OnUserInteraction.html
OnImageChange should also work, but will get called more often than you need it.
Nigel Xequte Software www.imageen.com |
pierrotsc |
Posted - May 18 2020 : 12:14:39 @yogiyang Thanks for the tip, i think i got it to work but not fully. When i draw on the iamgeenviewdest, it does not update right away. i have to draw again to see the first drawing updated. I use ImageEnViewSrc.CurrentLayer.Assign(ImageEnViewDest.CurrentLayer); ImageEnViewSrc.Update;
Why is the update delayed? Thanks |
yogiyang |
Posted - May 18 2020 : 00:39:46 When you click on a layer it automatically get set as CurrentLayer so all that you need to do is update this CurrentLayer in Source from Destination after you have made any modifications to it.
HTH
Yogi Yang |
pierrotsc |
Posted - May 17 2020 : 09:23:36 Ok, when you load my modified demo, you have 2 imaggenview. a source that has 4 layers (red, Blue, green and the RGB). the layermview is assign to the source. Each time you select a layer in the ielayermview, you are selecting either the R,G,B or RGB of the source and assign this layer to the imageenview destination. So the destination has one layer only. it can be a R,G,B or RGB image. I draw on the destination only. How can i update the RGB layer from the source from the destination layer that has only one layer and you do not know which color is selected ? Am i making myself clear? Anyway, just reload my demo and change the mouseinteractgeneral to brushtool to the imageenviewdest. Then draw on it. Best |
pierrotsc |
Posted - May 17 2020 : 08:48:01 maybe, let me ponder on that. i do not see an onchange event, just an onimagechange. not sure about the delayed statement you mentioned too best |
xequte |
Posted - May 17 2020 : 04:15:50 Hi Pierre
Then in the onchange event (delayed so as not to impede performance), call your GetRGBChannel code to update the content of your channel images.
Am I misunderstanding?
Nigel Xequte Software www.imageen.com
|