-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Added Python wrapping and documentation for alphamat module #2729
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ endif() | |
ocv_define_module(alphamat | ||
opencv_core | ||
opencv_imgproc | ||
WRAP python | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,24 @@ This project was part of Google Summer of Code 2019. | |
|
||
*Mentor:* Sunita Nayak | ||
|
||
Alphamatting is the problem of extracting the foreground from an image. The extracted foreground can be used for further operations like changing the background in an image. | ||
Alphamatting is the problem of extracting the foreground with soft boundaries from a background image. The extracted foreground can be used for further operations like changing the background in an image. | ||
|
||
Given an input image and its corresponding trimap, we try to extract the foreground from the background. Following is an example: | ||
|
||
Input Image:  | ||
Input Trimap:  | ||
Output alpha Matte:  | ||
Input Image:  | ||
Input image should be preferably a RGB image. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the image links. The local files image in the same directory as the markdown file are showing fine in GitHub, while the first three ones with path starting from alphamat folder are not. How to check if all image references are working in the final OpenCV doc page? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just refreshed in the test url you gave. All images look good now. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is OK to keep images in |
||
Input Trimap:  | ||
The trimap image is a greyscale image that contains information about the foreground(white pixels), background(black pixels) and unknown(grey) pixels. | ||
Output alpha Matte:  | ||
The computed alpha matte is saved as a greyscale image where the pixel values indicate the opacity of the extracted foreground object. These opacity values can be used to blend the foreground object into a diffferent backgound, as shown below: | ||
 | ||
|
||
This project is implementation of @cite aksoy2017designing . It required implementation of parts of other papers [2,3,4]. | ||
Following are some more results. | ||
 | ||
|
||
The first column is input RGB image, the second column is input trimap, third column is the extracted alpha matte and the last two columns show the foreground object blended on new backgrounds. | ||
|
||
This project is implementation of @cite aksoy2017designing . It also required implementation of parts of other papers [2,3,4]. | ||
|
||
# Building | ||
|
||
|
@@ -33,21 +42,20 @@ Please refer to OpenCV building tutorials for further details, if needed. | |
|
||
The built target can be tested as follows: | ||
``` | ||
example_alphamat_information_flow_matting -img=<path to input image file> -tri=<path to the corresponding trimap> -out=<path to save output matte file> | ||
<path to your opencv build directory>/bin/example_alphamat_information_flow_matting -img=<path to input image file> -tri=<path to the corresponding trimap> -out=<path to save output matte file> | ||
``` | ||
# Source Code of the sample | ||
|
||
@includelineno alphamat/samples/information_flow_matting.cpp | ||
|
||
|
||
# References | ||
|
||
[1] Yagiz Aksoy, Tunc Ozan Aydin, Marc Pollefeys, "[Designing Effective Inter-Pixel Information Flow for Natural Image Matting](http://people.inf.ethz.ch/aksoyy/ifm/)", CVPR, 2017. | ||
[1] Yagiz Aksoy, Tunc Ozan Aydin, Marc Pollefeys, [Designing Effective Inter-Pixel Information Flow for Natural Image Matting](https://www.researchgate.net/publication/318489370_Designing_Effective_Inter-Pixel_Information_Flow_for_Natural_Image_Matting), CVPR, 2017. | ||
|
||
[2] Roweis, Sam T., and Lawrence K. Saul. "[Nonlinear dimensionality reduction by locally linear embedding](https://science.sciencemag.org/content/290/5500/2323)" Science 290.5500 (2000): 2323-2326. | ||
[2] Roweis, Sam T., and Lawrence K. Saul. [Nonlinear dimensionality reduction by locally linear embedding](https://science.sciencemag.org/content/290/5500/2323), Science 290.5500 (2000): 2323-2326. | ||
|
||
[3] Anat Levin, Dani Lischinski, Yair Weiss, "[A Closed Form Solution to Natural Image Matting](https://www.researchgate.net/publication/5764820_A_Closed-Form_Solution_to_Natural_Image_Matting)", IEEE TPAMI, 2008. | ||
[3] Anat Levin, Dani Lischinski, Yair Weiss, [A Closed Form Solution to Natural Image Matting](https://www.researchgate.net/publication/5764820_A_Closed-Form_Solution_to_Natural_Image_Matting), IEEE TPAMI, 2008. | ||
|
||
[4] Qifeng Chen, Dingzeyu Li, Chi-Keung Tang, "[KNN Matting](http://dingzeyu.li/files/knn-matting-tpami.pdf)", IEEE TPAMI, 2013. | ||
[4] Qifeng Chen, Dingzeyu Li, Chi-Keung Tang, [KNN Matting](http://dingzeyu.li/files/knn-matting-tpami.pdf), IEEE TPAMI, 2013. | ||
|
||
[5] Yagiz Aksoy, "[Affinity Based Matting Toolbox](https://github.com/yaksoy/AffinityBasedMattingToolbox)". | ||
[5] Yagiz Aksoy, [Affinity Based Matting Toolbox](https://github.com/yaksoy/AffinityBasedMattingToolbox). |
Uh oh!
There was an error while loading. Please reload this page.