Thermal Calibration Pattern Detection
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 (there are 9 such crossings in the images below) 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;
}
Have you tried the corner detectors? IE: Harris corners?
Thanks for your reply, that's a fair point that we have previously tried,. However, the images are quite noisy with lots of sensor artifacts distributed over the entire image and this doesn't give any sense of structure.
Is it 8-bit or 16-bit data? If it's 16, can you post the original as a 16-bit PNG file somewhere so we can experiment?
Have you tried adaptive thresholding to remove everything but the wires?