python - <<'PY'
import cv2,numpy as np,json
s='HH-7101';p='/workspace/scratch/finalmasks/'+s+'.png';old=cv2.imread('/workspace/scratch/7101_pre.png',0);ox,oy=json.load(open('/workspace/scratch/detailboxes.json'))[s][:2]
poly=[[59,281],[76,237],[95,192],[115,164],[143,146],[182,138],[251,137],[330,135],[410,134],[510,134],[650,134],[790,136],[940,141],[1060,150],[1120,155],[1191,174],[1235,195],[1261,230],[1286,271],[1304,309],[1326,352],[1340,1230],[0,1230],[0,333]]
b=np.zeros(old.shape,'uint8');cv2.fillPoly(b,[np.array(poly,'int32')+[ox,oy]],255);b=cv2.GaussianBlur(b,(0,0),3)
# Hand-finished low-contrast sofa-facing edge; retain all opaque pile texture.
old[:oy+260]=b[:oy+260];cv2.imwrite(p,old)
PY