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.