Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

inRange() takes a 3channel input, and gives a 1 channel output, right ?

i got no real idea about the java/android wrappers, but i'd say, that

Core.inRange(roi, new Scalar(0, 10, 60), new Scalar(20, 150, 255), roi);

does not do, what you expect here, you can't do it in-place. ( you probably need a fresh Mat for the output, like in the c++ example )

same problem in the lines below: copying back a 1 channel img to a rgb one won't work, you'd need to cvtColor(src,dst,CV_GRAY2RGB); that(c++ speak), before copying it back to the original image.

inRange() takes a 3channel input, and gives a 1 channel output, right ?

i got no real idea about the java/android wrappers, but i'd say, that

Core.inRange(roi, new Scalar(0, 10, 60), new Scalar(20, 150, 255), roi);

does not do, what you expect here, you can't do it in-place. ( you probably need a fresh Mat for the output, like in the c++ example )

same similar problem in the lines below: copying back a 1 channel img to a rgb one won't work, you'd need to cvtColor(src,dst,CV_GRAY2RGB); that(c++ speak), before copying it back to the original image.