Side fill opencv.I want to fill sides of a binary image.
I have a binary image. I want to fill its sides. like this- for it I wrote a code in opencv (here I am just mentioning code for that particular section only)
for (int j =dst.cols; j>=0; j--) {
for (int i =dst.rows; i>=0; i--) {
if (dst.at<char>(i,j) == 0){
dst.at<char>(i,j)=255;
}
if (dst.at<char>(i,j)>0){
for (int k =i; k>=0; k--) {
dst.at<char>(k,j)=0;
}
}
}
}
//But I dont get the result.It shows "Segmentation fault(core dumped)" and sometimes it shows but it shows whole image black. Please help.
j=dst.cols is not a valid index. j=dst.cols-1 is. (same for i)
fine. but it's again showing completely white image? Is there a problem in Logic?
wait, that was about the segfault only.
sorry, but i neither understand, what your code does, nor what you're trying to achieve.