【发布时间】:2014-02-25 18:05:59
【问题描述】:
我之前在 Stack Overflow 上发布过关于如何在 c++ 程序中准确旋转 BMP 图像的问题。然而,现在,关于我的进步,我还有更多要展示的东西。
我想知道我的程序如何(或为什么)在我进行图像计算后不会输出图像:
void BMPImage::Rotate45Left(float point1, float point2, float point3)
{
float radians = (2 * 3.1416*45) / 360;
float cosine = (float)cos(radians);
float sine = (float)sin(radians);
float point1Xtreme = 0;
float point1Yearly = 0;
float point2Xtreme = 0;
float point2Yearly = 0;
float point3Xtreme = 0;
float point3Yearly = 0;
int SourceBitmapHeight = m_BIH.biHeight;
int SourceBitmapWidth = m_BIH.biWidth;
point1Xtreme = (-m_BIH.biHeight*sine);
point1Yearly = (m_BIH.biHeight*cosine);
point2Xtreme = (m_BIH.biWidth*cosine - m_BIH.biHeight*sine);
point2Yearly = (m_BIH.biHeight*cosine + m_BIH.biWidth*sine);
point3Xtreme = (m_BIH.biWidth*cosine);
point3Yearly = (m_BIH.biWidth*sine);
float Minx = min(0, min(point1Xtreme, min(point2Xtreme, point3Xtreme)));
float Miny = min(0, min(point1Yearly, min(point2Yearly, point3Yearly)));
float Maxx = max(point1Xtreme, max(point2Xtreme, point3Xtreme));
float Maxy = max(point1Yearly, max(point2Yearly, point3Yearly));
int FinalBitmapWidth = (int)ceil(fabs(Maxx) - Minx);
int FinalBitmapHeight = (int)ceil(fabs(Maxy) - Miny);
FinalBitmapHeight = m_BIH.biHeight;
FinalBitmapWidth = m_BIH.biWidth;
int finalBitmap;
如果有人有任何有用的指点,那就太好了。 我应该提一下:
- 我不能将其他外部库用于此程序
- 这是一个小型的图像处理程序,有一个菜单系统
【问题讨论】:
-
您的代码似乎根本没有进行任何旋转,因此没有图像输出是预期的结果。
-
顺便说一句,我发布上述内容的目的是在所以我们不是来为您做作业的。如果您发布试图解决问题但无法按预期工作的真实代码,我们可以提供帮助。您发布的代码甚至没有开始旋转图像。甚至没有要旋转的图像..
标签: c++ image image-processing image-rotation