I am looking at creating a calibration pattern that works for both EO and LWIR. As a first step I'm trying to identify crossing heated wires that will overlay a traditional checkerboard. Ideas that come to mind are hough lines and 2D filter maxima, but none seem to give satisfactory results. Any ideas?
#include <string>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
void printAbout()
{
std::cout << "\nLWIR Calibration Pattern Filter Test:"
<< "\n\tThis program... "
<< "\n\t\n\n";
}
int main(int argc, const char** argv)
{
const cv::String keys =
"{ @image | <none> | LWIR image calibration target }"
"{ h help | | print this message }";
cv::CommandLineParser parser(argc, argv, keys);
if(parser.has("help"))
{
printAbout();
parser.printMessage();
std::cout << std::endl;
return 0;
}
if(!parser.check())
{
parser.printErrors();
return 0;
}
const std::string image = parser.get<std::string>("@image");
cv::Mat lwir = cv::imread(image, cv::IMREAD_GRAYSCALE);
cv::Mat kernel = (cv::Mat_<float>(9,9) << -8, -8, 0, 1, 4, 1, 0, -8, -8,
-8, -4, 0, 1, 4, 1, 0, -4, -8,
0, 0, 0, 1, 4, 1, 0, 0, 0,
1, 1, 1, 2, 4, 2, 1, 1, 1,
4, 4, 4, 4, 4, 4, 4, 4, 4,
1, 1, 1, 2, 4, 2, 1, 1, 1,
0, 0, 0, 1, 4, 1, 0, 0, 0,
-8, -4, 0, 1, 4, 1, 0, -4, -8,
-8, -8, 0, 1, 4, 1, 0, -8, -8);
cv::Mat filtered;
cv::filter2D(lwir, filtered, CV_32F, kernel);
cv::normalize(filtered, filtered, 1.0, 0.0, cv::NORM_MINMAX, CV_32F);
cv::imshow("Input", lwir);
cv::imshow("Filtered", filtered);
cv::waitKey(0);
return 0;
}