You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
could we include 4-channels images, too? i.e. 4D alpha images? #15927
reason: all images with 4 channels (alpha channels) are required to be converted to 3 channels on the client side, then back to 3 channels just for API compatibility purposes.
Activity
ghost changed the title [-]could this not include alpha 4-channel images, too?[/-][+]could we include 4-channels images, too? i.e. 4D alpha images?[/+]on Nov 17, 2019
Hello
I am new to opencv community and would like to work on this issue. So I just wanted to know if the following code would resolve the issue. If not, do let me know how to resolve the issue
`
static Mat checkMask(InputArray _mask, Size size)
{
Mat mask = _mask.getMat();
Mat gray;
if (mask.channels() == 3)
cvtColor(mask, gray, COLOR_BGR2GRAY);
else if(mask.channels() == 4)
cvtColor(mask, gray, COLOR_BGRA2GRAY);
else
{
if (mask.empty())
gray = Mat(size.height, size.width, CV_8UC1, Scalar(255));
else
mask.copyTo(gray);
}
return gray;
}
Surely,we can use this to convert 3 channels to 4 channels image = cv2.cvtColor(image, cv2.COLOR_BGR2RGBA)
And similarly we can convert into 3 channels .
So, we use RGBA2BGR
Activity
[-]could this not include alpha 4-channel images, too?[/-][+]could we include 4-channels images, too? i.e. 4D alpha images?[/+]nappaillav commentedon Dec 30, 2019
Hello
I am new to opencv community and would like to work on this issue. So I just wanted to know if the following code would resolve the issue. If not, do let me know how to resolve the issue
`
`
Lalit-garg commentedon Jan 17, 2020
Surely,we can use this to convert 3 channels to 4 channels
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGBA)
And similarly we can convert into 3 channels .
So, we use RGBA2BGR