From fdd6f401b119fb76d54c9c7268871b52e4fe95b0 Mon Sep 17 00:00:00 2001 From: Pedro Mendes Date: Fri, 16 Feb 2024 11:15:30 +0700 Subject: [PATCH] graphics/focus-stack: Added (focus stacking). Signed-off-by: Willy Sudiarto Raharjo --- graphics/focus-stack/README | 14 +++ graphics/focus-stack/focus-stack.SlackBuild | 117 ++++++++++++++++++++ graphics/focus-stack/focus-stack.info | 10 ++ graphics/focus-stack/slack-desc | 19 ++++ 4 files changed, 160 insertions(+) create mode 100644 graphics/focus-stack/README create mode 100644 graphics/focus-stack/focus-stack.SlackBuild create mode 100644 graphics/focus-stack/focus-stack.info create mode 100644 graphics/focus-stack/slack-desc diff --git a/graphics/focus-stack/README b/graphics/focus-stack/README new file mode 100644 index 0000000000..a0040a44d3 --- /dev/null +++ b/graphics/focus-stack/README @@ -0,0 +1,14 @@ +focus-stack is an application for fast and easy focus stacking. + +It takes a series of photographs captured from the same location but +a different focus distances and then combines them to create a single +photograph so that the complete subject is in focus. This is commonly +called extended depth of field, or focus stacking. Typical use is for +microscope photography where it is difficult to obtain large enough +depth of field to cover the whole subject. The focus stacking +algorithm used was invented and first described in "Complex Wavelets +for Extended Depth-of-Field: A New Method for the Fusion of +Multichannel Microscopy Images" by B. Forster, D. Van De Ville, J. +Berent, D. Sage and M. Unser. The application also uses multiple +algorithms from OpenCV library. Most importantly, findTransformECC +is used to align the source images. diff --git a/graphics/focus-stack/focus-stack.SlackBuild b/graphics/focus-stack/focus-stack.SlackBuild new file mode 100644 index 0000000000..03680a34c6 --- /dev/null +++ b/graphics/focus-stack/focus-stack.SlackBuild @@ -0,0 +1,117 @@ +#!/bin/bash + +# Slackware build script for focus-stack + +# Copyright 2024 Pedro Mendes, Farmington CT +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=focus-stack +VERSION=${VERSION:-1.4} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" +elif [ "$ARCH" = "aarch64" ]; then + SLKCFLAGS="-O2 -fPIC" +else + SLKCFLAGS="-O2" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# This only uses a Makefile, no config step +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +DESTDIR="$PKG" \ +prefix=/usr \ +make + +DESTDIR="$PKG" \ +prefix=/usr \ +make install + +# Move man pages +mkdir -p $PKG/usr/man +mv $PKG/usr/share/man/man1 $PKG/usr/man/ +rmdir $PKG/usr/share/man + +# Strip binaries and libraries +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/imgs +cp -a \ + docs/focus-stack.html docs/focus-stack.md docs/Algorithms.md docs/imgs \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +# Copy examples into the package +mkdir -p $PKG/usr/share/$PRGNAM +cp -a examples $PKG/usr/share/$PRGNAM + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/graphics/focus-stack/focus-stack.info b/graphics/focus-stack/focus-stack.info new file mode 100644 index 0000000000..94dd70a8aa --- /dev/null +++ b/graphics/focus-stack/focus-stack.info @@ -0,0 +1,10 @@ +PRGNAM="focus-stack" +VERSION="1.4" +HOMEPAGE="https://github.com/PetteriAimonen/focus-stack" +DOWNLOAD="https://github.com/PetteriAimonen/focus-stack/archive/1.4/focus-stack-1.4.tar.gz" +MD5SUM="c7a6b7b0b5bd666199dba1823fd27cc2" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Pedro Mendes" +EMAIL="pedro@gepasi.org" diff --git a/graphics/focus-stack/slack-desc b/graphics/focus-stack/slack-desc new file mode 100644 index 0000000000..38d587adf4 --- /dev/null +++ b/graphics/focus-stack/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +focus-stack: focus-stack (Fast and easy focus stacking) +focus-stack: +focus-stack: focus-stack takes a set of photos taken at different focus settings +focus-stack: and combines them into one, selecting the sharpest source image for +focus-stack: each pixel position. This is commonly called extended depth of field, +focus-stack: or focus stacking. Typical use is for microscope photography where it +focus-stack: is difficult to obtain large enough depth of field to cover the whole +focus-stack: subject. This application uses OpenCV library and its OpenCL +focus-stack: acceleration interface. +focus-stack: +focus-stack: