1 | initial version |
Maybe I do not fully understand the problem, but using contours in this case seems like ovekill to me.
If that's always the last column, and there is always only one segment missing, then maybe:
- rotate the image 90deg counterclockwise (in order to get the pointer to the last two columns) cv::transpose()
and add the column faster
- add the missing column cv::Mat::push_back()
- go along the (n-1)th column (which after rotation becomes the second row) and
- starting from the first non-white pixel in (n-1)th column
- set all n-th column pixels to red
- until you reach next non-white pixel in the (n-1)th column.
For more information on how to iterate over the image see: http://docs.opencv.org/2.4/doc/tutorials/core/how_to_scan_images/how_to_scan_images.html
If there are more than one segments missing, this will be still doable.
2 | No.2 Revision |
Maybe I do not fully understand the problem, but using contours in this case seems like ovekill to me.
If that's always the last column, and there is always only one segment missing, then maybe:
- maybe:
cv::transpose()
and add the column cv::Mat::push_back()
For more information on how to iterate over the image see: http://docs.opencv.org/2.4/doc/tutorials/core/how_to_scan_images/how_to_scan_images.html
If there are more than one segments missing, this will be still doable.
3 | No.3 Revision |
Maybe I do not fully understand the problem, but using contours in this case seems like ovekill to me. If that's always the last column, and there is always only one segment missing, then maybe:
cv::transpose()
cv::Mat::push_back()
(append your image to the single-row image)For more information on how to iterate over the image see: http://docs.opencv.org/2.4/doc/tutorials/core/how_to_scan_images/how_to_scan_images.html
If there are more than one segments missing, this will be still doable.