I've been trying to make this program in c++ with opencv that converts the image to greyscale and rotates the image afterwards, but the output I get is all kinds of messed up.
I haven't been able to find what the hell I have done wrong so if any of you could help me it'd be great
>>1
Just move each pixel to a x*(cos angle), y*(sin angle), then fill result pixels with closest matching rotated-neighbors. Using a simple N-linear interpolation will greatly increase rotation quality.
Name:
Anonymous2012-10-22 12:27
using namespace std;
i see your code is off to an amazing start, op
youre going to go far
Name:
Anonymous2012-10-22 15:38
>>20
You're an idiot. That's not linear interpolation, that's nearest neighbor.
>>9
The problem is that you're truncating on lines 20 and 21. When you rotate an image the resulting coordinates are not going to fall exactly on the pixels and it's going to look like crap.
What you need to do is look up bilinear interpolation. Then, write a function that does that by taking the image and two double coordinates and gives you the value between the pixels. Use that function instead of im.at<unsigned char>.