CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: gray to rgb

  1. #1
    Join Date
    Jul 2006
    Posts
    49

    Red face gray to rgb

    Hi everyone

    How can i convert gray to rgb.I see the solution in board but I don't understand.I use opencv for image processing.Is opencv have function for solve this problem?

  2. #2
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: gray to rgb

    You mean gray scale image to color image ?? Thats not possible if you dont have color information with you. What solution did you got in board ?
    Regards,
    Ramkrishna Pawar

  3. #3
    Join Date
    Jul 2006
    Posts
    49

    Re: gray to rgb

    This is my project.First algorithm i get threshold image and it have many noise.I want remove noise.Then I use median filter for remove noide.so I convert rgb of threshold to gray scale and use median filter for remove noise.And I want to get rgb image again.The secound algorithm is use RLE(run length encoder) for remove noise.Is it possible.Can anyone help me.

    Thank you for your advice.

  4. #4
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: gray to rgb

    Well, it's impossible to get the colors back, but you can save the colors information before converting it to grayscale, and then later do something (something like using the grayscale noise less image to remove noise from the color image) to get color image (saved earlier) without the noise.
    Regards,
    Ramkrishna Pawar

  5. #5
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: gray to rgb

    Quote Originally Posted by suntonphon
    This is my project.First algorithm i get threshold image and it have many noise.I want remove noise.Then I use median filter for remove noide.so I convert rgb of threshold to gray scale and use median filter for remove noise.And I want to get rgb image again....
    Don't convert RGB to grayscale, since (as pointed out above) that will throw away all the color information, such that it will not be possible to get it back.

    Instead, apply the median filter separately to each of the R and G and B channels. In other words, apply a median filter to the R channel, another to the G channel, and another to the B channel.

    This will preserve the color information, and (presumably) eliminate the noise.

    Mike

  6. #6
    Join Date
    Jul 2006
    Posts
    49

    Red face Re: gray to rgb

    Thank you everyone
    But I want fast algorithm use for robocup.I use less color.If I use median filter for r g b .I will be slow.Can I remove noise in other algorithm.

    thank

  7. #7
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: gray to rgb

    This is only a suggestion, but I notice that you said that this is your "first project". Since it's your "first project", you really should concentrate on making it work, before you try to make it work fast.

    Mike

  8. #8
    Join Date
    Aug 2006
    Posts
    16

    Re: gray to rgb

    I'd look at the intensity of each pixel in the gray scale image before and after the filter and apply this ratio to the intensity of each pixel in the rgb image.

    Only a suggestion but I believe it would work...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured