Ask Your Question
0

warpAffine without Interpolation

asked 2013-08-13 08:33:06 -0600

pkohout gravatar image

Hi, what flags do i need by cv::warpAffine to do no interpolation ? Or is there a way to mark the "outliners" in a special color ?

edit retag flag offensive close merge delete

Comments

1

You cant avoid the interpolation which is kind of obvious. Lets take an example that you want to scale up an image. How do you want to determine the new pixels that get added without interpolation? The same applies to rotations and translations.

Moster gravatar imageMoster ( 2013-08-13 09:00:23 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-08-14 00:55:38 -0600

Michael Burdinov gravatar image

Each pixel in warped image should be calculated from one or more pixels of original image. Usually using more than one pixel give best result and this is default option for warpAffine (bilinear interpolation). But sometimes we may need that warped image will have only colors of original image, i.e. each new pixel should get its value from exactly one pixel of original image. Is this what you meant by "without interpolation"? If yes, you can use INTER_NEAREST flag. By the way, this is also the fastest way to perform warping because it needs less calculations.

edit flag offensive delete link more

Comments

You should also mention that it most likely creates ugly artifacts.

Moster gravatar imageMoster ( 2013-08-14 00:58:53 -0600 )edit

Well yes it indeed looks worse than other types of interpolation, but it still may be OK for his purpose.

Michael Burdinov gravatar imageMichael Burdinov ( 2013-08-14 03:17:35 -0600 )edit

Question Tools

Stats

Asked: 2013-08-13 08:33:06 -0600

Seen: 1,793 times

Last updated: Aug 14 '13