Re: Socles doubt

11 views
Skip to first unread message

mike

unread,
Aug 4, 2011, 8:01:22 PM8/4/11
to pratap koritala, socles-...@googlegroups.com

Hi Pratap,

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.

mike

unread,
Aug 5, 2011, 4:00:06 AM8/5/11
to pratap koritala, socles-...@googlegroups.com

Hi,

Lenna might not work without some tuning for that cascade, since it's really for full-frontal faces with even lighting.  Could always try other pics.

Or there could be bugs with varying image sizes.

 Z

On 05/08/11 16:05, pratap koritala wrote:
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.

mike

unread,
Aug 7, 2011, 10:48:59 PM8/7/11
to pratap koritala, socles-...@googlegroups.com

If you had already tried as i suggested why did you send me a version which cannot work?

To satisfy my curiosity I ran socles' viola & jones detector on an image of Lenna to see if it would work with that face.  I used the FRONTALFACE_DEFAULT cascade and fed it a greyscale image.

It shows the raw output highlighted, and clearly it appears to function just fine.

 Michael



On 05/08/11 16:05, pratap koritala wrote:
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:
lenna-fd.png

mike

unread,
Aug 8, 2011, 7:20:45 AM8/8/11
to pratap koritala, socles-...@googlegroups.com

Try using ImageFormats.R_UINT8 as the image format for the greyscale
image (float should work too though).

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

Reply all
Reply to author
Forward
0 new messages