Optimizes OpenCL resize and optical flow to use image extension.

Replaces PR#2595.