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

IMAGE=../../data/barbara.pan
IMASKED=../../data/barbara_masked.pan
IMASK=../../data/mask_512x512_random50.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 "   FCT 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 FCT 7 16 0 dict_barb.col dict_barb.col"
../../bin/dictionary FCT 7 16 0 dict_barb.col dict_barb.col

echo
echo "   LDCTIV transform (textured part)"
echo "   Make second transform of the dictionary"
echo "   ../../bin/dictionary LDCTIV 32 0.25 0 dict_barb.col dict_barb.col"
../../bin/dictionary LDCTIV 32 0.25 0 dict_barb.col dict_barb.col



# ----------------------------------------------------------------------
#     Apply MCA.
# More iterations for a higher quality result, e.g. 1000

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


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



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

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

echo

