unicorn_poet
unicorn_poet

Reputation: 495

Resizing data using cv2.imresize for neural network input

I have to scale down data to feed into a neural network.

I wanted to use cv2.imresize, but there are multiple options with regard to how it interpolates the data to scale it down:

Has anyone experimented with these, and if so what have you found? Note: I don't have enough time to try out learning with all varieties of interpolation.

Upvotes: 2

Views: 2239

Answers (1)

Abhijat Biswas
Abhijat Biswas

Reputation: 174

For down sampling image data (I presume the data is an image since you're using OpenCV), you can just use area averaging to get good performance in terms of speed and quality (unless the downscaling factor is quite small, where blurring may happen).

Nearest neighbor will drop some cells at regular intervals but will be quite fast since no interpolation is actually performed. However some aliasing is to be expected with most images.

If quality is your main concern, use Lanczos (slower than bicubic, but higher quality images, generally speaking).

Bicubic and bilinear are known to perform quite badly for downscaling images for factors less than 0.5.

Upvotes: 3

Related Questions