where things are.\ngreen = np.clip(img[:,:,1] - 0.5*(img[:,:,0]+img[:,:,2]), 0, None)\nys,xs = np.mgrid[0:16,0:16]; tot = green.sum()\ncx = float((green*xs).sum()/tot); cy = float((green*ys).sum()/tot)\nprint(\"feature centroid at\",(round(cx,1),round(cy,1)),\" true target\",(tx,ty))\nassert abs(cx-tx)<=1 and abs(cy-ty)<=1, \"the feature centroid should sit on the target\"\nprint(\"PASS - a visual feature turns pixels into a location. That is what 'vision' does in a VLA.\")","label":"A visual feature → a location"}],"intro":"Build a colour feature and locate the target by its centroid.","key":"vision-language-action/vision","kind":"python","title":"See: pixels to a place"}">
PYTHON · NUMPY · IN-BROWSER
See: pixels to a place
Build a colour feature and locate the target by its centroid.
You read
the arrays and values already in scope
You change
the code you write in each cell
Fixed
the dataset and the checks that grade you