CUDAでイメージローテーションを実装する際に問題があります。次のように私は非常に単純なローテート機能作業があります。CUDAイメージローテーション
__device__ float readPixVal(float* ImgSrc,int ImgWidth,int x,int y)
{
return (float)ImgSrc[y*ImgWidth+x];
}
__device__ void putPixVal(float* ImgSrc,int ImgWidth,int x,int y, float floatVal)
{
ImgSrc[y*ImgWidth+x] = floatVal;
}
__global__ void Rotate(float* Source, float* Destination, int sizeX, int sizeY, float deg)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;// Kernel definition
int j = blockIdx.y * blockDim.y + threadIdx.y;
if(i < sizeX && j < sizeY)
{
putPixVal(Destination, sizeX, ((float)i)*cos(deg) - ((float)j)*sin(deg), ((float)i)*sin(deg) + ((float)j)*cos(deg)), readPixVal(Source, sizeX, i, j));
}
}
問題は、私はすべての補間を行う方法がわからない、です。上記では、整数の丸めによって多くのピクセルがスキップされます。誰でもこの問題を解決する方法を知っているか、イメージのフリー/オープンソースの実装がありますか?私はCUDAを見つけることができませんでした。
は、グラフィックスカードが回転し、他の線形変換を行うためのグラフィックス・パイプラインにおける高速なハードウェアを持っていることを覚えていているようです。これを利用するには、CUDAからOpenGLまたはDirectXの相互運用性を使用します。 –