A Blender addon that finds the X, Y and Z perspective in an image automatically and builds the matched camera, like fSpy but without placing the lines by hand. Needs only Blender (numpy is bundled).
- Run
python build_zip.pyto produceAutoSpy.zip. - In Blender: Edit > Preferences > Add-ons > Install, pick
AutoSpy.zip, and tick AutoSpy.
Open the 3D viewport sidebar (press N), then the AutoSpy tab. The panel is five numbered steps.
- Choose an image, or an existing
.fspyfile. - Press Auto Align. This creates a camera named after the file, sets its lens, render size and background image, and switches to camera view.
- Check the result. The detected edges are drawn in camera view: red = X, green = Y, blue = Z.
- If the horizontal axes are the wrong way round, press Swap X/Y. Change Up picks a different axis as Z.
If the lens is known, tick Lock focal length and enter it (mm on a 36mm sensor).
Press Set Origin, then click a point on the real ground in the photo (a corner where a wall meets the floor works well). That point becomes world (0, 0, 0). Needed before Scale, the scaffold, or tracing, since they all measure from the ground plane.
Enter a real length and pick what it measures: Height, Along X, Along Y, or On Ground for a distance between two ground points. Press Set Scale, click the start of that reference (on the ground), then the end. The whole scene is rescaled so Blender units become real metres.
Add Scene Scaffold adds a ground plane set as a shadow catcher, a sun light, and compositor nodes that layer your render over the photo. Switches the renderer to Cycles (needed for the shadow catcher in 3.6) and the view transform to Standard, since Filmic would wash out the photo. Safe to run again: it updates its own objects rather than duplicating them, and leaves your compositor nodes alone if you've already customised them.
Auto Build Box (experimental) needs no clicking. It takes the vertical edges AutoSpy already detected, works out where each one touches the ground and how tall it is, and builds a box spanning all of them.
This is often wrong on real photos, and you should check it before trusting it. On a clean, simple scene it can work well. On a cluttered facade with windows, pipes or brickwork, those edges look just like real corners to the detector, and there's no reliable way to tell them apart from line geometry alone — in testing, it sometimes produced a box the wrong size or shape entirely. Compare the result against the photo, and prefer Trace Walls when it matters.
Manual trace, the reliable way to build, for anything the box doesn't fit or get right:
- Trace Walls: click a wall's base start, base end, then its top, which adds a vertical quad. The base snaps to the X or Y axis; hold Shift for a free angle. Click again to continue to the next wall from the last corner. Backspace undoes the last click or wall, Esc or right-click finishes.
- Trace Floor: click two opposite corners of a ground rectangle.
All tools work in camera view. A click above the horizon, or with the camera below the ground, gives a message instead of placing anything — set the origin on the ground first if you see that.
Save .fspy writes a project you can open in the fSpy app to fine tune. It carries the camera's rotation and lens, but not the real-world scale from step 3, since fSpy's own format has no field for it.
Clear straight edges running in at least two different directions: building corners, window frames, floor and wall lines, tables. Heavily rounded, blurry or cluttered scenes give a Low confidence rating, and the panel says why. Strongly fisheye or wide-angle lenses with visible barrel distortion should be corrected first.
- Z is the axis closest to straight up the image, X the remaining one closest to the right, and Y completes a right-handed set.
- Everything AutoSpy creates (ground, sun, walls, floors) lives in an AutoSpy collection, and moves together when you set the origin or scale.
- Re-running Auto Align resets the camera to the image's default framing. If you've already set an origin or scale and added traced geometry, it warns that those objects may no longer line up.
- Tests:
python -m pytest tests.