# Revision history [back]

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.

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:

• rotate the image 90deg counterclockwise (in order to get the pointer to the last two columns) cv::transpose() and add the column faster - 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 - 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.

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) columns and add the column faster) cv::transpose() and add the column faster
• add the missing column cv::Mat::push_back() (append your image to the single-row image)
• 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.