
This is an implementation of the paper "Maximum likelihood coordinates".
Usage
Start by cloning this repository, making sure to pass the
--recursive flag to grab all the dependencies. If you
forgot, then you can git submodule update --init instead.
git clone --recursive https://github.com/changqj/Maximum-Likelihood-Coordinates-2D.git mlc2d
Now, you can directly run the main.m program in MATLAB,
after a few seconds you will see a GUI interface. Then you can set a
target polygon by loading from file or dragging the vertices with the
mouse. Select the type of barycentric coordinates through the buttons
below.

Due to the rough processing in MATLAB GUI, the visualization image in
the MATLAB GUI is blurry, but a clear image can be obtained in MeshLab
(or other visualization tools) through .obj, the deformed
image file will be generated in real time in /data/ folder
and stored in textured .obj format.


Example
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|
| source image | mean value coordinates | iterative coordinates | harmonic coordinates |
![]() |
![]() |
![]() |
![]() |
| maximum entropy coordinates (prior 1) | maximum entropy coordinates (prior 2) | maximum likelihood coordinates | maximum likelihood without scaling |
Basis function
You can visualize the basis functions in two ways:
diaplay through the figure window of MATLAB
showbase(n,mlcoors,tri(:,2:4),xx,yy,v0)
display with other visualization software by generating textured
.objfile.% to plot the base functions name = 'mlc'; z = mlcoors'; % n x # % set a mtl file fid = fopen(['data/base_texture.obj.mtl'],'w'); fprintf(fid,'# Generated by MATLAB\n'); fprintf(fid,'# Wavefront material file\n'); fprintf(fid,'newmtl material_0\n'); fprintf(fid,'Ka 0.200000 0.200000 0.200000\n'); fprintf(fid,'Kd 0.752941 0.752941 0.752941\n'); fprintf(fid,'Ks 1.000000 1.000000 1.000000\n'); fprintf(fid,'Tr 1.000000\n'); fprintf(fid,'illum 2\n'); fprintf(fid,'Ns 0.000000\n'); fprintf(fid,'map_Kd %s\n',[ './gbc_bar.png']); fclose(fid); load('colorbar_mlc.mat') colorbar_mlc = colorbar_mlc(end:-1:1,:); bar = colorbar_mlc'; bar= repmat(bar,500,1); bar = reshape(bar,3,[]); bar = reshape(bar,3,1,[]); bar = permute(bar,[3 2 1]); bar= repmat(bar,1,50); imwrite(bar,['data/gbc_bar.png']); % close(2) for i = 1:size(z,2) bar_uv = [ones(length(xx),1)*0.5,z(:,i)]; writeOBJ(['data/' name '_bf_' num2str(i) '.obj'],[xx 1-yy ... zeros(length(xx),1)],... tri(:,[4 3 2]),bar_uv); fid = fopen(['data/' name '_bf_' num2str(i) '.obj'],'a'); fprintf(fid,['mtllib ./','base_texture.obj.mtl\n']); fclose(fid); endAfter executing the above code, the
.objfile of the basis functions will be in the/data/folder.


Citation
@Article{Chang:2023:MLC,
author = {Qingjun Chang and Chongyang Deng and Kai Hormann},
title = {Maximum likelihood coordinates},
journal = {Computer Graphics Forum},
volume = 42,
number = 5,
month = aug,
year = 2023,
pages = {Article e14908, 13 pages},
note = {Proceedings of SGP}
}







