You need to read the result buffer before accessing it on the cpu, and
synchronise as well - i.e. block wait, or q.finish();
This is a really basic part of the opencl api.
CLBuffer<IntBuffer> resultIndex = context.createIntBuffer(4, CLMemory.Mem.READ_WRITE);
CLBuffer<FloatBuffer> results = context.createFloatBuffer(4, WRITE_ONLY);
resultIndex.getBuffer().put(0, 0);
--> here 1
dec.loadImage(queue, clImg2d);
dec.detectObjects(queue, resultIndex, results);
--> here
if(resultIndex.getBuffer().get(0)> 0) {
System.out.println("face found");
float fi = results.getBuffer().get(0);
System.out.println("float 0 : " + fi);
}
i.e. at 'here' you need to do a queue.putReadBuffer(resultIndex,
false).putReadBuffer(results, true);
and at 'here 1' you need to also write the resultindex buffer to the device.
Also as the documentation suggests the image should be greyscale - and
in socles i'm using 'R' channel type for that. ImageLoader will convert
to greyscale (using java2d) if necessary.
Z
On 04/08/11 21:04, pratap koritala wrote:
> Hi Micheal,
>
> I've written a small test ( Attached).
> I knew you've properly tested it, But somehow my test program doesn't
> work.
> Can you please have look at it.
>
> Regards,
> Pratap.
My final try with socles,
I've already tried as you suggested, but it didn't work.
I also tried to convert to grey scale using java 2d api, commented out.
PS: I am trying it on lena.jpg supplied with openCV.
My final try with socles,
I've already tried as you suggested, but it didn't work.
I also tried to convert to grey scale using java 2d api, commented out.
PS: I am trying it on lena.jpg supplied with openCV.
On Fri, Aug 5, 2011 at 5:31 AM, mike <not...@gmail.com> wrote:
Also, use more than 4 entries for the result buffer - the raw output
from vj will have many hits at various scales- e.g. see the result i
obtained, it had 50 odd results. Further processing is required to use it.
Hmm, don't really see issues with the code though; assuming the opencl
stuff is working. What opencl implementation are you using? I've only
tested with nvidia gpu, and the amd cpu driver.
On 08/08/11 16:15, pratap koritala wrote:
> >> If you had already tried as i suggested why did you send me a
> version which cannot work?
>
> I kept trying after sending you mail also, I've tried it.
> Still, I could not get it to work with lena.
>
> Anyway, I appreciate your continued support in this.
>
> regards,
> Pratap .K