MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / splitColorAndAlpha

Function splitColorAndAlpha

jni/venus/region_operation.cpp:1070–1094  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1068}
1069
1070void splitColorAndAlpha(const Mat& image, Mat& color, Mat& alpha)
1071{
1072 assert(image.type() == CV_8UC4);
1073 color = Mat(image.size(), CV_8UC3);
1074 alpha = Mat(image.size(), CV_8UC1);
1075
1076// Mat image_bgr;
1077// cvtColor(image, image_bgr, CV_BGRA2BGR);
1078 for(int r = 0; r < image.rows; ++r)
1079 for(int c = 0; c < image.cols; ++c)
1080 {
1081//#ifdef ANDROID
1082// const cv::Vec4b& argb = image.at<cv::Vec4b>(r, c);
1083// // Config.ARGB_8888 means ANDROID_BITMAP_FORMAT_RGBA_8888
1084// // Android use ARGB, different name, damn it! https://groups.google.com/d/topic/android-ndk/XBGh8LZvkls
1085// alpha.at<uchar>(r, c) = argb[0];
1086// color.at<cv::Vec3b>(r, c) = *reinterpret_cast<const cv::Vec3b*>(reinterpret_cast<const uchar*>(&argb) + 1);
1087//#else
1088 // OpenCV use BGRA, what a mess world!
1089 const cv::Vec4b& bgra = image.at<cv::Vec4b>(r, c);
1090 color.at<cv::Vec3b>(r, c) = *reinterpret_cast<const cv::Vec3b*>(&bgra);
1091 alpha.at<uchar>(r, c) = bgra[3];
1092//#endif
1093 }
1094}
1095
1096cv::Mat& stretchImageWithAlpha(const Mat& src_image, Mat& dst_image, const std::vector<cv::Point2f>& src_points, const std::vector<cv::Point2f>& dst_points, const std::vector<cv::Vec3i>& indices)
1097{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected