Per Pixel Thresholding
-
24-05-2021 - |
Domanda
I was wondering if it is possible in opencv to have a threshold value per pixel. For example p(x,y) should be above 100 and then p(x+1,y) should be above 101.
You can see this as background subtraction. So that everything in front of the background remains.
I was thinking something like this. I have an image and then the other image. I subtract them. This means everything that is left should be above the threshold.
For example:
At the right side is the image taken when the camera (kinect) is launched. Then the image to the left is the current camera feed - the image at the left side.
the code :
cvSub(depth, depthInit, difference, null);
Since nothing changes this should be more black (I can understand there is some noise)
Could this be because there are negative values left or something ?
Thx in advance
Soluzione
I think you want cvCmp
(Docs)
// make sure threshold is zero to start with
cvZero(thresholded);
// for pixels where current > background, sets thresholded = high value
cvCmp(current, background, thresholded, CV_CMP_GT);
Altri suggerimenti
Take a look at this question. It helps you?
You can also try to sweep pixel per pixel, using a for, and increment the thresholds...