Open b4zz4 opened 2 years ago
Yes the sketch cleanup is also a function that I want to implement.
I read the StrokeAggregator paper and tried its program before. However, it was quite slow and took ~10min to process a single drawing in my computer. I do not know if I misconfigured something or the time complexity is indeed high. Maybe we can start from a simpler version of clustering algorithm.
I am also investigating machine learning methods. Though I am not an expert of it, the current popular models such as Transformer look like a good fit to process vector strokes. Now I am generating a dataset, by adding noise to GP strokes and letting the neural network to reverse it. I have not got enough results to show though.
Only firstly chosen lines could be joined similar to shapes. Grouping is a really complex problem. For that, you can use the skicit classification.
I have to make several fixes to current functions before developing new ones, so I am not sure when I can start working on this issue. But I did some experiments and would like to share some results here.
The last approach works in some cases like the following ones:
I think it is a good sign and I will continue. But it is not finished since there are also some failure cases.
yooo thats me who suggested on blender community. So nice to see you actually implementing this! Cant wait!
I will release this function in several days, and it is also in the current source code if you want to test it now.
Currently, strokes need to be selected manually. The next step is the implementation of a clustering algorithm. I reread the StrokeAggregator paper and found its clustering algorithm having a very high time complexity. On the other hand, most common clustering algorithms will not work well on curves if simply calculating the pairwise point distance. Therefore, I tend to develop a new method.
Work perfect:
Work perfect:
Thank you for your test case. Here one another possible issue is the difference between curves and straight lines. The algorithm tends to create rounded corners, therefore does not work well on straight lines with sharp corners, unless we set a small smoothness value manually. This issue is not mentioned in the research papers. Maybe some additional optimization methods are needed.
Maybe you could use a smooth Savitzky-Golay, but it has some problems at the beginning and the end
https://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_filter https://scipy-cookbook.readthedocs.io/items/SavitzkyGolay.html
Will there be a way to detect that points are the originals and take the stroke pressure?. To imitate the original pressure
Made a first implementation of identifying multiple strokes. Maybe some post-processing methods are needed, such as pinching the ends of strokes. Also, I have no confidence for it to work perfectly when the drawing is very complicated. I am thinking of adding another interactive way in the Draw mode.
Will there be a way to detect that points are the originals and take the stroke pressure?. To imitate the original pressure
Yes that should be possible. I will try to add some options inheriting the point attributes after finishing the main function.
Thank you for the information. It looks interesting and I will see if any techniques can be used here. Hopefully I can get more time to work on this project the next month...
I don't know why I think these add-ons can also solve this.
https://blender.community/c/rightclickselect/WQyE/
A simpler tool could be made. Take two or more lines and join them by averaging their closest points: associating proximity. When the points exceed a threshold they are "joined" Creating a new line and deleting the old ones.
https://cdn.masto.host/mographsocial/media_attachments/files/109/218/203/715/850/201/small/b95c64d42ee46797.png
This can be done sequentially and in iterations so that the result is more organic and mimics the results of neural networks.
Fast example:
https://cdn.masto.host/mographsocial/media_attachments/files/109/219/323/481/838/949/original/73ce9140b1ac3c42.mp4
(Quickly modifying the magnet stroke)