How to make Otsu threshold locally?

asked 2017-10-13 02:32:21 -0600

gino0717 gravatar image

updated 2017-10-13 03:50:17 -0600

hi all, I have a depth camera and I have to segment hand as foreground for hand detection application, I find that Otsu is really good. says:

threshold( src, dst, 0, 255, THRESH_BINARY|THRESH_OTSU);

image description

a threshold almost done everything I want.

but there is a hand overlap with the body, in the threshold image the otsu cannot segment it.

now I divid the image into about 100 Rect as roi and do OTSU

it's like something I want: after getting the foreground (body), if there is a hand, make the body part behind the hand different color. then I can segment the hand overlap with the body.

image description

however, this method is not smart and the image is too ugly , I had tried to make the otsu method like a filter and compare the pixel one by one, but it is too slow.

Is any smarter way to do this? thanks for any advice!

edit:

origin image: (not all the same but same result )

depth image: image description

IR image: image description

for de-noising purpose I use IR image to do a Otsu and get a mask, then use the mask to cut out the depth image to get a lesser noise depth image, then I use Otsu again in Depth image to get the foreground.

edit retag flag offensive close merge delete

Comments

1

could you post the original image

sturkmen gravatar imagesturkmen ( 2017-10-13 03:13:52 -0600 )edit

In this sample, the hands are the closest objects. I would use directly the depth metric to keep the closest (connected with the body?) large blobs.

Eduardo gravatar imageEduardo ( 2017-10-13 06:24:01 -0600 )edit