prepare_reference
Clean and crop a real-world reference image, remove its background, and keep the largest object to produce an RGBA PNG silhouette for use with other reference tools.
Instructions
Clean a real-world reference for the other reference tools: crop it, remove the background and keep only the
biggest object (a photo with two donuts and a caption becomes one donut with a transparent background). crop is
[x0, y0, x1, y1] as fractions of the image from the top left (one panel of a sheet of views). keep=all keeps every blob.
threshold is the colour distance from the background; leave it out and it is set just above the noise of the
picture border (the answer shows the value). The background must be plain.
fill_holes closes holes inside the object that are smaller than this share of the object area (glare on steel
that looks like background); bigger openings such as a trigger guard stay. 0 closes nothing, 1 closes all.
flip 'x' mirrors left-right, 'y' top-bottom; rotate turns clockwise by degrees (flip first).
Use them to bring a panel to the picture a view expects (see compare_view).
The result is an RGBA PNG cropped to the silhouette with pad margin; use its path as the reference of
compare_view, fit_to_reference, visual_hull, measure_profile. The answer has the hole count and hole area share
before and after filling, the blobs dropped, a warning (many open holes, the object touches the crop border, a
big part dropped) and a preview picture: the cut-out over magenta and the mask (white object, green filled
holes, red open holes). Look at the preview: alpha is not visible in the PNG itself.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| out | No | ||
| pad | No | ||
| crop | No | ||
| flip | No | ||
| keep | No | largest | |
| image | Yes | ||
| rotate | No | ||
| threshold | No | ||
| fill_holes | No |