please do NOT write loops like that, they’re slow, error prone, and defeat the purpose of a high-level matrix library like opencv
you already got x,y wrong, it’s at(row,col)
in opencv
please rather copy a whole ROI, like in:
Rect child_rect(child.getX(),child.gety(),child.getW(),child.getH()));
final.copyTo(img2(child_rect));