#!/bin/sh
# ----------------------------------------------------------------------
#    SparseLab1.1 benchmark
#    Test image decomposition and inpainting using MCA solver.

IMAGE=../../data/linesgaussians.pan
IMASKED=../../data/linesgaussians_masked.pan
IMASK=../../data/mask_256x256_brush.pan

clear

echo "----------------------------------------------------------------------"
echo "   SparseLab1.1 benchmark"
echo "   Test image decomposition and inpainting using MCA solver."


# ----------------------------------------------------------------------
#     Dictionary specifications: two transforms for this example.

echo
echo "   UDWT transform (natural smooth part)"
echo "   For UDWT, specify a QMF"
echo "   ../../bin/qmf symmlet 6 qmf.col"
../../bin/qmf symmlet 6 qmf.col
echo "   Make first transform of the dictionary"
echo    ../../bin/dictionary UDWT 5 qmf.col 0 dict_lg.col dict_lg.col
../../bin/dictionary UDWT 5 qmf.col 0 dict_lg.col dict_lg.col

echo
echo "   FCT transform (anisotropic line part)"
echo "   Make second transform of the dictionary"
echo    ../../bin/dictionary FCT 6 16 0 dict_lg.col dict_lg.col
../../bin/dictionary FCT 6 16 0 dict_lg.col dict_lg.col



# ----------------------------------------------------------------------
#     Apply MCA.

echo
echo "----------------------------------------------------------------------"
echo "  Apply MCA."
echo "  ../../bin/mca 100 1 3 0 0 dict_lg.col $IMAGE mca_test.pan"
../../bin/mca 100 1 3 0 0 dict_lg.col $IMAGE mca_test.pan



# ----------------------------------------------------------------------
#     Inpainting.

echo
echo "----------------------------------------------------------------------"
echo "  Inpainting: ECM with fixed lambda."
echo "  ../../bin/eminpaint 1 1E-6 3 0.1 1 0 dict_lg.col $IMASKED $IMASK inpaint_test_ecm1.pan"
../../bin/eminpaint 1 1E-6 3 0.1 1 0 dict_lg.col $IMASKED $IMASK inpaint_test_ecm1.pan

echo
echo "----------------------------------------------------------------------"
echo "  Inpainting: ECM with varying lambda (MCA)."
echo "  ../../bin/eminpaint 50 1E-6 0 1 1 2 dict_lg.col $IMASKED $IMASK inpaint_test_ecm2.pan"
../../bin/eminpaint 50 1E-6 0 1 1 2 dict_lg.col $IMASKED $IMASK inpaint_test_ecm2.pan



# ----------------------------------------------------------------------
#     Clean up temporary storage.

echo
echo "   Clean up."
rm qmf.col dict_lg.col

echo

