lnugraha / trimap_generator Goto Github PK
View Code? Open in Web Editor NEWGenerating automatic trimap through pixel dilation and strongly-connected-component algorithms
License: MIT License
Generating automatic trimap through pixel dilation and strongly-connected-component algorithms
License: MIT License
There might be a tiny "clump" of pixels which share the same pixel intensity as foreground.
The trimap generator will dilate those non-dominant regions.
An error-handler (either reject or convert those clumps as background) is required to anticipate this issue (see the attached image).
My temporary proposed solution is to utilize clustering method to detect the most dominant foreground.
Hello,
Thank you for your work, it's very useful.
I have develop a solution for the optimization part with cython.
I will share you the file to paste in folder where the trimap module is located. You need to dezip it.
And in trimap_module.py add theses lines :
from trimap.faster_remake import set_value
And replace (in trimap function) this :
for i in range(0,row):
for j in range (0,col):
if (remake[i,j] != 0 and remake[i,j] != 255):
remake[i,j] = 127
by this :
remake = np.array(set_value(remake, 127))
You can change the value if you want.
Hope that's help.
Have a good day and enjoy :)
Make an example, like slic algorithm in scikit-image.
Hi Inugraha,
It seems that you dilate the input binary mask to generate the trimap. But what if the input mask is not confident enough to be sure foreground? E.g., masks generated by Mask RCNN segmentation sometimes extend outside the ground truth objects. So perhaps shrink the input mask a bit (e.g., erosion operation) as sure foreground before dilation?
TODO: design an abstract class that can decide whether erosion or dilation will be used for the foreground. The derived classes deploy erosion or dilation with a kernel size decided priorhand
hi, lnugraha
I do not find strongly-connected-component algorithms in your code. Can you show me paper about how to use strongly-connected-component algorithms in trimap?
thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.