Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--align-only with --global-align / Question: Get crop rectangle from verbose-output #21

Open
LGimmick opened this issue May 20, 2022 · 4 comments

Comments

@LGimmick
Copy link

Hi,

if I add both parameters "--align-only" and "--global-align" it only loads the first two images (used *.jpg) and then exits. Without --global-align it works fine.
Version: Latest.

And my question:
-- verbose outputs something like "transformed with corners TL (,), TR (,), BL (,), BR (,)" per image. I guess that describes the boundary-corners of each image after the alignment inside the "expanded image". So to crop the overlapping part of each aligned-image (like the result image) I have to get the min/max x/y coordinates of each rectangle and crop every aligned-image with the same rectangle. Is that correct? :)

@PetteriAimonen
Copy link
Owner

The error with --global-align --align-only should be fixed now.

And yeah, that is correct interpretation of the corners.
I added verbose log message with aligned_pcb_001.jpg valid area X 19, Y 26, W 2005, H 1503 that hopefully makes it a bit easier.
The total area that is valid for all images is currently only calculated during merging, so I cannot directly log that.

Btw, it might make sense to specify some stable format for these messages that are used for machine parsing.
Emitting them to the log is easy and simple, but perhaps something like this would be easier to parse:

 1.779           T3 Finished task 25 in 0.039 s.
 1.779           Memory use: 49.557 MB.
 .. more normal log messages ...
 JSON_DATA: {"task": "Task_Align", "input": "pcb_001.jpg", "output": "aligned_pcb_001.jpg", "corners": {"tl": [17.9,25.2] ... }, "valid_area": {"x": 19, "y": 26, ...}}

@LGimmick
Copy link
Author

The format suggestion sounds good!

The newest build (atleast for Win?) does not seem to include the newest code changes.

@mviereck
Copy link

mviereck commented Nov 3, 2022

Yet I wrote a small script to crop the aligned images (needs ImageMagick):
https://github.com/mviereck/microscopy-tools/blob/master/stackalign

Though, it would make sense if focus-stack could do this itself.

@mcranium
Copy link

I would also be interested to have focus-stack to have the option (or even as default) to crop the aligned images produced with the --align-only option. I often use enfuse for merging normal map focus stacks (less artefacts) and this would allow me to easily integrate it into my scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants