1.OpenCL提供了大量可以在内核中运行的图像处理函数,它们大致可以分为以下三类:
(1)Read functiongs--返回给定坐标上的颜色取值;
(2)write functiongs-- 设定给定坐标上的颜色取值;
(3)Information functions-- 提供关于图像对象的信息,例如图像的维度以及像素属性;
图像读取函数是从图像对象中读取向量,他们各自的参数基本一样。唯一的区别是函数返回的是浮点数向量还是整数向量,读取的是二维图像对象还是三维图像对象。
读取图像数据的内核函数:
1.float4 read_imagef(image2d_t img,sampler_t sampler, int2/float2 coord)--以float4型向量的形式读取二维图像在coord位置的颜色数据;
2.int4 read_imagei(image2d_t img,sampler_t sampler, int2/float2 coord)--以int4型向量的形式读取二维图像在coord位置的颜色数据;
3.uint4 read_imagui(image2d_t img,sampler_t sampler, int2/float2 coord)--以uint4型向量的形式读取二维图像在coord位置的颜色数据;
4.float4 read_imagef(image3d_t img,sampler_t sampler, int4/float4 coord)--以float4型向量的形式读取三维图像在coord位置的颜色数据;
5.int4 read_imagei(image3d_t img,sampler_t sampler, int4/float4 coord)--以int4型向量的形式读取三维图像在coord位置的颜色数据;
6.uint4 read_imagui(image3d_t img