We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include <cv.h> #include <highgui.h> using namespace cv; using namespace std; #define BLUE 0 #define GREEN 1 #define RED 2 #ifndef SCREEN_XY #define SCREEN_XY(x, y) (255 - ((255 - (x))*(255 - (y)) >> 8)) #endif int main(){ char imgfile[256] = "E:\\t11.jpg"; Mat src = imread(imgfile, CV_LOAD_IMAGE_COLOR); imshow("src", src); int size = src.cols * src.rows; uchar r = 0, g = 0, b = 0, g_alpha = 0; uchar *pSrcData = src.data; for (int i = 0; i < size; i++, pSrcData += 3) { g_alpha = 255 - pSrcData[GREEN]; b = pSrcData[BLUE]*g_alpha >> 8; g = pSrcData[GREEN]*g_alpha >> 8; r = pSrcData[RED]*g_alpha >> 8; pSrcData[BLUE] = SCREEN_XY(pSrcData[BLUE], b); pSrcData[GREEN] = SCREEN_XY(pSrcData[GREEN], g); pSrcData[RED] = SCREEN_XY(pSrcData[RED], r); } imshow("dst", src); waitKey(); return 0; }
The text was updated successfully, but these errors were encountered:
https://blog.csdn.net/grafx/category_1824345.html
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: