         double mean=sum/(kernel_size*kernel_size);
         double var=square_sum/(kernel_size*kernel_size)-mean*mean;
         var=sqrt(var);
-        *(outputMean+x+y*H)=mean;
-        *(outputvar+x+y*H)=var;
+        setPixel(outputMean,H,W,x,y,mean);
+        setPixel(outputvar,H,W,x,y,var);
     }
 }
__global__ void intensityFeature(const unsigned char * inputData,double *outputMean,double *outputvar,const int H,const int W,int r)
{
    int x = blockIdx.x * blockDim.x + threadIdx.x;

       y<kernel_radius || y>=W-kernel_radius)
    {
        char temp_value=*(inputData+x+y*H);
        setPixel(outputMean,H,W,x,y,temp_value);
        setPixel(outputvar,H,W,x,y,0);
    }
    else
    {
