标签:图像 透明 enc rgba div image opencv rgb pen
cv::Mat transparentImage; cv::cvtColor(image, transparentImage, CV_BGR2BGRA); // find all white pixel and set alpha value to zero: for (int y = 0; y < transparentImage.rows; ++y) { for (int x = 0; x < transparentImage.cols; ++x) { cv::Vec4b & pixel = transparentImage.at<cv::Vec4b>(y, x); // if pixel is white if (pixel[0] == 255 && pixel[1] == 255 && pixel[2] == 255) { // set alpha to zero: pixel[3] = 0; } } }
标签:图像 透明 enc rgba div image opencv rgb pen
原文地址:https://www.cnblogs.com/nanfei/p/14307424.html