Repository navigation
Add Tools > Auto-Mapping, to see the scene from the projector - #702
Merged
Merged
Conversation
The first part of the automatic mapping with a camera: the projector shows white, black, then black and white stripes of a Gray code, each followed by its inverse; a camera films them, and MapMap finds, for each point of the camera, the point of the output that lights it. From it comes the scene seen from the projector, with the points the camera did not see left transparent. The scan runs with the event loop. After each change of the projection, the first images of the camera are thrown away, as a webcam often sends images filmed before, then the scan waits for two images in a row that hardly differ. It fails when the camera sends nothing steady, or does not see the projection. SyntheticScene computes what a camera would film of flat faces on a table, with noise and the light of a room, so that the tests need no camera and no projector: more than 99 % of the lit points are read, less than half a pixel away.
…pes of the output editor The output canvas shows an image over the whole output frame, in place of the shapes and of the test signal, pixel for pixel and without smoothing, so that the finest stripes stay sharp. The canvases of the editors draw an image under the shapes, over their content rectangle.
The window chooses the camera and the screen of the projector, shows what the camera films, and starts the scan. During the scan, the output covers the screen of the projector, for this session only, and shows a countdown, then the stripes; it is shown as before afterwards. The scene seen from the projector then shows under the shapes of the output editor, with in red what the camera did not see. Tools > Show Auto-Mapping Image hides it, Tools > Clear Auto-Mapping Image forgets it; it is never saved, and goes with the project. --auto-mapping-simulation films a computed scene instead of a camera; --auto-mapping-save-images <folder> writes the images of the camera, which are otherwise never written to the disk.
On macOS, a blank cursor does not hide the pointer when the output window comes under a still mouse, as it does when a scan starts: the camera would film it. It is now hidden again at each image, as long as it is over the output.
The shadow of a window draws a thin light outline around it, even without a frame: around the whole screen when the output covers it. The output has no shadow while it covers a screen, and gets it back as an ordinary window.
sofian
approved these changes
Dec 4, 2026
sofian
left a comment
Member
There was a problem hiding this comment.
This feature should be moved to an add-on when the plugins system is ready.
aalex
force-pushed
the
feat-camera-auto-mapping
branch
from
December 4, 2026 06:14
0004d77 to
ef52fe2
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First part of the slice "Caler les formes tout seul grâce à une caméra" (automatic mapping with a camera): the scan, and the scene seen from the projector. Placing shapes on the flat faces found comes in a second pull request.
--auto-mapping-simulationfilms a computed scene (a table, three blocks and a black object) instead of a camera, to try everything without a camera or a projector.--auto-mapping-save-images <folder>writes each image kept, and the scene seen from the projector; without it, no image of the camera is ever written to the disk.How:
src/automap/, new:GrayCodePattern(the images),GrayCodeDecoder(reads them as they come: a point is lit when white is brighter than black by 20 levels; each bit compares the stripes with their inverse, so the light of the room cancels out; a point on the edge of a stripe is decided by the sign, and lands one pixel away at worst),Correspondence(camera point → output point, and the scene seen from the projector, with its small holes filled from their neighbours),AutoMapScan(the scan, with the event loop),AutoMapFrameSource(a real camera with Qt Multimedia, or a simulated one),SyntheticScene(the computed scene of the tests and of the simulation).Demo
--auto-mapping-simulation, open a project.Tests
tests/TestAutoMap.cpp, 16 tests, on scenes computed bySyntheticScenewith noise and the light of a room: Gray code; images and their order; more than 99 % of the lit points read, less than 0.5 pixel of mean error; with the two finest series skipped, less than 1.6 pixel; the black object not read; the same result twice; images out of order refused; the scene seen from the projector and its colours; the red of what was not read; a whole scan with a simulated camera three images late; failures without images and when the camera does not see the projection.--auto-mapping-simulation, on one screen: the countdown, the stripes, the output shown as before, the scene under the shapes; no pointer over the images, no outline around the screen.--auto-mapping-save-images <folder>: the images andprojector-view.pngare written there;