Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think this answer from Alexander Smorkalov at OpenCV4Android group, suits you:

https://groups.google.com/d/topic/android-opencv/qSvJqaDdC_4/discussion

Quoting Alexander Smorkalov, for reference:

You can use several different ways to create mask for image. If you create images your self you can use alpha-channel as a mask. You need to save image in *.png format, and then load it with flags =-1 in imread. Then split it with cv::split function and path alpha channel as a mask.

If you cannot use alpha channel you can create mask using threshold ( http://docs.opencv.org/trunk/modules/imgproc/doc/miscellaneous_transformations.html?highlight=threshold#cv.Threshold )