Hi everybody!
A couple of days ago one of the readers of the blog asked this on the comments of a previous post:
Hi,
I'm Mike. Nice work! :)
I saw that some people have coloured depth maps and not just shades of grey/black/white. If I want to have coloured depth maps how can I achieve this?
Thanks,
Mike.
I'm Mike. Nice work! :)
I saw that some people have coloured depth maps and not just shades of grey/black/white. If I want to have coloured depth maps how can I achieve this?
Thanks,
Mike.
Well Mike, some time ago I had the same question and researching a bit I found two approaches. Pseudo Color and Chroma Depth. Let me answer your question with a blog post, so anybody else who could be interested can find it easily.
Basically, what we have is a function that takes as an input a gray scale value and returns the corresponding RGB. The Pseudo Color approach uses a trigonometric function to assign the RGB color to each gray value. The next picture shows an example:
As you can see the output is somewhat similar to the images of the luggage scanners in airports and train stations.
But for the purpose of depth visualization, maybe it is more convenient to use Chroma Depth. This method assigns red values to high depth values, magenta values to low depth values and a rainbow color to anything in between. Like in the next picture:
To make it easy, you can download the simple Gtk application that I made to visualize the output of both methods and play around with some parameters. The source code should be self explanatory, so I will skip the details in this post.
Just execute "make" and then "./GrayToPseudocolor -gray /path/to/your/image.something"
I would like to thank Sarah Martull for letting me use her depth image for this post.
6 comments:
Hello,
Hello,
What is the name of the mapping function?
Do you have any references for it?
Hi there,
There are lots of different mapping functions, on this post for pseudocolor I generate a rgb value using a sinusoidal function on the gray value. For chromadepth just used a "rainbow" function.
I did this long time ago, so don't remember exactly where I found the formulas. But there is plenty of references out there:
http://en.wikipedia.org/wiki/False-color
http://en.wikipedia.org/wiki/ChromaDepth
hello,could i ask the question that this code should be implemented in lnuix?
Hi Kelin,
Yes, the code should be compiled under Linux. Anyway you should have no problem using the core functionality (which is implemented in the files gray2pseudocolor.* and gray2chromadepth.*) in Windows.
Best regards,
Martin
I really happy when discovering your blog. Thanks for this share..
Hi, great work with this blog.
I just have one question. How do you compile this source code in Ubuntu 13.10?... i'm trying but it give me an error with glibc
Post a Comment