Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 600

How to find each black bar's begin and end row numbers ?

$
0
0
![image description](/upfiles/14825621517613014.png) ... (in vertical direction) A `cv::Mat` binarized image. Thanks I tried like following, `img` is given image in this question. bitwise_not(img, img_inv); int totalrows = img_inv.rows; int totalcols = img_inv.cols; int hist[totalrows]; int blackspacecount = 0; bool isbackground = true; for(int i=0; i 0) { if(isbackground == true) { blackspacecount++; isbackground = false; } } else { isbackground = true; } } int blackspaces[blackspacecount][2]; int p = 0; for(int i=1; i 0 && hist[i-1] == 0) { blackspaces[p][0] = i; // Begin } if ( hist[i] == 0 && hist[i-1] > 0) { blackspaces[p][1] = i-1; // End p++; } }

Viewing all articles
Browse latest Browse all 600

Latest Images

Trending Articles



Latest Images