opencv 图像透明
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; } } }
桂棹兮兰桨,击空明兮溯流光。