New feature: Optional manual adjustment of quad#164
Conversation
Also tried other means to achieve a more lenient checker, but - variable substitution did not work - adding multiple accepted header files would not scale with more contributors and more years
A scanned page can be opened from the DocumentScreen. The source image will be shown in full, with the quad on top. The corners and edges of the quad can be dragged. TODO: The result of the quad manipulation is not yet stored.
Displays a magnifying glass / loupe showing a zoomed-in patch of the image for more precise placement. Positioning rules: 1. By default, the loupe is placed above the finger. 2. If there is not enough room above, it moves to the left of the finger. 3. If there is not enough room on the left either, it moves to the right.
If the user manually rotated the image, this must be the actual orientation of the captured image. Hence, it makes sense to also apply the same rotation when viewing the image in the EditPageScreen
The app philosophy is that it shall function automatically by default. Hence, the feature for manual corrections shall not be available by default, but easily activated by those who need it.
- Made the Confirm button a MainActionButton, with a text label - In portrait the three buttons are in a row - In landscape, the Undo/Redo buttons are above the Confirm button and all is moved to the right - Added a right-to-left preview showing that undo/redo will be mirrored - contentDescription and text are proper string resources
This way, the user has a direct understanding how moving the corners affects the page cutout
… applied EditPageScreen's confirm handler called onUpdatePageQuad() (which launches an async coroutine for IO) and then immediately called navigation.back(). DocumentScreen would compose before the disk files were updated, reading stale bitmaps/thumbnails.
Similar to the AboutScreen, the user can send over a problematic image to the maintainer.
If the CV couldn't detect a page, and the optional manual image editing is enabled, it does not show the "No document detected" error but 1. captures the image nonetheless 2. Sets the quad to the whole image 3. Directly opens the editing screen
This helps to better distinguish what will be part of the document and what not.
- when set to true, the image editing screen is enabled for this invocation, regardless of the user's app setting. - when set to false, the image editing screen is disabled for this invocation, regardless of the user's app setting. - when the extra is not provided, the app's own setting is used. This extra does not change the persisted app setting.
Manual test protocolThe feature branch also adds automated unit tests. To make sure to cover more intricate flows, this is the
|
|
@PhilLab Thanks a lot for this PR and for the significant amount of work behind it. I can see the effort that went into both the implementation and the UX. I spent some time testing it locally. While the feature is interesting, I don't think this implementation is something I can merge into FairScan. There are a few reasons for that:
Even though FairScan is primarily focused on an automatic workflow, I agree that handling edge cases better is important. For now, I'm going to close this PR. Thanks again for your work and for taking the time to explore this direction. |
This feature branch adds an optional quad-editing screen so users can make targeted corrections without abandoning the automation-first workflow.
The automatic quad detection is world-class, but users occasionally encounter problematic images - creased pages, atypical aspect ratio or cluttered backgrounds. Right now there is no way to recover from that.
The feature is off by default and is gated behind a setting. Nothing in the existing flow changes unless the user explicitly enables it. When enabled, a single new button appears on the DocumentScreen. This matches the project's philosophy of keeping the default experience fully automatic while giving power users an escape hatch.
There is also a concrete benefit for the intent-based Nextcloud integration: an intent extra lets the host app request the edit functionality temporarily. Nextcloud's built-in scanner exposes quad manipulation as a core feature. Matching that capability increases the chances of FairScan becoming the default scanning option there.
Tickets: #72, #59
Features
quad.editing.screen.recording.mp4
Note 1: Merge conflicts
This branch is based on an older commit of main, so there are non-trivial merge conflicts with the current main branch. That is also why the screen is called EditPage and the setting is labelled "Enable manual image editing" - the intent was to keep it open for other manual edits such as color correction, which has since been added elsewhere. I would like to discuss the feature and general approach before investing the effort to resolve those conflicts and refactor the added code.
Note 2: Button layout suggestion
The current feature branch is purely additive: the setting adds a button without rearranging anything. Now that the color-edit button from main is also there, it may be worth tidying up the row. This is a suggestion only and not yet part of the current feature branch. A possible direction:
If the setting is OFF:
Icons.Default.ColorLens.If the setting is ON:
Icons.Default.Crop.Note 3: AI Coding assistance
This contribution made use of Github Copilot