1 | initial version |
If the mazes are all this regular and all this nicely binarized, you should just check single pixels in the center of the lane, in the center of each segment (like the image). If it's black, there's a segment, if it's white, there's no segment.
2 | No.2 Revision |
If the mazes are all this regular and all this nicely binarized, you should just check single pixels in the center of the lane, in the center of each segment (like the image). If it's black, there's a segment, if it's white, there's no segment.
EDIT:
image = imread("C:\\Users\\Tetragramm\\Downloads\\pre-corners.jpg");
cvtColor(image, trueGray, COLOR_BGR2GRAY);
threshold(trueGray, trueGray, 128, 255, THRESH_BINARY);
copyMakeBorder(trueGray, gray, 10, 10, 10, 10, BORDER_CONSTANT, 255);
cornerHarris(gray, output, 1, 1, 1);
double min, max;
minMaxIdx(output, &min, &max);
cv::threshold(output, output, min + (max - min) / 100.0, 255, THRESH_BINARY_INV);
cv::imshow("output", output);
waitKey();