constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR; struct input { int test; }; kernel void BWConvertor(read_only image2d_t frame, read_write image2d_t outImage, struct input params) { int2 gid = (int2)(get_global_id(0), get_global_id(1)); int2 size = get_image_dim(frame); if(all(gid < size)){ uint4 pixel = read_imageui(frame, sampler, gid); float4 color = convert_float4(pixel) / 255; //color.xyz = 0.2126*color.x + 0.7152*color.y + 0.0722*color.z; int a = 0.3*pixel.x + 0.59*pixel.y + 0.11*pixel.z; pixel.x = a; pixel.y = a; pixel.z = a; write_imageui(outImage, gid, pixel); } }