- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello,
I am new with OpenCL
Iam using it with jOCL in java platform
My problem is that I want to read an image pixels using read_imagef, and all the results of it returns 0.0 (.x .y .z .w) knowing that the image is contains red area.
here is my kernel
const sampler_t smp = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
__kernel void basic(__read_only image2d_t input,__global int *result)
{
int gidX = get_global_id(0);
int gidY = get_global_id(1);
int2 coord = (int2)(get_global_id(0), get_global_id(1));
int2 posIn = {gidX, gidY};
float4 pixel = read_imagef(input, smp, posIn);
result [gidX]= as_int(pixel.x);
}
what do you think the problem is???
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, I used also float variable and it always returns 0.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is my buffer allocation
DataBufferInt dataBufferSrc =
(DataBufferInt)image.getRaster().getDataBuffer();
int dataSrc[] = dataBufferSrc.getData();
cl_image_format imageFormat = new cl_image_format();
imageFormat.image_channel_order = CL_RGBA;
imageFormat.image_channel_data_type =CL_UNORM_INT8;
//CL_UNSIGNED_INT8;
inputImageMem = clCreateImage2D(
context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
new cl_image_format[]{imageFormat}, sizeX, sizeY,
sizeX * Sizeof.cl_uint, Pointer.to(dataSrc), null);
cl_mem memObjects[] = new cl_mem[2];
memObjects[0] = clCreateBuffer(context,
CL_MEM_READ_WRITE, Sizeof.cl_uint * sizeX, null, null);
I changed CL_UNORM_INT8 to CL_UNSIGNED_INT8 but there was no difference, I will try to print the result in the kernel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I tried to print te result in the OpenC Code builder but the pplication is blocked
When I build it is OK but when I want tosee the result by analysing it is deprecated
Could you know the reason???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you send more info on what you found was deprecated/blocked? Which OpenCL release are you using? On which operating system?
For an example using read_imagef, the Intel SDK for OpenCL applications Codebuilder Visual Studio integration can generate a starting point based on images. It can often be helpful to begin with a known good starting point.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page