ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Channels
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

pierrotsc

USA
497 Posts

Posted - Aug 26 2014 :  07:31:37  Show Profile  Reply
I have 3 layers and I would like to have all 3 showing the blue channel for example. How do i do that?
I read the manual and can do it if imageenvect has one layer but cannot figure out on how to do it with multiple layers.
Thanks.
Pierre

spetric

Croatia
308 Posts

Posted - Aug 26 2014 :  11:59:47  Show Profile  Reply
I presume that you're using TIEBitmap's ChannelOffset property to hide channels.
You must loop through your layers and set ChannelOffset for every layer.


for (int i = 0; i < ImageEnView->LayersCount; i++)
    {
    ImageEnView->Layers[i]->Bitmap->ChannelOffset[0]:=-255; // hide red
    ImageEnView->Layers[i]->Bitmap->ChannelOffset[1]:=-255; // hide green
    }


Didn't try it, but it should work.
Go to Top of Page

pierrotsc

USA
497 Posts

Posted - Aug 26 2014 :  12:34:10  Show Profile  Reply
No, I was using the following code from the manual. I also use delphi to code:
blue:= ImageEnView1.Proc.GetRGBChannel(0);
green:= ImageEnView1.Proc.GetRGBChannel(1);
red:= ImageEnView1.Proc.GetRGBChannel(2);

ImageEnView2.IEBitmap.Assign(blue); // shows Blue channel
ImageEnView3.IEBitmap.Assign(green); // shows Green channel
ImageEnView4.IEBitmap.Assign(red); // shows Red channel

So when I have 3 layers, i am not sure on how i can have all 3 layers with either the blue, red or green channels.
Does that make sense or am i being complicated?
Pierre
Go to Top of Page

w2m

USA
1990 Posts

Posted - Aug 26 2014 :  13:03:37  Show Profile  Reply
Try what Spetric suggested and see if it meets your needs, but you may be able to it similarly by looping through your layers with your code as well.

in Delphi Spetric's code is

var
i: integer;
for i := 0 to ImageEnView,LayersCount -1 do 
begin  
  ImageEnView.Layers[i].Bitmap.ChannelOffset[0] := -255; // hide red
  ImageEnView.Layers[i].Bitmap.ChannelOffset[1] := -255; // hide green
end;


Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

pierrotsc

USA
497 Posts

Posted - Aug 26 2014 :  13:12:43  Show Profile  Reply
ok, i'll try the suggestion with channel offset. i want to be sure that if i do something with one channel, it does not affect the other one.
now, how can i loop this command?
blue:= ImageEnView1.Proc.GetRGBChannel(0);

would i have to be on the specific layer first then move to the next?
thanks
Pierre
Go to Top of Page

w2m

USA
1990 Posts

Posted - Aug 26 2014 :  13:34:48  Show Profile  Reply
I am trying to come up with a demo... If I get it to work I'll post the code.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

pierrotsc

USA
497 Posts

Posted - Aug 26 2014 :  13:36:46  Show Profile  Reply
Awesome..thanks..hope you can make it to work.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Aug 26 2014 :  14:20:07  Show Profile  Reply
It works just fine... But I am busy for a few minutes on something else at the moment.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

pierrotsc

USA
497 Posts

Posted - Aug 26 2014 :  14:52:09  Show Profile  Reply
i'll wait..thanks
Go to Top of Page

w2m

USA
1990 Posts

Posted - Aug 26 2014 :  16:06:08  Show Profile  Reply
Assign RGB channels to layers can be downloaded here:
./attach/w2m/201482616537_AssignRGBChannels.zip

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

pierrotsc

USA
497 Posts

Posted - Aug 26 2014 :  16:59:36  Show Profile  Reply
Bill, this is not really what i am trying to accomplish I think.

I need to be able to add 3 different layers. It could be 3 different images on top of each other. Now, in the red window, i would like to see the 3 layers with the red channels. In the green window, i would like to see the 3 layers (Not merged, so i can still work individually on them) with the green channel.

Am i making sense? I am trying to reproduce the channel behavior you find in image processing program.
Pierre
Go to Top of Page

w2m

USA
1990 Posts

Posted - Aug 26 2014 :  17:28:47  Show Profile  Reply
As far as the layers are concerned it only makes sense if at least three different images are loaded, because one image only has a red, green and blue channel.

You should have enough from what I provided to be able to do that. Study the code where the layers are created. It should be a simple matter to do it for the other 3 controls.

You have to be quite specific as to what you are look for or I just waste my time. You did not say anything about loading 3 different images in your post.

So... I guess now you want to add 3 different images to 3 layers in ImageEnView1, then copy the RGB channels to the other three ImageEnViews?

So... biased on the layer creation code in the existing demo, you have to open an image in the base layer 0, in ImageEnView1 then add a layer to ImageEnView1 and open an image to layer 1, add a layer to ImageEnView1 and open an image in that layer.

After that iterate though the layers in ImageEnView1 to get the 3 base images then add 3 layers to the other ImageEnViews. Then assign each of the RGB color channels for the image in layer 0 of ImageEnView1 to ImageEnView2 - layers 1,2,3, then each of the RGB color channels for the image in layer 1 of ImageEnView1 to ImageEnView2- layers 1,2,3 and finally each of the RGB color channels for the image in layer 2 of ImageEnView1 to ImageEnView3 - layers 1,2,3.

This is quite easy to do... just add your pictures to layers in ImageEnView 1, then get the color channels for each image in each layer of ImageEnView1 and assign them to the three layers in each of ImageEnView2, ImageEnView3 and ImageEnView4.

You should be able to do that yourself now. I am too busy to do that right now.


Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

pierrotsc

USA
497 Posts

Posted - Aug 26 2014 :  18:38:20  Show Profile  Reply
I see. i guess there is no magic button :)
i am not really adding 3 images but i am adding layers on top of layers. one may have text, another one could have a brushstroke.
the way i could do it is to save the layers in a stream, assign the desired channel to each of the saved layers with a loop, clear the original imageen work space and reload from the stream the saved modified layers.
i see your code but i want to work with only one imageen. i do not want to open different ones for each channel, or maybe i could stack different imageen and bring them to the front when i call the desired channel. i do not know if 4 imageen stacked on top of each other with a number of layers associated with them would make the program too slow. maybe the stream idea could be better.
what do you think?
let me know which approach is better memory wise and i'll work on it.
thanks
Pierre
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: