Add edge aware, weighted debayering algorithms (Feature #1093)


Added by Patrick Mihelich almost 14 years ago. Updated about 12 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:Ilya Lavrenov % Done:

0%

Category:imgproc, video
Target version:3.0
Difficulty: Pull request:

Description

We've been using two versions of yet another debayering algorithm with the Kinect. It's simple enough to run in real time, but largely gets rid of the zipper artifacts you get from bilinear interpolation.

Suat has implementations for GRBG pattern (used by Kinect) in https://kforge.ros.org/openni/openni_ros/file/fbe024cacaf7/openni_camera_unstable/src/openni_image_bayer_grbg.cpp. You can ignore the downsampling logic.

I'd like these moved into OpenCV. Then in Electric, image_proc will allow a choice of bilinear, edge-aware or VNG debayering.

Kurt / Suat, could one of you post a high-level explanation of what these methods do?

Also, before we create too much work for Vadim: do we really need both, or is just EdgeAware sufficient? I basically can't tell the difference between EdgeAware and EdgeAwareWeighted, but then again the Kinect has a pretty crappy RGB camera.


Associated revisions

Revision 8f2047ad
Added by Roman Donchenko over 11 years ago

Merge pull request #1093 from jet47:fix-gpu-stream-test

History

Updated by Vadim Pisarevsky almost 14 years ago

Looks like edge-aware algorithm is patented, here is the very first link in Google that comes for "edge-aware demosaicing" query: http://www.patentgenius.com/patent/7822293.html

Shall we consider some other algorithm?

Updated by Patrick Mihelich almost 14 years ago

This is probably just some tweaking of old techniques... the original patents on debayering using edge-directed interpolation date back to the mid-1990s.

Kurt, what's the source of the edge-aware debayering algorithms we're using?

Updated by Patrick Mihelich over 13 years ago

Some explanation from Suat:

the Edge-aware algorithm is pretty simple. I implemented that after a short discussion with kurt, so i dont have a paper describing it.

Instead of bilinear interpolation, we interpolate only in the direction with smallest gradient.
e.g. below you see a Bayer pattern. The task here is to get the RGB information of the pixel at the position with the capital 'B'

grgrg
bgBgb
grgrg

Here the green value will not be the average of all 4 green values from around the selected B pixel. Instead its the average of either the horizontal or vertical green values. We use the both green values with smallest difference.
Thats it!

The EdgeAwareWeighted is just an idea i got during implementation of above method. I use all 4 green values, but weight them depending on the gradient information.
Lets say g_l g_r,g_t and g_b are the green values on left, right top and bottom of the blue value. Then the resulting green value is:

g = 0.5 * ( (g_l + g_r) * abs(g_t - g_b) + (g_t + g_b) * abs(g_l - g_r) ) / (abs(g_t - g_b) + abs (g_l - g_r))

The advantage here is, that it keeps strong edges while it reduces noise for homogeneous areas.

Updated by Alexander Shishkov about 13 years ago

  • Description changed from We've been using two versions of yet another debayering algorithm with th... to We've been using two versions of yet another debayering algorithm with th... More

Updated by Kirill Kornyakov almost 13 years ago

  • Subject changed from Add edge aware, edge aware weighted debayering algorithms to Add edge aware, weighted debayering algorithms

Updated by Vadim Pisarevsky over 12 years ago

ok, since Ilya is working on it (and nearly completed it: https://github.com/Itseez/opencv/pull/165), I reassign the ticket. Ilya, when your pull request is finally integrated, please, close the ticket.

  • Assignee changed from Vadim Pisarevsky to Ilya Lavrenov

Updated by Vadim Pisarevsky about 12 years ago

code is integrated into the master branch; will become a part of OpenCV 2.5

  • Target version set to 3.0
  • Status changed from Open to Done

Also available in: Atom PDF