Ask Your Question

background substraction with CV_16UC1

asked 2013-10-04 15:04:50 -0600

leRoss gravatar image

updated 2013-10-21 13:15:38 -0600

With Openni I want to use the Depthmap who is in CV_16UC1 and apply the background substracter to find the background pixels.

The background cv::BackgroundSubtractorMOG seems to accept only CV_8U images.

Is there a way to make it work with CV_16U images ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-10-21 13:35:35 -0600

Moster gravatar image

You will need to convert your image to 8 bit.

So, try this:

Mat input8bit;
input16bit.convertTo(input8bit, CV_8U, 1.0/256);
edit flag offensive delete link more


I will loose some precision that way.

Someone told me that if I remove the ASSERT that validate if the CV_U8 images it worked for them before. ( I have to recompile OpenCV)

I will try it and post my results here

leRoss gravatar imageleRoss ( 2013-10-21 15:05:46 -0600 )edit

Question Tools


Asked: 2013-10-04 15:04:50 -0600

Seen: 397 times

Last updated: Oct 21 '13