0

I've created a matrix from a ARGB_8888 bitmap like this:

Mat detectedFaceMat = Utils.bitmapToMat(bmp1);

The resultant matrix has 4 channels. I now need to compare it to 1 channel matrices. Not sure how to convert the 4 channel to 1 (I only need grayscale).

scoleman2272
  • 348
  • 5
  • 17

1 Answers1

2

OpenCV supports CV_BGRA2GRAY with cv::cvtColor() or cvCvtColor() which converts BGRA pixels to Grey.
It is possible that ARGB is in fact BGRA in memory (this is the most common format). In this case The above conversion will work as expected.

If not, you can always use the green channel as a pretty good approximation for grey.

Adi Shavit
  • 15,030
  • 2
  • 55
  • 121