Pixel -wise bicubic interpolation

Hello,
I want to compute pixel-wise bicubic interpolation for a given image. The coordinate (x,y) of a pixel indicated by a cv::Point2d(x,y), for example, is the input of the bicubic interpolation. Instead of having the interpolated pixel value, I want the coordinate (new x, new y) of the input one. Is there a demo or code to do this.
Thanks.

I know a little about bicubic interpolation and might be able to help with your question, but I don’t understand what you are going for.

Normally when I think of bicubic image interpolation, I imagine a real-valued X,Y pixel location that you want an interpolated RGB (or grayscale, or…) value for based on the values at discrete pixel locations in the original image. It sounds like you want something else - a function that maps a 2D location in the image to some other 2D location. This sounds more like distortion correction or some other image warping - is that right?

If you provide some more details about what you are actually trying to accomplish it would help with suggesting how to go about it.

-Steve

I can’t make sense of that post either.

if I had to make a wild guess, I’d wonder if perhaps he’s asking for something like the transition-timing-function of CSS, where you can have linear interpolation, cubic-bezier, “ease”…

applied to points, all of that STILL needs at least two points (more for higher orders), and an interpolation factor between 0 and 1

but if there are pixels involved, all of that makes no sense at all.

Hello guys, also @Steve_in_Denver.
That is basically right. I show an example of bi-linear interpolation for a single-channel image.

float getPixelValue(float x, float y, cv::Mat image_)
{
	uchar* data = &image_->data[int(y) * image_->step + int(x)];
	float xx = x - floor(x);
	float yy = y - floor(y);
	return float(
		(1 - xx) * (1 - yy) * data[0] +
		xx* (1 - yy) * data[1] +
		(1 - xx) *yy*data[image_->step] +
		xx*yy*data[image_->step + 1]
		);
}

This could be viewed as pseudo-code for image_ is generally a member object not passed by reference or value. I just want to do this by using the bi-cubic interpolation.

Based on your most recent post it sounds like you just want to get an RGB (or whatever) value back, and not some modified (x,y) coordinate - but I’m still not clear what you want.

Bicubic interpolation is a bit more involved than bilinear. Maybe start with the Wikipedia entry on it?

https://en.wikipedia.org/wiki/Bicubic_interpolation