#include <QCoreApplication>
#include <iostream>
#include <opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main(int argc, char *argv[])
{
cv::Mat srcImage = cv::imread("./imori.jpg",cv::IMREAD_COLOR);
int width = srcImage.rows;
int height = srcImage.cols;
cv::Mat dstImage = cv::Mat::zeros(height,width,CV_8UC1);
for (int j = 0; j < height;j++)
{
for (int i = 0 ; i < width ; i++)
{
dstImage.at<uchar>(j,i) = (int)((float)dstImage.at<cv::Vec3b>(j,i)[0] * 0.0772
+ (float)dstImage.at<cv::Vec3b>(j,i)[1] * 0.7152
+ (float)dstImage.at<cv::Vec3b>(j,i)[2] * 0.2126);
}
}
cv::imshow("SrcImage",srcImage);
cv::imshow("DstImage",dstImage);
std::cout << "END!" << std::endl;
cv::waitKey(0);
return 0;
}