

__global__ void Compose_Images(uchar3 *ComposedImage_dev,uchar3 *Image1_dev,uchar3 *Image2_dev,float alpha,int N){
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	if (idx<N){
		ComposedImage_dev[idx].x=alpha*Image1_dev[idx].x+(1-alpha)*Image2_dev[idx].x;
		ComposedImage_dev[idx].y=alpha*Image1_dev[idx].y+(1-alpha)*Image2_dev[idx].y;
		ComposedImage_dev[idx].z=alpha*Image1_dev[idx].z+(1-alpha)*Image2_dev[idx].z;
	} 
}


extern "C"
void CUDA_Compose_Images(uchar3 *ComposedImage_dev,uchar3 *Image1_dev,uchar3 *Image2_dev,float alpha,int N,dim3 grid,dim3 threads){
	Compose_Images<<<grid,threads>>>(ComposedImage_dev,Image1_dev,Image2_dev,alpha,N);	
}