does OpenCV support alpha-channel? Or is there any way to work with transparent png? I need to merge two images, where the first one is background and the second one is imag
Here is a bash script that I threw together that will perform the ImageMagick conversion given by ypnos on all of the png files in a directory. You can make it recursive by replacing the * in the third line with a find command.
#!/bin/bash
for file in *
do
if [[ $file =~ (.+)-mask\.png ]]; then
echo "Ignoring mask $file"
elif [[ $file =~ (.+)\.png ]]; then
echo "Generating mask for $file"
basefn=${BASH_REMATCH[1]}
convert "$basefn.png" -channel Alpha -negate -separate "$basefn-mask.png"
fi
done