Image interpolation

Hello,

I use a code that I have develop on my computer to interpolate an image. It works properly on my computer but on the shield the interpolation always send me 0.

Here is the code:

texture<unsigned char, 2,cudaReadModeElementType> Image_Gray;


__global__ void ExtractMarker56p( u_int8_t *ptTemplateMarker, TransformationM *ptMatrix)
{

    __shared__ float localTransformation[9];

    if(threadIdx.x <9 && threadIdx.y == 0)
    {
        localTransformation[threadIdx.x] = ptMatrix[blockIdx.x].Homography[threadIdx.x];
    }

    syncthreads();

    for(int i=threadIdx.x;i<_MARKER_MAX_SIZE;i+=blockDim.x)
    {
        for(int j=threadIdx.y;j<_MARKER_MAX_SIZE;j+=blockDim.y)
        {
            float x00 = (float)i;
            float y00 = (float)j;
            float fcoef = localTransformation[6]*x00+localTransformation[7]*y00+localTransformation[8];

            float x0 =  (localTransformation[0]*x00 + localTransformation[1]*y00 +localTransformation[2])/fcoef;
            float y0 =  (localTransformation[3]*x00 + localTransformation[4]*y00 +localTransformation[5])/fcoef;

            u_int8_t u8_Val = tex2D(Image_Gray,(x0),(y0));
            ptTemplateMarker[blockIdx.x*_MARKER_MAX_SIZE*_MARKER_MAX_SIZE + (i + j*_MARKER_MAX_SIZE) ] = u8_Val;
        }
    }

}


......


    cudaChannelFormatDesc  desc = cudaCreateChannelDesc<unsigned char>();

    Image_Gray.filterMode = cudaFilterModePoint;
    Image_Gray.normalized = 0;

    //Image_Gray.addressMode[0] = cudaAddressModeWrap;
    //Image_Gray.addressMode[1] = cudaAddressModeWrap;
    checkCudaErrors(cudaBindTexture2D(0,&Image_Gray,u8_GrayImage_Device, &desc, icols , irows, icols));

Why is there a difference between my computer and the jetson?

I just add the full project om my git repos.
Here is the link:

Hi xav123,

You mentioned “tt works properly on my computer but on the shield the interpolation always send me 0.”, but ask “Why is there a difference between my computer and the jetson?”.

Does this issue happen on Shield or Jetson TK1?
And what’s the CUDA version on you PC and tegra device?

Thanks

Sorry it is the jetson and not the shield tablet. Sorry about that.

I just find the solution, in fact the jetson is 3.2 capable device and my computer is 5.2.

So when I download the project on my jetson, I put 3.2 on architecture of cuda device. All the process works properly except the texture interpolation.

I finally modify the architecture to 3.0 and now it works!!! I don’t understand why the 3.2 version don’t works on the jetson.

Futhermore, I would like to use the 3.2 version because I red that the 3.2 on Jetson was equivalent to the 3.5 on computer, and I would like to use CUBLAS on my jetson.

Is the Jetson 3.2 compatible?
CAn I use CUBLAS with the 3.2 version of Jetson?

Hi xav123,

For your question - “CAn I use CUBLAS with the 3.2 version of Jetson?”, the answer is Yes.

Thanks

Thank you for the anwser but why when I change the architecture to 3.2, the interpolation don’t work on the jetson?

Hi xav123,

May I know your CUDA toolkit version?
Just want to double confirm the system environment was setup correctly, then it might be an issue in TK1 cross-compiler configuration.

Thanks.

Hi,

The version of the CUDA Toolkit is release 6.5, V6.5.35