-
Notifications
You must be signed in to change notification settings - Fork 1.3k
RFC: po/bitmap vectorisation - prerequisit for AI masking #20198
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
base: master
Are you sure you want to change the base?
Conversation
79dcaf3 to
5adf077
Compare
|
@jenshannoschwalm : I'll need your help on this. No matter what I try on some images I have a displacement of the drawn masks compared to the raster mask. So I'll need help from you pixelpipe expert. |
First, congrats and big thanks for getting into this, i think we will all love it. Having tested yet but my first idea on this question, iirc the standard masks are defined on whole image data (before cropped in rawprepare that must be so as changing the crops for rawprepare should keep masks as they are) and it seems to me you currently define on data provided after rawprepare. btw, the croppings are available in the image struct as crop_x and crop_y |
|
@jenshannoschwalm : It seems that rawprepare transform/backtransform are not correct. All those offset are seen when there is crop in rawprepare. If you reset all to 0 then the drawn masks are perfectly aligned. |
Currently not my thinking, they work fine for all distortions/masks right now. What i meant is, when you process the provided raster image with the new algorithm all coordinates are inside the range provided by the data of that file but not as we have for rawprepare. Like here: for start.x/y you'd have to add some rawprepare crop-x/y data before doing the backtransform. no? |
|
To fix the CI/nightly fail on macOS you need to add
to |
1c446ac to
5488b1e
Compare
|
@zisoft : Done ! |
My brain hurts tonight :) How can I get rawprepare offset here? Isn't this the role of |
Arg, i think i may have hurted you without good reason :-) I think we have the |
|
oh, and please add
to the So we have all the necessary stuff in this PR. |
5488b1e to
5bdf4e4
Compare
|
Could you provide the test files you are using so a) we can compare and b) i will try my best on this topic and you have a wine or so? |
|
@jenshannoschwalm : The tests files: https://drive.google.com/file/d/17uUarrVT1R3t0yEXPxlp4e7B2LV-rMQU/view?usp=sharing
Now before clicking on Part of the issue is that the mask is not in the size of the raw we probably need to scale x and y independently and we also need to take into account the x, y offset from rawprepare to align the raw and the mask. Now all I have tried has failed :) |
|
I have pushed a new version with may wip commits. The last modification is for the |
81b5d92 to
f314074
Compare
|
About yet - it doesn't work. Why - just check that crop_x/y are not correct here :-) At least that's one point. It seems to me that rawprepare isn't doing it correctly (code in commit params seems to be wrong) but not sure if that's the whole story. Will investigate further ... |
Works ok on 4 test images on my side with 2 different masks. |
0823d21 to
fe7f854
Compare
|
@jenshannoschwalm : Thanks a lot for your help ! I have just pushed a cleaned up version using the code you've propose. |
d26fcc5 to
ec83e48
Compare
|
There are two issues for me,
|
Should be fixed in current PR. If there is no file loaded the vectorize button is set inactive now. |
|
And now Windows is fixed ! |
ec83e48 to
5c5e7d3
Compare
|
I plan also on displaying some information to the user after the vectorization:
|
896a527 to
245fef6
Compare
e25913b to
35aba26
Compare
The library potrace is used by many Open Source projects like inkscape.
This is done using the new API based on potrace. The created path forms are added into the mask manager. Co-authored-by: Hanno Schwalm <hanno@schwalm-bremen.de>
This is equivalent to previous code but instead of hidding the scaling into an internal routine we expose it for later use. The routine ras2forms now takes an image (dt_image_t) as target for the scaling. If image is NULL the scaling is skipped and so the forms coordinates are based on the raster file.
35aba26 to
2f493ff
Compare
|
Tested again and working great! While being here:
|
|
Point 1. Can you tell me more about the orientation issue? I've probably missed it. Point 3. Either that or with a new module or a Lua script, but clearly yes we don't need in this case a raster mask visible. My initial idea was to add a button on the Mask Manager to extract the subjects from the edited images and create the corresponding path forms. But all this will be more thinking when we know what kind of techno we want to integrate. |
We import the external rastermasks "as they are", likely generated from other software. If you export an image to be used for other algorithms, a portrait photo will be a portrait and likely treated as such by that software. But in the pipe position of the "external rastermask" we don't know and don't care yet and that mask will be also be rotated/flipped/... |


This is a first attempt at creating path forms from a raster mask. The goal is that this work will be used by the AI based masking if someone want to work on it.
There is still an offset issue, but the core is working. I have added a
[vectorize]button on the external raster mask module.Click on
[vectorize]:From there is it easy to reuse those new forms on any module as any other masks: