Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Program to convert image and rotate

Name: Anonymous 2012-10-21 11:50

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

http://pastebin.com/FSJKyaeU

Name: Anonymous 2012-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>.

Also, your rotation matrix is inverted.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List