cant add more than 3 attachment so filter 3 and the code here
Code:
#include <iostream>
#include "opencv2/opencv.hpp"
#include "common_ocr_functions.h"
int main() {
cv::Mat source = cv::imread("D:/PROJECTS/opencv_sample/example.png");
//cv::imshow("source", source);
//cv::waitKey();
//ShowLarge10x("source", source, true);
cv::Mat filter1(source.rows * 2, source.cols * 2, CV_8UC1);
for (int row = 0; row < source.rows; row++) {
for (int col = 0; col < source.cols; col++) {
cv::Vec3b point = source.at<cv::Vec3b>(row, col);
uint8_t b = point[0];
uint8_t g = point[1];
uint8_t r = point[2];
uint8_t h, s, v;
RGB2HSV(r, g, b, &h, &s, &v);
filter1.at<uint8_t>(row * 2 + 0, col * 2 + 0) = v;
filter1.at<uint8_t>(row * 2 + 1, col * 2 + 0) = v;
filter1.at<uint8_t>(row * 2 + 0, col * 2 + 1) = v;
filter1.at<uint8_t>(row * 2 + 1, col * 2 + 1) = v;
}
}
//ShowLarge10x("filter1", filter1, true);
cv::Mat filter2(source.rows * 2, source.cols * 2, CV_8UC1);
cv::GaussianBlur(filter1, filter2, cv::Size(4, 4), 0.0);
//ShowLarge10x("filter2", filter2, true);
cv::Mat filter3(source.rows * 2, source.cols * 2, CV_8UC1);
for (int row = 0; row < filter2.rows; row++) {
for (int col = 0; col < filter2.cols; col++) {
uint8_t v = filter2.at<uint8_t>(row, col);
filter3.at<uint8_t>(row, col) = 0;
if (v > 100) filter3.at<uint8_t>(row, col) = v;
}
}
ShowLarge10x("filter3", filter3, true);
std::cout << "\n\n";
std::system("pause");
return 0;
}