[SOLVED] How to convert screen's color image to grayscale
-
- Gremlin
- Posts: 165
- Joined: Wed Sep 10, 2008 6:14 am
[SOLVED] How to convert screen's color image to grayscale
Hi,
In my project, i need to simulate an infrared-nigh camera image for aircraft so i want to convert color image on buffer to grayscale before it is rendered on screen.
Could you pls point me some hints?
Thank you in advance,
In my project, i need to simulate an infrared-nigh camera image for aircraft so i want to convert color image on buffer to grayscale before it is rendered on screen.
Could you pls point me some hints?
Thank you in advance,
Last edited by compvis on Wed Mar 18, 2015 4:39 am, edited 1 time in total.
- Zonder
- Ogre Magi
- Posts: 1168
- Joined: Mon Aug 04, 2008 7:51 pm
- Location: Manchester - England
- x 73
Re: How to convert screen's color image to grayscale
Here you go http://www.ogre3d.org/tikiwiki/tiki-ind ... Compositor
Some other reading on screen effects http://www.ogre3d.org/tikiwiki/tiki-ind ... +Rendering
Some other reading on screen effects http://www.ogre3d.org/tikiwiki/tiki-ind ... +Rendering
There are 10 types of people in the world: Those who understand binary, and those who don't...
- areay
- Bugbear
- Posts: 819
- Joined: Wed May 05, 2010 4:59 am
- Location: Auckland, NZ
- x 69
Re: How to convert screen's color image to grayscale
Yeah, there's an Ogre SampleBrowser Sample that shows compositor that does exactly this.
-
- Gremlin
- Posts: 165
- Joined: Wed Sep 10, 2008 6:14 am
Re: How to convert screen's color image to grayscale
Thanks, these are great links. I learn it very much.Zonder wrote:Here you go http://www.ogre3d.org/tikiwiki/tiki-ind ... Compositor
Some other reading on screen effects http://www.ogre3d.org/tikiwiki/tiki-ind ... +Rendering
Thanks,areay wrote:Yeah, there's an Ogre SampleBrowser Sample that shows compositor that does exactly this.
But is it possible to processing in real time by coding (not by scripts)? For example, image processing on buffer before it is rendered on screen? Which event i should inject my codes and how to handle image from buffer?
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1280
- Contact:
Re: How to convert screen's color image to grayscale
What the Compositor sample does is to run pixel shaders, which is your own programmable code running on the GPU.compvis wrote:But is it possible to processing in real time by coding (not by scripts)? For example, image processing on buffer before it is rendered on screen? Which event i should inject my codes and how to handle image from buffer?
If what you're looking is to use a routine writen by you in C++ (instead of hlsl or glsl), even though it can be done, it will be extremely slow.
-
- Gremlin
- Posts: 165
- Joined: Wed Sep 10, 2008 6:14 am
Re: How to convert screen's color image to grayscale
I don't want to dive into Hlsl or Glsl because I'm not familiar (not expert) with it and my application is small so i want to convert buffer data to work with opencv image (cv::Mat image) with C++ interface. Could you pls tell me some hints?dark_sylinc wrote:What the Compositor sample does is to run pixel shaders, which is your own programmable code running on the GPU.compvis wrote:But is it possible to processing in real time by coding (not by scripts)? For example, image processing on buffer before it is rendered on screen? Which event i should inject my codes and how to handle image from buffer?
If what you're looking is to use a routine writen by you in C++ (instead of hlsl or glsl), even though it can be done, it will be extremely slow.
Or Could someone help me to create scripts (compositor) ?
Thanks
- areay
- Bugbear
- Posts: 819
- Joined: Wed May 05, 2010 4:59 am
- Location: Auckland, NZ
- x 69
Re: How to convert screen's color image to grayscale
>> Or Could someone help me to create scripts (compositor) ?
We've told you where to find this, in the source (and material samples) for the SampleBrowser that comes as part of Ogre.
The other, slow, way to do it would be using a RTT and then doing your processing on the RenderTexture that it writes to. There is an example of how to use RTT in the Ogre tutorials. After you've done the tutorial you can change the RenderTexture to be read/write and then process that.
We've told you where to find this, in the source (and material samples) for the SampleBrowser that comes as part of Ogre.
The other, slow, way to do it would be using a RTT and then doing your processing on the RenderTexture that it writes to. There is an example of how to use RTT in the Ogre tutorials. After you've done the tutorial you can change the RenderTexture to be read/write and then process that.
-
- Gremlin
- Posts: 165
- Joined: Wed Sep 10, 2008 6:14 am
[SOLVED] How to convert screen's color image to grayscale
Dear all,
My problem resolved in Compositors sample.
Than you very much,
My problem resolved in Compositors sample.
Than you very much,