Open main menu

CDOT Wiki β

Changes

GPU621/Group 3

99 bytes removed, 12:13, 12 April 2023
Class Declaration
#include "openMP_imgProc.h"
vvoid void openMP_imgProcessor::sharpenImg(cv::Mat& image) { 
//supressing OpenCV messages
std::streambuf* coutbuf = std::cout.rdbuf();
std::cout.rdbuf(nullptr);
 
// Convert the image to grayscale
cv::Mat grayscale;
cv::cvtColor(image, grayscale, cv::COLOR_BGR2GRAY);
  // Apply the kernel to the grayscale image //finds areas with quick jumps from dark to light, increases contrast theredouble sum = 0.0; #pragma omp parallel forreduction(+:sum)
for (int x = 1; x < image.cols - 1; x++) {
for (int y = 1; y < image.rows - 1; y++) {
double sum local_sum = 0.0;
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
sum local_sum += grayscale.at<uchar>(y + j, x + i) * LapKernel_[i + 1][j + 1];
}
}
//apply filter
for (int c = 0; c < 3; c++) {
image.at<cv::Vec3b>(y, x)[c] = cv::saturate_cast<uchar>(image.at<cv::Vec3b>(y, x)[c] + sum local_sum * 0.99);
}
 
sum += local_sum;
}
}
}
//Saturation Increase here
void openMP_imgProcessor::saturateImg(cv::Mat& image, double saturationLvl) {
cv::cvtColor(hsv, image, cv::COLOR_HSV2BGR);
//stop cv message supressionsupressing
std::cout.rdbuf(coutbuf);
}
72
edits