I will be updating about the progress of the project here
Weekly progress(18-25 May):
-
I submitted a PR regarding Automatic assignment of extension when rendering gets messed up after saving #830
-
I encountered an error due to which I was not able to trigger the vectorizerpopup from menu/group action which was later resolved thanks to @KonstantinDmitriev and @blackwarthog
-
After some final touch up and fixes the vectorizerpopup looks like this -->
-
Meanwhile I started with the first step of Centerline Vectorization process i.e centerline polygonizer
Now I will list down the classes(their main variables) and also their synfig equivalent( will keep adding as I keep discovering more)
-
class RawBorderPoint
main variable being TPoint m_position; We have synfig pointint that can replace Tpoint -
class RawBorder final : public std::vector
main variable being TpointD We have synfig point that can replace TpointD -
class PixelEvaluator //this is a template class
main variable being TRasterPT -
class Signaturemap
main data being the functions
- Signaturemap(const TRasterP &ras, int threshold) and
- template <typename T> void readRasterData(const TRasterPT<T> &ras, int threshold);
Along with some other functions that directly or indirectly use data objects of mentioned classes
So in the next week, I will be focusing on creating Synfig equivalent of polygonizer
I appreciate any suggestions or improvements from anyone
EDIT: I will be adding ( ) to the one I have implemented.
Awesome! Keep up the good work!
I have this program maybe serves them of reference. It can work with flat colours.
https://git.tuxfamily.org/4232/quinema.git/tree/quinema-escalar
https://4232.cf/es/?s=quinema-escalar
@bazza thank you
but this uses potrace however I am not using potrace(although It was an option) you can see the discussion on that here
@KonstantinDmitriev I have implemented 2 classes(see edited comment).
Please have a look at https://github.com/synfig/synfig/issues/735#issuecomment-496266744
Thanks!
Currently I’m stuck on the PixelEvaluator class. It uses pixel information and then decides whether it is can be categorized as a black pixel or a white one.
The problem is Synfig uses RGBA color scheme and Toonz uses RGBM color scheme so I’m not sure if can simply replace the A with M into the same formula.
I found that GIMP uses 5 different method for the same (in desaturate).
Out of them luminance is most accurate according to documentation. So I’m thinking of using it.
Weekly progress(26 -1 June):
- Changed the label alignment to right as per comment
-
Added centerlinepolygonizer.cpp and polygonizerclasses.h
ps: the filename will also include skeletonizer code so will rename it to centerlineclasses.h
- The classes implemented till now are RawBorderPoint, RawBorder, CenterlineConfiguration, vectorizerconfiguration, Newoutlineconfiguration
- The progress was slow this week as I overlooked the filesize for polygonizer which is actually not small also I encountered few doubts where @blackwarthog came to rescue me.
- for the next week I am looking for the following goals: read the pixel data from layer_bitmap, implement the remaining portion of polygonizer and implement the classes needed for next step i.e skeletonizer.
My top priority is to complete the polygonizer in 2-3 days and then proceed further
Thanks
Weekly Progress(2 - 8 June):
- So I am finally on track as per my proposal
- Ported all the remaining functions and pixel related functions from Toonz to Synfig (thanks to @blackwarthog )
- Encountered a silly error which kept me and @KonstantinDmitriev busy for 3 hrs Xd
- And, I have completed the centerlinepolygonizer.cpp
- Few errors are present there, trying to rectify them
- For the next two weeks I will be working on next step of vectorization i.e Skeletonizer
I appreciate any feedback! [^_^]
Thanks,
Ankit Dwivedi
Weekly Progress(9 - 15 June):
- Rectified the errors present in centerlinepolygonizer
- I was able to pass the output of centerlinepolygonizer to Toonz and got the output(which was rotated 90-degrees anticlockwise)
- Fixed the rotated input error mentioned in the above point
- Started the work on centerlineskeletonizer which is almost complete(at least the code is compiling successfully :p)
- Will try to check the output of centerlineskeletonizer by passing it results to Toonz.
- In the next week I look forward to making the centerlineskeletonizer working
That’s all for this week [^_^]
Would appreciate Suggestions and feedbacks
A comparison between the output of Skeletonizer from Toonz and Synfig can be seen here however the results are not exactly the same but of the same nature.
-
I need to cross check if I have made any silly error and cross verify them again(for this time I need to pass the output of synfig skeletonizer to toonz to see if the result is varied which I am still figuring out a way on how to do that).
-
Have started working on the next step which is creating the complete skeleton using joints and sequence from separate straight skeletons.
Thanks!
feedback and suggestions are always welcome
Weekly Progress(16 - 22 June):
- This week I was able to complete the Skeletonizer that output a straight skeleton.
- And then I started working on organizegraphs() which joins the straight skeletons into sequences and joints. And I was able to achieve the same
-
@KonstantinDmitriev helped me understand the concept of frame in calculating thickness ratio and that
m_thicknessRatio = 1.0
in our case. (see discussion here) - The next step is storing the corresponding color for a sequence in the skeleton for which I the plan is to extract the original RGBA color from the bitmap layer and then apply the color as a “Stroke” ( as they say in Toonz) but we do not have strokes so Outline layer will be used.
The progress of this project can now be seen here
For people who want to get a quick insight into the centerline vectorization algorithm can see this comment.
Any suggestions or feedback are welcome
Thank’s
Weekly Progress(23 - 29 June):
This was a slow week for me was stuck at understanding Toonz Color and PixelCM32. Finally got what we needed -> see the discussion here
- Fixed the [Vectorization] Incorrect Output from skeletonizer #862
- Started working on centerlinecolors.cpp
- Implemented calculateSequenceColors()
- Was stuck on the color sampling due to the issue mention above.
- Currently working on firstInkChangePosition()
- In the next week I am looking forward to completing Step 5 and start with Step 6 on vectorization
That was all for this week, we had our 1st evaluation this week me and @AnishG both passed and are looking forward to achieving something fruitful for Synfig this summer
Thanks
Any feedback is much appreciated.
Ankit Dwivedi
After @KonstantinDmitriev comment -> https://github.com/synfig/synfig/issues/849#issuecomment-507127492
It is clear that Step 5 which involves taking samples from image is only done with toonzRaster and not the normal Raster image type, which means we do not need this function(maybe in future if we want to preserve the sequence color then we can do this for raster images too).
Also in step 6: Toonz create TStrokes which are similar to outline layer in synfig and in step 7 it again does the following
Under step 7 apply stroke it again Check
if(cm && ..)
{
}
else
{
//Here it choose the closest to black palette color and apply them to all the strokes
}
So we can skip step 7 too and simply apply black color to outline layers while creating?
Yes, this is ok to do that. Let’s leave coloring strokes as a bonus-task. Can you please fill an issue here so we will not forget abou it?
Weekly Progress(29 June - 6 July):
- I was able to complete centerlinecolors.cpp
- Hence I closed the issue for step 5 which I later came to know was not required for Raster image however we decided to keep this task as a bonus to restore the stroke color.
- Closed https://github.com/synfig/synfig/issues/875 which involved removing thickness ratio start/end
- Started the work on step 5, added SequenceConverter and SequenceSimplifier
- This week I was figuring out the way to display the final output and as synfig outline uses Hermite curve so I read about bezier-Hermite conversion.
In the next week, I am looking forward to completing the conversion including step 6, which is the most crucial phase because that will decide the final output outline layers. So I am hoping to achieve a working centerline converter without stroke colors.
That’s it for this weeks. Thanks [^_^]
Any suggestions are always welcome.
Ankit Dwivedi
Weekly Progress(7 July - 13 July):
- I was able to complete centerlinetostrokes.cpp
- In this week I tried converting from Toonz Strokes (which is based on bezier) to Synfig Outline (which uses hermite ) and was able to figure out the way to do that.
- Created the function BezierToOutline
- I started with step 8 tried my first attempt on displaying the output of Vectorization which was not successful (^_^)"
In the next week, I look forward to displaying the outline layers so I can know the outcome of Vectorization.
That’s all for this week. Suggestions are always appreciated.
Thanks
Ankit Dwivedi
Weekly Progress(14 - 20 July):
- I was able to create outline layer this week after multiple attempts thanks to @KonstantinDmitriev
- I fixed affine transformation
- I was able to test if the control points being generated by synfig and toonz and found some issue which was later fixed. Now both generate almost the same control points
- I attempted to create a group layer to encapsulate the outlines
- I also noticed the outlines are too large to fit. The vertex points for bline are in thousands
That is all for this week. In the next week, I look forward to fitting the outlines and encapsulating them to a group.
Thank you. Suggestions are always welcome
Ankit Dwivedi
Weekly progress(21 - 27 July):
- I was able to convert the test image got an output which was finally fitting into the drawing area.
- I fixed the pixel size to the unit conversion problem
- Found some problem with tangent creation and fixed that
- This week the focus was wrapping vectorization into action and I already have started working on it. Apart from group creation code in perform() and deletion code in undo() everything looks good.
That was all for this week. In the next week, I look forward to make the Synfig action vectorization working. And fix some problems related to outline creation after vectorization if I complete the action.
Feedback is always appreciated.
Ankit Dwivedi
Weekly progress(28 July - 3 August):
This week I made significant improvement but encounterd a major issue
- I was able to complete Vectorization action and implemented the recommendations provided by @blackwarthog and @KonstantinDmitriev
- I started fixing outline issue and removed the point(0,0) which was being added to the resultant outline now the result looks better
- I also completed the outline by making it closed after adding the last bline point
- However the bad news is I noticed there are two possible results for vectorization on the same image, out of which one is perfect and of the same shape the other is distorted and contain more outline layers than the correct result. I am looking for possible reasons.
In the upcoming week, I will be working to find the error which is causing the unexpected result and also fixing outline issues.
Thank you!
Any feedback and suggestions are always appreciated