How do I choose an image interpolation method? (Emgu/OpenCV)

Tom Wright picture Tom Wright · Jun 24, 2010 · Viewed 31.1k times · Source

The image resizing function provided by Emgu (a .net wrapper for OpenCV) can use any one of four interpolation methods:

  1. CV_INTER_NN (default)
  2. CV_INTER_LINEAR
  3. CV_INTER_CUBIC
  4. CV_INTER_AREA

I roughly understand linear interpolation, but can only guess what cubic or area do. I suspect NN stands for nearest neighbour, but I could be wrong.

The reason I'm resizing an image is to reduce the amount of pixels (they will be iterated over at some point) whilst keeping them representative. I mention this because it seems to me that interpolation is central to this purpose - getting the right type ought therefore be quite important.

My question then, is what are the pros and cons of each interpolation method? How do they differ and which one should I use?

Answer

MusiGenesis picture MusiGenesis · Jun 24, 2010

Nearest neighbor will be as fast as possible, but you will lose substantial information when resizing.

Linear interpolation is less fast, but will not result in information loss unless you're shrinking the image (which you are).

Cubic interpolation (probably actually "Bicubic") uses one of many possible formulas that incorporate multiple neighbor pixels. This is much better for shrinking images, but you are still limited as to how much shrinking you can do without information loss. Depending on the algorithm, you can probably reduce your images by 50% or 75%. The primary con of this approach is that it is much slower.

Not sure what "area" is - it may actually be "Bicubic". In all likelihood, this setting will give your best result (in terms of information loss / appearance), but at the cost of the longest processing time.

Update: this link gives more details (including a fifth type not included in your list):

http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html?highlight=resize#resize