I have a 512x160 pixel black and white image that I want to upscale (to 4096x1280) using OpenCV. It is very important that pixels that were negative (white) remain negative. cv2.resize
appears to anti-alias the image by default, thereby creating falsely-positive pixels. Is there a way to disable the anti-aliasing?
Edit: From what I can see here are the interpolation methods:
- INTER_NEAREST - nearest neighbor interpolation
- INTER_LINEAR - bilinear interpolation
- INTER_CUBIC - bicubic interpolation
- INTER_AREA - resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire'-free results. But when the image is zoomed, it is similar to the INTER_NEAREST method.
- INTER_LANCZOS4 - Lanczos interpolation over 8x8 neighborhood.
- INTER_MAX - mask for interpolation codes.
- WARP_FILL_OUTLIERS - flag, fills all of the destination image pixels. If some of them correspond to outliers in the source image, they are set to zero.
- WARP_INVERSE_MAP - flag, inverse transformation.