Simple code don't give connected contour. No top or bottom edge instead. Result printscreen is square-bug.png . The picture itself is square.png. Code is:
void test(){
UMat img = imread("./square.png", IMREAD_COLOR).getUMat(ACCESS_READ);
UMat imgGray, imgGrayEdges3, imgGrayEdges5;
cvtColor(img, imgGray, CV_BGR2GRAY);
Canny(imgGray, imgGrayEdges3, 50, 150, 3);
Canny(imgGray, imgGrayEdges5, 300, 2000, 5); // why so large thresholds?..
cout << imgGray.getMat(ACCESS_READ) << "\n" << imgGrayEdges3.getMat(ACCESS_READ) << "\n" << imgGrayEdges5.getMat(ACCESS_READ) ;
imshow("img", img);
imshow("canny3", imgGrayEdges3);
imshow("canny5", imgGrayEdges5);
waitKey();
}
Am I doing something wrong?