// Lab05_2.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include #include #include #include #include #include int main() { cv::Mat I = cv::imread("C:/Users/student/Downloads/foggy.jpg", 1); cv::Mat hsv; cv::Mat splitted[3]; cv::Mat result; float brightness = 0; int hue = 0; std::cin >> brightness >> hue; cv::cvtColor(I, hsv, cv::COLOR_RGB2HSV); cv::split(hsv, splitted); splitted[0].convertTo(splitted[0], CV_32FC1); splitted[0] += hue; splitted[0].convertTo(splitted[0], CV_8UC1); splitted[2].convertTo(splitted[2], CV_32FC1); splitted[2] += brightness/100; splitted[2].convertTo(splitted[2], CV_8UC1); cv::merge(splitted, 3, result); for (int i = 0; i < result.rows; i++) { for (int j = 0; j < result.cols - 1; j += 2) { cv::Vec3b temp = result.at(i, j); result.at(i, j) = result.at(i, j + 1); result.at(i, j + 1) = temp; } } for (int i = 0; i < result.rows; i++) { for (int j = 0; j < result.cols - 1; j += 2) { cv::Vec3b clear; clear[0] = 0; clear[1] = 0; clear[2] = 0; int isNeedtoClear = std::rand() % 2; if (isNeedtoClear) result.at(i, j + 1) = clear; } } cv::cvtColor(result, result, cv::COLOR_HSV2RGB); cv::imshow("test", result); cv::waitKey(); std::cout << "Hello World!\n"; } // Run program: Ctrl + F5 or Debug > Start Without Debugging menu // Debug program: F5 or Debug > Start Debugging menu // Tips for Getting Started: // 1. Use the Solution Explorer window to add/manage files // 2. Use the Team Explorer window to connect to source control // 3. Use the Output window to see build output and other messages // 4. Use the Error List window to view errors // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file