Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laplacian Matrix Calculation in C++ [closed]

I have been trying to implement the Digital Matting algorithm described in the research paper named Learning Based Digital Matting.

Its MATLAB Code is available here. I am trying to convert the MATLAB code into C++ using OpenCV 2.4.3 and UMFPACK.

The problem is that the function named getLap_iccv09_overlapping (that calculates the Laplacian Matrix of input image) is not available off-the-shelf in OpenCV and I have to write my own implementation in cpp. I am getting incorrect results from my implementation.

Is there any C/C++ library that offers Laplacian Matrix calculation of a matrix/image?

like image 732
sgarizvi Avatar asked Nov 23 '12 13:11

sgarizvi


1 Answers

I've recently have had to "translate" several Matlab functions to C++ (using OpenCV) and unfortunately you can't find the exact same function. There are some similar functions but the results are not exactly the same, especially with the borders of matrices.
I would suggest that you read and understand the algorithms (the operations on the matrices) used by your Matlab function and write it in c++ (Opencv is great for matrix operations).
You can test it by using a small matrix (4 by 4 for instance) and proceeding step by step, first with the elements inside the matrix then with the edges and borders (I find the border conditions to be more difficult to understand)
Good Luck!

like image 124
alvinleetya Avatar answered Oct 10 '22 15:10

alvinleetya