2
PIX* returnRotatedImage(PIX* image, float theta)
{
    PIX* rotated = pixRotate(image, -theta, L_ROTATE_AREA_MAP, L_BRING_IN_BLACK, image->w, image->h);

    return rotated;
}

当我在图像上执行上述代码时,生成的图像的边缘被切断。

示例:原始扫描,然后是通过上述函数运行后的图像将其旋转约 89 度。

我还没有 10 声望,所以我不能嵌入图片,但这里有两张图片的链接:http: //imgur.com/a/y7wAn

我也需要它适用于任意角度(不仅仅是接近 90 度的角度),所以不幸的是,这里提出的解决方案不起作用。

pixRotate 函数的描述说:

 *      (6) The dest can be expanded so that no image pixels
 *          are lost.  To invoke expansion, input the original
 *          width and height.  For repeated rotation, use of the
 *          original width and height allows the expansion to
 *          stop at the maximum required size, which is a square 
 *          with side = sqrt(w*w + h*h).

然而,它似乎在旋转后扩展了目的地,因此即使最终图像尺寸正确,像素也会丢失。如果我使用 pixRotate(..., 0, 0) 而不是 pixRotate(..., w, h),我最终会得到在原始尺寸内旋转的图像:http: //i.imgur.com/YZSETl5。 .jpg _

我是否错误地解释了 pixRotate 函数描述?我想做的甚至可能吗?或者这可能是一个错误?

提前致谢。

4

0 回答 0