The contours are wrong:
Mat arr(10,10,CV_8UC1,Scalar(0));
rectangle(arr,Point(2,0),Point(6,0),Scalar::all(1),-1);
cout << arr << endl;
vector<vector<Point>> contors;
findContours(arr,contors,CV_RETR_CCOMP,CV_CHAIN_APPROX_NONE);
for (size_t i=0;i < contors.size();i++)
cout << boundingRect(contors[i]) << endl;
Mat arr(10,10,CV_32SC1,Scalar(0));
rectangle(arr,Point(2,1),Point(6,1),Scalar::all(1),-1);
cout << arr << endl;
vector<vector<Point>> contors;
findContours(arr,contors,CV_RETR_CCOMP,CV_CHAIN_APPROX_NONE);
for (size_t i=0;i < contors.size();i++)
cout << boundingRect(contors[i]) << endl;