Diff of the two buildlogs: -- --- b1/build.log 2025-03-25 12:26:47.571842625 +0000 +++ b2/build.log 2025-03-25 12:31:01.636545279 +0000 @@ -1,6 +1,6 @@ I: pbuilder: network access will be disabled during build -I: Current time: Tue Mar 25 00:00:52 -12 2025 -I: pbuilder-time-stamp: 1742904052 +I: Current time: Tue Apr 28 08:49:49 +14 2026 +I: pbuilder-time-stamp: 1777315789 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/unstable-reproducible-base.tgz] I: copying local configuration @@ -32,52 +32,84 @@ dpkg-source: info: applying relax-unit-test-affine2d.patch I: Not using root during the build. I: Installing the build-deps -I: user script /srv/workspace/pbuilder/1673451/tmp/hooks/D02_print_environment starting +I: user script /srv/workspace/pbuilder/2779170/tmp/hooks/D01_modify_environment starting +debug: Running on ionos5-amd64. +I: Changing host+domainname to test build reproducibility +I: Adding a custom variable just for the fun of it... +I: Changing /bin/sh to bash +'/bin/sh' -> '/bin/bash' +lrwxrwxrwx 1 root root 9 Apr 27 18:49 /bin/sh -> /bin/bash +I: Setting pbuilder2's login shell to /bin/bash +I: Setting pbuilder2's GECOS to second user,second room,second work-phone,second home-phone,second other +I: user script /srv/workspace/pbuilder/2779170/tmp/hooks/D01_modify_environment finished +I: user script /srv/workspace/pbuilder/2779170/tmp/hooks/D02_print_environment starting I: set - BUILDDIR='/build/reproducible-path' - BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' - BUILDUSERNAME='pbuilder1' - BUILD_ARCH='amd64' - DEBIAN_FRONTEND='noninteractive' - DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=20 ' - DISTRIBUTION='unstable' - HOME='/root' - HOST_ARCH='amd64' + BASH=/bin/sh + BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath + BASH_ALIASES=() + BASH_ARGC=() + BASH_ARGV=() + BASH_CMDS=() + BASH_LINENO=([0]="12" [1]="0") + BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:. + BASH_SOURCE=([0]="/tmp/hooks/D02_print_environment" [1]="/tmp/hooks/D02_print_environment") + BASH_VERSINFO=([0]="5" [1]="2" [2]="37" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu") + BASH_VERSION='5.2.37(1)-release' + BUILDDIR=/build/reproducible-path + BUILDUSERGECOS='second user,second room,second work-phone,second home-phone,second other' + BUILDUSERNAME=pbuilder2 + BUILD_ARCH=amd64 + DEBIAN_FRONTEND=noninteractive + DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=42 ' + DIRSTACK=() + DISTRIBUTION=unstable + EUID=0 + FUNCNAME=([0]="Echo" [1]="main") + GROUPS=() + HOME=/root + HOSTNAME=i-capture-the-hostname + HOSTTYPE=x86_64 + HOST_ARCH=amd64 IFS=' ' - INVOCATION_ID='93fcf6263f3549ff979d6c01f318dcf4' - LANG='C' - LANGUAGE='en_US:en' - LC_ALL='C' - MAIL='/var/mail/root' - OPTIND='1' - PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' - PBCURRENTCOMMANDLINEOPERATION='build' - PBUILDER_OPERATION='build' - PBUILDER_PKGDATADIR='/usr/share/pbuilder' - PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' - PBUILDER_SYSCONFDIR='/etc' - PPID='1673451' - PS1='# ' - PS2='> ' + INVOCATION_ID=da518334bca54507994ab4b4f62c777b + LANG=C + LANGUAGE=et_EE:et + LC_ALL=C + MACHTYPE=x86_64-pc-linux-gnu + MAIL=/var/mail/root + OPTERR=1 + OPTIND=1 + OSTYPE=linux-gnu + PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path + PBCURRENTCOMMANDLINEOPERATION=build + PBUILDER_OPERATION=build + PBUILDER_PKGDATADIR=/usr/share/pbuilder + PBUILDER_PKGLIBDIR=/usr/lib/pbuilder + PBUILDER_SYSCONFDIR=/etc + PIPESTATUS=([0]="0") + POSIXLY_CORRECT=y + PPID=2779170 PS4='+ ' - PWD='/' - SHELL='/bin/bash' - SHLVL='2' - SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.kD1aoDvR/pbuilderrc_4rj6 --distribution unstable --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/unstable-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.kD1aoDvR/b1 --logfile b1/build.log octave-image_2.16.0-1.dsc' - SUDO_GID='110' - SUDO_UID='105' - SUDO_USER='jenkins' - TERM='unknown' - TZ='/usr/share/zoneinfo/Etc/GMT+12' - USER='root' - _='/usr/bin/systemd-run' - http_proxy='http://46.16.76.132:3128' + PWD=/ + SHELL=/bin/bash + SHELLOPTS=braceexpand:errexit:hashall:interactive-comments:posix + SHLVL=3 + SUDO_COMMAND='/usr/bin/timeout -k 24.1h 24h /usr/bin/ionice -c 3 /usr/bin/nice -n 11 /usr/bin/unshare --uts -- /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.kD1aoDvR/pbuilderrc_FgKb --distribution unstable --hookdir /etc/pbuilder/rebuild-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/unstable-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.kD1aoDvR/b2 --logfile b2/build.log octave-image_2.16.0-1.dsc' + SUDO_GID=110 + SUDO_UID=105 + SUDO_USER=jenkins + TERM=unknown + TZ=/usr/share/zoneinfo/Etc/GMT-14 + UID=0 + USER=root + _='I: set' + http_proxy=http://213.165.73.152:3128 I: uname -a - Linux ionos1-amd64 6.1.0-32-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.129-1 (2025-03-06) x86_64 GNU/Linux + Linux i-capture-the-hostname 6.12.12+bpo-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.12-1~bpo12+1 (2025-02-23) x86_64 GNU/Linux I: ls -l /bin - lrwxrwxrwx 1 root root 7 Mar 4 11:20 /bin -> usr/bin -I: user script /srv/workspace/pbuilder/1673451/tmp/hooks/D02_print_environment finished + lrwxrwxrwx 1 root root 7 Mar 4 2025 /bin -> usr/bin +I: user script /srv/workspace/pbuilder/2779170/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy @@ -650,7 +682,7 @@ Get: 528 http://deb.debian.org/debian unstable/main amd64 gfortran amd64 4:14.2.0-1 [1436 B] Get: 529 http://deb.debian.org/debian unstable/main amd64 octave-dev amd64 9.4.0-1 [1007 kB] Get: 530 http://deb.debian.org/debian unstable/main amd64 dh-octave all 1.8.0 [22.7 kB] -Fetched 208 MB in 16s (13.0 MB/s) +Fetched 208 MB in 6s (36.0 MB/s) Preconfiguring packages ... Selecting previously unselected package netbase. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 19807 files and directories currently installed.) @@ -2823,7 +2855,11 @@ Building tag database... -> Finished parsing the build-deps I: Building the package -I: Running cd /build/reproducible-path/octave-image-2.16.0/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-genchanges -S > ../octave-image_2.16.0-1_source.changes +I: user script /srv/workspace/pbuilder/2779170/tmp/hooks/A99_set_merged_usr starting +Not re-configuring usrmerge for unstable +I: user script /srv/workspace/pbuilder/2779170/tmp/hooks/A99_set_merged_usr finished +hostname: Name or service not known +I: Running cd /build/reproducible-path/octave-image-2.16.0/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-genchanges -S > ../octave-image_2.16.0-1_source.changes dpkg-buildpackage: info: source package octave-image dpkg-buildpackage: info: source version 2.16.0-1 dpkg-buildpackage: info: source distribution unstable @@ -2872,62 +2908,62 @@ make[1]: Entering directory '/build/reproducible-path/octave-image-2.16.0/src' /usr/bin/mkoctfile --verbose __spatial_filtering__.cc /usr/bin/mkoctfile --verbose __bilateral__.cc -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __spatial_filtering__.cc -o /tmp/oct-o4STnx.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __bilateral__.cc -o /tmp/oct-GBtNTh.o /usr/bin/mkoctfile --verbose __eps__.cc /usr/bin/mkoctfile --verbose __custom_gaussian_smoothing__.cc /usr/bin/mkoctfile --verbose __boundary__.cc /usr/bin/mkoctfile --verbose bwfill.cc +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __spatial_filtering__.cc -o /tmp/oct-foGJNO.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __bilateral__.cc -o /tmp/oct-hABCnB.o /usr/bin/mkoctfile --verbose rotate_scale.cc +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __eps__.cc -o /tmp/oct-ZJOrls.o /usr/bin/mkoctfile --verbose hough_line.cc /usr/bin/mkoctfile --verbose graycomatrix.cc +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __custom_gaussian_smoothing__.cc -o /tmp/oct-aMUtDa.o /usr/bin/mkoctfile --verbose bwdist.cc +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __boundary__.cc -o /tmp/oct-dFybGx.o /usr/bin/mkoctfile --verbose intlut.cc +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection bwfill.cc -o /tmp/oct-2GiCHH.o /usr/bin/mkoctfile --verbose nonmax_suppress.cc +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection rotate_scale.cc -o /tmp/oct-hRQRts.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection hough_line.cc -o /tmp/oct-UFZh1P.o /usr/bin/mkoctfile --verbose -c strel.cc -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection strel.cc -o strel.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection graycomatrix.cc -o /tmp/oct-SgxZpO.o /usr/bin/mkoctfile --verbose -c connectivity.cc +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection bwdist.cc -o /tmp/oct-yI7fc8.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection intlut.cc -o /tmp/oct-PYSJZ0.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection nonmax_suppress.cc -o /tmp/oct-wgtThH.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection strel.cc -o strel.o g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection connectivity.cc -o connectivity.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __eps__.cc -o /tmp/oct-f7vzUp.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __custom_gaussian_smoothing__.cc -o /tmp/oct-tEjmA3.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __boundary__.cc -o /tmp/oct-FSHZqh.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection bwfill.cc -o /tmp/oct-hT6Czl.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection rotate_scale.cc -o /tmp/oct-e5Oqvs.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection hough_line.cc -o /tmp/oct-UOyzdM.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection graycomatrix.cc -o /tmp/oct-yPILiu.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection bwdist.cc -o /tmp/oct-PyTNVK.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection intlut.cc -o /tmp/oct-bZSOAV.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection nonmax_suppress.cc -o /tmp/oct-w67LAI.o -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __eps__.oct /tmp/oct-f7vzUp.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o hough_line.oct /tmp/oct-UOyzdM.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __boundary__.oct /tmp/oct-FSHZqh.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o graycomatrix.oct /tmp/oct-yPILiu.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o intlut.oct /tmp/oct-bZSOAV.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o rotate_scale.oct /tmp/oct-e5Oqvs.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o nonmax_suppress.oct /tmp/oct-w67LAI.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o bwfill.oct /tmp/oct-hT6Czl.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o bwdist.oct /tmp/oct-PyTNVK.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __eps__.oct /tmp/oct-ZJOrls.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o hough_line.oct /tmp/oct-UFZh1P.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __boundary__.oct /tmp/oct-dFybGx.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o intlut.oct /tmp/oct-PYSJZ0.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o rotate_scale.oct /tmp/oct-hRQRts.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o graycomatrix.oct /tmp/oct-SgxZpO.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o bwdist.oct /tmp/oct-yI7fc8.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o nonmax_suppress.oct /tmp/oct-wgtThH.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro /usr/bin/mkoctfile --verbose conndef.cc connectivity.o /usr/bin/mkoctfile --verbose bwlabeln.cc connectivity.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection conndef.cc -o /tmp/oct-qoQkwr.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection bwlabeln.cc -o /tmp/oct-voxRPM.o /usr/bin/mkoctfile --verbose imreconstruct.cc connectivity.o /usr/bin/mkoctfile --verbose bwconncomp.cc connectivity.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection imreconstruct.cc -o /tmp/oct-3qQDLI.o /usr/bin/mkoctfile --verbose watershed.cc connectivity.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection bwconncomp.cc -o /tmp/oct-KktiLs.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection watershed.cc -o /tmp/oct-68P9hp.o -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __custom_gaussian_smoothing__.oct /tmp/oct-tEjmA3.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection conndef.cc -o /tmp/oct-QQ5XNw.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection bwlabeln.cc -o /tmp/oct-psAZVz.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection bwconncomp.cc -o /tmp/oct-ZpSIGT.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection imreconstruct.cc -o /tmp/oct-wrPASK.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection watershed.cc -o /tmp/oct-AXYVmE.o +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o bwfill.oct /tmp/oct-2GiCHH.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __custom_gaussian_smoothing__.oct /tmp/oct-aMUtDa.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __bilateral__.oct /tmp/oct-hABCnB.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o conndef.oct connectivity.o /tmp/oct-QQ5XNw.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro /usr/bin/mkoctfile --verbose imerode.cc strel.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection imerode.cc -o /tmp/oct-FVesNG.o -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o conndef.oct connectivity.o /tmp/oct-qoQkwr.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __bilateral__.oct /tmp/oct-GBtNTh.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __spatial_filtering__.oct /tmp/oct-o4STnx.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o bwlabeln.oct connectivity.o /tmp/oct-voxRPM.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o bwconncomp.oct connectivity.o /tmp/oct-KktiLs.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o imreconstruct.oct connectivity.o /tmp/oct-3qQDLI.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o watershed.oct connectivity.o /tmp/oct-68P9hp.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o imerode.oct strel.o /tmp/oct-FVesNG.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection imerode.cc -o /tmp/oct-C4liem.o +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o bwconncomp.oct connectivity.o /tmp/oct-ZpSIGT.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o bwlabeln.oct connectivity.o /tmp/oct-psAZVz.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __spatial_filtering__.oct /tmp/oct-foGJNO.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o imreconstruct.oct connectivity.o /tmp/oct-wrPASK.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o watershed.oct connectivity.o /tmp/oct-AXYVmE.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-9.4.0/octave/.. -I/usr/include/octave-9.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-image-2.16.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o imerode.oct strel.o /tmp/oct-C4liem.o -shared -Wl,-Bsymbolic -Wl,-z,relro -flto=auto -ffat-lto-objects -Wl,-z,relro make[1]: Leaving directory '/build/reproducible-path/octave-image-2.16.0/src' copyfile /build/reproducible-path/octave-image-2.16.0/./src/__bilateral__.oct /build/reproducible-path/octave-image-2.16.0/./src/__boundary__.oct /build/reproducible-path/octave-image-2.16.0/./src/__custom_gaussian_smoothing__.oct /build/reproducible-path/octave-image-2.16.0/./src/__eps__.oct /build/reproducible-path/octave-image-2.16.0/./src/__spatial_filtering__.oct /build/reproducible-path/octave-image-2.16.0/./src/bwconncomp.oct /build/reproducible-path/octave-image-2.16.0/./src/bwdist.oct /build/reproducible-path/octave-image-2.16.0/./src/bwfill.oct /build/reproducible-path/octave-image-2.16.0/./src/bwlabeln.oct /build/reproducible-path/octave-image-2.16.0/./src/conndef.oct /build/reproducible-path/octave-image-2.16.0/./src/graycomatrix.oct /build/reproducible-path/octave-image-2.16.0/./src/hough_line.oct /build/reproducible-path/octave-image-2.16.0/./src/imerode.oct /build/reproducible-path/octave-image-2.16.0/./src/imreconstruct.oct /build/reproducible-path/octave-image-2.16.0/./src/intlut.oct /build/reproducible-path/octave-image-2.16.0/./src/nonmax_suppress.oct /build/reproducible-path/octave-image-2.16.0/./src/rotate_scale.oct /build/reproducible-path/octave-image-2.16.0/./src/watershed.oct /build/reproducible-path/octave-image-2.16.0/./src/__spatial_filtering__.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/bwconncomp.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/bwdist.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/bwfill.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/bwlabeln.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/conndef.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/graycomatrix.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/hough_line.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/imerode.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/imreconstruct.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/intlut.cc-tst /build/reproducible-path/octave-image-2.16.0/./src/watershed.cc-tst /build/reproducible-path/octave-image-2.16.0/./inst/x86_64-pc-linux-gnu-api-v59 For information about changes from previous versions of the image package, run 'news image'. @@ -2935,431 +2971,6 @@ Checking package... Run the unit tests... Checking m files ... -[inst/imregionalmin.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imregionalmin.m -***** test - a = [ - 7 3 9 3 10 3 - 4 2 3 10 1 3 - 1 4 6 9 4 10 - 8 7 9 3 4 8 - 5 9 3 3 8 9 - 3 6 9 4 1 10]; - - a4 = logical ([ - 0 0 0 1 0 0 - 0 1 0 0 1 0 - 1 0 0 0 0 0 - 0 0 0 1 0 0 - 0 0 1 1 0 0 - 1 0 0 0 1 0]); - assert (imregionalmin (a, 4), a4) - assert (imregionalmin (uint8 (a), 4), a4) - assert (imregionalmin (int8 (a), 4), a4) - - a8 = logical ([ - 0 0 0 0 0 0 - 0 0 0 0 1 0 - 1 0 0 0 0 0 - 0 0 0 0 0 0 - 0 0 0 0 0 0 - 1 0 0 0 1 0]); - assert (imregionalmin (a), a8) - assert (imregionalmin (a, 8), a8) - assert (imregionalmin (uint8 (a), 8), a8) - assert (imregionalmin (int8 (a), 8), a8) -***** test - a = [ - 4 8 5 -1 8 7 - -1 4 0 7 1 1 - 6 1 2 6 7 0 - 6 1 5 -2 5 9 - 1 4 -1 0 0 2 - 4 6 1 0 7 1]; - - a4 = logical ([ - 0 0 0 1 0 0 - 1 0 1 0 0 0 - 0 1 0 0 0 1 - 0 1 0 1 0 0 - 1 0 1 0 0 0 - 0 0 0 0 0 1]); - assert (imregionalmin (a, 4), a4) - assert (imregionalmin (int8 (a), 4), a4) - - a8 = logical ([ - 0 0 0 1 0 0 - 1 0 0 0 0 0 - 0 0 0 0 0 1 - 0 0 0 1 0 0 - 0 0 0 0 0 0 - 0 0 0 0 0 0]); - assert (imregionalmin (a), a8) - assert (imregionalmin (a, 8), a8) - assert (imregionalmin (int8 (a), 8), a8) -***** test - ## test float input images - im0 = peaks (); - im1 = im0 ./ 100; - max_pos_expected = [1; 49; 664; 1286; 1302; 2401]; - max0 = imregionalmin (im0); - max0_pos = find (max0); - max1 = imregionalmin (im1); - assert (max1, max0) - assert (max0_pos, max_pos_expected) -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/imgaussfilt.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imgaussfilt.m -***** assert (imgaussfilt(ones (5) * 9)); -***** assert (isa (imgaussfilt (uint8 (ones (5))), "uint8")); -***** assert (isa (imgaussfilt (uint16 (ones (5))), "uint16")); -***** assert (isa (imgaussfilt (uint32 (ones (5))), "uint32")); -***** assert (isa (imgaussfilt (uint64 (ones (5))), "uint64")); -***** assert (isa (imgaussfilt (int8 (ones (5))), "int8")); -***** assert (isa (imgaussfilt (int16 (ones (5))), "int16")); -***** assert (isa (imgaussfilt (int32 (ones (5))), "int32")); -***** assert (isa (imgaussfilt (single (ones (5))), "single")); -***** assert (isa (imgaussfilt (double (ones (5))), "double")); -***** error (imgaussfilt (true (5))); -***** error (imgaussfilt (5i+9)); -***** error (imgaussfilt ({"sdg","sdgsd"})); -***** error (imgaussfilt ("sdjgkhsdkl")); -***** error (imgaussfilt (struct("x", "34", "y", "67"))) -***** error (imgaussfilt ()); -***** error (imgaussfilt ("asdf")); -***** assert(imgaussfilt(ones (5), 6)); -***** assert(imgaussfilt(ones (5), 1.7)); -***** assert (imgaussfilt (ones (5), [1, 4])); -***** error(imgaussfilt(ones (5), -0.5)); -***** error (imgaussfilt (ones (3), "asdf")); -***** error (imgaussfilt (ones (3), [3,5,6])); -***** error (imgaussfilt (ones (3), [3,-5])); -***** error (imgaussfilt (ones (3), [-3, 4])); -***** error (imgaussfilt (ones (3), [-3, -4])); -***** assert (imgaussfilt (ones (5), "padding", "circular")); -***** assert (imgaussfilt (ones (5), "padding", "symmetric")); -***** assert (imgaussfilt (ones (3), "padding", "replicate")); -***** assert (imgaussfilt (ones (3), "Padding", "Replicate")); -***** assert (imgaussfilt (ones (3), "Padding", 5)); -***** error (imgaussfilt (ones (3), "circular")); -***** error (imgaussfilt (ones (3), "symmetric", "padding")); -***** error (imgaussfilt (ones (3), "padding")); -***** error (imgaussfilt (ones (3), "padding", "ciircular")); -***** error (imgaussfilt (ones (3), "padding", [2, 3])); -***** error(imgaussfilt(ones (5), 5i)); -***** assert (imgaussfilt (ones (5), "filtersize", 3)); -***** assert (imgaussfilt (ones (5), "FilterSize", [5, 7])); -***** assert (imgaussfilt (ones (5), "FilterSize", [5, 3]')); -***** error (imgaussfilt (ones (5), "filter", 3)); -***** error (imgaussfilt (ones (5), "filtersize", 4)); -***** error (imgaussfilt (ones (5), "filtersize", 5.5)); -***** error (imgaussfilt (ones (5), "filterSize", [5, 2])); -***** error (imgaussfilt (ones (5), "filterSize", [5, 2]')); -***** error (imgaussfilt (ones (5), "filtersize", [5, 7.5])); -***** error (imgaussfilt (ones (5), "filtersize", [5, 7.5]')); -***** assert (imgaussfilt (ones (5), "padding", "replicate")); -***** assert (imgaussfilt (ones (5), "padding", "circular")); -***** assert (imgaussfilt (ones (5), "padding", "symmetric")); -***** assert (imgaussfilt (ones (5), "padding", 5)); -***** assert (imgaussfilt (ones (5), "FilterDomain", "auto")); -***** assert (imgaussfilt (ones (5), "FilterDomain", "frequency")); -***** assert (imgaussfilt (ones (5), "FilterDomain", "spatial")); -***** error (imgaussfilt (ones (5), "FilterDomain", "asdf")); -***** error (imgaussfilt (ones (5), "FilterDomain", 4)); -***** test - input = [1, 1, 1; 10, 10, 10; 100, 100, 100]; - expected = [12.5028 12.5028 12.5028 - 18.6271 18.6271 18.6271 - 79.8702 79.8702 79.8702]; - output = imgaussfilt (input, "padding", "circular"); - assert (output, expected, 0.0001); -***** test - input = [1, 1, 1; 10, 10, 10; 100, 100, 100]; - expected = [1.9586 1.9586 1.9586 - 18.6271 18.6271 18.6271 - 90.4144 90.4144 90.4144]; - output = imgaussfilt (input, "padding", "replicate"); - assert (output, expected, 0.0001); -***** test - input = [1 1 1 1 1 1 - 1 2 2 2 2 1; - 1 2 2 2 2 1; - 1 2 2 2 2 1; - 1 2 2 2 2 1; - 1 1 1 1 1 1]; - expected = [1.0114 1.0953 1.1067 1.1067 1.0953 1.0114 - 1.0953 1.7980 1.8930 1.8930 1.7980 1.0953 - 1.1067 1.8930 1.9995 1.9995 1.8930 1.1067 - 1.1067 1.8930 1.9995 1.9995 1.8930 1.1067 - 1.0953 1.7980 1.8930 1.8930 1.7980 1.0953 - 1.0114 1.0953 1.1067 1.1067 1.0953 1.0114]; - output = imgaussfilt (input, "filterSize", 5, "padding", "replicate"); - assert (output, expected, 0.0001); -***** test - input = [1 1 1 1 1 1 - 1 2 2 2 2 1; - 1 2 2 2 2 1; - 1 2 2 2 2 1; - 1 2 2 2 2 1; - 1 1 1 1 1 1]; - expected = [1.0114 1.0956 1.1070 1.1070 1.0956 1.0114 - 1.0956 1.7980 1.8930 1.8930 1.7980 1.0956 - 1.1070 1.8930 1.9995 1.9995 1.8930 1.1070 - 1.1070 1.8930 1.9995 1.9995 1.8930 1.1070 - 1.0956 1.7980 1.8930 1.8930 1.7980 1.0956 - 1.0114 1.0956 1.1070 1.1070 1.0956 1.0114]; - output = imgaussfilt (input, "filterSize", 5, "padding", "symmetric"); - assert (output, expected, 0.0001); -***** test - input = zeros(3,3,3,3); - input (2,2,:,:) = 9; - output = imgaussfilt (input); - expected = ones (3,3,3,3); - assert (size(output), size(expected), eps); -***** test - a1 = ones (5); - a2 = ones (5) * 2; - a3 = ones (5) * 3; - a4 = ones (5) * 4; - im = cat (4, a1, a2, a3, a4); - expected = im; - output = imgaussfilt (im); - assert (output, expected, 0.0001); -***** test - input = zeros(5,7); - input(3,4) = 1; - expected = [ -0.0000 0.0001 0.0006 0.0011 0.0006 0.0001 -0.0000 - 0.0000 0.0062 0.0397 0.0736 0.0397 0.0062 0.0000 - 0 0.0250 0.1593 0.2953 0.1593 0.0250 -0.0000 - 0 0.0062 0.0397 0.0736 0.0397 0.0062 -0.0000 - -0.0000 0.0001 0.0006 0.0011 0.0006 0.0001 -0.0000 ]; - output = imgaussfilt(input, [0.6,0.9], "filterDomain", "frequency"); - assert (output, expected, 0.01); -***** test - input = zeros(8); - input(6,4) = 1; - input(6,5) = 1; - input(7,4) = 2; - input(7,5) = 2; - expected_replicate = [-0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 - 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 - 0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 - 0.0000 0.0030 0.0163 0.0352 0.0352 0.0163 0.0030 0.0000 - 0.0000 0.0163 0.0892 0.1932 0.1932 0.0892 0.0163 0.0000 - 0.0000 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0.0000 - 0 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0 - -0.0000 0.0192 0.1055 0.2284 0.2284 0.1055 0.0192 0.0000]; - expected_circular = [-0.0000 0.0030 0.0163 0.0352 0.0352 0.0163 0.0030 0.0000 - 0.0000 -0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 - 0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 - 0.0000 0.0030 0.0163 0.0352 0.0352 0.0163 0.0030 0.0000 - 0.0000 0.0163 0.0892 0.1932 0.1932 0.0892 0.0163 0.0000 - 0 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0.0000 - 0.0000 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0.0000 - 0.0000 0.0163 0.0892 0.1932 0.1932 0.0892 0.0163 0.0000]; - expected_symmetric = [-0.0000 -0.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 -0.0000 - 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 - 0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 - 0.0000 0.0030 0.0163 0.0352 0.0352 0.0163 0.0030 0.0000 - 0 0.0163 0.0892 0.1932 0.1932 0.0892 0.0163 0 - 0.0000 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0 - 0 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0 - 0.0000 0.0163 0.0892 0.1932 0.1932 0.0892 0.0163 0.0000]; - output_symmetric = imgaussfilt(input, 1, "filterDomain", "frequency", "padding", "symmetric"); - output_circular = imgaussfilt(input, 1, "filterDomain", "frequency", "padding", "circular"); - output_replicate = imgaussfilt(input, 1, "filterDomain", "frequency", "padding", "replicate"); - assert (output_symmetric, expected_symmetric, 0.3); - assert (output_circular, expected_circular, 0.3); - assert (output_replicate, expected_replicate, 0.3); -***** test - im = zeros (11); - im(6,6) = 1; - out = imgaussfilt (im, [2, 0.5]); - assert (sum (out(6,:)), 0.2042, 0.0001); - assert (sum (out(:,6)), 0.7870, 0.0001); -65 tests, 65 passed, 0 known failure, 0 skipped -[inst/mean2.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/mean2.m -***** test - ## This throws a division by zero warning which Matlab does not, but - ## that's because Matlab does not throw such warnings in the first - ## place. Octave does, so we do not turn the warning off. - warning ("off", "Octave:divide-by-zero", "local"); - assert (mean2 ([]), NaN) -***** assert (mean2 (logical ([1 1; 0 0])), 0.5) -***** assert (mean2 (ones (3, 3, 3)), 1) -***** assert (mean2 (i), i) -***** assert (mean2 ([1 i]), [0.5+0.5i]) -***** assert (mean2 (speye (3)), sparse (1/3)) -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/imnoise.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imnoise.m -***** assert(var(imnoise(ones(10)/2,'gaussian')(:)),0.01,0.005) # probabilistic -***** assert(length(find(imnoise(ones(10)/2,'salt & pepper')~=0.5)),5,10) # probabilistic -***** assert(var(imnoise(ones(10)/2,'speckle')(:)),0.01,0.005) # probabilistic -***** test - A = imnoise (.5 * ones (100), 'poisson'); - assert (class (A), 'double') -***** test - A = imnoise (.5 * ones (100, 'single'), 'poisson'); - assert (class (A), 'single') -***** test - A = imnoise (128 * ones (100, 'uint8'), 'poisson'); - assert (class (A), 'uint8') -***** test - A = imnoise (256 * ones (100, 'uint16'), 'poisson'); - assert (class (A), 'uint16') -***** demo - A = imnoise (2^7 * ones (100, 'uint8'), 'poisson'); - subplot (2, 2, 1) - imshow (A) - title ('uint8 image with poisson noise') - A = imnoise (2^15 * ones (100, 'uint16'), 'poisson'); - subplot (2, 2, 2) - imshow (A) - title ('uint16 image with poisson noise') - A = imnoise (.5 * ones (100), 'poisson'); - subplot (2, 2, 3) - imshow (A) - title ('double image with poisson noise') - A = imnoise (.5 * ones (100, 'single'), 'poisson'); - subplot (2, 2, 4) - imshow (A) - title ('single image with poisson noise') -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/lab2uint8.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2uint8.m -***** test - cm_uint8 = uint8 ([0 1 2 3 4 127 128 200 254 255]); - cm_uint8 = repmat (cm_uint8(:), [1 3]); - im2d_uint8 = reshape (cm_uint8, [5 2 3]); - imnd_uint8 = permute (im2d_uint8, [1 4 3 2]); - - cm_uint16 = uint16 ([0 256 512 768 1024 32512 32768 51200 65024 65280]); - cm_uint16 = repmat (cm_uint16(:), [1 3]); - assert (lab2uint16 (cm_uint8), cm_uint16) - im2d_uint16 = reshape (cm_uint16, [5 2 3]); - assert (lab2uint16 (im2d_uint8), im2d_uint16) - assert (lab2uint16 (imnd_uint8), permute (im2d_uint16, [1 4 3 2])) - - l1 = 100/255; - cm = [ - 0 -128 -128 - l1 -127 -127 - 2*l1 -126 -126 - 3*l1 -125 -125 - 4*l1 -124 -124 - 127*l1 -1 -1 - 128*l1 0 0 - 200*l1 72 72 - 254*l1 126 126 - 100 127 127]; - im2d = reshape (cm, [5 2 3]); - imnd = permute (im2d, [1 4 3 2]); - - assert (lab2double (cm_uint8), cm) - assert (lab2double (im2d_uint8), im2d) - assert (lab2double (imnd_uint8), imnd) - - assert (lab2single (cm_uint8), single (cm)) - assert (lab2single (im2d_uint8), single (im2d)) - assert (lab2single (imnd_uint8), single (imnd)) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/im2single.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/im2single.m -***** assert (im2single (single ([1 2 3])), single ([1 2 3])); -***** assert (im2single ([1 2 3]), single ([1 2 3])); -***** assert (im2single (uint8 ([0 127 128 255])), single ([0 127/255 128/255 1])); -***** assert (im2single (uint16 ([0 127 128 65535])), single ([0 127/65535 128/65535 1])); -***** assert (im2single (int16 ([-32768 -32767 -32766 32767])), single ([0 1/65535 2/65535 1])); -***** assert (im2single (uint8 ([0 1 255]), "indexed"), single ([1 2 256])); -***** assert (im2single (uint16 ([0 1 2557]), "indexed"), single ([1 2 2558])); -***** assert (im2single ([3 25], "indexed"), single ([3 25])); -***** error im2single ([0 1 2], "indexed"); -***** error im2single (int16 ([17 8]), "indexed"); -***** error im2single (int16 ([-7 8]), "indexed"); -***** error im2single ([false true], "indexed"); -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/imcast.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imcast.m -***** test - im = randi ([0 255], 40, "uint8"); - assert (imcast (im, "uint8"), im2uint8 (im)) - assert (imcast (im, "uint16"), im2uint16 (im)) - assert (imcast (im, "single"), im2single (im)) - assert (imcast (im, "uint8", "indexed"), im2uint8 (im, "indexed")) - assert (imcast (im, "uint16", "indexed"), im2uint16 (im, "indexed")) - assert (imcast (im, "single", "indexed"), im2single (im, "indexed")) -***** test - im = randi ([1 256], 40, "double"); - assert (imcast (im, "uint8"), im2uint8 (im)) - assert (imcast (im, "uint8", "indexed"), im2uint8 (im, "indexed")) - assert (imcast (im, "single", "indexed"), im2single (im, "indexed")) -***** test - im = randi ([0 65535], 40, "uint16"); - assert (imcast (im, "uint8"), im2uint8 (im)) - assert (imcast (im, "single"), im2single (im)) - assert (imcast (im, "single", "indexed"), im2single (im, "indexed")) -***** test - im = randi ([1 255], 40, "double"); - assert (imcast (im, "uint8", "indexed"), im2uint8 (im, "indexed")) - assert (imcast (im, "single", "indexed"), im2single (im, "indexed")) -***** test - im = rand (40); - assert (imcast (im, "uint8"), im2uint8 (im)) -***** error imcast (randi (127, 40, "int8"), "uint8") -***** error imcast (randi (255, 40, "uint8"), "uint32") -***** error imcast (randi (255, 40, "uint8"), "not a class") -***** error imcast (randi ([0 65535], 40, "uint16"), "uint8", "indexed") -***** assert (imcast ([0 1 .2; 2 -0 Inf], "logical"), logical ([0 1 1; 1 0 1])) -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/ycbcr2rgb.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/ycbcr2rgb.m -***** assert (ycbcr2rgb (rgb2ycbcr (jet (10))), jet (10), 0.00001); -***** assert (class (ycbcr2rgb (single (rand (5, 5, 3)))), "single") -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/psf2otf.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/psf2otf.m -***** test - psf = rand (6, 1); - assert (psf2otf (psf), fft (circshift (psf, [-3])), eps); -***** test - psf = rand (6, 6); - assert (psf2otf (psf), fft2 (circshift (psf, [-3 -3])), eps); -***** test - psf = rand (6, 6, 6); - assert (psf2otf (psf), fftn (circshift (psf, [-3 -3 -3])), eps); -***** test - psf = rand (7, 1); - assert (psf2otf (psf), fft (circshift (psf, [-3])), eps); -***** test - psf = rand (7, 7); - assert (psf2otf (psf), fft2 (circshift (psf, [-3 -3])), 1e-14); -***** test - psf = rand (6, 7, 8); - assert (psf2otf (psf), fftn (circshift (psf, [-3 -3 -4])), 6e-14); -***** test - psf = rand (6, 1); - ppsf = [psf; 0]; - assert (psf2otf (psf, 7), fft (circshift (ppsf, [-3])), eps); -***** test - psf = rand (6, 1); - ppsf = [[psf; 0] zeros(7, 6)]; - assert (psf2otf (psf, [7 7]), fft2 (circshift (ppsf, [-3 0])), eps); -***** test - psf = rand (6, 6); - ppsf = [psf zeros(6, 1)]; - assert (psf2otf (psf, [6 7]), fft2 (circshift (ppsf, [-3 -3])), 1e-14); -***** error psf2otf ('foo') -***** error psf2otf (rand (16), 14) -***** error psf2otf (rand (16), [14 14]) -***** error psf2otf (rand (16), [18]) -***** error psf2otf (rand (16), [18 14]) -***** test - psf = fspecial ("gaussian", 16) + 1i; - otf = psf2otf (psf); - assert (otf2psf (otf), psf, eps); -15 tests, 15 passed, 0 known failure, 0 skipped [inst/montage.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/montage.m ***** function cdata = montage_cdata (varargin) @@ -3404,850 +3015,316 @@ ]); assert (cdata, expected) 2 tests, 2 passed, 0 known failure, 0 skipped -[inst/lab2single.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2single.m -***** test - l_max_f = 100 + (25500 / 65280); - ab_max_f = 127 + (255 / 256); - cm = [ - -Inf - Inf - NaN - l_max_f - ab_max_f - -200 - -129 - -128 - -128+(255/65280)*(0.499) - -128+(255/65280)*(0.500) - -128+(255/65280)*(0.501) - -127 - -1 - 0 - (100/65280)*(0.499999) - (100/65280)*(0.51) - (100/65280)*(0.500001) - 1 - 99 - 100 - 101 - 126 - 127 - 128 - 254 - 255 - 256 - 257]; - cm = repmat (single (cm), [1 3]); - im2d = reshape (cm, [7 4 3]); - imnd = permute (im2d, [1 4 3 2]); - - cm_uint8 = uint8 ([ - 0 0 0 - 255 255 255 - 255 255 255 - 255 228 228 - 255 255 255 - 0 0 0 - 0 0 0 - 0 0 0 - 0 0 0 - 0 0 0 - 0 0 0 - 0 1 1 - 0 127 127 - 0 128 128 - 0 128 128 - 0 128 128 - 0 128 128 - 3 129 129 - 252 227 227 - 255 228 228 - 255 229 229 - 255 254 254 - 255 255 255 - 255 255 255 - 255 255 255 - 255 255 255 - 255 255 255 - 255 255 255]); - - assert (lab2uint8 (cm), cm_uint8) - im2d_uint8 = reshape (cm_uint8, [7 4 3]); - assert (lab2uint8 (im2d), im2d_uint8) - assert (lab2uint8 (imnd), permute (im2d_uint8, [1 4 3 2])) - - cm_uint16 = uint16 ([ - 0 0 0 - 65535 65535 65535 - 65535 65535 65535 - 65535 58468 58468 - 65535 65535 65535 - 0 0 0 - 0 0 0 - 0 0 0 - 0 0 0 - 0 1 1 - 0 1 1 - 0 256 256 - 0 32512 32512 - 0 32768 32768 - 0 32768 32768 - 1 32768 32768 - 1 32768 32768 - 653 33024 33024 - 64627 58112 58112 - 65280 58368 58368 - 65535 58624 58624 - 65535 65024 65024 - 65535 65280 65280 - 65535 65535 65535 - 65535 65535 65535 - 65535 65535 65535 - 65535 65535 65535 - 65535 65535 65535]); - - assert (lab2uint16 (cm), cm_uint16) - im2d_uint16 = reshape (cm_uint16, [7 4 3]); - assert (lab2uint16 (im2d), im2d_uint16) - assert (lab2uint16 (imnd), permute (im2d_uint16, [1 4 3 2])) - - assert (lab2double (cm), double (cm)) - assert (lab2double (im2d), double (im2d)) - assert (lab2double (imnd), double (imnd)) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/labelmatrix.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/labelmatrix.m -***** test - cc = struct (); - cc.Connectivity = 8; - cc.ImageSize = [7 7]; - cc.NumObjects = 4; - cc.PixelIdxList = {[1;2], [5;7;12;13;14], [22;23], [26;32;33;36;37;38]}; - - l = uint8 ([ - 1 0 0 3 0 4 0 - 1 0 0 3 0 4 0 - 0 0 0 0 0 4 0 - 0 0 0 0 4 0 0 - 2 2 0 4 4 0 0 - 0 2 0 0 0 0 0 - 2 2 0 0 0 0 0 - ]); - assert (labelmatrix (cc), l) +[inst/imgetfile.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imgetfile.m +***** assert (1) 1 test, 1 passed, 0 known failure, 0 skipped -[inst/houghlines.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/houghlines.m -***** shared BW0, theta0, rho0, peaks0_1, peaks0_2, lines0_1, lines0_2, BW1, theta1, rho1, peaks1, lines1 - BW0 = logical([0 0 0 0 1; 0 0 0 1 0; 1 0 1 0 0; 0 1 0 0 0; 1 1 1 1 1]); - theta0 = [-90:89]; - rho0 = [-7:7]; - peaks0_1 = [11 130]; - peaks0_2 = [11 130; 4 1]; - lines0_1 = struct ("point1", {[1,5]}, "point2", {[5,1]}, "theta", {39}, "rho", {3}); - lines0_2 = struct ("point1", {[1,5], [1,5]}, "point2", {[5,1],[5,5]}, "theta", {39,-90}, "rho", {3, -4}); - BW1 = diag(ones(50,1)); - theta1 = [-90:89]; - rho1 = -70:70; - peaks1 = [71 46]; - lines1 = struct ("point1", {[1 1]}, "point2", {[50 50]}, "theta", {-45}, "rho", {0}); -***** error houghlines () -***** error houghlines (BW1) -***** error houghlines (BW1, theta1) -***** error houghlines (BW1, theta1, rho1) -***** assert (houghlines (BW1, theta1, rho1, peaks1), lines1) -***** error (houghlines (BW1, theta1, rho1, peaks1, [1 2 3])) -***** assert (houghlines (BW1, theta1, rho1, peaks1, "FillGap", 5), lines1) -***** assert (houghlines (BW1, theta1, rho1, peaks1, "MinLength", 2), lines1) -***** assert (houghlines (BW1, theta1, rho1, peaks1, "FillGap", 5, "MinLength", 2), lines1) -***** assert (houghlines (BW1, theta1, rho1, peaks1, "MinLength", 2, "FillGap", 5), lines1) -***** error houghlines (BW1, theta1, rho1, peaks1, "MinLength", 2, [1 2 3]) -***** error houghlines (BW1, theta1, rho1, peaks1, "MinLength", 2, "FillGap", 5, [1 2 3]) -***** assert (houghlines (double (BW1), theta1, rho1, peaks1), lines1) -***** error houghlines (ones(5, 5, 5), theta1, rho1, peaks1) -***** error houghlines ("nonsense", theta1, rho1, peaks1) -***** error houghlines (BW1, ones(5), rho1, peaks1) -***** error houghlines (BW1, "nonsense", rho1, peaks1) -***** error houghlines (BW1, theta1, ones(5), peaks1) -***** error houghlines (BW1, theta1, "nonsense", peaks1) -***** error houghlines (BW1, theta1, rho1, ones(5)) -***** error houghlines (BW1, theta1, rho1, ones(2,2,2)) -***** error houghlines (BW1, theta1, rho1, "nonsense") -***** error houghlines (BW1, theta1, rho1, peaks1, "nonsense", 5) -***** error houghlines (BW1, theta1, rho1, peaks1, "MinLength", -5) -***** error houghlines (BW1, theta1, rho1, peaks1, "MinLength", [3 4]) -***** error houghlines (BW1, theta1, rho1, peaks1, "MinLength", "nonsense") -***** error houghlines (BW1, theta1, rho1, peaks1, "FillGap", -5) -***** error houghlines (BW1, theta1, rho1, peaks1, "FillGap", [3 4]) -***** error houghlines (BW1, theta1, rho1, peaks1, "FillGap", "nonsense") -***** test - out = houghlines(BW0, theta0, rho0, peaks0_2, "MinLength", 1); - assert (out, lines0_2) # includes class = struct, size = [1,2] -***** test # for empty output - n = 100; - BW = false (n); - a = 50; % line starts at left side at row a - b = 3; % slope of line is 1:b - for column = 1:n - if (rem (column, b) == 0) - row = a - column/b; - BW(row, column) = true; - BW(row, column+1) = true; - end - end - theta = [-90: 89]; - rho = [-141:141]; - peaks = [188, 163]; - out = houghlines(BW, theta, rho, peaks, 'FillGap', 1, 'MinLength', 5); - assert (out, struct([])) -***** test - out0_1 = houghlines(BW0, theta0, rho0, peaks0_1, 'MinLength', 1); - out0_2 = houghlines(BW0, theta0, rho0, peaks0_2, 'MinLength', 1); - assert (out0_1, lines0_1); - assert (out0_2, lines0_2); +[inst/qtdecomp.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/qtdecomp.m +***** demo + full(qtdecomp(eye(8))) + %It finds 2 big blocks of 0 and it decomposes further where 0 and 1 are mixed. +***** # Test if odd-sized limits split +***** assert(full(qtdecomp(eye(5))), reshape([5,zeros(1,24)],5,5)); +***** assert(full(qtdecomp(eye(6))), repmat(reshape([3,zeros(1,8)],3,3),2,2)); +***** # Test 'equal' method ***** test - out = houghlines(BW1, theta1, rho1, peaks1); - assert (out, lines1); + a=ones(2,2); + b=[2,0;0,0]; + assert(full(qtdecomp(eye(4))), [a,b;b,a]); +***** shared A, B2, B4 + A=[ 1, 4, 2, 5,54,55,61,62; + 3, 6, 3, 1,58,53,67,65; + 3, 6, 3, 1,58,53,67,65; + 3, 6, 3, 1,58,53,67,65; + 23,42,42,42,99,99,99,99; + 27,42,42,42,99,99,99,99; + 23,22,26,25,99,99,99,99; + 22,22,24,22,99,99,99,99]; + B2=[2,0;0,0]; + B4=zeros(4); B4(1,1)=4; ***** test - n = 100; - BW = false (n); - a = 50; % line starts at left side at row a - b = 3; % slope of line is 1:b - for column = 1:n - if (rem (column, b) == 0) - row = a - column/b; - BW(row, column) = true; - BW(row, column+1) = true; - end - end - theta = [-90:89]; - rho = [-141:141]; - peaks = [188, 163]; - lines_1 = struct ("point1", {[99 17]}, "point2", {[3 49]}, "theta", {72}, "rho", {46}); - out_1 = houghlines(BW, theta, rho, peaks); - out_n = houghlines(BW, theta, rho, peaks, 'FillGap', 1, 'MinLength', 1); - assert (out_1, lines_1) - assert (size (out_n), [1, 29]) -***** demo - I = checkerboard (30, 1, 1); - I = imnoise(I, "salt & pepper", 0.2); - figure, imshow (I); - title ("noisy image with some lines"); - BW = edge (I, "canny"); - figure, imshow(BW); - title ("edge image"); - [H, theta, rho] = hough (BW); - figure, imshow (mat2gray (H), [], "XData", theta, "YData", rho); - title ("Hough transform of edge image \n 2 peaks marked"); - axis on; xlabel("theta [degrees]"); ylabel("rho [pixels]"); - peaks = houghpeaks (H, 2); - peaks_rho = rho(peaks(:,1)); - peaks_theta = theta(peaks(:,2)); - hold on; plot (peaks_theta, peaks_rho, "sr"); hold off; - lines = houghlines (BW, theta, rho, peaks); - figure, imshow (I), hold on; - for n = 1:length (lines) - points = [lines(n).point1; lines(n).point2]; - plot (points(:,1), points(:,2), "r"); - endfor - title ("the two strongest lines (edges) in the image"), hold off; -34 tests, 34 passed, 0 known failure, 0 skipped -[inst/rgb2lab.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/rgb2lab.m -***** assert (rgb2lab ([0 0 0]), [0, 0, 0], 1e-2) -***** assert (rgb2lab ([1 0 0]), [53.24, 80.09, 67.20], 1e-2) -***** assert (rgb2lab ([1 1 0]), [97.14, -21.55, 94.48], 1e-2) -***** assert (rgb2lab ([0 1 0]), [87.74, -86.18, 83.18], 1e-2) -***** assert (rgb2lab ([0 1 1]), [91.11, -48.09, -14.13], 1e-2) -***** assert (rgb2lab ([0 0 1]), [32.30, 79.19, -107.86], 1e-2) -***** assert (rgb2lab ([1 0 1]), [60.32, 98.24, -60.83], 1e-2) -***** assert (rgb2lab ([1 1 1]), [100, 0.00, 0.00], 1e-2) -***** assert (rgb2lab ([0.5 0.5 0.5]), [53.39, 0.00, 0.00], 1e-2) -***** assert (rgb2lab ([0.75 0 0]), [39.77, 64.51, 54.13], 1e-2) -***** assert (rgb2lab ([0.5 0 0]), [25.42, 47.91, 37.91], 1e-2) -***** assert (rgb2lab ([0.25 0 0]), [9.66, 29.68, 15.24], 1e-2) -***** assert (rgb2lab ([1 0.5 0.5]), [68.11, 48.39, 22.83], 1e-2) -***** assert (rgb2lab ([1.5 1 1]), [111.47, 43.42, 17.98], 1e-2) + R=[ones(4,8); [ones(2),B2;ones(2,4)], B4]; + assert(full(qtdecomp(A)), R); + assert(full(qtdecomp(A,0)), R); +***** # Test 'threshold' method ***** test - rgb_map = rand (64, 3); - assert (lab2rgb (rgb2lab (rgb_map)), rgb_map, 2e-5); + R=[ones(4,8); [ones(2),B2;B2,ones(2)],B4]; + assert(full(qtdecomp(A,1)), R); ***** test - rgb_img = rand (64, 64, 3); - assert (lab2rgb (rgb2lab (rgb_img)), rgb_img, 2e-5); -***** assert (rgb2lab (sparse ([0 0 1])), sparse ([32.30, 79.19, -107.86]), 1e-2) -***** assert (rgb2lab (sparse ([0 1 1])), sparse ([91.11, -48.09, -14.13]), 1e-2) -***** assert (rgb2lab (sparse ([1 1 1])), sparse ([100, 0.00, 0.00]), 1e-2) -***** assert (rgb2lab (uint8([255 255 255])), [100, 0.00, 0.00], 1e-2) -***** assert (class (rgb2lab (single([1 1 1]))), 'single') -***** error rgb2lab () -***** error rgb2lab (1,2) -***** error rgb2lab ({1}) -***** error rgb2lab (ones (2,2)) + R=[[B4,[B2,B2;B2,B2]]; [[ones(2),B2;B2,B2],B4]]; + assert(full(qtdecomp(A,10)), R); ***** test - rgb = rand (16, 16, 3, 5); - lab = zeros (size (rgb)); - for i = 1:5 - lab(:,:,:,i) = rgb2lab (rgb(:,:,:,i)); - endfor - assert (rgb2lab (rgb), lab) -26 tests, 26 passed, 0 known failure, 0 skipped -[inst/iradon.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/iradon.m -***** assert (iradon (single ([0; 1; 1; 0]), 90)); -***** assert (iradon (double ([0; 1; 1; 0]), 90)); -***** assert (iradon (int8 ([0; 1; 1; 0]), 90)); -***** assert (iradon (int16 ([0; 1; 1; 0]), 90)); -***** assert (iradon (int32 ([0; 1; 1; 0]), 90)); -***** assert (iradon (int64 ([0; 1; 1; 0]), 90)); -***** assert (iradon (uint8 ([0; 1; 1; 0]), 90)); -***** assert (iradon (uint16 ([0; 1; 1; 0]), 90)); -***** assert (iradon (uint32 ([0; 1; 1; 0]), 90)); -***** assert (iradon (uint64 ([0; 1; 1; 0]), 90)); -***** assert (iradon (logical ([0; 1; 1; 0]), 90)); -***** assert (iradon (ones (5), 1:5)); -***** assert (iradon (ones (5), 1:5, 'nearest')); -***** assert (iradon (ones (5), 1:5, 'linear')); -***** assert (iradon (ones (5), 1:5, 'spline')); -***** assert (iradon (ones (5), 1:5, 'pchip')); -***** assert (iradon (ones (5), 1:5, 'linear', 'None')); -***** assert (iradon (ones (5), 1:5, 'linear', 'Ram-Lak')); -***** assert (iradon (ones (5), 1:5, 'linear', 'Shepp-Logan')); -***** assert (iradon (ones (5), 1:5, 'linear', 'Cosine')); -***** assert (iradon (ones (5), 1:5, 'linear', 'Hamming')); -***** assert (iradon (ones (5), 1:5, 'linear', 'Hann')); -***** assert (iradon (ones (5), 1:5, 'linear', 'None', 0.45)); -***** assert (iradon (ones (5), 1:5, 'linear', 'None', 0.45, 5)); + R=[[B4,[B2,B2;B2,B2]]; [[B2,B2;B2,B2],B4]]; + assert(full(qtdecomp(A,10,2)), R); + + assert(full(qtdecomp(A,100,[2, 4])), [B4,B4;B4,B4]); ***** test - [R, F] = iradon (ones (5), 1:5); - assert(isvector(F)); - assert(ismatrix(R)); -***** error iradon (); -***** error iradon ('xxx'); -***** error iradon (ones (2), 'xxx'); -***** error iradon (ones (5), 1:5, 'foo'); -***** error iradon (ones (5), 1:5, 'linear', 'foo'); -***** error iradon (ones (5), 1:5, 'linear', 'none', 'foo'); -***** error iradon (ones (5), 1:5, 'linear', 'none', 0.65, 'foo'); + f = @(A, c1 = 54, c2 = 0, c3 = 0) (A (1, 1, :) != ((c1+c2+c3) * ones (1, 1, size (A, 3))))(:); + + assert(full(qtdecomp(A,f)),[ones(4),B4;ones(4,8)]); + assert(full(qtdecomp(A,f,54)),[ones(4),B4;ones(4,8)]); + assert(full(qtdecomp(A,f,4,40,10)),[ones(4),B4;ones(4,8)]); ***** test - A = iradon([0; 1; 1; 0], 90); - A_matlab = 0.4671 .* ones (2); - assert (A, A_matlab, 0.02); # as Matlab compatible as iradon outputs currently get +***** # no params + first_eq=inline("(A(1,1,:)!=(54*ones(1,1,size(A,3))))(:)","A"); + assert(full(qtdecomp(A,first_eq)),[ones(4),B4;ones(4,8)]); ***** test - A = iradon (radon (ones (2, 2), 0:5), 0:5, "nearest", "none"); - A_matlab = [1, 1, 1, 1]' * [0.4264, 2.7859, 2.7152, 0.3557]; - assert (A, A_matlab, 0.0001); +***** # 1 param + first_eq=inline("(A(1,1,:)!=(c*ones(1,1,size(A,3))))(:)","A","c"); + assert(full(qtdecomp(A,first_eq,54)),[ones(4),B4;ones(4,8)]); ***** test - P = phantom (128); - R = radon (P, 0:179); - - IR = iradon (R, 0:179, [], [], [], 128); # (errors in Matlab because of []s) - D = P - IR; - maxdiff = max (abs (D(:))); - maxdiff_matlab = 0.3601; - assert (maxdiff, maxdiff_matlab, 0.002); - meandiff = mean (abs (D(:))); - meandiff_matlab = 0.0218; - assert (meandiff, meandiff_matlab, 0.001); - - filtername = "None"; - IR = iradon (R, 0:179, [], filtername, [], 128); - D = P - IR; - maxdiff = max (abs (D(:))); - maxdiff_matlab = 36.5671; - assert (maxdiff, maxdiff_matlab, 0.0001); - meandiff = mean (abs (D(:))); - meandiff_matlab = 24.6302; - assert (meandiff, meandiff_matlab, 0.0001); - - filtername = "Ram-Lak"; # is same as default - IR = iradon (R, 0:179, [], filtername, [], 128); - D = P - IR; - maxdiff = max (abs (D(:))); - maxdiff_matlab = 0.3601; - assert (maxdiff, maxdiff_matlab, 0.002); - meandiff = mean (abs (D(:))); - meandiff_matlab = 0.0218; - assert (meandiff, meandiff_matlab, 0.001); - - filtername = "Hamming"; - IR = iradon (R, 0:179, [], filtername, [], 128); - D = P - IR; - maxdiff = max (abs (D(:))); - maxdiff_matlab = 0.5171; - assert (maxdiff, maxdiff_matlab, 0.005); - meandiff = mean (abs (D(:))); - meandiff_matlab = 0.0278; - assert (meandiff, meandiff_matlab, 0.003); - - filtername = "Shepp-Logan"; - IR = iradon (R, 0:179, [], filtername, [], 128); - D = P - IR; - maxdiff = max (abs (D(:))); - maxdiff_matlab = 0.3941; - assert (maxdiff, maxdiff_matlab, 0.005); - meandiff = mean (abs (D(:))); - meandiff_matlab = 0.0226; - assert (meandiff, meandiff_matlab, 0.0015); - - filtername = "Cosine"; - IR = iradon (R, 0:179, [], filtername, [], 128); - D = P - IR; - maxdiff = max (abs (D(:))); - maxdiff_matlab = 0.4681; - assert (maxdiff, maxdiff_matlab, 0.005); - meandiff = mean (abs (D(:))); - meandiff_matlab = 0.0249; - assert (meandiff, meandiff_matlab, 0.002); - - filtername = "Hann"; - IR = iradon (R, 0:179, [], filtername, [], 128); - D = P - IR; - maxdiff = max (abs (D(:))); - maxdiff_matlab = 0.5334; - assert (maxdiff, maxdiff_matlab, 0.005); - meandiff = mean (abs (D(:))); - meandiff_matlab = 0.0285; - assert (meandiff, meandiff_matlab, 0.0025); -***** demo - P = phantom (); - figure, imshow (P, []), title ("Original image") - projections = radon (P, 0:179); - reconstruction = iradon (projections, 0:179, 'Spline', 'Hann'); - figure, imshow (reconstruction, []), title ("Reconstructed image") -35 tests, 35 passed, 0 known failure, 0 skipped -[inst/hough.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/hough.m -***** shared BW0, BW1, BW2, BWx, BWy - - BW0 = false (5); - BW0(2,2) = true; - - BW1 = zeros (100, 100); - BW1(1,1) = 1; - BW1(100,100) = 1; - BW1(1,100) = 1; - BW1(100, 1) = 1; - BW1(50,50) = 1; +***** # 3 params + first_eq=inline("(A(1,1,:)!=((c1+c2+c3)*ones(1,1,size(A,3))))(:)","A","c1","c2","c3"); + assert(full(qtdecomp(A,first_eq,4,40,10)),[ones(4),B4;ones(4,8)]); +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/cp2tform.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/cp2tform.m +***** function [crw, cap] = coords (npt = 1000, scale = 2, dtheta = pi/3, + dx = 2, dy = -6, sig2noise = 1e32) + theta = (rand(npt, 1)*2-1)*2*pi; + R = rand(npt,1); + y = R.*sin(theta); + x = R.*cos(theta); + crw = [y x]; - n = 100; - BW2 = false (n); - a = 50; # line starts at left side at row a - b = 3; # slope of line is 1:b - for column = 1:n - if (rem (column, b) == 0) - row = a - column/b; - BW2(row, column) = true; - endif - endfor + thetap = theta + dtheta; + Rap = R * scale; - BWx = false (10); - BWx(:,5) = true; + yap = Rap.*sin(thetap); + yap = yap + dy; + yap = yap + rand (size (yap)) * norm (yap) / sig2noise; - BWy = false (10); - BWy(5,:) = true; -***** test - [H, T, R] = hough (BW1); - assert (size (H), [283 180]); -***** test - [H, T, R] = hough (BW1, "Theta", [-90 0 45 79]); - assert (size (H), [283 4]); -***** test - [H, T, R] = hough (BW1, "ThetaResolution", 0.5); - assert (size (H), [283 360]); -***** error hough ("foo") -***** test - I = [0 0 1 0; 1 1 1 1; 0 0 1 1; 0 0 1 0]; - I2 = I; - for v = [0.7 0.2 5] - I2(1,3) = v; - assert (hough (I2), hough (I)) - endfor -***** error - [H, T, R] = hough (BW0, "Theta"); -***** error - [H, T, R] = hough (BW0, "Theta", ones (10)); -***** error - [H, T, R] = hough (BW0, "Theta", [5 -i 7]); -***** error - [H, T, R] = hough (BW0, "RhoResolution", 0.5); -***** test - [Hd, Td, Rd] = hough (BW0); - [H1, T1, R1] = hough (BW0, "RhoResolution", 1); - assert (Hd, H1) - assert (Td, T1) - assert (Rd, R1) -***** test - [H, theta, rho] = hough (BW2); - H_max = max (H(:)); - H_size = size (H); - [~, max_idx_lin] = max (H(:)); - [max_row, max_column] = ind2sub (size (H), max_idx_lin); - theta_max = theta(max_column); - rho_max = rho(max_row); - assert (H_max , 33); - assert (H_size, [283 180]); - assert (max_row, 188); - assert (max_column, 163); - assert (theta_max, 72); - assert (rho_max, 46); -***** test - [H, theta, rho] = hough (BW2, "Theta", [65:1:75]); - H_max = max (H(:)); - H_size = size (H); - [~, max_idx_lin] = max (H(:)); - [max_row, max_column] = ind2sub (size (H), max_idx_lin); - theta_max = theta(max_column); - rho_max = rho(max_row); - assert (H_max , 33); - assert (H_size, [283 11]); - assert (max_row, 188); - assert (max_column, 8); - assert (theta_max, 72); - assert (rho_max, 46); -***** test - [H, theta, rho] = hough (BW2, "Theta", [-90:0.5:89.5]); - H_max = max (H(:)); - H_size = size (H); - [~, max_idx_lin] = max (H(:)); - [max_row, max_column] = ind2sub (size (H), max_idx_lin); - theta_max = theta(max_column); - rho_max = rho(max_row); - assert (H_max , 33); - assert (H_size, [283 360]); - assert (max_row, 188); - assert (max_column, 324); - assert (theta_max, 71.5); - assert (rho_max, 46); + xap = Rap.*cos(thetap); + xap = xap + dx; + xap = xap + rand (size (xap)) * norm (xap) / sig2noise; + cap = [yap xap]; +***** endfunction ***** test - [H, theta, rho] = hough (BW2, "ThetaResolution", 0.5); - H_max = max (H(:)); - H_size = size (H); - [~, max_idx_lin] = max (H(:)); - [max_row, max_column] = ind2sub (size (H), max_idx_lin); - theta_max = theta(max_column); - rho_max = rho(max_row); - assert (H_max , 33); - assert (H_size, [283 360]); - assert (max_row, 188); - assert (max_column, 324); - assert (theta_max, 71.5); - assert (rho_max, 46); + npt = 100000; + [crw, cap] = coords (npt); + ttype = 'projective'; + T = cp2tform (crw, cap, ttype); + crw2 = tforminv (T, cap); + finalerr = norm (crw - crw2)/npt; + assert (finalerr < 2*eps, "norm = %3.2e ( > 2*eps)", finalerr) ***** test - [H, theta, rho] = hough (BWx); - H_max = max (H(:)); - [~, max_idx_lin] = max (H(:)); - [max_row, max_column] = ind2sub (size (H), max_idx_lin); - theta_max = theta(max_column); - rho_max = rho(max_row); - assert (H_max , 10); - assert (max_column, 88); - assert (theta_max, -3); - assert (rho_max, 4); + npt = 100000; + [crw, cap] = coords (npt); + ttype = 'affine'; + T = cp2tform (crw, cap, ttype); + crw2 = tforminv (T, cap); + finalerr = norm (crw - crw2)/npt; + assert (finalerr < 2*eps, "norm = %3.2e ( > 2*eps)", finalerr) +***** xtest + npt = 100000; + [crw, cap] = coords (npt); + ttype = 'nonreflective similarity'; + T = cp2tform (crw, cap, ttype); + crw2 = tforminv (T, cap); + finalerr = norm (crw - crw2)/npt; + assert (finalerr < 3*eps, "norm = %3.2e ( > 3*eps)", finalerr) ***** test - [H, theta, rho] = hough (BWx); - H_size = size (H); - [~, max_idx_lin] = max (H(:)); - [max_row, max_column] = ind2sub (size (H), max_idx_lin); - assert (H_size, [27 180]); - assert (max_row, 18); + npt = 100000; + [crw, cap] = coords (npt); + cap(:,2) *= -1; % reflection around y axis + ttype = 'similarity'; + T = cp2tform (crw, cap, ttype); + crw2 = tforminv (T, cap); + finalerr = norm (crw - crw2)/npt; + assert (finalerr < 3*eps, "norm = %3.2e ( > 3*eps)", finalerr) +***** xtest + npt = 100000; + [crw, cap] = coords (npt); + ttype = 'polynomial'; + ord = 2; + T = cp2tform (crw, cap, ttype, ord); + crw2 = tforminv (T, cap); + finalerr = norm (crw - crw2)/npt; + assert (finalerr < eps, "norm = %3.2e ( > eps)", finalerr) +***** xtest + npt = 100000; + [crw, cap] = coords (npt); + ttype = 'polynomial'; + ord = 3; + T = cp2tform (crw, cap, ttype, ord); + crw2 = tforminv (T, cap); + finalerr = norm (crw - crw2)/npt; + assert (finalerr < eps, "norm = %3.2e ( > eps)", finalerr) +***** xtest + npt = 100000; + [crw, cap] = coords (npt); + ttype = 'polynomial'; + ord = 4; + T = cp2tform (crw, cap, ttype, ord); + crw2 = tforminv (T, cap); + finalerr = norm (crw - crw2)/npt; + assert (finalerr < 6*eps, "norm = %3.2e ( > 6*eps)", finalerr) +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/imquantize.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imquantize.m +***** error + imquantize (rand (5), [3 4 2 5]) +***** error + imquantize (rand (5), [1 2 3], "foo") +***** error + imquantize (rand (5), [1 2 3 4], 1:6) +***** error + imquantize (rand (5), [1 2 3 4], 1:2) ***** test - [H, theta, rho] = hough (BWy); - H_max = max (H(:)); - [~, max_idx_lin] = max (H(:)); - [max_row, max_column] = ind2sub (size (H), max_idx_lin); - theta_max = theta(max_column); - rho_max = rho(max_row); - assert (H_max , 10); - assert (max_column, 1); - assert (theta_max, -90); - assert (rho_max, -4); + img = [-inf 0 10000000; -100000 -3 1/1000000; 5 5 10]; + [q, q_idx] = imquantize (img, 5); + assert (q, [1 1 2; 1 1 1; 1 1 2]) + assert (q_idx, q) ***** test - [H, theta, rho] = hough (BWy); - H_size = size (H); - [~, max_idx_lin] = max (H(:)); - [max_row, max_column] = ind2sub (size (H), max_idx_lin); - assert (H_size, [27 180]); - assert (max_row, 10); -***** demo - BW = zeros (100, 150); - BW(30,:) = 1; - BW(:, 65) = 1; - BW(35:45, 35:50) = 1; - for i = 1:90 - BW(i,i) = 1; - endfor - BW = imnoise (BW, "salt & pepper"); - figure (); - imshow (BW); - title ("BW"); - [H, theta, rho] = hough (BW); - H /= max (H(:)); - figure (); - imshow (H, "XData", theta, "YData", rho); - title ("hough transform of BW"); - axis on; - xlabel ("angle \\theta [degrees]"); - ylabel ("distance \\rho to origin [pixels]"); -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/impixel.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/impixel.m -***** shared img2d, img3d - img2d = uint8 (magic (10)); - img3d(:,:,1) = img2d; - img3d(:,:,2) = img2d + 1; - img3d(:,:,3) = img2d + 2; - img3d = uint8 (img3d); + img = [1:10; 11:20; 21:30; 31:40; 41:50; 51:60; 61:70]; -***** assert (impixel (img2d, 2, 2), single ([80 80 80])); -***** assert (impixel (img2d, -2, 2), single ([NA NA NA])); + expected_q = [ + 0 0 0 0 0 1 1 1 1 1 + 1 1 1 1 1 5 5 5 5 5 + 5 5 5 5 5 10 10 10 10 10 + 20 20 20 20 20 20 20 20 20 20 + 30 30 30 30 30 30 30 30 30 30 + 30 30 30 30 30 30 30 30 30 30 + 15 15 15 15 15 15 15 15 15 15]; -***** assert (impixel (img2d, [1 10], [1 10]), single ([92 92 92; 59 59 59])); -***** assert (impixel (img3d, [1 10], [1 10]), single ([92 93 94; 59 60 61])); -***** assert (impixel (double (img2d), [1 10], [1 10]), [92 92 92; 59 59 59]); + expected_q_idx = [ + 1 1 1 1 1 2 2 2 2 2 + 2 2 2 2 2 3 3 3 3 3 + 3 3 3 3 3 4 4 4 4 4 + 5 5 5 5 5 5 5 5 5 5 + 6 6 6 6 6 6 6 6 6 6 + 6 6 6 6 6 6 6 6 6 6 + 7 7 7 7 7 7 7 7 7 7]; -***** assert (impixel ([1 10], [1 10], img2d, [1 10], [1 10]), single ([92 92 92; 59 59 59])); -***** assert (impixel ([3 12], [-4 12], img2d, [1 10], [1 10]), single ([NA NA NA; 44 44 44])); -***** assert (impixel ([3 5], [-4 3], img2d, [1 10], [1 10]), single ([NA NA NA; NA NA NA])); + [q, q_idx] = imquantize (img, [5 15 25 30 40 60], [0 1 5 10 20 30 15]); + assert (q, expected_q) + assert (q_idx, expected_q_idx) - ## the following returns double because it's an indexed image -***** assert (impixel ([3 12], [-4 12], img2d, gray (100), [1 10], [1 10]), [NA NA NA; 4/9 4/9 4/9]); -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/imhmin.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imhmin.m -***** shared im0, im0_h2_out - im0 = uint8 ([5 5 5 5 5; - 5 4 3 4 5; - 5 3 0 3 5; - 5 4 3 4 5; - 5 5 5 5 5]); - im0_h2_out = uint8 ([5 5 5 5 5; - 5 4 3 4 5; - 5 3 2 3 5; - 5 4 3 4 5; - 5 5 5 5 5]); -***** error imhmin () -***** error imhmin (im0) -***** error imhmin ("hello", 2) -***** error imhmin (i.*im0, 2) -***** error imhmin (sparse (im0), 2) -***** error imhmin (im0, -2) -***** error imhmin (im0, 'a') -***** error imhmin (im0, ones (2)) -***** error imhmin (im0, 2*i) -***** assert (imhmin (im0, 2), im0_h2_out) -***** assert (imhmin (double (im0), 2), double (im0_h2_out)) -***** assert (imhmin (im0, 2, 8), im0_h2_out) -***** assert (imhmin (im0, 2, 4), im0_h2_out) -***** assert (imhmin (im0, 2, true (3)), im0_h2_out) -***** test - out = imhmin (double (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "double") -***** test - out = imhmin (single (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "single") -***** test - out = imhmin (uint8 (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "uint8") -***** test - out = imhmin (uint16 (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "uint16") -***** test - im = cat (3, im0, im0, im0, im0); - out = imhmin (im, 2); - assert (size (out), size (im)) -***** test - im = 10 .* ones (10); - im(2:4, 2:4) = 7; - im(6:8, 6:8) = 2; - expected_4 = 10 .* ones (10); - expected_4(6:8, 6:8) = 6; - expected_2 = 10 .* ones (10); - expected_2(6:8, 6:8) = 4; - expected_2(2:4, 2:4) = 9; - out = imhmin (im, 4); - assert (out, expected_4, eps) - out = imhmin (im, 2); - assert (out, expected_2, eps) - out = imhmin (0.1.*im, 0.4); - assert (out, 0.1 .* expected_4, eps) + [q, q_idx] = imquantize (single (img), [5 15 25 30 40 60], + [0 1 5 10 20 30 15]); + assert (q, expected_q) + assert (q_idx, expected_q_idx) + + [q, q_idx] = imquantize (uint8 (img), [5 15 25 30 40 60], + [0 1 5 10 20 30 15]); + assert (q, expected_q) + assert (q_idx, expected_q_idx) + + [q, q_idx] = imquantize (uint8 (img), uint8 ([5 15 25 30 40 60]), + [0 1 5 10 20 30 15]); + assert (q, expected_q) + assert (q_idx, expected_q_idx) + + [q, q_idx] = imquantize (uint8 (img), uint8 ([5 15 25 30 40 60]), + uint8 ([0 1 5 10 20 30 15])); + assert (q, uint8 (expected_q)) + assert (q_idx, expected_q_idx) ***** test - im2 = 10 .* ones (10); - im2(2:4, 2:4) = 7; - im2(6:9, 6:9)=2; - im2(5, 5)=2; - im2(6, 7)=10; - im2(7, 8)=10; - expected_4 = 10 .* ones (10); - expected_4(6:9, 6:9) = 6; - expected_4(5, 5) = 6; - expected_4(6, 7) = 10; - expected_4(7, 8) = 10; - expected_8 = expected_4; - expected_8(2:4, 2:4) = 7; - out2 = imhmin (im2, 4); - assert (out2, expected_8, eps) - out2 = imhmin (im2, 4, 4); - assert (out2, expected_4, eps) - out2 = imhmin (im2, 4, 8); - assert (out2, expected_8, eps) -21 tests, 21 passed, 0 known failure, 0 skipped -[inst/fftconv2.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/fftconv2.m -***** xtest - a = repmat (1:10, 5); - b = repmat (10:-1:3, 7); - assert (fftconv2 (a, b), conv2 (a, b), 1.8e4*eps) - assert (fftconv2 (b, a), conv2 (b, a), 1.8e4*eps) - assert (fftconv2 (a, b, "full"), conv2 (a, b, "full"), 1.8e4*eps) - assert (fftconv2 (b, a, "full"), conv2 (b, a, "full"), 1.8e4*eps) - assert (fftconv2 (a, b, "same"), conv2 (a, b, "same"), 1.8e4*eps) - assert (fftconv2 (b, a, "same"), conv2 (b, a, "same"), 1.8e4*eps) - assert (isempty (fftconv2 (a, b, "valid"))); - assert (fftconv2 (b, a, "valid"), conv2 (b, a, "valid"), 1e4*eps) + img = randi ([0 255], 10, "uint8"); + [q, q_idx] = imquantize (img, [50 100 150 200]); + assert (class (q), "double") + assert (class (q_idx), "double") + + [q, q_idx] = imquantize (img, [50 100 150 200], uint16 ([5 7 8 9 2])); + assert (class (q), "uint16") + assert (class (q_idx), "double") + + [q, q_idx] = imquantize (img, [50 100 150 200], uint8 ([5 7 8 9 2])); + assert (class (q), "uint8") + assert (class (q_idx), "double") ***** test - x = 1:4; - y = 4:-1:1; - a = repmat(1:10, 5); - assert (fftconv2 (x, y, a), conv2 (x, y, a), 1e4*eps) - assert (fftconv2 (x, y, a, "full"), conv2 (x, y, a, "full"), 1e4*eps) - assert (fftconv2 (x, y, a, "same"), conv2 (x, y, a, "same"), 1e4*eps) - assert (fftconv2 (x, y, a, "valid"), conv2 (x, y, a, "valid"), 1e4*eps) -***** demo - ## Draw a cross - z = zeros (101, 101); - z(50, :) = 1; - z(:, 50) = 1; - subplot (1, 3, 1) - imshow (z); - title ("Original thin cross") + img = [1:10; 11:20; 21:30; 31:40; 41:50; 51:60; 61:70].'; + r_idx = reshape (randperm (numel (img)), size (img)); - ## Draw a sinc blob - b = getheight (strel ("ball", 10, 1)); - subplot (1, 3, 2) - imshow (b); - title ("Sync blob") + [quant, quant_idx] = imquantize (img, [5 15 25 30 40 60]); + [quant_r, quant_r_idx] = imquantize (img(r_idx), [5 15 25 30 40 60]); - ## Convolve the cross with the blob - fc = real (fftconv2 (z, b, "same")); - subplot (1, 3, 3) - imshow (fc, [min(fc(:)) max(fc(:))]) - title ("Convolution in the frequency domain") -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/axes2pix.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/axes2pix.m -***** error id=Octave:invalid-fun-call axes2pix () -***** error id=Octave:invalid-fun-call axes2pix (42) -***** error id=Octave:invalid-fun-call axes2pix (42, [1, 2]) -***** error id=Octave:invalid-input-arg axes2pix ([42, 43], [1, 2], [1, 2, 3]) -***** error id=Octave:invalid-input-arg axes2pix (42, [1, 2; 3, 4], [1, 2, 3]) -***** assert (axes2pix (42, [1 42], []), []) -***** assert (axes2pix (240, [1, 240], 30), 30) -***** assert (axes2pix (291, [1, 291], 30), 30) -***** assert (axes2pix (240, [400.5, 520], 450), 100) -***** assert (axes2pix (291, [-19, 271], 90), 110) -***** assert (axes2pix (1, [1 1], [0, 1, 2, 3, 4]), [0, 1, 2, 3, 4]) -***** assert (axes2pix (5, [1 1], [0, 1, 2, 3, 4]), [0, 1, 2, 3, 4]) -***** assert (axes2pix (0, [1 1], [0, 1, 2, 3, 4]), [0, 1, 2, 3, 4]) -***** assert (axes2pix (5, [5 1], [1, 2, 3, 4, 5]), [5, 4, 3, 2, 1]) -***** assert (axes2pix (5, [3 -1], [1, 2, 3, 4, 5]), [3, 2, 1, 0, -1]) -***** assert (axes2pix (25, [5 1], [1, 2, 3, 4, 5]), [25, 19, 13, 7, 1]) -***** assert (axes2pix (1, [1 5], [1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]) -***** assert (axes2pix (1, [5 1], [-1, 0, 1, 2.5]), [-5, -4, -3, -1.5]) -***** assert (axes2pix (1, [-10 -15], [-1, 0, 1.5]), [10, 11, 12.5]) -***** assert (axes2pix (5, [5; 1], [1, 2, 3, 4, 5]), [5, 4, 3, 2, 1]) -***** assert (axes2pix (5, [5; 1], [1; 2; 3; 4; 5]), [5; 4; 3; 2; 1]) -21 tests, 21 passed, 0 known failure, 0 skipped -[inst/integralImage3.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/integralImage3.m + assert (imquantize (img(r_idx), [5 15 25 30 40 60]), quant(r_idx)) + assert (quant_r, quant_r_idx) +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/mean2.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/mean2.m ***** test - assert (integralImage3 (zeros (4)), zeros (5, 5, 2)); + ## This throws a division by zero warning which Matlab does not, but + ## that's because Matlab does not throw such warnings in the first + ## place. Octave does, so we do not turn the warning off. + warning ("off", "Octave:divide-by-zero", "local"); + assert (mean2 ([]), NaN) +***** assert (mean2 (logical ([1 1; 0 0])), 0.5) +***** assert (mean2 (ones (3, 3, 3)), 1) +***** assert (mean2 (i), i) +***** assert (mean2 ([1 i]), [0.5+0.5i]) +***** assert (mean2 (speye (3)), sparse (1/3)) +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/integralImage.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/integralImage.m ***** test - J_res = zeros (2, 2, 2); - J_res(2, 2, 2) = 10; - assert (integralImage3 (10), J_res); + assert (integralImage (10), [0 0; 0 10]); + assert (integralImage (10, "rotated"), [0 0 0; 0 10 0]); ***** test - J = integralImage3 (10); - assert (class (J), "double"); - J = integralImage3 (uint8 (10)); - assert (class (J), "double"); + J = integralImage (10); + assert (class(J), "double"); + J = integralImage (uint8(10)); + assert (class(J), "double"); ***** test I = [1, 2; 3, 4]; - J = integralImage3 (I); - J_res = zeros (3, 3, 2); - J_res(2:3, 2:3, 2) = [1 3; 4 10]; - assert (J, J_res) + J = integralImage (I); + J1 = [0 0 0; 0 1 3; 0 4 10]; + assert (J, J1) + J = integralImage (I, "rotated"); + J1 = [0 0 0 0; 0 1 2 0; 1 6 7 2]; + assert (J, J1) ***** test I1 = [1, 2; 3, 4]; I2 = [5, 6; 7, 8]; I3 = [9, 10; 11, 12]; I = cat (3, I1, I2, I3); - J = integralImage3 (I); - J2 = [0 0 0; 0 1 3; 0 4 10]; - J3 = [0 0 0; 0 6 14; 0 16 36]; - J4 = [0 0 0; 0 15 33; 0 36 78]; - J_res = cat (3, zeros (3), J2, J3, J4); - assert (J, J_res) + J = integralImage (I); + J1 = [0 0 0; 0 1 3; 0 4 10]; + J2 = [0 0 0; 0 5 11; 0 12 26]; + J3 = [0 0 0; 0 9 19; 0 20 42]; + J0 = cat (3, J1, J2, J3); + assert (J, J0) +***** test + I1 = [1, 2; 3, 4]; + I2 = [5, 6; 7, 8]; + I3 = [9, 10; 11, 12]; + I = cat (3, I1, I2, I3); + J = integralImage (I, "rotated"); + J1 = [0 0 0 0; 0 1 2 0; 1 6 7 2]; + J2 = [0 0 0 0; 0 5 6 0; 5 18 19 6]; + J3 = [0 0 0 0; 0 9 10 0; 9 30 31 10]; + J0 = cat (3, J1, J2, J3); + assert (J, J0) ***** test I = magic (5); - J = integralImage3 (I); - J_res = zeros (6, 6, 2); - J_res(:, :, 2) = [0 0 0 0 0 0; - 0 17 41 42 50 65; - 0 40 69 77 99 130; - 0 44 79 100 142 195; - 0 54 101 141 204 260; - 0 65 130 195 260 325]; + J = integralImage (I); + J_res = [0 0 0 0 0 0; + 0 17 41 42 50 65; + 0 40 69 77 99 130; + 0 44 79 100 142 195; + 0 54 101 141 204 260; + 0 65 130 195 260 325]; assert (J, J_res) -***** # test of 3d input image: -***** test - K = magic (8); - K = reshape (K, [4 4 4]); - L = integralImage3 (K); - L1_ML = zeros (5); - L2_ML = [0 0 0 0 0; - 0 64 96 98 132; - 0 73 146 203 260; - 0 90 212 316 388; - 0 130 260 390 520]; - L3_ML = [0 0 0 0 0; - 0 67 134 197 260; - 0 130 260 390 520; - 0 193 386 583 780; - 0 260 520 780 1040]; - L4_ML = [0 0 0 0 0; - 0 127 222 291 392; - 0 203 406 593 780; - 0 287 606 903 1168; - 0 390 780 1170 1560]; - L5_ML = [0 0 0 0 0; - 0 134 268 394 520; - 0 260 520 780 1040; - 0 386 772 1166 1560; - 0 520 1040 1560 2080]; - L_ML = cat (3, L1_ML, L2_ML, L3_ML, L4_ML, L5_ML); - assert (L, L_ML) -***** # test of 2d input image: -***** test - X = ones (3); - Y = integralImage3 (X); - Y_ML = zeros (4, 4, 2); - Y_ML(:, :, 2) = [0 0 0 0; 0 1 2 3; 0 2 4 6; 0 3 6 9]; - assert(Y, Y_ML); -***** error id=Octave:invalid-fun-call - integralImage3 (); -***** error id=Octave:invalid-fun-call - integralImage3 (zeros (3), zeros (3)); -***** error - integralImage3 ("abcd"); -***** error - integralImage3 (1+i); -***** error - integralImage3 (reshape (1:81, 3, 3, 3, 3)); -13 tests, 13 passed, 0 known failure, 0 skipped + + J = integralImage (I, "rotated"); + J_res_R = [0 0 0 0 0 0 0; + 0 17 24 1 8 15 0; + 17 64 47 40 38 39 15; + 64 74 91 104 105 76 39; + 74 105 149 188 183 130 76; + 105 170 232 272 236 195 130]; + assert (J, J_res_R) +***** error + integralImage (); +***** error + integralImage (1, "xxx", 2); +***** error + integralImage ("abcd"); +***** error + integralImage ([1 2; 3 4], "xxx"); +10 tests, 10 passed, 0 known failure, 0 skipped [inst/imboxfilt.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/imboxfilt.m ***** assert (imboxfilt(ones (5) * 9)); @@ -4412,71 +3489,397 @@ assert (sum (out(6,:)), 1/3, eps); assert (sum (out(:,6)), 1/7, eps); 84 tests, 84 passed, 0 known failure, 0 skipped -[inst/imextendedmin.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imextendedmin.m +[inst/rangefilt.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/rangefilt.m +***** test + im = rangefilt (ones (5)); + assert (im, zeros (5)); +***** test + A = zeros (3,3); + B = ones (3,3); + C = [1 1 1; 2 2 2; 3 3 3]; + D = C'; + E = ones (3,3); + E(2,2) = 2; + F = 3 .* ones (3,3); + F(2,2) = 1; + G = [-1 2 7; -5 2 8; -7 pi 9]; + H = [5 2 8; 1 -3 1; 5 1 0]; + A_out = [0 0 0; 0 0 0; 0 0 0]; + B_out = [0 0 0; 0 0 0; 0 0 0]; + C_out = [1 1 1; 2 2 2; 1 1 1]; + D_out = [1 2 1; 1 2 1; 1 2 1]; + E_out = [1 1 1; 1 1 1; 1 1 1]; + F_out = [2 2 2; 2 2 2; 2 2 2]; + G_out = [7 13 6; 7+pi 16 7; 7+pi 16 7]; + H_out = [8 11 11; 8 11 11; 8 8 4]; + assert (rangefilt (A), A_out) + assert (rangefilt (B), B_out) + assert (rangefilt (C), C_out) + assert (rangefilt (D), D_out) + assert (rangefilt (E), E_out) + assert (rangefilt (F), F_out) + assert (rangefilt (G), G_out, eps) + assert (rangefilt (H), H_out) +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/rgb2xyz.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/rgb2xyz.m +***** assert (rgb2xyz ([0 0 0]), [0, 0, 0], 1e-3) +***** assert (rgb2xyz ([1 0 0]), [0.4125, 0.2127, 0.0193], 1e-3) +***** assert (rgb2xyz ([1 1 0]), [0.7700, 0.9278, 0.1385], 1e-3) +***** assert (rgb2xyz ([0 1 0]), [0.3576, 0.7152, 0.1192], 1e-3) +***** assert (rgb2xyz ([0 1 1]), [0.5380, 0.7873, 1.0694], 1e-3) +***** assert (rgb2xyz ([0 0 1]), [0.1804, 0.0722, 0.9502], 1e-3) +***** assert (rgb2xyz ([1 0 1]), [0.5929, 0.2848, 0.9696], 1e-3) +***** assert (rgb2xyz ([1 1 1]), [0.9505, 1.0000, 1.0888], 1e-3) +***** assert (rgb2xyz ([0.5 0.5 0.5]), [0.2034, 0.2140, 0.2330], 1e-3) +***** assert (rgb2xyz ([0.75 0 0]), [0.2155, 0.1111, 0.0101], 1e-3) +***** assert (rgb2xyz ([0.5 0 0]), [0.0883, 0.0455, 0.0041], 1e-3) +***** assert (rgb2xyz ([0.25 0 0]), [0.0210, 0.0108, 0.0010], 1e-3) +***** assert (rgb2xyz ([1 0.5 0.5]), [0.5276, 0.3812, 0.2482], 1e-3) +***** assert (rgb2xyz ([1.5 1 1]), [1.5845, 1.3269, 1.1185], 1e-3) +***** test + rgb_map = rand (64, 3); + assert (xyz2rgb (rgb2xyz (rgb_map)), rgb_map, 2e-5); +***** test + rgb_img = rand (64, 64, 3); + assert (xyz2rgb (rgb2xyz (rgb_img)), rgb_img, 2e-5); +***** assert (rgb2xyz (sparse ([0 0 0])), [0 0 0], 1e-3) +***** assert (rgb2xyz (sparse ([0 0 1])), [0.1804, 0.0722, 0.9502], 1e-3) +***** assert (rgb2xyz (uint8([255 255 255])), [0.9505, 1.0000, 1.0888], 1e-3) +***** assert (class (rgb2xyz (single([1 1 1]))), 'single') +***** error rgb2xyz () +***** error rgb2xyz (1,2) +***** error rgb2xyz ({1}) +***** error rgb2xyz (ones (2,2)) +***** test + rgb = rand (16, 16, 3, 5); + xyz = zeros (size (rgb)); + for i = 1:5 + xyz(:,:,:,i) = rgb2xyz (rgb(:,:,:,i)); + endfor + assert (rgb2xyz (rgb), xyz) +25 tests, 25 passed, 0 known failure, 0 skipped +[inst/imadjust.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imadjust.m +***** error imadjust ("bad argument"); +***** error imadjust ([1:100], "bad argument", [], 1); +***** error <2 row column per plane> imadjust ([1:100], [0 1 1], [], 1); +***** error <2 row column per plane> imadjust ([1:100], [], [0 1 1], 1); +***** error imadjust ([1:100], [], [], [0; 1]); +***** error imadjust (rand (5, 5, 3), [], [], [0 1]); +***** error imadjust ([1:100], [0; 1], [], -1); +***** error imadjust ([1:100], [0; 5], []); +***** error imadjust ([1:100], [-2; 1], []); +***** error imadjust ([1:100], [], [0; 4]); +***** error imadjust ([1:100], [], [-2; 1]); +***** error imadjust (rand (5) > .5); +***** test + im = [0.01:0.01:1]; + assert (imadjust (im), [0 linspace(0, 1, 98) 1], eps) + assert (imadjust (im), imadjust (im, stretchlim (im, 0.01), [0; 1], 1)) + assert (imadjust (im, []), imadjust (im, [0; 1], [0; 1], 1)) + assert (imadjust (im, [], []), imadjust (im, [0; 1], [0; 1], 1)) + assert (imadjust (im, [], [.25 .75]), imadjust (im, [0; 1], [.25; .75], 1)) + assert (imadjust (im, [.25; .75], []), imadjust (im, [.25; .75], [0; 1], 1)) +***** assert (imadjust (linspace (0, 1), [], [.25 .75]), linspace (.25, .75, 100), eps) +***** assert (imadjust (linspace (0, 1, 100),[1/99; 98/99]), + [0 linspace(0, 1, 98) 1], eps) +***** shared cm + cm = [[0:8]' [1:9]' [2:10]'] / 10; +***** assert (imadjust (cm, [0; 1], [0.5; 1]), (cm /2) + .5) +***** assert (imadjust (cm, [0 1], [0.5 1]), (cm /2) + .5) +***** assert (imadjust (cm, [0; 1], [.1 .2 .3; .7 .8 .9]), + (cm*.6) + [.1 .2 .3], eps) +***** assert (imadjust (cm, [.2 .4 .6; .7 .8 .9], [0; 1]), + [[0 0 linspace(0, 1, 6) 1]' ... + [0 0 0 linspace(0, 1, 5) 1]' ... + [0 0 0 0 linspace(0, 1, 4) 1]'], eps) +***** assert (imadjust (cm, [.2 .4 .6; .7 .8 .9], [0 .1 .2; .8 .9 1]), + [[0 0 linspace(0, .8, 6) .8]' ... + [.1 .1 .1 linspace(.1, .9, 5) .9]' ... + [.2 .2 .2 .2 linspace(.2, 1, 4) 1]'], eps) +***** assert (imadjust (cm, [.2 .4 .6; .7 .8 .9], [0 .1 .2; .8 .9 1], [0.5 1 2]), + [[0 0 0 (((([.3 .4 .5 .6]-.2)/.5).^.5)*.8) .8 .8]' ... + [.1 .1 .1 linspace(.1, .9, 5) .9]' ... + [.2 .2 .2 .2 .2 ((((([.7 .8]-.6)/.3).^2).*.8)+.2) 1 1]'], eps*10) +***** test + im = [-0.4:.1:0.8 + 0.0:.1:1.2 + 0.1:.1:1.3 + -0.4:.2:2.0]; + + ## just clipping + assert (imadjust (im, [0; 1], [0; 1]), + [0 0 0 0 (0:.1:.8) + (0:.1:1) 1 1 + (.1:.1:1) 1 1 1 + 0 0 (0:.2:1) 1 1 1 1 1], eps) + + ## clipping and invert + assert (imadjust (im, [0; 1], [1; 0]), + [1 1 1 1 (1:-.1:.2) + (1:-.1:0) 0 0 + (.9:-.1:0) 0 0 0 + 1 1 (1:-.2:0) 0 0 0 0 0], eps) + + ## rescale + assert (imadjust (im, [.2; .7], [.1; .9]), + [1 1 1 1 1 1 1 2.6 4.2 5.8 7.4 9 9 + 1 1 1 2.6 4.2 5.8 7.4 9 9 9 9 9 9 + 1 1 2.6 4.2 5.8 7.4 9 9 9 9 9 9 9 + 1 1 1 1 4.2 7.4 9 9 9 9 9 9 9]/10, eps) + + ## rescale and invert + assert (imadjust (im, [.2; .7], [.9; .1]), + [9 9 9 9 9 9 9 7.4 5.8 4.2 2.6 1 1 + 9 9 9 7.4 5.8 4.2 2.6 1 1 1 1 1 1 + 9 9 7.4 5.8 4.2 2.6 1 1 1 1 1 1 1 + 9 9 9 9 5.8 2.6 1 1 1 1 1 1 1]/10, eps) +***** assert (imadjust (linspace (0, 1), [], [], 2), linspace (0, 1) .^ 2) +***** shared oRGB + oRGB = zeros (10, 1, 3); + oRGB(:,:,1) = [0 linspace(0,1,6) 1 1 1]'; + oRGB(:,:,2) = [0 0 linspace(0,1,6) 1 1]'; + oRGB(:,:,3) = [0 0 0 linspace(0,1,6) 1]'; +***** assert (imadjust (oRGB, [0; 1], [0; 1]), oRGB) +***** assert (imadjust (oRGB, [.2; .8], [0; 1]), + reshape ([[0 0 0 1/3 2/3 1 1 1 1 1]' + [0 0 0 0 1/3 2/3 1 1 1 1]' + [0 0 0 0 0 1/3 2/3 1 1 1]'], [10 1 3]), eps) +***** assert (imadjust (oRGB, [.2; .8], [.1; .9]), + reshape ([[.1 .1 .1 (1/3)+(.1/3) (2/3)-(.1/3) .9 .9 .9 .9 .9]' + [.1 .1 .1 .1 (1/3)+(.1/3) (2/3)-(.1/3) .9 .9 .9 .9]' + [.1 .1 .1 .1 .1 (1/3)+(.1/3) (2/3)-(.1/3) .9 .9 .9]'], + [10 1 3]), eps) +***** assert (imadjust (oRGB, [.2; .8], [.2; .8]), + reshape ([[2 2 2 4 6 8 8 8 8 8]' + [2 2 2 2 4 6 8 8 8 8]' + [2 2 2 2 2 4 6 8 8 8]']/10, [10 1 3]), eps) +***** assert (imadjust (oRGB, [0; 1], [.1 .2 .3; .9 .8 .7]), + reshape ([[1 1 2.6 4.2 5.8 7.4 9 9 9 9]' + [2 2 2 3.2 4.4 5.6 6.8 8 8 8]' + [3 3 3 3 3.8 4.6 5.4 6.2 7 7]']/10, [10 1 3]), eps) +***** assert (imadjust (oRGB, [.1 .2 .3; .9 .8 .7], [0; 1]), + reshape ([[0 0 .125 .375 .625 .875 1 1 1 1]' + [0 0 0 0 1/3 2/3 1 1 1 1]' + [0 0 0 0 0 .25 .75 1 1 1]'], [10 1 3]), eps*10) +***** assert (imadjust (oRGB, [.1 .2 .3; .9 .8 .7], [.2 0 .4; .5 1 .7 ]), + reshape ([[.2 .2 .2375 .3125 .3875 .4625 .5 .5 .5 .5]' + [0 0 0 0 1/3 2/3 1 1 1 1]' + [.4 .4 .4 .4 .4 .475 .625 .7 .7 .7]'], [10 1 3]), eps) +***** test + img = rand (4, 4, 2, 3, 4); + adj = zeros (4, 4, 2, 3, 4); + for p = 1:2 + for q = 1:3 + for r = 1:4 + adj(:,:,p,q,r) = imadjust (img(:,:,p,q,r)); + endfor + endfor + endfor + assert (imadjust (img), adj) +***** test + img = rand (4, 4, 2, 3, 2); + adj = zeros (4, 4, 2, 3, 2); + in = reshape ([ 3 5 7 9 11 13 15 17 19 21 23 25; + 97 95 93 91 89 87 85 83 81 79 77 75] / 100, [2 2 3 2]); + out = reshape ([ 5 7 9 11 14 15 17 19 21 23 25 27; + 95 93 91 89 87 85 83 81 79 77 75 73] / 100, [2 2 3 2]); + gamma = reshape (0.6:.1:1.7, [1 2 3 2]); + for p = 1:2 + for q = 1:3 + for r = 1:2 + adj(:,:,p,q,r) = imadjust (img(:,:,p,q,r), in(:,p,q,r), + out(:,p,q,r), gamma(1,p,q,r)); + endfor + endfor + endfor + assert (imadjust (img, in, out, gamma), adj, eps) +***** test + in = int16 (1:6); + assert (imadjust (in), int16 ([-32768 -19661 -6554 6553 19660 32767])) + assert (imadjust (in, []), in) +***** test + in = uint8([ + 35 1 6 26 19 24 + 3 32 7 21 23 25 + 31 9 2 22 27 20 + 8 28 33 17 10 15 + 30 5 34 12 14 16 + 4 36 29 13 18 11]); + out = uint8([ + 12 0 0 1 0 0 + 0 8 0 0 0 0 + 7 0 0 0 2 0 + 0 3 9 0 0 0 + 6 0 11 0 0 0 + 0 13 4 0 0 0]); + assert (imadjust (in, [.1 .9], [0 1]), out); +***** test + in = uint8([ + 140 4 24 104 76 96 + 12 128 28 84 92 100 + 124 36 8 88 108 80 + 32 112 132 68 40 60 + 120 20 136 48 56 64 + 16 144 116 52 72 44]); + out = uint8([ + 143 0 0 98 63 88 + 0 128 3 73 83 93 + 123 13 0 78 103 68 + 8 108 133 53 18 43 + 118 0 138 28 38 48 + 0 148 113 33 58 23]); + assert (imadjust (in, [.1 .9], [0 1]), out); +***** xtest + in_u8 = randi ([0 255], 5, 5, 2, 3, "uint8"); + in_u16 = randi ([0 65535], 5, 5, 2, 3, "uint16"); + in_i16 = randi ([-32768 32767], 5, 5, 2, 3, "int16"); + in_u8_d = im2double (in_u8); + in_u16_d = im2double (in_u16); + in_i16_d = im2double (in_i16); + lim_u8 = eps + 0.5 / double (intmax ("uint8")); + lim_u16 = eps + 0.5 / double (intmax ("uint16")); + lim_i16 = eps + 0.5 / ( double (intmax("int16")) - double (intmin ("int16")) ); + + ## default values + assert (im2double (imadjust (in_u8)), imadjust (in_u8_d), lim_u8) + assert (im2double( imadjust (in_u16)), imadjust (in_u16_d), lim_u16) + assert (im2double( imadjust (in_i16)), imadjust (in_i16_d), lim_i16) + + ## single adjustment for all planes + args = {[.3; .7], [.1; .9], [1.5]}; + assert (im2double (imadjust (in_u8, args{:})), imadjust (in_u8_d, args{:}), lim_u8) + assert (im2double (imadjust (in_u16, args{:})), imadjust (in_u16_d, args{:}), lim_u16) + assert (im2double (imadjust (in_i16, args{:})), imadjust (in_i16_d, args{:}), lim_i16) + + ## single adjustment for all planes (mixed with some complement) + args = {reshape([.2 .3 .25 .1 0 .1; .9 .7 .85 .9 1 .8], [2 2 3]), + reshape([.1 .2 .05 .9 1 .3; .9 .85 .7 .1 0 .9], [2 2 3]), + reshape([1 .75 1 1.2 1.5 2], [1 2 3])}; + assert (im2double (imadjust (in_u8, args{:})), imadjust (in_u8_d, args{:}), lim_u8) + assert (im2double (imadjust (in_u16, args{:})), imadjust (in_u16_d, args{:}), lim_u16) + assert (im2double (imadjust (in_i16, args{:})), imadjust (in_i16_d, args{:}), lim_i16) + + ## test use of [] as limit and negative + args = {[], [.95; 0], 1.25}; + assert (im2double (imadjust (in_u8, args{:})), imadjust (in_u8_d, args{:}), lim_u8) + assert (im2double (imadjust (in_u16, args{:})), imadjust (in_u16_d, args{:}), lim_u16) + assert (im2double (imadjust (in_i16, args{:})), imadjust (in_i16_d, args{:}), lim_i16) +36 tests, 36 passed, 0 known failure, 0 skipped +[inst/viscircles.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/viscircles.m +***** demo + centers = randi ([0 100], 5, 2); + radii = randi ([10 100], 5, 1); + axis equal + viscircles (centers, radii, + "Color", "magenta", + "LineStyle", ":", + "LineWidth", 5); + title ("5 random circles"); + #---------------------------------------------- + # the figure window shows 5 circles with random + # radii and positions +***** test # old undocumented property + h = viscircles ([0 0], 1, "EdgeColor", "black"); + assert (get (get (h, "children")(1), "color"), [0 0 0]) +***** test # old undocumented property + h = viscircles ([0 0], 1, "DrawBackgroundCircle", false); + assert (numel (get (h, "children")), 1) +***** error ... + viscircles ([0 0], 1, "Color", "magenta", "EdgeColor", "black") +***** test + centers = randi ([0 100], 5, 2); + radii = randi ([0 100], 5, 1); + h = viscircles (centers, radii); + close; +***** test + centers = randi ([0 100], 5, 2); + radii = randi ([0 100], 5, 1); + figure (); + h = viscircles (gca (), centers, radii); + close; +***** test + centers = randi ([0 100], 5, 2); + radii = randi ([0 100], 5, 1); + h = viscircles (centers, radii, "Color", "magenta", + "LineStyle", ":", "LineWidth", 5); + close; +***** test + centers = randi ([0 100],5,2); + radii = randi ([0 100],5,1); + figure (); + h = viscircles (centers, radii, "Color", "magenta", + "LineStyle", ":", "LineWidth", 5); + close; +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/imextendedmax.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imextendedmax.m ***** shared im0, bw0_h2_out - im0 = uint8 ([5 5 5 5 5; - 5 4 3 4 5; - 5 3 0 3 5; - 5 4 3 4 5; - 5 5 5 5 5]); + im0 = uint8 ([0 0 0 0 0; + 0 1 2 1 0; + 0 2 5 2 0; + 0 1 2 1 0; + 0 0 0 0 0]); bw0_h2_out = false (5); bw0_h2_out(3,3) = true; -***** error imextendedmin () -***** error imextendedmin (im0) -***** error imextendedmin ("hello", 2) -***** error imextendedmin (i.*im0, 2) -***** error imextendedmin (sparse (im0), 2) -***** error imextendedmin (im0, -2) -***** error imextendedmin (im0, 'a') -***** error imextendedmin (im0, ones (2)) -***** error imextendedmin (im0, 2*i) -***** assert (imextendedmin (im0, 2), bw0_h2_out) -***** assert (imextendedmin (double (im0), 2), bw0_h2_out) -***** assert (imextendedmin (im0, 2, 8), bw0_h2_out) -***** assert (imextendedmin (im0, 2, 4), bw0_h2_out) -***** assert (imextendedmin (im0, 2, true (3)), bw0_h2_out) +***** error imextendedmax () +***** error imextendedmax (im0) +***** error imextendedmax ("hello", 2) +***** error imextendedmax (i.*im0, 2) +***** error imextendedmax (sparse (im0), 2) +***** error imextendedmax (im0, -2) +***** error imextendedmax (im0, 'a') +***** error imextendedmax (im0, ones (2)) +***** error imextendedmax (im0, 2*i) +***** assert (imextendedmax (im0, 2), bw0_h2_out) +***** assert (imextendedmax (double (im0), 2), bw0_h2_out) +***** assert (imextendedmax (im0, 2, 8), bw0_h2_out) +***** assert (imextendedmax (im0, 2, 4), bw0_h2_out) +***** assert (imextendedmax (im0, 2, true (3)), bw0_h2_out) ***** test - out = imextendedmin (im0, 2); + out = imextendedmax (im0, 2); assert (size (out), size (im0)) assert (class (out), "logical") ***** test - out = imextendedmin (single (im0), 2); + out = imextendedmax (single (im0), 2); assert (size (out), size (im0)) assert (class (out), "logical") ***** test - out = imextendedmin (uint8 (im0), 2); + out = imextendedmax (uint8 (im0), 2); assert (size (out), size (im0)) assert (class (out), "logical") ***** test - out = imextendedmin (uint16 (im0), 2); + out = imextendedmax (uint16 (im0), 2); assert (size (out), size (im0)) assert (class (out), "logical") ***** test im = cat (3, im0, im0, im0, im0); - out = imextendedmin (im, 2); + out = imextendedmax (im, 2); assert (size (out), size (im)) ***** test - im = 10 .* ones (10); - im(2:4, 2:4) = 7; - im(6:8, 6:8) = 2; + im = zeros (10); + im(2:4, 2:4) = 3; + im(6:8, 6:8) = 8; expected_4 = false (10); expected_4(6:8, 6:8) = true; expected_2 = expected_4; expected_2(2:4, 2:4) = true; - out = imextendedmin (im, 4); + out = imextendedmax (im, 4); assert (out, expected_4, eps) - out = imextendedmin (0.1.*im, 0.4); + out = imextendedmax (0.1.*im, 0.4); assert (out, expected_4, eps) - out = imextendedmin (im, 2); + out = imextendedmax (im, 2); assert (out, expected_2, eps) ***** test - im2 = 10 .* ones (10); - im2(2:4, 2:4) = 7; - im2(6:9, 6:9)=2; - im2(5, 5)=2; - im2(6, 7)=10; - im2(7, 8)=10; + im2 = zeros (10); + im2(2:4, 2:4) = 3; + im2(6:9, 6:9)=8; + im2(5, 5)=8; + im2(6, 7)=0; + im2(7, 8)=0; expected_8 = false (10); expected_8(6:9, 6:9) = true; expected_8(5, 5) = true; @@ -4484,1256 +3887,71 @@ expected_8(7, 8) = false; expected_4 = expected_8; expected_4(2:4, 2:4) = true; - out2 = imextendedmin (im2, 2); + out2 = imextendedmax (im2, 2); assert (out2, expected_8, eps) - out2 = imextendedmin (im2, 2, 4); + out2 = imextendedmax (im2, 2, 4); assert (out2, expected_4, eps) - out2 = imextendedmin (im2, 2, 8); + out2 = imextendedmax (im2, 2, 8); assert (out2, expected_8, eps) 21 tests, 21 passed, 0 known failure, 0 skipped -[inst/bwmorph.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwmorph.m -***** demo - bwmorph (true (11), "shrink", Inf) - # Should return 0 matrix with 1 pixel set to 1 at (6,6) -***** test - slBW = logical ([ 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 - 0 0 1 1 0 0 0 - 0 0 1 1 0 0 0 - 0 0 1 1 1 0 0 - 0 0 1 1 1 0 0 - 0 1 1 1 1 1 0 - 0 1 1 1 1 1 0 - 0 1 1 1 1 1 0 - 0 1 1 1 1 1 0 - 0 1 1 1 1 1 0 - 0 0 0 0 0 0 0]); - - rslBW = logical ([ 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 - 0 0 1 1 0 0 0 - 0 0 1 1 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 1 0 0 0 - 0 0 0 1 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 1 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0]); - assert (bwmorph (slBW, "skel-lantuejoul", 1), [rslBW(1:5,:); false(7, 7)]); - assert (bwmorph (slBW, "skel-lantuejoul", 2), [rslBW(1:8,:); false(4, 7)]); - assert (bwmorph (slBW, "skel-lantuejoul", 3), rslBW); - assert (bwmorph (slBW, "skel-lantuejoul", Inf), rslBW); -***** test - bw = [ - 0 1 1 1 1 1 - 0 1 1 1 1 1 - 0 1 1 1 1 1 - 1 1 1 1 1 1 - 1 1 1 1 1 1 - 1 1 1 1 1 1 - 1 1 1 1 1 0 - 1 1 1 1 1 0 - 1 1 1 1 1 0]; - - final = logical ([ - 0 1 0 0 0 1 - 0 0 1 0 1 0 - 0 0 0 1 0 0 - 0 0 0 1 0 0 - 0 0 1 1 0 0 - 0 0 1 0 0 0 - 0 0 1 0 0 0 - 0 1 0 1 0 0 - 1 0 0 0 1 0]); - assert (bwmorph (bw, "skel", Inf), final) - assert (bwmorph (bw, "skel", 3), final) -***** error bwmorph ("not a matrix", "dilate") -***** assert (bwmorph (magic (10), "dilate"), imdilate (logical (magic (10)), ones (3))); -***** test - in = logical ([1 1 0 0 1 0 1 0 0 0 1 1 1 0 1 1 0 1 0 0 - 1 1 1 0 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 - 0 1 1 1 0 1 1 0 0 0 1 1 0 0 1 1 0 0 1 0 - 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 - 0 1 0 0 1 1 0 1 1 0 0 0 0 0 1 1 0 0 1 0 - 0 0 1 1 1 1 1 0 0 1 0 1 1 1 0 0 1 0 0 1 - 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 0 0 1 0 0 - 1 0 1 1 1 0 1 1 0 1 0 0 1 1 1 0 0 1 0 0 - 1 0 1 1 1 0 1 0 0 1 0 0 1 1 0 0 1 1 1 0 - 1 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 - 1 1 1 1 1 1 0 1 0 1 0 0 0 0 0 0 1 0 1 1 - 0 1 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 - 0 0 1 1 0 1 1 1 1 0 0 1 0 0 0 0 1 0 1 1 - 0 0 1 1 0 0 1 1 1 0 0 0 1 1 1 1 0 0 0 0 - 0 0 1 0 0 0 0 0 0 1 0 0 1 1 1 1 0 0 0 0 - 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 0 - 0 1 0 0 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 - 1 0 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 1 1 1 - 0 0 1 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 1 1 - 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 0 1]); - se = strel ("arbitrary", ones (3)); - - assert (bwmorph (in, "dilate"), imdilate (in, se)); - assert (bwmorph (in, "dilate", 3), imdilate (imdilate (imdilate (in, se), se), se)); - assert (bwmorph (in, "bothat"), imbothat (in, se)); - assert (bwmorph (in, "tophat"), imtophat (in, se)); - assert (bwmorph (in, "open"), imopen (in, se)); - assert (bwmorph (in, "close"), imclose (in, se)); -***** assert (bwmorph ([1 0 0; 1 0 1; 0 0 1], "bridge"), logical ([1 1 0; 1 1 1; 0 1 1])); -***** assert (bwmorph ([0 0 0; 1 0 1; 0 0 1], "clean"), logical ([0 0 0; 0 0 1; 0 0 1])); -***** assert (bwmorph ([0 0 0; 0 1 0; 0 0 0], "clean"), false (3)); -***** assert (bwmorph ([0 1 0; 1 0 0; 0 0 0], "diag"), logical ([1 1 0; 1 1 0; 0 0 0])); -***** test - in = logical ([0 1 0 1 0 - 1 1 1 0 1 - 1 0 0 1 0 - 1 1 1 0 1 - 1 1 1 1 1]); - out = logical ([0 1 0 1 0 - 1 1 1 1 1 - 1 0 0 1 0 - 1 1 1 1 1 - 1 1 1 1 1]); - assert (bwmorph (in, "fill"), out); -***** assert (bwmorph ([1 1 1; 0 1 0; 1 1 1], "hbreak"), logical ([1 1 1; 0 0 0; 1 1 1])); -***** test - in = logical ([0 1 0 0 0 - 1 0 0 1 0 - 1 0 1 0 0 - 1 1 1 1 1 - 1 1 1 1 1]); - - out = logical ([0 1 0 0 0 - 1 0 0 1 0 - 1 0 1 0 0 - 1 1 0 1 1 - 1 1 1 1 1]); - assert (bwmorph (in, "remove"), out); - - out = logical ([0 1 0 0 0 - 1 0 0 1 0 - 1 0 1 0 0 - 1 1 0 1 1 - 1 1 1 1 1]); - assert (bwmorph (in, "remove", Inf), out); -***** xtest - ## tests for spur are failing (matlab incompatible) - in = logical ([0 1 0 0 0 - 1 0 0 1 0 - 1 0 1 0 0 - 1 1 1 1 1 - 1 1 1 1 1]); - - out = logical ([0 1 0 0 0 - 1 0 0 0 0 - 1 0 1 0 0 - 1 1 1 1 1 - 1 1 1 1 1]); - assert (bwmorph (in, "spur"), out); - - out = logical ([0 1 0 0 0 - 1 0 0 0 0 - 1 0 0 0 0 - 1 1 1 1 1 - 1 1 1 1 1]); - assert (bwmorph (in, "spur", Inf), out); -!!!!! known failure -ASSERT errors for: assert (bwmorph (in, "spur"),out) - - Location | Observed | Expected | Reason - (1,2) 0 1 Abs err 1 exceeds tol 0 by 1 -***** test - bw = false (3, 3); - bw(3, 1) = true; - out = bwmorph (bw, "thicken", 0); - assert (out, bw) -***** test - bw = false (8, 7); - bw(8, 1) = true; - expected = logical ([ - 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 - 1 1 0 0 0 0 0 - 1 1 1 0 0 0 0 - 1 1 1 1 0 0 0 - 1 1 1 1 1 0 0 - 1 1 1 1 1 1 0 - 1 1 1 1 1 1 1]); - out = bwmorph (bw, "thicken", 6); - assert (out, expected) -***** test - bw = false (8, 7); - bw(2, 4) = true; - expected = logical ([ - 0 0 1 1 1 0 0 - 0 1 1 1 1 1 0 - 0 0 1 1 1 0 0 - 0 0 0 1 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0]); - out = bwmorph (bw, "thicken", 2); - assert (out, expected) -***** test - bw = false (8, 7); - bw (6, 3) = true ; - expected1 = logical ([ - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 1 0 0 0 0 - 0 1 1 1 0 0 0 - 0 0 1 0 0 0 0 - 0 0 0 0 0 0 0]); - expected3 = logical ([ - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 1 0 0 0 0 - 0 1 1 1 0 0 0 - 1 1 1 1 1 0 0 - 1 1 1 1 1 1 0 - 1 1 1 1 1 0 0 - 0 1 1 1 0 0 0]); - out1 = bwmorph (bw, "thicken", 1); - out3 = bwmorph (bw, "thicken", 3); - assert (out1, expected1) - assert (out3, expected3) -***** test - bw = false (10, 10); - bw(2, 3) = true; - bw(7, 7) = true; - out_inf = bwmorph (bw, "thicken", Inf); - assert (out_inf(1, 9), false) -***** test - bw = false (3, 3); - bw(3, 1) = true; - out = bwmorph (bw, "thicken", 4); - assert (out, true (3, 3)) -***** xtest - ## bug #44396 - in = [ - 0 0 0 1 0 - 1 1 1 1 0 - 0 0 1 1 0 - 0 0 1 1 0 - 0 0 0 1 0]; - out = [ - 0 0 0 0 0 - 0 1 1 0 0 - 0 0 0 1 0 - 0 0 0 0 0 - 0 0 0 0 0]; - assert (bwmorph (in, "shrink"), logical (out)); -!!!!! known failure -ASSERT errors for: assert (bwmorph (in, "shrink"),logical (out)) - - Location | Observed | Expected | Reason - (2,4) 1 0 Abs err 1 exceeds tol 0 by 1 - (3,4) 0 1 Abs err 1 exceeds tol 0 by 1 - (4,4) 1 0 Abs err 1 exceeds tol 0 by 1 - (5,4) 1 0 Abs err 1 exceeds tol 0 by 1 -***** test - H = false (7,7); - H(2:3,2:3) = 1; - H(5:6,5:6) = 1; - T = logical([0 0 0 0 0 0 0; - 0 0 0 0 0 0 0; - 0 1 0 0 0 0 0; - 0 0 0 0 0 0 0; - 0 0 0 0 0 0 0; - 0 0 0 0 1 0 0; - 0 0 0 0 0 0 0]); - out = bwmorph (H, "thin", 1); - assert (T, out) - - H(4:6,4:6) = 1; - T = logical([0 0 0 0 0 0 0; - 0 0 0 0 0 0 0; - 0 1 1 0 0 0 0; - 0 0 0 1 0 0 0; - 0 0 0 0 1 0 0; - 0 0 0 0 0 0 0; - 0 0 0 0 0 0 0]); - out = bwmorph (H, "thin", 1); - assert (T, out) - - H3 = [0 0 0 0 0 0; - 0 1 1 1 0 0; - 0 1 1 1 0 0; - 0 0 0 1 0 1; - 0 0 0 0 1 1; - 0 0 0 1 1 1]; - out3 = bwmorph (H3, "thin", 1); - expected3 = logical( - [0 0 0 0 0 0; - 0 0 0 0 0 0; - 0 1 1 0 0 0; - 0 0 0 1 0 1; - 0 0 0 0 1 0; - 0 0 0 1 1 0]); - assert (out3, expected3) - - out33 = bwmorph (H3, "thin", 2); - expected33 = logical( - [0 0 0 0 0 0; - 0 0 0 0 0 0; - 0 1 1 0 0 0; - 0 0 0 1 0 1; - 0 0 0 0 1 0; - 0 0 0 1 0 0]); - assert (out33, expected33) - - out333 = bwmorph (H3, "thin", inf); - assert (out333, expected33) -***** test - in = logical ([ - 1 0 0 0 - 0 1 0 0 - 0 0 1 0 - 0 0 0 0]); - out = logical ([ - 1 0 0 0 - 0 0 0 0 - 0 0 1 0 - 0 0 0 0]); - assert (bwmorph (in, "endpoints"), out); - - A = logical ([0 0 0 0 0; 0 0 1 0 0; 0 1 1 1 0; 0 0 1 0 0; 0 0 0 0 0]); - B = logical ([0 0 0 0 0; 0 0 1 0 0; 0 1 0 1 0; 0 0 1 0 0; 0 0 0 0 0]); - assert (bwmorph (A, "endpoints"), B); - - A = logical ([0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 1 1 - 0 0 1 1 1 1 0 0 - 0 0 0 1 1 0 0 0 - 0 0 1 1 1 1 0 0 - 0 1 0 0 0 0 1 0 - 1 0 0 0 0 0 0 1]); - B = logical ([0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 1 - 0 0 0 0 0 0 0 0 - 0 0 0 1 1 0 0 0 - 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 1]); - assert (bwmorph (A, "endpoints"), B); - - A = logical([0 0 0 0 0; 0 1 1 1 0; 0 1 1 1 0; 0 1 1 1 0; 0 0 0 0 0]); - B = logical([0 0 0 0 0; 0 1 1 1 0; 0 1 0 1 0; 0 1 1 1 0; 0 0 0 0 0]); - assert (bwmorph (A, "endpoints"), B); - assert (bwmorph (B, "endpoints"), zeros (5, "logical")); - - A = logical([0,0,0,0,0,0,0,0,0,0,0,0,0,0 - 0,0,1,1,1,1,1,1,1,1,1,1,0,0 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0]); - B = logical([0,0,0,0,0,0,0,0,0,0,0,0,0,0 - 0,0,1,0,0,0,0,0,0,0,0,1,0,0 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0]); - C = logical([1,0,0,0,0,0,0,0,0,0,0,0,0,1 - 1,1,0,0,0,0,0,0,0,0,0,0,1,1 - 1,0,0,0,0,0,0,0,0,0,0,0,0,1]); - assert (bwmorph (!A, "endpoints"), C); -22 tests, 20 passed, 2 known failures, 0 skipped -[inst/imfuse.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imfuse.m -***** error id=Octave:invalid-fun-call imfuse () -***** error id=Octave:invalid-input-arg imfuse (1, 1, "xxx") -***** error id=Octave:invalid-input-arg imfuse (1, 1, "interpolation") -***** error id=Octave:invalid-input-arg imfuse (1, 1, "ColorChannels", [0 0 0]) -***** error id=Octave:invalid-input-arg imfuse (1, 1, "ColorChannels", [1 1 1]) -***** error id=Octave:invalid-input-arg imfuse (1, 1, "ColorChannels", [2 2 2]) -***** error id=Octave:expected-less-equal imfuse (1, 1, "ColorChannels", [42 0 0]) -***** error id=Octave:expected-greater-equal imfuse (1, 1, "ColorChannels", [-1 2 0]) -***** error id=Octave:invalid-input-arg imfuse (1, 1, "ColorChannels", "deep-purple") -***** assert (imfuse (1, 2, "blend"), uint8 (0)) -***** assert (imfuse (1, 2, "blend", "Scaling", "independent"), uint8 (0)) -***** assert (imfuse (1, 2, "blend", "Scaling", "joint"), uint8 (128)) -***** assert (imfuse (1, 2, "blend", "Scaling", "none"), uint8 (255)) -***** assert (imfuse (1, 2, "falsecolor"), uint8 (zeros (1, 1, 3))) -***** test - a = [0 1 2]; - b = [0 10 20]; - expected = uint8 (repmat ([0 128 255], [1 1 3])); - assert (imfuse (a, b), expected); -***** test - a = uint8 ([0 1 2]); - b = uint8 ([0 10 20]); - expected = uint8 (repmat ([0 128 255], [1 1 3])); - assert (imfuse (a, b), expected); -***** test - a = uint8 ([0 1 2]); - b = uint8 ([0 10 20]); - expected = uint8 (repmat ([0 128 255], [1 1 3])); - assert (imfuse (a, b, "falsecolor"), expected); -***** test - a = logical([0 1 1]); - b = logical([0 1 1]); - expected = uint8 (repmat ([0 255 255], [1 1 3])); - assert (imfuse (a, b), expected); -***** test - a = logical([0 1 1]); - b = logical([0 1 1]); - expected = uint8 (repmat ([0 255 255], [1 1 3])); - assert (imfuse (a, b, "falsecolor"), expected); -***** test - a = [0 1 2]; - b = [0 10 20]; - expected = uint8 (repmat ([0 255 255], [1 1 3])); - assert (imfuse (a, b, "Scaling", "none"), expected); -***** test - a = uint8 ([0 1 2]); - b = uint8 ([0 10 20]); - expected = uint8 (zeros ([1, 3, 3])); - expected(:, :, 1) = [0 10 20]; - expected(:, :, 2) = [0 1 2]; - expected(:, :, 3) = [0 10 20]; - assert (imfuse (a, b, "Scaling", "none"), expected); -***** test - a = [0 1 2]; - b = uint8 ([0 10 20]); - expected = uint8 (zeros ([1, 3, 3])); - expected(:, :, 1) = [0 10 20]; - expected(:, :, 2) = [0 255 255]; - expected(:, :, 3) = [0 10 20]; - assert (imfuse (a, b, "Scaling", "none"), expected); -***** test - a = uint8 ([0 1 2]); - b = [0 10 20]; - expected = uint8 (zeros ([1, 3, 3])); - expected(:, :, 1) = [0 255 255]; - expected(:, :, 2) = [0 1 2]; - expected(:, :, 3) = [0 255 255]; - assert (imfuse (a, b, "Scaling", "none"), expected); -***** test - a = [0 .1 2]; - b = [0 .01 .02]; - expected = uint8 (zeros ([1, 3, 3])); - expected(:, :, 1) = [0 3 5]; - expected(:, :, 2) = [0 26 255]; - expected(:, :, 3) = [0 3 5]; - assert (imfuse (a, b, "Scaling", "none"), expected); -***** test - a = [0 1 2]; - b = [0 10 20]; - expected = uint8 (zeros ([1, 3, 3])); - expected(:, :, 1) = [0 128 255]; - expected(:, :, 2) = [0 13 26]; - expected(:, :, 3) = [0 128 255]; - assert (imfuse (a, b, "Scaling", "joint"), expected); -***** test - a = uint8 ([0 1 2]); - b = [0 10 20]; - expected = uint8 (zeros ([1, 3, 3])); - expected(:, :, 1) = [0 128 255]; - expected(:, :, 2) = [0 13 26]; - expected(:, :, 3) = [0 128 255]; - assert (imfuse (a, b, "Scaling", "joint"), expected); -***** test - a = [0 150 300]; - b = uint8 ([0 10 20]); - expected = uint8 (zeros ([1, 3, 3])); - expected(:, :, 1) = [0 9 17]; - expected(:, :, 2) = [0 128 255]; - expected(:, :, 3) = [0 9 17]; - assert (imfuse (a, b, "Scaling", "joint"), expected); -***** test - a = uint8 ([0 1 2]); - b = uint8 ([0 10 20]); - expected = uint8 (zeros ([1, 3, 3])); - expected(:, :, 1) = [0 128 255]; - expected(:, :, 2) = [0 13 26]; - expected(:, :, 3) = [0 128 255]; - assert (imfuse (a, b, "Scaling", "joint"), expected); -***** test - a = [0 1 2]; - b = [0 10 20]; - expected = uint8 (zeros ([1, 3, 3])); - expected(:, :, 1) = [0 0 0]; - expected(:, :, 2) = [0 128 255]; - expected(:, :, 3) = [0 13 26]; - assert (imfuse (a, b, "Scaling", "joint", "ColorChannels", [0 2 1]), expected); -***** test - a = [0 1 2]; - b = [0 10 15]; - c = imfuse (a, b, "ColorChannels", "red-cyan"); - expected = uint8 (zeros (1, 3, 3)); - expected(:, :, 1) = [0 128 255]; - expected(:, :, 2) = [0 170 255]; - expected(:, :, 3) = [0 170 255]; - assert (c, expected); -***** test - a = [0 1 2]; - b = [0 10 15]; - c = imfuse (a, b, "ColorChannels", "green-magenta"); - expected = uint8 (zeros (1, 3, 3)); - expected(:, :, 1) = [0 170 255]; - expected(:, :, 2) = [0 128 255]; - expected(:, :, 3) = [0 170 255]; - assert (c, expected); -***** test - a = [0 5 2]; - b = [0 10 20]; - assert (imfuse (a, b, "diff"), uint8 ([0 213 255])); -***** test - a = [0 5 2]; - b = [0 10 20]; - assert (imfuse (a, b, "diff", "Scaling", "joint"), uint8 ([0 71 255])); -***** test - a = [0 5 2]; - b = [0 10 20]; - assert (imfuse (a, b, "blend"), uint8 ([0 192 179])); -***** test - a = magic (5); - b = a'; - c = imfuse (a, b, "falsecolor"); - expected = zeros (5, 5, 3); - expected(:, :, 1) = [ - 170 234 32 96 106 - 244 43 53 117 181 - 0 64 128 191 255 - 74 138 202 213 11 - 149 159 223 21 85]; - expected(:, :, 2) = [ - 170 244 0 74 149 - 234 43 64 138 159 - 32 53 128 202 223 - 96 117 191 213 21 - 106 181 255 11 85]; - expected(:, :, 3) = [ - 170 234 32 96 106 - 244 43 53 117 181 - 0 64 128 191 255 - 74 138 202 213 11 - 149 159 223 21 85]; - assert (c, uint8 (expected)); -***** test - a = magic (5); - b = a'; - assert (imfuse (uint8 (a), uint8 (b), "blend", "Scaling", "none"), - uint8 ([17 24 3 9 13 - 24 5 7 13 17 - 3 7 13 20 24 - 9 13 20 21 3 - 13 17 24 3 9])); -***** test - a = magic (5); - b = 2 * a'; - assert (imfuse (a, b, "blend", "Scaling", "independent"), - uint8 ([170 239 16 85 128 - 239 43 59 128 170 - 16 59 128 197 239 - 85 128 197 213 16 - 128 170 239 16 85])); -***** test - a = magic (5); - b = 2 * a'; - assert (imfuse (a, b, "blend", "Scaling", "joint"), - uint8 ([128 177 18 68 91 - 180 34 44 94 130 - 11 47 96 146 182 - 63 99 149 159 13 - 102 125 175 16 65])); -***** test - a = [0 1.2 5]; - b = [5 6.13 12]; - assert (imfuse (a, b, "blend"), uint8 ([0 51 255])); -***** test - a = [0 5 2]; - b = [0 10 20]; - assert (imfuse (a, b, "blend", "Scaling", "joint"), uint8 ([0 96 141])); -***** test - a = [0 5 2]; - b = [0 10 20]; - assert (imfuse (a, b, "montage"), uint8 ([0 255 102 0 128 255])); -***** test - a = zeros (1, 100); - b = 2 * ones (1, 100); - assert (imfuse (a, b, "montage"), uint8 ([zeros(1, 200)])); - assert (imfuse (a, b, "montage", "Scaling", "none"), - uint8 ([zeros(1, 100), 255 * ones(1, 100)])); -***** test - a = zeros (1, 100, 3); - b = 2 * ones (1, 100); - assert (imfuse (a, b, "montage"), uint8 ([zeros(1, 200, 3)])); -***** test - a = 0.1 * ones (50, 50); - b = 0.2 * ones (50, 50); - c = imfuse (a, b, "checkerboard", "Scaling", "none"); - d = imresize (repmat([26, 51; 51, 26], [8, 8]), [50, 50], "nearest"); - assert (all (c(:) == d(:))); -***** test - a = zeros (2, 2); - b = zeros (2, 2); - ra = imref2d (size (a), [0, 2], [0, 2]); - rb = imref2d (size (b), [0, 2], [2, 4]); - [c, rc] = imfuse (a, ra, b, rb, "falsecolor"); - assert (rc.ImageSize, [4, 2]); - assert (rc.XWorldLimits, [0, 2]); - assert (rc.YWorldLimits, [0, 4]); - assert (rc.PixelExtentInWorldX, 1); - assert (rc.PixelExtentInWorldY, 1); - assert (rc.ImageExtentInWorldX, 2); - assert (rc.ImageExtentInWorldY, 4); - assert (rc.XIntrinsicLimits, [0.5, 2.5]); - assert (rc.YIntrinsicLimits, [0.5, 4.5]); - assert (c, uint8 (zeros (4, 2, 3))); -***** xtest - a = zeros (5, 3); - b = ones (6, 5); - ra = imref2d (size (a), [15, 30], [2, 4]); - rb = imref2d (size (b), [10, 50], [5.5, 6.7]); - [c, rc] = imfuse (a, ra, b, rb, "falsecolor"); - assert (rc.ImageSize, [24, 8]); - assert (rc.XWorldLimits, [10, 50]); - assert (rc.YWorldLimits, [2, 6.7]); - assert (rc.PixelExtentInWorldX, 5); - assert (rc.PixelExtentInWorldY, 0.19583333, 10e-9); - assert (rc.ImageExtentInWorldX, 40); - assert (rc.ImageExtentInWorldY, 4.7); - assert (rc.XIntrinsicLimits, [0.5, 8.5]); - assert (rc.YIntrinsicLimits, [0.5, 24.5]); - expected = uint8 (zeros (24, 8, 3)); - expected(19:23, 2:7, 1) = 255 * ones (5, 6); - expected(19:23, 2:7, 3) = 255 * ones (5, 6); - assert (c, expected); -!!!!! known failure -ASSERT errors for: assert (c,expected) - - Location | Observed | Expected | Reason - (19,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,3,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,3,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,3,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,3,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,3,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,4,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,4,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,4,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,4,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,4,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,5,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,5,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,5,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,5,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,5,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,6,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,6,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,6,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,6,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,6,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,7,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,7,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,7,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,7,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,7,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,3,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,3,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,3,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,3,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,3,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,4,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,4,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,4,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,4,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,4,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,5,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,5,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,5,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,5,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,5,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,6,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,6,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,6,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,6,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,6,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (19,7,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (20,7,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (21,7,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (22,7,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (23,7,3) 0 255 Abs err 0 exceeds tol 0 by 0 -***** test - a = uint8 (reshape (1:1:9, [1 3 3])); - b = uint8 (reshape (10:2:26, [1 3 3])); - c = imfuse (a, b); - expected = uint8 (zeros (1, 3, 3)); - expected(:, :, 1) = [0 128 255]; - expected(:, :, 2) = [0 128 255]; - expected(:, :, 3) = [0 128 255]; - assert (c, expected); -***** test - a = uint8 (reshape (1:1:9, [1 3 3])); - b = uint8 (reshape (10:2:26, [1 3 3])); - c = imfuse (a, b, "Scaling", "independent"); - expected = uint8 (zeros (1, 3, 3)); - expected(:, :, 1) = [0 128 255]; - expected(:, :, 2) = [0 128 255]; - expected(:, :, 3) = [0 128 255]; - assert (c, expected); -***** test - a = uint8 (reshape (1:1:9, [1 3 3])); - b = uint8 (reshape (10:2:26, [1 3 3])); - c = imfuse (a, b, "Scaling", "joint"); - expected = uint8 (zeros (1, 3, 3)); - expected(:, :, 1) = [191 223 255]; - expected(:, :, 2) = [0 16 32]; - expected(:, :, 3) = [191 223 255]; - assert (c, expected); -***** test - a = uint8 (reshape (1:1:9, [1 3 3])); - b = uint8 (reshape (10:2:26, [1 3 3])); - c = imfuse (a, b, "Scaling", "none"); - expected = uint8 (zeros (1, 3, 3)); - expected(:, :, 1) = [15 17 19]; - expected(:, :, 2) = [3 4 5]; - expected(:, :, 3) = [15 17 19]; - assert (c, expected); -***** xtest - a = zeros (5, 3); - b = ones (5, 3); - ra = imref2d (size (a), [10, 20], [30, 40]); - rb = imref2d (size (b), [10, 20], [30, 40]); - [c, rc] = imfuse (a, ra, b, rb, "falsecolor"); - expected = uint8 (zeros (5, 3, 3)); - expected(:, 1:2, 1) = 255 * ones (5, 2); - expected(:, 1:2, 3) = 255 * ones (5, 2); - assert (rc.ImageSize, [5, 3]); - assert (rc.XWorldLimits, [10, 20]); - assert (rc.YWorldLimits, [30, 40]); - assert (rc.PixelExtentInWorldX, 3.33333333, 10e-9); - assert (rc.PixelExtentInWorldY, 2); - assert (rc.ImageExtentInWorldX, 10); - assert (rc.ImageExtentInWorldY, 10); - assert (rc.XIntrinsicLimits, [0.5, 3.5]); - assert (rc.YIntrinsicLimits, [0.5, 5.5]); - assert (c, expected); -!!!!! known failure -ASSERT errors for: assert (c,expected) - - Location | Observed | Expected | Reason - (1,1,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (2,1,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (3,1,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (4,1,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (5,1,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (1,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (2,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (3,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (4,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (5,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 - (1,1,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (2,1,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (3,1,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (4,1,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (5,1,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (1,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (2,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (3,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (4,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 - (5,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 -***** test - a = zeros (5, 5); - b = ones (5, 5); - ra = imref2d (size (a), [10, 20], [30, 40]); - rb = imref2d (size (b), [10, 20], [30, 40]); - [c, rc] = imfuse (a, ra, b, rb, "falsecolor"); - expected = uint8 (zeros (5, 5, 3)); - assert (rc.ImageSize, [5, 5]); - assert (rc.XWorldLimits, [10, 20]); - assert (rc.YWorldLimits, [30, 40]); - assert (rc.PixelExtentInWorldX, 2); - assert (rc.PixelExtentInWorldY, 2); - assert (rc.ImageExtentInWorldX, 10); - assert (rc.ImageExtentInWorldY, 10); - assert (rc.XIntrinsicLimits, [0.5, 5.5]); - assert (rc.YIntrinsicLimits, [0.5, 5.5]); - assert (c, expected); -***** test - a = magic (5); - b = ones (5, 5); - ra = imref2d (size (a), [10, 20], [30, 40]); - rb = imref2d (size (b), [10, 20], [30, 40]); - [c, rc] = imfuse (a, ra, b, rb, "falsecolor", "Scaling", "independent"); - expected = uint8 (zeros (5, 5, 3)); - expected(:, :, 2) = [ - 170 244 0 74 149 - 234 43 64 138 159 - 32 53 128 202 223 - 96 117 191 213 21 - 106 181 255 11 85]; - assert (rc.ImageSize, [5, 5]); - assert (rc.XWorldLimits, [10, 20]); - assert (rc.YWorldLimits, [30, 40]); - assert (rc.PixelExtentInWorldX, 2); - assert (rc.PixelExtentInWorldY, 2); - assert (rc.ImageExtentInWorldX, 10); - assert (rc.ImageExtentInWorldY, 10); - assert (rc.XIntrinsicLimits, [0.5, 5.5]); - assert (rc.YIntrinsicLimits, [0.5, 5.5]); - assert (c, expected); -53 tests, 51 passed, 2 known failures, 0 skipped -[inst/qtgetblk.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/qtgetblk.m -***** demo - [vals,r,c]=qtgetblk(eye(4),qtdecomp(eye(4)),2) - % Returns 2 blocks, at [1,3] and [3,1] (2*2 zeros blocks) -***** shared A,S - A=[ 1, 4, 2, 5,54,55,61,62; - 3, 6, 3, 1,58,53,67,65; - 3, 6, 3, 1,58,53,67,65; - 3, 6, 3, 1,58,53,67,65; - 23,42,42,42,99,99,99,99; - 27,42,42,42,99,99,99,99; - 23,22,26,25,99,99,99,99; - 22,22,24,22,99,99,99,99]; - S=qtdecomp(A,10); -***** test - [va]=qtgetblk(A,S,8); - [vb,r,c]=qtgetblk(A,S,8); - [vc,i]=qtgetblk(A,S,8); - assert(va, vb); - assert(va, vc); - assert(i,[]); - assert(r,[]); - assert(c,[]); - R=[]; - assert(va,R); -***** test - [va]=qtgetblk(A,S,4); - [vb,r,c]=qtgetblk(A,S,4); - [vc,i]=qtgetblk(A,S,4); - assert(va, vb); - assert(va, vc); - assert(i, find(full(S)==4)); - assert(r,[1;5]); - assert(c,[1;5]); - R=zeros(4,4,2); - R(:,:,1)=A(1:4,1:4); - R(:,:,2)=A(5:8,5:8); - assert(va,R); -***** test - [va]=qtgetblk(A,S,2); - [vb,r,c]=qtgetblk(A,S,2); - [vc,i]=qtgetblk(A,S,2); - assert(va, vb); - assert(va, vc); - assert(i, find(full(S)==2)); - assert(r,[7;5;7;1;3;1;3]); - assert(c,[1;3;3;5;5;7;7]); - R=zeros(2,2,7); - R(:,:,1)=A(7:8,1:2); - R(:,:,2)=A(5:6,3:4); - R(:,:,3)=A(7:8,3:4); - R(:,:,4)=A(1:2,5:6); - R(:,:,5)=A(3:4,5:6); - R(:,:,6)=A(1:2,7:8); - R(:,:,7)=A(3:4,7:8); - assert(va,R); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/imfilter.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imfilter.m -***** test - img = [ - 8 2 6 7 4 3 7 8 4 1 - 9 9 1 1 4 7 3 3 8 1 - 2 9 8 3 7 6 5 8 6 5 - 9 5 9 1 8 2 7 3 5 8 - 6 8 7 1 2 2 9 9 9 9 - 1 2 7 8 5 5 9 4 3 2 - 3 4 7 7 5 9 5 2 7 6 - 5 9 4 3 6 4 2 3 7 5 - 9 8 6 9 7 6 2 6 4 1 - 9 9 2 1 7 3 3 5 6 4]; - - expected_corr = [ - 46 53 30 34 44 42 40 51 42 19 - 48 66 57 42 46 50 59 58 49 34 - 48 67 55 54 44 58 50 50 64 39 - 44 77 52 43 28 55 57 75 70 50 - 29 51 65 51 42 50 60 62 55 42 - 23 44 58 59 63 59 55 57 50 36 - 36 50 52 56 56 47 48 45 47 39 - 51 64 70 62 56 50 40 38 41 31 - 58 72 50 49 58 45 41 42 49 28 - 27 37 27 21 19 26 16 23 24 17]; - assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2]), expected_corr) - - ## test order of options (and matching with defaults) - assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2], 0), expected_corr) - assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2], "corr"), expected_corr) - assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2], "corr", 0), expected_corr) - assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2], 0, "corr"), expected_corr) - - expected_conv = [ - 21 31 23 22 21 28 29 26 22 6 - 47 55 43 43 51 44 49 64 44 24 - 56 69 53 34 47 50 57 48 52 37 - 38 70 60 56 41 57 54 61 66 44 - 46 67 53 48 32 54 59 65 63 46 - 28 56 63 50 36 54 58 66 63 47 - 20 43 55 62 67 57 52 53 44 28 - 42 51 54 61 57 53 44 46 48 39 - 53 70 63 50 57 42 38 38 43 33 - 53 62 50 54 52 44 38 40 40 20]; - assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2], "conv"), expected_conv) - - ## alternative class - assert (imfilter (single (img), [0 1 0; 2 1 1; 1 2 2]), - single (expected_corr)) - assert (imfilter (int8 (img), [0 1 0; 2 1 1; 1 2 2]), - int8 (expected_corr)) - assert (imfilter (uint8 (img), [0 1 0; 2 1 1; 1 2 2]), - uint8 (expected_corr)) - - assert (imfilter (single (img), [0 1 0; 2 1 1; 1 2 2], "conv"), - single (expected_conv)) - assert (imfilter (int8 (img), [0 1 0; 2 1 1; 1 2 2], "conv"), - int8 (expected_conv)) - assert (imfilter (uint8 (img), [0 1 0; 2 1 1; 1 2 2], "conv"), - uint8 (expected_conv)) - +[inst/findbounds.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/findbounds.m ***** test - I = zeros (6); - I(2:3,2:3) = 1; - F = zeros (4); - F(2,2:3) = 1; - result = [0 0 0 0 0 0 - 1 2 1 0 0 0 - 1 2 1 0 0 0 - 0 0 0 0 0 0 - 0 0 0 0 0 0 - 0 0 0 0 0 0]; - assert (imfilter (I, F), result) + im = checkerboard (); + theta = pi/6; + T = maketform ('affine', [cos(theta) -sin(theta); ... + sin(theta) cos(theta); 0 0]); + inbnd = [0 0; 1 1]; + outbnd = findbounds (T, inbnd); + diag = 2^.5; + ang = pi/4; + assert (diff (outbnd(:,1)), diag * abs (cos (theta - ang)), eps) + assert (diff (outbnd(:,2)), diag * abs (cos (theta - ang)), eps) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/edgetaper.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/edgetaper.m +***** assert (class (edgetaper (rand (100), rand (16))), "double") +***** assert (class (edgetaper (randi (255, 100, "uint8"), rand (16))), "uint8") 2 tests, 2 passed, 0 known failure, 0 skipped -[inst/bwareafilt.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwareafilt.m -***** shared a2d, a3d - a2d = [1 0 0 0 0 0 1 0 0 1 - 1 0 0 1 0 1 0 1 0 1 - 1 0 1 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 1 0 1 1 1 0 0 0 0 - 1 1 0 1 0 0 0 1 0 0 - 1 1 0 0 0 0 1 0 1 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 1 1 0 0 1]; - - a3d = a2d; - a3d(:,:,2) = [ - 0 0 0 0 0 0 0 0 0 0 - 1 0 0 1 1 0 0 1 0 0 - 0 0 0 1 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 1 0 0 1 1 0 0 0 0 - 1 1 0 1 0 0 0 0 0 0 - 1 0 0 0 0 0 1 0 0 0 - 0 1 0 0 0 0 0 0 0 1 - 1 1 0 0 0 0 1 0 0 0]; - - a3d(:,:,3) = [ - 1 0 0 0 0 0 0 0 0 0 - 0 1 0 1 1 0 0 1 0 0 - 0 0 0 1 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 1 1 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 1 - 1 1 0 0 0 0 0 0 0 0]; -***** test - f2d = [0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 1 0 1 1 1 0 0 0 0 - 1 1 0 1 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0]; - assert (bwareafilt (a2d, 2), logical (f2d)); - assert (bwareafilt (a2d, 2, 8), logical (f2d)); - assert (bwareafilt (a2d, 2, 4), logical (f2d)); -***** test - f2d = [1 0 0 0 0 0 1 0 0 0 - 1 0 0 0 0 1 0 1 0 0 - 1 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 1 0 1 1 1 0 0 0 0 - 1 1 0 1 0 0 0 1 0 0 - 1 1 0 0 0 0 1 0 1 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0]; - assert (bwareafilt (a2d, 5), logical (f2d)); - assert (bwareafilt (a2d, 5, 8), logical (f2d)); -***** test - f2d = [0 0 0 0 0 0 1 0 0 1 - 0 0 0 1 0 1 0 1 0 1 - 0 0 1 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 1 0 0 - 0 0 0 0 0 0 1 0 1 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 1 1 0 0 1]; - assert (bwareafilt (a2d, 11, "smallest", 4), logical (f2d)); -***** test - f2d = [1 0 0 0 0 0 1 0 0 0 - 1 0 0 0 0 1 0 1 0 0 - 1 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 1 1 0 0 0 0 - 0 0 0 1 0 0 0 1 0 0 - 0 0 0 0 0 0 1 0 1 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0]; - assert (bwareafilt (a2d, [3 5]), logical (f2d)); - assert (bwareafilt (a2d, [3 5], 8), logical (f2d)); -***** test - f2d = [1 0 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 1 1 0 0 0 0 - 0 0 0 1 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0]; - assert (bwareafilt (a2d, [3 4], 4), logical (f2d)); - assert (bwareafilt (a2d, [3 4], [0 1 0; 1 1 1; 0 1 0]), logical (f2d)); -***** test - f2d = [1 0 0 0 0 0 1 0 0 1 - 1 0 0 1 0 1 0 1 0 1 - 1 0 1 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 1 1 0 0 0 0 - 0 0 0 1 0 0 0 1 0 0 - 0 0 0 0 0 0 1 0 1 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 1 1 0 0 0]; - assert (bwareafilt (a2d, [2 4]), logical (f2d)); - assert (bwareafilt (a2d, [2 4], 8), logical (f2d)); - assert (bwareafilt (a2d, [2 4], ones (3)), logical (f2d)); -***** test - f3d = [0 0 0 0 0 0 1 0 0 0 - 0 0 0 1 0 1 0 1 0 0 - 0 0 1 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0]; - - f3d(:,:,2) = [ - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 1 0 0 1 0 0 - 0 0 0 1 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0]; - - f3d(:,:,3) = [ - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 1 0 0 1 0 0 - 0 0 0 1 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0]; - assert (bwareafilt (a3d, 2), logical (f3d)); - assert (bwareafilt (a3d, 2, 26), logical (f3d)); - assert (bwareafilt (a3d, 2, ones (3, 3, 3)), logical (f3d)); -***** test - f3d = [0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 1 0 1 1 1 0 0 0 0 - 1 1 0 1 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0]; - - f3d(:,:,2) = [ - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 1 0 0 1 1 0 0 0 0 - 1 1 0 1 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0]; - - f3d(:,:,3) = [ - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 1 1 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 0 0]; - assert (bwareafilt (a3d, 2, 6), logical (f3d)); - assert (bwareafilt (a3d, 2, conndef (3, "minimal")), logical (f3d)); -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/imattributes.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imattributes.m -***** shared x, map, img, rgb, bw - [x, map] = imread ("default.img"); - rgb = ind2rgb (x, map); - img = ind2gray (x, map); - bw = im2bw (img); +[inst/imregionalmax.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imregionalmax.m ***** test - h = imshow (img); - a = imattributes (h); - assert ([a.("Height (rows)") a.("Width (columns)")], [53 40]); - assert (a.Class, "uint8"); - assert (a.("Image type"), "intensity"); - assert (a.("Minimum intensity"), uint8 (28)); - assert (a.("Maximum intensity"), uint8 (250)); -***** xtest - h = imshow (rgb); - a = imattributes (h); - assert ([a.("Height (rows)") a.("Width (columns)")], [53 40]); - assert (a.Class, "uint8"); - assert (a.("Image type"), "truecolor"); - assert (isfield (a, "Minimum intensity"), false); - assert (isfield (a, "Maximum intensity"), false); -!!!!! known failure -ASSERT errors for: assert (a.Class,"uint8") + a = [ + 7 3 9 3 10 3 + 4 2 3 10 1 3 + 1 4 6 9 4 10 + 8 7 9 3 4 8 + 5 9 3 3 8 9 + 3 6 9 4 1 10]; - Location | Observed | Expected | Reason - [] 'double' 'uint8' Strings don't match -***** test - h = imshow (bw); - a = imattributes (h); - assert ([a.("Height (rows)") a.("Width (columns)")], [53 40]); - assert (a.Class, "logical"); - assert (a.("Image type"), "binary"); - assert (isfield (a, "Minimum intensity"), false); - assert (isfield (a, "Maximum intensity"), false); -***** test - h = imshow (x, map); - a = imattributes (h); - assert ([a.("Height (rows)") a.("Width (columns)")], [53 40]); - assert (a.Class, "uint8"); - assert (a.("Image type"), "indexed"); - assert (a.("Minimum intensity"), uint8 (0)); - assert (a.("Maximum intensity"), uint8 (55)); -***** test - h = imshow (img); - a1 = imattributes (); - a2 = imattributes (h); - assert (a1, a2); -5 tests, 4 passed, 1 known failure, 0 skipped -[inst/bwhitmiss.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwhitmiss.m -***** test - bw1 = repmat ([0 1 0 1 1], [3 1]); - bw2 = repmat ([0 1 0 0 0], [3 1]); - assert (bwhitmiss (bw1, [1; 0; 1], [1 0 1]), logical (bw2)) - assert (bwhitmiss (bw1, [0 1 0; -1 0 -1; 0 1 0]), logical (bw2)) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/isgray.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/isgray.m -***** assert (isgray ([0 0 1; 1 0 1]), true) -***** assert (isgray (zeros (3)), true) -***** assert (isgray (ones (3)), true) -***** test - a = rand (10); - assert (isgray (a), true); - a(5, 5) = 2; - assert (isgray (a), false); -***** test - a = uint8 (randi (255, 10)); - assert (isgray (a), true); - a = int8 (a); - assert (isgray (a), false); -***** test - a = rand (10); - a(50) = NaN; - assert (isgray (a), true); -***** assert (isgray (rand (5, 5, 1, 4)), true); -***** assert (isgray (rand (5, 5, 3, 4)), false); -***** assert (isgray (rand (5, 5, 3)), false); -***** assert (isgray (rand (5, 5, 1, 3, 4)), false); -***** assert (isgray (rand (5, "single")), true) -***** assert (isgray ([.1 .2 .3; .4 NaN .6; .7 .8 .9]), true) -***** assert (isgray ([.1 .2 .3; NA NaN .6; .7 .8 .9]), true) -***** assert (isgray ([.1 .2 .3; NA .5 .6; .7 .8 .9]), true) -***** assert (isgray (NaN (5)), false) -***** assert (isgray (NA (5)), false) -16 tests, 16 passed, 0 known failure, 0 skipped -[inst/fftconvn.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/fftconvn.m -***** function test_shapes (a, b, precision) - shapes = {"valid", "same", "full"}; - for i = 1:3 - shape = shapes{i}; - assert (fftconvn (a, b, shape), convn (a, b, shape), precision); - endfor - assert (fftconvn (a, b), fftconvn (a, b, "full")); -***** endfunction -***** test test_shapes (randi (255, 100), randi (255, 10), 0.1) -***** test test_shapes (randi (255, 100, 100), randi (255, 10, 10), 0.1) -***** test test_shapes (randi (255, 100, 100, 100), randi (255, 10, 10, 10), 0.1) -***** test test_shapes (randi (255, 100, 50, 20), randi (255, 10, 7), 0.1) -***** test test_shapes (randi (255, 100, 50, 20), randi (255, 10), 0.1) -***** test - for s = [55 56 57 58] - test_shapes (randi (255, 200, 200), randi (255, s, s), 0.1) - endfor + a4 = [ + 1 0 1 0 1 0 + 0 0 0 1 0 0 + 0 0 0 0 0 1 + 1 0 1 0 0 0 + 0 1 0 0 0 0 + 0 0 1 0 0 1]; + assert (imregionalmax (a, 4), logical (a4)) + a8 = [ + 1 0 0 0 1 0 + 0 0 0 1 0 0 + 0 0 0 0 0 1 + 0 0 0 0 0 0 + 0 0 0 0 0 0 + 0 0 0 0 0 1]; + assert (imregionalmax (a, 8), logical (a8)) + assert (imregionalmax (a), logical (a8)) ***** test - for s = [203 204 205 206] - test_shapes (randi (255, s, s), randi (255, 52, 52), 0.1) - endfor -***** test test_shapes (randi (255, 100, 100, "uint8"), randi (255, 10, 10, "uint8"), 0.1) -***** test test_shapes (randi (255, 100, 100, "uint8"), randi (255, 10, 10), 0.1) -***** test test_shapes (randi (255, 100, 100, "single"), randi (255, 10, 10, "single"), 0.9) -***** test test_shapes (randi (255, 100, 100, "single"), randi (255, 10, 10), 0.9) -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/immultiply.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/immultiply.m -***** assert (immultiply (uint8 ([255 50]), uint16 ([300 50])), uint8 ([255 255])); # default to first class and truncate -***** assert (immultiply (uint8 ([250 50]), uint16 ([ 3 4]), "uint32"), uint32 ([750 200])); # defining output class works (not in matlab?) -***** assert (immultiply (uint8 ([255 50]), 4), uint8 ([255 200])); # works multiplying by a scalar -***** assert (immultiply (logical ([ 1 0]), uint16 ([300 50])), uint16 ([300 0])); # output class defaults to whatever input is not logical -***** assert (immultiply (logical ([ 1 0]), logical ([ 1 1])), double ([ 1 0])); # tested on matlab for compatibility -5 tests, 5 passed, 0 known failure, 0 skipped + ## test float input images + im0 = peaks (); + im1 = im0 ./ 100; + max_pos_expected = [1000; 1214; 1691; 2353]; + max0 = imregionalmax (im0); + max0_pos = find (max0); + max1 = imregionalmax (im1); + assert (max1, max0) + assert (max0_pos, max_pos_expected) +2 tests, 2 passed, 0 known failure, 0 skipped [inst/regionprops.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/regionprops.m ***** shared bw2d, gray2d, bw2d_over_bb, bw2d_insides @@ -6551,564 +4769,1625 @@ props = regionprops (L, "Centroid"); assert ([props.Centroid], [40.5, 40.5], 1e-10) 87 tests, 86 passed, 1 known failure, 0 skipped -[inst/affine2d.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/affine2d.m +[inst/isind.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/isind.m +***** assert (isind ([]), false); +***** assert (isind (1:10), true); +***** assert (isind (0:10), false); +***** assert (isind (1), true); +***** assert (isind (0), false); +***** assert (isind ([1.3 2.4]), false); +***** assert (isind ([1 2; 3 4]), true); +***** assert (isind (randi (100, 10, 10, 1, 4)), true); +***** assert (isind (randi (100, 10, 10, 3, 4)), false); +***** assert (isind (randi (100, 10, 10, 1, 4, 2)), false); +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/otf2psf.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/otf2psf.m +***** function otf = rand_otf (varargin) + otf = complex (rand (varargin{:}), rand (varargin{:})); +***** endfunction ***** test - theta = 10; - A = [cosd(theta) -sind(theta) 0 - sind(theta) cosd(theta) 0 - 0 0 1]; - tform = affine2d (A); - [X, Y] = transformPointsForward (tform, 5, 10); - assert (X, 6.6605, 1.e-4) - assert (Y, 8.9798, 1.e-4) - - [U, V] = transformPointsInverse (tform, X, Y); - assert (U, 5, 5*eps) - assert (V, 10, 9*eps) - assert (isRigid (tform)) - assert (! isTranslation (tform)) - assert (isSimilarity (tform)) + otf = rand_otf (6, 1); + assert (otf2psf (otf), circshift (ifft (otf), 3), 1e-16); ***** test - theta = 30; - tform = affine2d([ cosd(theta) sind(theta) 0 - -sind(theta) cosd(theta) 0 - 0 0 1]); - assert (tform.T, [ 0.86603 0.5 0 - -0.5 0.86603 0 - 0 0 1], 1.e-5); - invtform = invert(tform); - assert (invtform.T, [ 0.86603 -0.5 0 - 0.5 0.86603 0 - 0 0 1], 1.e-5); - assert (isRigid (tform)) - assert (! isTranslation (tform)) - assert (isSimilarity (tform)) + otf = rand_otf (6, 6); + assert (otf2psf (otf), circshift (ifft2 (otf), [3 3]), eps); ***** test - tform = affine2d ([1 0 0; 0 1 0; 5 10 1]); - [X, Y] = transformPointsForward (tform, [1 2; 3 4; 5 6; 7 8]); - assert (round (X), [6; 8; 10; 12]) - assert (round (Y), [12; 14; 16; 18]) - - [U, V] = transformPointsInverse (tform, X, Y); - assert (round (U), [1; 3; 5; 7]) - assert (round (V), [2; 4; 6; 8]) - assert (isRigid (tform)) - assert (isTranslation (tform)) - assert (isSimilarity (tform)) + otf = rand_otf (6, 6, 6); + assert (otf2psf (otf), circshift (ifftn (otf), [3 3 3]), eps); ***** test - tform = affine2d ([1 1e-16 0; 1e-16 1 0; 5 10 1]); - assert (isRigid (tform)) - tform = affine2d ([2 1e-16 0; 1e-16 1 0; 5 10 1]); - assert (! isRigid (tform)) + otf = rand_otf (7, 1); + assert (otf2psf (otf), circshift (ifft (otf), 3), 2.5e-16); ***** test - theta = 10; - A = [cosd(theta) -sind(theta) 0 - sind(theta) cosd(theta) 0 - 0 0 1]; - tform = affine2d (A); - [xlim, ylim] = outputLimits (tform, [1 240], [1 291]); - assert (xlim, [1.1585 286.8855], 1.e-4) - assert (ylim, [-40.6908 286.4054], 1.e-4) + otf = rand_otf (7, 7); + assert (otf2psf (otf), circshift (ifft2 (otf), [3 3]), 2.5e-16); ***** test - A = [1 0 0 - 0 1 0 - 40 40 1]; - tform = affine2d (A); - assert (isRigid (tform)); - assert (isSimilarity (tform)); - assert (isTranslation (tform)); + otf = rand_otf (6, 7, 8); + assert (otf2psf (otf), circshift (ifftn (otf), [3 3 4]), 2.5e-16); ***** test - a = invert (affine2d ([1 2 0; 3 4 0; 10 20 1])); - b = affine2d(a.T); - assert (b.T, [-2, 1, 0; 1.5, -0.5, 0; -10, 0, 1], 5*eps) -***** assert (isTranslation (affine2d ([1, 0, 0; 0, 1, 0; 40, 40, 1]))) -***** assert (! isTranslation (affine2d ([1 0 0; 0 -1 0; 0 0 1]))) -***** assert (! isRigid (affine2d ([1 0 0; 0 -1 0; 0 0 1]))) -***** error affine2d ([0 0 0; 0 0 0]) -***** error affine2d ([0 0 0 0 0 0 0 0 1]) -***** error affine2d ([0 0 0; 0 0 0; 0 0 0]) -***** error affine2d ([1 0 0; 0 1 1; 0 0 1]) -***** error affine2d ([0 0 0; 0 0 0; 0 0 1]) -***** error affine2d (1, 2) -***** error outputLimits (affine2d()) + otf = rand_otf (7, 1); + ppsf = circshift (ifft (otf), 3); + assert (otf2psf (otf, 6), ppsf(1:6), 2.5e-16); + assert (otf2psf (otf, [6 1]), ppsf(1:6), 2.5e-16); ***** test - tform = affine2d; - assert (tform.T, eye (3)) - assert (tform.Dimensionality, 2) -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/iptcheckmap.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/iptcheckmap.m -***** test ("iptcheckmap (jet(64), 'func', 'var', 2)"); # simple must work -***** fail ("iptcheckmap (3, 'func', 'var', 2)"); # not a colormap -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/qtsetblk.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/qtsetblk.m -***** demo - J=qtsetblk(eye(4),qtdecomp(eye(4)),2,ones(2,2,2)) - % Sets upper-right and lower-left blocks of 2*2 zeros to ones -***** shared A, S - A=[ 1, 4, 2, 5,54,55,61,62; - 3, 6, 3, 1,58,53,67,65; - 3, 6, 3, 1,58,53,67,65; - 3, 6, 3, 1,58,53,67,65; - 23,42,42,42,99,99,99,99; - 27,42,42,42,99,99,99,99; - 23,22,26,25,99,99,99,99; - 22,22,24,22,99,99,99,99]; - S = qtdecomp (A, 10); + otf = rand_otf (7, 7); + ppsf = circshift (ifft2 (otf), [3 3]); + assert (otf2psf (otf, [6 1]), ppsf(1:6,4), 2.5e-16); ***** test - R=A; - vals=zeros(4,4,2); - vals(:,:,1)=reshape([1:16],4,4); - vals(:,:,2)=reshape([21:36],4,4); - R(1:4,1:4)=reshape([1:16],4,4); - R(5:8,5:8)=reshape([21:36],4,4); - assert(qtsetblk(A,S,4,vals),R); + otf = rand_otf (6, 7); + ppsf = circshift (ifft2 (otf), [3 3]); + assert (otf2psf (otf, [6 6]), ppsf(:,1:6), 2.5e-16); +***** error otf2psf ("not a otf") +***** error otf2psf (rand_otf (16), 18) +***** error otf2psf (rand_otf (16), [14 18]) +***** error otf2psf (rand_otf (16), [18 18]) +***** error otf2psf (rand_otf (16, 1), 18) ***** test - R=A; - R(1:4,5:8)=1; - R(7:8,1:4)=1; - R(5:6,3:4)=1; - assert(qtsetblk(A,S,2,ones(2,2,7)),R); + psf = fspecial ("gaussian", 16); + otf = psf2otf (psf); + assert (otf2psf (otf), psf, eps); +***** xtest + psf = rand (16); + otf = psf2otf (psf); + assert (otf2psf (otf), psf, 4*eps); ***** test - R=A; - R(5:6,1:2)=10; - assert(qtsetblk(A,S,1,ones(1,1,4)*10),R); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/affine3d.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/affine3d.m + psf = rand (8); + otf = psf2otf (psf, [16 16]); + assert (otf2psf (otf, [8 8]), psf, 2*eps); +17 tests, 17 passed, 0 known failure, 0 skipped +[inst/xyz2lab.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/xyz2lab.m +***** assert (xyz2lab ([0, 0, 0]), [0 0 0], 5e-2) +***** assert (xyz2lab ([0.4125, 0.2127, 0.0193]), [53.24, 80.09, 67.20], 5e-2) +***** assert (xyz2lab ([0.7700, 0.9278, 0.1385]), [97.14, -21.55, 94.48], 5e-2) +***** assert (xyz2lab ([0.3576, 0.7152, 0.1192]), [87.74, -86.18, 83.18], 5e-2) +***** assert (xyz2lab ([0.5380, 0.7873, 1.0694]), [91.11, -48.09, -14.13], 5e-2) +***** assert (xyz2lab ([0.1804, 0.07217, 0.9502]), [32.30, 79.19, -107.86], 5e-2) +***** assert (xyz2lab ([0.5929, 0.28484, 0.9696]), [60.32, 98.24, -60.83], 5e-2) +***** assert (xyz2lab ([0.9505, 1.0000, 1.0888]), [100, 0.00, 0.00], 5e-2) +***** assert (xyz2lab ([0.2034, 0.2140, 0.2330]), [53.39, 0.00, 0.00], 5e-2) +***** assert (xyz2lab ([0.2155, 0.1111, 0.0101]), [39.77, 64.51, 54.13], 5e-2) +***** assert (xyz2lab ([0.0883, 0.0455, 0.0041]), [25.42, 47.91, 37.91], 5e-2) +***** assert (xyz2lab ([0.02094, 0.0108, 0.00098]), [9.66, 29.68, 15.24], 5e-2) +***** assert (xyz2lab ([0.5276, 0.3812, 0.2482]), [68.11, 48.39, 22.83], 5e-2) +***** assert (xyz2lab ([1.5 1 1]), [100, 82.15, 5.60], 5e-2) + xyz_map = rand (64, 3); + assert (lab2xyz (xyz2lab (xyz_map)), xyz_map, 1e-5); ***** test - Sx = 1.2; - Sy = 1.6; - Sz = 2.4; - A = [Sx 0 0 0; 0 Sy 0 0; 0 0 Sz 0; 0 0 0 1]; - tform = affine3d (A); - [X, Y, Z] = transformPointsForward (tform, 5, 10, 3); - assert ([X Y Z], [6 16 7.2], 5*eps) - [U, V, W] = transformPointsInverse (tform, X, Y, Z); - assert ([U V W], [5 10 3], eps) - assert (! isRigid (tform)) - assert (! isTranslation (tform)) - assert (! isSimilarity (tform)) + xyz_img = rand (64, 64, 3); + assert (lab2xyz (xyz2lab (xyz_img)), xyz_img, 1e-5); +***** assert (xyz2lab (sparse ([0 0 0])), [0 0 0], 5e-2) +***** assert (class (xyz2lab (single([0.5 0.5 0.5]))), 'single') +***** error xyz2lab () +***** error xyz2lab (1,2) +***** error xyz2lab ({1}) +***** error xyz2lab (ones (2,2)) ***** test - A = [3 1 2 0; 4 5 8 0; 6 2 1 0; 0 0 0 1]; - tform = affine3d (A); - [X, Y, Z] = transformPointsForward (tform, 2, 3, 5); - assert (X, 48, eps) - assert (Y, 27, eps) - assert (Z, 33, eps) - [U, V, W] = transformPointsInverse (tform, X, Y, Z); - assert (U, 2, 50*eps) - assert (V, 3, 50*eps) - assert (W, 5, 50*eps) - assert (! isRigid (tform)) - assert (! isTranslation (tform)) - assert (! isSimilarity (tform)) + xyz = rand (16, 16, 3, 5); + lab = zeros (size (xyz)); + for i = 1:5 + lab(:,:,:,i) = xyz2lab (xyz(:,:,:,i)); + endfor + assert (xyz2lab (xyz), lab) +22 tests, 22 passed, 0 known failure, 0 skipped +[inst/checkerboard.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/checkerboard.m +***** demo + ## Simplest case, default checkerboard size: + ## 8 by 8 checkerboard, with squares 10 pixel wide + board = checkerboard (); + imshow (board) +***** demo + ## Simplest case, default checkerboard size: + ## 8 by 16 checkerboard, with squares 5 pixel wide + board = checkerboard (5, 4, 8); + imshow (board) +***** assert (checkerboard (0), zeros (0, 0)) +***** assert (checkerboard (0, 3), zeros (0, 0)) +***** assert (checkerboard (0, 2, 4), zeros (0, 0)) +***** assert (checkerboard (0, 2, 4, 3), zeros (0, 0, 0)) +***** assert (checkerboard (0, 2, 4, 3, 2), zeros (0, 0, 0, 0)) +***** assert (checkerboard (1, 4, 2, 3, 0), zeros (8, 4, 6, 0)) +***** assert (checkerboard (1, 4, 0, 3, 2), zeros (8, 0, 6, 4)) +***** assert (checkerboard (2, 4, 0, 3, 2), zeros (16, 0, 12, 8)) ***** test - A = [1 0 0 0; 0 1 0 0; 0 0 1 0; 5 10 1 1]; - tform = affine3d (A); - X = transformPointsForward (tform, [1 2 3; 4 5 6; 7 8 9]); - assert (round (X), [6, 12, 4; 9, 15, 7; 12, 18, 10]) - U = transformPointsInverse (tform, X); - assert (round (U), [1 2 3; 4 5 6; 7 8 9]) - assert (isRigid (tform)) - assert (isTranslation (tform)) - assert (isSimilarity (tform)) + out = zeros (80); + i1 = ((1:20:80) + (0:9)')(:); + i2 = ((11:20:80) + (0:9)')(:); + out(i1, i2) = 1; + out(i2, i1) = 1; + i1r = ((41:20:80) + (0:9)')(:); + i2r = ((51:20:80) + (0:9)')(:); + out(i2, i1r) = 0.7; + out(i1, i2r) = 0.7; + assert (checkerboard (), out) + assert (checkerboard (10, 4, 4), out) + assert (checkerboard (10, [4 4]), out) + assert (checkerboard (10, [4; 4]), out) ***** test - Sx = 1.2; - Sy = 1.6; - Sz = 2.4; - A = [Sx 0 0 0; 0 Sy 0 0; 0 0 Sz 0; 0 0 0 1]; - tform = affine3d (A); - [xlim, ylim, zlim] = outputLimits (tform, [1 128], [1 128], [1 27]); - assert (xlim, [ 1.2000 153.6000],1e-8) - assert (ylim, [1.6000 204.8000], 1e-8) - assert (zlim, [2.4000 64.8000], 1e-8) -***** error affine3d (1, 2) -***** error outputLimits (affine2d()) + out = zeros (8); + out(2:2:8, 1:2:8) = 1; + out(1:2:8, 2:2:8) = 1; + out(1:2:8, 6:2:8) = 0.7; + out(2:2:8, 5:2:8) = 0.7; + assert (checkerboard (1), out) + assert (checkerboard (1, 4), out) + assert (checkerboard (1, 4, 4), out) + assert (checkerboard (1, [4 4]), out) ***** test - a = 23; - M = [cosd(a) 0 sind(a) 0; - 0 1 0 0; - -sind(a) 0 cosd(a) 0; - 0 0 0 1]; - tform = affine3d (M); - tform2 = invert (tform); - assert (tform.T * tform2.T, diag([1 1 1 1]), eps); + out = zeros (10); + out(2:2:10, 1:2:10) = 1; + out(1:2:10, 2:2:10) = 1; + out(1:2:10, 6:2:10) = 0.7; + out(2:2:10, 7:2:10) = 0.7; + assert (checkerboard (1, 5), out) + assert (checkerboard (1, 5, 5), out) + assert (checkerboard (1, [5 5]), out) ***** test - tform = affine3d; - assert (tform.T, eye (4)) - assert (tform.Dimensionality, 3) -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/lab2double.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2double.m + out = zeros (20); + out([1:4:20 2:4:20], [3:4:20 4:4:20]) = 1; + out([3:4:20 4:4:20], [1:4:20 2:4:20]) = 1; + out([1:4:20 2:4:20], [11:4:20 12:4:20]) = 0.7; + out([3:4:20 4:4:20], [13:4:20 14:4:20]) = 0.7; + assert (checkerboard (2, 5), out) + assert (checkerboard (2, 5, 5), out) + assert (checkerboard (2, [5 5]), out) ***** test - l_max_f = 100 + (25500 / 65280); - ab_max_f = 127 + (255 / 256); - cm = [ - -Inf - Inf - NaN - l_max_f - ab_max_f - -200 - -129 - -128 - -128+(255/65280)*(0.499999) - -128+(255/65280)*(0.500001) # should be 0.5, but float rounding error - -128+(255/65280)*(0.500002) - -127 - -1 - 0 - (100/65280)*(0.499999) - (100/65280)*(0.51) - (100/65280)*(0.500001) - 1 - 99 - 100 - 101 - 126 - 127 - 128 - 254 - 255 - 256 - 257]; - cm = repmat (cm, [1 3]); - im2d = reshape (cm, [7 4 3]); - imnd = permute (im2d, [1 4 3 2]); + out = zeros (4, 4, 4); + out([1 3], 1, [1 3]) = 1; + out([2 4], 2, [1 3]) = 1; + out([1 3], 2, [2 4]) = 1; + out([2 4], 1, [2 4]) = 1; + out([1 3], 3, [1 3]) = 0.7; + out([2 4], 4, [1 3]) = 0.7; + out([1 3], 4, [2 4]) = 0.7; + out([2 4], 3, [2 4]) = 0.7; + assert (checkerboard (1, [2 2 2]), out) + assert (checkerboard (1, 2, 2, 2), out) +***** test + out = zeros (8, 8, 8); + out([1 2 5 6], [1 2], [1 2 5 6]) = 1; + out([3 4 7 8], [3 4], [1 2 5 6]) = 1; + out([1 2 5 6], [3 4], [3 4 7 8]) = 1; + out([3 4 7 8], [1 2], [3 4 7 8]) = 1; + out([1 2 5 6], [5 6], [1 2 5 6]) = 0.7; + out([3 4 7 8], [7 8], [1 2 5 6]) = 0.7; + out([1 2 5 6], [7 8], [3 4 7 8]) = 0.7; + out([3 4 7 8], [5 6], [3 4 7 8]) = 0.7; + assert (checkerboard (2, [2 2 2]), out) + assert (checkerboard (2, 2, 2, 2), out) +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/im2uint8.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/im2uint8.m +***** assert (im2uint8 (uint8 ([1 2 3])), uint8 ([1 2 3])); +***** assert (im2uint8 (uint16 ([0 65535])), uint8 ([0 255])); +***** assert (im2uint8 ([0 0.5 1]), uint8 ([0 128 255])); +***** assert (im2uint8 ([1 2]), uint8 ([255 255])); +***** assert (im2uint8 ([-1 0 0.5 1 2]), uint8 ([0 0 128 255 255])); +***** assert (im2uint8 (int16 ([-32768 0 32768])), uint8 ([0 128 255])); +***** assert (im2uint8 ([false true]), uint8 ([0 255])); +***** assert (im2uint8 ([true false]), uint8 ([255 0])); +***** assert (im2uint8 ([1 256], "indexed"), uint8 ([0 255])); +***** assert (im2uint8 ([3 25], "indexed"), uint8 ([2 24])); +***** assert (im2uint8 (uint16 ([3 25]), "indexed"), uint8 ([3 25])); +***** error im2uint8 ([0 1 2], "indexed"); +***** error im2uint8 (int16 ([17 8]), "indexed"); +***** error im2uint8 (int16 ([-7 8]), "indexed"); +***** error im2uint8 ([false true], "indexed"); +***** error im2uint8 (uint16 (256), "indexed"); +***** error im2uint8 (257, "indexed"); +***** assert (im2uint8 ((1:255) ./ 256), uint8 ([1:128 128:254])) +***** assert (im2uint8 ((0:255) ./ 256), uint8 ([0:128 128:254])) +19 tests, 19 passed, 0 known failure, 0 skipped +[inst/imgradientxy.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imgradientxy.m +***** test + A = [0 1 0 + 1 1 1 + 0 1 0]; - cm_uint8 = uint8 ([ - 0 0 0 - 255 255 255 - 255 255 255 - 255 228 228 - 255 255 255 - 0 0 0 - 0 0 0 - 0 0 0 - 0 0 0 - 0 0 0 - 0 0 0 - 0 1 1 - 0 127 127 - 0 128 128 - 0 128 128 - 0 128 128 - 0 128 128 - 3 129 129 - 252 227 227 - 255 228 228 - 255 229 229 - 255 254 254 - 255 255 255 - 255 255 255 - 255 255 255 - 255 255 255 - 255 255 255 - 255 255 255]); + [gxSobel, gySobel] = imgradientxy (A); + [gxSobel2, gySobel2] = imgradientxy (A, "Sobel"); + assert (gxSobel, + [ 3 0 -3 + 4 0 -4 + 3 0 -3]); + assert (gySobel, + [ 3 4 3 + 0 0 0 + -3 -4 -3]); - assert (lab2uint8 (cm), cm_uint8) - im2d_uint8 = reshape (cm_uint8, [7 4 3]); - assert (lab2uint8 (im2d), im2d_uint8) - assert (lab2uint8 (imnd), permute (im2d_uint8, [1 4 3 2])) + ## test default method + assert(gxSobel, gxSobel2); + assert(gySobel, gySobel2); - cm_uint16 = uint16 ([ - 0 0 0 - 65535 65535 65535 - 65535 65535 65535 - 65535 58468 58468 - 65535 65535 65535 - 0 0 0 - 0 0 0 - 0 0 0 - 0 0 0 - 0 1 1 - 0 1 1 - 0 256 256 - 0 32512 32512 - 0 32768 32768 - 0 32768 32768 - 1 32768 32768 - 1 32768 32768 - 653 33024 33024 - 64627 58112 58112 - 65280 58368 58368 - 65535 58624 58624 - 65535 65024 65024 - 65535 65280 65280 - 65535 65535 65535 - 65535 65535 65535 - 65535 65535 65535 - 65535 65535 65535 - 65535 65535 65535]); + [gxPrewitt, gyPrewitt] = imgradientxy (A, "Prewitt"); + assert (gxPrewitt, + [ 2 0 -2 + 3 0 -3 + 2 0 -2]); + assert (gyPrewitt, + [ 2 3 2 + 0 0 0 + -2 -3 -2]); - assert (lab2uint16 (cm), cm_uint16) - im2d_uint16 = reshape (cm_uint16, [7 4 3]); - assert (lab2uint16 (im2d), im2d_uint16) - assert (lab2uint16 (imnd), permute (im2d_uint16, [1 4 3 2])) + [gxCd, gyCd] = imgradientxy (A, "CentralDifference"); + assert (gxCd, + [ 0.5 0.0 -0.5 + 0.5 0.0 -0.5 + 0.5 0.0 -0.5]); + assert (gyCd, + [ 0.5 0.5 0.5 + 0 0 0 + -0.5 -0.5 -0.5]); - assert (lab2single (cm), single (cm)) - assert (lab2single (im2d), single (im2d)) - assert (lab2single (imnd), single (imnd)) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/@strel/strel.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@strel/strel.m -***** test - shape = logical ([0 0 0 1]); - assert (getnhood (strel (shape)), shape); - assert (getnhood (strel ("arbitrary", shape)), shape); + [gxCd, gyCd] = imgradientxy (A, "Central"); + assert (gxCd, + [ 0.5 0.0 -0.5 + 0.5 0.0 -0.5 + 0.5 0.0 -0.5]); + assert (gyCd, + [ 0.5 0.5 0.5 + 0 0 0 + -0.5 -0.5 -0.5]); - height = [0 0 0 3]; - assert (getnhood (strel ("arbitrary", shape, height)), shape); - assert (getheight (strel ("arbitrary", shape, height)), height); + [gxId, gyId] = imgradientxy(A, "IntermediateDifference"); + assert (gxId, + [ 1 -1 0 + 0 0 -1 + 1 -1 0]); + assert (gyId, + [ 1 0 1 + -1 0 -1 + 0 -1 0]); + + [gxId, gyId] = imgradientxy(A, "Intermediate"); + assert (gxId, + [ 1 -1 0 + 0 0 -1 + 1 -1 0]); + assert (gyId, + [ 1 0 1 + -1 0 -1 + 0 -1 0]); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/entropy.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/entropy.m +***** assert (entropy ([0 1]), 1) +***** assert (entropy (uint8 ([0 1])), 1) +***** assert (entropy ([0 0]), 0) +***** assert (entropy ([0]), 0) +***** assert (entropy ([1]), 0) +***** assert (entropy ([0 .5; 2 0]), 1.5) +***** assert (entropy (repmat ([0 .5; 2 0], 1, 1, 3)), + entropy ([0 .5; 2 0])) ***** test - shape = logical ([0 0 1]); - height = [-2 1 3]; ## this works for matlab compatibility - assert (getnhood (strel ("arbitrary", shape, height)), shape); - assert (getheight (strel ("arbitrary", shape, height)), height); + A = zeros (3,3); + B = ones (3,3); + C = [1 1 1; 2 2 2; 3 3 3]; + D = C'; + E = ones (3,3); + E(2,2)=2; + F = 3 .* ones (3,3); + F(2,2)=1; + G = [-1 2 7; -5 2 8; -7 pi 9]; + H = [5 2 8; 1 -3 1; 5 1 0]; + pG = [1 2] ./ 3; + G_out = -sum (pG.*log2 (pG)); + pH = [2 7] ./ 9; + H_out = -sum (pH.*log2 (pH)); + assert (entropy (A), 0, eps); + assert (entropy (B), 0, eps); + assert (entropy (C), 0, eps); + assert (entropy (D), 0, eps); + assert (entropy (E), 0, eps); + assert (entropy (F), 0, eps); + assert (entropy (G), G_out, eps); + assert (entropy (H), H_out, eps); ***** test - shape = logical ([0 0 0 1 0 0 0 - 0 1 1 1 1 1 0 - 0 1 1 1 1 1 0 - 1 1 1 1 1 1 1 - 0 1 1 1 1 1 0 - 0 1 1 1 1 1 0 - 0 0 0 1 0 0 0]); - height = [ 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 - 0.00000 0.33333 0.66667 0.74536 0.66667 0.33333 0.00000 - 0.00000 0.66667 0.88192 0.94281 0.88192 0.66667 0.00000 - 0.00000 0.74536 0.94281 1.00000 0.94281 0.74536 0.00000 - 0.00000 0.66667 0.88192 0.94281 0.88192 0.66667 0.00000 - 0.00000 0.33333 0.66667 0.74536 0.66667 0.33333 0.00000 - 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000]; - assert (getnhood (strel ("ball", 3, 1)), shape); - assert (getheight (strel ("ball", 3, 1)), height, 0.0001); + A = uint8 (zeros (3,3)); + B = uint8 (ones (3,3)); + C = uint8 ([1 1 1; 2 2 2; 3 3 3]); + D = C'; + E = uint8 (ones (3,3)); + E(2,2)=2; + F = 3 .* uint8 (ones (3,3)); + F(2,2)=1; + G = uint8 ([0 2 7; 0 2 8; 0 3 9]); + H = uint8 ([5 2 8; 1 0 1; 5 1 0]); + pC = [1 1 1] ./ 3; + C_out = -sum (pC.*log2 (pC)); + D_out = C_out; + pE = [8 1] ./ 9; + E_out = -sum (pE.*log2 (pE)); + F_out = E_out; + pG = [3 2 1 1 1 1] ./ 9; + G_out = -sum (pG.*log2 (pG)); + pH = [2 3 1 2 1] ./ 9; + H_out = -sum (pH.*log2 (pH)); + assert (entropy (A), 0); + assert (entropy (B), 0); + assert (entropy (C), C_out, eps); + assert (entropy (D), D_out, eps); + assert (entropy (E), E_out, eps); + assert (entropy (F), F_out, eps); + assert (entropy (G), G_out, eps); + assert (entropy (H), H_out, eps); ***** test - shape = logical ([0 0 0 1 0 0 0 - 0 0 1 1 1 0 0 - 0 1 1 1 1 1 0 - 1 1 1 1 1 1 1 - 0 1 1 1 1 1 0 - 0 0 1 1 1 0 0 - 0 0 0 1 0 0 0]); - assert (getnhood (strel ("diamond", 3)), shape); + L1 = false (3,3); + L1(2,2)=true; + L2 = true (3,3); + L2(2,2)=false; + L3 = logical ([0 1 1; 0 1 1; 0 0 1]); + p12 = [1 8] ./ 9; + out12 = -sum (p12.*log2 (p12)); + p3 = [5 4] ./9; + out3 = -sum (p3.*log2 (p3)); + assert (entropy (L1), out12, eps); + assert (entropy (L2), out12, eps); + assert (entropy (L3), out3, eps); +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/col2im.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/col2im.m +***** demo + ## Divide A using distinct blocks and then reverse the operation + A = [ 1:10 + 11:20 + 21:30 + 31:40]; + B = im2col (A, [2 5], "distinct") + C = col2im (B, [2 5], [4 10], "distinct") +***** demo + ## Get sliding blocks of size from A into columns, calculate the + ## mean of each block (mean of each column), and reconstruct A + ## after a median filter. + A = reshape (1:24, [4 6]) + B = im2col (A, [2 3], "sliding") + C = mean (B); + col2im (C, [1 1], [3 4], "sliding") +***** error col2im (ones (10), [5 5], [10 10], "wrong_block_type"); +***** error col2im (ones (10), [1 1], [ 7 7], "sliding"); +***** error col2im (ones (10), [3 3], [10 10], "distinct") +***** error col2im (ones (10), [5 5], [10 11], "distinct"); +***** assert (col2im (sum (im2col (magic (10), [3 3], "sliding")), [1 1], [8 8]), + convn (magic (10), ones (3, 3), "valid")); ***** test - shape = logical ([0 0 0 1 0 0 0 - 0 1 1 1 1 1 0 - 0 1 1 1 1 1 0 - 1 1 1 1 1 1 1 - 0 1 1 1 1 1 0 - 0 1 1 1 1 1 0 - 0 0 0 1 0 0 0]); - assert (getnhood (strel ("disk", 3, 0)), shape); + B = ones (1, (10-2+1)*(7-3+1)); + A = ones ((10-2+1), (7-3+1)); + assert (col2im (B, [2 3], [10 7]), A); + + ## same but different classes + assert (col2im (int16 (B), [2 3], [10 7]), int16 (A)); + assert (col2im (single (B), [2 3], [10 7]), single (A)); + assert (col2im (logical (B), [2 3], [10 7]), logical (A)); ***** test - shape = logical ([1 1 1]); - assert (getnhood (strel ("line", 3.9, 20.17)), shape); - shape = logical ([0 0 1 - 0 1 0 - 1 0 0]); - assert (getnhood (strel ("line", 3.9, 20.18)), shape); - shape = logical ([1 0 0 0 0 0 0 0 0 - 0 1 0 0 0 0 0 0 0 - 0 0 1 0 0 0 0 0 0 - 0 0 1 0 0 0 0 0 0 - 0 0 0 1 0 0 0 0 0 - 0 0 0 0 1 0 0 0 0 - 0 0 0 0 0 1 0 0 0 - 0 0 0 0 0 0 1 0 0 - 0 0 0 0 0 0 1 0 0 - 0 0 0 0 0 0 0 1 0 - 0 0 0 0 0 0 0 0 1]); - assert (getnhood (strel ("line", 14, 130)), shape); + a = rand (10)(:); + assert (col2im (a, [1 1], [10 10]), col2im (a, [1 1], [10 10], "sliding")) +***** shared A, B + v = [1:10]'; + r = reshape (1:10, [2 5]); + B = [v v+10 v+20 v+30 v+40 v+50]; + A = [r r+30 + r+10 r+40 + r+20 r+50]; + assert (col2im (B, [2 5], [6 10], "distinct"), A); +***** assert (col2im (int16 (B), [2 5], [6 10], "distinct"), int16 (A)); +***** assert (col2im (logical (B), [2 5], [6 10], "distinct"), logical (A)); +***** assert (col2im (single (B), [2 5], [6 10], "distinct"), single (A)); ***** test - se = strel ("octagon", 0); - seq = getsequence (se); - assert (getnhood (se), true (1)); - assert (getnhood (seq(1)), true (1)); + a = rand (10, 8); + b = im2col (a, [5 5], "distinct"); + assert (col2im (b, [5 5], [10 8], "distinct"), a); - se = strel ("octagon", 3); - seq = getsequence (se); - shape = logical ([0 0 1 1 1 0 0 - 0 1 1 1 1 1 0 - 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 - 0 1 1 1 1 1 0 - 0 0 1 1 1 0 0]); - assert (getnhood (se), shape); - assert (size (seq), [4 1]); + a = rand (8); + b = im2col (a, [5 5], "distinct"); + assert (col2im (b, [5 5], [8 8], "distinct"), a); +***** shared a, b + ## Same number of multiple dimensions + a = rand (10, 10, 10); + b = im2col (a, [5 5 5], "distinct"); +***** assert (col2im (b, [5 5 5], [10 10 10], "distinct"), a); - templ1 = logical ([0 0 0; 1 1 1; 0 0 0]); - templ2 = logical ([0 1 0; 0 1 0; 0 1 0]); - templ3 = logical ([1 0 0; 0 1 0; 0 0 1]); - templ4 = logical ([0 0 1; 0 1 0; 1 0 0]); - assert ({getnhood(seq(1)) getnhood(seq(2)) getnhood(seq(3)) getnhood(seq(4))}, - {templ1 templ2 templ3 templ4}); + ## Different number of dimensions + a = rand (10, 10, 10); + b = im2col (a, [5 5], "distinct"); +***** assert (col2im (b, [5 5], [10 10 10], "distinct"), a); - seq = getsequence (strel ("octagon", 21)); - assert (size (seq), [28 1]); - assert (arrayfun (@(x) getnhood (seq(x)), 1:4:25, "UniformOutput", false), - repmat ({templ1}, 1, 7)); - assert (arrayfun (@(x) getnhood (seq(x)), 2:4:26, "UniformOutput", false), - repmat ({templ2}, 1, 7)); - assert (arrayfun (@(x) getnhood (seq(x)), 3:4:27, "UniformOutput", false), - repmat ({templ3}, 1, 7)); - assert (arrayfun (@(x) getnhood (seq(x)), 4:4:28, "UniformOutput", false), - repmat ({templ4}, 1, 7)); + ## Removing padding from multiple dimensions + a = rand (10, 10, 7); + b = im2col (a, [5 5 3], "distinct"); +***** assert (col2im (b, [5 5 3], [10 10 7], "distinct"), a); + + a = rand (10, 10, 7); + b = im2col (a, [5 5 5 2], "distinct"); +***** assert (col2im (b, [5 5 5 2], [10 10 7], "distinct"), a); +15 tests, 15 passed, 0 known failure, 0 skipped +[inst/roicolor.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/roicolor.m +***** demo + roicolor([1:10],2,4); + % Returns '1' where input values are between 2 and 4 (both included). +***** assert(roicolor([1:10],2,4),logical([0,1,1,1,zeros(1,6)])); +***** assert(roicolor([1,2;3,4],3,3),logical([0,0;1,0])); +***** assert(roicolor([1,2;3,4],[1,4]),logical([1,0;0,1])); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/imregionalmin.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imregionalmin.m ***** test - shape = logical ([1 1 0]'); - assert (getnhood (strel ("pair", [-1 0])), shape); - shape = logical ([1 0 0 0 0 0 0 - 0 0 0 1 0 0 0 - 0 0 0 0 0 0 0]); - assert (getnhood (strel ("pair", [-1 -3])), shape); - shape = logical ([0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 1 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 1]); - assert (getnhood (strel ("pair", [2 3])), shape); + a = [ + 7 3 9 3 10 3 + 4 2 3 10 1 3 + 1 4 6 9 4 10 + 8 7 9 3 4 8 + 5 9 3 3 8 9 + 3 6 9 4 1 10]; + + a4 = logical ([ + 0 0 0 1 0 0 + 0 1 0 0 1 0 + 1 0 0 0 0 0 + 0 0 0 1 0 0 + 0 0 1 1 0 0 + 1 0 0 0 1 0]); + assert (imregionalmin (a, 4), a4) + assert (imregionalmin (uint8 (a), 4), a4) + assert (imregionalmin (int8 (a), 4), a4) + + a8 = logical ([ + 0 0 0 0 0 0 + 0 0 0 0 1 0 + 1 0 0 0 0 0 + 0 0 0 0 0 0 + 0 0 0 0 0 0 + 1 0 0 0 1 0]); + assert (imregionalmin (a), a8) + assert (imregionalmin (a, 8), a8) + assert (imregionalmin (uint8 (a), 8), a8) + assert (imregionalmin (int8 (a), 8), a8) ***** test - assert (getnhood (strel ("rectangle", [10 5])), true (10, 5)); - assert (getnhood (strel ("square", 5)), true (5)); -***** shared se, seq - se = strel ("square", 5); - seq = getsequence (se); - assert (class (se(1)), "strel") - assert (class (se(1,1)),"strel") - assert (class (seq), "strel") - assert (class (seq(1)), "strel") - assert (class (seq(2)), "strel") - assert (numel (se), 1) - assert (numel (seq), 2) - assert (getnhood (seq(1)), true (5, 1)) - assert (getnhood (seq(2)), true (1, 5)) - assert (size (se), [1 1]) - assert (size (seq), [2 1]) - assert (isscalar (se), true) - assert (isscalar (seq), false) -***** error se(2); -***** error seq(3); + a = [ + 4 8 5 -1 8 7 + -1 4 0 7 1 1 + 6 1 2 6 7 0 + 6 1 5 -2 5 9 + 1 4 -1 0 0 2 + 4 6 1 0 7 1]; + + a4 = logical ([ + 0 0 0 1 0 0 + 1 0 1 0 0 0 + 0 1 0 0 0 1 + 0 1 0 1 0 0 + 1 0 1 0 0 0 + 0 0 0 0 0 1]); + assert (imregionalmin (a, 4), a4) + assert (imregionalmin (int8 (a), 4), a4) + + a8 = logical ([ + 0 0 0 1 0 0 + 1 0 0 0 0 0 + 0 0 0 0 0 1 + 0 0 0 1 0 0 + 0 0 0 0 0 0 + 0 0 0 0 0 0]); + assert (imregionalmin (a), a8) + assert (imregionalmin (a, 8), a8) + assert (imregionalmin (int8 (a), 8), a8) ***** test - se = strel ("arbitrary", [1 0 0; 1 1 0; 0 1 0], [2 0 0; 3 1 0; 0 3 0]); - ref = reflect (se); - assert (getnhood (ref), logical([0 1 0; 0 1 1; 0 0 1])); - assert (getheight (ref), [0 3 0; 0 1 3; 0 0 2]); -***** error strel() -***** error strel("nonmethodthing", 2) -***** error strel("arbitrary", "stuff") -***** error strel("arbitrary", [0 0 1], [2 0 1; 4 5 1]) -***** error strel("arbitrary", [0 0 1], "stuff") -***** error strel("ball", -3, 1) -***** error strel("diamond", -3) -***** error strel("disk", -3) -***** error strel("line", 0, 45) -***** error strel("octagon", 3.5) -***** error strel("octagon", 4) -***** error strel("octagon", -1) -***** error strel("pair", [45 67 90]) -***** error strel("rectangle", 2) -***** error strel("rectangle", [2 -5]) -***** error strel("square", [34 1-2]) -28 tests, 28 passed, 0 known failure, 0 skipped -[inst/colorangle.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/colorangle.m -***** error id=Octave:invalid-fun-call colorangle () -***** error id=Octave:invalid-fun-call colorangle (1, 2, 3) -***** error colorangle (2, 3) -***** error colorangle ([1, 2], [3, 4]) -***** error id=Octave:expected-real colorangle ([1, 2, 3j], [4, 5, 6]) -***** error id=Octave:expected-real colorangle ([1, 2, 3], [4j, 5, 6]) -***** error id=Octave:invalid-type colorangle ("abc", "def") + ## test float input images + im0 = peaks (); + im1 = im0 ./ 100; + max_pos_expected = [1; 49; 664; 1286; 1302; 2401]; + max0 = imregionalmin (im0); + max0_pos = find (max0); + max1 = imregionalmin (im1); + assert (max1, max0) + assert (max0_pos, max_pos_expected) +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/bwperim.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwperim.m ***** test - assert (colorangle ([0 0 0], [0 1 0]), NaN) - assert (colorangle ([0 0 0], [0 1 1]), NaN) - assert (colorangle ([0 1 0], [0 0 0]), NaN) - assert (colorangle ([1 1 0], [0 0 0]), NaN) - assert (colorangle ([1 1 1], [1 1 1]), 0) -***** assert (colorangle ([0 0 0], [0 0 0]), 0) -***** assert (colorangle ([1 0 0], [-1 0 0]), 180) -***** assert (colorangle ([0 0 1], [1 0 0]), 90) -***** assert (colorangle ([0; 0; 1], [1 0 0]), 90) -***** assert (colorangle ([0, 0, 1], [1; 0; 0]), 90) -***** assert (colorangle ([0.5 0.61237 -0.61237], [0.86603 0.35355 -0.35355]), 30.000270917, 1e-4) -***** assert (colorangle ([0.1582055390, 0.2722362096, 0.1620813305], [0.0717 0.1472 0.0975]), 5.09209927, 1e-6) -***** assert (colorangle ([0.0659838500, 0.1261619536, 0.0690643667], [0.0717 0.1472 0.0975]), 5.10358588, 1e-6) -***** assert (colorangle ([0.436871170, 0.7794672250, 0.4489702582], [0.0717 0.1472 0.0975]), 5.01339769, 1e-6) + in = [ 1 1 1 1 0 1 1 0 1 1 + 1 1 0 1 1 1 1 1 1 0 + 1 1 1 0 1 1 1 1 1 1 + 1 1 1 1 0 1 1 1 0 1 + 1 1 1 0 1 1 1 1 1 0 + 1 1 1 1 1 1 0 1 0 1 + 1 1 1 1 1 1 1 1 1 0 + 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 0 0 1 1 + 1 1 1 1 0 1 0 1 1 0]; + + out = [1 1 1 1 0 1 1 0 1 1 + 1 1 0 1 1 0 0 1 1 0 + 1 0 1 0 1 0 0 0 1 1 + 1 0 0 1 0 1 0 1 0 1 + 1 0 1 0 1 0 1 0 1 0 + 1 0 0 1 0 1 0 1 0 1 + 1 0 0 0 0 0 1 0 1 0 + 1 0 0 0 0 0 1 1 0 1 + 1 0 0 0 1 1 0 0 1 1 + 1 1 1 1 0 1 0 1 1 0]; + assert (bwperim (in), logical (out)) + assert (bwperim (in, 4), logical (out)) + + out = [1 1 1 1 0 1 1 0 1 1 + 1 1 0 1 1 1 1 1 1 0 + 1 1 1 0 1 1 0 1 1 1 + 1 0 1 1 0 1 0 1 0 1 + 1 0 1 0 1 1 1 1 1 0 + 1 0 1 1 1 1 0 1 0 1 + 1 0 0 0 0 1 1 1 1 0 + 1 0 0 0 0 1 1 1 1 1 + 1 0 0 1 1 1 0 0 1 1 + 1 1 1 1 0 1 0 1 1 0]; + assert (bwperim (in, 8), logical (out)) + + out = [1 1 1 1 0 1 1 0 1 1 + 1 0 0 0 0 1 0 0 1 0 + 1 0 0 0 0 0 0 1 0 1 + 1 0 1 0 0 0 0 0 0 1 + 1 0 0 0 0 1 0 1 0 0 + 1 0 0 0 1 0 0 0 0 1 + 1 0 0 0 0 0 0 1 0 0 + 1 0 0 0 0 1 1 0 0 1 + 1 0 0 1 0 1 0 0 1 1 + 1 1 1 1 0 1 0 1 1 0]; + assert (bwperim (in, [1 0 0; 0 1 0; 0 0 1]), logical (out)) ***** test - a = [1 0 0]; - b = [1 1 0]; - expected = colorangle (a, b); - assert (colorangle (a.', b.'), expected) - assert (colorangle (a, b.'), expected) - assert (colorangle (a.', b), expected) - assert (colorangle (vec (a, 3), b.'), expected) -***** assert (colorangle ([1 0 0; 0 1 1], [1 1 1; 2 3 4]), - [colorangle([1 0 0], [1 1 1]); colorangle([0 1 1], [2 3 4])]) + in = [ 0 0 0 0 0 0 0 + 0 0 5 0 0 1 9 + 0 Inf 9 7 0 0 0 + 0 1.5 5 7 1 0 0 + 0 0.5 -1 89 i 0 0 + 0 4 10 15 1 0 0 + 0 0 0 0 0 0 0]; + out = [0 0 0 0 0 0 0 + 0 0 1 0 0 1 1 + 0 1 0 1 0 0 0 + 0 1 0 0 1 0 0 + 0 1 0 0 1 0 0 + 0 1 1 1 1 0 0 + 0 0 0 0 0 0 0]; + assert (bwperim (in), logical (out)) ***** test - a = [1 0 0; 0.5 1 0; 0 1 1; 1 1 1]; - b = [0 1 0]; - expected = zeros (4, 1); - for i = 1:4 - expected(i) = colorangle (a(i,:), b); + in = reshape (magic(16), [8 8 4]) > 50; + out(:,:,1) = [ + 1 1 0 1 0 1 1 1 + 0 1 1 1 1 1 0 1 + 0 1 1 1 1 1 0 1 + 1 1 0 1 1 1 1 1 + 1 1 1 1 1 1 1 1 + 1 1 1 0 1 0 1 1 + 1 1 1 0 1 0 1 1 + 1 0 1 1 1 1 1 0]; + out(:,:,2) = [ + 1 1 0 1 0 1 1 1 + 0 1 1 0 1 1 0 1 + 0 1 0 0 0 1 0 1 + 1 0 1 0 0 0 1 1 + 1 0 0 1 0 1 0 1 + 1 0 1 0 1 0 1 1 + 1 1 1 0 1 0 1 1 + 1 0 1 1 1 1 1 0]; + out(:,:,3) = [ + 1 1 0 1 0 1 1 1 + 0 1 1 0 1 1 0 1 + 0 1 0 0 0 1 0 1 + 1 0 0 0 0 0 1 1 + 1 0 0 1 0 1 0 1 + 1 0 1 0 1 0 1 1 + 1 1 1 0 1 0 1 1 + 1 0 1 1 1 1 1 0]; + out(:,:,4) = [ + 1 1 0 1 0 1 1 1 + 0 1 1 1 1 1 0 1 + 0 1 1 1 1 1 0 1 + 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 0 + 1 1 1 0 1 0 1 1 + 1 1 1 0 1 0 1 1 + 1 0 1 1 1 1 1 0]; + assert (bwperim (in), logical (out)) + + out(:,:,1) = [ + 1 1 0 1 0 1 1 1 + 0 1 1 1 1 1 0 1 + 0 1 1 1 1 1 0 1 + 1 1 0 1 1 1 1 1 + 1 1 1 1 1 1 1 1 + 1 1 1 0 1 0 1 1 + 1 1 1 0 1 0 1 1 + 1 0 1 1 1 1 1 0]; + out(:,:,2) = [ + 1 1 0 1 0 1 1 1 + 0 1 1 1 1 1 0 1 + 0 1 1 0 0 1 0 1 + 1 1 1 1 0 1 1 1 + 1 0 1 1 1 1 1 1 + 1 0 1 0 1 0 1 1 + 1 1 1 0 1 0 1 1 + 1 0 1 1 1 1 1 0]; + out(:,:,3) = [ + 1 1 0 1 0 1 1 1 + 0 1 1 1 1 1 0 1 + 0 1 0 0 0 1 0 1 + 1 1 0 0 0 1 1 1 + 1 0 1 1 1 1 1 1 + 1 0 1 0 1 0 1 1 + 1 1 1 0 1 0 1 1 + 1 0 1 1 1 1 1 0]; + out(:,:,4) = [ + 1 1 0 1 0 1 1 1 + 0 1 1 1 1 1 0 1 + 0 1 1 1 1 1 0 1 + 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 0 + 1 1 1 0 1 0 1 1 + 1 1 1 0 1 0 1 1 + 1 0 1 1 1 1 1 0]; + assert (bwperim (in, 18), logical (out)) +***** error bwperim ("text") +***** error bwperim (rand (10), 5) +***** error bwperim (rand (10), "text") +***** test + a = false (5); + a(1:4,2:4) = true; + + p = false (5); + p(1:4,[2 4]) = true; + assert (bwperim (a, [0 0 0; 1 1 1; 0 0 0]), p) +***** test + a = false (8, 8, 5); + a(4:5,4:5,2:4) = true; + a(2:7,2:7,3) = true; + assert (bwperim (a, 26), a) + + ## It is easy to forget that is correct + b = a; + b(4:5, 4:5, 3) = false; + assert (bwperim (a), b) + + c = a; + c(3:6,3:6,3) = false; + assert (bwperim (a, 4), c) +***** test + conn_self = logical ([0 0 0; 0 1 0; 0 0 0]); + assert (bwperim (true), true) + assert (bwperim (true, conn_self), false) + assert (bwperim (true (1, 6)), true (1, 6)) + assert (bwperim (true (1, 6), conn_self), false (1, 6)) + assert (bwperim (true (6, 1)), true (6, 1)) + + bw_3d = true (1, 1, 6); + assert (bwperim (bw_3d), bw_3d) + assert (bwperim (bw_3d, conn_self), false (1, 1, 6)) + assert (bwperim (bw_3d, true (3)), bw_3d) + + perim_3d = bw_3d; + perim_3d(1, 1, 2:end-1) = false; + conn_3d = false (3, 3, 3); + conn_3d(2, 2, :) = true; + assert (bwperim (true (1, 1, 6), conn_3d), perim_3d) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/imshear.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imshear.m +***** error imshear () +***** error imshear (1) +***** error imshear (1, "x") +***** error imshear (1, "x", 3, "loose", 5, 6) +***** error imshear ("foo", "x", 3) +***** error imshear ({1, 2, 3}, "x", 3) +***** error imshear (reshape (1:24, 4, 3, 2), "x", 3) +***** error imshear (reshape (1:24, 2, 3, 2, 2), "x", 3) +***** error imshear (1, "Z", 3) +***** error imshear (1, "x", "foo") +***** error imshear (1, "x", "f") +***** error imshear (1, "x", [1, 2, 3]) +***** error imshear (1, "x", {3}) +***** error imshear (1, "x", 3, "foo") +***** error imshear (1, "x", 3, "loose", 7) +***** error imshear (1, "x", 3, "loose", "foo") +***** error imshear (1, "x", 3, "loose", [1 0]) +17 tests, 17 passed, 0 known failure, 0 skipped +[inst/lab2xyz.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2xyz.m +***** assert (lab2xyz ([0, 0, 0]), [0 0 0], 1e-3) +***** assert (lab2xyz ([53.24, 80.09, 67.20]), [0.4125, 0.2127, 0.0193], 1e-3) +***** assert (lab2xyz ([97.14, -21.55, 94.48]), [0.7700, 0.9278, 0.1385], 1e-3) +***** assert (lab2xyz ([87.74, -86.18, 83.18]), [0.3576, 0.7152, 0.1192], 1e-3) +***** assert (lab2xyz ([91.11, -48.09, -14.13]), [0.5380, 0.7873, 1.0694], 1e-3) +***** assert (lab2xyz ([32.30, 79.19, -107.86]), [0.1804, 0.07217, 0.9502], 1e-3) +***** assert (lab2xyz ([60.32, 98.24, -60.83]), [0.5929, 0.28484, 0.9696], 1e-3) +***** assert (lab2xyz ([100, 0.00, 0.00]), [0.9505, 1.0000, 1.0888], 1e-3) +***** assert (lab2xyz ([53.39, 0.00, 0.00]), [0.2034, 0.2140, 0.2330], 1e-3) +***** assert (lab2xyz ([39.77, 64.51, 54.13]), [0.2155, 0.1111, 0.0101], 1e-3) +***** assert (lab2xyz ([25.42, 47.91, 37.91]), [0.0883, 0.0455, 0.0041], 1e-3) +***** assert (lab2xyz ([9.66, 29.68, 15.24]), [0.02094, 0.0108, 0.00098], 1e-3) +***** assert (lab2xyz ([68.11, 48.39, 22.83]), [0.5276, 0.3812, 0.2482], 1e-3) +***** assert (lab2xyz ([150 130 130]), [4.596, 2.931, 0.519], 1e-3) +***** test + lab_map = rand (64, 3); + lab_map(:,1) = lab_map(:,1) .* 100; + lab_map(:,2) = lab_map(:,2) .* 254 - 127; + lab_map(:,3) = lab_map(:,3) .* 254 - 127; + assert (xyz2lab (lab2xyz (lab_map)), lab_map, 1e-5); +***** test + lab_img = rand (64, 64, 3); + lab_img(:,:,1) = lab_img(:,:,1) .* 100; + lab_img(:,:,2) = lab_img(:,:,2) .* 254 - 127; + lab_img(:,:,3) = lab_img(:,:,3) .* 254 - 127; + assert (xyz2lab (lab2xyz (lab_img)), lab_img, 1e-5); +***** assert (lab2xyz (sparse ([0 0 0])), [0 0 0], 1e-3) +***** assert (lab2xyz (sparse ([100, 0.00, 0.00])), [0.9505, 1.0000, 1.0888], 1e-3) +***** assert (class (lab2xyz (single([50 50 50]))), 'single') +***** error lab2xyz () +***** error lab2xyz (1,2) +***** error lab2xyz ({1}) +***** error lab2xyz (ones (2,2)) +***** test + lab = rand (16, 16, 3, 5); + lab(:,:,1,:) = lab(:,:,1,:) .* 100; + lab(:,:,2,:) = lab(:,:,2,:) .* 254 - 127; + lab(:,:,3,:) = lab(:,:,3,:) .* 254 - 127; + xyz = zeros (size (lab)); + for i = 1:5 + xyz(:,:,:,i) = lab2xyz (lab(:,:,:,i)); endfor - assert (colorangle (a, b), expected) - assert (colorangle (b, a), expected) + assert (lab2xyz (lab), xyz) +24 tests, 24 passed, 0 known failure, 0 skipped +[inst/immultiply.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/immultiply.m +***** assert (immultiply (uint8 ([255 50]), uint16 ([300 50])), uint8 ([255 255])); # default to first class and truncate +***** assert (immultiply (uint8 ([250 50]), uint16 ([ 3 4]), "uint32"), uint32 ([750 200])); # defining output class works (not in matlab?) +***** assert (immultiply (uint8 ([255 50]), 4), uint8 ([255 200])); # works multiplying by a scalar +***** assert (immultiply (logical ([ 1 0]), uint16 ([300 50])), uint16 ([300 0])); # output class defaults to whatever input is not logical +***** assert (immultiply (logical ([ 1 0]), logical ([ 1 1])), double ([ 1 0])); # tested on matlab for compatibility +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/radon.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/radon.m +***** test + A = radon (ones (2,2), 30); + assert (A, [0 0 0.608253175473055 2.103325780167649 1.236538105676658 0.051882938682637 0]',1e-10) +***** test +***** # testing all types + A = radon (single (ones (2,2)), 90); + assert (A, B) + A = radon (double (ones (2,2)), 90); + assert (A, B) + A = radon (int8 (ones (2,2)), 90); + assert (A, B) + A = radon (int32 (ones (2,2)), 90); + assert (A, B) + A = radon (int64 (ones (2,2)), 90); + assert (A, B) + A = radon (uint8 (ones (2,2)), 90); + assert (A, B) + A = radon (uint16 (ones (2,2)), 90); + assert (A, B) + A = radon (uint32 (ones (2,2)), 90); + assert (A, B) + A = radon (uint64 (ones (2,2)), 90); + B = [0, 0.25, 1.75, 1.75, 0.25, 0. 0.]'; + assert (A, B) + bug #58567 + A = radon (logical (ones (2,2)), 90); + assert (A, B) +***** error + radon (); +***** error + radon ('xxx'); +***** error + radon (ones (2, 2), ones (2,2)); +***** error + radon (ones (2, 2), 'xxx'); +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/imfuse.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imfuse.m +***** error id=Octave:invalid-fun-call imfuse () +***** error id=Octave:invalid-input-arg imfuse (1, 1, "xxx") +***** error id=Octave:invalid-input-arg imfuse (1, 1, "interpolation") +***** error id=Octave:invalid-input-arg imfuse (1, 1, "ColorChannels", [0 0 0]) +***** error id=Octave:invalid-input-arg imfuse (1, 1, "ColorChannels", [1 1 1]) +***** error id=Octave:invalid-input-arg imfuse (1, 1, "ColorChannels", [2 2 2]) +***** error id=Octave:expected-less-equal imfuse (1, 1, "ColorChannels", [42 0 0]) +***** error id=Octave:expected-greater-equal imfuse (1, 1, "ColorChannels", [-1 2 0]) +***** error id=Octave:invalid-input-arg imfuse (1, 1, "ColorChannels", "deep-purple") +***** assert (imfuse (1, 2, "blend"), uint8 (0)) +***** assert (imfuse (1, 2, "blend", "Scaling", "independent"), uint8 (0)) +***** assert (imfuse (1, 2, "blend", "Scaling", "joint"), uint8 (128)) +***** assert (imfuse (1, 2, "blend", "Scaling", "none"), uint8 (255)) +***** assert (imfuse (1, 2, "falsecolor"), uint8 (zeros (1, 1, 3))) +***** test + a = [0 1 2]; + b = [0 10 20]; + expected = uint8 (repmat ([0 128 255], [1 1 3])); + assert (imfuse (a, b), expected); +***** test + a = uint8 ([0 1 2]); + b = uint8 ([0 10 20]); + expected = uint8 (repmat ([0 128 255], [1 1 3])); + assert (imfuse (a, b), expected); +***** test + a = uint8 ([0 1 2]); + b = uint8 ([0 10 20]); + expected = uint8 (repmat ([0 128 255], [1 1 3])); + assert (imfuse (a, b, "falsecolor"), expected); +***** test + a = logical([0 1 1]); + b = logical([0 1 1]); + expected = uint8 (repmat ([0 255 255], [1 1 3])); + assert (imfuse (a, b), expected); +***** test + a = logical([0 1 1]); + b = logical([0 1 1]); + expected = uint8 (repmat ([0 255 255], [1 1 3])); + assert (imfuse (a, b, "falsecolor"), expected); +***** test + a = [0 1 2]; + b = [0 10 20]; + expected = uint8 (repmat ([0 255 255], [1 1 3])); + assert (imfuse (a, b, "Scaling", "none"), expected); +***** test + a = uint8 ([0 1 2]); + b = uint8 ([0 10 20]); + expected = uint8 (zeros ([1, 3, 3])); + expected(:, :, 1) = [0 10 20]; + expected(:, :, 2) = [0 1 2]; + expected(:, :, 3) = [0 10 20]; + assert (imfuse (a, b, "Scaling", "none"), expected); +***** test + a = [0 1 2]; + b = uint8 ([0 10 20]); + expected = uint8 (zeros ([1, 3, 3])); + expected(:, :, 1) = [0 10 20]; + expected(:, :, 2) = [0 255 255]; + expected(:, :, 3) = [0 10 20]; + assert (imfuse (a, b, "Scaling", "none"), expected); +***** test + a = uint8 ([0 1 2]); + b = [0 10 20]; + expected = uint8 (zeros ([1, 3, 3])); + expected(:, :, 1) = [0 255 255]; + expected(:, :, 2) = [0 1 2]; + expected(:, :, 3) = [0 255 255]; + assert (imfuse (a, b, "Scaling", "none"), expected); +***** test + a = [0 .1 2]; + b = [0 .01 .02]; + expected = uint8 (zeros ([1, 3, 3])); + expected(:, :, 1) = [0 3 5]; + expected(:, :, 2) = [0 26 255]; + expected(:, :, 3) = [0 3 5]; + assert (imfuse (a, b, "Scaling", "none"), expected); +***** test + a = [0 1 2]; + b = [0 10 20]; + expected = uint8 (zeros ([1, 3, 3])); + expected(:, :, 1) = [0 128 255]; + expected(:, :, 2) = [0 13 26]; + expected(:, :, 3) = [0 128 255]; + assert (imfuse (a, b, "Scaling", "joint"), expected); +***** test + a = uint8 ([0 1 2]); + b = [0 10 20]; + expected = uint8 (zeros ([1, 3, 3])); + expected(:, :, 1) = [0 128 255]; + expected(:, :, 2) = [0 13 26]; + expected(:, :, 3) = [0 128 255]; + assert (imfuse (a, b, "Scaling", "joint"), expected); +***** test + a = [0 150 300]; + b = uint8 ([0 10 20]); + expected = uint8 (zeros ([1, 3, 3])); + expected(:, :, 1) = [0 9 17]; + expected(:, :, 2) = [0 128 255]; + expected(:, :, 3) = [0 9 17]; + assert (imfuse (a, b, "Scaling", "joint"), expected); +***** test + a = uint8 ([0 1 2]); + b = uint8 ([0 10 20]); + expected = uint8 (zeros ([1, 3, 3])); + expected(:, :, 1) = [0 128 255]; + expected(:, :, 2) = [0 13 26]; + expected(:, :, 3) = [0 128 255]; + assert (imfuse (a, b, "Scaling", "joint"), expected); +***** test + a = [0 1 2]; + b = [0 10 20]; + expected = uint8 (zeros ([1, 3, 3])); + expected(:, :, 1) = [0 0 0]; + expected(:, :, 2) = [0 128 255]; + expected(:, :, 3) = [0 13 26]; + assert (imfuse (a, b, "Scaling", "joint", "ColorChannels", [0 2 1]), expected); +***** test + a = [0 1 2]; + b = [0 10 15]; + c = imfuse (a, b, "ColorChannels", "red-cyan"); + expected = uint8 (zeros (1, 3, 3)); + expected(:, :, 1) = [0 128 255]; + expected(:, :, 2) = [0 170 255]; + expected(:, :, 3) = [0 170 255]; + assert (c, expected); +***** test + a = [0 1 2]; + b = [0 10 15]; + c = imfuse (a, b, "ColorChannels", "green-magenta"); + expected = uint8 (zeros (1, 3, 3)); + expected(:, :, 1) = [0 170 255]; + expected(:, :, 2) = [0 128 255]; + expected(:, :, 3) = [0 170 255]; + assert (c, expected); +***** test + a = [0 5 2]; + b = [0 10 20]; + assert (imfuse (a, b, "diff"), uint8 ([0 213 255])); +***** test + a = [0 5 2]; + b = [0 10 20]; + assert (imfuse (a, b, "diff", "Scaling", "joint"), uint8 ([0 71 255])); +***** test + a = [0 5 2]; + b = [0 10 20]; + assert (imfuse (a, b, "blend"), uint8 ([0 192 179])); +***** test + a = magic (5); + b = a'; + c = imfuse (a, b, "falsecolor"); + expected = zeros (5, 5, 3); + expected(:, :, 1) = [ + 170 234 32 96 106 + 244 43 53 117 181 + 0 64 128 191 255 + 74 138 202 213 11 + 149 159 223 21 85]; + expected(:, :, 2) = [ + 170 244 0 74 149 + 234 43 64 138 159 + 32 53 128 202 223 + 96 117 191 213 21 + 106 181 255 11 85]; + expected(:, :, 3) = [ + 170 234 32 96 106 + 244 43 53 117 181 + 0 64 128 191 255 + 74 138 202 213 11 + 149 159 223 21 85]; + assert (c, uint8 (expected)); +***** test + a = magic (5); + b = a'; + assert (imfuse (uint8 (a), uint8 (b), "blend", "Scaling", "none"), + uint8 ([17 24 3 9 13 + 24 5 7 13 17 + 3 7 13 20 24 + 9 13 20 21 3 + 13 17 24 3 9])); +***** test + a = magic (5); + b = 2 * a'; + assert (imfuse (a, b, "blend", "Scaling", "independent"), + uint8 ([170 239 16 85 128 + 239 43 59 128 170 + 16 59 128 197 239 + 85 128 197 213 16 + 128 170 239 16 85])); +***** test + a = magic (5); + b = 2 * a'; + assert (imfuse (a, b, "blend", "Scaling", "joint"), + uint8 ([128 177 18 68 91 + 180 34 44 94 130 + 11 47 96 146 182 + 63 99 149 159 13 + 102 125 175 16 65])); +***** test + a = [0 1.2 5]; + b = [5 6.13 12]; + assert (imfuse (a, b, "blend"), uint8 ([0 51 255])); +***** test + a = [0 5 2]; + b = [0 10 20]; + assert (imfuse (a, b, "blend", "Scaling", "joint"), uint8 ([0 96 141])); +***** test + a = [0 5 2]; + b = [0 10 20]; + assert (imfuse (a, b, "montage"), uint8 ([0 255 102 0 128 255])); +***** test + a = zeros (1, 100); + b = 2 * ones (1, 100); + assert (imfuse (a, b, "montage"), uint8 ([zeros(1, 200)])); + assert (imfuse (a, b, "montage", "Scaling", "none"), + uint8 ([zeros(1, 100), 255 * ones(1, 100)])); +***** test + a = zeros (1, 100, 3); + b = 2 * ones (1, 100); + assert (imfuse (a, b, "montage"), uint8 ([zeros(1, 200, 3)])); +***** test + a = 0.1 * ones (50, 50); + b = 0.2 * ones (50, 50); + c = imfuse (a, b, "checkerboard", "Scaling", "none"); + d = imresize (repmat([26, 51; 51, 26], [8, 8]), [50, 50], "nearest"); + assert (all (c(:) == d(:))); +***** test + a = zeros (2, 2); + b = zeros (2, 2); + ra = imref2d (size (a), [0, 2], [0, 2]); + rb = imref2d (size (b), [0, 2], [2, 4]); + [c, rc] = imfuse (a, ra, b, rb, "falsecolor"); + assert (rc.ImageSize, [4, 2]); + assert (rc.XWorldLimits, [0, 2]); + assert (rc.YWorldLimits, [0, 4]); + assert (rc.PixelExtentInWorldX, 1); + assert (rc.PixelExtentInWorldY, 1); + assert (rc.ImageExtentInWorldX, 2); + assert (rc.ImageExtentInWorldY, 4); + assert (rc.XIntrinsicLimits, [0.5, 2.5]); + assert (rc.YIntrinsicLimits, [0.5, 4.5]); + assert (c, uint8 (zeros (4, 2, 3))); ***** xtest - a = [1 2 3]; - b = [2 3 4]; - c = [5 6 7]; - d = [3 1 1]; + a = zeros (5, 3); + b = ones (6, 5); + ra = imref2d (size (a), [15, 30], [2, 4]); + rb = imref2d (size (b), [10, 50], [5.5, 6.7]); + [c, rc] = imfuse (a, ra, b, rb, "falsecolor"); + assert (rc.ImageSize, [24, 8]); + assert (rc.XWorldLimits, [10, 50]); + assert (rc.YWorldLimits, [2, 6.7]); + assert (rc.PixelExtentInWorldX, 5); + assert (rc.PixelExtentInWorldY, 0.19583333, 10e-9); + assert (rc.ImageExtentInWorldX, 40); + assert (rc.ImageExtentInWorldY, 4.7); + assert (rc.XIntrinsicLimits, [0.5, 8.5]); + assert (rc.YIntrinsicLimits, [0.5, 24.5]); + expected = uint8 (zeros (24, 8, 3)); + expected(19:23, 2:7, 1) = 255 * ones (5, 6); + expected(19:23, 2:7, 3) = 255 * ones (5, 6); + assert (c, expected); +!!!!! known failure +ASSERT errors for: assert (c,expected) - ac = colorangle (c, a); - bc = colorangle (b, c); - ad = colorangle (a, d); - bd = colorangle (b, d); + Location | Observed | Expected | Reason + (19,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,3,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,3,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,3,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,3,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,3,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,4,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,4,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,4,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,4,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,4,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,5,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,5,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,5,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,5,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,5,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,6,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,6,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,6,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,6,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,6,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,7,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,7,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,7,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,7,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,7,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,3,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,3,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,3,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,3,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,3,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,4,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,4,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,4,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,4,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,4,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,5,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,5,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,5,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,5,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,5,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,6,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,6,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,6,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,6,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,6,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (19,7,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (20,7,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (21,7,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (22,7,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (23,7,3) 0 255 Abs err 0 exceeds tol 0 by 0 +***** test + a = uint8 (reshape (1:1:9, [1 3 3])); + b = uint8 (reshape (10:2:26, [1 3 3])); + c = imfuse (a, b); + expected = uint8 (zeros (1, 3, 3)); + expected(:, :, 1) = [0 128 255]; + expected(:, :, 2) = [0 128 255]; + expected(:, :, 3) = [0 128 255]; + assert (c, expected); +***** test + a = uint8 (reshape (1:1:9, [1 3 3])); + b = uint8 (reshape (10:2:26, [1 3 3])); + c = imfuse (a, b, "Scaling", "independent"); + expected = uint8 (zeros (1, 3, 3)); + expected(:, :, 1) = [0 128 255]; + expected(:, :, 2) = [0 128 255]; + expected(:, :, 3) = [0 128 255]; + assert (c, expected); +***** test + a = uint8 (reshape (1:1:9, [1 3 3])); + b = uint8 (reshape (10:2:26, [1 3 3])); + c = imfuse (a, b, "Scaling", "joint"); + expected = uint8 (zeros (1, 3, 3)); + expected(:, :, 1) = [191 223 255]; + expected(:, :, 2) = [0 16 32]; + expected(:, :, 3) = [191 223 255]; + assert (c, expected); +***** test + a = uint8 (reshape (1:1:9, [1 3 3])); + b = uint8 (reshape (10:2:26, [1 3 3])); + c = imfuse (a, b, "Scaling", "none"); + expected = uint8 (zeros (1, 3, 3)); + expected(:, :, 1) = [15 17 19]; + expected(:, :, 2) = [3 4 5]; + expected(:, :, 3) = [15 17 19]; + assert (c, expected); +***** xtest + a = zeros (5, 3); + b = ones (5, 3); + ra = imref2d (size (a), [10, 20], [30, 40]); + rb = imref2d (size (b), [10, 20], [30, 40]); + [c, rc] = imfuse (a, ra, b, rb, "falsecolor"); + expected = uint8 (zeros (5, 3, 3)); + expected(:, 1:2, 1) = 255 * ones (5, 2); + expected(:, 1:2, 3) = 255 * ones (5, 2); + assert (rc.ImageSize, [5, 3]); + assert (rc.XWorldLimits, [10, 20]); + assert (rc.YWorldLimits, [30, 40]); + assert (rc.PixelExtentInWorldX, 3.33333333, 10e-9); + assert (rc.PixelExtentInWorldY, 2); + assert (rc.ImageExtentInWorldX, 10); + assert (rc.ImageExtentInWorldY, 10); + assert (rc.XIntrinsicLimits, [0.5, 3.5]); + assert (rc.YIntrinsicLimits, [0.5, 5.5]); + assert (c, expected); +!!!!! known failure +ASSERT errors for: assert (c,expected) - assert (colorangle (a, cat (3, c, d)), - cat (3, [ac ad])) + Location | Observed | Expected | Reason + (1,1,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (2,1,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (3,1,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (4,1,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (5,1,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (1,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (2,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (3,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (4,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (5,2,1) 0 255 Abs err 0 exceeds tol 0 by 0 + (1,1,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (2,1,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (3,1,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (4,1,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (5,1,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (1,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (2,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (3,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (4,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 + (5,2,3) 0 255 Abs err 0 exceeds tol 0 by 0 +***** test + a = zeros (5, 5); + b = ones (5, 5); + ra = imref2d (size (a), [10, 20], [30, 40]); + rb = imref2d (size (b), [10, 20], [30, 40]); + [c, rc] = imfuse (a, ra, b, rb, "falsecolor"); + expected = uint8 (zeros (5, 5, 3)); + assert (rc.ImageSize, [5, 5]); + assert (rc.XWorldLimits, [10, 20]); + assert (rc.YWorldLimits, [30, 40]); + assert (rc.PixelExtentInWorldX, 2); + assert (rc.PixelExtentInWorldY, 2); + assert (rc.ImageExtentInWorldX, 10); + assert (rc.ImageExtentInWorldY, 10); + assert (rc.XIntrinsicLimits, [0.5, 5.5]); + assert (rc.YIntrinsicLimits, [0.5, 5.5]); + assert (c, expected); +***** test + a = magic (5); + b = ones (5, 5); + ra = imref2d (size (a), [10, 20], [30, 40]); + rb = imref2d (size (b), [10, 20], [30, 40]); + [c, rc] = imfuse (a, ra, b, rb, "falsecolor", "Scaling", "independent"); + expected = uint8 (zeros (5, 5, 3)); + expected(:, :, 2) = [ + 170 244 0 74 149 + 234 43 64 138 159 + 32 53 128 202 223 + 96 117 191 213 21 + 106 181 255 11 85]; + assert (rc.ImageSize, [5, 5]); + assert (rc.XWorldLimits, [10, 20]); + assert (rc.YWorldLimits, [30, 40]); + assert (rc.PixelExtentInWorldX, 2); + assert (rc.PixelExtentInWorldY, 2); + assert (rc.ImageExtentInWorldX, 10); + assert (rc.ImageExtentInWorldY, 10); + assert (rc.XIntrinsicLimits, [0.5, 5.5]); + assert (rc.YIntrinsicLimits, [0.5, 5.5]); + assert (c, expected); +53 tests, 51 passed, 2 known failures, 0 skipped +[inst/imfill.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imfill.m +***** test + I = uint8 (5.*[1 1 1; 1 0 1; 1 1 1]); + bw = logical ([1 1 1; 1 0 1; 1 1 1]); + I2 = uint8 (5.*ones (3)); + bw2 = logical (ones (3)); - assert (colorangle (cat (3, a, b), cat (3, c, d)), - cat (3, [ac cd])) + assert (imfill (int8 (I)), int8 (I2)) + assert (imfill (int16 (I)), int16 (I2)) + assert (imfill (int32 (I)), int32 (I2)) + assert (imfill (int64 (I)), int64 (I2)) + assert (imfill (uint8 (I)), uint8 (I2)) + assert (imfill (uint16 (I)), uint16 (I2)) + assert (imfill (uint32 (I)), uint32 (I2)) + assert (imfill (uint64 (I)), uint64 (I2)) + assert (imfill (single (I)), single (I2)) + assert (imfill (double (I)), double (I2)) + assert (imfill (bw, "holes"), bw2) + assert (imfill (uint8 (bw)), uint8 (bw2)) +***** error + imfill (i + ones (3, 3)); # complex input +***** error + imfill (sparse (double (I))); # sparse input +***** error + imfill (); +***** error + imfill (true (3), 4, "holes", 5) +***** error + imfill (false (3), ones (2, 3)) +***** error + imfill (false (3), ones (2, 3), 4) +***** error + imfill (false (3)) +***** error + imfill (false (3), 0, 4) +***** warning + bw = logical ([1 1 1; 1 0 1; 1 1 1]); + assert (imfill (bw, [5 5]), bw) + assert (imfill (bw, 15), bw) - assert (colorangle (cat (1, a, b), cat (3, c, d)), - reshape ([ac bc ad bd], [2 2])) -!!!!! known failure -dot: sizes of X and Y must match -21 tests, 20 passed, 1 known failure, 0 skipped -[inst/imdivide.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imdivide.m -***** assert (imdivide (uint8 ([23 250]), uint8 ([ 2 50])), uint8 ([ 12 5])); # default to first class -***** assert (imdivide (uint8 ([56 255]), uint8 ([ 0 0])), uint8 ([255 255])); # dividing by zero works (tested in matlab) -***** assert (imdivide (uint8 ([23 250]), 2), uint8 ([ 12 125])); # works subtracting a scalar -***** assert (imdivide (uint8 ([23 250]), uint8 ([ 2 50]), "uint16"), uint16 ([ 12 5])); # defining output class works (not in matlab) -***** assert (imdivide (logical ([1 1 0 0]), logical ([1 0 1 0])), double ([1 Inf 0 NaN])); # dividing logical matrix (tested in matlab) -***** fail ("imdivide (uint8 ([23 250]), uint16 ([23 250]))"); # input needs to have same class -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/rgb2ycbcr.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/rgb2ycbcr.m + bw = repmat (bw, [1 1 3]); + assert (imfill (bw, 30), bw) + assert (imfill (bw, [2 2 5]), bw) ***** test - in(:,:,1) = magic (5); - in(:,:,2) = magic (5); - in(:,:,3) = magic (5); - out(:,:,1) = [31 37 17 23 29 - 36 20 22 28 30 - 19 21 27 33 35 - 25 26 32 34 19 - 25 31 37 18 24]; - out(:,:,2) = 128; - out(:,:,3) = 128; - assert (rgb2ycbcr (uint8 (in)), uint8 (out)); -***** shared cbcr - cbcr = 0.5019607843137255; - out(1:10, 1) = linspace (16/255, 235/255, 10); - out(:, [2 3]) = cbcr; - assert (rgb2ycbcr (gray (10)), out, 0.00001); -***** assert (rgb2ycbcr ([1 1 1]), [0.92157 cbcr cbcr], 0.0001); -***** assert (class (rgb2ycbcr (single (rand (5, 5, 3)))), "single") -3 tests, 3 passed, 0 known failure, 0 skipped + bw = logical ([1 0 0 0 0 0 0 0 + 1 1 1 1 1 0 0 0 + 1 0 0 0 1 0 1 0 + 1 0 0 0 1 1 1 0 + 1 1 1 1 0 1 1 1 + 1 0 0 1 1 0 1 0 + 1 0 0 0 1 0 1 0 + 1 0 0 0 1 1 1 0]); + bw2 = logical ([1 0 0 0 0 0 0 0 + 1 1 1 1 1 0 0 0 + 1 1 1 1 1 0 1 0 + 1 1 1 1 1 1 1 0 + 1 1 1 1 1 1 1 1 + 1 0 0 1 1 1 1 0 + 1 0 0 0 1 1 1 0 + 1 0 0 0 1 1 1 0]); + bw3 = logical ([1 0 0 0 0 0 0 0 + 1 1 1 1 1 0 0 0 + 1 1 1 1 1 0 1 0 + 1 1 1 1 1 1 1 0 + 1 1 1 1 0 1 1 1 + 1 0 0 1 1 0 1 0 + 1 0 0 0 1 0 1 0 + 1 0 0 0 1 1 1 0]); + assert (imfill (bw, "holes"), bw2) + assert (imfill (bw, 8, "holes"), bw2) + assert (imfill (bw, 4, "holes"), bw2) + assert (imfill (bw, [3 3]), bw3) + assert (imfill (bw, 19), bw3) + assert (imfill (bw, [3 3], 4), bw3) + assert (imfill (bw, 19, 4), bw3) + assert (imfill (bw, [3 3], 8), bw2) + assert (imfill (bw, 19, 8), bw2) + assert (imfill (bw, [19; 20]), bw3) + assert (imfill (bw, [19; 20], 4), bw3) + assert (imfill (bw, [19; 20], 8), bw2) +***** warning + bw = logical ([1 1 1 1 1 1 1 + 1 0 0 0 0 0 1 + 1 0 1 1 1 0 1 + 1 0 1 0 1 0 1 + 1 0 1 1 1 0 1 + 1 0 0 0 0 0 1 + 1 1 1 1 1 1 1]); + bw44 = logical ([1 1 1 1 1 1 1 + 1 0 0 0 0 0 1 + 1 0 1 1 1 0 1 + 1 0 1 1 1 0 1 + 1 0 1 1 1 0 1 + 1 0 0 0 0 0 1 + 1 1 1 1 1 1 1]); + bw9 = logical ([1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 + 1 1 1 0 1 1 1 + 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1]); + assert (imfill (bw, "holes"), logical (ones (7))) + assert (imfill (bw, [4 4]), bw44) + assert (imfill (bw, 9), bw9) + assert (imfill (bw, [4 4; 10 10]), bw44) +***** test + bw = logical ([1 1 0 1 1]); + assert (imfill (bw, "holes"), bw) + bw = logical([1 1 0 1 1; 1 1 1 1 1]); + assert (imfill (bw, "holes"), bw) +***** test + I = zeros (5); + I(:, [2 4]) = 1; + I2_expected = [0 1 1 1 0 + 0 1 1 1 0 + 0 1 1 1 0 + 0 1 1 1 0 + 0 1 1 1 0]; + I2 = imfill (I, [0 0 0; 1 1 1; 0 0 0], "holes"); + assert (I2, I2_expected) +***** test + I = zeros (5); + I(:, [2 4]) = 1; + I2_expected = I; + I2 = imfill (I, [0 1 0; 0 1 0; 0 1 0], "holes"); + assert (I2, I2_expected) +***** test # this test is Matlab compatible + I = zeros (5); + I(:, [2 4]) = 1; + I2_expected = inf .* ones (5); + I2 = imfill (I, [0 0 0; 0 1 0; 0 0 0], "holes"); + assert (I2, I2_expected) +***** test + I = false (5); + I(:, [2 4]) = true; + I2_expected = true (5); + I2 = imfill (I, [0 0 0; 0 1 0; 0 0 0], "holes"); + assert (I2, I2_expected) +***** test + I = uint8 ([10 20 80 85 20 + 15 90 03 25 88 + 05 85 02 50 83 + 90 04 03 80 80 + 10 81 83 85 30]); + I2 = uint8 ([10 20 80 85 20 + 15 90 80 80 88 + 05 85 80 80 83 + 90 80 80 80 80 + 10 81 83 85 30]); + I3 = uint8 ([10 20 80 85 20 + 15 90 05 25 88 + 05 85 05 50 83 + 90 05 05 80 80 + 10 81 83 85 30]); + assert (imfill (I), I2) + assert (imfill (I, 4), I2) + assert (imfill (I, 4, "holes"), I2) + assert (imfill (I, 8), I3) + assert (imfill (I, "holes"), I2) +***** test + v_line = [0 1 0; 0 1 0; 0 1 0]; + h_line = [0 0 0; 1 1 1; 0 0 0]; + im = [0 1 0 0 1 0]; + + assert (imfill (im, h_line, "holes"), [0 1 1 1 1 0]) + assert (imfill (im, v_line, "holes"), [0 1 0 0 1 0]) + assert (imfill (im', h_line, "holes"), [0 1 0 0 1 0]') + assert (imfill (im', v_line, "holes"), [0 1 1 1 1 0]') + + im = repmat (im, [1 1 5]); + assert (imfill (im, h_line, "holes"), repmat ([0 1 1 1 1 0], [1 1 5])) + assert (imfill (im, v_line, "holes"), im) + + im = permute (im, [2 1 3]); + assert (imfill (im, h_line, "holes"), im) + assert (imfill (im, v_line, "holes"), repmat ([0 1 1 1 1 0]', [1 1 5])) +***** test + im = logical ([0 0 0 0 0 0 + 0 1 1 1 1 0 + 0 1 0 0 1 0 + 0 1 1 1 1 0 + 0 0 0 0 0 0]); + fi = logical ([0 0 0 0 0 0 + 0 1 1 1 1 0 + 0 1 1 1 1 0 + 0 1 1 1 1 0 + 0 0 0 0 0 0]); + + assert (imfill (cat (3, im, im, im), 8, 'holes'), cat (3, fi, fi, fi)) + assert (imfill (cat (3, im, im, im), 'holes'), cat (3, im, im, im)) + assert (imfill (cat (3, fi, im, fi), 'holes'), cat (3, fi, fi, fi)) +***** test + emp = false (5, 6); + im = logical ([0 0 0 0 0 0 + 0 1 1 1 1 0 + 0 1 0 1 0 1 + 0 1 1 1 1 0 + 0 0 0 0 0 0]); + fi = logical ([0 0 0 0 0 0 + 0 1 1 1 1 0 + 0 1 1 1 1 1 + 0 1 1 1 1 0 + 0 0 0 0 0 0]); + fi1 = logical ([0 0 0 0 0 0 + 0 1 1 1 1 0 + 0 1 1 1 0 1 + 0 1 1 1 1 0 + 0 0 0 0 0 0]); + fi2 = logical ([0 0 0 0 0 0 + 0 1 1 1 1 0 + 0 1 0 1 1 1 + 0 1 1 1 1 0 + 0 0 0 0 0 0]); + + assert (imfill (cat (3, im, im, im), [3 3 2]), cat (3, fi1, fi1, fi1)) + assert (imfill (cat (3, im, im, im), [3 5 2]), cat (3, fi2, fi2, fi2)) + assert (imfill (cat (3, im, im, im), [3 3 2; 3 5 2]), cat (3, fi, fi, fi)) + assert (imfill (cat (3, emp, im, emp), [3 3 2]), true (5, 6, 3)) +21 tests, 21 passed, 0 known failure, 0 skipped +[inst/iradon.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/iradon.m +***** assert (iradon (single ([0; 1; 1; 0]), 90)); +***** assert (iradon (double ([0; 1; 1; 0]), 90)); +***** assert (iradon (int8 ([0; 1; 1; 0]), 90)); +***** assert (iradon (int16 ([0; 1; 1; 0]), 90)); +***** assert (iradon (int32 ([0; 1; 1; 0]), 90)); +***** assert (iradon (int64 ([0; 1; 1; 0]), 90)); +***** assert (iradon (uint8 ([0; 1; 1; 0]), 90)); +***** assert (iradon (uint16 ([0; 1; 1; 0]), 90)); +***** assert (iradon (uint32 ([0; 1; 1; 0]), 90)); +***** assert (iradon (uint64 ([0; 1; 1; 0]), 90)); +***** assert (iradon (logical ([0; 1; 1; 0]), 90)); +***** assert (iradon (ones (5), 1:5)); +***** assert (iradon (ones (5), 1:5, 'nearest')); +***** assert (iradon (ones (5), 1:5, 'linear')); +***** assert (iradon (ones (5), 1:5, 'spline')); +***** assert (iradon (ones (5), 1:5, 'pchip')); +***** assert (iradon (ones (5), 1:5, 'linear', 'None')); +***** assert (iradon (ones (5), 1:5, 'linear', 'Ram-Lak')); +***** assert (iradon (ones (5), 1:5, 'linear', 'Shepp-Logan')); +***** assert (iradon (ones (5), 1:5, 'linear', 'Cosine')); +***** assert (iradon (ones (5), 1:5, 'linear', 'Hamming')); +***** assert (iradon (ones (5), 1:5, 'linear', 'Hann')); +***** assert (iradon (ones (5), 1:5, 'linear', 'None', 0.45)); +***** assert (iradon (ones (5), 1:5, 'linear', 'None', 0.45, 5)); +***** test + [R, F] = iradon (ones (5), 1:5); + assert(isvector(F)); + assert(ismatrix(R)); +***** error iradon (); +***** error iradon ('xxx'); +***** error iradon (ones (2), 'xxx'); +***** error iradon (ones (5), 1:5, 'foo'); +***** error iradon (ones (5), 1:5, 'linear', 'foo'); +***** error iradon (ones (5), 1:5, 'linear', 'none', 'foo'); +***** error iradon (ones (5), 1:5, 'linear', 'none', 0.65, 'foo'); +***** test + A = iradon([0; 1; 1; 0], 90); + A_matlab = 0.4671 .* ones (2); + assert (A, A_matlab, 0.02); # as Matlab compatible as iradon outputs currently get +***** test + A = iradon (radon (ones (2, 2), 0:5), 0:5, "nearest", "none"); + A_matlab = [1, 1, 1, 1]' * [0.4264, 2.7859, 2.7152, 0.3557]; + assert (A, A_matlab, 0.0001); +***** test + P = phantom (128); + R = radon (P, 0:179); + + IR = iradon (R, 0:179, [], [], [], 128); # (errors in Matlab because of []s) + D = P - IR; + maxdiff = max (abs (D(:))); + maxdiff_matlab = 0.3601; + assert (maxdiff, maxdiff_matlab, 0.002); + meandiff = mean (abs (D(:))); + meandiff_matlab = 0.0218; + assert (meandiff, meandiff_matlab, 0.001); + + filtername = "None"; + IR = iradon (R, 0:179, [], filtername, [], 128); + D = P - IR; + maxdiff = max (abs (D(:))); + maxdiff_matlab = 36.5671; + assert (maxdiff, maxdiff_matlab, 0.0001); + meandiff = mean (abs (D(:))); + meandiff_matlab = 24.6302; + assert (meandiff, meandiff_matlab, 0.0001); + + filtername = "Ram-Lak"; # is same as default + IR = iradon (R, 0:179, [], filtername, [], 128); + D = P - IR; + maxdiff = max (abs (D(:))); + maxdiff_matlab = 0.3601; + assert (maxdiff, maxdiff_matlab, 0.002); + meandiff = mean (abs (D(:))); + meandiff_matlab = 0.0218; + assert (meandiff, meandiff_matlab, 0.001); + + filtername = "Hamming"; + IR = iradon (R, 0:179, [], filtername, [], 128); + D = P - IR; + maxdiff = max (abs (D(:))); + maxdiff_matlab = 0.5171; + assert (maxdiff, maxdiff_matlab, 0.005); + meandiff = mean (abs (D(:))); + meandiff_matlab = 0.0278; + assert (meandiff, meandiff_matlab, 0.003); + + filtername = "Shepp-Logan"; + IR = iradon (R, 0:179, [], filtername, [], 128); + D = P - IR; + maxdiff = max (abs (D(:))); + maxdiff_matlab = 0.3941; + assert (maxdiff, maxdiff_matlab, 0.005); + meandiff = mean (abs (D(:))); + meandiff_matlab = 0.0226; + assert (meandiff, meandiff_matlab, 0.0015); + + filtername = "Cosine"; + IR = iradon (R, 0:179, [], filtername, [], 128); + D = P - IR; + maxdiff = max (abs (D(:))); + maxdiff_matlab = 0.4681; + assert (maxdiff, maxdiff_matlab, 0.005); + meandiff = mean (abs (D(:))); + meandiff_matlab = 0.0249; + assert (meandiff, meandiff_matlab, 0.002); + + filtername = "Hann"; + IR = iradon (R, 0:179, [], filtername, [], 128); + D = P - IR; + maxdiff = max (abs (D(:))); + maxdiff_matlab = 0.5334; + assert (maxdiff, maxdiff_matlab, 0.005); + meandiff = mean (abs (D(:))); + meandiff_matlab = 0.0285; + assert (meandiff, meandiff_matlab, 0.0025); +***** demo + P = phantom (); + figure, imshow (P, []), title ("Original image") + projections = radon (P, 0:179); + reconstruction = iradon (projections, 0:179, 'Spline', 'Hann'); + figure, imshow (reconstruction, []), title ("Reconstructed image") +35 tests, 35 passed, 0 known failure, 0 skipped +[inst/imsubtract.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imsubtract.m +***** assert (imsubtract (uint8 ([23 250]), uint8 ([24 50])), uint8 ([ 0 200])); # default to first class and truncate +***** assert (imsubtract (uint8 ([23 250]), 10), uint8 ([13 240])); # works subtracting a scalar +***** assert (imsubtract (uint8 ([23 250]), uint8 ([24 50]), "uint16"), uint16 ([ 0 200])); # defining output class works (not in matlab) +***** assert (imsubtract (logical ([ 1 0]), logical ([ 1 1])), double ([ 0 -1])); # return double for two logical images +***** assert (imsubtract (logical ([ 1 0]), logical ([ 1 1]), "logical"), logical ([ 0 0])); # this is matlab incompatible on purpose +***** error imsubtract (uint8 ([23 250]), uint16 ([23 250])); +***** warning imsubtract (uint8 ([23 250]), uint8 ([24 255]), "int8"); +***** test + warning ("off", "all"); + assert (imsubtract (uint8 ([23 250]), uint8 ([24 255]), "int8"), + int8 ([-1 0])) +8 tests, 8 passed, 0 known failure, 0 skipped [inst/wiener2.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/wiener2.m ***** shared im0, im0_out, im0_n @@ -7353,878 +6632,1103 @@ figure, imshow (K); title ("Image with noise reduced by wiener2 filtering"); 27 tests, 27 passed, 0 known failure, 0 skipped -[inst/imcrop.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imcrop.m +[inst/stdfilt.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/stdfilt.m ***** test - a = randi (255, [100 100]); - rect = [20 30 3 5]; - assert (nthargout ([1 2], @imcrop, a, rect), {a(30:35, 20:23) rect}); - assert (nthargout (2, @imcrop, a, rect), rect); - assert (nthargout ([3 4], 4, @imcrop, a, rect), {a(30:35, 20:23) rect}); + im = stdfilt (ones (5)); + assert (im, zeros (5)) ***** test - rgb = randi (255, [100 100 3]); - rect = [20 30 3 5]; - assert (nthargout ([1 2], @imcrop, rgb, rect), {rgb(30:35, 20:23,:) rect}); - assert (nthargout (2, @imcrop, rgb, rect), rect); - assert (nthargout ([3 4], 4, @imcrop, rgb, rect), {rgb(30:35, 20:23,:) rect}); + A = zeros (3,3); + B = ones (3,3); + C = [1 1 1; 2 2 2; 3 3 3]; + D = C'; + E = ones (3,3); + E(2,2) = 2; + F = 3 .* ones (3,3); + F(2,2) = 1; + G = [-1 2 7; -5 2 8; -7 pi 9]; + H = [5 2 8; 1 -3 1; 5 1 0]; + A_out = [0 0 0; 0 0 0; 0 0 0]; + B_out = [0 0 0; 0 0 0; 0 0 0]; + C_out = repmat ([std([1 1 1 1 1 1 2 2 2]) + std([1 1 1 2 2 2 3 3 3]) + std([2 2 2 3 3 3 3 3 3])], [1 3]); + D_out = C_out'; + E_out = (1/3) .* ones (3,3); + F_out = (2/3) .* ones (3,3); + G_out = [std([-1 -1 2 -1 -1 2 -5 -5 2]), std([-1 2 7 -1 2 7 -5 2 8]), std([2 7 7 2 7 7 2 8 8]); + std([-1 -1 2 -5 -5 2 -7 -7 pi]), std([-1 2 7 -5 2 8 -7 pi 9]), std([2 7 7 2 8 8 pi 9 9]); + std([-5 -5 2 -7 -7 pi -7 -7 pi]), std([-5 2 8 -7 pi 9 -7 pi 9]), std([2 8 8 pi 9 9 pi 9 9])]; + H_out = [std([5 5 2 5 5 2 1 1 -3]), std([5 2 8 5 2 8 1 -3 1]), std([2 8 8 2 8 8 -3 1 1]); + std([5 5 2 1 1 -3 5 5 1]), std([5 2 8 1 -3 1 5 1 0]), std([2 8 8 -3 1 1 1 0 0]); + std([1 1 -3 5 5 1 5 5 1]), std([1 -3 1 5 1 0 5 1 0]), std([-3 1 1 1 0 0 1 0 0])]; + assert (stdfilt (A), A_out) + assert (stdfilt (B), B_out) + assert (stdfilt (C), C_out, 4*eps) + assert (stdfilt (D), D_out, 4*eps) + assert (stdfilt (E), E_out, 4*eps) + assert (stdfilt (F), F_out, 4*eps) + assert (stdfilt (G), G_out, 4*eps) + assert (stdfilt (H), H_out, 4*eps) + im = stdfilt (ones (5, 'logical')); + assert (im, zeros (5)) + im = stdfilt (ones (5, 'uint8')); + assert (im, zeros (5)) + assert (stdfilt (int8(H), H_out, 4*eps)) + assert (stdfilt (uint8(H), H_out, 4*eps)) + assert (stdfilt (int16(H), H_out, 4*eps)) + assert (stdfilt (uint16(H), H_out, 4*eps)) + assert (stdfilt (int32(H), H_out, 4*eps)) + assert (stdfilt (uint32(H), H_out, 4*eps)) + assert (stdfilt (int64(H), H_out, 4*eps)) + assert (stdfilt (uint64(H), H_out, 4*eps)) + assert (stdfilt (single(H), H_out, 4*eps)) +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/deconvwnr.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/deconvwnr.m +***** shared im0, psf0, im0_out, psf1, im2, out2_0, out2_1, im3 + im0 = ones (5, 5); + psf0 = ones (3, 3); + im0_out = 0.11111 .* ones (5, 5); + psf1 = [1 0 0; 0 1 0; 0 0 1]; + im2 = checkerboard (2, 2, 2); + out2_0 = [ + -0.4713 -0.2786 0.4229 0.5161 -0.2759 -0.4685 0.5131 0.4199; + -0.4713 -0.2786 0.4229 0.5161 -0.2759 -0.4685 0.5131 0.4199; + 0.5161 0.4229 -0.2786 -0.4713 0.4199 0.5131 -0.4685 -0.2759; + 0.5161 0.4229 -0.2786 -0.4713 0.4199 0.5131 -0.4685 -0.2759; + -0.4713 -0.2786 0.4229 0.5161 -0.2759 -0.4685 0.5131 0.4199; + -0.4713 -0.2786 0.4229 0.5161 -0.2759 -0.4685 0.5131 0.4199; + 0.5161 0.4229 -0.2786 -0.4713 0.4199 0.5131 -0.4685 -0.2759; + 0.5161 0.4229 -0.2786 -0.4713 0.4199 0.5131 -0.4685 -0.2759]; + out2_1 = [ + -0.0000 0.8481 0.4288 -0.4194 0.0000 0.2765 0.1373 -0.1392; + 0.5623 -0.0000 -0.4194 0.1429 0.5623 0.0000 -0.1392 0.4231; + 0.1429 -0.4194 0 0.5623 0.4231 -0.1392 0 0.5623; + -0.4194 0.4288 0.8481 0 -0.1392 0.1373 0.2765 0; + -0.0000 0.8481 0.4288 -0.4194 0.0000 0.2765 0.1373 -0.1392; + 0.5623 -0.0000 -0.4194 0.1429 0.5623 0.0000 -0.1392 0.4231; + 0.1429 -0.4194 0 0.5623 0.4231 -0.1392 0 0.5623; + -0.4194 0.4288 0.8481 0 -0.1392 0.1373 0.2765 0]; + im3 = rot90 (diag (0.5.*ones (1,8)) + diag (ones(1,7), 1)); +***** error deconvwnr () +***** error deconvwnr (ones (5)) +***** assert (deconvwnr (ones (5), ones (3))) +***** assert (deconvwnr (ones (5), ones (3), 0.7)) +***** assert (deconvwnr (ones (5), ones (3), 0.5 .* ones (5))) +***** assert (deconvwnr (ones (5, 5, 5), ones (3))) +***** error deconvwnr (ones (5), ones (3), -0.7) +***** error + deconvwnr (ones (5), ones (7)) +***** error + deconvwnr (ones (5, 8, 2), ones (6, 5)) +***** assert (deconvwnr (im0, psf0), im0_out, 1e-5) +***** assert (deconvwnr (im0, single (psf0)), im0_out, 1e-5) +***** assert (class (deconvwnr (im0, psf0)), "double") +***** assert (deconvwnr (single (im0), psf0), single (im0_out), 1e-5) +***** assert (class (deconvwnr (single (im0), psf0)), "single") +***** assert (deconvwnr (im2uint8 (im0), psf0), im2uint8 (im0_out)) +***** assert (class (deconvwnr (im2uint8 (im0), psf0)), "uint8") +***** assert (deconvwnr (im2uint16 (im0), psf0), im2uint16 (im0_out)) +***** assert (class (deconvwnr (im2uint16 (im0), psf0)), "uint16") +***** assert (deconvwnr (im2int16 (im0), psf0), im2int16 (im0_out)) +***** assert (class (deconvwnr (im2int16 (im0), psf0)), "int16") +***** error deconvwnr (true (5), ones (3)) ***** test - a = randi (255, [100 100]); - rect = [20 30 3 5]; - cmap = jet (255); - assert (nthargout ([1 2], @imcrop, a, cmap, rect), {a(30:35, 20:23) rect}); - assert (nthargout (2, @imcrop, a, cmap, rect), rect); - assert (nthargout ([3 4], 4, @imcrop, a, cmap, rect), {a(30:35, 20:23) rect}); + assert (deconvwnr (im0, psf0, 0.01), im0_out, 1e-4) + assert (deconvwnr (im0, psf1, 0.01), 0.333.*ones (5), 1e-4) ***** test - a = rand (100) > 0.5; - rect = [20 30 3 5]; - assert (nthargout ([1 2], @imcrop, a, rect), {a(30:35, 20:23) rect}); - assert (nthargout (2, @imcrop, a, rect), rect); - assert (nthargout ([3 4], 4, @imcrop, a, rect), {a(30:35, 20:23) rect}); -***** assert (imcrop (0, [0.5 0.5 0.9 0.9]), 0); -***** assert (imcrop (zeros (5), [1 1 1 1]), zeros (2)); + im1 = magic (5)./25; + out1_0 = [ + -0.0820 0.5845 -0.4293 0.2372 -0.0214; + 0.6241 -0.5877 0.2768 0.0182 -0.0424; + -0.5481 0.3164 0.0578 -0.2009 0.6637; + 0.1580 0.0974 -0.1613 0.7033 -0.5085; + 0.1370 -0.1217 0.5449 -0.4689 0.1976]; + out1_1 = [ + -0.2959 -0.1363 0.4038 0.7595 0.1347; + -0.0191 0.3269 0.8768 0.0559 -0.3748; + 0.2481 0.7979 0.1731 -0.4517 0.0982; + 0.7210 0.2904 -0.5305 0.0194 0.3654; + 0.2116 -0.4132 -0.0575 0.4826 0.6422]; + assert (deconvwnr (im1, psf0, 0.01), out1_0, 1e-4) + assert (deconvwnr (im1, psf1, 0.01), out1_1, 1e-4) ***** test - im = magic (5); - assert (imcrop (im, [1 1 5 5]), im) - assert (imcrop (im, [0 0 5 5]), im) - assert (imcrop (im, [1 1 2 5]), im(:,1:3)) - assert (imcrop (im, [1 -3 2 5]), im(1:2,1:3)) - assert (imcrop (im, [5 -3 2 5]), im(1:2,5)) + assert (deconvwnr (im2, psf0, 0.01), out2_0, 1e-4) + assert (deconvwnr (im2, psf1, 0.01), out2_1, 1e-4) ***** test - im = [1:7] .* [1; 2; 3; 4; 5]; - assert (imcrop (im, [1 1 5 5]), im(:,1:6)) - assert (imcrop (im, [0 0 5 5]), im(:,1:5)) - assert (imcrop (im, [1 1 2 5]), im(:,1:3)) - assert (imcrop (im, [1 -3 2 7]), im(1:4,1:3)) - assert (imcrop (im, [7 -3 2 7]), im(1:4,7)) + out3_0_x = [ + -1.1111 1.0556 -0.4444 -0.1111 0.5556 -0.9444 0.8889 0.0556; + 1.0556 -0.7778 0.2222 0.5556 -1.2778 1.2222 0.0556 -0.7778; + -0.4444 0.2222 0.2222 -0.9444 1.2222 -0.2778 -0.4444 0.7222; + -0.1111 0.5556 -0.9444 0.8889 0.0556 -0.4444 0.3889 -0.4444; + 0.5556 -1.2778 1.2222 0.0556 -0.7778 0.7222 -0.4444 0.2222; + -0.9444 1.2222 -0.2778 -0.4444 0.7222 -0.7778 0.5556 0.2222; + 0.8889 0.0556 -0.4444 0.3889 -0.4444 0.5556 -0.1111 -0.9444; + 0.0556 -0.7778 0.7222 -0.4444 0.2222 0.2222 -0.9444 1.2222]; + out3_0_01 = [ + -0.5064 0.2140 0.1101 -0.0993 0.0297 -0.1942 0.3223 0.0772; + 0.2140 -0.0659 0.0375 0.0891 -0.4109 0.4783 0.2202 -0.2860; + 0.1101 0.0375 -0.0525 -0.3208 0.5721 0.0034 -0.1743 0.0939; + -0.0993 0.0891 -0.3208 0.4624 0.0936 -0.1150 -0.1395 -0.0135; + 0.0297 -0.4109 0.5721 0.0936 -0.2566 -0.0027 0.1101 0.1341; + -0.1942 0.4783 0.0034 -0.1150 -0.0027 -0.0659 0.2542 -0.0819; + 0.3223 0.2202 -0.1743 -0.1395 0.1101 0.2542 -0.3023 -0.3371; + 0.0772 -0.2860 0.0939 -0.0135 0.1341 -0.0819 -0.3371 0.6794]; + out3_0_00001 = [ + -1.1087 1.0520 -0.4419 -0.1112 0.5532 -0.9410 0.8864 0.0557; + 1.0520 -0.7746 0.2213 0.5537 -1.2742 1.2190 0.0565 -0.7759; + -0.4419 0.2213 0.2211 -0.9418 1.2196 -0.2767 -0.4433 0.7195; + -0.1112 0.5537 -0.9418 0.8870 0.0557 -0.4428 0.3864 -0.4425; + 0.5532 -1.2742 1.2196 0.0557 -0.7755 0.7188 -0.4419 0.2220; + -0.9410 1.2190 -0.2767 -0.4428 0.7188 -0.7746 0.5544 0.2206; + 0.8864 0.0565 -0.4433 0.3864 -0.4419 0.5544 -0.1121 -0.9418; + 0.0557 -0.7759 0.7195 -0.4425 0.2220 0.2206 -0.9418 1.2201]; + out3_0_3 = [ + -0.0893 -0.0089 0.0446 -0.0357 -0.0268 0.0268 0.0893 0.0446; + -0.0089 0.0223 -0.0089 -0.0357 -0.0089 0.1473 0.1161 0.0179; + 0.0446 -0.0089 -0.0357 -0.0089 0.1607 0.0804 -0.0089 -0.0357; + -0.0357 -0.0357 -0.0089 0.1652 0.0804 -0.0179 -0.0714 0.0045; + -0.0268 -0.0089 0.1607 0.0804 -0.0179 -0.0446 0.0446 -0.0000; + 0.0268 0.1473 0.0804 -0.0179 -0.0446 0.0223 0.0268 -0.0000; + 0.0893 0.1161 -0.0089 -0.0714 0.0446 0.0268 -0.1071 -0.0446; + 0.0446 0.0179 -0.0357 0.0045 0.0000 -0.0000 -0.0446 0.1652]; + out3_1_x = [ + -0.3333 0.1667 -0.6667 -0.3333 0.3333 0.1667 0.3333 0.1667; + 0.1667 -0.3333 -0.3333 0.3333 0.1667 0.3333 0.1667 0.3333; + -0.6667 -0.3333 0.6667 0.1667 0.3333 0.1667 0.3333 0.1667; + -0.3333 0.3333 0.1667 -0.3333 0.1667 0.3333 0.1667 -0.6667; + 0.3333 0.1667 0.3333 0.1667 0.6667 0.1667 -0.6667 -0.3333; + 0.1667 0.3333 0.1667 0.3333 0.1667 -0.3333 -0.3333 0.3333; + 0.3333 0.1667 0.3333 0.1667 -0.6667 -0.3333 -0.3333 0.1667; + 0.1667 0.3333 0.1667 -0.6667 -0.3333 0.3333 0.1667 0.6667]; + out3_1_01 = [ + -0.1868 0.1548 -0.5994 -0.2997 0.3097 0.1548 0.3097 0.1548; + 0.1548 -0.2997 -0.2997 0.3097 0.1548 0.3097 0.1548 0.3097; + -0.5994 -0.2997 0.4965 0.1548 0.3097 0.1548 0.3097 0.1548; + -0.2997 0.3097 0.1548 -0.1247 0.1548 0.3097 0.1548 -0.5994; + 0.3097 0.1548 0.3097 0.1548 0.4965 0.1548 -0.5994 -0.2997; + 0.1548 0.3097 0.1548 0.3097 0.1548 -0.2997 -0.2997 0.3097; + 0.3097 0.1548 0.3097 0.1548 -0.5994 -0.2997 -0.1868 0.1548; + 0.1548 0.3097 0.1548 -0.5994 -0.2997 0.3097 0.1548 0.4343]; + out3_1_00001 = [ + -0.3331 0.1667 -0.6666 -0.3333 0.3333 0.1667 0.3333 0.1667; + 0.1667 -0.3333 -0.3333 0.3333 0.1667 0.3333 0.1667 0.3333; + -0.6666 -0.3333 0.6664 0.1667 0.3333 0.1667 0.3333 0.1667; + -0.3333 0.3333 0.1667 -0.3330 0.1667 0.3333 0.1667 -0.6666; + 0.3333 0.1667 0.3333 0.1667 0.6664 0.1667 -0.6666 -0.3333; + 0.1667 0.3333 0.1667 0.3333 0.1667 -0.3333 -0.3333 0.3333; + 0.3333 0.1667 0.3333 0.1667 -0.6666 -0.3333 -0.3331 0.1667; + 0.1667 0.3333 0.1667 -0.6666 -0.3333 0.3333 0.1667 0.6663]; + out3_1_3 = [ + -0.0089 0.0625 -0.1250 -0.0625 0.1250 0.0625 0.1250 0.0625; + 0.0625 -0.0625 -0.0625 0.1250 0.0625 0.1250 0.0625 0.1250; + -0.1250 -0.0625 0.1339 0.0625 0.1250 0.0625 0.1250 0.0625; + -0.0625 0.1250 0.0625 0.0982 0.0625 0.1250 0.0625 -0.1250; + 0.1250 0.0625 0.1250 0.0625 0.1339 0.0625 -0.1250 -0.0625; + 0.0625 0.1250 0.0625 0.1250 0.0625 -0.0625 -0.0625 0.1250; + 0.1250 0.0625 0.1250 0.0625 -0.1250 -0.0625 -0.0089 0.0625; + 0.0625 0.1250 0.0625 -0.1250 -0.0625 0.1250 0.0625 0.0268]; + assert (deconvwnr (im3, psf0), out3_0_x, 1e-4) + assert (deconvwnr (im3, psf0, 0.1), out3_0_01, 1e-4) + assert (deconvwnr (im3, psf0, 0.0001), out3_0_00001, 1e-4) + assert (deconvwnr (im3, psf0, 3), out3_0_3, 1e-4) + assert (deconvwnr (im3, psf1), out3_1_x, 1e-4) + assert (deconvwnr (im3, psf1, 0.1), out3_1_01, 1e-4) + assert (deconvwnr (im3, psf1, 0.0001), out3_1_00001, 1e-4) + assert (deconvwnr (im3, psf1, 3), out3_1_3, 1e-4) ***** test - ## Matlab returns [] (size 0x0) for this cases, while we return - ## [] (size 2x0). We are not compatible by design. If it ever - ## becomes an issue to anyone we can review this decision. - assert (imcrop (magic (5), [6 -3 2 5]), zeros (2, 0)) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/imhmax.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imhmax.m -***** shared im0, im0_h2_out - im0 = uint8 ([0 0 0 0 0; - 0 1 2 1 0; - 0 2 5 2 0; - 0 1 2 1 0; - 0 0 0 0 0]); - im0_h2_out = uint8 ([0 0 0 0 0; - 0 1 2 1 0; - 0 2 3 2 0; - 0 1 2 1 0; - 0 0 0 0 0]); -***** error imhmax () -***** error imhmax (im0) -***** error imhmax ("hello", 2) -***** error imhmax (i.*im0, 2) -***** error imhmax (sparse (im0), 2) -***** error imhmax (im0, -2) -***** error imhmax (im0, 'a') -***** error imhmax (im0, ones (2)) -***** error imhmax (im0, 2*i) -***** assert (imhmax (im0, 2), im0_h2_out) -***** assert (imhmax (double (im0), 2), double (im0_h2_out)) -***** assert (imhmax (im0, 2, 8), im0_h2_out) -***** assert (imhmax (im0, 2, 4), im0_h2_out) -***** assert (imhmax (im0, 2, true (3)), im0_h2_out) + im_rgb = cat (3, im2, im3, magic (8)./64); + out_rgb_0(:, :, 1) = out2_0; + out_rgb_0(:, :, 2) = [ + -0.9255 0.7869 -0.2553 -0.1154 0.3801 -0.6906 0.7000 0.0651; + 0.7869 -0.5407 0.1534 0.4141 -1.0064 0.9816 0.1222 -0.6335; + -0.2553 0.1534 0.1343 -0.7453 1.0211 -0.1936 -0.3586 0.5209; + -0.1154 0.4141 -0.7453 0.7468 0.0675 -0.3247 0.2023 -0.2996; + 0.3801 -1.0064 1.0211 0.0675 -0.6045 0.4711 -0.2553 0.2032; + -0.6906 0.9816 -0.1936 -0.3247 0.4711 -0.5407 0.4692 0.1052; + 0.7000 0.1222 -0.3586 0.2023 -0.2553 0.4692 -0.1868 -0.7477; + 0.0651 -0.6335 0.5209 -0.2996 0.2032 0.1052 -0.7477 1.0630]; + out_rgb_0(:, :, 3) = [ + -0.8118 0.8805 0.8341 -0.7963 -0.6343 0.8222 0.7757 -0.6188; + 0.5720 -0.4151 -0.3687 0.5565 0.3945 -0.3567 -0.3103 0.3791; + 0.2007 -0.0438 0.0026 0.1852 0.0232 0.0146 0.0610 0.0078; + -0.6880 0.7568 0.7104 -0.6725 -0.5105 0.6984 0.6520 -0.4951; + 0.6079 -0.5392 -0.5856 0.6234 0.7854 -0.5975 -0.6439 0.8008; + 0.1051 0.0519 0.0983 0.0896 -0.0724 0.1102 0.1566 -0.0879; + -0.2662 0.4231 0.4696 -0.2817 -0.4437 0.4815 0.5279 -0.4592; + 0.7317 -0.6629 -0.7093 0.7471 0.9091 -0.7213 -0.7677 0.9246]; + out_rgb_1(:, :, 1) = out2_1; + out_rgb_1(:, :, 2) = [ + -0.3110 0.1654 -0.6593 -0.3297 0.3308 0.1654 0.3308 0.1654; + 0.1654 -0.3297 -0.3297 0.3308 0.1654 0.3308 0.1654 0.3308; + -0.6593 -0.3297 0.6418 0.1654 0.3308 0.1654 0.3308 0.1654; + -0.3297 0.3308 0.1654 -0.3016 0.1654 0.3308 0.1654 -0.6593; + 0.3308 0.1654 0.3308 0.1654 0.6418 0.1654 -0.6593 -0.3297; + 0.1654 0.3308 0.1654 0.3308 0.1654 -0.3297 -0.3297 0.3308; + 0.3308 0.1654 0.3308 0.1654 -0.6593 -0.3297 -0.3110 0.1654; + 0.1654 0.3308 0.1654 -0.6593 -0.3297 0.3308 0.1654 0.6323]; + out_rgb_1(:, :, 3) = [ + -0.0240 0.3338 0.3335 0.0329 0.0344 0.1564 0.3942 0.0913; + 0.7871 0.6512 -0.5394 -0.2225 0.7287 0.5905 -0.3619 -0.2809; + 0.1333 -0.7196 0.2335 1.0291 0.0749 -0.5421 0.1728 0.9708; + -0.2201 0.4109 0.6487 -0.1632 -0.1617 0.4716 0.4713 -0.1048; + 0.4430 -0.1331 -0.1334 0.4999 0.5014 -0.3106 -0.0727 0.5582; + -0.6326 0.1654 0.8803 0.2633 -0.6910 0.1047 1.0577 0.2049; + 0.6191 0.7001 -0.2523 -0.3905 0.5607 0.8776 -0.3130 -0.4489; + 0.2469 -0.0561 0.1818 0.3038 0.3052 0.0047 0.0043 0.3621]; + assert (deconvwnr (im_rgb, psf0, 0.01), out_rgb_0, 1e-4) + assert (deconvwnr (im_rgb, psf1, 0.01), out_rgb_1, 1e-4) ***** test - out = imhmax (double (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "double") + ## Test that psf and nsr can be of class single, but are usually + ## internally as doubles. Matlab requires everything all to be + ## double so this is Matlab incompatible behaviour by design. + nsr = 0.1; + psf1_recast = double (single (psf1)); + nsr_recast = double (single (0.1)); + deconvolved = deconvwnr (im2, psf1_recast, nsr_recast); + assert (deconvwnr (im2, single (psf1), single (nsr)), deconvolved, 2e-16) + assert (deconvwnr (im2, single (psf1), nsr_recast), deconvolved, 2e-16) + assert (deconvwnr (im2, psf1_recast, single (nsr)), deconvolved, 2e-16) +***** demo + I = phantom (); + figure, imshow (I); + title ("Original image"); + psf = fspecial ("motion", 30, 15); + blurred = imfilter (I, psf, "conv"); + figure, imshow (blurred); + title ("Image with added motion blur"); + var_noise = 0.00005; + blurred_noisy = imnoise (blurred, "gaussian", 0, var_noise); + figure, imshow (blurred_noisy); + title ("Image with motion blur and added Gaussian noise"); + estimated_nsr = var_noise / (var(blurred_noisy(:)) - var_noise); + J = deconvwnr (blurred_noisy, psf, estimated_nsr); + figure, imshow (J) + title ({"restored image after Wiener deconvolution", + "with known PSF and estimated NSR"}); +27 tests, 27 passed, 0 known failure, 0 skipped +[inst/isbw.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/isbw.m +***** shared img + img = round (rand (10)); +***** assert (isbw (img, "non-logical"), true); +***** assert (isbw (img, "logical"), false); +***** assert (isbw (logical (img), "logical"), true); +***** assert (isbw (logical (img), "non-logical"), true); ***** test - out = imhmax (single (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "single") + img(1, 1) = 2; + assert (isbw (img, "non-logical"), false); ***** test - out = imhmax (uint8 (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "uint8") + a( 1, 1) = 1; + a(50, 50) = 2; + assert (isbw (a, "non-logical"), false); +***** assert (isbw (rand (5, 5, 1, 4) > 0.5), true) +***** assert (isbw (rand (5, 5, 3, 4) > 0.5), false) +***** assert (isbw (rand (5, 5, 3) > 0.5), false) +***** assert (isbw (rand (5, 5, 1, 3, 4) > 0.5), false) +***** assert (isbw (randi ([0 1], 5, 5, 1, 4), "non-logical"), true) +***** assert (isbw (randi ([0 1], 5, 5, 3, 4), "non-logical"), false) +***** assert (isbw (randi ([0 1], 5, 5, 3), "non-logical"), false) +***** assert (isbw (randi ([0 1], 5, 5, 1, 3, 4), "non-logical"), false) +***** assert (isbw (single ([0 0 1]), "non-logical"), true) +***** assert (isbw ([0 NaN 1], "non-logical"), false) +16 tests, 16 passed, 0 known failure, 0 skipped +[inst/makelut.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/makelut.m +***** demo + makelut(@(x) sum(x(:))>=3, 2) + % Returns '1' if one or more values + % in the input matrix are 1 +***** assert(prod(makelut(@(x) sum(x(:))==2, 2)==makelut(@(x, a, b, c, d) sum(x(:))==a*b*c*d,2,2/(3*4*5),3,4,5))); # test multiple params +***** assert(prod(makelut(@(x) x(1,1)==1, 2)==[zeros(2^3,1);ones(2^3,1)])==1); # test 2-by-2 +***** assert(prod(makelut(@(x) x(1,1)==1, 3)==[zeros(2^8,1);ones(2^8,1)])==1); # test 3-by-3 +***** assert(prod(makelut(@(x) x(1,1)==1, 4)==[zeros(2^15,1);ones(2^15,1)])==1); # test 4-by-4 +***** assert(prod(makelut(@(x) x(2,1)==1, 3)==[zeros(2^7,1);ones(2^7,1);zeros(2^7,1);ones(2^7,1)])==1); # another test for 3-by-3 +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/bwareafilt.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwareafilt.m +***** shared a2d, a3d + a2d = [1 0 0 0 0 0 1 0 0 1 + 1 0 0 1 0 1 0 1 0 1 + 1 0 1 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 1 0 1 1 1 0 0 0 0 + 1 1 0 1 0 0 0 1 0 0 + 1 1 0 0 0 0 1 0 1 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 1 1 0 0 1]; + + a3d = a2d; + a3d(:,:,2) = [ + 0 0 0 0 0 0 0 0 0 0 + 1 0 0 1 1 0 0 1 0 0 + 0 0 0 1 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 1 0 0 1 1 0 0 0 0 + 1 1 0 1 0 0 0 0 0 0 + 1 0 0 0 0 0 1 0 0 0 + 0 1 0 0 0 0 0 0 0 1 + 1 1 0 0 0 0 1 0 0 0]; + + a3d(:,:,3) = [ + 1 0 0 0 0 0 0 0 0 0 + 0 1 0 1 1 0 0 1 0 0 + 0 0 0 1 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 1 1 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 1 + 1 1 0 0 0 0 0 0 0 0]; ***** test - out = imhmax (uint16 (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "uint16") + f2d = [0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 1 0 1 1 1 0 0 0 0 + 1 1 0 1 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0]; + assert (bwareafilt (a2d, 2), logical (f2d)); + assert (bwareafilt (a2d, 2, 8), logical (f2d)); + assert (bwareafilt (a2d, 2, 4), logical (f2d)); ***** test - im = cat (3, im0, im0, im0, im0); - out = imhmax (im, 2); - assert (size (out), size (im)) + f2d = [1 0 0 0 0 0 1 0 0 0 + 1 0 0 0 0 1 0 1 0 0 + 1 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 1 0 1 1 1 0 0 0 0 + 1 1 0 1 0 0 0 1 0 0 + 1 1 0 0 0 0 1 0 1 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0]; + assert (bwareafilt (a2d, 5), logical (f2d)); + assert (bwareafilt (a2d, 5, 8), logical (f2d)); ***** test - im = zeros (10); - im(2:4, 2:4) = 3; - im(6:8, 6:8) = 8; - expected_4 = zeros (10); - expected_4(6:8, 6:8) = 4; - expected_2 = zeros (10); - expected_2(2:4, 2:4) = 1; - expected_2(6:8, 6:8) = 6; - out = imhmax (im, 4); - assert (out, expected_4, eps) - out = imhmax (im, 2); - assert (out, expected_2, eps) - out = imhmax (0.1 .* im, 0.4); - assert (out, 0.1 .* expected_4, eps) + f2d = [0 0 0 0 0 0 1 0 0 1 + 0 0 0 1 0 1 0 1 0 1 + 0 0 1 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 1 0 0 + 0 0 0 0 0 0 1 0 1 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 1 1 0 0 1]; + assert (bwareafilt (a2d, 11, "smallest", 4), logical (f2d)); ***** test - im2 = zeros (10); - im2(2:4, 2:4) = 3; - im2(6:9, 6:9)=8; - im2(5, 5)=8; - im2(6, 7)=0; - im2(7, 8)=0; - expected_4 = zeros (10); - expected_4(6:9, 6:9) = 4; - expected_4(5, 5) = 4; - expected_4(6, 7) = 0; - expected_4(7, 8) = 0; - expected_8 = expected_4; - expected_8(2:4, 2:4) = 3; - out2 = imhmax (im2, 4); - assert (out2, expected_8, eps) - out2 = imhmax (im2, 4, 4); - assert (out2, expected_4, eps) - out2 = imhmax (im2, 4, 8); - assert (out2, expected_8, eps) -21 tests, 21 passed, 0 known failure, 0 skipped -[inst/immse.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/immse.m -***** error immse (rand (10), rand (12)) -***** error immse (uint8 ([0 1 2 3]), uint16 ([0 1 2 3])) -***** error immse (double ([0 1 2 3]), single ([0 1 2 3])) -***** assert (immse (magic (5), magic (5)), 0) -***** assert (immse (single (magic (5)), single (magic (5))), single (0)) -***** assert (immse (uint8 (magic (5)), uint8 (magic (5))), 0) -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/imlincomb.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imlincomb.m -***** assert (imlincomb (0.5, uint8 ([255 10]), 0.5, uint8 ([50 20])), - uint8 ([153 15])); # default to first class and truncate -***** assert (imlincomb (0.5, uint8 ([255 10]), 0.5, uint8 ([50 20]), "uint16"), - uint16 ([153 15])); # defining output class works -***** assert (imlincomb (0.5, uint8 ([255 10]), 0.5, uint8 ([50 20]), 10), - uint8 ([163 25])); # default to first class and truncate -***** assert (imlincomb (0.5, uint8 ([255 10]), 0.5, uint8 ([50 20]), 1000, "uint16"), - uint16 ([1153 1015])); # defining output class works -***** assert (imlincomb (0.5, uint8 ([255 10]), 0.5, uint8 ([50 20]), 1000), - uint8 ([255 255])); # defining output class works -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/mat2gray.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/mat2gray.m -***** assert(mat2gray([1 2 3]), [0 0.5 1]); # standard use -***** assert(mat2gray(repmat ([1 2; 3 3], [1 1 3])), repmat ([0 0.5; 1 1], [1 1 3])); # setting min and max -***** assert(mat2gray([1 2 3], [2 2]), [1 1 1]); # equal min and max -***** assert(mat2gray([-1 0 0.5 3], [2 2]), [0 0 0.5 1]); # equal min and max + f2d = [1 0 0 0 0 0 1 0 0 0 + 1 0 0 0 0 1 0 1 0 0 + 1 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 1 1 0 0 0 0 + 0 0 0 1 0 0 0 1 0 0 + 0 0 0 0 0 0 1 0 1 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0]; + assert (bwareafilt (a2d, [3 5]), logical (f2d)); + assert (bwareafilt (a2d, [3 5], 8), logical (f2d)); ***** test - ## SCALE is unset and all values in the input IMAGE are the same: - ## case 1: all values are in the [0 1] range] - assert (mat2gray ([.5 .5; .5 .5]), [.5 .5; .5 .5]) - ## case 2: all values are above the [0 1] range - assert (mat2gray ([3 3; 3 3]), [1 1; 1 1]) - ## case 2: all values are below the [0 1] range - assert (mat2gray ([-3 -3; -3 -3]), [0 0; 0 0]) -***** assert(mat2gray([1 2 3], [3 1]), [1 0.5 0]); # max and min inverted -***** assert (mat2gray ([-3 -2 -1]), [0 0.5 1]) -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/ordfiltn.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/ordfiltn.m -***** shared b, f, s - b = [ 0 1 2 3 - 1 8 12 12 - 4 20 24 21 - 7 22 25 18]; - - f = [ 8 12 12 12 - 20 24 24 24 - 22 25 25 25 - 22 25 25 25]; -***** assert (ordfiltn (b, 9, true (3)), f); - - f = [ 1 8 12 12 - 8 20 21 21 - 20 24 24 24 - 20 24 24 24]; -***** assert (ordfiltn (b, 8, true (3)), f); - - f = [ 1 2 8 12 - 4 12 20 21 - 8 22 22 21 - 20 24 24 24]; -***** assert (ordfiltn (b, 7, true (3), "symmetric"), f); - - f = [ 1 8 12 12 - 4 20 24 21 - 7 22 25 21 - 7 22 25 21]; -***** assert (ordfiltn (b, 3, true (3, 1)), f); + f2d = [1 0 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 1 1 0 0 0 0 + 0 0 0 1 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0]; + assert (bwareafilt (a2d, [3 4], 4), logical (f2d)); + assert (bwareafilt (a2d, [3 4], [0 1 0; 1 1 1; 0 1 0]), logical (f2d)); +***** test + f2d = [1 0 0 0 0 0 1 0 0 1 + 1 0 0 1 0 1 0 1 0 1 + 1 0 1 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 1 1 0 0 0 0 + 0 0 0 1 0 0 0 1 0 0 + 0 0 0 0 0 0 1 0 1 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 1 1 0 0 0]; + assert (bwareafilt (a2d, [2 4]), logical (f2d)); + assert (bwareafilt (a2d, [2 4], 8), logical (f2d)); + assert (bwareafilt (a2d, [2 4], ones (3)), logical (f2d)); +***** test + f3d = [0 0 0 0 0 0 1 0 0 0 + 0 0 0 1 0 1 0 1 0 0 + 0 0 1 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0]; - f = [ 1 8 12 12 - 4 20 24 18 - 4 20 24 18 - 4 20 24 18]; -***** assert (ordfiltn (b, 3, true (4, 1)), f); + f3d(:,:,2) = [ + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 1 0 0 1 0 0 + 0 0 0 1 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0]; - f = [ 4 20 24 21 - 7 22 25 21 - 7 22 25 21 - 7 22 25 21]; -***** assert (ordfiltn (b, 4, true (4, 1)), f); + f3d(:,:,3) = [ + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 1 0 0 1 0 0 + 0 0 0 1 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0]; + assert (bwareafilt (a3d, 2), logical (f3d)); + assert (bwareafilt (a3d, 2, 26), logical (f3d)); + assert (bwareafilt (a3d, 2, ones (3, 3, 3)), logical (f3d)); +***** test + f3d = [0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 1 0 1 1 1 0 0 0 0 + 1 1 0 1 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0]; - s = [0 0 1 - 0 0 1 - 0 0 1]; - f = [ 2 8 12 12 - 9 20 22 21 - 21 25 24 24 - 21 25 24 24]; -***** assert (ordfiltn (b, 8, true (3), s), f); + f3d(:,:,2) = [ + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 1 0 0 1 1 0 0 0 0 + 1 1 0 1 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0]; - b(:,:,2) = b(:,:,1) - 1; - b(:,:,3) = b(:,:,2) - 1; - f(:,:,1) = [ 1 8 11 11 - 8 20 21 21 - 20 24 24 24 - 20 24 24 24]; - f(:,:,2) = [ 6 10 11 11 - 18 22 22 22 - 20 24 24 24 - 20 24 24 24]; - f(:,:,3) = [ 0 7 10 10 - 7 19 20 20 - 19 23 23 23 - 19 23 23 23]; -***** assert (ordfiltn (b, 25, true (3, 3, 3)), f); + f3d(:,:,3) = [ + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 1 1 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 0 0]; + assert (bwareafilt (a3d, 2, 6), logical (f3d)); + assert (bwareafilt (a3d, 2, conndef (3, "minimal")), logical (f3d)); 8 tests, 8 passed, 0 known failure, 0 skipped -[inst/imadjust.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imadjust.m -***** error imadjust ("bad argument"); -***** error imadjust ([1:100], "bad argument", [], 1); -***** error <2 row column per plane> imadjust ([1:100], [0 1 1], [], 1); -***** error <2 row column per plane> imadjust ([1:100], [], [0 1 1], 1); -***** error imadjust ([1:100], [], [], [0; 1]); -***** error imadjust (rand (5, 5, 3), [], [], [0 1]); -***** error imadjust ([1:100], [0; 1], [], -1); -***** error imadjust ([1:100], [0; 5], []); -***** error imadjust ([1:100], [-2; 1], []); -***** error imadjust ([1:100], [], [0; 4]); -***** error imadjust ([1:100], [], [-2; 1]); -***** error imadjust (rand (5) > .5); +[inst/imsharpen.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imsharpen.m ***** test - im = [0.01:0.01:1]; - assert (imadjust (im), [0 linspace(0, 1, 98) 1], eps) - assert (imadjust (im), imadjust (im, stretchlim (im, 0.01), [0; 1], 1)) - assert (imadjust (im, []), imadjust (im, [0; 1], [0; 1], 1)) - assert (imadjust (im, [], []), imadjust (im, [0; 1], [0; 1], 1)) - assert (imadjust (im, [], [.25 .75]), imadjust (im, [0; 1], [.25; .75], 1)) - assert (imadjust (im, [.25; .75], []), imadjust (im, [.25; .75], [0; 1], 1)) -***** assert (imadjust (linspace (0, 1), [], [.25 .75]), linspace (.25, .75, 100), eps) -***** assert (imadjust (linspace (0, 1, 100),[1/99; 98/99]), - [0 linspace(0, 1, 98) 1], eps) -***** shared cm - cm = [[0:8]' [1:9]' [2:10]'] / 10; -***** assert (imadjust (cm, [0; 1], [0.5; 1]), (cm /2) + .5) -***** assert (imadjust (cm, [0 1], [0.5 1]), (cm /2) + .5) -***** assert (imadjust (cm, [0; 1], [.1 .2 .3; .7 .8 .9]), - (cm*.6) + [.1 .2 .3], eps) -***** assert (imadjust (cm, [.2 .4 .6; .7 .8 .9], [0; 1]), - [[0 0 linspace(0, 1, 6) 1]' ... - [0 0 0 linspace(0, 1, 5) 1]' ... - [0 0 0 0 linspace(0, 1, 4) 1]'], eps) -***** assert (imadjust (cm, [.2 .4 .6; .7 .8 .9], [0 .1 .2; .8 .9 1]), - [[0 0 linspace(0, .8, 6) .8]' ... - [.1 .1 .1 linspace(.1, .9, 5) .9]' ... - [.2 .2 .2 .2 linspace(.2, 1, 4) 1]'], eps) -***** assert (imadjust (cm, [.2 .4 .6; .7 .8 .9], [0 .1 .2; .8 .9 1], [0.5 1 2]), - [[0 0 0 (((([.3 .4 .5 .6]-.2)/.5).^.5)*.8) .8 .8]' ... - [.1 .1 .1 linspace(.1, .9, 5) .9]' ... - [.2 .2 .2 .2 .2 ((((([.7 .8]-.6)/.3).^2).*.8)+.2) 1 1]'], eps*10) + A = zeros (7, 7); + A(4,4) = 1; + B = [ + 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 + 0.00000 -0.00238 -0.01064 -0.01755 -0.01064 -0.00238 0.00000 + 0.00000 -0.01064 -0.04771 -0.07866 -0.04771 -0.01064 0.00000 + 0.00000 -0.01755 -0.07866 1.67032 -0.07866 -0.01755 0.00000 + 0.00000 -0.01064 -0.04771 -0.07866 -0.04771 -0.01064 0.00000 + 0.00000 -0.00238 -0.01064 -0.01755 -0.01064 -0.00238 0.00000 + 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000]; + assert (imsharpen (A), B, 5e-6) ***** test - im = [-0.4:.1:0.8 - 0.0:.1:1.2 - 0.1:.1:1.3 - -0.4:.2:2.0]; - - ## just clipping - assert (imadjust (im, [0; 1], [0; 1]), - [0 0 0 0 (0:.1:.8) - (0:.1:1) 1 1 - (.1:.1:1) 1 1 1 - 0 0 (0:.2:1) 1 1 1 1 1], eps) - - ## clipping and invert - assert (imadjust (im, [0; 1], [1; 0]), - [1 1 1 1 (1:-.1:.2) - (1:-.1:0) 0 0 - (.9:-.1:0) 0 0 0 - 1 1 (1:-.2:0) 0 0 0 0 0], eps) - - ## rescale - assert (imadjust (im, [.2; .7], [.1; .9]), - [1 1 1 1 1 1 1 2.6 4.2 5.8 7.4 9 9 - 1 1 1 2.6 4.2 5.8 7.4 9 9 9 9 9 9 - 1 1 2.6 4.2 5.8 7.4 9 9 9 9 9 9 9 - 1 1 1 1 4.2 7.4 9 9 9 9 9 9 9]/10, eps) - - ## rescale and invert - assert (imadjust (im, [.2; .7], [.9; .1]), - [9 9 9 9 9 9 9 7.4 5.8 4.2 2.6 1 1 - 9 9 9 7.4 5.8 4.2 2.6 1 1 1 1 1 1 - 9 9 7.4 5.8 4.2 2.6 1 1 1 1 1 1 1 - 9 9 9 9 5.8 2.6 1 1 1 1 1 1 1]/10, eps) -***** assert (imadjust (linspace (0, 1), [], [], 2), linspace (0, 1) .^ 2) -***** shared oRGB - oRGB = zeros (10, 1, 3); - oRGB(:,:,1) = [0 linspace(0,1,6) 1 1 1]'; - oRGB(:,:,2) = [0 0 linspace(0,1,6) 1 1]'; - oRGB(:,:,3) = [0 0 0 linspace(0,1,6) 1]'; -***** assert (imadjust (oRGB, [0; 1], [0; 1]), oRGB) -***** assert (imadjust (oRGB, [.2; .8], [0; 1]), - reshape ([[0 0 0 1/3 2/3 1 1 1 1 1]' - [0 0 0 0 1/3 2/3 1 1 1 1]' - [0 0 0 0 0 1/3 2/3 1 1 1]'], [10 1 3]), eps) -***** assert (imadjust (oRGB, [.2; .8], [.1; .9]), - reshape ([[.1 .1 .1 (1/3)+(.1/3) (2/3)-(.1/3) .9 .9 .9 .9 .9]' - [.1 .1 .1 .1 (1/3)+(.1/3) (2/3)-(.1/3) .9 .9 .9 .9]' - [.1 .1 .1 .1 .1 (1/3)+(.1/3) (2/3)-(.1/3) .9 .9 .9]'], - [10 1 3]), eps) -***** assert (imadjust (oRGB, [.2; .8], [.2; .8]), - reshape ([[2 2 2 4 6 8 8 8 8 8]' - [2 2 2 2 4 6 8 8 8 8]' - [2 2 2 2 2 4 6 8 8 8]']/10, [10 1 3]), eps) -***** assert (imadjust (oRGB, [0; 1], [.1 .2 .3; .9 .8 .7]), - reshape ([[1 1 2.6 4.2 5.8 7.4 9 9 9 9]' - [2 2 2 3.2 4.4 5.6 6.8 8 8 8]' - [3 3 3 3 3.8 4.6 5.4 6.2 7 7]']/10, [10 1 3]), eps) -***** assert (imadjust (oRGB, [.1 .2 .3; .9 .8 .7], [0; 1]), - reshape ([[0 0 .125 .375 .625 .875 1 1 1 1]' - [0 0 0 0 1/3 2/3 1 1 1 1]' - [0 0 0 0 0 .25 .75 1 1 1]'], [10 1 3]), eps*10) -***** assert (imadjust (oRGB, [.1 .2 .3; .9 .8 .7], [.2 0 .4; .5 1 .7 ]), - reshape ([[.2 .2 .2375 .3125 .3875 .4625 .5 .5 .5 .5]' - [0 0 0 0 1/3 2/3 1 1 1 1]' - [.4 .4 .4 .4 .4 .475 .625 .7 .7 .7]'], [10 1 3]), eps) + A = zeros (7, 7); + A(4,4) = 1; + B = [ + -0.0035147 -0.0065663 -0.0095539 -0.0108259 -0.0095539 -0.0065663 -0.0035147 + -0.0065663 -0.0122674 -0.0178490 -0.0202255 -0.0178490 -0.0122674 -0.0065663 + -0.0095539 -0.0178490 -0.0259701 -0.0294280 -0.0259701 -0.0178490 -0.0095539 + -0.0108259 -0.0202255 -0.0294280 1.7666538 -0.0294280 -0.0202255 -0.0108259 + -0.0095539 -0.0178490 -0.0259701 -0.0294280 -0.0259701 -0.0178490 -0.0095539 + -0.0065663 -0.0122674 -0.0178490 -0.0202255 -0.0178490 -0.0122674 -0.0065663 + -0.0035147 -0.0065663 -0.0095539 -0.0108259 -0.0095539 -0.0065663 -0.0035147]; + assert (imsharpen (A, "radius", 2), B, 5e-8) ***** test - img = rand (4, 4, 2, 3, 4); - adj = zeros (4, 4, 2, 3, 4); - for p = 1:2 - for q = 1:3 - for r = 1:4 - adj(:,:,p,q,r) = imadjust (img(:,:,p,q,r)); - endfor - endfor - endfor - assert (imadjust (img), adj) + A = zeros (7, 7); + A(4,4) = 1; + assert (imsharpen (A, "radius", 0.01), A) ***** test - img = rand (4, 4, 2, 3, 2); - adj = zeros (4, 4, 2, 3, 2); - in = reshape ([ 3 5 7 9 11 13 15 17 19 21 23 25; - 97 95 93 91 89 87 85 83 81 79 77 75] / 100, [2 2 3 2]); - out = reshape ([ 5 7 9 11 14 15 17 19 21 23 25 27; - 95 93 91 89 87 85 83 81 79 77 75 73] / 100, [2 2 3 2]); - gamma = reshape (0.6:.1:1.7, [1 2 3 2]); - for p = 1:2 - for q = 1:3 - for r = 1:2 - adj(:,:,p,q,r) = imadjust (img(:,:,p,q,r), in(:,p,q,r), - out(:,p,q,r), gamma(1,p,q,r)); - endfor - endfor - endfor - assert (imadjust (img, in, out, gamma), adj, eps) + A = zeros (7, 7); + A(4,4) = 1; + B = A; + B(3:5,3:5) = -0.000000000011110; + B(3:5,4) = -0.000002981278097; + B(4,3:5) = -0.000002981278097; + B(4,4) = 1.000011925156828; + assert (imsharpen (A, "radius", 0.2), B, eps*10) ***** test - in = int16 (1:6); - assert (imadjust (in), int16 ([-32768 -19661 -6554 6553 19660 32767])) - assert (imadjust (in, []), in) + A = zeros (7, 7); + A(4,4) = 1; + B = [ + 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 + 0.00000 -0.00297 -0.01331 -0.02194 -0.01331 -0.00297 0.00000 + 0.00000 -0.01331 -0.05963 -0.09832 -0.05963 -0.01331 0.00000 + 0.00000 -0.02194 -0.09832 1.83790 -0.09832 -0.02194 0.00000 + 0.00000 -0.01331 -0.05963 -0.09832 -0.05963 -0.01331 0.00000 + 0.00000 -0.00297 -0.01331 -0.02194 -0.01331 -0.00297 0.00000 + 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000]; + assert (imsharpen (A, "amount", 1), B, 5e-6) ***** test - in = uint8([ - 35 1 6 26 19 24 - 3 32 7 21 23 25 - 31 9 2 22 27 20 - 8 28 33 17 10 15 - 30 5 34 12 14 16 - 4 36 29 13 18 11]); - out = uint8([ - 12 0 0 1 0 0 - 0 8 0 0 0 0 - 7 0 0 0 2 0 - 0 3 9 0 0 0 - 6 0 11 0 0 0 - 0 13 4 0 0 0]); - assert (imadjust (in, [.1 .9], [0 1]), out); + A = zeros (7, 7); + A(4,4) = 1; + B = zeros (7, 7); + B(4,4) = 1.670317742690299; + B(4,3) = -0.078656265079077; + B(3,4) = -0.078656265079077; + B(4,5) = -0.078656265079077; + B(5,4) = -0.078656265079077; + assert (imsharpen (A, "Threshold", 0.117341762), B, eps*10) ***** test - in = uint8([ - 140 4 24 104 76 96 - 12 128 28 84 92 100 - 124 36 8 88 108 80 - 32 112 132 68 40 60 - 120 20 136 48 56 64 - 16 144 116 52 72 44]); - out = uint8([ - 143 0 0 98 63 88 - 0 128 3 73 83 93 - 123 13 0 78 103 68 - 8 108 133 53 18 43 - 118 0 138 28 38 48 - 0 148 113 33 58 23]); - assert (imadjust (in, [.1 .9], [0 1]), out); + A = zeros (7, 7); + A(4,4) = 1; + B = zeros (7, 7); + B(4,4) = 1.670317742690299; + assert (imsharpen (A, "Threshold", 0.117341763), B, eps*10) +***** test + A = zeros (7, 7, "uint8"); + A(3:5,3:5) = 150; + B = zeros (7, 7, "uint8"); + B(3:5,3:5) = 211; + B(4,3:5) = 195; + B(3:5,4) = 195; + B(4,4) = 175; + assert (imsharpen (A), B) +***** test + A = zeros (7, 7, "uint8"); + A(3:5,3:5) = 100; + B = zeros (7, 7, "uint8"); + B(3:5,3:5) = 173; + assert (imsharpen (A, "radius", 4), B) +***** test + A = zeros (7, 7, 3, "uint8"); + A(4,4,:) = 255; + assert (imsharpen (A), A) ***** xtest - in_u8 = randi ([0 255], 5, 5, 2, 3, "uint8"); - in_u16 = randi ([0 65535], 5, 5, 2, 3, "uint16"); - in_i16 = randi ([-32768 32767], 5, 5, 2, 3, "int16"); - in_u8_d = im2double (in_u8); - in_u16_d = im2double (in_u16); - in_i16_d = im2double (in_i16); - lim_u8 = eps + 0.5 / double (intmax ("uint8")); - lim_u16 = eps + 0.5 / double (intmax ("uint16")); - lim_i16 = eps + 0.5 / ( double (intmax("int16")) - double (intmin ("int16")) ); + A = zeros(7,7,3, "uint8"); + A(4,4,1) = 255; + B = A; + B(4,4,2) = 146; # Octave result is 145; + B(4,4,3) = 100; # Octave result is 99; + assert (imsharpen (A), B) +!!!!! known failure +ASSERT errors for: assert (imsharpen (A),B) - ## default values - assert (im2double (imadjust (in_u8)), imadjust (in_u8_d), lim_u8) - assert (im2double( imadjust (in_u16)), imadjust (in_u16_d), lim_u16) - assert (im2double( imadjust (in_i16)), imadjust (in_i16_d), lim_i16) + Location | Observed | Expected | Reason + (4,4,2) 145 146 Abs err 0 exceeds tol 0 by 0 + (4,4,3) 99 100 Abs err 0 exceeds tol 0 by 0 +***** xtest + A = zeros (7, 7, 3, "uint8"); + A(3:5,3:5,1) = 100; + A(3:5,3:5,2) = 150; + B = A; + B(3:5,3:5,1) = 164; + B(3:5,4,1) = 146; # Octave result is 147 + B(4,3:5,1) = 146; # Octave result is 145 + B(4,4,1) = 125; # Octave result is 126 + B(3:5,3:5,2) = 213; + B(3:5,4,2) = 195; # Octave result is 196 + B(4,3:5,2) = 195; # Octave result is 196 + B(4,4,2) = 175; + B(3:5,3:5,3) = 79; + B(3:5,4,3) = 62; + B(4,3:5,3) = 62; + B(4,4,3) = 40; # Octave result is 39 + assert (imsharpen (A), B) +!!!!! known failure +ASSERT errors for: assert (imsharpen (A),B) - ## single adjustment for all planes - args = {[.3; .7], [.1; .9], [1.5]}; - assert (im2double (imadjust (in_u8, args{:})), imadjust (in_u8_d, args{:}), lim_u8) - assert (im2double (imadjust (in_u16, args{:})), imadjust (in_u16_d, args{:}), lim_u16) - assert (im2double (imadjust (in_i16, args{:})), imadjust (in_i16_d, args{:}), lim_i16) + Location | Observed | Expected | Reason + (4,3,1) 147 146 Abs err 1 exceeds tol 0 by 1 + (3,4,1) 147 146 Abs err 1 exceeds tol 0 by 1 + (4,4,1) 126 125 Abs err 1 exceeds tol 0 by 1 + (5,4,1) 147 146 Abs err 1 exceeds tol 0 by 1 + (4,5,1) 147 146 Abs err 1 exceeds tol 0 by 1 + (4,3,2) 196 195 Abs err 1 exceeds tol 0 by 1 + (3,4,2) 196 195 Abs err 1 exceeds tol 0 by 1 + (5,4,2) 196 195 Abs err 1 exceeds tol 0 by 1 + (4,5,2) 196 195 Abs err 1 exceeds tol 0 by 1 + (4,4,3) 39 40 Abs err 0 exceeds tol 0 by 0 +***** error imsharpen () +***** error imsharpen (ones (3, 3), "Radius") +***** error imsharpen (ones (3, 3), "Radius", 0) +***** error imsharpen (ones (3, 3), "Amount", -1) +***** error imsharpen (ones (3, 3), "Threshold", 1.5) +***** error imsharpen (ones (3, 3), "Threshold", -1) +***** error imsharpen (ones (3, 3), "foo") +***** error imsharpen ("foo") +20 tests, 18 passed, 2 known failures, 0 skipped +[inst/imtransform.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imtransform.m +***** demo + ## Various linear transforms + figure (); + im = [checkerboard(20, 2, 4); checkerboard(40, 1, 2)]; + %input space corners + incp = [1 1; 160 1; 160 160; 1 160]; + udata = [min(incp(:,1)) max(incp(:,1))]; + vdata = [min(incp(:,2)) max(incp(:,2))]; + subplot (2,3,1); + imshow (im) + hold on + plot (incp(:,1), incp(:,2), 'ob') + axis on + xlabel ('Original') + + % Translation and scaling + outcp = incp * 2; + outcp(:,1) += 200; + outcp(:,2) += 500; + T = maketform ('affine', incp(1:3,:), outcp(1:3,:)); + subplot (2,3,2); + [im2 xdata ydata] = imtransform (im, T, 'udata', udata, + 'vdata', vdata, 'fillvalues', 1); + imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata) + set (gca, 'xlim', xdata, 'ylim', ydata) + axis on, hold on, xlabel ('Translation / Scaling'); + plot (outcp(:,1), outcp(:,2), 'or') + + % Shear + outcp = [1 1; 160 1; 140 160; -19 160]; % affine only needs 3 control points + T = maketform ('affine', incp(1:3,:), outcp(1:3,:)); + subplot (2,3,3); + [im2 xdata ydata] = imtransform (im, T, 'udata', udata, + 'vdata', vdata, 'fillvalues', 1); + imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata) + set (gca, 'xlim', xdata, 'ylim', ydata) + axis on, hold on, xlabel ('Shear'); + plot (outcp(:,1), outcp(:,2), 'or') + + % Rotation + theta = pi/4; + T = maketform ('affine', [cos(theta) -sin(theta); ... + sin(theta) cos(theta); 0 0]); + outcp = tformfwd (T, incp); + subplot (2,3,4); + [im2 xdata ydata] = imtransform (im, T, 'udata', udata, + 'vdata', vdata, 'fillvalues', 1 ); + imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata) + set (gca, 'xlim', xdata, 'ylim', ydata) + axis on, hold on, xlabel ('Rotation'); + plot (outcp(:,1), outcp(:,2), 'or') - ## single adjustment for all planes (mixed with some complement) - args = {reshape([.2 .3 .25 .1 0 .1; .9 .7 .85 .9 1 .8], [2 2 3]), - reshape([.1 .2 .05 .9 1 .3; .9 .85 .7 .1 0 .9], [2 2 3]), - reshape([1 .75 1 1.2 1.5 2], [1 2 3])}; - assert (im2double (imadjust (in_u8, args{:})), imadjust (in_u8_d, args{:}), lim_u8) - assert (im2double (imadjust (in_u16, args{:})), imadjust (in_u16_d, args{:}), lim_u16) - assert (im2double (imadjust (in_i16, args{:})), imadjust (in_i16_d, args{:}), lim_i16) + % Reflection around x axis + outcp = incp; + outcp(:,2) *= -1; + T = cp2tform (incp, outcp, 'similarity'); + subplot (2,3,5); + [im2 xdata ydata] = imtransform (im, T, 'udata', udata, + 'vdata', vdata, 'fillvalues', 1 ); + imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata) + set (gca, 'xlim', xdata, 'ylim', ydata) + axis on, hold on, xlabel ('Reflection'); + plot (outcp(:,1), outcp(:,2), 'or') - ## test use of [] as limit and negative - args = {[], [.95; 0], 1.25}; - assert (im2double (imadjust (in_u8, args{:})), imadjust (in_u8_d, args{:}), lim_u8) - assert (im2double (imadjust (in_u16, args{:})), imadjust (in_u16_d, args{:}), lim_u16) - assert (im2double (imadjust (in_i16, args{:})), imadjust (in_i16_d, args{:}), lim_i16) -36 tests, 36 passed, 0 known failure, 0 skipped -[inst/im2uint8.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/im2uint8.m -***** assert (im2uint8 (uint8 ([1 2 3])), uint8 ([1 2 3])); -***** assert (im2uint8 (uint16 ([0 65535])), uint8 ([0 255])); -***** assert (im2uint8 ([0 0.5 1]), uint8 ([0 128 255])); -***** assert (im2uint8 ([1 2]), uint8 ([255 255])); -***** assert (im2uint8 ([-1 0 0.5 1 2]), uint8 ([0 0 128 255 255])); -***** assert (im2uint8 (int16 ([-32768 0 32768])), uint8 ([0 128 255])); -***** assert (im2uint8 ([false true]), uint8 ([0 255])); -***** assert (im2uint8 ([true false]), uint8 ([255 0])); -***** assert (im2uint8 ([1 256], "indexed"), uint8 ([0 255])); -***** assert (im2uint8 ([3 25], "indexed"), uint8 ([2 24])); -***** assert (im2uint8 (uint16 ([3 25]), "indexed"), uint8 ([3 25])); -***** error im2uint8 ([0 1 2], "indexed"); -***** error im2uint8 (int16 ([17 8]), "indexed"); -***** error im2uint8 (int16 ([-7 8]), "indexed"); -***** error im2uint8 ([false true], "indexed"); -***** error im2uint8 (uint16 (256), "indexed"); -***** error im2uint8 (257, "indexed"); -***** assert (im2uint8 ((1:255) ./ 256), uint8 ([1:128 128:254])) -***** assert (im2uint8 ((0:255) ./ 256), uint8 ([0:128 128:254])) -19 tests, 19 passed, 0 known failure, 0 skipped -[inst/checkerboard.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/checkerboard.m -***** demo - ## Simplest case, default checkerboard size: - ## 8 by 8 checkerboard, with squares 10 pixel wide - board = checkerboard (); - imshow (board) + % Projection + outcp = [1 1; 160 -40; 220 220; 12 140]; + T = maketform ('projective', incp, outcp); + subplot (2,3,6); + [im2 xdata ydata] = imtransform (im, T, 'udata', udata, + 'vdata', vdata, 'fillvalues', 1 ); + imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata) + set (gca, 'xlim', xdata, 'ylim', ydata) + axis on, hold on, xlabel ('Projection'); + plot (outcp(:,1), outcp(:,2), 'or') ***** demo - ## Simplest case, default checkerboard size: - ## 8 by 16 checkerboard, with squares 5 pixel wide - board = checkerboard (5, 4, 8); - imshow (board) -***** assert (checkerboard (0), zeros (0, 0)) -***** assert (checkerboard (0, 3), zeros (0, 0)) -***** assert (checkerboard (0, 2, 4), zeros (0, 0)) -***** assert (checkerboard (0, 2, 4, 3), zeros (0, 0, 0)) -***** assert (checkerboard (0, 2, 4, 3, 2), zeros (0, 0, 0, 0)) -***** assert (checkerboard (1, 4, 2, 3, 0), zeros (8, 4, 6, 0)) -***** assert (checkerboard (1, 4, 0, 3, 2), zeros (8, 0, 6, 4)) -***** assert (checkerboard (2, 4, 0, 3, 2), zeros (16, 0, 12, 8)) + ## Streched image + rad = 2; % minimum value: 4/pi + [uu vv] = meshgrid ((-2:2)/rad, (-2:2)/rad); + rescfactor = sin ((uu.^2 + vv.^2).^.5); + inpts = [(reshape (uu, numel (uu), 1)), (reshape (vv, numel (uu), 1))]; + xx = rescfactor .* sign(uu); + yy = rescfactor .* sign(vv); + outpts = [reshape(xx, numel (xx), 1) reshape(yy, numel (yy), 1)]; + + T = cp2tform (inpts, outpts, "polynomial", 4); + figure; + subplot (1,2,1) + im = zeros (800, 800, 3); + im(:,:,1) = checkerboard (100) > 0.2; + im(:,:,3) = checkerboard (100) < 0.2; + [im2 xdata ydata] = imtransform (im, T, 'udata', [-2 2], + 'vdata', [-2 2], 'fillvalues', + [0 1 0]); + imh = imshow (im2); + set (imh, 'xdata', xdata, 'ydata', ydata) + set (gca, 'xlim', xdata, 'ylim', ydata) + [im cmap] = imread ('default.img'); + subplot (1,2,2) + [im2 xdata ydata] = imtransform (im, T, 'udata', [-1 1], + 'vdata', [-1 1], 'fillvalues', + round (length (cmap) / 2)); + imh = imshow (im2, cmap); ***** test - out = zeros (80); - i1 = ((1:20:80) + (0:9)')(:); - i2 = ((11:20:80) + (0:9)')(:); - out(i1, i2) = 1; - out(i2, i1) = 1; - i1r = ((41:20:80) + (0:9)')(:); - i2r = ((51:20:80) + (0:9)')(:); - out(i2, i1r) = 0.7; - out(i1, i2r) = 0.7; - assert (checkerboard (), out) - assert (checkerboard (10, 4, 4), out) - assert (checkerboard (10, [4 4]), out) - assert (checkerboard (10, [4; 4]), out) + im = checkerboard (); + incp = [0 0; 0 1; 1 1]; + scl = 10; + outcp = scl * incp; + T = maketform ('affine', incp, outcp); + [im2 xdata ydata] = imtransform (im, T, 'udata', [0 1], + 'vdata', [0 1], 'size', [500 500]); + assert (xdata, scl * ([0 1])) + assert (ydata, scl * ([0 1])) + assert (size (im2), [500 500]) ***** test - out = zeros (8); - out(2:2:8, 1:2:8) = 1; - out(1:2:8, 2:2:8) = 1; - out(1:2:8, 6:2:8) = 0.7; - out(2:2:8, 5:2:8) = 0.7; - assert (checkerboard (1), out) - assert (checkerboard (1, 4), out) - assert (checkerboard (1, 4, 4), out) - assert (checkerboard (1, [4 4]), out) + im = checkerboard (); + incp = [0 0; 0 1; 1 1]; + scl = 10; + outcp = scl * incp; + xyscale = scl; + T = maketform ('affine', incp, outcp); + [im2 xdata ydata] = imtransform (im, T, 'xyscale', xyscale); + assert (size (im2), size (im), 1) ***** test - out = zeros (10); - out(2:2:10, 1:2:10) = 1; - out(1:2:10, 2:2:10) = 1; - out(1:2:10, 6:2:10) = 0.7; - out(2:2:10, 7:2:10) = 0.7; - assert (checkerboard (1, 5), out) - assert (checkerboard (1, 5, 5), out) - assert (checkerboard (1, [5 5]), out) + im = checkerboard (100, 10, 4); + theta = 2 * pi; + T = maketform ("affine", [cos(theta) -sin(theta); ... + sin(theta) cos(theta); 0 0]); + im2 = imtransform (im, T, "nearest", "xdata", [1 800], "ydata", [1 2000]); + im = im(2:end-1, 2:end-1); %avoid boundaries + im2 = im2(2:end-1, 2:end-1); + assert (im, im2) ***** test - out = zeros (20); - out([1:4:20 2:4:20], [3:4:20 4:4:20]) = 1; - out([3:4:20 4:4:20], [1:4:20 2:4:20]) = 1; - out([1:4:20 2:4:20], [11:4:20 12:4:20]) = 0.7; - out([3:4:20 4:4:20], [13:4:20 14:4:20]) = 0.7; - assert (checkerboard (2, 5), out) - assert (checkerboard (2, 5, 5), out) - assert (checkerboard (2, [5 5]), out) + im = checkerboard (20, 10, 4); + theta = pi/6; + T = maketform ('affine', [cos(theta) -sin(theta); ... + sin(theta) cos(theta); 0 0]); + [im2, xdata] = imtransform (im, T); + nu = columns(im); + nv = rows(im); + nx = xdata(2); + diag = sqrt (nu^2 + nv^2); + ang = atan (nv / nu); + assert (nx, diag * abs (cos (theta - ang)), + diag * 1 / size (im2, 2)) ***** test - out = zeros (4, 4, 4); - out([1 3], 1, [1 3]) = 1; - out([2 4], 2, [1 3]) = 1; - out([1 3], 2, [2 4]) = 1; - out([2 4], 1, [2 4]) = 1; - out([1 3], 3, [1 3]) = 0.7; - out([2 4], 4, [1 3]) = 0.7; - out([1 3], 4, [2 4]) = 0.7; - out([2 4], 3, [2 4]) = 0.7; - assert (checkerboard (1, [2 2 2]), out) - assert (checkerboard (1, 2, 2, 2), out) + im = rand (2); + tmat = [eye(2); 0 0]; + T = maketform ("affine", tmat); + im2 = imtransform (im, T, "xdata", [1 3]); + assert (im2(:,3), zeros (2,1)) ***** test - out = zeros (8, 8, 8); - out([1 2 5 6], [1 2], [1 2 5 6]) = 1; - out([3 4 7 8], [3 4], [1 2 5 6]) = 1; - out([1 2 5 6], [3 4], [3 4 7 8]) = 1; - out([3 4 7 8], [1 2], [3 4 7 8]) = 1; - out([1 2 5 6], [5 6], [1 2 5 6]) = 0.7; - out([3 4 7 8], [7 8], [1 2 5 6]) = 0.7; - out([1 2 5 6], [7 8], [3 4 7 8]) = 0.7; - out([3 4 7 8], [5 6], [3 4 7 8]) = 0.7; - assert (checkerboard (2, [2 2 2]), out) - assert (checkerboard (2, 2, 2, 2), out) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/imgradientxy.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imgradientxy.m + im = rand (2); + tmat = [eye(2); 0 0]; + T = maketform ('affine', tmat); + im2 = imtransform (im, T, "xdata", [1 3]); + assert (size (im2), [2 3]) ***** test - A = [0 1 0 - 1 1 1 - 0 1 0]; - - [gxSobel, gySobel] = imgradientxy (A); - [gxSobel2, gySobel2] = imgradientxy (A, "Sobel"); - assert (gxSobel, - [ 3 0 -3 - 4 0 -4 - 3 0 -3]); - assert (gySobel, - [ 3 4 3 - 0 0 0 - -3 -4 -3]); - - ## test default method - assert(gxSobel, gxSobel2); - assert(gySobel, gySobel2); - - [gxPrewitt, gyPrewitt] = imgradientxy (A, "Prewitt"); - assert (gxPrewitt, - [ 2 0 -2 - 3 0 -3 - 2 0 -2]); - assert (gyPrewitt, - [ 2 3 2 - 0 0 0 - -2 -3 -2]); - - [gxCd, gyCd] = imgradientxy (A, "CentralDifference"); - assert (gxCd, - [ 0.5 0.0 -0.5 - 0.5 0.0 -0.5 - 0.5 0.0 -0.5]); - assert (gyCd, - [ 0.5 0.5 0.5 - 0 0 0 - -0.5 -0.5 -0.5]); + im = rand (2); + tmat = [eye(2); 0 0]; + T = maketform ('affine', tmat); + im2 = imtransform (im, T, "xyscale", [0.5 0.5]); + assert (size (im2), [3 3]) +***** test + im = [1,2,3,4; 5,6,7,8; 9,10,11,12; 13,14,15,16]; + tmat = [eye(2); 0 0]; + T = maketform ('affine', tmat); + im2 = imtransform (im, T, 'xdata', [1 4], 'ydata', [4 1]); + assert (im2, [13,14,15,16; 9,10,11,12; 5,6,7,8; 1,2,3,4]) - [gxCd, gyCd] = imgradientxy (A, "Central"); - assert (gxCd, - [ 0.5 0.0 -0.5 - 0.5 0.0 -0.5 - 0.5 0.0 -0.5]); - assert (gyCd, - [ 0.5 0.5 0.5 - 0 0 0 - -0.5 -0.5 -0.5]); + im2 = imtransform (im, T, 'xdata', [4 1], 'ydata', [1 4]); + assert (im2, [4,3,2,1; 8,7,6,5; 12,11,10,9; 16,15,14,13]) - [gxId, gyId] = imgradientxy(A, "IntermediateDifference"); - assert (gxId, - [ 1 -1 0 - 0 0 -1 - 1 -1 0]); - assert (gyId, - [ 1 0 1 - -1 0 -1 - 0 -1 0]); + [im2, xd, yd] = imtransform (im, T, 'xdata', [4 1], 'ydata', [4 1]); + assert (im2, [16,15,14,13; 12,11,10,9; 8,7,6,5; 4,3,2,1]) + assert (xd, [4 1]) + assert (yd, [4 1]) - [gxId, gyId] = imgradientxy(A, "Intermediate"); - assert (gxId, - [ 1 -1 0 - 0 0 -1 - 1 -1 0]); - assert (gyId, - [ 1 0 1 - -1 0 -1 - 0 -1 0]); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/imfindcircles.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imfindcircles.m -***** shared im0, rgb0, im1 - im0 = [0 0 0 0 0; - 0 1 2 1 0; - 0 2 5 2 0; - 0 1 2 1 0; - 0 0 0 0 0]; - rgb0 = cat (3, im0, 3.*im0, 2.*im0); - im1 = zeros (20); - im1(2:6, 5:9) = 1; - im1(13:19, 13:19) = 1; -***** function image = circlesimage (numx, numy, centersx, centersy, rs, values) - ## create an image with circles of given parameters - num = length (centersx); - image = zeros (numy, numx); - [indy, indx] = meshgrid (1:numx, 1:numy); - for n = 1:num - centerx = centersx(n); - centery = centersy(n); - r = rs(n); - value = values(n); - dist_squared = (indx - centerx).^ 2 + (indy - centery).^ 2; - image(dist_squared <= (r-0.5)^2) = value; +***** error imtransform () +***** error imtransform (rand(2)) +***** error ... + imtransform (rand(2), maketform ('affine', [eye(2); 0 0]), ... + 'udata', [1 2], 'vdata', [2 1]); +***** error ... + imtransform (rand(2), maketform ('affine', [eye(2); 0 0]), ... + 'udata', [2 1], 'vdata', [1 2]); +12 tests, 12 passed, 0 known failure, 0 skipped +[inst/fftconvn.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/fftconvn.m +***** function test_shapes (a, b, precision) + shapes = {"valid", "same", "full"}; + for i = 1:3 + shape = shapes{i}; + assert (fftconvn (a, b, shape), convn (a, b, shape), precision); endfor + assert (fftconvn (a, b), fftconvn (a, b, "full")); ***** endfunction -***** error imfindcircles () -***** error imfindcircles (im0) -***** error imfindcircles (im0, [1 2 3]) -***** error imfindcircles (im0, -3) -***** error imfindcircles (im0, 4+2*i) -***** error imfindcircles (ones (5,5,4), 2) -***** error imfindcircles (ones (5,5,5,5), 2) -***** error imfindcircles (im0, [2 1]) -***** error imfindcircles (im0, 2, "rubbish") -***** error imfindcircles (im0, 2, "more", "rubbish") -***** error imfindcircles (im0, 2, "ObjectPolarity", "rubbish") -***** error imfindcircles (im0, 2, "ObjectPolarity", 5) -***** error imfindcircles (im0, 2, "ObjectPolarity") -***** error imfindcircles (im0, 2, "Method", "rubbish") -***** error imfindcircles (im0, 2, "Method", 5) -***** error imfindcircles (im0, 2, "Method") -***** error imfindcircles (im0, 2, "Sensitivity", "rubbish") -***** error imfindcircles (im0, 2, "Sensitivity") -***** error imfindcircles (im0, 2, "Sensitivity", -0.1) -***** error imfindcircles (im0, 2, "Sensitivity", 1.1) -***** error imfindcircles (im0, 2, "Sensitivity", [0.1 0.2]) -***** error imfindcircles (im0, 2, "EdgeThreshold", "rubbish") -***** error imfindcircles (im0, 2, "EdgeThreshold") -***** error imfindcircles (im0, 2, "EdgeThreshold", -0.1) -***** error imfindcircles (im0, 2, "EdgeThreshold", 1.1) -***** error imfindcircles (im0, 2, "EdgeThreshold", [0.1 0.2]) -***** error imfindcircles (im0, 2, "EdgeThreshold", 0.1, "ObjectPolarity", "bright", - "Sensitivity", 0.3, "Method", "PhaseCode", "more", 1) -***** test # none of this should fail - imfindcircles (im0, 2); - imfindcircles (im0, [1 2]); - imfindcircles (logical (im0), 2); - imfindcircles (logical (im0), [1 2]); - imfindcircles (rgb0, 2); - imfindcircles (rgb0, [1 2]); - imfindcircles (uint8 (im0), 2); - imfindcircles (uint8 (im0), [1 2]); - imfindcircles (im0, 2, "ObjectPolarity", "bright"); - imfindcircles (im0, 2, "ObjectPolarity", "dark"); - imfindcircles (im0, 2, "Method", "PhaseCode"); - imfindcircles (im0, 2, "Sensitivity", 0.5); - imfindcircles (im0, 2, "EdgeThreshold", 0.5); - imfindcircles (im0, 2, "ObjectPolarity", "bright", "Method", "PhaseCode"); - imfindcircles (im0, 2, "ObjectPolarity", "bright", "Sensitivity", 0.3, - "Method", "PhaseCode"); - imfindcircles (im0, 2, "EdgeThreshold", 0.1, "ObjectPolarity", "bright", - "Sensitivity", 0.3, "Method", "PhaseCode"); -***** test - centers = imfindcircles (im1, 2); - assert (size (centers, 2), 2) - assert (class (centers), "double") -***** test - [centers, radii] = imfindcircles (im1, [1 5]); - assert (size (centers, 2), 2) - assert (size (radii, 2), 1) - assert (class (radii), "double") -***** test - [centers, radii, strengths] = imfindcircles (im1, [1 5]); - assert (size (strengths, 2), 1) - assert (class (strengths), "double") -***** error [a b c d] = imfindcircles (im0, 2); -***** test ## sub-pixel accuracy of circle center - xs = [95.7]; - ys = [101.1]; - rs = [50]; - vals = [0.5]; - im = circlesimage (200, 200, xs, ys, rs, vals); - filt = ones (3) ./ 9; - im = imfilter (im, filt); - [centers, radii] = imfindcircles (im, [40 60]); - assert (centers, [101.1, 95.7], 0.1); - assert (radii, 50, 1); -***** test - ## specificity to circular shapes and strengths output value - xs = [100 202]; - ys = [101, 203]; - rs = [40, 41]; - vals = [0.8, 0.9]; - im = circlesimage (300, 300, xs, ys, rs, vals); - filt = ones (3) ./ 9; - im = imfilter (im, filt); - im(30:170, 50:100) = 0; - im(20:120, 180:280) = 1; - [centers, radii, strengths] = imfindcircles (im, [30 50], "Sensitivity", 0.9); - assert (size (centers), [2 2]); - assert (centers, [203, 202; 101, 100], 1.5); - assert (radii, [40; 41], 2.5); - assert (strengths(1) / strengths(2) > 1.8, true); -***** test # radius range parameter & dark circles - xs = [50, 420, 180]; - ys = [80, 100, 200]; - rs = [35, 30, 40]; - vals = [0.7, 0.8, 0.9]; - im = circlesimage (300, 500, xs, ys, rs, vals); - filt = ones (3) ./ 9; - im = imfilter (im, filt); - [centers1, radii1] = imfindcircles (im, [28 36]); - [centers2, radii2] = imfindcircles (im, [28 42]); - assert (size (centers1), [2 2]); - assert (centers1, [100 420; 80 50], 0.2); - assert (radii1, [30; 35], 2); - assert (size (centers2), [3 2]); - im_dark = 1-im; - [centers_dark, radii_dark, strengths_dark] = imfindcircles (im_dark, [25 42], "ObjectPolarity", "dark"); - assert (sortrows (centers_dark), [80 50; 100 420; 200 180], 0.2); - assert (sortrows (radii_dark), [30; 35; 40], 1); -***** test # ability to find circles with big radius - xs = [111, 555, 341]; - ys = [222, 401, 161]; - rs = [45, 50, 150]; - vals = [0.6, 0.8, 0.7]; - im = circlesimage (400, 701, xs, ys, rs, vals); - [centers, radii] = imfindcircles (im, [140 160], "Sensitivity", 0.98); - assert (centers, [161, 341], 0.2); - assert (radii, 150, 1); -***** test # overlapping circles - xs = [105, 155]; - ys = [202, 221]; - rs = [45, 50]; - vals = [0.5, 0.8]; - im = circlesimage(385, 422, xs, ys, rs, vals); - filt = ones (3) ./ 9; - im = imfilter (im, filt); - [centers, radii] = imfindcircles (im, [30 80]); - assert (centers, [221, 155; 202, 105], 0.5); - assert (radii, [50; 45], 1); -***** test # overlapping circles, only 10 pixels apart - xs = [155, 155]; - ys = [175, 157]; - rs = [50, 50]; - vals = [0.7, 0.8]; - im = circlesimage (300, 300, xs, ys, rs, vals); - filt = ones (3) ./ 9; - im = imfilter (im, filt); - [centers, radii] = imfindcircles (im, [30 80], "Sensitivity", 0.95); - assert (centers, [157, 155; 175, 155], 1); - assert (radii, [50; 50], 1); -***** test # edge threshold parameter - xs = [100 202]; - ys = [101, 203]; - rs = [40, 41]; - vals = [0.1, 0.9]; - im = circlesimage (300, 300, xs, ys, rs, vals); - filt = ones (3) ./ 9; - im= imfilter (im, filt); - [centers_auto, radii_auto] = imfindcircles (im, [30 50]); - [centers_0, radii_0] = imfindcircles (im, [30 50], "EdgeThreshold", 0); - [centers_05, radii_05] = imfindcircles (im, [30 50], "EdgeThreshold", 0.5); - assert (centers_auto, [203, 202], 0.2); - assert (radii_auto, 41, 1); - assert (centers_0, [101, 100; 203, 202], 0.2); - assert (radii_0, [40; 41], 1); - assert (centers_05, [203, 202], 0.2); - assert (radii_05, 41, 1); -***** demo - ## First generate an input image: - model = [ 1.0 0.2 0.2 0.2 0.5 0 - 1.0 0.3 0.3 -0.1 -0.2 0 - -0.5 0.7 0.7 -0.5 0.5 0]; - im = phantom (model); - im(170:230,170:230) = 1; - im = imfilter (im, fspecial ("average", 3)); - im = imnoise (im, "salt & pepper"); - imshow (im); - - ## Find and show circles with radius between 20 and 50: - [centers, radii] = imfindcircles (im, [20 50]); - viscircles (centers, radii) - title ("found circles in red") -39 tests, 39 passed, 0 known failure, 0 skipped -[inst/im2int16.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/im2int16.m -***** assert (im2int16 (int16 ([-2 2 3])), int16 ([-2 2 3])); -***** assert (im2int16 (uint16 ([0 65535])), int16 ([-32768 32767])); -***** assert (im2int16 ([false true]), int16 ([-32768 32767])); -***** assert (im2int16 ([true false]), int16 ([32767 -32768])); -***** assert (im2int16 (uint8 ([0 127 128 255])), int16 ([-32768 -129 128 32767])); -***** assert (im2int16 ([0 1.4/65535 1.5/65535 2/65535 1]), int16 ([-32768 -32767 -32766 -32766 32767])); -***** assert (im2int16 ([0 0.5 1]), int16 ([-32768 0 32767])); -***** assert (im2int16 ([-1 0 1 2]), int16 ([-32768 -32768 32767 32767])); -***** error im2int16 ([1 2], "indexed"); -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/xyz2lab.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/xyz2lab.m -***** assert (xyz2lab ([0, 0, 0]), [0 0 0], 5e-2) -***** assert (xyz2lab ([0.4125, 0.2127, 0.0193]), [53.24, 80.09, 67.20], 5e-2) -***** assert (xyz2lab ([0.7700, 0.9278, 0.1385]), [97.14, -21.55, 94.48], 5e-2) -***** assert (xyz2lab ([0.3576, 0.7152, 0.1192]), [87.74, -86.18, 83.18], 5e-2) -***** assert (xyz2lab ([0.5380, 0.7873, 1.0694]), [91.11, -48.09, -14.13], 5e-2) -***** assert (xyz2lab ([0.1804, 0.07217, 0.9502]), [32.30, 79.19, -107.86], 5e-2) -***** assert (xyz2lab ([0.5929, 0.28484, 0.9696]), [60.32, 98.24, -60.83], 5e-2) -***** assert (xyz2lab ([0.9505, 1.0000, 1.0888]), [100, 0.00, 0.00], 5e-2) -***** assert (xyz2lab ([0.2034, 0.2140, 0.2330]), [53.39, 0.00, 0.00], 5e-2) -***** assert (xyz2lab ([0.2155, 0.1111, 0.0101]), [39.77, 64.51, 54.13], 5e-2) -***** assert (xyz2lab ([0.0883, 0.0455, 0.0041]), [25.42, 47.91, 37.91], 5e-2) -***** assert (xyz2lab ([0.02094, 0.0108, 0.00098]), [9.66, 29.68, 15.24], 5e-2) -***** assert (xyz2lab ([0.5276, 0.3812, 0.2482]), [68.11, 48.39, 22.83], 5e-2) -***** assert (xyz2lab ([1.5 1 1]), [100, 82.15, 5.60], 5e-2) - xyz_map = rand (64, 3); - assert (lab2xyz (xyz2lab (xyz_map)), xyz_map, 1e-5); +***** test test_shapes (randi (255, 100), randi (255, 10), 0.1) +***** test test_shapes (randi (255, 100, 100), randi (255, 10, 10), 0.1) +***** test test_shapes (randi (255, 100, 100, 100), randi (255, 10, 10, 10), 0.1) +***** test test_shapes (randi (255, 100, 50, 20), randi (255, 10, 7), 0.1) +***** test test_shapes (randi (255, 100, 50, 20), randi (255, 10), 0.1) ***** test - xyz_img = rand (64, 64, 3); - assert (lab2xyz (xyz2lab (xyz_img)), xyz_img, 1e-5); -***** assert (xyz2lab (sparse ([0 0 0])), [0 0 0], 5e-2) -***** assert (class (xyz2lab (single([0.5 0.5 0.5]))), 'single') -***** error xyz2lab () -***** error xyz2lab (1,2) -***** error xyz2lab ({1}) -***** error xyz2lab (ones (2,2)) + for s = [55 56 57 58] + test_shapes (randi (255, 200, 200), randi (255, s, s), 0.1) + endfor ***** test - xyz = rand (16, 16, 3, 5); - lab = zeros (size (xyz)); - for i = 1:5 - lab(:,:,:,i) = xyz2lab (xyz(:,:,:,i)); + for s = [203 204 205 206] + test_shapes (randi (255, s, s), randi (255, 52, 52), 0.1) endfor - assert (xyz2lab (xyz), lab) -22 tests, 22 passed, 0 known failure, 0 skipped +***** test test_shapes (randi (255, 100, 100, "uint8"), randi (255, 10, 10, "uint8"), 0.1) +***** test test_shapes (randi (255, 100, 100, "uint8"), randi (255, 10, 10), 0.1) +***** test test_shapes (randi (255, 100, 100, "single"), randi (255, 10, 10, "single"), 0.9) +***** test test_shapes (randi (255, 100, 100, "single"), randi (255, 10, 10), 0.9) +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/@imref2d/sizesMatch.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/sizesMatch.m +***** error id=Octave:invalid-fun-call sizesMatch (imref2d) +***** test + I = zeros (256, 256); + r = imref2d ([256, 256]); + assert (sizesMatch (r, I), true) + I2 = zeros (246, 300); + assert (sizesMatch (r, I2), false) +***** test + r = imref2d ([256, 256]); + assert (sizesMatch (r, []), false) +***** test + r = imref2d ([256, 256]); + assert (sizesMatch (r, 42), false) +***** test + r = imref2d ([256, 256]); + assert (sizesMatch (r, zeros (256, 256, 3, 2)), true) +***** test + I = zeros (384, 512, 3); + r = imref2d (size (I)); + assert (sizesMatch (r, I), true) +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/@imref2d/worldToIntrinsic.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/worldToIntrinsic.m +***** error id=Octave:invalid-fun-call worldToIntrinsic (imref2d) +***** error id=Octave:invalid-fun-call worldToIntrinsic (imref2d, 1, 2, 3) +***** error id=Octave:expected-real worldToIntrinsic (imref2d, 1j, 2) +***** error id=Octave:expected-real worldToIntrinsic (imref2d, 1, 2j) +***** error id=Octave:invalid-input-arg worldToIntrinsic (imref2d, [1, 2], 3) +***** error id=Octave:invalid-input-arg worldToIntrinsic (imref2d, [1], [2, 3]) +***** test + r = imref2d ([512, 512], 0.3125, 0.3125); + xW = [38.44, 39.44, 38.44, -0.2]; + yW = [68.75, 68.75, 75.75, -1]; + [xI, yI] = worldToIntrinsic (r, xW, yW); + assert (xI, [123.008, 126.208, 123.008, -0.64], 1e-6) + assert (yI, [220, 220, 242.4, -3.2], 1e-6) +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/@imref2d/intrinsicToWorld.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/intrinsicToWorld.m +***** error id=Octave:invalid-fun-call intrinsicToWorld (imref2d) +***** error id=Octave:invalid-fun-call intrinsicToWorld (imref2d, 1, 2, 3) +***** error id=Octave:expected-real intrinsicToWorld (imref2d, 1j, 2) +***** error id=Octave:expected-real intrinsicToWorld (imref2d, 1, 2j) +***** error id=Octave:invalid-input-arg intrinsicToWorld (imref2d, [1, 2], 3) +***** error id=Octave:invalid-input-arg intrinsicToWorld (imref2d, [1], [2, 3]) +***** test + r = imref2d ([512, 512], 0.3125, 0.3125); + xIntrinsic = [34, 442]; + yIntrinsic = [172, 172]; + [xWorld, yWorld] = intrinsicToWorld (r, xIntrinsic, yIntrinsic); + assert (xWorld, [10.625, 138.125]) + assert (yWorld, [53.75, 53.75]) +***** test + [xWorld, yWorld] = intrinsicToWorld (imref2d, -5.3, -2.8); + assert (xWorld, -5.3) + assert (yWorld, -2.8) +***** test + [xW, yW] = intrinsicToWorld (imref2d, [1, 2; 3, 4], [2, 3; 5, 9]); + assert (xW, [1, 2; 3, 4]) + assert (yW, [2, 3; 5, 9]) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/@imref2d/worldToSubscript.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/worldToSubscript.m +***** error id=Octave:invalid-fun-call worldToSubscript (imref2d) +***** error id=Octave:invalid-fun-call worldToSubscript (imref2d, 1, 2, 3) +***** error id=Octave:expected-real worldToSubscript (imref2d, 1j, 2) +***** error id=Octave:expected-real worldToSubscript (imref2d, 1, 2j) +***** error id=Octave:invalid-input-arg worldToSubscript (imref2d, [1, 2], 3) +***** error id=Octave:invalid-input-arg worldToSubscript (imref2d, [1], [2, 3]) +***** test + r = imref2d ([512, 512], 0.3125, 0.3125); + xW = [38.44, 39.44, 38.44, -0.2]; + yW = [68.75, 68.75, 75.75, -1]; + [rS, cS] = worldToSubscript (r, xW, yW); + assert (rS, [220, 220, 242, NaN]) + assert (cS, [123, 126, 123, NaN]) +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/@imref2d/imref2d.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/imref2d.m +***** error id=Octave:invalid-fun-call imref2d (1, 2, 3, 4) +***** error id=Octave:invalid-input-arg imref2d (42) +***** error id=Octave:invalid-input-arg imref2d ([42]) +***** error id=Octave:expected-integer imref2d ([4.2, 42]) +***** error id=Octave:expected-positive imref2d ([0, 0]) +***** error id=Octave:expected-positive imref2d ([-4, 2]) +***** error id=Octave:expected-positive imref2d ([4, 2], 0, 2) +***** error id=Octave:expected-positive imref2d ([4, 2], 2, 0) +***** error id=Octave:expected-real imref2d ([4, 2], j, 2) +***** error id=Octave:expected-real imref2d ([4, 2], 2, j) +***** error id=Octave:expected-real imref2d ([4, 2], [j, 2], [3, 4]) +***** error id=Octave:expected-real imref2d ([4, 2], [1, 2], [j, 4]) +***** error id=Octave:expected-vector imref2d ([4, 2], [], []) +***** error id=Octave:expected-vector imref2d ([4, 2], [], [1]) +***** error id=Octave:expected-scalar imref2d ([4, 2], [1], []) +***** error id=Octave:incorrect-size imref2d ([4, 2], [1, 2], [0]) +***** error id=Octave:incorrect-size imref2d ([4, 2], [1, 2], [1, 2, 3]) +***** error id=Octave:incorrect-size imref2d ([4, 2], [1, 2, 3], [1, 2]) +***** error id=Octave:incorrect-size imref2d ([4, 2], [1; 2], [1, 2]) +***** error id=Octave:incorrect-size imref2d ([4, 2], [1, 2], [1; 2]) +***** error id=Octave:invalid-indexing imref2d().InvalidProperty +***** error id=Octave:expected-increasing imref2d ([100 200], [1.5 0.5], [2.5 3.5]) +***** error id=Octave:expected-increasing imref2d ([100 200], [1.5 2.5], [2.5 1.5]) +***** test + r = imref2d; + assert (r.XWorldLimits, [0.5, 2.5]) + assert (r.YWorldLimits, [0.5, 2.5]) + assert (r.ImageSize, [2, 2]) + assert (r.PixelExtentInWorldX, 1) + assert (r.PixelExtentInWorldY, 1) + assert (r.ImageExtentInWorldX, 2) + assert (r.ImageExtentInWorldY, 2) + assert (r.XIntrinsicLimits, [0.5, 2.5]) + assert (r.YIntrinsicLimits, [0.5, 2.5]) +***** test + r = imref2d ([100, 200]); + assert (r.XWorldLimits, [0.5, 200.5]) + assert (r.YWorldLimits, [0.5, 100.5]) + assert (r.ImageSize, [100, 200]) + assert (r.PixelExtentInWorldX, 1) + assert (r.PixelExtentInWorldY, 1) + assert (r.ImageExtentInWorldX, 200) + assert (r.ImageExtentInWorldY, 100) + assert (r.XIntrinsicLimits, [0.5, 200.5]) + assert (r.YIntrinsicLimits, [0.5, 100.5]) +***** test + xWorldLimits = [2, 5]; + yWorldLimits = [3, 6]; + r = imref2d ([291, 240], xWorldLimits, yWorldLimits); + assert (r.XWorldLimits, [2, 5]) + assert (r.YWorldLimits, [3, 6]) + assert (r.ImageSize, [291, 240]) + assert (r.PixelExtentInWorldX, 0.0125) + assert (r.PixelExtentInWorldY, 0.0103, 1e-3) + assert (r.ImageExtentInWorldX, 3) + assert (r.ImageExtentInWorldY, 3) + assert (r.XIntrinsicLimits, [0.5, 240.5]) + assert (r.YIntrinsicLimits, [0.5, 291.5]) +***** test + pixelExtentInWorldX = 0.3125; + pixelExtentInWorldY = 0.3125; + r = imref2d ([512, 512], pixelExtentInWorldX, pixelExtentInWorldY); + assert (r.XWorldLimits, [0.15625, 160.1562], 1e-4) + assert (r.YWorldLimits, [0.15625, 160.1562], 1e-4) + assert (r.ImageSize, [512, 512]) + assert (r.PixelExtentInWorldX, 0.3125) + assert (r.PixelExtentInWorldY, 0.3125) + assert (r.ImageExtentInWorldX, 160) + assert (r.ImageExtentInWorldY, 160) + assert (r.XIntrinsicLimits, [0.5, 512.5]) + assert (r.YIntrinsicLimits, [0.5, 512.5]) +***** test + pixelExtentInWorldX = 0.1; + pixelExtentInWorldY = 0.4; + r = imref2d ([100, 200], pixelExtentInWorldX, pixelExtentInWorldY); + assert (r.XWorldLimits, [0.05, 20.05], 1e-4) + assert (r.YWorldLimits, [0.2, 40.2], 1e-4) + assert (r.ImageSize, [100, 200]) + assert (r.PixelExtentInWorldX, 0.1) + assert (r.PixelExtentInWorldY, 0.4) + assert (r.ImageExtentInWorldX, 20) + assert (r.ImageExtentInWorldY, 40) + assert (r.XIntrinsicLimits, [0.5, 200.5]) + assert (r.YIntrinsicLimits, [0.5, 100.5]) +***** test + r = imref2d; + assert (r.XWorldLimits, [0.5, 2.5]) + assert (r.YWorldLimits, [0.5, 2.5]) + assert (r.ImageSize, [2, 2]) + assert (r.PixelExtentInWorldX, 1) + assert (r.PixelExtentInWorldY, 1) + assert (r.ImageExtentInWorldX, 2) + assert (r.ImageExtentInWorldY, 2) + assert (r.XIntrinsicLimits, [0.5, 2.5]) + assert (r.YIntrinsicLimits, [0.5, 2.5]) + r.ImageSize = [800, 600]; + assert (r.XWorldLimits, [0.5, 2.5]) + assert (r.YWorldLimits, [0.5, 2.5]) + assert (r.ImageSize, [800, 600]) + assert (r.PixelExtentInWorldX, 0.003333, 1e-5) + assert (r.PixelExtentInWorldY, 0.0025) + assert (r.ImageExtentInWorldX, 2) + assert (r.ImageExtentInWorldY, 2) + assert (r.XIntrinsicLimits, [0.5, 600.5]) + assert (r.YIntrinsicLimits, [0.5, 800.5]) +***** test + r = imref2d; + assert (r.XWorldLimits, [0.5, 2.5]) + assert (r.YWorldLimits, [0.5, 2.5]) + assert (r.ImageSize, [2, 2]) + assert (r.PixelExtentInWorldX, 1) + assert (r.PixelExtentInWorldY, 1) + assert (r.ImageExtentInWorldX, 2) + assert (r.ImageExtentInWorldY, 2) + assert (r.XIntrinsicLimits, [0.5, 2.5]) + assert (r.YIntrinsicLimits, [0.5, 2.5]) + r.XWorldLimits = [-60, 13.33]; + r.YWorldLimits = [-900.8, -560.26]; + assert (r.XWorldLimits, [-60, 13.33]) + assert (r.YWorldLimits, [-900.8, -560.26]) + assert (r.PixelExtentInWorldX, 36.6650) + assert (r.PixelExtentInWorldY, 170.27, 1e-5) + assert (r.ImageExtentInWorldX, 73.33, 1e-5) + assert (r.ImageExtentInWorldY, 340.54, 1e-5) + assert (r.XIntrinsicLimits, [0.5, 2.5]) + assert (r.YIntrinsicLimits, [0.5, 2.5]) +***** test + r = imref2d; + fail ("r.XWorldLimits = []", "") + fail ("r.XWorldLimits = [1]", "") + fail ("r.XWorldLimits = [j]", "") + fail ("r.XWorldLimits = [1; 2]", "") + fail ("r.YWorldLimits = []", "") + fail ("r.YWorldLimits = [1]", "") + fail ("r.YWorldLimits = [j]", "") + fail ("r.YWorldLimits = [1; 2]", "") +***** assert (imref2d ([4, 2, 3]).ImageSize, [4, 2]); +32 tests, 32 passed, 0 known failure, 0 skipped +[inst/@imref2d/contains.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/contains.m +***** error id=Octave:invalid-fun-call contains (imref2d) +***** error id=Octave:invalid-fun-call contains (imref2d, 1) +***** error id=Octave:invalid-fun-call contains (imref2d, 1, 2, 3) +***** error id=Octave:invalid-input-arg contains (imref2d, 1, [2, 3]) +***** error id=Octave:invalid-input-arg contains (imref2d, [1, 2], 3) +***** error id=Octave:expected-real contains (imref2d, 0, j) +***** error id=Octave:expected-real contains (imref2d, j, 0) +***** assert (contains (imref2d, [], []), logical( zeros (0, 0))) +***** assert (contains (imref2d, [1, 2; 3, 4], [5, -6; 7, 8]), logical (zeros (2, 2))) +***** test + r = imref2d ([256, 256]); + assert (contains(r, [5, 8, 8], [5, 10, 257]), logical([1, 1, 0])) +10 tests, 10 passed, 0 known failure, 0 skipped [inst/normxcorr2.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/normxcorr2.m ***** function offsets = get_max_offsets (c) @@ -8298,175 +7802,741 @@ c = normxcorr2 (t, img); assert (c(3), 0) 10 tests, 10 passed, 0 known failure, 0 skipped -[inst/colfilt.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/colfilt.m +[inst/psf2otf.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/psf2otf.m +***** test + psf = rand (6, 1); + assert (psf2otf (psf), fft (circshift (psf, [-3])), eps); +***** test + psf = rand (6, 6); + assert (psf2otf (psf), fft2 (circshift (psf, [-3 -3])), eps); +***** test + psf = rand (6, 6, 6); + assert (psf2otf (psf), fftn (circshift (psf, [-3 -3 -3])), eps); +***** test + psf = rand (7, 1); + assert (psf2otf (psf), fft (circshift (psf, [-3])), eps); +***** test + psf = rand (7, 7); + assert (psf2otf (psf), fft2 (circshift (psf, [-3 -3])), 1e-14); +***** test + psf = rand (6, 7, 8); + assert (psf2otf (psf), fftn (circshift (psf, [-3 -3 -4])), 6e-14); +***** test + psf = rand (6, 1); + ppsf = [psf; 0]; + assert (psf2otf (psf, 7), fft (circshift (ppsf, [-3])), eps); +***** test + psf = rand (6, 1); + ppsf = [[psf; 0] zeros(7, 6)]; + assert (psf2otf (psf, [7 7]), fft2 (circshift (ppsf, [-3 0])), eps); +***** test + psf = rand (6, 6); + ppsf = [psf zeros(6, 1)]; + assert (psf2otf (psf, [6 7]), fft2 (circshift (ppsf, [-3 -3])), 1e-14); +***** error psf2otf ('foo') +***** error psf2otf (rand (16), 14) +***** error psf2otf (rand (16), [14 14]) +***** error psf2otf (rand (16), [18]) +***** error psf2otf (rand (16), [18 14]) +***** test + psf = fspecial ("gaussian", 16) + 1i; + otf = psf2otf (psf); + assert (otf2psf (otf), psf, eps); +15 tests, 15 passed, 0 known failure, 0 skipped +[inst/fftconv2.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/fftconv2.m +***** xtest + a = repmat (1:10, 5); + b = repmat (10:-1:3, 7); + assert (fftconv2 (a, b), conv2 (a, b), 1.8e4*eps) + assert (fftconv2 (b, a), conv2 (b, a), 1.8e4*eps) + assert (fftconv2 (a, b, "full"), conv2 (a, b, "full"), 1.8e4*eps) + assert (fftconv2 (b, a, "full"), conv2 (b, a, "full"), 1.8e4*eps) + assert (fftconv2 (a, b, "same"), conv2 (a, b, "same"), 1.8e4*eps) + assert (fftconv2 (b, a, "same"), conv2 (b, a, "same"), 1.8e4*eps) + assert (isempty (fftconv2 (a, b, "valid"))); + assert (fftconv2 (b, a, "valid"), conv2 (b, a, "valid"), 1e4*eps) +***** test + x = 1:4; + y = 4:-1:1; + a = repmat(1:10, 5); + assert (fftconv2 (x, y, a), conv2 (x, y, a), 1e4*eps) + assert (fftconv2 (x, y, a, "full"), conv2 (x, y, a, "full"), 1e4*eps) + assert (fftconv2 (x, y, a, "same"), conv2 (x, y, a, "same"), 1e4*eps) + assert (fftconv2 (x, y, a, "valid"), conv2 (x, y, a, "valid"), 1e4*eps) ***** demo - ## Perform moving average filter with a 4x4 window - A = magic (12) - colfilt (A, [4 4], "sliding", @mean) + ## Draw a cross + z = zeros (101, 101); + z(50, :) = 1; + z(:, 50) = 1; + subplot (1, 3, 1) + imshow (z); + title ("Original thin cross") + + ## Draw a sinc blob + b = getheight (strel ("ball", 10, 1)); + subplot (1, 3, 2) + imshow (b); + title ("Sync blob") + + ## Convolve the cross with the blob + fc = real (fftconv2 (z, b, "same")); + subplot (1, 3, 3) + imshow (fc, [min(fc(:)) max(fc(:))]) + title ("Convolution in the frequency domain") +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/mat2gray.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/mat2gray.m +***** assert(mat2gray([1 2 3]), [0 0.5 1]); # standard use +***** assert(mat2gray(repmat ([1 2; 3 3], [1 1 3])), repmat ([0 0.5; 1 1], [1 1 3])); # setting min and max +***** assert(mat2gray([1 2 3], [2 2]), [1 1 1]); # equal min and max +***** assert(mat2gray([-1 0 0.5 3], [2 2]), [0 0 0.5 1]); # equal min and max ***** test - A = reshape (1:36, [6 6]); - assert (colfilt (A, [2 2], [3 3], "sliding", @sum), - conv2 (A, ones (2), "same")); + ## SCALE is unset and all values in the input IMAGE are the same: + ## case 1: all values are in the [0 1] range] + assert (mat2gray ([.5 .5; .5 .5]), [.5 .5; .5 .5]) + ## case 2: all values are above the [0 1] range + assert (mat2gray ([3 3; 3 3]), [1 1; 1 1]) + ## case 2: all values are below the [0 1] range + assert (mat2gray ([-3 -3; -3 -3]), [0 0; 0 0]) +***** assert(mat2gray([1 2 3], [3 1]), [1 0.5 0]); # max and min inverted +***** assert (mat2gray ([-3 -2 -1]), [0 0.5 1]) +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/imgradient.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imgradient.m +***** test + A = [0 1 0 + 1 1 1 + 0 1 0]; + + [gMag, gDir] = imgradient (A); + assert (gMag,[sqrt(18) 4 sqrt(18); 4 0 4; sqrt(18),4,sqrt(18)]); + assert (gDir,[-45 -90 -135; -0 -0 -180; 45 90 135]); + + ## the following just test if passing gx and gy separately gets + ## us the same as the image and method though imgradient + [gxSobel, gySobel] = imgradientxy (A, "Sobel"); + [gxPrewitt, gyPrewitt] = imgradientxy (A, "Prewitt"); + [gxCd, gyCd] = imgradientxy (A, "CentralDifference"); + [gxId, gyId] = imgradientxy (A, "IntermediateDifference"); + + assert (imgradient (A), + imgradient (gxSobel, gySobel)); + assert (imgradient (A, "Sobel"), + imgradient (gxSobel, gySobel)); + assert (imgradient (A, "Prewitt"), + imgradient(gxPrewitt, gyPrewitt)); + assert (imgradient (A, "CentralDifference"), + imgradient (gxCd, gyCd)); + assert (imgradient (A, "IntermediateDifference"), + imgradient (gxId, gyId)); 1 test, 1 passed, 0 known failure, 0 skipped -[inst/im2bw.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/im2bw.m -***** assert(im2bw ([0 0.4 0.5 0.6 1], 0.5), logical([0 0 0 1 1])); # basic usage -***** assert(im2bw (uint8 ([0 100 255]), 0.5), logical([0 0 1])); # with a uint8 input -***** warning bw = im2bw (logical ([0 1 0])); -***** warning bw = im2bw (logical ([0 1 0]), 1); +[inst/rgb2lab.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/rgb2lab.m +***** assert (rgb2lab ([0 0 0]), [0, 0, 0], 1e-2) +***** assert (rgb2lab ([1 0 0]), [53.24, 80.09, 67.20], 1e-2) +***** assert (rgb2lab ([1 1 0]), [97.14, -21.55, 94.48], 1e-2) +***** assert (rgb2lab ([0 1 0]), [87.74, -86.18, 83.18], 1e-2) +***** assert (rgb2lab ([0 1 1]), [91.11, -48.09, -14.13], 1e-2) +***** assert (rgb2lab ([0 0 1]), [32.30, 79.19, -107.86], 1e-2) +***** assert (rgb2lab ([1 0 1]), [60.32, 98.24, -60.83], 1e-2) +***** assert (rgb2lab ([1 1 1]), [100, 0.00, 0.00], 1e-2) +***** assert (rgb2lab ([0.5 0.5 0.5]), [53.39, 0.00, 0.00], 1e-2) +***** assert (rgb2lab ([0.75 0 0]), [39.77, 64.51, 54.13], 1e-2) +***** assert (rgb2lab ([0.5 0 0]), [25.42, 47.91, 37.91], 1e-2) +***** assert (rgb2lab ([0.25 0 0]), [9.66, 29.68, 15.24], 1e-2) +***** assert (rgb2lab ([1 0.5 0.5]), [68.11, 48.39, 22.83], 1e-2) +***** assert (rgb2lab ([1.5 1 1]), [111.47, 43.42, 17.98], 1e-2) ***** test - warning ("off", "all", "local"); - assert (im2bw (logical ([0 1 0])), logical ([0 1 0])) - assert (im2bw (logical ([0 1 0]), 0), logical ([0 1 0])) - assert (im2bw (logical ([0 1 0]), 1), logical ([0 1 0])) -***** assert (nnz (im2bw (uint8 ([0:255]), 0.9)), 26) + rgb_map = rand (64, 3); + assert (lab2rgb (rgb2lab (rgb_map)), rgb_map, 2e-5); ***** test - img = uint8 ([0:255]); - s = 0; - for i=0:.1:1 - s += nnz (im2bw (img, i)); - endfor - assert (s, 1405) -***** assert (nnz (im2bw (int16 ([-128:127]), 0.499)), 194) -***** assert (nnz (im2bw (int16 ([-128:127]), 0.500)), 128) -***** assert (nnz (im2bw (int16 ([-128:127]), 0.501)), 62) + rgb_img = rand (64, 64, 3); + assert (lab2rgb (rgb2lab (rgb_img)), rgb_img, 2e-5); +***** assert (rgb2lab (sparse ([0 0 1])), sparse ([32.30, 79.19, -107.86]), 1e-2) +***** assert (rgb2lab (sparse ([0 1 1])), sparse ([91.11, -48.09, -14.13]), 1e-2) +***** assert (rgb2lab (sparse ([1 1 1])), sparse ([100, 0.00, 0.00]), 1e-2) +***** assert (rgb2lab (uint8([255 255 255])), [100, 0.00, 0.00], 1e-2) +***** assert (class (rgb2lab (single([1 1 1]))), 'single') +***** error rgb2lab () +***** error rgb2lab (1,2) +***** error rgb2lab ({1}) +***** error rgb2lab (ones (2,2)) ***** test - img = uint16 ([0:intmax("uint16")]); - s = 0; - for i=0:.1:1 - s += nnz (im2bw (img, i)); + rgb = rand (16, 16, 3, 5); + lab = zeros (size (rgb)); + for i = 1:5 + lab(:,:,:,i) = rgb2lab (rgb(:,:,:,i)); endfor - assert (s, 360445) + assert (rgb2lab (rgb), lab) +26 tests, 26 passed, 0 known failure, 0 skipped +[inst/imlincomb.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imlincomb.m +***** assert (imlincomb (0.5, uint8 ([255 10]), 0.5, uint8 ([50 20])), + uint8 ([153 15])); # default to first class and truncate +***** assert (imlincomb (0.5, uint8 ([255 10]), 0.5, uint8 ([50 20]), "uint16"), + uint16 ([153 15])); # defining output class works +***** assert (imlincomb (0.5, uint8 ([255 10]), 0.5, uint8 ([50 20]), 10), + uint8 ([163 25])); # default to first class and truncate +***** assert (imlincomb (0.5, uint8 ([255 10]), 0.5, uint8 ([50 20]), 1000, "uint16"), + uint16 ([1153 1015])); # defining output class works +***** assert (imlincomb (0.5, uint8 ([255 10]), 0.5, uint8 ([50 20]), 1000), + uint8 ([255 255])); # defining output class works +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/lab2uint16.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2uint16.m ***** test - img = int16 ([intmin("int16"):intmax("int16")]); - s = 0; - for i=0:.1:1 - s += nnz (im2bw (img, i)); + cm_uint16 = uint16 ([0 127 128 383 384 65151 65152 65279 65280 65281 65534 65535]); + cm_uint16 = repmat (cm_uint16(:), [1 3]); + im2d_uint16 = reshape (cm_uint16, [4 3 3]); + imnd_uint16 = permute (im2d_uint16, [1 4 3 2]); + + cm_uint8 = uint8 ([0 0 1 1 2 254 255 255 255 255 255 255]); + cm_uint8 = repmat (cm_uint8(:), [1 3]); + assert (lab2uint8 (cm_uint16), cm_uint8) + im2d_uint8 = reshape (cm_uint8, [4 3 3]); + assert (lab2uint8 (im2d_uint16), im2d_uint8) + assert (lab2uint8 (imnd_uint16), permute (im2d_uint8, [1 4 3 2])) + + l1 = 100/65280; + ab1 = 255/65280; + cm = [ + 0 -128 + 127*l1 -128+(ab1*127) + 128*l1 -128+(ab1*128) + 383*l1 -128+(ab1*383) + 384*l1 -128+(ab1*384) + 65151*l1 -128+(ab1*65151) + 65152*l1 -128+(ab1*65152) + 65279*l1 -128+(ab1*65279) + 100 127 + 65281*l1 -128+(ab1*65281) + 65534*l1 -128+(ab1*65534) + 65535*l1 -128+(ab1*65535)]; + cm(:,3) = cm(:,2); + im2d = reshape (cm, [4 3 3]); + imnd = permute (im2d, [1 4 3 2]); + + assert (lab2double (cm_uint16), cm) + assert (lab2double (im2d_uint16), im2d) + assert (lab2double (imnd_uint16), imnd) + + assert (lab2single (cm_uint16), single (cm)) + assert (lab2single (im2d_uint16), single (im2d)) + assert (lab2single (imnd_uint16), single (imnd)) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/lab2rgb.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2rgb.m +***** assert (lab2rgb ([0 0 0]), [0, 0, 0], 1e-3) +***** assert (lab2rgb ([53.24, 80.09, 67.20]), [1 0 0], 1e-3) +***** assert (lab2rgb ([97.14, -21.55, 94.48]), [1 1 0], 1e-3) +***** assert (lab2rgb ([87.74, -86.18, 83.18]), [0 1 0], 1e-3) +***** assert (lab2rgb ([91.11, -48.09, -14.13]), [0 1 1], 1e-3) +***** assert (lab2rgb ([32.30, 79.19, -107.86]), [0 0 1], 1e-3) +***** assert (lab2rgb ([60.32, 98.24, -60.83]), [1 0 1], 1e-3) +***** assert (lab2rgb ([100, 0.00, 0.00]), [1 1 1], 1e-3) +***** assert (lab2rgb ([53.39, 0.00, 0.00]), [0.5 0.5 0.5], 1e-3) +***** assert (lab2rgb ([39.77, 64.51, 54.13]), [0.75 0 0], 1e-3) +***** assert (lab2rgb ([25.42, 47.91, 37.91]), [0.5 0 0], 1e-3) +***** assert (lab2rgb ([9.66, 29.68, 15.24]), [0.25 0 0], 1e-3) +***** assert (lab2rgb ([68.11, 48.39, 22.83]), [1 0.5 0.5], 1e-3) +***** assert (lab2rgb ([150 130 130]), [2.714, 1.028, 0.492], 1e-3) +***** test + lab_map = rand (64, 3); + lab_map(:,1) = lab_map(:,1) .* 100; + lab_map(:,2) = lab_map(:,2) .* 254 - 127; + lab_map(:,3) = lab_map(:,3) .* 254 - 127; + assert (rgb2lab (lab2rgb (lab_map)), lab_map, 5e-3); +***** test + lab_img = rand (64, 64, 3); + lab_img(:,:,1) = lab_img(:,:,1) .* 100; + lab_img(:,:,2) = lab_img(:,:,2) .* 254 - 127; + lab_img(:,:,3) = lab_img(:,:,3) .* 254 - 127; + assert (rgb2lab (lab2rgb (lab_img)), lab_img, 5e-3); +***** assert (lab2rgb (sparse ([0 0 0])), [0 0 0], 1e-3) +***** assert (lab2rgb (sparse ([100, 0.00, 0.00])), [1 1 1], 1e-3) +***** assert (class (lab2rgb (single([50 50 50]))), 'single') +***** error lab2rgb () +***** error lab2rgb (1,2) +***** error lab2rgb ({1}) +***** error lab2rgb (ones (2,2)) +***** test + lab = rand (16, 16, 3, 5); + lab(:,:,1,:) = lab(:,:,1,:) .* 100; + lab(:,:,2,:) = lab(:,:,2,:) .* 254 - 127; + lab(:,:,3,:) = lab(:,:,3,:) .* 254 - 127; + rgb = zeros (size (lab)); + for i = 1:5 + rgb(:,:,:,i) = lab2rgb (lab(:,:,:,i)); endfor - assert (s, 360445) + assert (lab2rgb (lab), rgb) +24 tests, 24 passed, 0 known failure, 0 skipped +[inst/nlfilter.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/nlfilter.m +***** demo + ## creates a "wide" diagonal (although it can be performed more + ## efficiently with "imdilate (A, true (3))") + nlfilter (eye (10), [3 3], @(x) any (x(:) > 0)) +***** assert (nlfilter (eye (4), [2 3], @(x) sum (x(:))), + [2 2 1 0 + 1 2 2 1 + 0 1 2 2 + 0 0 1 1]); +***** assert (nlfilter (eye (4), "indexed", [2 3], @(x) sum (x(:))), + [4 2 1 2 + 3 2 2 3 + 2 1 2 4 + 4 3 4 5]); +***** assert (nlfilter (eye (4), "indexed", [2 3], @(x, y) sum (x(:)) == y, 2), + logical ([0 1 0 1 + 0 1 1 0 + 1 0 1 0 + 0 0 0 0])); +***** assert (nlfilter (uint8 (eye (4)), "indexed", [2 3], @(x) sum (x(:))), + [2 2 1 0 + 1 2 2 1 + 0 1 2 2 + 0 0 1 1]); +***** assert (nlfilter (int16 (eye (4)), "indexed", [2 3], @(x) sum (x(:))), + [4 2 1 2 + 3 2 2 3 + 2 1 2 4 + 4 3 4 5]); +***** assert (nlfilter (uint8 (eye (4)), "indexed", [2 3], @(x) int8 (sum (x(:)))), + int8 ([2 2 1 0 + 1 2 2 1 + 0 1 2 2 + 0 0 1 1])); ***** test - im = [((randn(10)/10)+.3) ((randn(10)/10)+.7)]; - assert (im2bw (im, "Otsu"), im2bw (im, graythresh (im, "Otsu"))) - assert (im2bw (im, "moments"), im2bw (im, graythresh (im, "moments"))) + ## Effect of out of border elements. + expected = [ + 0.5 6.0 6.0 0.5 0 + 5.5 10.5 13.5 10.5 4.0 + 6.5 12.5 13.5 13.5 1.5 + 10.5 12.5 15.5 11.0 1.0 + 5.0 10.5 6.0 1.0 0 + ]; + assert (nlfilter (magic (5), [3 4], @(x) median (x(:))), expected) ***** test - im = [((randn(10)/10)+.3) ((randn(10)/10)+.7)]; - im = reshape (im, [10 10 1 2]); - assert (im2bw (im, "Otsu"), im2bw (im, graythresh (im, "Otsu"))) - assert (im2bw (im, "moments"), im2bw (im, graythresh (im, "moments"))) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/label2rgb.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/label2rgb.m -***** function map = test_colormap (unused) - map = [0 0 0; 0.5 0.5 0.5; 0.125 0.125 0.125]; + ## The center pixel of a sliding window when its length is even + ## sized is ceil ((size (NHOOD) +1) /2) + expected = [ + 24 24 24 16 16 + 24 24 24 22 22 + 23 23 22 22 22 + 25 25 25 25 22 + 25 25 25 25 21 + ]; + assert (nlfilter (magic (5), [3 4], @(x) max (x(:))), expected) +***** function dilated = imdilate_like_nlfilter (im, nhood) + even_nhood_dims = find (mod (size (nhood), 2) == 0); + for i = 1:even_nhood_dims + im = flip (im, i); + endfor + dilated = imdilate (im, nhood); + for i = 1:even_nhood_dims + dilated = flip (dilated, i); + endfor ***** endfunction -***** shared in, out, cmap - in = [ 0 1 1 0 2 2 0 3 3 - 0 1 1 0 2 2 0 3 3]; - - out = [255 0 0 255 128 128 255 32 32 - 255 0 0 255 128 128 255 32 32]; - out(:,:,2) = out(:,:,3) = out(:,:,1); - out = uint8(out); - - cmap = [0 0 0; 0.5 0.5 0.5; 0.125 0.125 0.125]; -***** assert (label2rgb (in, cmap), out); -***** assert (label2rgb (uint8 (in), cmap), out); -***** assert (label2rgb (in, "test_colormap"), out); -***** assert (label2rgb (in, @test_colormap), out); +***** test + a = randi (65535, 20, 20, 20, "uint16"); + ## extra dimensions on matrix only + assert (nlfilter (a, [5 5], @(x) max(x(:))), imdilate (a, ones (5))) + ## extra dimensions on both matrix and block + assert (nlfilter (a, [5 5 5], @(x) max(x(:))), imdilate (a, ones ([5 5 5]))) + ## extra dimensions and padding + assert (nlfilter (a, [3 7], @(x) max(x(:))), imdilate (a, ones ([3 7]))) + assert (nlfilter (a, [3 7 3], @(x) max(x(:))), imdilate (a, ones ([3 7 3]))) +***** test + a = randi (65535, 15, 15, 4, 8, 3, "uint16"); + assert (nlfilter (a, [3 4 7 5], @(x) max(x(:))), + imdilate_like_nlfilter (a, ones ([3 4 7 5]))) +***** test + a = randi (65535, 15, 15, 4, 3, 8, "uint16"); + ord = ordfiltn (a, 3, ones ([3 7 3 1 5])); + assert (nlfilter (a, [3 7 3 1 5], @(x) sort (x(:))(3)), ord) + assert (nlfilter (a, [3 7 3 1 5], @(x, y) sort (x(:))(y), 3), ord) +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/getrangefromclass.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/getrangefromclass.m +***** shared img + img = ones (5); +***** assert (getrangefromclass (double (img)), [0 1]); # double returns [0 1] +***** assert (getrangefromclass (single (img)), [0 1]); # single returns [0 1] +***** assert (getrangefromclass (logical (img)), [0 1]); # logical returns [0 1] +***** assert (getrangefromclass (int8 (img)), [-128 127]); # checks int +***** assert (getrangefromclass (uint8 (img)), [0 255]); # checks unit +***** fail ("getrangefromclass ('string')"); # fails with strings +***** fail ("getrangefromclass ({3, 4})"); # fails with cells +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/imbothat.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imbothat.m +***** assert (imbothat (ones (3), [1 1; 0 1]), zeros (3)); +***** assert (imbothat (true (3), [1 1; 0 1]), false (3)); +***** shared in, out, se + in = [ 0 0 0 1 1 1 0 0 1 1 + 0 1 0 1 1 1 0 0 0 1 + 1 1 1 1 1 0 0 0 0 0 + 0 1 1 1 1 0 0 0 0 0 + 0 0 0 1 0 0 0 0 1 0 + 0 0 0 0 0 0 0 1 1 1 + 0 0 0 0 1 0 1 0 1 0 + 0 0 0 1 1 1 1 1 0 0 + 0 0 0 0 1 1 1 0 0 0 + 0 0 0 1 1 1 0 0 0 0]; - out(find (in == 0)) = 0; -***** assert (label2rgb (in, cmap, "cyan"), out); -***** assert (label2rgb (in, cmap, [0 1 1]), out); + out = [ 1 1 1 0 0 0 1 1 0 0 + 1 0 1 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 1 + 1 0 0 0 0 0 0 0 0 1 + 0 0 0 0 1 0 0 0 0 1 + 0 0 0 1 1 1 1 0 0 0 + 0 0 0 1 0 1 0 1 0 1 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 0 0 0 0 0 0 + 0 0 0 0 0 0 1 0 0 0]; +***** assert (imbothat (logical (in), ones (3)), logical (out)); - in(1) = 10; -***** error label2rgb (in, cmap); -***** error label2rgb (in, cmap, 89); -***** error label2rgb (in, cmap, "g", "wrong"); -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/cp2tform.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/cp2tform.m -***** function [crw, cap] = coords (npt = 1000, scale = 2, dtheta = pi/3, - dx = 2, dy = -6, sig2noise = 1e32) - theta = (rand(npt, 1)*2-1)*2*pi; - R = rand(npt,1); - y = R.*sin(theta); - x = R.*cos(theta); - crw = [y x]; + out = [ 7 0 15 8 1 6 0 13 6 24 + 0 8 9 2 0 0 16 7 0 23 + 89 7 0 41 39 7 12 7 0 23 + 8 1 69 40 58 1 6 2 0 43 + 7 0 63 59 52 0 0 0 14 32 + 62 55 6 7 0 7 0 23 16 1 + 56 74 0 2 0 0 16 14 7 0 + 0 73 69 0 0 19 15 8 1 0 + 8 6 0 0 6 13 9 2 0 6 + 7 0 0 19 0 14 7 0 23 0]; +***** assert (imbothat (magic (10), ones (3)), out); +***** assert (imbothat (uint8 (magic (10)), strel ("square", 3)), uint8 (out)); - thetap = theta + dtheta; - Rap = R * scale; + ## using a se that will be decomposed in 2 pieces + out =[ 7 0 87 66 59 7 0 19 12 30 + 0 13 81 60 58 1 19 13 6 29 + 89 12 0 54 52 20 18 7 0 23 + 8 6 69 53 71 14 12 2 0 43 + 7 0 63 73 66 14 7 0 23 41 + 76 69 14 7 0 30 23 46 39 7 + 70 88 9 2 0 24 42 40 33 6 + 14 87 80 0 0 43 41 34 27 0 + 84 82 0 0 19 37 35 28 26 19 + 89 82 0 20 13 36 29 22 45 13]; +***** assert (imbothat (magic (10), ones(5)), out); - yap = Rap.*sin(thetap); - yap = yap + dy; - yap = yap + rand (size (yap)) * norm (yap) / sig2noise; + ## using a weird non-symmetric and even-size se + out =[ 0 0 15 8 1 3 0 7 0 18 + 0 8 53 59 0 0 14 13 0 17 + 84 0 0 40 38 6 13 6 0 23 + 2 0 42 47 58 0 6 0 0 41 + 0 0 62 59 52 0 0 0 16 35 + 6 58 13 6 0 3 19 19 35 1 + 0 18 0 0 0 0 15 13 6 0 + 0 17 69 0 0 17 17 8 0 0 + 8 67 0 0 0 15 9 2 0 6 + 7 0 0 17 10 42 7 0 19 0]; +***** assert (imbothat (magic (10), [1 0 0 0; 1 1 1 0; 0 1 0 1]), out); - xap = Rap.*cos(thetap); - xap = xap + dx; - xap = xap + rand (size (xap)) * norm (xap) / sig2noise; - cap = [yap xap]; -***** endfunction + ## N dimensional and weird se + in = reshape (magic(16), [4 8 4 2]); + se = ones (3, 3, 3); + se(:,:,1) = [1 0 1; 0 1 1; 0 0 0]; + se(:,:,3) = [1 0 1; 0 1 1; 0 0 1]; + out = zeros (size (in)); + out(:,:,1,1) = [ + 0 17 81 145 237 146 64 0 + 205 128 64 0 0 37 83 147 + 175 111 47 0 0 64 117 181 + 0 64 128 209 173 109 45 0]; + out(:,:,2,1) = [ + 235 142 78 18 0 23 69 133 + 0 35 103 163 215 128 46 0 + 0 64 128 195 183 123 48 0 + 153 93 43 0 14 78 146 215]; + out(:,:,3,1) = [ + 0 25 89 153 229 142 64 0 + 201 128 64 0 0 41 91 155 + 167 103 57 0 0 64 125 189 + 0 64 146 217 165 101 37 0]; + out(:,:,4,1) = [ + 227 142 78 14 0 31 77 141 + 0 43 107 171 211 128 46 0 + 0 64 128 203 179 115 48 0 + 149 99 35 0 18 82 146 223]; + out(:,:,1,2) = [ + 0 33 97 161 221 146 64 0 + 189 125 61 0 0 53 99 163 + 159 95 31 0 0 64 128 197 + 0 64 128 225 157 93 29 0]; + out(:,:,2,2) = [ + 219 142 78 18 0 39 85 149 + 0 51 119 179 199 128 46 0 + 0 64 128 211 167 107 43 0 + 137 77 27 0 14 78 146 231]; + out(:,:,3,2) = [ + 0 41 105 169 213 142 64 0 + 185 121 64 0 0 57 107 171 + 151 87 41 0 0 64 128 205 + 0 64 146 233 149 85 21 0]; + out(:,:,4,2) = [ + 211 142 78 14 0 47 93 157 + 0 59 123 187 195 128 46 0 + 0 64 128 219 163 99 35 0 + 133 83 19 0 18 82 146 239]; +***** assert (imbothat (in, se), out); +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/imhmin.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imhmin.m +***** shared im0, im0_h2_out + im0 = uint8 ([5 5 5 5 5; + 5 4 3 4 5; + 5 3 0 3 5; + 5 4 3 4 5; + 5 5 5 5 5]); + im0_h2_out = uint8 ([5 5 5 5 5; + 5 4 3 4 5; + 5 3 2 3 5; + 5 4 3 4 5; + 5 5 5 5 5]); +***** error imhmin () +***** error imhmin (im0) +***** error imhmin ("hello", 2) +***** error imhmin (i.*im0, 2) +***** error imhmin (sparse (im0), 2) +***** error imhmin (im0, -2) +***** error imhmin (im0, 'a') +***** error imhmin (im0, ones (2)) +***** error imhmin (im0, 2*i) +***** assert (imhmin (im0, 2), im0_h2_out) +***** assert (imhmin (double (im0), 2), double (im0_h2_out)) +***** assert (imhmin (im0, 2, 8), im0_h2_out) +***** assert (imhmin (im0, 2, 4), im0_h2_out) +***** assert (imhmin (im0, 2, true (3)), im0_h2_out) ***** test - npt = 100000; - [crw, cap] = coords (npt); - ttype = 'projective'; - T = cp2tform (crw, cap, ttype); - crw2 = tforminv (T, cap); - finalerr = norm (crw - crw2)/npt; - assert (finalerr < 2*eps, "norm = %3.2e ( > 2*eps)", finalerr) + out = imhmin (double (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "double") ***** test - npt = 100000; - [crw, cap] = coords (npt); - ttype = 'affine'; - T = cp2tform (crw, cap, ttype); - crw2 = tforminv (T, cap); - finalerr = norm (crw - crw2)/npt; - assert (finalerr < 2*eps, "norm = %3.2e ( > 2*eps)", finalerr) -***** xtest - npt = 100000; - [crw, cap] = coords (npt); - ttype = 'nonreflective similarity'; - T = cp2tform (crw, cap, ttype); - crw2 = tforminv (T, cap); - finalerr = norm (crw - crw2)/npt; - assert (finalerr < 3*eps, "norm = %3.2e ( > 3*eps)", finalerr) + out = imhmin (single (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "single") ***** test - npt = 100000; - [crw, cap] = coords (npt); - cap(:,2) *= -1; % reflection around y axis - ttype = 'similarity'; - T = cp2tform (crw, cap, ttype); - crw2 = tforminv (T, cap); - finalerr = norm (crw - crw2)/npt; - assert (finalerr < 3*eps, "norm = %3.2e ( > 3*eps)", finalerr) -***** xtest - npt = 100000; - [crw, cap] = coords (npt); - ttype = 'polynomial'; - ord = 2; - T = cp2tform (crw, cap, ttype, ord); - crw2 = tforminv (T, cap); - finalerr = norm (crw - crw2)/npt; - assert (finalerr < eps, "norm = %3.2e ( > eps)", finalerr) + out = imhmin (uint8 (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "uint8") +***** test + out = imhmin (uint16 (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "uint16") +***** test + im = cat (3, im0, im0, im0, im0); + out = imhmin (im, 2); + assert (size (out), size (im)) +***** test + im = 10 .* ones (10); + im(2:4, 2:4) = 7; + im(6:8, 6:8) = 2; + expected_4 = 10 .* ones (10); + expected_4(6:8, 6:8) = 6; + expected_2 = 10 .* ones (10); + expected_2(6:8, 6:8) = 4; + expected_2(2:4, 2:4) = 9; + out = imhmin (im, 4); + assert (out, expected_4, eps) + out = imhmin (im, 2); + assert (out, expected_2, eps) + out = imhmin (0.1.*im, 0.4); + assert (out, 0.1 .* expected_4, eps) +***** test + im2 = 10 .* ones (10); + im2(2:4, 2:4) = 7; + im2(6:9, 6:9)=2; + im2(5, 5)=2; + im2(6, 7)=10; + im2(7, 8)=10; + expected_4 = 10 .* ones (10); + expected_4(6:9, 6:9) = 6; + expected_4(5, 5) = 6; + expected_4(6, 7) = 10; + expected_4(7, 8) = 10; + expected_8 = expected_4; + expected_8(2:4, 2:4) = 7; + out2 = imhmin (im2, 4); + assert (out2, expected_8, eps) + out2 = imhmin (im2, 4, 4); + assert (out2, expected_4, eps) + out2 = imhmin (im2, 4, 8); + assert (out2, expected_8, eps) +21 tests, 21 passed, 0 known failure, 0 skipped +[inst/ordfilt2.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/ordfilt2.m +***** test + order = 3; + domain = ones (3); + A = zeros (3,3); + B = ones (3,3); + C = [1 1 1; 2 2 2; 3 3 3]; + D = C'; + E = ones (3,3); + E(2,2) = 2; + F = 3 .* ones (3,3); + F(2,2) = 1; + G = [-1 2 7; -5 2 8; -7 pi 9]; + H = [5 2 8; 1 -3 1; 5 1 0]; + A_out = [0 0 0; 0 0 0; 0 0 0]; + B_out = [0 0 0; 0 1 0; 0 0 0]; + C_out = [0 0 0; 0 1 0; 0 0 0]; + D_out = [0 0 0; 0 1 0; 0 0 0]; + E_out = [0 0 0; 0 1 0; 0 0 0]; + F_out = [0 0 0; 0 3 0; 0 0 0]; + G_out = [0 0 0; -1 -1 0; 0 0 0]; + H_out = [0 0 0; 0 1 0; 0 0 0]; + assert (ordfilt2 (A, order, domain), A_out); + assert (ordfilt2 (B, order, domain), B_out); + assert (ordfilt2 (C, order, domain), C_out); + assert (ordfilt2 (D, order, domain), D_out); + assert (ordfilt2 (E, order, domain), E_out); + assert (ordfilt2 (F, order, domain), F_out); + assert (ordfilt2 (G, order, domain), G_out); + assert (ordfilt2 (H, order, domain), H_out); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/imabsdiff.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imabsdiff.m +***** assert (imabsdiff (uint8 ([23 250]), uint8 ([26 50])), uint8 ([ 3 200])); # default to first class and abs works +***** assert (imabsdiff (uint8 ([23 250]), uint8 ([24 50]), "uint16"), uint16 ([ 1 200])); # defining output class works (not in matlab) +***** assert (imabsdiff (uint8 ([23 250]), uint8 ([24 255]), "int8"), int8 ([ 1 5])); # signed integers kinda work (not in matlab) +***** assert (imabsdiff (logical ([ 1 0]), logical ([ 1 1])), double ([ 0 1])); # return double for two logical images +***** fail ("imabsdiff (uint8 ([23 250]), 30"); # fails subtracting a scalar +***** fail ("imabsdiff (uint8 ([23 250]), uint16 ([23 250]))"); # input need to have same class +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/imextendedmin.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imextendedmin.m +***** shared im0, bw0_h2_out + im0 = uint8 ([5 5 5 5 5; + 5 4 3 4 5; + 5 3 0 3 5; + 5 4 3 4 5; + 5 5 5 5 5]); + bw0_h2_out = false (5); + bw0_h2_out(3,3) = true; +***** error imextendedmin () +***** error imextendedmin (im0) +***** error imextendedmin ("hello", 2) +***** error imextendedmin (i.*im0, 2) +***** error imextendedmin (sparse (im0), 2) +***** error imextendedmin (im0, -2) +***** error imextendedmin (im0, 'a') +***** error imextendedmin (im0, ones (2)) +***** error imextendedmin (im0, 2*i) +***** assert (imextendedmin (im0, 2), bw0_h2_out) +***** assert (imextendedmin (double (im0), 2), bw0_h2_out) +***** assert (imextendedmin (im0, 2, 8), bw0_h2_out) +***** assert (imextendedmin (im0, 2, 4), bw0_h2_out) +***** assert (imextendedmin (im0, 2, true (3)), bw0_h2_out) +***** test + out = imextendedmin (im0, 2); + assert (size (out), size (im0)) + assert (class (out), "logical") +***** test + out = imextendedmin (single (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "logical") +***** test + out = imextendedmin (uint8 (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "logical") +***** test + out = imextendedmin (uint16 (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "logical") +***** test + im = cat (3, im0, im0, im0, im0); + out = imextendedmin (im, 2); + assert (size (out), size (im)) +***** test + im = 10 .* ones (10); + im(2:4, 2:4) = 7; + im(6:8, 6:8) = 2; + expected_4 = false (10); + expected_4(6:8, 6:8) = true; + expected_2 = expected_4; + expected_2(2:4, 2:4) = true; + out = imextendedmin (im, 4); + assert (out, expected_4, eps) + out = imextendedmin (0.1.*im, 0.4); + assert (out, expected_4, eps) + out = imextendedmin (im, 2); + assert (out, expected_2, eps) +***** test + im2 = 10 .* ones (10); + im2(2:4, 2:4) = 7; + im2(6:9, 6:9)=2; + im2(5, 5)=2; + im2(6, 7)=10; + im2(7, 8)=10; + expected_8 = false (10); + expected_8(6:9, 6:9) = true; + expected_8(5, 5) = true; + expected_8(6, 7) = false; + expected_8(7, 8) = false; + expected_4 = expected_8; + expected_4(2:4, 2:4) = true; + out2 = imextendedmin (im2, 2); + assert (out2, expected_8, eps) + out2 = imextendedmin (im2, 2, 4); + assert (out2, expected_4, eps) + out2 = imextendedmin (im2, 2, 8); + assert (out2, expected_8, eps) +21 tests, 21 passed, 0 known failure, 0 skipped +[inst/bwunpack.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwunpack.m +***** error id=Octave:invalid-fun-call bwunpack () +***** error bwunpack (uint8 (1)) +***** error bwunpack (uint32 (1), -1) +***** error bwunpack (uint32 (1), 4.2) ***** xtest - npt = 100000; - [crw, cap] = coords (npt); - ttype = 'polynomial'; - ord = 3; - T = cp2tform (crw, cap, ttype, ord); - crw2 = tforminv (T, cap); - finalerr = norm (crw - crw2)/npt; - assert (finalerr < eps, "norm = %3.2e ( > eps)", finalerr) + ## bug #55521 + assert (bwunpack (uint32 (2.^[0:31])), logical (eye (32))) ***** xtest - npt = 100000; - [crw, cap] = coords (npt); - ttype = 'polynomial'; - ord = 4; - T = cp2tform (crw, cap, ttype, ord); - crw2 = tforminv (T, cap); - finalerr = norm (crw - crw2)/npt; - assert (finalerr < 6*eps, "norm = %3.2e ( > 6*eps)", finalerr) -7 tests, 7 passed, 0 known failure, 0 skipped + ## bug #55521 + assert (bwunpack (uint32 (repmat (7, [1 3 3 3])), 3), true (3, 3, 3, 3)) +***** assert (bwunpack (uint32 (zeros (0, 0))), false (0, 0)) +***** assert (bwunpack (uint32 (zeros (0, 0)), 0), false (0, 0)) +***** assert (bwunpack (uint32 (zeros (0, 5)), 0), false (0, 5)) +***** assert (bwunpack (uint32 (zeros (0, 5, 7)), 0), false (0, 5, 7)) +***** assert (bwunpack (uint32 (zeros (1, 0))), false (32, 0)) +***** assert (bwunpack (uint32 (zeros (2, 0, 7))), false (64, 0, 7)) +***** assert (bwunpack (uint32 (zeros (2, 0, 7))), false (64, 0, 7)) +***** assert (bwunpack (uint32 (zeros (2, 0, 7)), 60), false (60, 0, 7)) +***** error + bwunpack (uint32 (1), 1042) +15 tests, 15 passed, 0 known failure, 0 skipped +[inst/imsmooth.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imsmooth.m +***** test + ## checking Bilateral Filter + + ## constant image remain the same after Bilateral Filter + A = uint8(255*ones(128,128)); + B = uint8(imsmooth(A, 'Bilateral', 2, 10)); + assert (A,B); + + ## Bilateral Filter does not smear outlayers + A = zeros(256,256); + A(128,128) = 256; + ## bilateral filter does not smear outlayers + B = imsmooth(A, 'Bilateral', 2, 10); + assert (A,B,1.e-140); + + ## When sigma_r is large the filter behaves almost + ## like the isotropic Gaussian filter + + A0 = fspecial ('gaussian',100,100); + A = uint8(A0/max(max(A0))*255); + B1 = imsmooth(A, 'Bilateral', 2, 100); + B2 = imsmooth(A, 'Gaussian', 2); + assert (B1,B2); +1 test, 1 passed, 0 known failure, 0 skipped [inst/im2col.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/im2col.m ***** demo @@ -8536,534 +8606,6 @@ reshape (sum (im2col (A, [3 5 3 2])), [8 5 3 6])); ***** assert (im2col (1:8, [2 1]), zeros (2, 0)) 28 tests, 28 passed, 0 known failure, 0 skipped -[inst/imsharpen.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imsharpen.m -***** test - A = zeros (7, 7); - A(4,4) = 1; - B = [ - 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 - 0.00000 -0.00238 -0.01064 -0.01755 -0.01064 -0.00238 0.00000 - 0.00000 -0.01064 -0.04771 -0.07866 -0.04771 -0.01064 0.00000 - 0.00000 -0.01755 -0.07866 1.67032 -0.07866 -0.01755 0.00000 - 0.00000 -0.01064 -0.04771 -0.07866 -0.04771 -0.01064 0.00000 - 0.00000 -0.00238 -0.01064 -0.01755 -0.01064 -0.00238 0.00000 - 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000]; - assert (imsharpen (A), B, 5e-6) -***** test - A = zeros (7, 7); - A(4,4) = 1; - B = [ - -0.0035147 -0.0065663 -0.0095539 -0.0108259 -0.0095539 -0.0065663 -0.0035147 - -0.0065663 -0.0122674 -0.0178490 -0.0202255 -0.0178490 -0.0122674 -0.0065663 - -0.0095539 -0.0178490 -0.0259701 -0.0294280 -0.0259701 -0.0178490 -0.0095539 - -0.0108259 -0.0202255 -0.0294280 1.7666538 -0.0294280 -0.0202255 -0.0108259 - -0.0095539 -0.0178490 -0.0259701 -0.0294280 -0.0259701 -0.0178490 -0.0095539 - -0.0065663 -0.0122674 -0.0178490 -0.0202255 -0.0178490 -0.0122674 -0.0065663 - -0.0035147 -0.0065663 -0.0095539 -0.0108259 -0.0095539 -0.0065663 -0.0035147]; - assert (imsharpen (A, "radius", 2), B, 5e-8) -***** test - A = zeros (7, 7); - A(4,4) = 1; - assert (imsharpen (A, "radius", 0.01), A) -***** test - A = zeros (7, 7); - A(4,4) = 1; - B = A; - B(3:5,3:5) = -0.000000000011110; - B(3:5,4) = -0.000002981278097; - B(4,3:5) = -0.000002981278097; - B(4,4) = 1.000011925156828; - assert (imsharpen (A, "radius", 0.2), B, eps*10) -***** test - A = zeros (7, 7); - A(4,4) = 1; - B = [ - 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 - 0.00000 -0.00297 -0.01331 -0.02194 -0.01331 -0.00297 0.00000 - 0.00000 -0.01331 -0.05963 -0.09832 -0.05963 -0.01331 0.00000 - 0.00000 -0.02194 -0.09832 1.83790 -0.09832 -0.02194 0.00000 - 0.00000 -0.01331 -0.05963 -0.09832 -0.05963 -0.01331 0.00000 - 0.00000 -0.00297 -0.01331 -0.02194 -0.01331 -0.00297 0.00000 - 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000]; - assert (imsharpen (A, "amount", 1), B, 5e-6) -***** test - A = zeros (7, 7); - A(4,4) = 1; - B = zeros (7, 7); - B(4,4) = 1.670317742690299; - B(4,3) = -0.078656265079077; - B(3,4) = -0.078656265079077; - B(4,5) = -0.078656265079077; - B(5,4) = -0.078656265079077; - assert (imsharpen (A, "Threshold", 0.117341762), B, eps*10) -***** test - A = zeros (7, 7); - A(4,4) = 1; - B = zeros (7, 7); - B(4,4) = 1.670317742690299; - assert (imsharpen (A, "Threshold", 0.117341763), B, eps*10) -***** test - A = zeros (7, 7, "uint8"); - A(3:5,3:5) = 150; - B = zeros (7, 7, "uint8"); - B(3:5,3:5) = 211; - B(4,3:5) = 195; - B(3:5,4) = 195; - B(4,4) = 175; - assert (imsharpen (A), B) -***** test - A = zeros (7, 7, "uint8"); - A(3:5,3:5) = 100; - B = zeros (7, 7, "uint8"); - B(3:5,3:5) = 173; - assert (imsharpen (A, "radius", 4), B) -***** test - A = zeros (7, 7, 3, "uint8"); - A(4,4,:) = 255; - assert (imsharpen (A), A) -***** xtest - A = zeros(7,7,3, "uint8"); - A(4,4,1) = 255; - B = A; - B(4,4,2) = 146; # Octave result is 145; - B(4,4,3) = 100; # Octave result is 99; - assert (imsharpen (A), B) -!!!!! known failure -ASSERT errors for: assert (imsharpen (A),B) - - Location | Observed | Expected | Reason - (4,4,2) 145 146 Abs err 0 exceeds tol 0 by 0 - (4,4,3) 99 100 Abs err 0 exceeds tol 0 by 0 -***** xtest - A = zeros (7, 7, 3, "uint8"); - A(3:5,3:5,1) = 100; - A(3:5,3:5,2) = 150; - B = A; - B(3:5,3:5,1) = 164; - B(3:5,4,1) = 146; # Octave result is 147 - B(4,3:5,1) = 146; # Octave result is 145 - B(4,4,1) = 125; # Octave result is 126 - B(3:5,3:5,2) = 213; - B(3:5,4,2) = 195; # Octave result is 196 - B(4,3:5,2) = 195; # Octave result is 196 - B(4,4,2) = 175; - B(3:5,3:5,3) = 79; - B(3:5,4,3) = 62; - B(4,3:5,3) = 62; - B(4,4,3) = 40; # Octave result is 39 - assert (imsharpen (A), B) -!!!!! known failure -ASSERT errors for: assert (imsharpen (A),B) - - Location | Observed | Expected | Reason - (4,3,1) 147 146 Abs err 1 exceeds tol 0 by 1 - (3,4,1) 147 146 Abs err 1 exceeds tol 0 by 1 - (4,4,1) 126 125 Abs err 1 exceeds tol 0 by 1 - (5,4,1) 147 146 Abs err 1 exceeds tol 0 by 1 - (4,5,1) 147 146 Abs err 1 exceeds tol 0 by 1 - (4,3,2) 196 195 Abs err 1 exceeds tol 0 by 1 - (3,4,2) 196 195 Abs err 1 exceeds tol 0 by 1 - (5,4,2) 196 195 Abs err 1 exceeds tol 0 by 1 - (4,5,2) 196 195 Abs err 1 exceeds tol 0 by 1 - (4,4,3) 39 40 Abs err 0 exceeds tol 0 by 0 -***** error imsharpen () -***** error imsharpen (ones (3, 3), "Radius") -***** error imsharpen (ones (3, 3), "Radius", 0) -***** error imsharpen (ones (3, 3), "Amount", -1) -***** error imsharpen (ones (3, 3), "Threshold", 1.5) -***** error imsharpen (ones (3, 3), "Threshold", -1) -***** error imsharpen (ones (3, 3), "foo") -***** error imsharpen ("foo") -20 tests, 18 passed, 2 known failures, 0 skipped -[inst/imshowpair.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imshowpair.m -***** error id=Octave:invalid-fun-call imshowpair () -***** error id=Octave:invalid-fun-call imshowpair (1) -***** error id=Octave:invalid-input-arg imshowpair (uint8 (200.*rand (100)), ... - uint8 (200.*rand (100)), "interpolation") -***** error id=Octave:invalid-input-arg imshowpair (uint8 (200.*rand (100)), ... - uint8 (200.*rand (100)), "xxxxx") -***** error id=Octave:invalid-input-arg imshowpair (1, 1, "ColorChannels", [0 0 0]) -***** error id=Octave:invalid-input-arg imshowpair (1, 1, "ColorChannels", [1 1 1]) -***** error id=Octave:invalid-input-arg imshowpair (1, 1, "ColorChannels", [2 2 2]) -***** error id=Octave:expected-less-equal imshowpair (1, 1, "ColorChannels", [42 0 0]) -***** error id=Octave:expected-greater-equal imshowpair (1, 1, "ColorChannels", [-1 2 0]) -***** error id=Octave:invalid-input-arg imshowpair (1, 1, "ColorChannels", "deep-purple") -***** test - A = uint8 (200.*rand (100)); - B = uint8 (150.*rand (100)); - RA = imref2d (size (A), 0.5, 0.5); - RB = imref2d (size (B), 0.5, 0.5); - figure; - Ax=axes; - assert (imshowpair (A, B)); - assert (imshowpair (A, RA, B, RB)); - assert (imshowpair (A, B, "blend")); - assert (imshowpair (A, B, "falsecolor", "ColorChannels", "red-cyan")); - assert (imshowpair (A, B, "Parent", Ax)); - assert (imshowpair (A, B, "montage", "Scaling", "joint")); - close; -No entry for terminal type "unknown"; -using dumb terminal settings. - line 0: warning: iconv failed to convert degree sign - - - - - - - - - - - - - - - - - - - - - - - - -warning: test: file /build/reproducible-path/octave-image-2.16.0/inst/imshowpair.m leaked file descriptors -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/stretchlim.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/stretchlim.m -***** error (stretchlim ()); -***** error (stretchlim ("bad parameter")); -***** error (stretchlim (zeros (10, 10), "bad parameter")); -***** error (stretchlim (zeros (10, 10), 0.01, 2)); -***** assert (stretchlim (0.01:.01:1), [0.02; 0.99]) -***** assert (stretchlim (0.01:.01:1), stretchlim (0.01:.01:1, [0.01 0.99])) -***** assert (stretchlim (0.01:.01:1, 0.15), stretchlim (0.01:.01:1, [0.15 0.85])) -***** assert (stretchlim (0.01:.01:1, [0.01,0.95]), [0.02; 0.95], eps) -***** assert (stretchlim (0.01:.01:1, 0), [0.01; 1]) -***** test - im = rand (5); - assert (stretchlim (im, 0), [min(im(:)); max(im(:))]) -***** test - im = rand (5, 5, 3); - assert (stretchlim (im, 0), - [min(im(:,:,1)(:)) min(im(:,:,2)(:)) min(im(:,:,3)(:)); - max(im(:,:,1)(:)) max(im(:,:,2)(:)) max(im(:,:,3)(:))]) -***** test - im = rand (5); - assert (stretchlim (im, 0.03), [min(im(:)); max(im(:))]) - assert (stretchlim (im, 0.0399), [min(im(:)); max(im(:))]) -***** assert (stretchlim (uint8 (1:100)), im2double (uint8 ([2; 99]))) -***** assert (stretchlim (uint8 (1:100), .25), im2double (uint8 ([26; 75]))) -***** assert (stretchlim (uint16 (1:1000)), im2double (uint16 ([11; 990]))) -***** assert (stretchlim (int16 (-100:100)), im2double (int16 ([-98; 98]))) -***** assert (stretchlim (single (0.01:.01:1)), - double (single (0.01:.01:1)([2; 99])).') -***** assert (stretchlim (uint8 ([1 repmat(2, [1, 90]) 92:100]), 0.05), - im2double (uint8 ([2; 95]))) -***** assert (stretchlim (uint8 ([1 repmat(2, [1 4]) 6:100]), 0.05), - im2double (uint8 ([6; 95]))) -***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) 7:100]), 0.05), - im2double (uint8 ([2; 95]))) -***** assert (stretchlim (uint8 ([1 repmat(2, [1 6]) 8:100]), 0.05), - im2double (uint8 ([2; 95]))) -***** assert (stretchlim (uint8 ([1 repmat(2, [1 7]) 9:100]), 0.05), - im2double (uint8 ([2; 95]))) -***** assert (stretchlim (uint8 ([1 repmat(2, [1 8]) 10:100]), 0.05), - im2double (uint8 ([2; 95]))) -***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) repmat(3, [1 5]) 9:100]), 0.04), - im2double (uint8 ([2; 96]))) -***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) repmat(3, [1 5]) 9:100]), 0.05), - im2double (uint8 ([2; 95]))) -***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) repmat(3, [1 5]) 9:100]), 0.06), - im2double (uint8 ([3; 94]))) -***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) repmat(3, [1 5]) 9:100]), 0.07), - im2double (uint8 ([3; 93]))) -***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) repmat(3, [1 5]) 9:100]), 0.08), - im2double (uint8 ([3; 92]))) -***** test - RGB = zeros (100, 1, 3, "uint16"); - RGB(:,:,1) = [1:1:100]; - RGB(:,:,2) = [2:2:200]; - RGB(:,:,3) = [4:4:400]; - assert (stretchlim (RGB) , im2double (uint16 ([2 4 8; 99 198 396]))) -***** test - im6c = zeros (100, 1, 6, "uint16"); - im6c(:,:,1) = [1:1:100]; - im6c(:,:,2) = [2:2:200]; - im6c(:,:,3) = [4:4:400]; - im6c(:,:,4) = [8:8:800]; - im6c(:,:,5) = [16:16:1600]; - im6c(:,:,6) = [32:32:3200]; - assert (stretchlim (im6c) , - im2double (uint16 ([2 4 8 16 32 64; 99 198 396 792 1584 3168]))) -***** test - im = [0 0 .1 .1 .1 .1 .2 .2 .2 .4 .4 .6 .6 .7 .7 .9 .9 .9 1 1]; - - assert (stretchlim (im), [0; 1]) - - ## Consider the returned lower limit in this test. A lower limit - ## of 0.1 will saturate two elements (10%), while 0.2 will saturate - ## 6 elements (30%). Both have the same distance to 20% but returning - ## 0.1 is Matlab compatible. - ## Now looking at the higher limit. A limit of .9 will saturate - ## 2 elements (10%), while a limit of 0.7 will saturate 5 elements (25%). - ## However, for Matlab compatibility we must return .9 even though - ## 25% would be closer to 20%. - ## Basically, it's not just rounded. - assert (stretchlim (im, .2), [0.1; 0.9]) - - assert (stretchlim (im, .15), [0.1; 0.9]) - assert (stretchlim (im, .1), [0.1; 0.9]) - assert (stretchlim (im, .25), [0.1; 0.7]) - - ## Reorder the vector of values (real images don't have the values - ## already sorted), just to be sure it all works. - im([6 3 16 11 7 17 14 8 5 19 15 1 2 4 18 13 9 20 10 12]) = im; - assert (stretchlim (im, .2), [0.1; 0.9]) - assert (stretchlim (im, .15), [0.1; 0.9]) - assert (stretchlim (im, .1), [0.1; 0.9]) - assert (stretchlim (im, .25), [0.1; 0.7]) -***** assert (stretchlim (0.01:.001:1), [0.019; 0.991], eps) -***** assert (stretchlim (0.01:.001:1, [0.01,0.95]), [0.019; 0.951], eps) -***** assert (stretchlim (0.01:.001:1, 0), [0.01; 1], eps) -***** assert (stretchlim (single (0.01:.001:1)), - double (single (0.01:.001:1)([10; 982])).', eps) -***** xtest - assert (stretchlim ([(.05:.05:1) (2:4)], 0.2), [0.25; 0.95], eps) - assert (stretchlim ([(.05:.05:1) (2:5)], 0.2), [0.25; 1], eps) - assert (stretchlim ([(.05:.05:1) (2:6)], 0.2), [0.3; 1], eps) - assert (stretchlim ([(.05:.05:1) (2:7)], 0.2), [0.3; 1], eps) -***** test - assert (stretchlim ([(-6:0) (.05:.05:1)], 0.2), [0; 0.75], eps) - assert (stretchlim ([(-5:0) (.05:.05:1)], 0.2), [0; 0.75], eps) -***** test - im = rand (4, 4, 2, 3, 2); - rv = zeros (2, 2, 3, 2); - for p = 1:2 - for q = 1:3 - for r = 1:2 - rv(:,p,q,r) = stretchlim (im(:,:,p,q,r), 0.25); - endfor - endfor - endfor - assert (stretchlim (im, 0.25), rv) -***** test - im = rand (4, 4, 2, 3, 2); - rv = zeros (2, 2, 3, 2); - for p = 1:2 - for q = 1:3 - for r = 1:2 - rv(:,p,q,r) = stretchlim (im(:,:,p,q,r), 0); - endfor - endfor - endfor - assert (stretchlim (im, 0), rv) -***** assert (stretchlim (zeros (5)), [0; 1]) -***** assert (stretchlim (ones (5)), [0; 1]) -***** assert (stretchlim (.6 * ones (5)), [0; 1]) -***** assert (stretchlim (zeros (3, 3, 3, 3)), repmat ([0; 1], [1 3 3])) -***** assert (stretchlim ([0 .5 .5 .5 .5 1], .2), [0; 1]) -***** test - im = repmat ((magic (5) -1) / 24, [1 1 3 3]); - im(:,:,1,1) = 0; - im(:,:,2,2) = .5; - im(:,:,3,3) = 1; - lims = stretchlim (im, 0.2); - assert (size (lims), [2 3 3]) - assert (lims(:, [2 3 4 6 7 8]), - repmat ([(1/24)*round(24*.2); 1-((1/24)*round(24*.2))], [1 6]), eps) - assert (lims(:, [1 5 9]), repmat ([0; 1], [1 3])) -45 tests, 45 passed, 0 known failure, 0 skipped -[inst/bwperim.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwperim.m -***** test - in = [ 1 1 1 1 0 1 1 0 1 1 - 1 1 0 1 1 1 1 1 1 0 - 1 1 1 0 1 1 1 1 1 1 - 1 1 1 1 0 1 1 1 0 1 - 1 1 1 0 1 1 1 1 1 0 - 1 1 1 1 1 1 0 1 0 1 - 1 1 1 1 1 1 1 1 1 0 - 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 0 0 1 1 - 1 1 1 1 0 1 0 1 1 0]; - - out = [1 1 1 1 0 1 1 0 1 1 - 1 1 0 1 1 0 0 1 1 0 - 1 0 1 0 1 0 0 0 1 1 - 1 0 0 1 0 1 0 1 0 1 - 1 0 1 0 1 0 1 0 1 0 - 1 0 0 1 0 1 0 1 0 1 - 1 0 0 0 0 0 1 0 1 0 - 1 0 0 0 0 0 1 1 0 1 - 1 0 0 0 1 1 0 0 1 1 - 1 1 1 1 0 1 0 1 1 0]; - assert (bwperim (in), logical (out)) - assert (bwperim (in, 4), logical (out)) - - out = [1 1 1 1 0 1 1 0 1 1 - 1 1 0 1 1 1 1 1 1 0 - 1 1 1 0 1 1 0 1 1 1 - 1 0 1 1 0 1 0 1 0 1 - 1 0 1 0 1 1 1 1 1 0 - 1 0 1 1 1 1 0 1 0 1 - 1 0 0 0 0 1 1 1 1 0 - 1 0 0 0 0 1 1 1 1 1 - 1 0 0 1 1 1 0 0 1 1 - 1 1 1 1 0 1 0 1 1 0]; - assert (bwperim (in, 8), logical (out)) - - out = [1 1 1 1 0 1 1 0 1 1 - 1 0 0 0 0 1 0 0 1 0 - 1 0 0 0 0 0 0 1 0 1 - 1 0 1 0 0 0 0 0 0 1 - 1 0 0 0 0 1 0 1 0 0 - 1 0 0 0 1 0 0 0 0 1 - 1 0 0 0 0 0 0 1 0 0 - 1 0 0 0 0 1 1 0 0 1 - 1 0 0 1 0 1 0 0 1 1 - 1 1 1 1 0 1 0 1 1 0]; - assert (bwperim (in, [1 0 0; 0 1 0; 0 0 1]), logical (out)) -***** test - in = [ 0 0 0 0 0 0 0 - 0 0 5 0 0 1 9 - 0 Inf 9 7 0 0 0 - 0 1.5 5 7 1 0 0 - 0 0.5 -1 89 i 0 0 - 0 4 10 15 1 0 0 - 0 0 0 0 0 0 0]; - out = [0 0 0 0 0 0 0 - 0 0 1 0 0 1 1 - 0 1 0 1 0 0 0 - 0 1 0 0 1 0 0 - 0 1 0 0 1 0 0 - 0 1 1 1 1 0 0 - 0 0 0 0 0 0 0]; - assert (bwperim (in), logical (out)) -***** test - in = reshape (magic(16), [8 8 4]) > 50; - out(:,:,1) = [ - 1 1 0 1 0 1 1 1 - 0 1 1 1 1 1 0 1 - 0 1 1 1 1 1 0 1 - 1 1 0 1 1 1 1 1 - 1 1 1 1 1 1 1 1 - 1 1 1 0 1 0 1 1 - 1 1 1 0 1 0 1 1 - 1 0 1 1 1 1 1 0]; - out(:,:,2) = [ - 1 1 0 1 0 1 1 1 - 0 1 1 0 1 1 0 1 - 0 1 0 0 0 1 0 1 - 1 0 1 0 0 0 1 1 - 1 0 0 1 0 1 0 1 - 1 0 1 0 1 0 1 1 - 1 1 1 0 1 0 1 1 - 1 0 1 1 1 1 1 0]; - out(:,:,3) = [ - 1 1 0 1 0 1 1 1 - 0 1 1 0 1 1 0 1 - 0 1 0 0 0 1 0 1 - 1 0 0 0 0 0 1 1 - 1 0 0 1 0 1 0 1 - 1 0 1 0 1 0 1 1 - 1 1 1 0 1 0 1 1 - 1 0 1 1 1 1 1 0]; - out(:,:,4) = [ - 1 1 0 1 0 1 1 1 - 0 1 1 1 1 1 0 1 - 0 1 1 1 1 1 0 1 - 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 0 - 1 1 1 0 1 0 1 1 - 1 1 1 0 1 0 1 1 - 1 0 1 1 1 1 1 0]; - assert (bwperim (in), logical (out)) - - out(:,:,1) = [ - 1 1 0 1 0 1 1 1 - 0 1 1 1 1 1 0 1 - 0 1 1 1 1 1 0 1 - 1 1 0 1 1 1 1 1 - 1 1 1 1 1 1 1 1 - 1 1 1 0 1 0 1 1 - 1 1 1 0 1 0 1 1 - 1 0 1 1 1 1 1 0]; - out(:,:,2) = [ - 1 1 0 1 0 1 1 1 - 0 1 1 1 1 1 0 1 - 0 1 1 0 0 1 0 1 - 1 1 1 1 0 1 1 1 - 1 0 1 1 1 1 1 1 - 1 0 1 0 1 0 1 1 - 1 1 1 0 1 0 1 1 - 1 0 1 1 1 1 1 0]; - out(:,:,3) = [ - 1 1 0 1 0 1 1 1 - 0 1 1 1 1 1 0 1 - 0 1 0 0 0 1 0 1 - 1 1 0 0 0 1 1 1 - 1 0 1 1 1 1 1 1 - 1 0 1 0 1 0 1 1 - 1 1 1 0 1 0 1 1 - 1 0 1 1 1 1 1 0]; - out(:,:,4) = [ - 1 1 0 1 0 1 1 1 - 0 1 1 1 1 1 0 1 - 0 1 1 1 1 1 0 1 - 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 0 - 1 1 1 0 1 0 1 1 - 1 1 1 0 1 0 1 1 - 1 0 1 1 1 1 1 0]; - assert (bwperim (in, 18), logical (out)) -***** error bwperim ("text") -***** error bwperim (rand (10), 5) -***** error bwperim (rand (10), "text") -***** test - a = false (5); - a(1:4,2:4) = true; - - p = false (5); - p(1:4,[2 4]) = true; - assert (bwperim (a, [0 0 0; 1 1 1; 0 0 0]), p) -***** test - a = false (8, 8, 5); - a(4:5,4:5,2:4) = true; - a(2:7,2:7,3) = true; - assert (bwperim (a, 26), a) - - ## It is easy to forget that is correct - b = a; - b(4:5, 4:5, 3) = false; - assert (bwperim (a), b) - - c = a; - c(3:6,3:6,3) = false; - assert (bwperim (a, 4), c) -***** test - conn_self = logical ([0 0 0; 0 1 0; 0 0 0]); - assert (bwperim (true), true) - assert (bwperim (true, conn_self), false) - assert (bwperim (true (1, 6)), true (1, 6)) - assert (bwperim (true (1, 6), conn_self), false (1, 6)) - assert (bwperim (true (6, 1)), true (6, 1)) - - bw_3d = true (1, 1, 6); - assert (bwperim (bw_3d), bw_3d) - assert (bwperim (bw_3d, conn_self), false (1, 1, 6)) - assert (bwperim (bw_3d, true (3)), bw_3d) - - perim_3d = bw_3d; - perim_3d(1, 1, 2:end-1) = false; - conn_3d = false (3, 3, 3); - conn_3d(2, 2, :) = true; - assert (bwperim (true (1, 1, 6), conn_3d), perim_3d) -9 tests, 9 passed, 0 known failure, 0 skipped [inst/im2uint16.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/im2uint16.m ***** assert (im2uint16 (uint16 ([1 2 3])), uint16 ([1 2 3])); @@ -9083,603 +8625,162 @@ ***** error im2uint16 ([false true], "indexed"); ***** error im2uint16 (65537, "indexed"); 16 tests, 16 passed, 0 known failure, 0 skipped -[inst/padarray.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/padarray.m -***** demo - padarray([1,2,3;4,5,6],[2,1]) - % pads [1,2,3;4,5,6] with a whole border of 2 rows and 1 columns of 0 -***** demo - padarray([1,2,3;4,5,6],[2,1],5) - % pads [1,2,3;4,5,6] with a whole border of 2 rows and 1 columns of 5 -***** demo - padarray([1,2,3;4,5,6],[2,1],0,'pre') - % pads [1,2,3;4,5,6] with a left and top border of 2 rows and 1 columns of 0 -***** demo - padarray([1,2,3;4,5,6],[2,1],'circular') - % pads [1,2,3;4,5,6] with a whole 'circular' border of 2 rows and 1 columns - % border 'repeats' data as if we tiled blocks of data -***** demo - padarray([1,2,3;4,5,6],[2,1],'replicate') - % pads [1,2,3;4,5,6] with a whole border of 2 rows and 1 columns which - % 'replicates' edge data -***** demo - padarray([1,2,3;4,5,6],[2,1],'symmetric') - % pads [1,2,3;4,5,6] with a whole border of 2 rows and 1 columns which - % is symmetric to the data on the edge -***** assert (padarray ([1;2], [1]), [0;1;2;0]); -***** assert (padarray ([3 4], [0 2]), [0 0 3 4 0 0]); -***** assert (padarray ([1 2 3; 4 5 6], [1 2]), - [zeros(1, 7); 0 0 1 2 3 0 0; 0 0 4 5 6 0 0; zeros(1, 7)]); -***** test - assert (padarray ([1 2 3; 4 5 6], [3 2 1]), - cat(3, zeros(8, 7), - [ [ zeros(3, 7) ] - [zeros(2, 2) [1 2 3; 4 5 6] zeros(2, 2) ] - [ zeros(3,7)] ], - zeros (8, 7))); -***** assert (padarray ([1 2], [4 5]), padarray ([1 2], [4 5], 0)); -***** assert (padarray ([1 2], [4 5]), padarray ([1 2], [4 5], "both")); -***** assert (padarray ([1;2], [1], i), [i; 1; 2; i]); -***** assert (padarray ([1;2], [1], i, "pre"), [i; 1; 2]); -***** assert (padarray ([1;2], [1], i, "post"), [1; 2; i]); -***** assert (padarray ([1;2], [1], i, "both"), [i; 1; 2; i]); -***** assert (padarray ([1 2], [0 1], i, "pre"), [i 1 2]); -***** assert (padarray ([1 2], [0 1], i, "post"), [1 2 i]); -***** assert (padarray ([1 2], [0 1], i, "both"), [i 1 2 i]); -***** assert (padarray ([1 2], [0;1], i, "both"), [i 1 2 i]); -***** test - A = [1 2 3; 4 5 6]; - B = repmat (A, 7, 9); - assert (padarray (A, [1 2], "circular", "pre"), B(2:4,2:6)); - assert (padarray (A, [1 2], "circular", "post"), B(3:5,4:8)); - assert (padarray (A, [1 2], "circular", "both"), B(2:5,2:8)); - ## This tests when padding is bigger than data - assert (padarray (A, [5 10], "circular", "both"), B(2:13,3:25)); -***** test - A = int8 ([1 2 3; 4 5 6]); - B = repmat (A, 7, 9); - assert (padarray (A, [1 2], "circular", "pre"), B(2:4,2:6)); - assert (padarray (A, [1 2], "circular", "post"), B(3:5,4:8)); - assert (padarray (A, [1 2], "circular", "both"), B(2:5,2:8)); - ## This tests when padding is bigger than data - assert (padarray (A, [5 10], "circular", "both"), B(2:13,3:25)); -***** test - A = [1 2; 3 4]; - B = kron (A, ones (10, 5)); - assert (padarray (A, [9 4], "replicate", "pre"), B(1:11,1:6)); - assert (padarray (A, [9 4], "replicate", "post"), B(10:20,5:10)); - assert (padarray (A, [9 4], "replicate", "both"), B); - ## same with uint class - assert (padarray (uint8 (A), [9 4], "replicate", "pre"), uint8 (B(1:11,1:6))); - assert (padarray (uint8 (A), [9 4], "replicate", "post"), uint8 (B(10:20,5:10))); - assert (padarray (uint8 (A), [9 4], "replicate", "both"), uint8 (B)); -***** test - A = [1:3 - 4:6]; - HA = [3:-1:1 - 6:-1:4]; - VA = [4:6 - 1:3]; - VHA = [6:-1:4 - 3:-1:1]; - B = [VHA VA VHA - HA A HA - VHA VA VHA]; - assert (padarray (A, [1 2], "symmetric", "pre"), B(2:4,2:6)); - assert (padarray (A, [1 2], "symmetric", "post"), B(3:5,4:8)); - assert (padarray (A, [1 2], "symmetric", "both"), B(2:5,2:8)); - ## same with int class - assert (padarray (int16 (A), [1 2], "symmetric", "pre"), int16 (B(2:4,2:6))); - assert (padarray (int16 (A), [1 2], "symmetric", "post"), int16 (B(3:5,4:8))); - assert (padarray (int16 (A), [1 2], "symmetric", "both"), int16 (B(2:5,2:8))); -***** assert (padarray (int8 ([1; 2]), [1]), int8 ([0; 1; 2; 0])); -***** assert (padarray (uint8 ([3 4]), [0 2]), uint8 ([0 0 3 4 0 0])); -***** assert (padarray (int16 ([1; 2]), [1], 4), int16 ([4; 1; 2; 4])); -***** assert (padarray (uint16 ([1; 2]), [1], 0), uint16 ([0; 1; 2; 0])); -***** assert (padarray (uint32 ([1; 2]), [1], 6, "post"), uint32 ([1; 2; 6])); -***** assert (padarray (int32 ([1; 2]), [1], int32 (4), "pre"), int32 ([4; 1; 2])); -***** test - in = [ 7 5 1 3 - 5 3 3 4 - 7 5 2 3 - 6 1 3 8]; - padded = [ - 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 - 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 - 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 - 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 - 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 - 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 - 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 - 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 - 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 - 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 - 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 - 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 - 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 - 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 - 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 - 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 - 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 - 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 - 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 - 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 - 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 - 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 - 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 - 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2]; - for ite = 1:10 - assert (padarray (in, [ite ite], "symmetric"), padded((11-ite):(14+ite),(11-ite):(14+ite))); - assert (padarray (in, [ite ite], "symmetric", "pre"), padded((11-ite):14,(11-ite):14)); - assert (padarray (in, [ite ite], "symmetric", "post"), padded(11:(14+ite),11:(14+ite))); - endfor +[inst/isrgb.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/isrgb.m +***** assert (isrgb ("this is not a RGB image"), false); +***** assert (isrgb (rand (5, 5)), false); +***** assert (isrgb (rand (5, 5, 1, 5)), false); +***** assert (isrgb (rand (5, 5, 3, 5)), true); +***** assert (isrgb (rand (5, 5, 3)), true); +***** assert (isrgb (ones (5, 5, 3)), true); +***** assert (isrgb (ones (5, 5, 3) + eps), false); +***** assert (isrgb (zeros (5, 5, 3) - eps), false); +***** assert (isrgb (rand (5, 5, 3) > 0.5), false); +***** assert (isrgb (randi ([-100 100], 5, 5, 3, "int16")), true) +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/lab2uint8.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2uint8.m ***** test - in = [ 7 5 4 9 - 6 4 5 1 - 5 3 3 3 - 2 6 7 3]; - padded = [ - 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 - 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 - 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 - 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 - 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 - 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 - 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 - 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 - 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 - 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 - 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 - 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 - 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 - 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 - 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 - 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 - 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 - 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 - 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 - 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 - 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 - 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 - 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 - 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4]; - for ite = 1:10 - assert (padarray (in, [ite ite], "reflect"), padded((11-ite):(14+ite),(11-ite):(14+ite))); - assert (padarray (in, [ite ite], "reflect", "pre"), padded((11-ite):14,(11-ite):14)); - assert (padarray (in, [ite ite], "reflect", "post"), padded(11:(14+ite),11:(14+ite))); - endfor -26 tests, 26 passed, 0 known failure, 0 skipped -[inst/impyramid.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/impyramid.m -***** xtest - ## bug #51979 (results are not matlab compatible) - in = [116 227 153 69 146 194 59 130 139 106 - 2 47 137 249 90 75 16 24 158 44 - 155 68 46 84 166 156 69 204 32 152 - 71 221 137 230 210 153 192 115 30 118 - 107 143 108 52 51 73 101 21 175 90 - 54 158 143 77 26 168 113 229 165 225 - 9 47 133 135 130 207 236 43 19 73]; + cm_uint8 = uint8 ([0 1 2 3 4 127 128 200 254 255]); + cm_uint8 = repmat (cm_uint8(:), [1 3]); + im2d_uint8 = reshape (cm_uint8, [5 2 3]); + imnd_uint8 = permute (im2d_uint8, [1 4 3 2]); - reduced = [ - 114 139 131 103 111 - 97 122 141 111 100 - 103 123 112 123 122 - 47 107 134 153 94]; + cm_uint16 = uint16 ([0 256 512 768 1024 32512 32768 51200 65024 65280]); + cm_uint16 = repmat (cm_uint16(:), [1 3]); + assert (lab2uint16 (cm_uint8), cm_uint16) + im2d_uint16 = reshape (cm_uint16, [5 2 3]); + assert (lab2uint16 (im2d_uint8), im2d_uint16) + assert (lab2uint16 (imnd_uint8), permute (im2d_uint16, [1 4 3 2])) - expanded = [ - 115 154 185 178 150 122 105 116 138 159 158 117 78 86 112 129 133 120 103 - 69 98 128 141 146 152 152 139 125 127 121 87 55 58 81 113 131 112 84 - 40 54 74 100 131 167 184 157 119 104 92 64 41 44 66 100 121 103 74 - 76 69 65 75 97 130 153 148 131 122 108 80 61 79 103 105 98 97 98 - 120 105 88 77 78 96 121 143 155 154 140 112 98 124 143 109 74 91 123 - 117 129 134 119 107 125 153 173 180 172 156 143 138 146 140 96 60 83 122 - 99 139 170 157 139 156 181 188 180 164 151 154 156 140 112 81 65 84 110 - 101 136 163 153 133 132 138 136 130 122 120 130 133 108 82 86 99 104 104 - 103 126 143 136 116 97 81 73 73 82 94 105 105 87 78 108 138 133 116 - 90 116 139 139 122 96 69 52 53 80 109 114 111 116 128 148 163 164 160 - 66 99 131 140 131 109 83 62 62 102 142 144 138 154 169 164 157 169 184 - 41 68 99 121 130 122 107 92 95 133 173 182 172 156 135 114 105 121 142 - 21 38 64 98 124 131 127 123 129 160 194 212 199 144 82 52 48 65 85]; + l1 = 100/255; + cm = [ + 0 -128 -128 + l1 -127 -127 + 2*l1 -126 -126 + 3*l1 -125 -125 + 4*l1 -124 -124 + 127*l1 -1 -1 + 128*l1 0 0 + 200*l1 72 72 + 254*l1 126 126 + 100 127 127]; + im2d = reshape (cm, [5 2 3]); + imnd = permute (im2d, [1 4 3 2]); - assert (impyramid (uint8 (in), "reduce"), uint8 (reduced)) - assert (impyramid (uint8 (in), "expand"), uint8 (expanded)) -!!!!! known failure -ASSERT errors for: assert (impyramid (uint8 (in), "reduce"),uint8 (reduced)) + assert (lab2double (cm_uint8), cm) + assert (lab2double (im2d_uint8), im2d) + assert (lab2double (imnd_uint8), imnd) - Location | Observed | Expected | Reason - (2,4) 110 111 Abs err 0 exceeds tol 0 by 0 - (2,5) 99 100 Abs err 0 exceeds tol 0 by 0 - (3,5) 121 122 Abs err 0 exceeds tol 0 by 0 + assert (lab2single (cm_uint8), single (cm)) + assert (lab2single (im2d_uint8), single (im2d)) + assert (lab2single (imnd_uint8), single (imnd)) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/xyz2rgb.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/xyz2rgb.m +***** assert (xyz2rgb ([0, 0, 0]), [0 0 0], 1e-3) +***** assert (xyz2rgb ([0.4125, 0.2127, 0.0193]), [1 0 0], 1e-3) +***** assert (xyz2rgb ([0.7700, 0.9278, 0.1385]), [1 1 0], 1e-3) +***** assert (xyz2rgb ([0.3576, 0.7152, 0.1192]), [0 1 0], 1e-3) +***** assert (xyz2rgb ([0.5380, 0.7873, 1.0694]), [0 1 1], 1e-3) +***** assert (xyz2rgb ([0.1804, 0.07217, 0.9502]), [0 0 1], 1e-3) +***** assert (xyz2rgb ([0.5929, 0.28484, 0.9696]), [1 0 1], 1e-3) +***** assert (xyz2rgb ([0.9505, 1.0000, 1.0888]), [1 1 1], 1e-3) +***** assert (xyz2rgb ([0.2034, 0.2140, 0.2330]), [0.5 0.5 0.5], 1e-3) +***** assert (xyz2rgb ([0.2155, 0.1111, 0.0101]), [0.75 0 0], 1e-3) +***** assert (xyz2rgb ([0.0883, 0.0455, 0.0041]), [0.5 0 0], 1e-3) +***** assert (xyz2rgb ([0.0210, 0.0108, 0.0010]), [0.25 0 0], 1e-3) +***** assert (xyz2rgb ([0.5276, 0.3812, 0.2482]), [1 0.5 0.5], 1e-3) +***** assert (xyz2rgb ([1.5 1 1]), [1.5712, 0.7109 0.9717], 1e-3) ***** test - in = randi ([0 255], [40 39 3 5], "uint8"); - red = impyramid (in, "reduce"); - for p = 1:3 - for n = 1:5 - assert (red(:,:,p,n), impyramid (in(:,:,p,n), "reduce")) - endfor - endfor - - exp = impyramid (in, "expand"); - for p = 1:3 - for n = 1:5 - assert (exp(:,:,p,n), impyramid (in(:,:,p,n), "expand")) - endfor - endfor -***** xtest - ## bug #51979 (results are not matlab compatible) - in = repmat (uint8 (255), [10 10]); - assert (impyramid (in, "reduce"), repmat (uint8 (255), [5 5])) - assert (impyramid (in, "expand"), repmat (uint8 (255), [19 19])) -!!!!! known failure -ASSERT errors for: assert (impyramid (in, "expand"),repmat (uint8 (255), [19, 19])) - - Location | Observed | Expected | Reason - (1,1) 195 255 Abs err 0 exceeds tol 0 by 0 - (2,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (3,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (4,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (5,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (6,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (7,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (8,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (9,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (10,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (11,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (12,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (13,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (14,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (15,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (16,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (17,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (18,1) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,1) 195 255 Abs err 0 exceeds tol 0 by 0 - (1,2) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,2) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,3) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,3) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,4) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,4) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,5) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,5) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,6) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,6) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,7) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,7) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,8) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,8) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,9) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,9) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,10) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,10) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,11) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,11) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,12) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,12) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,13) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,13) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,14) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,14) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,15) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,15) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,16) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,16) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,17) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,17) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,18) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,18) 223 255 Abs err 0 exceeds tol 0 by 0 - (1,19) 195 255 Abs err 0 exceeds tol 0 by 0 - (2,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (3,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (4,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (5,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (6,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (7,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (8,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (9,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (10,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (11,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (12,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (13,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (14,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (15,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (16,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (17,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (18,19) 223 255 Abs err 0 exceeds tol 0 by 0 - (19,19) 195 255 Abs err 0 exceeds tol 0 by 0 -***** xtest - ## bug #51979 (results are not matlab compatible) - in = logical ([ - 1 0 1 1 0 0 1 1 0 0 - 1 1 0 0 0 1 0 0 1 0 - 0 1 1 0 1 1 1 1 1 1 - 1 0 1 0 1 0 1 0 1 1 - 1 1 1 0 0 0 1 1 1 1 - 0 0 1 1 0 0 1 0 0 0 - 0 0 1 1 0 1 1 0 1 1 - 1 1 0 0 1 0 0 0 1 0 - 1 1 1 1 1 1 0 1 0 0 - 1 1 0 0 1 0 0 0 1 0]); - - reduced = logical ([ - 1 1 0 1 0 - 1 1 0 1 1 - 1 1 0 1 1 - 0 1 0 0 0 - 1 1 1 0 0]); - - expanded = logical ([ - 1 1 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 - 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 - 1 1 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 1 1 - 0 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 - 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 - 1 1 0 1 1 0 0 0 1 0 0 1 1 1 0 1 1 1 1 - 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 - 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 - 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 - 0 0 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 - 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 - 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 - 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 - 1 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 - 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 - 1 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 - 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0]); - - assert (impyramid (in, "reduce"), reduced) - assert (impyramid (in, "expand"), expanded) -!!!!! known failure -ASSERT errors for: assert (impyramid (in, "reduce"),reduced) - - Location | Observed | Expected | Reason - (4,1) 1 0 Abs err 1 exceeds tol 0 by 1 - (1,3) 1 0 Abs err 1 exceeds tol 0 by 1 - (2,3) 1 0 Abs err 1 exceeds tol 0 by 1 - (3,3) 1 0 Abs err 1 exceeds tol 0 by 1 - (4,3) 1 0 Abs err 1 exceeds tol 0 by 1 - (4,4) 1 0 Abs err 1 exceeds tol 0 by 1 - (5,4) 1 0 Abs err 1 exceeds tol 0 by 1 - (1,5) 1 0 Abs err 1 exceeds tol 0 by 1 - (4,5) 1 0 Abs err 1 exceeds tol 0 by 1 - (5,5) 1 0 Abs err 1 exceeds tol 0 by 1 -4 tests, 1 passed, 3 known failures, 0 skipped -[inst/imfill.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imfill.m + xyz_map = rand (64, 3); + assert (rgb2xyz (xyz2rgb (xyz_map)), xyz_map, 3e-4); ***** test - I = uint8 (5.*[1 1 1; 1 0 1; 1 1 1]); - bw = logical ([1 1 1; 1 0 1; 1 1 1]); - I2 = uint8 (5.*ones (3)); - bw2 = logical (ones (3)); + xyz_img = rand (64, 64, 3); + assert (rgb2xyz (xyz2rgb (xyz_img)), xyz_img, 3e-4); +***** assert (xyz2rgb (sparse ([0 0 0])), [0 0 0], 1e-3) +***** assert (class (xyz2rgb (single([0.5 0.5 0.5]))), 'single') +***** error xyz2rgb () +***** error xyz2rgb (1,2) +***** error xyz2rgb ({1}) +***** error xyz2rgb (ones (2,2)) +***** test + xyz = rand (16, 16, 3, 5); + rgb = zeros (size (xyz)); + for i = 1:5 + rgb(:,:,:,i) = xyz2rgb (xyz(:,:,:,i)); + endfor + assert (xyz2rgb (xyz), rgb) +23 tests, 23 passed, 0 known failure, 0 skipped +[inst/ordfiltn.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/ordfiltn.m +***** shared b, f, s + b = [ 0 1 2 3 + 1 8 12 12 + 4 20 24 21 + 7 22 25 18]; - assert (imfill (int8 (I)), int8 (I2)) - assert (imfill (int16 (I)), int16 (I2)) - assert (imfill (int32 (I)), int32 (I2)) - assert (imfill (int64 (I)), int64 (I2)) - assert (imfill (uint8 (I)), uint8 (I2)) - assert (imfill (uint16 (I)), uint16 (I2)) - assert (imfill (uint32 (I)), uint32 (I2)) - assert (imfill (uint64 (I)), uint64 (I2)) - assert (imfill (single (I)), single (I2)) - assert (imfill (double (I)), double (I2)) - assert (imfill (bw, "holes"), bw2) - assert (imfill (uint8 (bw)), uint8 (bw2)) -***** error - imfill (i + ones (3, 3)); # complex input -***** error - imfill (sparse (double (I))); # sparse input -***** error - imfill (); -***** error - imfill (true (3), 4, "holes", 5) -***** error - imfill (false (3), ones (2, 3)) -***** error - imfill (false (3), ones (2, 3), 4) -***** error - imfill (false (3)) -***** error - imfill (false (3), 0, 4) -***** warning - bw = logical ([1 1 1; 1 0 1; 1 1 1]); - assert (imfill (bw, [5 5]), bw) - assert (imfill (bw, 15), bw) + f = [ 8 12 12 12 + 20 24 24 24 + 22 25 25 25 + 22 25 25 25]; +***** assert (ordfiltn (b, 9, true (3)), f); - bw = repmat (bw, [1 1 3]); - assert (imfill (bw, 30), bw) - assert (imfill (bw, [2 2 5]), bw) -***** test - bw = logical ([1 0 0 0 0 0 0 0 - 1 1 1 1 1 0 0 0 - 1 0 0 0 1 0 1 0 - 1 0 0 0 1 1 1 0 - 1 1 1 1 0 1 1 1 - 1 0 0 1 1 0 1 0 - 1 0 0 0 1 0 1 0 - 1 0 0 0 1 1 1 0]); - bw2 = logical ([1 0 0 0 0 0 0 0 - 1 1 1 1 1 0 0 0 - 1 1 1 1 1 0 1 0 - 1 1 1 1 1 1 1 0 - 1 1 1 1 1 1 1 1 - 1 0 0 1 1 1 1 0 - 1 0 0 0 1 1 1 0 - 1 0 0 0 1 1 1 0]); - bw3 = logical ([1 0 0 0 0 0 0 0 - 1 1 1 1 1 0 0 0 - 1 1 1 1 1 0 1 0 - 1 1 1 1 1 1 1 0 - 1 1 1 1 0 1 1 1 - 1 0 0 1 1 0 1 0 - 1 0 0 0 1 0 1 0 - 1 0 0 0 1 1 1 0]); - assert (imfill (bw, "holes"), bw2) - assert (imfill (bw, 8, "holes"), bw2) - assert (imfill (bw, 4, "holes"), bw2) - assert (imfill (bw, [3 3]), bw3) - assert (imfill (bw, 19), bw3) - assert (imfill (bw, [3 3], 4), bw3) - assert (imfill (bw, 19, 4), bw3) - assert (imfill (bw, [3 3], 8), bw2) - assert (imfill (bw, 19, 8), bw2) - assert (imfill (bw, [19; 20]), bw3) - assert (imfill (bw, [19; 20], 4), bw3) - assert (imfill (bw, [19; 20], 8), bw2) -***** warning - bw = logical ([1 1 1 1 1 1 1 - 1 0 0 0 0 0 1 - 1 0 1 1 1 0 1 - 1 0 1 0 1 0 1 - 1 0 1 1 1 0 1 - 1 0 0 0 0 0 1 - 1 1 1 1 1 1 1]); - bw44 = logical ([1 1 1 1 1 1 1 - 1 0 0 0 0 0 1 - 1 0 1 1 1 0 1 - 1 0 1 1 1 0 1 - 1 0 1 1 1 0 1 - 1 0 0 0 0 0 1 - 1 1 1 1 1 1 1]); - bw9 = logical ([1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 - 1 1 1 0 1 1 1 - 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1]); - assert (imfill (bw, "holes"), logical (ones (7))) - assert (imfill (bw, [4 4]), bw44) - assert (imfill (bw, 9), bw9) - assert (imfill (bw, [4 4; 10 10]), bw44) -***** test - bw = logical ([1 1 0 1 1]); - assert (imfill (bw, "holes"), bw) - bw = logical([1 1 0 1 1; 1 1 1 1 1]); - assert (imfill (bw, "holes"), bw) -***** test - I = zeros (5); - I(:, [2 4]) = 1; - I2_expected = [0 1 1 1 0 - 0 1 1 1 0 - 0 1 1 1 0 - 0 1 1 1 0 - 0 1 1 1 0]; - I2 = imfill (I, [0 0 0; 1 1 1; 0 0 0], "holes"); - assert (I2, I2_expected) -***** test - I = zeros (5); - I(:, [2 4]) = 1; - I2_expected = I; - I2 = imfill (I, [0 1 0; 0 1 0; 0 1 0], "holes"); - assert (I2, I2_expected) -***** test # this test is Matlab compatible - I = zeros (5); - I(:, [2 4]) = 1; - I2_expected = inf .* ones (5); - I2 = imfill (I, [0 0 0; 0 1 0; 0 0 0], "holes"); - assert (I2, I2_expected) -***** test - I = false (5); - I(:, [2 4]) = true; - I2_expected = true (5); - I2 = imfill (I, [0 0 0; 0 1 0; 0 0 0], "holes"); - assert (I2, I2_expected) -***** test - I = uint8 ([10 20 80 85 20 - 15 90 03 25 88 - 05 85 02 50 83 - 90 04 03 80 80 - 10 81 83 85 30]); - I2 = uint8 ([10 20 80 85 20 - 15 90 80 80 88 - 05 85 80 80 83 - 90 80 80 80 80 - 10 81 83 85 30]); - I3 = uint8 ([10 20 80 85 20 - 15 90 05 25 88 - 05 85 05 50 83 - 90 05 05 80 80 - 10 81 83 85 30]); - assert (imfill (I), I2) - assert (imfill (I, 4), I2) - assert (imfill (I, 4, "holes"), I2) - assert (imfill (I, 8), I3) - assert (imfill (I, "holes"), I2) -***** test - v_line = [0 1 0; 0 1 0; 0 1 0]; - h_line = [0 0 0; 1 1 1; 0 0 0]; - im = [0 1 0 0 1 0]; + f = [ 1 8 12 12 + 8 20 21 21 + 20 24 24 24 + 20 24 24 24]; +***** assert (ordfiltn (b, 8, true (3)), f); - assert (imfill (im, h_line, "holes"), [0 1 1 1 1 0]) - assert (imfill (im, v_line, "holes"), [0 1 0 0 1 0]) - assert (imfill (im', h_line, "holes"), [0 1 0 0 1 0]') - assert (imfill (im', v_line, "holes"), [0 1 1 1 1 0]') + f = [ 1 2 8 12 + 4 12 20 21 + 8 22 22 21 + 20 24 24 24]; +***** assert (ordfiltn (b, 7, true (3), "symmetric"), f); - im = repmat (im, [1 1 5]); - assert (imfill (im, h_line, "holes"), repmat ([0 1 1 1 1 0], [1 1 5])) - assert (imfill (im, v_line, "holes"), im) + f = [ 1 8 12 12 + 4 20 24 21 + 7 22 25 21 + 7 22 25 21]; +***** assert (ordfiltn (b, 3, true (3, 1)), f); - im = permute (im, [2 1 3]); - assert (imfill (im, h_line, "holes"), im) - assert (imfill (im, v_line, "holes"), repmat ([0 1 1 1 1 0]', [1 1 5])) -***** test - im = logical ([0 0 0 0 0 0 - 0 1 1 1 1 0 - 0 1 0 0 1 0 - 0 1 1 1 1 0 - 0 0 0 0 0 0]); - fi = logical ([0 0 0 0 0 0 - 0 1 1 1 1 0 - 0 1 1 1 1 0 - 0 1 1 1 1 0 - 0 0 0 0 0 0]); + f = [ 1 8 12 12 + 4 20 24 18 + 4 20 24 18 + 4 20 24 18]; +***** assert (ordfiltn (b, 3, true (4, 1)), f); - assert (imfill (cat (3, im, im, im), 8, 'holes'), cat (3, fi, fi, fi)) - assert (imfill (cat (3, im, im, im), 'holes'), cat (3, im, im, im)) - assert (imfill (cat (3, fi, im, fi), 'holes'), cat (3, fi, fi, fi)) -***** test - emp = false (5, 6); - im = logical ([0 0 0 0 0 0 - 0 1 1 1 1 0 - 0 1 0 1 0 1 - 0 1 1 1 1 0 - 0 0 0 0 0 0]); - fi = logical ([0 0 0 0 0 0 - 0 1 1 1 1 0 - 0 1 1 1 1 1 - 0 1 1 1 1 0 - 0 0 0 0 0 0]); - fi1 = logical ([0 0 0 0 0 0 - 0 1 1 1 1 0 - 0 1 1 1 0 1 - 0 1 1 1 1 0 - 0 0 0 0 0 0]); - fi2 = logical ([0 0 0 0 0 0 - 0 1 1 1 1 0 - 0 1 0 1 1 1 - 0 1 1 1 1 0 - 0 0 0 0 0 0]); + f = [ 4 20 24 21 + 7 22 25 21 + 7 22 25 21 + 7 22 25 21]; +***** assert (ordfiltn (b, 4, true (4, 1)), f); - assert (imfill (cat (3, im, im, im), [3 3 2]), cat (3, fi1, fi1, fi1)) - assert (imfill (cat (3, im, im, im), [3 5 2]), cat (3, fi2, fi2, fi2)) - assert (imfill (cat (3, im, im, im), [3 3 2; 3 5 2]), cat (3, fi, fi, fi)) - assert (imfill (cat (3, emp, im, emp), [3 3 2]), true (5, 6, 3)) -21 tests, 21 passed, 0 known failure, 0 skipped -[inst/imtranslate.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imtranslate.m -***** test - obs = imtranslate (ones (5, 5), 2, 1, "crop"); - exp = zeros (5, 5); - exp(1:4, 3:5) = 1; - assert (obs, exp, eps * 10) + s = [0 0 1 + 0 0 1 + 0 0 1]; + f = [ 2 8 12 12 + 9 20 22 21 + 21 25 24 24 + 21 25 24 24]; +***** assert (ordfiltn (b, 8, true (3), s), f); - obs = imtranslate (ones (5, 5), -2, -1, "crop"); - exp = zeros (5, 5); - exp(2:5, 1:3) = 1; - assert (obs, exp, eps * 10) -1 test, 1 passed, 0 known failure, 0 skipped + b(:,:,2) = b(:,:,1) - 1; + b(:,:,3) = b(:,:,2) - 1; + f(:,:,1) = [ 1 8 11 11 + 8 20 21 21 + 20 24 24 24 + 20 24 24 24]; + f(:,:,2) = [ 6 10 11 11 + 18 22 22 22 + 20 24 24 24 + 20 24 24 24]; + f(:,:,3) = [ 0 7 10 10 + 7 19 20 20 + 19 23 23 23 + 19 23 23 23]; +***** assert (ordfiltn (b, 25, true (3, 3, 3)), f); +8 tests, 8 passed, 0 known failure, 0 skipped [inst/edge.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/edge.m ***** test @@ -10008,303 +9109,98 @@ (1) 0.261 0.35 Abs err 0.089001 exceeds tol 0 by 0.09 (2) 0.6525 0.875 Abs err 0.2225 exceeds tol 0 by 0.2 24 tests, 22 passed, 2 known failures, 0 skipped -[inst/fspecial.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/fspecial.m -***** test - for i = 1:9 - n = 2^i; - assert (sum (fspecial ("disk", n)(:)), 1, eps*n*n); - endfor -***** test - for r = [3 5 9 17] - f = fspecial ("disk", r); - [X, Y] = meshgrid (-r:r, -r:r); - rhi = (abs (X) + 0.5).^2 + (abs (Y) + 0.5).^2; - rlo = (abs (X) - 0.5).^2 + (abs (Y) - 0.5).^2; - fhi = (rhi <= (r^2)); - flo = (rlo >= (r^2)); - for i = 1:(2*r+1) - for j = 1:(2*r+1) - if (fhi(i,j)) - assert (f(i,j), 1/(pi*r^2), eps); - endif - if (flo(i,j)) - assert (f(i,j), 0); - endif - endfor - endfor - endfor -***** error - fspecial ("gaussian", 0) -***** error - fspecial ("gaussian", 3.9) -***** assert (fspecial ("gaussian"), fspecial ("gaussian", 3, 0.5)) -***** assert (fspecial ("gaussian"), fspecial ("gaussian", [3 3], 0.5)) -***** test - c = ([-1:1].^2) + ([-1:1]'.^2); - gauss = exp (- (c / (2 * (0.5 ^ 2)))); - f = gauss / sum (gauss(:)); - assert (fspecial ("gaussian"), f) - - expected = [ - 0.01134373655849507 0.08381950580221061 0.01134373655849507 - 0.08381950580221061 0.61934703055717721 0.08381950580221061 - 0.01134373655849507 0.08381950580221061 0.01134373655849507]; - assert (f, expected, eps) -***** function f = f_gaussian_2d (hsize, sigma) - c = ([(-hsize(1)):(hsize(1))]'.^2) + ([(-hsize(2)):(hsize(2))].^2); - gauss = exp (- (c ./ (2 * (sigma .^ 2)))); - f = gauss ./ sum (gauss(:)); -***** endfunction -***** test - f = fspecial ("gaussian"); - assert (f, f_gaussian_2d ([1 1], .5)) - expected = [ - 0.01134373655849507 0.08381950580221061 0.01134373655849507 - 0.08381950580221061 0.61934703055717721 0.08381950580221061 - 0.01134373655849507 0.08381950580221061 0.01134373655849507]; - assert (f, expected, eps) -***** test - f = fspecial ("gaussian", 7, 2); - assert (f, f_gaussian_2d ([3 3], 2)) - expected = [ - 0.00492233115934352 - 0.00919612528958620 - 0.01338028334410124 - 0.01516184737296414 - 0.01338028334410124 - 0.00919612528958620 - 0.00492233115934352 - 0.00919612528958620 - 0.01718062389630964 - 0.02499766026691484 - 0.02832606006174462 - 0.02499766026691484 - 0.01718062389630964 - 0.00919612528958620 - 0.01338028334410124 - 0.02499766026691484 - 0.03637138107390363 - 0.04121417419979795 - 0.03637138107390363 - 0.02499766026691484 - 0.01338028334410124 - 0.01516184737296414 - 0.02832606006174462 - 0.04121417419979795 - 0.04670177773892775]; - expected = reshape ([expected; expected((end-1):-1:1)], [7 7]); - assert (f, expected, eps) -***** test - f = fspecial ("gaussian", [7 5], 2); - assert (f, f_gaussian_2d ([3 2], 2)) - expected = [ - 0.01069713252648568 - 0.01998487459872362 - 0.02907782096336423 - 0.03294948784319031 - 0.02907782096336423 - 0.01998487459872362 - 0.01069713252648568 - 0.01556423598706978 - 0.02907782096336423 - 0.04230797985750011 - 0.04794122192790870 - 0.04230797985750011 - 0.02907782096336423 - 0.01556423598706978 - 0.01763658993191515 - 0.03294948784319031 - 0.04794122192790870 - 0.05432452146574315]; - expected = reshape ([expected; expected((end-1):-1:1)], [7 5]); - assert (f, expected, eps) -***** test - f = fspecial ("gaussian", [4 2], 2); - expected = [0.10945587477855045 0.14054412522144952]; - expected = expected([1 1; 2 2; 2 2; 1 1]); - assert (f, expected, eps) -***** test - expected =[0.04792235409415088 0.06153352068439959 0.07901060453704994]; - expected = expected([1 2 2 1; 2 3 3 2; 2 3 3 2; 1 2 2 1]); - assert (fspecial ("gaussian", 4, 2), expected) -***** function f = f_gaussian_3d (lengths, sigma) - [x, y, z] = ndgrid (-lengths(1):lengths(1), -lengths(2):lengths(2), - -lengths(3):lengths(3)); - sig_22 = 2 * (sigma.^2); - f = exp (-((x.^2)/sig_22 + (y.^2)/sig_22 + (z.^2)/sig_22)); - f = f / sum (f(:)); -***** endfunction -***** test - obs = fspecial ("gaussian", [5 5 5]); - assert (obs, f_gaussian_3d ([2 2 2], .5)) - - u_values = [ - 0.00000000001837155 - 0.00000000741161178 - 0.00000005476481523 - 0.00000299005759843 - 0.00002209370333384 - 0.00016325161336690 - 0.00120627532940896 - 0.00891323607975882 - 0.06586040141635063 - 0.48664620076350640]; - expected = zeros (5, 5, 5); - expected([1 5 21 25 101 105 121 125]) = u_values(1); - expected([2 4 6 10 16 20 22 24 26 30 46 50 76 80 96 100 102 104 106 110 116 120 122 124]) = u_values(2); - expected([3 11 15 23 51 55 71 75 103 111 115 123]) = u_values(3); - expected([7 9 17 19 27 29 31 35 41 45 47 49 77 79 81 85 91 95 97 99 107 109 117 119]) = u_values(4); - expected([8 12 14 18 28 36 40 48 52 54 56 60 66 70 72 74 78 86 90 98 108 112 114 118]) = u_values(5); - expected([13 53 61 65 73 113]) = u_values(6); - expected([32 34 42 44 82 84 92 94]) = u_values(7); - expected([33 37 39 43 57 59 67 69 83 87 89 93]) = u_values(8); - expected([38 58 62 64 68 88]) = u_values(9); - expected([63]) = u_values(10); - assert (obs, expected, 4 * eps) -***** test - obs = fspecial ("gaussian", [5 5 5], 1); - assert (obs, f_gaussian_3d ([2 2 2], 1)) - - u_values = [ - 0.00016177781678373 - 0.00072503787330278 - 0.00119538536377748 - 0.00324939431236223 - 0.00535734551968363 - 0.00883276951279243 - 0.01456277497493249 - 0.02400995686159072 - 0.03958572658629712 - 0.06526582943894763]; - expected = zeros (5, 5, 5); - expected([1 5 21 25 101 105 121 125]) = u_values(1); - expected([2 4 6 10 16 20 22 24 26 30 46 50 76 80 96 100 102 104 106 110 116 120 122 124]) = u_values(2); - expected([3 11 15 23 51 55 71 75 103 111 115 123]) = u_values(3); - expected([7 9 17 19 27 29 31 35 41 45 47 49 77 79 81 85 91 95 97 99 107 109 117 119]) = u_values(4); - expected([8 12 14 18 28 36 40 48 52 54 56 60 66 70 72 74 78 86 90 98 108 112 114 118]) = u_values(5); - expected([13 53 61 65 73 113]) = u_values(6); - expected([32 34 42 44 82 84 92 94]) = u_values(7); - expected([33 37 39 43 57 59 67 69 83 87 89 93]) = u_values(8); - expected([38 58 62 64 68 88]) = u_values(9); - expected([63]) = u_values(10); - assert (obs, expected, eps) -***** test - obs = fspecial ("gaussian", [3 4 1 5], 3); - assert (find (obs == max (obs(:))), [29; 32]) - assert (size (obs), [3 4 1 5]) - assert (obs(:)(1:30), obs(:)(end:-1:31)) -***** test - f = repmat (1/9, [3 3]); - assert (fspecial ("average", [3 3]), f) - - ## Test default - assert (fspecial ("average"), fspecial ("average", [3 3])) - assert (fspecial ("average"), fspecial ("average", [3])) - - f = repmat (1/21, [3 7]); - assert (fspecial ("average", [3 7]), f) - - f = repmat (1/40, [4 5 1 2]); - assert (fspecial ("average", [4 5 1 2]), f) - ## Behave even if it's a column vector - assert (fspecial ("average", [4 5 1 2]'), f) -16 tests, 16 passed, 0 known failure, 0 skipped -[inst/houghpeaks.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/houghpeaks.m -***** shared im1 - im1 = magic (5); -***** error houghpeaks () -***** error houghpeaks (1, 2, 3, 4, 5, 6, 7) -***** assert (houghpeaks (im1)) -***** assert (houghpeaks (im1, 2)) -***** assert (houghpeaks (im1, "Threshold", 10)) -***** assert (houghpeaks (im1, 2, "Threshold", 10)) -***** assert (houghpeaks (im1, "NHoodSize", [3 3])) -***** assert (houghpeaks (im1, 2, "NHoodSize", [3 3])) -***** assert (houghpeaks (im1, "Threshold", 10, "NHoodSize", [3 3])) -***** assert (houghpeaks (im1, "NHoodSize", [3 3], "Threshold", 10)) -***** assert (houghpeaks (im1, 2, "Threshold", 10, "NHoodSize", [3 3])) -***** assert (houghpeaks (im1, 2, "NHoodSize", [3 3], "Threshold", 10)) -***** error houghpeaks (ones (5, 5, 5)) -***** error houghpeaks ("hello") -***** error houghpeaks (im1, 1.5) -***** error houghpeaks (im1, -2) -***** error houghpeaks (im1, [1 1]) -***** error houghpeaks (im1, "Threshold", "hello") -***** error houghpeaks (im1, "Threshold", -2) -***** error houghpeaks (im1, "Threshold", [1 1]) -***** error houghpeaks (im1, "NHoodSize", [3 3 3]) -***** error houghpeaks (im1, "NHoodSize", "hello") -***** error houghpeaks (im1, "NHoodSize", [-3 -3]) -***** error houghpeaks (im1, "NHoodSize", [4 4]) -***** test - out = houghpeaks (im1); - assert (size (out), [1 2]) - assert (class (out), "double") -***** test - out = houghpeaks (im1, 3); - assert (size (out), [3 2]) -***** test - expected = [5 3; 1 2; 3 5; 1 5]; - assert (houghpeaks (im1, 4), expected) # this checks for undocumented nhood >=3 - assert (houghpeaks (im1, 4, "nhoodsize", [3,3]), expected) - assert (houghpeaks (im1, 4, "threshold", 10), expected) - assert (houghpeaks (im1, 4, "threshold", 24), expected(1:2,:)) +[inst/houghlines.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/houghlines.m +***** shared BW0, theta0, rho0, peaks0_1, peaks0_2, lines0_1, lines0_2, BW1, theta1, rho1, peaks1, lines1 + BW0 = logical([0 0 0 0 1; 0 0 0 1 0; 1 0 1 0 0; 0 1 0 0 0; 1 1 1 1 1]); + theta0 = [-90:89]; + rho0 = [-7:7]; + peaks0_1 = [11 130]; + peaks0_2 = [11 130; 4 1]; + lines0_1 = struct ("point1", {[1,5]}, "point2", {[5,1]}, "theta", {39}, "rho", {3}); + lines0_2 = struct ("point1", {[1,5], [1,5]}, "point2", {[5,1],[5,5]}, "theta", {39,-90}, "rho", {3, -4}); + BW1 = diag(ones(50,1)); + theta1 = [-90:89]; + rho1 = -70:70; + peaks1 = [71 46]; + lines1 = struct ("point1", {[1 1]}, "point2", {[50 50]}, "theta", {-45}, "rho", {0}); +***** error houghlines () +***** error houghlines (BW1) +***** error houghlines (BW1, theta1) +***** error houghlines (BW1, theta1, rho1) +***** assert (houghlines (BW1, theta1, rho1, peaks1), lines1) +***** error (houghlines (BW1, theta1, rho1, peaks1, [1 2 3])) +***** assert (houghlines (BW1, theta1, rho1, peaks1, "FillGap", 5), lines1) +***** assert (houghlines (BW1, theta1, rho1, peaks1, "MinLength", 2), lines1) +***** assert (houghlines (BW1, theta1, rho1, peaks1, "FillGap", 5, "MinLength", 2), lines1) +***** assert (houghlines (BW1, theta1, rho1, peaks1, "MinLength", 2, "FillGap", 5), lines1) +***** error houghlines (BW1, theta1, rho1, peaks1, "MinLength", 2, [1 2 3]) +***** error houghlines (BW1, theta1, rho1, peaks1, "MinLength", 2, "FillGap", 5, [1 2 3]) +***** assert (houghlines (double (BW1), theta1, rho1, peaks1), lines1) +***** error houghlines (ones(5, 5, 5), theta1, rho1, peaks1) +***** error houghlines ("nonsense", theta1, rho1, peaks1) +***** error houghlines (BW1, ones(5), rho1, peaks1) +***** error houghlines (BW1, "nonsense", rho1, peaks1) +***** error houghlines (BW1, theta1, ones(5), peaks1) +***** error houghlines (BW1, theta1, "nonsense", peaks1) +***** error houghlines (BW1, theta1, rho1, ones(5)) +***** error houghlines (BW1, theta1, rho1, ones(2,2,2)) +***** error houghlines (BW1, theta1, rho1, "nonsense") +***** error houghlines (BW1, theta1, rho1, peaks1, "nonsense", 5) +***** error houghlines (BW1, theta1, rho1, peaks1, "MinLength", -5) +***** error houghlines (BW1, theta1, rho1, peaks1, "MinLength", [3 4]) +***** error houghlines (BW1, theta1, rho1, peaks1, "MinLength", "nonsense") +***** error houghlines (BW1, theta1, rho1, peaks1, "FillGap", -5) +***** error houghlines (BW1, theta1, rho1, peaks1, "FillGap", [3 4]) +***** error houghlines (BW1, theta1, rho1, peaks1, "FillGap", "nonsense") ***** test - im2 = magic (7); - expected_a = [7 4; 1 3; 3 1; 5 6]; - expected_b = [7 4; 1 3; 4 7; 1 7]; - assert (houghpeaks (im2, 4), expected_a) - assert (houghpeaks (im2, 4, "nhoodsize", [5,5]), expected_b) - assert (houghpeaks (im2, 4, "threshold", 24), expected_a) - assert (houghpeaks (im2, 4, "threshold", 47), expected_a(1:2,:)) + out = houghlines(BW0, theta0, rho0, peaks0_2, "MinLength", 1); + assert (out, lines0_2) # includes class = struct, size = [1,2] +***** test # for empty output + n = 100; + BW = false (n); + a = 50; % line starts at left side at row a + b = 3; % slope of line is 1:b + for column = 1:n + if (rem (column, b) == 0) + row = a - column/b; + BW(row, column) = true; + BW(row, column+1) = true; + end + end + theta = [-90: 89]; + rho = [-141:141]; + peaks = [188, 163]; + out = houghlines(BW, theta, rho, peaks, 'FillGap', 1, 'MinLength', 5); + assert (out, struct([])) ***** test - im3 = magic (99); - expected_a = [99 50; 1 49; 3 47; 5 45; 7 43; 9 41; 11 39]; - expected_b = [99 50; 1 49; 7 43; 13 37; 19 31; 25 25; 31 19]; - expected_c = [99 50; 1 49; 2 48; 3 47; 4 46; 5 45; 6 44]; - assert (houghpeaks (im3, 7), expected_a) - assert (houghpeaks (im3, 7, "nhoodsize", [11 11]), expected_b) - assert (houghpeaks (im3, 7, "nhoodsize", [11 1]), expected_c) - assert (houghpeaks (im3, 7, "nhoodsize", [11 1]), expected_c) + out0_1 = houghlines(BW0, theta0, rho0, peaks0_1, 'MinLength', 1); + out0_2 = houghlines(BW0, theta0, rho0, peaks0_2, 'MinLength', 1); + assert (out0_1, lines0_1); + assert (out0_2, lines0_2); ***** test - im4 = double (im2uint16 (peaks ())); - expected_a = [37 15; 39 15; 41 15; 15 16; 17 16]; - expected_b = [37 15; 15 16; 26 21; 37 26; 20 32]; - expected_c = [37 15; 15 16; 35 16; 15 17; 35 17]; - expected_d = [37 15; 38 15; 39 15; 40 15; 41 15]; - assert (houghpeaks (im4, 5), expected_a) - assert (houghpeaks (im4, 5, "nhoodsize", [21 21]), expected_b) - assert (houghpeaks (im4, 5, "nhoodsize", [21 1]), expected_c) - assert (houghpeaks (im4, 5, "nhoodsize", [1 21]), expected_d) -***** test # tests use of anti-symmetry in H - im5 = zeros (6,4); im5(2,1) = 1; im5(5,4) = 2; - expected = [5 4; 2 1]; - assert (houghpeaks (im5, 2, "nhoodsize", [1 1]), expected); - assert (houghpeaks (im5, 2, "nhoodsize", [3 3]), expected(1,:)); -***** test #test use of anti-symmetry in the other direction - im6 = magic (100); - expected_a = [1 1; 100 99; 1 4; 100 95; 1 8; 100 91; 1 12]; - expected_b = [1 1; 100 95; 1 8; 100 87; 1 16; 100 79; 1 24]; - expected_c = [1 1; 100 99; 100 98; 1 4; 1 5; 100 95; 100 94]; - expected_d = expected_b; - assert (houghpeaks (im6, 7), expected_a) - assert (houghpeaks (im6, 7, "nhoodsize", [11 11]), expected_b) - assert (houghpeaks (im6, 7, "nhoodsize", [11 1]), expected_c) - assert (houghpeaks (im6, 7, "nhoodsize", [1 11]), expected_d) -***** test # test undocumented Matlab default value for nhoodsize - im = zeros (723, 180); - im(585,136) = 8; - im(593,135) = 7; - im(310,46) = 6; - expected = [585, 136; 310, 46]; - assert (houghpeaks (im, 2), expected) + out = houghlines(BW1, theta1, rho1, peaks1); + assert (out, lines1); ***** test - I = max (0, phantom ()); - H = hough (I); - P0 = [585, 136; 310, 46; 595, 136; 522, 104; 373, 46]; - assert (houghpeaks (H, 5), P0) + n = 100; + BW = false (n); + a = 50; % line starts at left side at row a + b = 3; % slope of line is 1:b + for column = 1:n + if (rem (column, b) == 0) + row = a - column/b; + BW(row, column) = true; + BW(row, column+1) = true; + end + end + theta = [-90:89]; + rho = [-141:141]; + peaks = [188, 163]; + lines_1 = struct ("point1", {[99 17]}, "point2", {[3 49]}, "theta", {72}, "rho", {46}); + out_1 = houghlines(BW, theta, rho, peaks); + out_n = houghlines(BW, theta, rho, peaks, 'FillGap', 1, 'MinLength', 1); + assert (out_1, lines_1) + assert (size (out_n), [1, 29]) ***** demo I = checkerboard (30, 1, 1); I = imnoise(I, "salt & pepper", 0.2); @@ -10314,888 +9210,563 @@ figure, imshow(BW); title ("edge image"); [H, theta, rho] = hough (BW); - figure, imshow (mat2gray (H), [],"XData",theta,"YData",rho); + figure, imshow (mat2gray (H), [], "XData", theta, "YData", rho); title ("Hough transform of edge image \n 2 peaks marked"); axis on; xlabel("theta [degrees]"); ylabel("rho [pixels]"); peaks = houghpeaks (H, 2); - peaks_rho = rho(peaks(:,1)) - peaks_theta = theta(peaks(:,2)) - hold on; - plot(peaks_theta,peaks_rho,"sr"); - hold off; + peaks_rho = rho(peaks(:,1)); + peaks_theta = theta(peaks(:,2)); + hold on; plot (peaks_theta, peaks_rho, "sr"); hold off; + lines = houghlines (BW, theta, rho, peaks); + figure, imshow (I), hold on; + for n = 1:length (lines) + points = [lines(n).point1; lines(n).point2]; + plot (points(:,1), points(:,2), "r"); + endfor + title ("the two strongest lines (edges) in the image"), hold off; 34 tests, 34 passed, 0 known failure, 0 skipped -[inst/imregionalmax.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imregionalmax.m -***** test - a = [ - 7 3 9 3 10 3 - 4 2 3 10 1 3 - 1 4 6 9 4 10 - 8 7 9 3 4 8 - 5 9 3 3 8 9 - 3 6 9 4 1 10]; - - a4 = [ - 1 0 1 0 1 0 - 0 0 0 1 0 0 - 0 0 0 0 0 1 - 1 0 1 0 0 0 - 0 1 0 0 0 0 - 0 0 1 0 0 1]; - assert (imregionalmax (a, 4), logical (a4)) - a8 = [ - 1 0 0 0 1 0 - 0 0 0 1 0 0 - 0 0 0 0 0 1 - 0 0 0 0 0 0 - 0 0 0 0 0 0 - 0 0 0 0 0 1]; - assert (imregionalmax (a, 8), logical (a8)) - assert (imregionalmax (a), logical (a8)) -***** test - ## test float input images - im0 = peaks (); - im1 = im0 ./ 100; - max_pos_expected = [1000; 1214; 1691; 2353]; - max0 = imregionalmax (im0); - max0_pos = find (max0); - max1 = imregionalmax (im1); - assert (max1, max0) - assert (max0_pos, max_pos_expected) -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/entropy.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/entropy.m -***** assert (entropy ([0 1]), 1) -***** assert (entropy (uint8 ([0 1])), 1) -***** assert (entropy ([0 0]), 0) -***** assert (entropy ([0]), 0) -***** assert (entropy ([1]), 0) -***** assert (entropy ([0 .5; 2 0]), 1.5) -***** assert (entropy (repmat ([0 .5; 2 0], 1, 1, 3)), - entropy ([0 .5; 2 0])) -***** test - A = zeros (3,3); - B = ones (3,3); - C = [1 1 1; 2 2 2; 3 3 3]; - D = C'; - E = ones (3,3); - E(2,2)=2; - F = 3 .* ones (3,3); - F(2,2)=1; - G = [-1 2 7; -5 2 8; -7 pi 9]; - H = [5 2 8; 1 -3 1; 5 1 0]; - pG = [1 2] ./ 3; - G_out = -sum (pG.*log2 (pG)); - pH = [2 7] ./ 9; - H_out = -sum (pH.*log2 (pH)); - assert (entropy (A), 0, eps); - assert (entropy (B), 0, eps); - assert (entropy (C), 0, eps); - assert (entropy (D), 0, eps); - assert (entropy (E), 0, eps); - assert (entropy (F), 0, eps); - assert (entropy (G), G_out, eps); - assert (entropy (H), H_out, eps); -***** test - A = uint8 (zeros (3,3)); - B = uint8 (ones (3,3)); - C = uint8 ([1 1 1; 2 2 2; 3 3 3]); - D = C'; - E = uint8 (ones (3,3)); - E(2,2)=2; - F = 3 .* uint8 (ones (3,3)); - F(2,2)=1; - G = uint8 ([0 2 7; 0 2 8; 0 3 9]); - H = uint8 ([5 2 8; 1 0 1; 5 1 0]); - pC = [1 1 1] ./ 3; - C_out = -sum (pC.*log2 (pC)); - D_out = C_out; - pE = [8 1] ./ 9; - E_out = -sum (pE.*log2 (pE)); - F_out = E_out; - pG = [3 2 1 1 1 1] ./ 9; - G_out = -sum (pG.*log2 (pG)); - pH = [2 3 1 2 1] ./ 9; - H_out = -sum (pH.*log2 (pH)); - assert (entropy (A), 0); - assert (entropy (B), 0); - assert (entropy (C), C_out, eps); - assert (entropy (D), D_out, eps); - assert (entropy (E), E_out, eps); - assert (entropy (F), F_out, eps); - assert (entropy (G), G_out, eps); - assert (entropy (H), H_out, eps); -***** test - L1 = false (3,3); - L1(2,2)=true; - L2 = true (3,3); - L2(2,2)=false; - L3 = logical ([0 1 1; 0 1 1; 0 0 1]); - p12 = [1 8] ./ 9; - out12 = -sum (p12.*log2 (p12)); - p3 = [5 4] ./9; - out3 = -sum (p3.*log2 (p3)); - assert (entropy (L1), out12, eps); - assert (entropy (L2), out12, eps); - assert (entropy (L3), out3, eps); -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/imextendedmax.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imextendedmax.m -***** shared im0, bw0_h2_out - im0 = uint8 ([0 0 0 0 0; - 0 1 2 1 0; - 0 2 5 2 0; - 0 1 2 1 0; - 0 0 0 0 0]); - bw0_h2_out = false (5); - bw0_h2_out(3,3) = true; -***** error imextendedmax () -***** error imextendedmax (im0) -***** error imextendedmax ("hello", 2) -***** error imextendedmax (i.*im0, 2) -***** error imextendedmax (sparse (im0), 2) -***** error imextendedmax (im0, -2) -***** error imextendedmax (im0, 'a') -***** error imextendedmax (im0, ones (2)) -***** error imextendedmax (im0, 2*i) -***** assert (imextendedmax (im0, 2), bw0_h2_out) -***** assert (imextendedmax (double (im0), 2), bw0_h2_out) -***** assert (imextendedmax (im0, 2, 8), bw0_h2_out) -***** assert (imextendedmax (im0, 2, 4), bw0_h2_out) -***** assert (imextendedmax (im0, 2, true (3)), bw0_h2_out) -***** test - out = imextendedmax (im0, 2); - assert (size (out), size (im0)) - assert (class (out), "logical") -***** test - out = imextendedmax (single (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "logical") -***** test - out = imextendedmax (uint8 (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "logical") -***** test - out = imextendedmax (uint16 (im0), 2); - assert (size (out), size (im0)) - assert (class (out), "logical") -***** test - im = cat (3, im0, im0, im0, im0); - out = imextendedmax (im, 2); - assert (size (out), size (im)) -***** test - im = zeros (10); - im(2:4, 2:4) = 3; - im(6:8, 6:8) = 8; - expected_4 = false (10); - expected_4(6:8, 6:8) = true; - expected_2 = expected_4; - expected_2(2:4, 2:4) = true; - out = imextendedmax (im, 4); - assert (out, expected_4, eps) - out = imextendedmax (0.1.*im, 0.4); - assert (out, expected_4, eps) - out = imextendedmax (im, 2); - assert (out, expected_2, eps) -***** test - im2 = zeros (10); - im2(2:4, 2:4) = 3; - im2(6:9, 6:9)=8; - im2(5, 5)=8; - im2(6, 7)=0; - im2(7, 8)=0; - expected_8 = false (10); - expected_8(6:9, 6:9) = true; - expected_8(5, 5) = true; - expected_8(6, 7) = false; - expected_8(7, 8) = false; - expected_4 = expected_8; - expected_4(2:4, 2:4) = true; - out2 = imextendedmax (im2, 2); - assert (out2, expected_8, eps) - out2 = imextendedmax (im2, 2, 4); - assert (out2, expected_4, eps) - out2 = imextendedmax (im2, 2, 8); - assert (out2, expected_8, eps) -21 tests, 21 passed, 0 known failure, 0 skipped -[inst/imquantize.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imquantize.m -***** error - imquantize (rand (5), [3 4 2 5]) -***** error - imquantize (rand (5), [1 2 3], "foo") -***** error - imquantize (rand (5), [1 2 3 4], 1:6) -***** error - imquantize (rand (5), [1 2 3 4], 1:2) -***** test - img = [-inf 0 10000000; -100000 -3 1/1000000; 5 5 10]; - [q, q_idx] = imquantize (img, 5); - assert (q, [1 1 2; 1 1 1; 1 1 2]) - assert (q_idx, q) -***** test - img = [1:10; 11:20; 21:30; 31:40; 41:50; 51:60; 61:70]; - - expected_q = [ - 0 0 0 0 0 1 1 1 1 1 - 1 1 1 1 1 5 5 5 5 5 - 5 5 5 5 5 10 10 10 10 10 - 20 20 20 20 20 20 20 20 20 20 - 30 30 30 30 30 30 30 30 30 30 - 30 30 30 30 30 30 30 30 30 30 - 15 15 15 15 15 15 15 15 15 15]; - - expected_q_idx = [ - 1 1 1 1 1 2 2 2 2 2 - 2 2 2 2 2 3 3 3 3 3 - 3 3 3 3 3 4 4 4 4 4 - 5 5 5 5 5 5 5 5 5 5 - 6 6 6 6 6 6 6 6 6 6 - 6 6 6 6 6 6 6 6 6 6 - 7 7 7 7 7 7 7 7 7 7]; - - [q, q_idx] = imquantize (img, [5 15 25 30 40 60], [0 1 5 10 20 30 15]); - assert (q, expected_q) - assert (q_idx, expected_q_idx) - - [q, q_idx] = imquantize (single (img), [5 15 25 30 40 60], - [0 1 5 10 20 30 15]); - assert (q, expected_q) - assert (q_idx, expected_q_idx) - - [q, q_idx] = imquantize (uint8 (img), [5 15 25 30 40 60], - [0 1 5 10 20 30 15]); - assert (q, expected_q) - assert (q_idx, expected_q_idx) - - [q, q_idx] = imquantize (uint8 (img), uint8 ([5 15 25 30 40 60]), - [0 1 5 10 20 30 15]); - assert (q, expected_q) - assert (q_idx, expected_q_idx) +[inst/impixel.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/impixel.m +***** shared img2d, img3d + img2d = uint8 (magic (10)); + img3d(:,:,1) = img2d; + img3d(:,:,2) = img2d + 1; + img3d(:,:,3) = img2d + 2; + img3d = uint8 (img3d); - [q, q_idx] = imquantize (uint8 (img), uint8 ([5 15 25 30 40 60]), - uint8 ([0 1 5 10 20 30 15])); - assert (q, uint8 (expected_q)) - assert (q_idx, expected_q_idx) -***** test - img = randi ([0 255], 10, "uint8"); - [q, q_idx] = imquantize (img, [50 100 150 200]); - assert (class (q), "double") - assert (class (q_idx), "double") +***** assert (impixel (img2d, 2, 2), single ([80 80 80])); +***** assert (impixel (img2d, -2, 2), single ([NA NA NA])); - [q, q_idx] = imquantize (img, [50 100 150 200], uint16 ([5 7 8 9 2])); - assert (class (q), "uint16") - assert (class (q_idx), "double") +***** assert (impixel (img2d, [1 10], [1 10]), single ([92 92 92; 59 59 59])); +***** assert (impixel (img3d, [1 10], [1 10]), single ([92 93 94; 59 60 61])); +***** assert (impixel (double (img2d), [1 10], [1 10]), [92 92 92; 59 59 59]); - [q, q_idx] = imquantize (img, [50 100 150 200], uint8 ([5 7 8 9 2])); - assert (class (q), "uint8") - assert (class (q_idx), "double") -***** test - img = [1:10; 11:20; 21:30; 31:40; 41:50; 51:60; 61:70].'; - r_idx = reshape (randperm (numel (img)), size (img)); +***** assert (impixel ([1 10], [1 10], img2d, [1 10], [1 10]), single ([92 92 92; 59 59 59])); +***** assert (impixel ([3 12], [-4 12], img2d, [1 10], [1 10]), single ([NA NA NA; 44 44 44])); +***** assert (impixel ([3 5], [-4 3], img2d, [1 10], [1 10]), single ([NA NA NA; NA NA NA])); - [quant, quant_idx] = imquantize (img, [5 15 25 30 40 60]); - [quant_r, quant_r_idx] = imquantize (img(r_idx), [5 15 25 30 40 60]); + ## the following returns double because it's an indexed image +***** assert (impixel ([3 12], [-4 12], img2d, gray (100), [1 10], [1 10]), [NA NA NA; 4/9 4/9 4/9]); +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/impyramid.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/impyramid.m +***** xtest + ## bug #51979 (results are not matlab compatible) + in = [116 227 153 69 146 194 59 130 139 106 + 2 47 137 249 90 75 16 24 158 44 + 155 68 46 84 166 156 69 204 32 152 + 71 221 137 230 210 153 192 115 30 118 + 107 143 108 52 51 73 101 21 175 90 + 54 158 143 77 26 168 113 229 165 225 + 9 47 133 135 130 207 236 43 19 73]; - assert (imquantize (img(r_idx), [5 15 25 30 40 60]), quant(r_idx)) - assert (quant_r, quant_r_idx) -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/qtdecomp.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/qtdecomp.m -***** demo - full(qtdecomp(eye(8))) - %It finds 2 big blocks of 0 and it decomposes further where 0 and 1 are mixed. -***** # Test if odd-sized limits split -***** assert(full(qtdecomp(eye(5))), reshape([5,zeros(1,24)],5,5)); -***** assert(full(qtdecomp(eye(6))), repmat(reshape([3,zeros(1,8)],3,3),2,2)); -***** # Test 'equal' method -***** test - a=ones(2,2); - b=[2,0;0,0]; - assert(full(qtdecomp(eye(4))), [a,b;b,a]); -***** shared A, B2, B4 - A=[ 1, 4, 2, 5,54,55,61,62; - 3, 6, 3, 1,58,53,67,65; - 3, 6, 3, 1,58,53,67,65; - 3, 6, 3, 1,58,53,67,65; - 23,42,42,42,99,99,99,99; - 27,42,42,42,99,99,99,99; - 23,22,26,25,99,99,99,99; - 22,22,24,22,99,99,99,99]; - B2=[2,0;0,0]; - B4=zeros(4); B4(1,1)=4; -***** test - R=[ones(4,8); [ones(2),B2;ones(2,4)], B4]; - assert(full(qtdecomp(A)), R); - assert(full(qtdecomp(A,0)), R); -***** # Test 'threshold' method -***** test - R=[ones(4,8); [ones(2),B2;B2,ones(2)],B4]; - assert(full(qtdecomp(A,1)), R); -***** test - R=[[B4,[B2,B2;B2,B2]]; [[ones(2),B2;B2,B2],B4]]; - assert(full(qtdecomp(A,10)), R); -***** test - R=[[B4,[B2,B2;B2,B2]]; [[B2,B2;B2,B2],B4]]; - assert(full(qtdecomp(A,10,2)), R); + reduced = [ + 114 139 131 103 111 + 97 122 141 111 100 + 103 123 112 123 122 + 47 107 134 153 94]; - assert(full(qtdecomp(A,100,[2, 4])), [B4,B4;B4,B4]); -***** test - f = @(A, c1 = 54, c2 = 0, c3 = 0) (A (1, 1, :) != ((c1+c2+c3) * ones (1, 1, size (A, 3))))(:); + expanded = [ + 115 154 185 178 150 122 105 116 138 159 158 117 78 86 112 129 133 120 103 + 69 98 128 141 146 152 152 139 125 127 121 87 55 58 81 113 131 112 84 + 40 54 74 100 131 167 184 157 119 104 92 64 41 44 66 100 121 103 74 + 76 69 65 75 97 130 153 148 131 122 108 80 61 79 103 105 98 97 98 + 120 105 88 77 78 96 121 143 155 154 140 112 98 124 143 109 74 91 123 + 117 129 134 119 107 125 153 173 180 172 156 143 138 146 140 96 60 83 122 + 99 139 170 157 139 156 181 188 180 164 151 154 156 140 112 81 65 84 110 + 101 136 163 153 133 132 138 136 130 122 120 130 133 108 82 86 99 104 104 + 103 126 143 136 116 97 81 73 73 82 94 105 105 87 78 108 138 133 116 + 90 116 139 139 122 96 69 52 53 80 109 114 111 116 128 148 163 164 160 + 66 99 131 140 131 109 83 62 62 102 142 144 138 154 169 164 157 169 184 + 41 68 99 121 130 122 107 92 95 133 173 182 172 156 135 114 105 121 142 + 21 38 64 98 124 131 127 123 129 160 194 212 199 144 82 52 48 65 85]; - assert(full(qtdecomp(A,f)),[ones(4),B4;ones(4,8)]); - assert(full(qtdecomp(A,f,54)),[ones(4),B4;ones(4,8)]); - assert(full(qtdecomp(A,f,4,40,10)),[ones(4),B4;ones(4,8)]); -***** test -***** # no params - first_eq=inline("(A(1,1,:)!=(54*ones(1,1,size(A,3))))(:)","A"); - assert(full(qtdecomp(A,first_eq)),[ones(4),B4;ones(4,8)]); -***** test -***** # 1 param - first_eq=inline("(A(1,1,:)!=(c*ones(1,1,size(A,3))))(:)","A","c"); - assert(full(qtdecomp(A,first_eq,54)),[ones(4),B4;ones(4,8)]); -***** test -***** # 3 params - first_eq=inline("(A(1,1,:)!=((c1+c2+c3)*ones(1,1,size(A,3))))(:)","A","c1","c2","c3"); - assert(full(qtdecomp(A,first_eq,4,40,10)),[ones(4),B4;ones(4,8)]); -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/bestblk.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/bestblk.m -***** demo - siz = bestblk ([200; 10], 50); - disp (siz) -***** error bestblk ("string") -***** error bestblk ([100 200], "string") -***** error <2 elements> bestblk ([100], 5) -***** assert (bestblk ([ 10 12], 2), [ 2 2]); -***** assert (bestblk ([ 10 12], 3), [ 2 3]); -***** assert (bestblk ([300 100], 150), [150 100]); -***** assert (bestblk ([256 128], 17), [ 16 16]); -***** assert (bestblk ([ 17 17], 3), [ 3 3]); -***** assert (bestblk ([230 470]), bestblk ([230 470], 100)) -***** assert (bestblk ([10 12 10], 3), [2 3 2]); -***** assert (bestblk ([ 9 12 9], 3), [3 3 3]); -***** assert (bestblk ([10 12 10 11], 5), [5 4 5 4]); -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/col2im.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/col2im.m -***** demo - ## Divide A using distinct blocks and then reverse the operation - A = [ 1:10 - 11:20 - 21:30 - 31:40]; - B = im2col (A, [2 5], "distinct") - C = col2im (B, [2 5], [4 10], "distinct") -***** demo - ## Get sliding blocks of size from A into columns, calculate the - ## mean of each block (mean of each column), and reconstruct A - ## after a median filter. - A = reshape (1:24, [4 6]) - B = im2col (A, [2 3], "sliding") - C = mean (B); - col2im (C, [1 1], [3 4], "sliding") -***** error col2im (ones (10), [5 5], [10 10], "wrong_block_type"); -***** error col2im (ones (10), [1 1], [ 7 7], "sliding"); -***** error col2im (ones (10), [3 3], [10 10], "distinct") -***** error col2im (ones (10), [5 5], [10 11], "distinct"); -***** assert (col2im (sum (im2col (magic (10), [3 3], "sliding")), [1 1], [8 8]), - convn (magic (10), ones (3, 3), "valid")); -***** test - B = ones (1, (10-2+1)*(7-3+1)); - A = ones ((10-2+1), (7-3+1)); - assert (col2im (B, [2 3], [10 7]), A); + assert (impyramid (uint8 (in), "reduce"), uint8 (reduced)) + assert (impyramid (uint8 (in), "expand"), uint8 (expanded)) +!!!!! known failure +ASSERT errors for: assert (impyramid (uint8 (in), "reduce"),uint8 (reduced)) - ## same but different classes - assert (col2im (int16 (B), [2 3], [10 7]), int16 (A)); - assert (col2im (single (B), [2 3], [10 7]), single (A)); - assert (col2im (logical (B), [2 3], [10 7]), logical (A)); -***** test - a = rand (10)(:); - assert (col2im (a, [1 1], [10 10]), col2im (a, [1 1], [10 10], "sliding")) -***** shared A, B - v = [1:10]'; - r = reshape (1:10, [2 5]); - B = [v v+10 v+20 v+30 v+40 v+50]; - A = [r r+30 - r+10 r+40 - r+20 r+50]; - assert (col2im (B, [2 5], [6 10], "distinct"), A); -***** assert (col2im (int16 (B), [2 5], [6 10], "distinct"), int16 (A)); -***** assert (col2im (logical (B), [2 5], [6 10], "distinct"), logical (A)); -***** assert (col2im (single (B), [2 5], [6 10], "distinct"), single (A)); + Location | Observed | Expected | Reason + (2,4) 110 111 Abs err 0 exceeds tol 0 by 0 + (2,5) 99 100 Abs err 0 exceeds tol 0 by 0 + (3,5) 121 122 Abs err 0 exceeds tol 0 by 0 ***** test - a = rand (10, 8); - b = im2col (a, [5 5], "distinct"); - assert (col2im (b, [5 5], [10 8], "distinct"), a); + in = randi ([0 255], [40 39 3 5], "uint8"); + red = impyramid (in, "reduce"); + for p = 1:3 + for n = 1:5 + assert (red(:,:,p,n), impyramid (in(:,:,p,n), "reduce")) + endfor + endfor - a = rand (8); - b = im2col (a, [5 5], "distinct"); - assert (col2im (b, [5 5], [8 8], "distinct"), a); -***** shared a, b - ## Same number of multiple dimensions - a = rand (10, 10, 10); - b = im2col (a, [5 5 5], "distinct"); -***** assert (col2im (b, [5 5 5], [10 10 10], "distinct"), a); + exp = impyramid (in, "expand"); + for p = 1:3 + for n = 1:5 + assert (exp(:,:,p,n), impyramid (in(:,:,p,n), "expand")) + endfor + endfor +***** xtest + ## bug #51979 (results are not matlab compatible) + in = repmat (uint8 (255), [10 10]); + assert (impyramid (in, "reduce"), repmat (uint8 (255), [5 5])) + assert (impyramid (in, "expand"), repmat (uint8 (255), [19 19])) +!!!!! known failure +ASSERT errors for: assert (impyramid (in, "expand"),repmat (uint8 (255), [19, 19])) - ## Different number of dimensions - a = rand (10, 10, 10); - b = im2col (a, [5 5], "distinct"); -***** assert (col2im (b, [5 5], [10 10 10], "distinct"), a); + Location | Observed | Expected | Reason + (1,1) 195 255 Abs err 0 exceeds tol 0 by 0 + (2,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (3,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (4,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (5,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (6,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (7,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (8,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (9,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (10,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (11,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (12,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (13,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (14,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (15,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (16,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (17,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (18,1) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,1) 195 255 Abs err 0 exceeds tol 0 by 0 + (1,2) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,2) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,3) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,3) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,4) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,4) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,5) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,5) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,6) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,6) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,7) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,7) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,8) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,8) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,9) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,9) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,10) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,10) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,11) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,11) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,12) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,12) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,13) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,13) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,14) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,14) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,15) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,15) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,16) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,16) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,17) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,17) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,18) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,18) 223 255 Abs err 0 exceeds tol 0 by 0 + (1,19) 195 255 Abs err 0 exceeds tol 0 by 0 + (2,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (3,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (4,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (5,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (6,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (7,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (8,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (9,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (10,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (11,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (12,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (13,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (14,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (15,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (16,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (17,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (18,19) 223 255 Abs err 0 exceeds tol 0 by 0 + (19,19) 195 255 Abs err 0 exceeds tol 0 by 0 +***** xtest + ## bug #51979 (results are not matlab compatible) + in = logical ([ + 1 0 1 1 0 0 1 1 0 0 + 1 1 0 0 0 1 0 0 1 0 + 0 1 1 0 1 1 1 1 1 1 + 1 0 1 0 1 0 1 0 1 1 + 1 1 1 0 0 0 1 1 1 1 + 0 0 1 1 0 0 1 0 0 0 + 0 0 1 1 0 1 1 0 1 1 + 1 1 0 0 1 0 0 0 1 0 + 1 1 1 1 1 1 0 1 0 0 + 1 1 0 0 1 0 0 0 1 0]); - ## Removing padding from multiple dimensions - a = rand (10, 10, 7); - b = im2col (a, [5 5 3], "distinct"); -***** assert (col2im (b, [5 5 3], [10 10 7], "distinct"), a); + reduced = logical ([ + 1 1 0 1 0 + 1 1 0 1 1 + 1 1 0 1 1 + 0 1 0 0 0 + 1 1 1 0 0]); - a = rand (10, 10, 7); - b = im2col (a, [5 5 5 2], "distinct"); -***** assert (col2im (b, [5 5 5 2], [10 10 7], "distinct"), a); -15 tests, 15 passed, 0 known failure, 0 skipped -[inst/bwunpack.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwunpack.m -***** error id=Octave:invalid-fun-call bwunpack () -***** error bwunpack (uint8 (1)) -***** error bwunpack (uint32 (1), -1) -***** error bwunpack (uint32 (1), 4.2) -***** xtest - ## bug #55521 - assert (bwunpack (uint32 (2.^[0:31])), logical (eye (32))) -***** xtest - ## bug #55521 - assert (bwunpack (uint32 (repmat (7, [1 3 3 3])), 3), true (3, 3, 3, 3)) -***** assert (bwunpack (uint32 (zeros (0, 0))), false (0, 0)) -***** assert (bwunpack (uint32 (zeros (0, 0)), 0), false (0, 0)) -***** assert (bwunpack (uint32 (zeros (0, 5)), 0), false (0, 5)) -***** assert (bwunpack (uint32 (zeros (0, 5, 7)), 0), false (0, 5, 7)) -***** assert (bwunpack (uint32 (zeros (1, 0))), false (32, 0)) -***** assert (bwunpack (uint32 (zeros (2, 0, 7))), false (64, 0, 7)) -***** assert (bwunpack (uint32 (zeros (2, 0, 7))), false (64, 0, 7)) -***** assert (bwunpack (uint32 (zeros (2, 0, 7)), 60), false (60, 0, 7)) -***** error - bwunpack (uint32 (1), 1042) -15 tests, 15 passed, 0 known failure, 0 skipped -[inst/grayslice.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/grayslice.m -***** test - expected = uint8 ([0 4 5 5 9]); - im = [0 0.45 0.5 0.55 1]; - assert (grayslice (im), expected) - assert (grayslice (im, 10), expected) - assert (grayslice (im, uint8 (10)), expected) - assert (grayslice (im, [.1 .2 .3 .4 .5 .6 .7 .8 .9]), expected) -***** test - im = [0 0.45 0.5 0.55 1]; - assert (grayslice (im, 2), uint8 ([0 0 1 1 1])) - assert (grayslice (im, 3), uint8 ([0 1 1 1 2])) - assert (grayslice (im, 4), uint8 ([0 1 2 2 3])) - assert (grayslice (im, [0 0.5 1]), uint8 ([1 1 2 2 3])) - assert (grayslice (im, [0.5 1]), uint8 ([0 0 1 1 2])) - assert (grayslice (im, [0.6 1]), uint8 ([0 0 0 0 2])) -***** test - im = [0 .55 1]; - assert (grayslice (im, 9), uint8 ([0 4 8])) - assert (grayslice (im, 9.1), uint8 ([0 5 8])) - assert (grayslice (im, 10), uint8 ([0 5 9])) -***** assert (grayslice ([0 .5 1], [0 1 .5]), uint8 ([1 2 3])) -***** test - ## 0 > N > 1 values are treated as if they are V and N=2 - im = [0 .5 .55 .7 1]; - assert (grayslice (im, .5), uint8 ([0 1 1 1 1])) - assert (grayslice (im, .51), uint8 ([0 0 1 1 1])) - assert (grayslice (im, .7), uint8 ([0 0 0 1 1])) - assert (grayslice (im, 1), uint8 ([0 0 0 0 0])) - assert (grayslice (im, 1.2), uint8 ([0 0 0 0 0])) -***** assert (grayslice ([0 .5 .7 1], [0 .5 1 2]), uint8 ([1 2 2 4])) -***** assert (grayslice ([0 .45 .5 .65 .7 1], [.4 .5 .5 .7 .7 1]), - uint8 ([0 1 3 3 5 6])) -***** assert (grayslice ([-.5 .1 .8 1.2], [-1 -.4 .05 .6 .9 1.1 2]), - uint8 ([1 3 4 7])) -***** assert (grayslice ([0 .5 1], [-1 .5 1 2]), uint8 ([1 2 4])) -***** assert (grayslice ([-2 -1 .5 1], [-1 .5 1]), uint8 ([0 1 2 3])) -***** test - sliced = [ - repmat(0, [26 1]) - repmat(1, [25 1]) - repmat(2, [26 1]) - repmat(3, [25 1]) - repmat(4, [26 1]) - repmat(5, [25 1]) - repmat(6, [26 1]) - repmat(7, [25 1]) - repmat(8, [26 1]) - repmat(9, [26 1]) - ]; - sliced = uint8 (sliced(:).'); - assert (grayslice (uint8 (0:255)), sliced) -***** assert (grayslice (uint8 (0:255), 255), uint8 ([0:254 254])) -***** assert (class (grayslice (uint8 (0:255), 256)), "double") -***** xtest - assert (grayslice (uint8 (0:255), 256), [1:256]) + expanded = logical ([ + 1 1 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 + 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 + 1 1 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 1 1 + 0 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 + 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 + 1 1 0 1 1 0 0 0 1 0 0 1 1 1 0 1 1 1 1 + 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 + 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 + 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 + 0 0 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 + 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 + 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 + 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 + 1 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 + 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 + 1 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 + 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0]); - ## While the above fails, this passes and should continue to do so - ## since it's the actual formula in the documentation. - assert (grayslice (uint8 (0:255), 256), - grayslice (uint8 (0:255), (1:255)./256)) + assert (impyramid (in, "reduce"), reduced) + assert (impyramid (in, "expand"), expanded) !!!!! known failure -ASSERT errors for: assert (grayslice (uint8 (0:255), 256),[1:256]) +ASSERT errors for: assert (impyramid (in, "reduce"),reduced) Location | Observed | Expected | Reason - (129) 130 129 Abs err 1 exceeds tol 0 by 1 - (130) 131 130 Abs err 1 exceeds tol 0 by 1 - (131) 132 131 Abs err 1 exceeds tol 0 by 1 - (132) 133 132 Abs err 1 exceeds tol 0 by 1 - (133) 134 133 Abs err 1 exceeds tol 0 by 1 - (134) 135 134 Abs err 1 exceeds tol 0 by 1 - (135) 136 135 Abs err 1 exceeds tol 0 by 1 - (136) 137 136 Abs err 1 exceeds tol 0 by 1 - (137) 138 137 Abs err 1 exceeds tol 0 by 1 - (138) 139 138 Abs err 1 exceeds tol 0 by 1 - (139) 140 139 Abs err 1 exceeds tol 0 by 1 - (140) 141 140 Abs err 1 exceeds tol 0 by 1 - (141) 142 141 Abs err 1 exceeds tol 0 by 1 - (142) 143 142 Abs err 1 exceeds tol 0 by 1 - (143) 144 143 Abs err 1 exceeds tol 0 by 1 - (144) 145 144 Abs err 1 exceeds tol 0 by 1 - (145) 146 145 Abs err 1 exceeds tol 0 by 1 - (146) 147 146 Abs err 1 exceeds tol 0 by 1 - (147) 148 147 Abs err 1 exceeds tol 0 by 1 - (148) 149 148 Abs err 1 exceeds tol 0 by 1 - (149) 150 149 Abs err 1 exceeds tol 0 by 1 - (150) 151 150 Abs err 1 exceeds tol 0 by 1 - (151) 152 151 Abs err 1 exceeds tol 0 by 1 - (152) 153 152 Abs err 1 exceeds tol 0 by 1 - (153) 154 153 Abs err 1 exceeds tol 0 by 1 - (154) 155 154 Abs err 1 exceeds tol 0 by 1 - (155) 156 155 Abs err 1 exceeds tol 0 by 1 - (156) 157 156 Abs err 1 exceeds tol 0 by 1 - (157) 158 157 Abs err 1 exceeds tol 0 by 1 - (158) 159 158 Abs err 1 exceeds tol 0 by 1 - (159) 160 159 Abs err 1 exceeds tol 0 by 1 - (160) 161 160 Abs err 1 exceeds tol 0 by 1 - (161) 162 161 Abs err 1 exceeds tol 0 by 1 - (162) 163 162 Abs err 1 exceeds tol 0 by 1 - (163) 164 163 Abs err 1 exceeds tol 0 by 1 - (164) 165 164 Abs err 1 exceeds tol 0 by 1 - (165) 166 165 Abs err 1 exceeds tol 0 by 1 - (166) 167 166 Abs err 1 exceeds tol 0 by 1 - (167) 168 167 Abs err 1 exceeds tol 0 by 1 - (168) 169 168 Abs err 1 exceeds tol 0 by 1 - (169) 170 169 Abs err 1 exceeds tol 0 by 1 - (170) 171 170 Abs err 1 exceeds tol 0 by 1 - (171) 172 171 Abs err 1 exceeds tol 0 by 1 - (172) 173 172 Abs err 1 exceeds tol 0 by 1 - (173) 174 173 Abs err 1 exceeds tol 0 by 1 - (174) 175 174 Abs err 1 exceeds tol 0 by 1 - (175) 176 175 Abs err 1 exceeds tol 0 by 1 - (176) 177 176 Abs err 1 exceeds tol 0 by 1 - (177) 178 177 Abs err 1 exceeds tol 0 by 1 - (178) 179 178 Abs err 1 exceeds tol 0 by 1 - (179) 180 179 Abs err 1 exceeds tol 0 by 1 - (180) 181 180 Abs err 1 exceeds tol 0 by 1 - (181) 182 181 Abs err 1 exceeds tol 0 by 1 - (182) 183 182 Abs err 1 exceeds tol 0 by 1 - (183) 184 183 Abs err 1 exceeds tol 0 by 1 - (184) 185 184 Abs err 1 exceeds tol 0 by 1 - (185) 186 185 Abs err 1 exceeds tol 0 by 1 - (186) 187 186 Abs err 1 exceeds tol 0 by 1 - (187) 188 187 Abs err 1 exceeds tol 0 by 1 - (188) 189 188 Abs err 1 exceeds tol 0 by 1 - (189) 190 189 Abs err 1 exceeds tol 0 by 1 - (190) 191 190 Abs err 1 exceeds tol 0 by 1 - (191) 192 191 Abs err 1 exceeds tol 0 by 1 - (192) 193 192 Abs err 1 exceeds tol 0 by 1 - (193) 194 193 Abs err 1 exceeds tol 0 by 1 - (194) 195 194 Abs err 1 exceeds tol 0 by 1 - (195) 196 195 Abs err 1 exceeds tol 0 by 1 - (196) 197 196 Abs err 1 exceeds tol 0 by 1 - (197) 198 197 Abs err 1 exceeds tol 0 by 1 - (198) 199 198 Abs err 1 exceeds tol 0 by 1 - (199) 200 199 Abs err 1 exceeds tol 0 by 1 - (200) 201 200 Abs err 1 exceeds tol 0 by 1 - (201) 202 201 Abs err 1 exceeds tol 0 by 1 - (202) 203 202 Abs err 1 exceeds tol 0 by 1 - (203) 204 203 Abs err 1 exceeds tol 0 by 1 - (204) 205 204 Abs err 1 exceeds tol 0 by 1 - (205) 206 205 Abs err 1 exceeds tol 0 by 1 - (206) 207 206 Abs err 1 exceeds tol 0 by 1 - (207) 208 207 Abs err 1 exceeds tol 0 by 1 - (208) 209 208 Abs err 1 exceeds tol 0 by 1 - (209) 210 209 Abs err 1 exceeds tol 0 by 1 - (210) 211 210 Abs err 1 exceeds tol 0 by 1 - (211) 212 211 Abs err 1 exceeds tol 0 by 1 - (212) 213 212 Abs err 1 exceeds tol 0 by 1 - (213) 214 213 Abs err 1 exceeds tol 0 by 1 - (214) 215 214 Abs err 1 exceeds tol 0 by 1 - (215) 216 215 Abs err 1 exceeds tol 0 by 1 - (216) 217 216 Abs err 1 exceeds tol 0 by 1 - (217) 218 217 Abs err 1 exceeds tol 0 by 1 - (218) 219 218 Abs err 1 exceeds tol 0 by 1 - (219) 220 219 Abs err 1 exceeds tol 0 by 1 - (220) 221 220 Abs err 1 exceeds tol 0 by 1 - (221) 222 221 Abs err 1 exceeds tol 0 by 1 - (222) 223 222 Abs err 1 exceeds tol 0 by 1 - (223) 224 223 Abs err 1 exceeds tol 0 by 1 - (224) 225 224 Abs err 1 exceeds tol 0 by 1 - (225) 226 225 Abs err 1 exceeds tol 0 by 1 - (226) 227 226 Abs err 1 exceeds tol 0 by 1 - (227) 228 227 Abs err 1 exceeds tol 0 by 1 - (228) 229 228 Abs err 1 exceeds tol 0 by 1 - (229) 230 229 Abs err 1 exceeds tol 0 by 1 - (230) 231 230 Abs err 1 exceeds tol 0 by 1 - (231) 232 231 Abs err 1 exceeds tol 0 by 1 - (232) 233 232 Abs err 1 exceeds tol 0 by 1 - (233) 234 233 Abs err 1 exceeds tol 0 by 1 - (234) 235 234 Abs err 1 exceeds tol 0 by 1 - (235) 236 235 Abs err 1 exceeds tol 0 by 1 - (236) 237 236 Abs err 1 exceeds tol 0 by 1 - (237) 238 237 Abs err 1 exceeds tol 0 by 1 - (238) 239 238 Abs err 1 exceeds tol 0 by 1 - (239) 240 239 Abs err 1 exceeds tol 0 by 1 - (240) 241 240 Abs err 1 exceeds tol 0 by 1 - (241) 242 241 Abs err 1 exceeds tol 0 by 1 - (242) 243 242 Abs err 1 exceeds tol 0 by 1 - (243) 244 243 Abs err 1 exceeds tol 0 by 1 - (244) 245 244 Abs err 1 exceeds tol 0 by 1 - (245) 246 245 Abs err 1 exceeds tol 0 by 1 - (246) 247 246 Abs err 1 exceeds tol 0 by 1 - (247) 248 247 Abs err 1 exceeds tol 0 by 1 - (248) 249 248 Abs err 1 exceeds tol 0 by 1 - (249) 250 249 Abs err 1 exceeds tol 0 by 1 - (250) 251 250 Abs err 1 exceeds tol 0 by 1 - (251) 252 251 Abs err 1 exceeds tol 0 by 1 - (252) 253 252 Abs err 1 exceeds tol 0 by 1 - (253) 254 253 Abs err 1 exceeds tol 0 by 1 - (254) 255 254 Abs err 1 exceeds tol 0 by 1 - (255) 256 255 Abs err 1 exceeds tol 0 by 1 + (4,1) 1 0 Abs err 1 exceeds tol 0 by 1 + (1,3) 1 0 Abs err 1 exceeds tol 0 by 1 + (2,3) 1 0 Abs err 1 exceeds tol 0 by 1 + (3,3) 1 0 Abs err 1 exceeds tol 0 by 1 + (4,3) 1 0 Abs err 1 exceeds tol 0 by 1 + (4,4) 1 0 Abs err 1 exceeds tol 0 by 1 + (5,4) 1 0 Abs err 1 exceeds tol 0 by 1 + (1,5) 1 0 Abs err 1 exceeds tol 0 by 1 + (4,5) 1 0 Abs err 1 exceeds tol 0 by 1 + (5,5) 1 0 Abs err 1 exceeds tol 0 by 1 +4 tests, 1 passed, 3 known failures, 0 skipped +[inst/imcast.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imcast.m ***** test - ## Use of threshold in the [0 1] range for images of integer type does - ## not really work despite the Matlab documentation. It's Matlab - ## documentation that is wrong, see bug #55059 - - assert (grayslice (uint8([0 100 200 255]), [.1 .4 .5]), - uint8 ([0 3 3 3])) - assert (grayslice (uint8([0 100 200 255]), [100 199 200 210]), - uint8 ([0 1 3 4])) - - ## P (penny) is a 2d image of class double in [1 255] range - q = warning ("query", "Octave:data-file-in-path"); - warning ("off", "Octave:data-file-in-path"); - load ("penny.mat"); - warning (q.state, "Octave:data-file-in-path"); - assert (grayslice (P), repmat (uint8 (9), size (P))) -***** function gs = test_grayslice_v (I, v) - ## This is effectively what grayslice does but slower with a for - ## loop internally. - gs = zeros (size (I)); - for idx = 1:numel (v) - gs(I >= v(idx)) = idx; - endfor - if (numel (v) >= 256) - gs = gs +1; - else - gs = uint8 (gs); - endif -***** endfunction + im = randi ([0 255], 40, "uint8"); + assert (imcast (im, "uint8"), im2uint8 (im)) + assert (imcast (im, "uint16"), im2uint16 (im)) + assert (imcast (im, "single"), im2single (im)) + assert (imcast (im, "uint8", "indexed"), im2uint8 (im, "indexed")) + assert (imcast (im, "uint16", "indexed"), im2uint16 (im, "indexed")) + assert (imcast (im, "single", "indexed"), im2single (im, "indexed")) ***** test - q = warning ("query", "Octave:data-file-in-path"); - warning ("off", "Octave:data-file-in-path"); - load ("penny.mat"); - warning (q.state, "Octave:data-file-in-path"); - - ## The loaded P in penny.mat is of size 128x128, class double, and - ## with values in the [1 255] range - penny_uint8 = uint8 (P); - penny_double = im2double (penny_uint8); # rescales to [0 1] range] - - ## default of N = 10 - expected = test_grayslice_v (penny_uint8, - [26 51 77 102 128 153 179 204 230]); - assert (grayslice (penny_uint8, 10), expected) - assert (grayslice (penny_uint8), expected) - - expected = test_grayslice_v (penny_double, - [.1 .2 .3 .4 .5 .6 .7 .8 .9]); - assert (grayslice (penny_double, 10), expected) - assert (grayslice (penny_double), expected) + im = randi ([1 256], 40, "double"); + assert (imcast (im, "uint8"), im2uint8 (im)) + assert (imcast (im, "uint8", "indexed"), im2uint8 (im, "indexed")) + assert (imcast (im, "single", "indexed"), im2single (im, "indexed")) ***** test - ## For images with more than 2d - q = warning ("query", "Octave:data-file-in-path"); - warning ("off", "Octave:data-file-in-path"); - load ("penny.mat"); - warning (q.state, "Octave:data-file-in-path"); - penny_double = im2double (uint8 (P)); - P_3d = repmat (penny_double, [1 1 3]); - P_5d = repmat (penny_double, [1 1 3 2 3]); - - v = [.3 .5 .7]; - expected_2d = test_grayslice_v (penny_double, v); - assert (grayslice (P_3d, v), repmat (expected_2d, [1 1 3])) - assert (grayslice (P_5d, v), repmat (expected_2d, [1 1 3 2 3])) + im = randi ([0 65535], 40, "uint16"); + assert (imcast (im, "uint8"), im2uint8 (im)) + assert (imcast (im, "single"), im2single (im)) + assert (imcast (im, "single", "indexed"), im2single (im, "indexed")) ***** test - q = warning ("query", "Octave:data-file-in-path"); - warning ("off", "Octave:data-file-in-path"); - load ("penny.mat"); - warning (q.state, "Octave:data-file-in-path"); - penny_double = uint8 (P); - - ## Test that change from uint8 to double happens at 256 exactly - assert (class (grayslice (penny_double, 255)), "uint8") - assert (class (grayslice (penny_double, 256)), "double") - - ## If returns in class double, it's +1. - v = [10 150 200]; - v_long = [v 256:600]; - assert (double (grayslice (penny_double, v)) +1, - grayslice (penny_double, v_long)) + im = randi ([1 255], 40, "double"); + assert (imcast (im, "uint8", "indexed"), im2uint8 (im, "indexed")) + assert (imcast (im, "single", "indexed"), im2single (im, "indexed")) ***** test - ## If there's a vector for floating point and goes outside the - ## range, it uses the last index of the vector. - q = warning ("query", "Octave:data-file-in-path"); - warning ("off", "Octave:data-file-in-path"); - load ("penny.mat"); - warning (q.state, "Octave:data-file-in-path"); - penny_double = im2double (uint8 (P)); - v = [.3 .5 .7 2:10]; - idx_1 = find (penny_double == 1); - assert (grayslice (penny_double, v)(idx_1), uint8 ([12; 12])) -***** error x = grayslice ([1 2; 3 4], 0) -***** error x = grayslice ([1 2; 3 4], -1) -***** error x = grayslice ([1 2; 3 4], "foo") + im = rand (40); + assert (imcast (im, "uint8"), im2uint8 (im)) +***** error imcast (randi (127, 40, "int8"), "uint8") +***** error imcast (randi (255, 40, "uint8"), "uint32") +***** error imcast (randi (255, 40, "uint8"), "not a class") +***** error imcast (randi ([0 65535], 40, "uint16"), "uint8", "indexed") +***** assert (imcast ([0 1 .2; 2 -0 Inf], "logical"), logical ([0 1 1; 1 0 1])) +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/imnoise.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imnoise.m +***** assert(var(imnoise(ones(10)/2,'gaussian')(:)),0.01,0.005) # probabilistic +***** assert(length(find(imnoise(ones(10)/2,'salt & pepper')~=0.5)),5,10) # probabilistic +***** assert(var(imnoise(ones(10)/2,'speckle')(:)),0.01,0.005) # probabilistic ***** test - ## test output values for all input classes - - klasse = "uint8"; - im = cast ([intmin(klasse): intmax(klasse)], klasse); - erg05 = grayslice (im, 0.5); - first1_erg05 = im(find (erg05)(1)); - assert (first1_erg05, cast (1, klasse)); - erg5 = grayslice (im, 5); - first1_erg5 = im(find (erg5)(1)); - assert (first1_erg5, cast (51, klasse)); - ergint5 = grayslice (im, uint8 (5)); - first1_ergint5 = im(find (ergint5)(1)); - assert (first1_ergint5, cast (51, klasse)); - - klasse = "uint16"; - im = cast ([intmin(klasse): intmax(klasse)], klasse); - erg05 = grayslice (im, 0.5); - first1_erg05 = im(find (erg05)(1)); - assert (first1_erg05, cast (1, klasse)); - erg5 = grayslice (im, 5); - first1_erg5 = im(find (erg5)(1)); - assert (first1_erg5, cast (13107, klasse)); - ergint5 = grayslice (im, uint8 (5)); - first1_ergint5 = im(find (ergint5)(1)); - assert (first1_ergint5, cast (13107, klasse)); - - klasse = "int16"; - im = cast ([intmin(klasse): intmax(klasse)], klasse); - erg05 = grayslice (im, 0.5); - first1_erg05 = im(find (erg05)(1)); - assert (first1_erg05, cast (-32767, klasse)); - erg5 = grayslice (im, 5); - first1_erg5 = im(find (erg5)(1)); - assert (first1_erg5, cast (-19661, klasse)); - ergint5 = grayslice (im, uint8 (5)); - first1_ergint5 = im(find (ergint5)(1)); - assert (first1_ergint5, cast (-19661, klasse)); - - klasse = "single"; - im = cast ([0:0.001:1], klasse); - erg05 = grayslice (im, 0.5); - first1_erg05 = im(find (erg05)(1)); - assert (first1_erg05, cast (0.5, klasse)); - erg5 = grayslice (im, 5); - first1_erg5 = im(find (erg5)(1)); - assert (first1_erg5, cast (0.2, klasse)); - ergint5 = grayslice (im, uint8 (5)); - first1_ergint5 = im(find (ergint5)(1)); - assert (first1_ergint5, cast (0.2, klasse)); - - klasse = "double"; - im = cast ([0:0.001:1], klasse); - erg05 = grayslice (im, 0.5); - first1_erg05 = im(find (erg05)(1)); - assert (first1_erg05, cast (0.5, klasse)); - erg5 = grayslice (im, 5); - first1_erg5 = im(find (erg5)(1)); - assert (first1_erg5, cast (0.2, klasse)); - ergint5 = grayslice (im, uint8 (5)); - first1_ergint5 = im(find (ergint5)(1)); - assert (first1_ergint5, cast (0.2, klasse)); -23 tests, 22 passed, 1 known failure, 0 skipped -[inst/entropyfilt.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/entropyfilt.m + A = imnoise (.5 * ones (100), 'poisson'); + assert (class (A), 'double') ***** test - a = log2 (9) * ones (5, 5); - b = -(2*log2 (2/9) + log2 (1/9))/3; - a(1,2:4) = b; - a(5,2:4) = b; - a(2:4,1) = b; - a(2:4,5) = b; - c = -(4*log2 (4/9) + 4*log2 (2/9) + log2 (1/9))/9; - a(1,1) = c; - a(5,1) = c; - a(1,5) = c; - a(5,5) = c; - assert (entropyfilt (uint8 (magic (5)), ones (3, 3)), a, 2*eps); + A = imnoise (.5 * ones (100, 'single'), 'poisson'); + assert (class (A), 'single') ***** test - assert (entropyfilt (uint8 (ones (10, 10))), zeros (10, 10)); + A = imnoise (128 * ones (100, 'uint8'), 'poisson'); + assert (class (A), 'uint8') +***** test + A = imnoise (256 * ones (100, 'uint16'), 'poisson'); + assert (class (A), 'uint16') +***** demo + A = imnoise (2^7 * ones (100, 'uint8'), 'poisson'); + subplot (2, 2, 1) + imshow (A) + title ('uint8 image with poisson noise') + A = imnoise (2^15 * ones (100, 'uint16'), 'poisson'); + subplot (2, 2, 2) + imshow (A) + title ('uint16 image with poisson noise') + A = imnoise (.5 * ones (100), 'poisson'); + subplot (2, 2, 3) + imshow (A) + title ('double image with poisson noise') + A = imnoise (.5 * ones (100, 'single'), 'poisson'); + subplot (2, 2, 4) + imshow (A) + title ('single image with poisson noise') +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/@imref3d/imref3d.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref3d/imref3d.m +***** error id=Octave:invalid-fun-call imref3d (1, 2, 3, 4, 5) +***** error id=Octave:incorrect-size imref3d (42) +***** error id=Octave:incorrect-size imref3d ([42]) +***** error id=Octave:incorrect-size imref3d ([4, 2]) +***** error id=Octave:incorrect-size imref3d ([4, 2, 3, 3]) +***** error id=Octave:expected-integer imref3d ([4.2, 42]) +***** error id=Octave:expected-positive imref3d ([0, 0]) +***** error id=Octave:expected-positive imref3d ([-4, 2]) +***** error id=Octave:expected-positive imref3d ([4, 2, 3], 0, 1, 2) +***** error id=Octave:expected-positive imref3d ([4, 2, 3], 1, 0, 2) +***** error id=Octave:expected-positive imref3d ([4, 2, 3], 1, 2, 0) +***** error id=Octave:expected-real imref3d ([4, 2, 3], j, 1, 2) +***** error id=Octave:expected-real imref3d ([4, 2, 3], 1, j, 2) +***** error id=Octave:expected-real imref3d ([4, 2, 3], 1, 2, j) +***** error id=Octave:expected-real imref3d ([4, 2, 3], [j, 2], [3, 4], [5, 6]) +***** error id=Octave:expected-real imref3d ([4, 2, 3], [1, 2], [j, 4], [5, 6]) +***** error id=Octave:expected-real imref3d ([4, 2, 3], [1, 2], [3, 4], [5, j]) +***** error id=Octave:expected-vector imref3d ([4, 2, 3], [], [], []) +***** error id=Octave:expected-vector imref3d ([4, 2, 3], [], [1], [2]) +***** error id=Octave:expected-scalar imref3d ([4, 2, 3], [1], [], []) +***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1, 2], [3, 4], [0]) +***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1, 2], [3, 4, 5], [6, 7]) +***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1, 2], [3, 4], [5, 6, 7]) +***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1; 2], [3, 4], [5, 6]) +***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1, 2], [3; 4], [5, 6]) +***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1, 2], [3, 4], [5; 6]) +***** error id=Octave:invalid-indexing imref3d().InvalidProperty +***** error id=Octave:expected-increasing imref3d ([100, 200, 3], [1.5 0.5], [2.5, 3.5], [0.5, 1.5]) +***** error id=Octave:expected-increasing imref3d ([100, 200, 3], [1.5 2.5], [2.5, 1.5], [0.5, 1.5]) +***** error id=Octave:expected-increasing imref3d ([100, 200, 3], [1.5 2.5], [2.5, 3.5], [1.5, 0.5]) +***** assert (imref3d ([4, 2, 3]).ImageSize, [4, 2, 3]) +***** test + r = imref3d; + assert (r.XWorldLimits, [0.5, 2.5]) + assert (r.YWorldLimits, [0.5, 2.5]) + assert (r.ZWorldLimits, [0.5, 2.5]) + assert (r.ImageSize, [2, 2, 2]) + assert (r.PixelExtentInWorldX, 1) + assert (r.PixelExtentInWorldY, 1) + assert (r.PixelExtentInWorldZ, 1) + assert (r.ImageExtentInWorldX, 2) + assert (r.ImageExtentInWorldY, 2) + assert (r.ImageExtentInWorldZ, 2) + assert (r.XIntrinsicLimits, [0.5, 2.5]) + assert (r.YIntrinsicLimits, [0.5, 2.5]) + assert (r.ZIntrinsicLimits, [0.5, 2.5]) +***** test + r = imref3d ([128, 128, 27]); + assert (r.XWorldLimits, [0.5, 128.5]) + assert (r.YWorldLimits, [0.5, 128.5]) + assert (r.ZWorldLimits, [0.5, 27.5]) + assert (r.ImageSize, [128, 128, 27]) + assert (r.PixelExtentInWorldX, 1) + assert (r.PixelExtentInWorldY, 1) + assert (r.PixelExtentInWorldZ, 1) + assert (r.ImageExtentInWorldX, 128) + assert (r.ImageExtentInWorldY, 128) + assert (r.ImageExtentInWorldZ, 27) + assert (r.XIntrinsicLimits, [0.5, 128.5]) + assert (r.YIntrinsicLimits, [0.5, 128.5]) + assert (r.ZIntrinsicLimits, [0.5, 27.5]) +***** test + r = imref3d ([128, 128, 27], 2, 2, 4); + assert (r.XWorldLimits, [1, 257]) + assert (r.YWorldLimits, [1, 257]) + assert (r.ZWorldLimits, [2, 110]) + assert (r.ImageSize, [128, 128, 27]) + assert (r.PixelExtentInWorldX, 2) + assert (r.PixelExtentInWorldY, 2) + assert (r.PixelExtentInWorldZ, 4) + assert (r.ImageExtentInWorldX, 256) + assert (r.ImageExtentInWorldY, 256) + assert (r.ImageExtentInWorldZ, 108) + assert (r.XIntrinsicLimits, [0.5, 128.5]) + assert (r.YIntrinsicLimits, [0.5, 128.5]) + assert (r.ZIntrinsicLimits, [0.5, 27.5]) +***** test + r = imref3d; + assert (r.XWorldLimits, [0.5, 2.5]) + assert (r.YWorldLimits, [0.5, 2.5]) + assert (r.ZWorldLimits, [0.5, 2.5]) + assert (r.ImageSize, [2, 2, 2]) + assert (r.PixelExtentInWorldX, 1) + assert (r.PixelExtentInWorldY, 1) + assert (r.PixelExtentInWorldZ, 1) + assert (r.ImageExtentInWorldX, 2) + assert (r.ImageExtentInWorldY, 2) + assert (r.ImageExtentInWorldZ, 2) + assert (r.XIntrinsicLimits, [0.5, 2.5]) + assert (r.YIntrinsicLimits, [0.5, 2.5]) + assert (r.ZIntrinsicLimits, [0.5, 2.5]) + r.ImageSize = [128, 128, 27]; + assert (r.XWorldLimits, [0.5, 2.5]) + assert (r.YWorldLimits, [0.5, 2.5]) + assert (r.ZWorldLimits, [0.5, 2.5]) + assert (r.ImageSize, [128, 128, 27]) + assert (r.PixelExtentInWorldX, 0.015625, 1e-6) + assert (r.PixelExtentInWorldY, 0.015625, 1e-6) + assert (r.PixelExtentInWorldZ, 0.074074, 1e-6) + assert (r.ImageExtentInWorldX, 2) + assert (r.ImageExtentInWorldY, 2) + assert (r.ImageExtentInWorldZ, 2) + assert (r.XIntrinsicLimits, [0.5, 128.5]) + assert (r.YIntrinsicLimits, [0.5, 128.5]) + assert (r.ZIntrinsicLimits, [0.5, 27.5]) +***** test + r = imref3d; + assert (r.XWorldLimits, [0.5, 2.5]) + assert (r.YWorldLimits, [0.5, 2.5]) + assert (r.ZWorldLimits, [0.5, 2.5]) + assert (r.ImageSize, [2, 2, 2]) + assert (r.PixelExtentInWorldX, 1) + assert (r.PixelExtentInWorldY, 1) + assert (r.PixelExtentInWorldZ, 1) + assert (r.ImageExtentInWorldX, 2) + assert (r.ImageExtentInWorldY, 2) + assert (r.ImageExtentInWorldZ, 2) + assert (r.XIntrinsicLimits, [0.5, 2.5]) + assert (r.YIntrinsicLimits, [0.5, 2.5]) + assert (r.ZIntrinsicLimits, [0.5, 2.5]) + r.XWorldLimits = [-60, 13.33]; + r.YWorldLimits = [-900.8, -560.26]; + r.ZWorldLimits = [-302.48, 1500.333]; + assert (r.XWorldLimits, [-60, 13.33]) + assert (r.YWorldLimits, [-900.8, -560.26]) + assert (r.ZWorldLimits, [-302.48, 1500.333]) + assert (r.ImageSize, [2, 2, 2]) + assert (r.PixelExtentInWorldX, 36.6650) + assert (r.PixelExtentInWorldY, 170.27, 1e-5) + assert (r.PixelExtentInWorldZ, 901.4065) + assert (r.ImageExtentInWorldX, 73.33, 1e-5) + assert (r.ImageExtentInWorldY, 340.54, 1e-5) + assert (r.ImageExtentInWorldZ, 1802.813, 1e-5) + assert (r.XIntrinsicLimits, [0.5, 2.5]) + assert (r.YIntrinsicLimits, [0.5, 2.5]) + assert (r.ZIntrinsicLimits, [0.5, 2.5]) +***** test + r = imref3d; + fail ("r.XWorldLimits = []", "") + fail ("r.XWorldLimits = [1]", "") + fail ("r.XWorldLimits = [j]", "") + fail ("r.XWorldLimits = [1; 2]", "") + fail ("r.YWorldLimits = []", "") + fail ("r.YWorldLimits = [1]", "") + fail ("r.YWorldLimits = [j]", "") + fail ("r.YWorldLimits = [1; 2]", "") + fail ("r.ZWorldLimits = []", "") + fail ("r.ZWorldLimits = [1]", "") + fail ("r.ZWorldLimits = [j]", "") + fail ("r.ZWorldLimits = [1; 2]", "") +37 tests, 37 passed, 0 known failure, 0 skipped +[inst/@imref3d/worldToIntrinsic.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref3d/worldToIntrinsic.m +***** error id=Octave:invalid-fun-call worldToIntrinsic (imref3d) +***** error id=Octave:invalid-fun-call worldToIntrinsic (imref3d, 1, 2) +***** error id=Octave:invalid-fun-call worldToIntrinsic (imref3d, 1, 2, 3, 4) +***** error id=Octave:expected-real worldToIntrinsic (imref3d, 1j, 2, 3) +***** error id=Octave:expected-real worldToIntrinsic (imref3d, 1, 2j, 3) +***** error id=Octave:expected-real worldToIntrinsic (imref3d, 1, 2, 3j) +***** error id=Octave:invalid-input-arg worldToIntrinsic (imref3d, [1, 2], 3, 4) +***** error id=Octave:invalid-input-arg worldToIntrinsic (imref3d, 1, [2, 3], 4) +***** error id=Octave:invalid-input-arg worldToIntrinsic (imref3d, 1, 2, [3, 4]) +***** test + r = imref3d ([128, 128, 27], 2, 2, 4); + xW = [108, 108, 108.2, 2]; + yW = [92, 92, 92, -1]; + zW = [52, 55, 52, 0.33]; + [xI, yI, zI] = worldToIntrinsic (r, xW, yW, zW); + assert (xI, [54, 54, 54.1, 1], 1e-6) + assert (yI, [46, 46, 46, -0.5], 1e-6) + assert (zI, [13, 13.75, 13, 0.0825], 1e-6) +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/@imref3d/intrinsicToWorld.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref3d/intrinsicToWorld.m +***** error id=Octave:invalid-fun-call intrinsicToWorld (imref3d) +***** error id=Octave:invalid-fun-call intrinsicToWorld (imref3d, 1) +***** error id=Octave:invalid-fun-call intrinsicToWorld (imref3d, 1, 2) +***** error id=Octave:invalid-fun-call intrinsicToWorld (imref3d, 1, 2, 3, 4) +***** error id=Octave:expected-real intrinsicToWorld (imref3d, 1j, 2, 3) +***** error id=Octave:expected-real intrinsicToWorld (imref3d, 1, 2j, 3) +***** error id=Octave:expected-real intrinsicToWorld (imref3d, 1, j, 3j) +***** error id=Octave:invalid-input-arg intrinsicToWorld (imref3d, [1, 2], 3, 4) +***** error id=Octave:invalid-input-arg intrinsicToWorld (imref3d, 1, [2, 3], 4) +***** error id=Octave:invalid-input-arg intrinsicToWorld (imref3d, 1, 2, [3, 4]) +***** test + r = imref3d ([128, 128, 27], 2, 2, 4); + xI = [54, 71, 57, 70]; + yI = [46, 48, 79, 80]; + zI = [13, 13, 13, 13]; + [xW, yW, zW] = intrinsicToWorld (r, xI, yI, zI); + assert (xW, [108, 142, 114, 140]) + assert (yW, [92, 96, 158, 160]) + assert (zW, [52, 52, 52, 52]) +***** test + [xW, yW, zW] = intrinsicToWorld (imref3d, -5.3, -2.8, -15.88); + assert (xW, -5.3) + assert (yW, -2.8) + assert (zW, -15.88, 1e-6) +***** test + [xW, yW, zW] = intrinsicToWorld (imref3d, [1, 2; 3, 4], + [2, 3; 5, 9], + [-5, 8; 19, 42.8]); + assert (xW, [1, 2; 3, 4]) + assert (yW, [2, 3; 5, 9]) + assert (zW, [-5, 8; 19, 42.8]) +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/@imref3d/worldToSubscript.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref3d/worldToSubscript.m +***** error id=Octave:invalid-fun-call worldToSubscript (imref3d) +***** error id=Octave:invalid-fun-call worldToSubscript (imref3d, 1) +***** error id=Octave:invalid-fun-call worldToSubscript (imref3d, 1, 2) +***** error id=Octave:invalid-fun-call worldToSubscript (imref3d, 1, 2, 3, 4) +***** error id=Octave:expected-real worldToSubscript (imref3d, 1j, 2, 3) +***** error id=Octave:expected-real worldToSubscript (imref3d, 1, 2j, 3) +***** error id=Octave:expected-real worldToSubscript (imref3d, 1, 2, 3j) +***** error id=Octave:invalid-input-arg worldToSubscript (imref3d, [1, 2], 3, 4) +***** error id=Octave:invalid-input-arg worldToSubscript (imref3d, 1, [2, 3], 4) +***** error id=Octave:invalid-input-arg worldToSubscript (imref3d, 1, 2, [3, 4]) +***** test + r = imref3d ([128, 128, 27], 2, 2, 4); + xW = [108, 108, 113.2, 2]; + yW = [92, 92, 92, -1]; + zW = [52, 55, 52, 0.33]; + [rS, cS, pS] = worldToSubscript (r, xW, yW, zW); + assert (rS, [46, 46, 46, NaN]) + assert (cS, [54, 54, 57, NaN]) + assert (pS, [13, 14, 13, NaN]) +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/@imref3d/contains.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref3d/contains.m +***** error id=Octave:invalid-fun-call contains (imref3d) +***** error id=Octave:invalid-fun-call contains (imref3d, 1) +***** error id=Octave:invalid-fun-call contains (imref3d, 1, 2) +***** error id=Octave:invalid-fun-call contains (imref3d, 1, 2, 3, 4) +***** error id=Octave:invalid-input-arg contains (imref3d, [1, 2], 3, 4) +***** error id=Octave:invalid-input-arg contains (imref3d, 1, [2, 3], 4) +***** error id=Octave:invalid-input-arg contains (imref3d, 1, 2, [3, 4]) +***** error id=Octave:expected-real contains (imref3d, 1j, 2, 3) +***** error id=Octave:expected-real contains (imref3d, 1, 2j, 3) +***** error id=Octave:expected-real contains (imref3d, 1, 2, 3j) +***** test + r = imref3d ([128, 128, 27]); + assert (contains (r, [5, 6, 6, 8], [5, 10, 10, 257], [1, 27.5, 28, 1]), logical ([1, 1, 0, 0])) +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/bwhitmiss.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwhitmiss.m ***** test - A = zeros (3,3); - B = ones (3,3); - C = [1 1 1; 2 2 2; 3 3 3]; - D = C'; - E = ones (3,3); - E(2,2) = 2; - F = 3 .* ones (3,3); - F(2,2) = 1; - G = [-1 2 7; -5 2 8; -7 pi 9]; - H = [5 2 8; 1 -3 1; 5 1 0]; - Hf = mat2gray(H); - X = uint8(abs(H)); - P = [0.2 0.201 0.204; 0.202 0.203 0.205; 0.205 0.206 0.202]; - Q = uint16([100 101 103; 100 105 102; 100 102 103]); - R = uint8([1 2 3 4 5; 11 12 13 14 15; 21 22 4 5 6; 5 5 3 2 1; 15 14 14 14 14]); - Aout = zeros (3); - Bout = zeros (3); - Cout = zeros (3); - Dout = zeros (3); - Eout = zeros (3); - Fout = zeros (3); - Gout_1 = -sum([2 7]./9.*log2([2 7]./9)); - Gout_2 = -sum([3 6]./9.*log2([3 6]./9)); - Gout_3 = -sum([4 5]./9.*log2([4 5]./9)); - Gout = [Gout_1 Gout_2 Gout_3; Gout_1 Gout_2 Gout_3; Gout_1 Gout_2 Gout_3]; - Hout_5 = -sum([2 7]./9.*log2([2 7]./9)) ; - Hout = [0.8916 0.8256 0.7412; 0.8256 Hout_5 0.6913; 0.7412 0.6913 0.6355]; - Hfout_5 = -sum([3 2 1 1 1 1]./9.*log2([3 2 1 1 1 1]./9)); - Hfout = [2.3613 2.3296 2.2252; 2.4571 Hfout_5 2.3090; 2.4805 2.4488 2.3445]; - Xout_5 = -sum([1 1 1 1 2 3]./9.*log2([1 1 1 1 2 3]./9)); - Xout = [2.3613 2.3296 2.2252; 2.4571 Xout_5 2.3090; 2.4805 2.4488 2.3445]; - Pout_5 = -sum([1 2 6]./9.*log2([1 2 6]./9)); - Pout = [1.1137 1.1730 1.2251; 1.1595 Pout_5 1.2774; 1.1556 1.2183 1.2635]; - Qout = zeros(3); - Rout = [3.5143 3.5700 3.4871 3.4957 3.4825; - 3.4705 3.5330 3.4341 3.4246 3.3890; - 3.3694 3.4063 3.3279 3.3386 3.3030; - 3.3717 3.4209 3.3396 3.3482 3.3044; - 3.4361 3.5047 3.3999 3.4236 3.3879]; - assert (entropyfilt (A), Aout); - assert (entropyfilt (B), Bout); - assert (entropyfilt (C), Cout); - assert (entropyfilt (D), Dout); - assert (entropyfilt (E), Eout); - assert (entropyfilt (F), Fout); - assert (entropyfilt (G), Gout, 1e-4); - assert (entropyfilt (H), Hout, 1e-4); - assert (entropyfilt (Hf), Hfout, 1e-4); - assert (entropyfilt (X), Xout, 1e-4); - assert (entropyfilt (P), Pout, 1e-4); - assert (entropyfilt (Q), Qout); - assert (entropyfilt (R), Rout, 1e-4); -3 tests, 3 passed, 0 known failure, 0 skipped + bw1 = repmat ([0 1 0 1 1], [3 1]); + bw2 = repmat ([0 1 0 0 0], [3 1]); + assert (bwhitmiss (bw1, [1; 0; 1], [1 0 1]), logical (bw2)) + assert (bwhitmiss (bw1, [0 1 0; -1 0 -1; 0 1 0]), logical (bw2)) +1 test, 1 passed, 0 known failure, 0 skipped [inst/imresize.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/imresize.m ***** test @@ -11563,1287 +10134,407 @@ assert (std (out2(:)), 0, 10*eps); assert (std (out3(:)), 0, 10*eps); 14 tests, 14 passed, 0 known failure, 0 skipped -[inst/bweuler.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/bweuler.m -***** demo - A=zeros(9,10); - A([2,5,8],2:9)=1; - A(2:8,[2,9])=1 - bweuler(A) - # Euler number (objects minus holes) is 1-2=-1 in an 8-like object +[inst/imhist.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imhist.m +***** shared nn, bb, enn, ebb + [nn, bb] = imhist(logical([0 1 0 0 1])); +***** assert({nn, bb}, {[3 2]', [0 1]'}) + [nn, bb] = imhist([0 0.2 0.4 0.9 1], 5); +***** assert({nn, bb}, {[1 1 1 0 2]', [0 0.25 0.5 0.75 1]'}) + [nn, bb] = imhist([-2 0 0.2 0.4 0.9 1 5], 5); +***** assert({nn, bb}, {[2 1 1 0 3]', [0 0.25 0.5 0.75 1]'}) + [nn, bb] = imhist(uint8([0 32 255]), 256); + enn = zeros(256, 1); enn([1, 33, 256]) = 1; + ebb = 0:255; +***** assert({nn, bb}, {enn, ebb'}) + [nn, bb] = imhist(int8([-50 0 100]), 31); + enn = zeros(31, 1); enn([10, 16, 28]) = 1; + ebb = -128:8.5:127; +***** assert({nn, bb}, {enn, ebb'}) +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/imfindcircles.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imfindcircles.m +***** shared im0, rgb0, im1 + im0 = [0 0 0 0 0; + 0 1 2 1 0; + 0 2 5 2 0; + 0 1 2 1 0; + 0 0 0 0 0]; + rgb0 = cat (3, im0, 3.*im0, 2.*im0); + im1 = zeros (20); + im1(2:6, 5:9) = 1; + im1(13:19, 13:19) = 1; +***** function image = circlesimage (numx, numy, centersx, centersy, rs, values) + ## create an image with circles of given parameters + num = length (centersx); + image = zeros (numy, numx); + [indy, indx] = meshgrid (1:numx, 1:numy); + for n = 1:num + centerx = centersx(n); + centery = centersy(n); + r = rs(n); + value = values(n); + dist_squared = (indx - centerx).^ 2 + (indy - centery).^ 2; + image(dist_squared <= (r-0.5)^2) = value; + endfor +***** endfunction +***** error imfindcircles () +***** error imfindcircles (im0) +***** error imfindcircles (im0, [1 2 3]) +***** error imfindcircles (im0, -3) +***** error imfindcircles (im0, 4+2*i) +***** error imfindcircles (ones (5,5,4), 2) +***** error imfindcircles (ones (5,5,5,5), 2) +***** error imfindcircles (im0, [2 1]) +***** error imfindcircles (im0, 2, "rubbish") +***** error imfindcircles (im0, 2, "more", "rubbish") +***** error imfindcircles (im0, 2, "ObjectPolarity", "rubbish") +***** error imfindcircles (im0, 2, "ObjectPolarity", 5) +***** error imfindcircles (im0, 2, "ObjectPolarity") +***** error imfindcircles (im0, 2, "Method", "rubbish") +***** error imfindcircles (im0, 2, "Method", 5) +***** error imfindcircles (im0, 2, "Method") +***** error imfindcircles (im0, 2, "Sensitivity", "rubbish") +***** error imfindcircles (im0, 2, "Sensitivity") +***** error imfindcircles (im0, 2, "Sensitivity", -0.1) +***** error imfindcircles (im0, 2, "Sensitivity", 1.1) +***** error imfindcircles (im0, 2, "Sensitivity", [0.1 0.2]) +***** error imfindcircles (im0, 2, "EdgeThreshold", "rubbish") +***** error imfindcircles (im0, 2, "EdgeThreshold") +***** error imfindcircles (im0, 2, "EdgeThreshold", -0.1) +***** error imfindcircles (im0, 2, "EdgeThreshold", 1.1) +***** error imfindcircles (im0, 2, "EdgeThreshold", [0.1 0.2]) +***** error imfindcircles (im0, 2, "EdgeThreshold", 0.1, "ObjectPolarity", "bright", + "Sensitivity", 0.3, "Method", "PhaseCode", "more", 1) +***** test # none of this should fail + imfindcircles (im0, 2); + imfindcircles (im0, [1 2]); + imfindcircles (logical (im0), 2); + imfindcircles (logical (im0), [1 2]); + imfindcircles (rgb0, 2); + imfindcircles (rgb0, [1 2]); + imfindcircles (uint8 (im0), 2); + imfindcircles (uint8 (im0), [1 2]); + imfindcircles (im0, 2, "ObjectPolarity", "bright"); + imfindcircles (im0, 2, "ObjectPolarity", "dark"); + imfindcircles (im0, 2, "Method", "PhaseCode"); + imfindcircles (im0, 2, "Sensitivity", 0.5); + imfindcircles (im0, 2, "EdgeThreshold", 0.5); + imfindcircles (im0, 2, "ObjectPolarity", "bright", "Method", "PhaseCode"); + imfindcircles (im0, 2, "ObjectPolarity", "bright", "Sensitivity", 0.3, + "Method", "PhaseCode"); + imfindcircles (im0, 2, "EdgeThreshold", 0.1, "ObjectPolarity", "bright", + "Sensitivity", 0.3, "Method", "PhaseCode"); ***** test - A=zeros(10,10); - A(2:9,3:8)=1; - A(4,4)=0; - A(8,8)=0; # not a hole - A(6,6)=0; - assert(bweuler(A),-1); + centers = imfindcircles (im1, 2); + assert (size (centers, 2), 2) + assert (class (centers), "double") ***** test - A=zeros(10,10); - A(2:4,2:4)=1; - A(5:8,5:8)=1; - assert(bweuler(A,4),2); - assert(bweuler(A,8),1); - assert(bweuler(A),1); -***** error <2 dimensions> bweuler (true (5, 5, 1, 5)) -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/isbw.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/isbw.m -***** shared img - img = round (rand (10)); -***** assert (isbw (img, "non-logical"), true); -***** assert (isbw (img, "logical"), false); -***** assert (isbw (logical (img), "logical"), true); -***** assert (isbw (logical (img), "non-logical"), true); + [centers, radii] = imfindcircles (im1, [1 5]); + assert (size (centers, 2), 2) + assert (size (radii, 2), 1) + assert (class (radii), "double") ***** test - img(1, 1) = 2; - assert (isbw (img, "non-logical"), false); + [centers, radii, strengths] = imfindcircles (im1, [1 5]); + assert (size (strengths, 2), 1) + assert (class (strengths), "double") +***** error [a b c d] = imfindcircles (im0, 2); +***** test ## sub-pixel accuracy of circle center + xs = [95.7]; + ys = [101.1]; + rs = [50]; + vals = [0.5]; + im = circlesimage (200, 200, xs, ys, rs, vals); + filt = ones (3) ./ 9; + im = imfilter (im, filt); + [centers, radii] = imfindcircles (im, [40 60]); + assert (centers, [101.1, 95.7], 0.1); + assert (radii, 50, 1); ***** test - a( 1, 1) = 1; - a(50, 50) = 2; - assert (isbw (a, "non-logical"), false); -***** assert (isbw (rand (5, 5, 1, 4) > 0.5), true) -***** assert (isbw (rand (5, 5, 3, 4) > 0.5), false) -***** assert (isbw (rand (5, 5, 3) > 0.5), false) -***** assert (isbw (rand (5, 5, 1, 3, 4) > 0.5), false) -***** assert (isbw (randi ([0 1], 5, 5, 1, 4), "non-logical"), true) -***** assert (isbw (randi ([0 1], 5, 5, 3, 4), "non-logical"), false) -***** assert (isbw (randi ([0 1], 5, 5, 3), "non-logical"), false) -***** assert (isbw (randi ([0 1], 5, 5, 1, 3, 4), "non-logical"), false) -***** assert (isbw (single ([0 0 1]), "non-logical"), true) -***** assert (isbw ([0 NaN 1], "non-logical"), false) -16 tests, 16 passed, 0 known failure, 0 skipped -[inst/imtransform.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imtransform.m -***** demo - ## Various linear transforms - figure (); - im = [checkerboard(20, 2, 4); checkerboard(40, 1, 2)]; - %input space corners - incp = [1 1; 160 1; 160 160; 1 160]; - udata = [min(incp(:,1)) max(incp(:,1))]; - vdata = [min(incp(:,2)) max(incp(:,2))]; - subplot (2,3,1); - imshow (im) - hold on - plot (incp(:,1), incp(:,2), 'ob') - axis on - xlabel ('Original') - - % Translation and scaling - outcp = incp * 2; - outcp(:,1) += 200; - outcp(:,2) += 500; - T = maketform ('affine', incp(1:3,:), outcp(1:3,:)); - subplot (2,3,2); - [im2 xdata ydata] = imtransform (im, T, 'udata', udata, - 'vdata', vdata, 'fillvalues', 1); - imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata) - set (gca, 'xlim', xdata, 'ylim', ydata) - axis on, hold on, xlabel ('Translation / Scaling'); - plot (outcp(:,1), outcp(:,2), 'or') - - % Shear - outcp = [1 1; 160 1; 140 160; -19 160]; % affine only needs 3 control points - T = maketform ('affine', incp(1:3,:), outcp(1:3,:)); - subplot (2,3,3); - [im2 xdata ydata] = imtransform (im, T, 'udata', udata, - 'vdata', vdata, 'fillvalues', 1); - imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata) - set (gca, 'xlim', xdata, 'ylim', ydata) - axis on, hold on, xlabel ('Shear'); - plot (outcp(:,1), outcp(:,2), 'or') - - % Rotation - theta = pi/4; - T = maketform ('affine', [cos(theta) -sin(theta); ... - sin(theta) cos(theta); 0 0]); - outcp = tformfwd (T, incp); - subplot (2,3,4); - [im2 xdata ydata] = imtransform (im, T, 'udata', udata, - 'vdata', vdata, 'fillvalues', 1 ); - imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata) - set (gca, 'xlim', xdata, 'ylim', ydata) - axis on, hold on, xlabel ('Rotation'); - plot (outcp(:,1), outcp(:,2), 'or') - - % Reflection around x axis - outcp = incp; - outcp(:,2) *= -1; - T = cp2tform (incp, outcp, 'similarity'); - subplot (2,3,5); - [im2 xdata ydata] = imtransform (im, T, 'udata', udata, - 'vdata', vdata, 'fillvalues', 1 ); - imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata) - set (gca, 'xlim', xdata, 'ylim', ydata) - axis on, hold on, xlabel ('Reflection'); - plot (outcp(:,1), outcp(:,2), 'or') - - % Projection - outcp = [1 1; 160 -40; 220 220; 12 140]; - T = maketform ('projective', incp, outcp); - subplot (2,3,6); - [im2 xdata ydata] = imtransform (im, T, 'udata', udata, - 'vdata', vdata, 'fillvalues', 1 ); - imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata) - set (gca, 'xlim', xdata, 'ylim', ydata) - axis on, hold on, xlabel ('Projection'); - plot (outcp(:,1), outcp(:,2), 'or') + ## specificity to circular shapes and strengths output value + xs = [100 202]; + ys = [101, 203]; + rs = [40, 41]; + vals = [0.8, 0.9]; + im = circlesimage (300, 300, xs, ys, rs, vals); + filt = ones (3) ./ 9; + im = imfilter (im, filt); + im(30:170, 50:100) = 0; + im(20:120, 180:280) = 1; + [centers, radii, strengths] = imfindcircles (im, [30 50], "Sensitivity", 0.9); + assert (size (centers), [2 2]); + assert (centers, [203, 202; 101, 100], 1.5); + assert (radii, [40; 41], 2.5); + assert (strengths(1) / strengths(2) > 1.8, true); +***** test # radius range parameter & dark circles + xs = [50, 420, 180]; + ys = [80, 100, 200]; + rs = [35, 30, 40]; + vals = [0.7, 0.8, 0.9]; + im = circlesimage (300, 500, xs, ys, rs, vals); + filt = ones (3) ./ 9; + im = imfilter (im, filt); + [centers1, radii1] = imfindcircles (im, [28 36]); + [centers2, radii2] = imfindcircles (im, [28 42]); + assert (size (centers1), [2 2]); + assert (centers1, [100 420; 80 50], 0.2); + assert (radii1, [30; 35], 2); + assert (size (centers2), [3 2]); + im_dark = 1-im; + [centers_dark, radii_dark, strengths_dark] = imfindcircles (im_dark, [25 42], "ObjectPolarity", "dark"); + assert (sortrows (centers_dark), [80 50; 100 420; 200 180], 0.2); + assert (sortrows (radii_dark), [30; 35; 40], 1); +***** test # ability to find circles with big radius + xs = [111, 555, 341]; + ys = [222, 401, 161]; + rs = [45, 50, 150]; + vals = [0.6, 0.8, 0.7]; + im = circlesimage (400, 701, xs, ys, rs, vals); + [centers, radii] = imfindcircles (im, [140 160], "Sensitivity", 0.98); + assert (centers, [161, 341], 0.2); + assert (radii, 150, 1); +***** test # overlapping circles + xs = [105, 155]; + ys = [202, 221]; + rs = [45, 50]; + vals = [0.5, 0.8]; + im = circlesimage(385, 422, xs, ys, rs, vals); + filt = ones (3) ./ 9; + im = imfilter (im, filt); + [centers, radii] = imfindcircles (im, [30 80]); + assert (centers, [221, 155; 202, 105], 0.5); + assert (radii, [50; 45], 1); +***** test # overlapping circles, only 10 pixels apart + xs = [155, 155]; + ys = [175, 157]; + rs = [50, 50]; + vals = [0.7, 0.8]; + im = circlesimage (300, 300, xs, ys, rs, vals); + filt = ones (3) ./ 9; + im = imfilter (im, filt); + [centers, radii] = imfindcircles (im, [30 80], "Sensitivity", 0.95); + assert (centers, [157, 155; 175, 155], 1); + assert (radii, [50; 50], 1); +***** test # edge threshold parameter + xs = [100 202]; + ys = [101, 203]; + rs = [40, 41]; + vals = [0.1, 0.9]; + im = circlesimage (300, 300, xs, ys, rs, vals); + filt = ones (3) ./ 9; + im= imfilter (im, filt); + [centers_auto, radii_auto] = imfindcircles (im, [30 50]); + [centers_0, radii_0] = imfindcircles (im, [30 50], "EdgeThreshold", 0); + [centers_05, radii_05] = imfindcircles (im, [30 50], "EdgeThreshold", 0.5); + assert (centers_auto, [203, 202], 0.2); + assert (radii_auto, 41, 1); + assert (centers_0, [101, 100; 203, 202], 0.2); + assert (radii_0, [40; 41], 1); + assert (centers_05, [203, 202], 0.2); + assert (radii_05, 41, 1); ***** demo - ## Streched image - rad = 2; % minimum value: 4/pi - [uu vv] = meshgrid ((-2:2)/rad, (-2:2)/rad); - rescfactor = sin ((uu.^2 + vv.^2).^.5); - inpts = [(reshape (uu, numel (uu), 1)), (reshape (vv, numel (uu), 1))]; - xx = rescfactor .* sign(uu); - yy = rescfactor .* sign(vv); - outpts = [reshape(xx, numel (xx), 1) reshape(yy, numel (yy), 1)]; - - T = cp2tform (inpts, outpts, "polynomial", 4); - figure; - subplot (1,2,1) - im = zeros (800, 800, 3); - im(:,:,1) = checkerboard (100) > 0.2; - im(:,:,3) = checkerboard (100) < 0.2; - [im2 xdata ydata] = imtransform (im, T, 'udata', [-2 2], - 'vdata', [-2 2], 'fillvalues', - [0 1 0]); - imh = imshow (im2); - set (imh, 'xdata', xdata, 'ydata', ydata) - set (gca, 'xlim', xdata, 'ylim', ydata) - [im cmap] = imread ('default.img'); - subplot (1,2,2) - [im2 xdata ydata] = imtransform (im, T, 'udata', [-1 1], - 'vdata', [-1 1], 'fillvalues', - round (length (cmap) / 2)); - imh = imshow (im2, cmap); -***** test - im = checkerboard (); - incp = [0 0; 0 1; 1 1]; - scl = 10; - outcp = scl * incp; - T = maketform ('affine', incp, outcp); - [im2 xdata ydata] = imtransform (im, T, 'udata', [0 1], - 'vdata', [0 1], 'size', [500 500]); - assert (xdata, scl * ([0 1])) - assert (ydata, scl * ([0 1])) - assert (size (im2), [500 500]) -***** test - im = checkerboard (); - incp = [0 0; 0 1; 1 1]; - scl = 10; - outcp = scl * incp; - xyscale = scl; - T = maketform ('affine', incp, outcp); - [im2 xdata ydata] = imtransform (im, T, 'xyscale', xyscale); - assert (size (im2), size (im), 1) -***** test - im = checkerboard (100, 10, 4); - theta = 2 * pi; - T = maketform ("affine", [cos(theta) -sin(theta); ... - sin(theta) cos(theta); 0 0]); - im2 = imtransform (im, T, "nearest", "xdata", [1 800], "ydata", [1 2000]); - im = im(2:end-1, 2:end-1); %avoid boundaries - im2 = im2(2:end-1, 2:end-1); - assert (im, im2) -***** test - im = checkerboard (20, 10, 4); - theta = pi/6; - T = maketform ('affine', [cos(theta) -sin(theta); ... - sin(theta) cos(theta); 0 0]); - [im2, xdata] = imtransform (im, T); - nu = columns(im); - nv = rows(im); - nx = xdata(2); - diag = sqrt (nu^2 + nv^2); - ang = atan (nv / nu); - assert (nx, diag * abs (cos (theta - ang)), - diag * 1 / size (im2, 2)) -***** test - im = rand (2); - tmat = [eye(2); 0 0]; - T = maketform ("affine", tmat); - im2 = imtransform (im, T, "xdata", [1 3]); - assert (im2(:,3), zeros (2,1)) -***** test - im = rand (2); - tmat = [eye(2); 0 0]; - T = maketform ('affine', tmat); - im2 = imtransform (im, T, "xdata", [1 3]); - assert (size (im2), [2 3]) -***** test - im = rand (2); - tmat = [eye(2); 0 0]; - T = maketform ('affine', tmat); - im2 = imtransform (im, T, "xyscale", [0.5 0.5]); - assert (size (im2), [3 3]) -***** test - im = [1,2,3,4; 5,6,7,8; 9,10,11,12; 13,14,15,16]; - tmat = [eye(2); 0 0]; - T = maketform ('affine', tmat); - im2 = imtransform (im, T, 'xdata', [1 4], 'ydata', [4 1]); - assert (im2, [13,14,15,16; 9,10,11,12; 5,6,7,8; 1,2,3,4]) - - im2 = imtransform (im, T, 'xdata', [4 1], 'ydata', [1 4]); - assert (im2, [4,3,2,1; 8,7,6,5; 12,11,10,9; 16,15,14,13]) - - [im2, xd, yd] = imtransform (im, T, 'xdata', [4 1], 'ydata', [4 1]); - assert (im2, [16,15,14,13; 12,11,10,9; 8,7,6,5; 4,3,2,1]) - assert (xd, [4 1]) - assert (yd, [4 1]) - -***** error imtransform () -***** error imtransform (rand(2)) -***** error ... - imtransform (rand(2), maketform ('affine', [eye(2); 0 0]), ... - 'udata', [1 2], 'vdata', [2 1]); -***** error ... - imtransform (rand(2), maketform ('affine', [eye(2); 0 0]), ... - 'udata', [2 1], 'vdata', [1 2]); -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/imopen.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imopen.m -***** shared in, out - in = [ 0 0 0 1 1 1 0 0 1 1 - 0 1 0 1 1 1 0 0 0 1 - 1 1 1 1 1 0 0 0 0 0 - 0 1 1 1 1 0 0 0 0 0 - 0 0 0 1 0 0 0 0 1 0 - 0 0 0 0 0 0 0 1 1 1 - 0 0 0 0 1 0 1 0 1 0 - 0 0 0 1 1 1 1 1 0 0 - 0 0 0 0 1 1 1 0 0 0 - 0 0 0 1 1 1 0 0 0 0]; - - out = [ 0 0 0 1 1 1 0 0 0 0 - 0 0 0 1 1 1 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0]; -***** assert (imopen (logical (in), ones (3)), logical (out)); - - out = [80 80 1 8 15 51 51 51 51 40 - 80 80 7 8 15 54 55 55 55 40 - 4 7 7 8 15 54 55 55 55 40 - 17 17 17 7 3 54 55 55 55 28 - 17 17 17 2 9 54 54 54 52 33 - 17 17 17 29 29 29 29 26 33 33 - 5 5 13 29 29 29 30 32 39 39 - 6 6 13 29 29 29 30 32 39 39 - 10 12 77 77 77 35 35 35 39 39 - 10 12 77 77 77 35 35 35 27 27]; -***** assert (imopen (magic (10), ones (3)), out); -***** assert (imopen (uint8 (magic (10)), strel ("square", 3)), uint8 (out)); - - ## using a se that will be decomposed in 2 pieces - out =[ 1 1 1 8 15 40 40 40 40 40 - 4 4 4 8 15 40 40 40 40 40 - 4 4 4 8 15 40 40 40 40 40 - 5 5 5 3 3 28 28 28 28 28 - 5 5 5 2 9 28 28 28 28 28 - 5 5 13 26 26 26 26 26 26 26 - 5 5 13 29 29 29 29 29 27 27 - 6 6 13 29 29 29 29 29 27 27 - 6 6 13 29 29 29 29 29 27 27 - 6 6 13 29 29 29 29 29 27 27]; -***** assert (imopen (magic (10), ones(5)), out); + ## First generate an input image: + model = [ 1.0 0.2 0.2 0.2 0.5 0 + 1.0 0.3 0.3 -0.1 -0.2 0 + -0.5 0.7 0.7 -0.5 0.5 0]; + im = phantom (model); + im(170:230,170:230) = 1; + im = imfilter (im, fspecial ("average", 3)); + im = imnoise (im, "salt & pepper"); + imshow (im); - ## using a weird non-symmetric and even-size se - out =[ 7 7 1 8 15 55 51 51 41 40 - 7 7 7 8 16 55 55 55 51 41 - 4 9 7 7 16 54 55 54 55 47 - 25 25 9 9 3 52 54 52 54 28 - 25 24 25 2 9 33 52 34 52 34 - 17 24 29 31 29 30 33 26 33 34 - 17 5 29 31 31 31 30 32 39 33 - 10 6 13 35 35 29 31 32 45 39 - 10 12 77 36 36 35 35 31 45 45 - 11 12 77 77 77 36 36 35 27 45]; -***** assert (imopen (magic (10), [1 0 0 0; 1 1 1 0; 0 1 0 1]), out); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/rangefilt.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/rangefilt.m -***** test - im = rangefilt (ones (5)); - assert (im, zeros (5)); -***** test - A = zeros (3,3); - B = ones (3,3); - C = [1 1 1; 2 2 2; 3 3 3]; - D = C'; - E = ones (3,3); - E(2,2) = 2; - F = 3 .* ones (3,3); - F(2,2) = 1; - G = [-1 2 7; -5 2 8; -7 pi 9]; - H = [5 2 8; 1 -3 1; 5 1 0]; - A_out = [0 0 0; 0 0 0; 0 0 0]; - B_out = [0 0 0; 0 0 0; 0 0 0]; - C_out = [1 1 1; 2 2 2; 1 1 1]; - D_out = [1 2 1; 1 2 1; 1 2 1]; - E_out = [1 1 1; 1 1 1; 1 1 1]; - F_out = [2 2 2; 2 2 2; 2 2 2]; - G_out = [7 13 6; 7+pi 16 7; 7+pi 16 7]; - H_out = [8 11 11; 8 11 11; 8 8 4]; - assert (rangefilt (A), A_out) - assert (rangefilt (B), B_out) - assert (rangefilt (C), C_out) - assert (rangefilt (D), D_out) - assert (rangefilt (E), E_out) - assert (rangefilt (F), F_out) - assert (rangefilt (G), G_out, eps) - assert (rangefilt (H), H_out) -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/roicolor.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/roicolor.m -***** demo - roicolor([1:10],2,4); - % Returns '1' where input values are between 2 and 4 (both included). -***** assert(roicolor([1:10],2,4),logical([0,1,1,1,zeros(1,6)])); -***** assert(roicolor([1,2;3,4],3,3),logical([0,0;1,0])); -***** assert(roicolor([1,2;3,4],[1,4]),logical([1,0;0,1])); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/imabsdiff.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imabsdiff.m -***** assert (imabsdiff (uint8 ([23 250]), uint8 ([26 50])), uint8 ([ 3 200])); # default to first class and abs works -***** assert (imabsdiff (uint8 ([23 250]), uint8 ([24 50]), "uint16"), uint16 ([ 1 200])); # defining output class works (not in matlab) -***** assert (imabsdiff (uint8 ([23 250]), uint8 ([24 255]), "int8"), int8 ([ 1 5])); # signed integers kinda work (not in matlab) -***** assert (imabsdiff (logical ([ 1 0]), logical ([ 1 1])), double ([ 0 1])); # return double for two logical images -***** fail ("imabsdiff (uint8 ([23 250]), 30"); # fails subtracting a scalar -***** fail ("imabsdiff (uint8 ([23 250]), uint16 ([23 250]))"); # input need to have same class -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/lab2uint16.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2uint16.m + ## Find and show circles with radius between 20 and 50: + [centers, radii] = imfindcircles (im, [20 50]); + viscircles (centers, radii) + title ("found circles in red") +39 tests, 39 passed, 0 known failure, 0 skipped +[inst/imtranslate.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imtranslate.m ***** test - cm_uint16 = uint16 ([0 127 128 383 384 65151 65152 65279 65280 65281 65534 65535]); - cm_uint16 = repmat (cm_uint16(:), [1 3]); - im2d_uint16 = reshape (cm_uint16, [4 3 3]); - imnd_uint16 = permute (im2d_uint16, [1 4 3 2]); - - cm_uint8 = uint8 ([0 0 1 1 2 254 255 255 255 255 255 255]); - cm_uint8 = repmat (cm_uint8(:), [1 3]); - assert (lab2uint8 (cm_uint16), cm_uint8) - im2d_uint8 = reshape (cm_uint8, [4 3 3]); - assert (lab2uint8 (im2d_uint16), im2d_uint8) - assert (lab2uint8 (imnd_uint16), permute (im2d_uint8, [1 4 3 2])) - - l1 = 100/65280; - ab1 = 255/65280; - cm = [ - 0 -128 - 127*l1 -128+(ab1*127) - 128*l1 -128+(ab1*128) - 383*l1 -128+(ab1*383) - 384*l1 -128+(ab1*384) - 65151*l1 -128+(ab1*65151) - 65152*l1 -128+(ab1*65152) - 65279*l1 -128+(ab1*65279) - 100 127 - 65281*l1 -128+(ab1*65281) - 65534*l1 -128+(ab1*65534) - 65535*l1 -128+(ab1*65535)]; - cm(:,3) = cm(:,2); - im2d = reshape (cm, [4 3 3]); - imnd = permute (im2d, [1 4 3 2]); - - assert (lab2double (cm_uint16), cm) - assert (lab2double (im2d_uint16), im2d) - assert (lab2double (imnd_uint16), imnd) + obs = imtranslate (ones (5, 5), 2, 1, "crop"); + exp = zeros (5, 5); + exp(1:4, 3:5) = 1; + assert (obs, exp, eps * 10) - assert (lab2single (cm_uint16), single (cm)) - assert (lab2single (im2d_uint16), single (im2d)) - assert (lab2single (imnd_uint16), single (imnd)) + obs = imtranslate (ones (5, 5), -2, -1, "crop"); + exp = zeros (5, 5); + exp(2:5, 1:3) = 1; + assert (obs, exp, eps * 10) 1 test, 1 passed, 0 known failure, 0 skipped -[inst/imclearborder.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imclearborder.m -***** test - a = logical ([ - 0 1 0 0 1 0 0 0 0 1 - 1 0 0 0 0 1 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 1 0 1 0 1 0 1 0 0 1 - 0 0 0 0 0 0 0 1 1 0 - 0 0 1 0 0 1 0 1 0 0 - 0 1 0 1 0 1 1 0 0 0 - 0 0 0 1 0 0 0 0 0 0 - 0 0 0 1 0 1 1 0 0 0 - 0 0 0 1 1 0 0 0 1 0]); - - a4 = logical ([ - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 1 0 0 0 0 - 0 1 0 0 0 0 0 0 0 0 - 0 0 1 0 1 0 1 0 0 0 - 0 0 0 0 0 0 0 1 1 0 - 0 0 1 0 0 1 0 1 0 0 - 0 1 0 0 0 1 1 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 1 1 0 0 0 - 0 0 0 0 0 0 0 0 0 0]); - - a8 = logical ([ - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 1 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0]); - - assert (imclearborder (a, 4), a4) - assert (imclearborder (a, [0 1 0; 1 1 1; 0 1 0]), a4) - assert (imclearborder (a), a8) - assert (imclearborder (a, 8), a8) - assert (imclearborder (a, ones (3)), a8) -***** test - a = false (5, 5, 3); - a(2:4,2:4,:) = true; - assert (imclearborder (a, 4), a) +[inst/histeq.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/histeq.m +***** assert (histeq ([]), []); +***** assert (histeq (0), 1); +***** assert (histeq (1), 1); +***** assert (histeq (1.5), 1); +***** assert (histeq (zeros (100, 200)), ones (100, 200)); # matrix +***** xtest assert (histeq ([0 1]), [0.4920634921 1], 10^-8); +!!!!! known failure +ASSERT errors for: assert (histeq ([0, 1]),[0.4920634921, 1],10 ^ -8) - a(1,2) = true; - a4 = a; - a4(:,:,1) = false; - assert (imclearborder (a, 4), a4) -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/isrgb.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/isrgb.m -***** assert (isrgb ("this is not a RGB image"), false); -***** assert (isrgb (rand (5, 5)), false); -***** assert (isrgb (rand (5, 5, 1, 5)), false); -***** assert (isrgb (rand (5, 5, 3, 5)), true); -***** assert (isrgb (rand (5, 5, 3)), true); -***** assert (isrgb (ones (5, 5, 3)), true); -***** assert (isrgb (ones (5, 5, 3) + eps), false); -***** assert (isrgb (zeros (5, 5, 3) - eps), false); -***** assert (isrgb (rand (5, 5, 3) > 0.5), false); -***** assert (isrgb (randi ([-100 100], 5, 5, 3, "int16")), true) -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/isind.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/isind.m -***** assert (isind ([]), false); -***** assert (isind (1:10), true); -***** assert (isind (0:10), false); -***** assert (isind (1), true); -***** assert (isind (0), false); -***** assert (isind ([1.3 2.4]), false); -***** assert (isind ([1 2; 3 4]), true); -***** assert (isind (randi (100, 10, 10, 1, 4)), true); -***** assert (isind (randi (100, 10, 10, 3, 4)), false); -***** assert (isind (randi (100, 10, 10, 1, 4, 2)), false); -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/imclose.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imclose.m -***** shared in, out - in = [ 0 0 0 1 1 1 0 0 1 1 - 0 1 0 1 1 1 0 0 0 1 - 1 1 1 1 1 0 0 0 0 0 - 0 1 1 1 1 0 0 0 0 0 - 0 0 0 1 0 0 0 0 1 0 - 0 0 0 0 0 0 0 1 1 1 - 0 0 0 0 1 0 1 0 1 0 - 0 0 0 1 1 1 1 1 0 0 - 0 0 0 0 1 1 1 0 0 0 - 0 0 0 1 1 1 0 0 0 0]; + Location | Observed | Expected | Reason + (1) 0.5 0.49206 Abs err 0.0079365 exceeds tol 1e-08 by 0.008 +***** xtest assert (histeq ([0 1]'), [0.4920634921 1]', 10^-8); # column array +!!!!! known failure +ASSERT errors for: assert (histeq ([0, 1]'),[0.4920634921, 1]',10 ^ -8) - out = [ 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 0 0 0 1 - 1 1 1 1 1 0 0 0 0 1 - 1 1 1 1 1 0 0 0 0 1 - 0 0 0 1 1 0 0 0 1 1 - 0 0 0 1 1 1 1 1 1 1 - 0 0 0 1 1 1 1 1 1 1 - 0 0 0 1 1 1 1 1 0 0 - 0 0 0 1 1 1 1 0 0 0 - 0 0 0 1 1 1 1 0 0 0]; -***** assert (imclose (logical (in), ones (3)), logical (out)); + Location | Observed | Expected | Reason + (1) 0.5 0.49206 Abs err 0.0079365 exceeds tol 1e-08 by 0.008 +***** xtest assert (histeq ([0 255]), [0.4920634921 1], 10^-8); +!!!!! known failure +ASSERT errors for: assert (histeq ([0, 255]),[0.4920634921, 1],10 ^ -8) - out = [99 99 16 16 16 73 74 64 64 64 - 98 88 16 16 16 73 71 64 64 64 - 93 88 88 61 61 61 68 70 70 70 - 93 88 88 61 61 61 68 71 71 71 - 93 93 88 61 61 61 68 75 66 66 - 79 79 82 90 90 49 49 49 49 66 - 79 79 82 91 91 48 46 46 46 66 - 79 79 82 95 97 48 46 46 46 72 - 18 18 94 96 84 48 46 46 46 59 - 18 18 100 96 84 50 50 50 50 59]; -***** assert (imclose (magic (10), ones (3)), out); -***** assert (imclose (uint8 (magic (10)), strel ("square", 3)), uint8 (out)); + Location | Observed | Expected | Reason + (1) 0.5 0.49206 Abs err 0.0079365 exceeds tol 1e-08 by 0.008 +***** xtest assert (histeq (uint8 ([0 1])), [ 125 190]); # uint8 +!!!!! known failure +ASSERT errors for: assert (histeq (uint8 ([0, 1])),[125, 190]) - ## using a se that will be decomposed in 2 pieces - out =[ 99 99 88 74 74 74 74 70 70 70 - 98 93 88 74 74 74 74 70 70 70 - 93 93 88 74 74 74 74 70 70 70 - 93 93 88 74 74 74 74 71 71 71 - 93 93 88 75 75 75 75 75 75 75 - 93 93 90 90 90 72 72 72 72 72 - 93 93 91 91 91 72 72 72 72 72 - 93 93 93 95 97 72 72 72 72 72 - 94 94 94 96 97 72 72 72 72 72 - 100 100 100 97 97 72 72 72 72 72]; -***** assert (imclose (magic (10), ones(5)), out); + Location | Observed | Expected | Reason + (1) 0.5 125 Abs err 124.5 exceeds tol 0 by 1e+02 + (2) 1 190 Abs err 189 exceeds tol 0 by 2e+02 +***** xtest assert (histeq (uint8 ([0 255])), [ 125 255]); +!!!!! known failure +ASSERT errors for: assert (histeq (uint8 ([0, 255])),[125, 255]) - ## using a weird non-symmetric and even-size se - out =[ 92 99 16 16 16 70 74 58 58 58 - 98 88 60 73 16 73 69 70 64 58 - 88 81 88 60 60 60 69 69 70 70 - 87 87 61 68 61 60 68 69 71 69 - 86 93 87 61 61 61 68 75 68 69 - 23 82 89 89 90 45 68 45 68 66 - 23 23 82 89 91 48 45 45 45 66 - 79 23 82 95 97 46 48 46 45 72 - 18 79 94 96 78 50 46 46 46 59 - 18 18 100 94 94 78 50 50 46 59]; -***** assert (imclose (magic (10), [1 0 0 0; 1 1 1 0; 0 1 0 1]), out); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/otsuthresh.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/otsuthresh.m -***** test - histo = zeros (1, 256); - histo([ 29 33 37 41 46 50 54 58 62 66 70 74 78 82 ... - 86 90 94 98 102 106 110 114 118 122 126 131 135 139 ... - 143 147 151 155 159 163 167 171 175 179 183 187 191 195 ... - 199 203 207 211 216 220 224 228 232 236 240 244 248 252]) = ... - [2 27 51 144 132 108 43 29 22 21 22 20 10 16 17 12 13 14 12 13 ... - 15 25 19 20 23 37 23 65 92 84 87 54 50 54 33 73 76 64 57 58 47 ... - 48 30 27 22 20 20 11 12 12 11 7 17 31 37 31]; - assert (otsuthresh (histo), 114.5/255) -***** test - I = max (phantom (), 0); - H = imhist (I); - assert (otsuthresh (H), 178/255) - assert (otsuthresh (H'), 178/255) - H = imhist (I, 10); - assert (otsuthresh (H), 170/255) -***** assert (otsuthresh (100), 0) -***** assert (otsuthresh (zeros (256, 1)), 0) -***** assert (otsuthresh (zeros (5, 1)), 0) -***** assert (otsuthresh (uint8 ([10 20 30])), 0.5) -***** assert (otsuthresh (int32 ([100 200 300])), 0.5) -***** assert (otsuthresh (int32 ([100 200])), 0) -***** assert (otsuthresh (single ([10 20 30 40])), 1/3); -***** assert (otsuthresh (uint16 ([10 20 30 40 50 60 70 80 90 100])), 5/9) -***** assert (otsuthresh (int16 ([10 20 30 40 50 60 70 80 90 100])), 5/9) -***** assert (otsuthresh (int16 (1:255)), 156/254) -***** assert (otsuthresh (int16 (1:1023)), 631/1022) -***** assert (otsuthresh (int8 (1:1023)), 541/1022) -***** test - warning ("off", "Octave:data-file-in-path", "local"); - S = load ("penny.mat"); - h = imhist (uint8 (S.P)); - assert (otsuthresh (h), 94/255); -***** test - I = max (phantom (), 0); - h = imhist (I, 5); - assert (otsuthresh (h), 0.625); -***** error id=Octave:invalid-fun-call otsuthresh () -***** error id=Octave:invalid-fun-call otsuthresh (ones (10), 5) -***** error otsuthresh ([]) -***** error otsuthresh ([Inf 10]) -***** error otsuthresh ([10 NA]) -***** error otsuthresh ([10 NaN]) -***** error otsuthresh (zeros (5)) -***** error otsuthresh ([10 -10]) -***** error otsuthresh ("foo") -***** demo - I = max (phantom (), 0); - figure; imshow (I); - title ("Original image"); - h = imhist (I); - t = otsuthresh (h); - J = im2bw (I); - figure; imshow (J); - title_line = sprintf ("Black and white image after thresholding, t=%g", - t*255); - title (title_line); -***** demo - warning ("off", "Octave:data-file-in-path", "local"); - S = load ("penny.mat"); - I = uint8 (S.P); - figure; imshow (I); - title ("Original penny image"); - h = imhist (I); - t = otsuthresh (h); - J = im2bw (I); - figure; imshow (J); - title_line = sprintf ("Black and white penny image after thresholding, t=%g", - t*255); - title (title_line); - I = 255 - I; - figure; imshow(I); - title ("Negative penny image"); - h = imhist (I); - t = otsuthresh (h); - J = im2bw (I); - figure; imshow (J); - title_line = sprintf ("Black and white negative penny image after thresholding, t=%g", - t*255); - title (title_line); -25 tests, 25 passed, 0 known failure, 0 skipped -[inst/medfilt2.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/medfilt2.m -***** shared b, f - b = [ 0 1 2 3 - 1 8 12 12 - 4 20 24 21 - 7 22 25 18]; - f = [ 0 1 2 0 - 1 4 12 3 - 4 12 20 12 - 0 7 20 0]; -***** assert (medfilt2 (b), f); + Location | Observed | Expected | Reason + (1) 0.5 125 Abs err 124.5 exceeds tol 0 by 1e+02 + (2) 1 255 Abs err 254 exceeds tol 0 by 3e+02 +***** xtest assert (histeq (uint16 ([0 1])), [65535 65535]); # uint16 +!!!!! known failure +ASSERT errors for: assert (histeq (uint16 ([0, 1])),[65535, 65535]) - f = [ 0 1 2 3 - 1 8 12 12 - 4 20 24 18 - 4 20 24 18]; -***** assert (medfilt2 (b, true (3, 1)), f); -***** assert (medfilt2 (b, [3 1]), f); + Location | Observed | Expected | Reason + (1) 0.5 65535 Abs err 65534 exceeds tol 0 by 7e+04 + (2) 1 65535 Abs err 65534 exceeds tol 0 by 7e+04 +***** xtest assert (histeq (uint16 ([0 255])), [32247 48891]); +!!!!! known failure +ASSERT errors for: assert (histeq (uint16 ([0, 255])),[32247, 48891]) - f = [ 1 8 10 10 - 1 8 12 12 - 4 20 24 18 - 7 20 24 18]; -***** assert (medfilt2 (b, [3 1], 10), f); -***** assert (medfilt2 (b, 10, [3 1]), f); + Location | Observed | Expected | Reason + (1) 0.5 32247 Abs err 32246 exceeds tol 0 by 3e+04 + (2) 1 48891 Abs err 48890 exceeds tol 0 by 5e+04 +***** xtest assert (histeq (uint16 ([0 256])), [32247 48891]); +!!!!! known failure +ASSERT errors for: assert (histeq (uint16 ([0, 256])),[32247, 48891]) - f = [ 0.5 4.5 7.0 7.5 - 2.5 14.0 18.0 15.0 - 2.5 14.0 18.0 15.0 - 2.0 10.0 12.0 9.0]; -***** assert (medfilt2 (b, true (4, 1)), f); -***** assert (medfilt2 (b, [4 1]), f); -***** test - A = zeros (3, 3); - B = ones (3, 3); - C = [1 1 1; 2 2 2; 3 3 3]; - D = C'; - E = ones (3, 3); - E(2,2) = 2; - F = 3 .* ones (3, 3); - F(2,2) = 1; - G = [-1 2 7; -5 2 8; -7 pi 9]; - H = [5 2 8; 1 -3 1; 5 1 0]; - A_out = [0 0 0; 0 0 0; 0 0 0]; - B_out = [0 1 0; 1 1 1; 0 1 0]; - C_out = [0 1 0; 1 2 1; 0 2 0]; - D_out = [0 1 0; 1 2 2; 0 1 0]; - E_out = [0 1 0; 1 1 1; 0 1 0]; - F_out = [0 3 0; 3 3 3; 0 3 0]; - G_out = [0 0 0; 0 2 2; 0 0 0]; - H_out = [0 1 0; 1 1 0; 0 0 0]; - assert (medfilt2 (A), A_out); - assert (medfilt2 (B), B_out); - assert (medfilt2 (C), C_out); - assert (medfilt2 (D), D_out); - assert (medfilt2 (E), E_out); - assert (medfilt2 (F), F_out); - assert (medfilt2 (G), G_out); - assert (medfilt2 (H), H_out); -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/applylut.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/applylut.m -***** demo - lut = makelut (@(x) sum (x (:)) >= 3, 3); - S = applylut (eye (5), lut); - disp (S) - ## Everything should be 0 despite a diagonal which doesn't reach borders. -***** assert (prod (applylut (eye (3), makelut (@(x) x(1) == 1, 2)) == eye (3)), [1 1 1]); -***** assert (prod (applylut (eye (3), makelut (@(x) x(2,2) == 1, 3)) == eye (3)), [1 1 1]); -***** assert (prod (applylut (eye (3), makelut (@(x) x(3,3) == 1, 3)) == - applylut (eye (3), makelut (@(x) x(2,2) == 1, 2))), - [1 1 1]); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/integralImage.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/integralImage.m -***** test - assert (integralImage (10), [0 0; 0 10]); - assert (integralImage (10, "rotated"), [0 0 0; 0 10 0]); -***** test - J = integralImage (10); - assert (class(J), "double"); - J = integralImage (uint8(10)); - assert (class(J), "double"); -***** test - I = [1, 2; 3, 4]; - J = integralImage (I); - J1 = [0 0 0; 0 1 3; 0 4 10]; - assert (J, J1) - J = integralImage (I, "rotated"); - J1 = [0 0 0 0; 0 1 2 0; 1 6 7 2]; - assert (J, J1) -***** test - I1 = [1, 2; 3, 4]; - I2 = [5, 6; 7, 8]; - I3 = [9, 10; 11, 12]; - I = cat (3, I1, I2, I3); - J = integralImage (I); - J1 = [0 0 0; 0 1 3; 0 4 10]; - J2 = [0 0 0; 0 5 11; 0 12 26]; - J3 = [0 0 0; 0 9 19; 0 20 42]; - J0 = cat (3, J1, J2, J3); - assert (J, J0) -***** test - I1 = [1, 2; 3, 4]; - I2 = [5, 6; 7, 8]; - I3 = [9, 10; 11, 12]; - I = cat (3, I1, I2, I3); - J = integralImage (I, "rotated"); - J1 = [0 0 0 0; 0 1 2 0; 1 6 7 2]; - J2 = [0 0 0 0; 0 5 6 0; 5 18 19 6]; - J3 = [0 0 0 0; 0 9 10 0; 9 30 31 10]; - J0 = cat (3, J1, J2, J3); - assert (J, J0) -***** test - I = magic (5); - J = integralImage (I); - J_res = [0 0 0 0 0 0; - 0 17 41 42 50 65; - 0 40 69 77 99 130; - 0 44 79 100 142 195; - 0 54 101 141 204 260; - 0 65 130 195 260 325]; - assert (J, J_res) + Location | Observed | Expected | Reason + (1) 0.5 32247 Abs err 32246 exceeds tol 0 by 3e+04 + (2) 1 48891 Abs err 48890 exceeds tol 0 by 5e+04 +***** xtest assert (histeq (uint16 ([0 65535])), [32247 65535]); +!!!!! known failure +ASSERT errors for: assert (histeq (uint16 ([0, 65535])),[32247, 65535]) - J = integralImage (I, "rotated"); - J_res_R = [0 0 0 0 0 0 0; - 0 17 24 1 8 15 0; - 17 64 47 40 38 39 15; - 64 74 91 104 105 76 39; - 74 105 149 188 183 130 76; - 105 170 232 272 236 195 130]; - assert (J, J_res_R) -***** error - integralImage (); -***** error - integralImage (1, "xxx", 2); -***** error - integralImage ("abcd"); -***** error - integralImage ([1 2; 3 4], "xxx"); -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/radon.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/radon.m -***** test - A = radon (ones (2,2), 30); - assert (A, [0 0 0.608253175473055 2.103325780167649 1.236538105676658 0.051882938682637 0]',1e-10) -***** test -***** # testing all types - A = radon (single (ones (2,2)), 90); - assert (A, B) - A = radon (double (ones (2,2)), 90); - assert (A, B) - A = radon (int8 (ones (2,2)), 90); - assert (A, B) - A = radon (int32 (ones (2,2)), 90); - assert (A, B) - A = radon (int64 (ones (2,2)), 90); - assert (A, B) - A = radon (uint8 (ones (2,2)), 90); - assert (A, B) - A = radon (uint16 (ones (2,2)), 90); - assert (A, B) - A = radon (uint32 (ones (2,2)), 90); - assert (A, B) - A = radon (uint64 (ones (2,2)), 90); - B = [0, 0.25, 1.75, 1.75, 0.25, 0. 0.]'; - assert (A, B) - bug #58567 - A = radon (logical (ones (2,2)), 90); - assert (A, B) -***** error - radon (); -***** error - radon ('xxx'); -***** error - radon (ones (2, 2), ones (2,2)); -***** error - radon (ones (2, 2), 'xxx'); -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/imbothat.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imbothat.m -***** assert (imbothat (ones (3), [1 1; 0 1]), zeros (3)); -***** assert (imbothat (true (3), [1 1; 0 1]), false (3)); -***** shared in, out, se - in = [ 0 0 0 1 1 1 0 0 1 1 - 0 1 0 1 1 1 0 0 0 1 - 1 1 1 1 1 0 0 0 0 0 - 0 1 1 1 1 0 0 0 0 0 - 0 0 0 1 0 0 0 0 1 0 - 0 0 0 0 0 0 0 1 1 1 - 0 0 0 0 1 0 1 0 1 0 - 0 0 0 1 1 1 1 1 0 0 - 0 0 0 0 1 1 1 0 0 0 - 0 0 0 1 1 1 0 0 0 0]; + Location | Observed | Expected | Reason + (1) 0.5 32247 Abs err 32246 exceeds tol 0 by 3e+04 + (2) 1 65535 Abs err 65534 exceeds tol 0 by 7e+04 +***** test assert (histeq ([0 1 1] ), [ 1/3 1 1] , 10^-8); +***** test assert (histeq ([0 0 1]'), [ 2/3 2/3 1]', 10^-8); +***** xtest assert (histeq ([0 1 2] ), [ 1/3 1 1] , 10^-8); +!!!!! known failure +ASSERT errors for: assert (histeq ([0, 1, 2]),[1 / 3, 1, 1],10 ^ -8) - out = [ 1 1 1 0 0 0 1 1 0 0 - 1 0 1 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 1 - 1 0 0 0 0 0 0 0 0 1 - 0 0 0 0 1 0 0 0 0 1 - 0 0 0 1 1 1 1 0 0 0 - 0 0 0 1 0 1 0 1 0 1 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 0 0 0 0 0 0 - 0 0 0 0 0 0 1 0 0 0]; -***** assert (imbothat (logical (in), ones (3)), logical (out)); + Location | Observed | Expected | Reason + (2) 0.66667 1 Abs err 0.33333 exceeds tol 1e-08 by 0.3 +***** xtest assert (histeq (uint8 ([0 1 2])), [ 85 125 215]); +!!!!! known failure +ASSERT errors for: assert (histeq (uint8 ([0, 1, 2])),[85, 125, 215]) - out = [ 7 0 15 8 1 6 0 13 6 24 - 0 8 9 2 0 0 16 7 0 23 - 89 7 0 41 39 7 12 7 0 23 - 8 1 69 40 58 1 6 2 0 43 - 7 0 63 59 52 0 0 0 14 32 - 62 55 6 7 0 7 0 23 16 1 - 56 74 0 2 0 0 16 14 7 0 - 0 73 69 0 0 19 15 8 1 0 - 8 6 0 0 6 13 9 2 0 6 - 7 0 0 19 0 14 7 0 23 0]; -***** assert (imbothat (magic (10), ones (3)), out); -***** assert (imbothat (uint8 (magic (10)), strel ("square", 3)), uint8 (out)); + Location | Observed | Expected | Reason + (1) 0.33333 85 Abs err 84.667 exceeds tol 0 by 8e+01 + (2) 0.66667 125 Abs err 124.33 exceeds tol 0 by 1e+02 + (3) 1 215 Abs err 214 exceeds tol 0 by 2e+02 +***** xtest assert (histeq (uint16 ([0 1 2])), [65535 65535 65535]); +!!!!! known failure +ASSERT errors for: assert (histeq (uint16 ([0, 1, 2])),[65535, 65535, 65535]) - ## using a se that will be decomposed in 2 pieces - out =[ 7 0 87 66 59 7 0 19 12 30 - 0 13 81 60 58 1 19 13 6 29 - 89 12 0 54 52 20 18 7 0 23 - 8 6 69 53 71 14 12 2 0 43 - 7 0 63 73 66 14 7 0 23 41 - 76 69 14 7 0 30 23 46 39 7 - 70 88 9 2 0 24 42 40 33 6 - 14 87 80 0 0 43 41 34 27 0 - 84 82 0 0 19 37 35 28 26 19 - 89 82 0 20 13 36 29 22 45 13]; -***** assert (imbothat (magic (10), ones(5)), out); + Location | Observed | Expected | Reason + (1) 0.33333 65535 Abs err 65535 exceeds tol 0 by 7e+04 + (2) 0.66667 65535 Abs err 65534 exceeds tol 0 by 7e+04 + (3) 1 65535 Abs err 65534 exceeds tol 0 by 7e+04 +***** xtest assert (histeq (uint16 ([0 100 200])), [43690 43690 55133]); +!!!!! known failure +ASSERT errors for: assert (histeq (uint16 ([0, 100, 200])),[43690, 43690, 55133]) - ## using a weird non-symmetric and even-size se - out =[ 0 0 15 8 1 3 0 7 0 18 - 0 8 53 59 0 0 14 13 0 17 - 84 0 0 40 38 6 13 6 0 23 - 2 0 42 47 58 0 6 0 0 41 - 0 0 62 59 52 0 0 0 16 35 - 6 58 13 6 0 3 19 19 35 1 - 0 18 0 0 0 0 15 13 6 0 - 0 17 69 0 0 17 17 8 0 0 - 8 67 0 0 0 15 9 2 0 6 - 7 0 0 17 10 42 7 0 19 0]; -***** assert (imbothat (magic (10), [1 0 0 0; 1 1 1 0; 0 1 0 1]), out); + Location | Observed | Expected | Reason + (1) 0.33333 43690 Abs err 43690 exceeds tol 0 by 4e+04 + (2) 0.66667 43690 Abs err 43689 exceeds tol 0 by 4e+04 + (3) 1 55133 Abs err 55132 exceeds tol 0 by 6e+04 +***** xtest + J = [20 32 57 81 105 125 150 174 198 223 247]; + assert (histeq (uint8 (0:10:100)), J); +!!!!! known failure +ASSERT errors for: assert (histeq (uint8 (0:10:100)),J) - ## N dimensional and weird se - in = reshape (magic(16), [4 8 4 2]); - se = ones (3, 3, 3); - se(:,:,1) = [1 0 1; 0 1 1; 0 0 0]; - se(:,:,3) = [1 0 1; 0 1 1; 0 0 1]; - out = zeros (size (in)); - out(:,:,1,1) = [ - 0 17 81 145 237 146 64 0 - 205 128 64 0 0 37 83 147 - 175 111 47 0 0 64 117 181 - 0 64 128 209 173 109 45 0]; - out(:,:,2,1) = [ - 235 142 78 18 0 23 69 133 - 0 35 103 163 215 128 46 0 - 0 64 128 195 183 123 48 0 - 153 93 43 0 14 78 146 215]; - out(:,:,3,1) = [ - 0 25 89 153 229 142 64 0 - 201 128 64 0 0 41 91 155 - 167 103 57 0 0 64 125 189 - 0 64 146 217 165 101 37 0]; - out(:,:,4,1) = [ - 227 142 78 14 0 31 77 141 - 0 43 107 171 211 128 46 0 - 0 64 128 203 179 115 48 0 - 149 99 35 0 18 82 146 223]; - out(:,:,1,2) = [ - 0 33 97 161 221 146 64 0 - 189 125 61 0 0 53 99 163 - 159 95 31 0 0 64 128 197 - 0 64 128 225 157 93 29 0]; - out(:,:,2,2) = [ - 219 142 78 18 0 39 85 149 - 0 51 119 179 199 128 46 0 - 0 64 128 211 167 107 43 0 - 137 77 27 0 14 78 146 231]; - out(:,:,3,2) = [ - 0 41 105 169 213 142 64 0 - 185 121 64 0 0 57 107 171 - 151 87 41 0 0 64 128 205 - 0 64 146 233 149 85 21 0]; - out(:,:,4,2) = [ - 211 142 78 14 0 47 93 157 - 0 59 123 187 195 128 46 0 - 0 64 128 219 163 99 35 0 - 133 83 19 0 18 82 146 239]; -***** assert (imbothat (in, se), out); -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/otf2psf.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/otf2psf.m -***** function otf = rand_otf (varargin) - otf = complex (rand (varargin{:}), rand (varargin{:})); -***** endfunction -***** test - otf = rand_otf (6, 1); - assert (otf2psf (otf), circshift (ifft (otf), 3), 1e-16); -***** test - otf = rand_otf (6, 6); - assert (otf2psf (otf), circshift (ifft2 (otf), [3 3]), eps); -***** test - otf = rand_otf (6, 6, 6); - assert (otf2psf (otf), circshift (ifftn (otf), [3 3 3]), eps); -***** test - otf = rand_otf (7, 1); - assert (otf2psf (otf), circshift (ifft (otf), 3), 2.5e-16); -***** test - otf = rand_otf (7, 7); - assert (otf2psf (otf), circshift (ifft2 (otf), [3 3]), 2.5e-16); -***** test - otf = rand_otf (6, 7, 8); - assert (otf2psf (otf), circshift (ifftn (otf), [3 3 4]), 2.5e-16); -***** test - otf = rand_otf (7, 1); - ppsf = circshift (ifft (otf), 3); - assert (otf2psf (otf, 6), ppsf(1:6), 2.5e-16); - assert (otf2psf (otf, [6 1]), ppsf(1:6), 2.5e-16); -***** test - otf = rand_otf (7, 7); - ppsf = circshift (ifft2 (otf), [3 3]); - assert (otf2psf (otf, [6 1]), ppsf(1:6,4), 2.5e-16); -***** test - otf = rand_otf (6, 7); - ppsf = circshift (ifft2 (otf), [3 3]); - assert (otf2psf (otf, [6 6]), ppsf(:,1:6), 2.5e-16); -***** error otf2psf ("not a otf") -***** error otf2psf (rand_otf (16), 18) -***** error otf2psf (rand_otf (16), [14 18]) -***** error otf2psf (rand_otf (16), [18 18]) -***** error otf2psf (rand_otf (16, 1), 18) -***** test - psf = fspecial ("gaussian", 16); - otf = psf2otf (psf); - assert (otf2psf (otf), psf, eps); + Location | Observed | Expected | Reason + (1) 0.090909 20 Abs err 19.909 exceeds tol 0 by 2e+01 + (2) 0.18182 32 Abs err 31.818 exceeds tol 0 by 3e+01 + (3) 0.27273 57 Abs err 56.727 exceeds tol 0 by 6e+01 + (4) 0.36364 81 Abs err 80.636 exceeds tol 0 by 8e+01 + (5) 0.45455 105 Abs err 104.55 exceeds tol 0 by 1e+02 + (6) 0.54545 125 Abs err 124.45 exceeds tol 0 by 1e+02 + (7) 0.63636 150 Abs err 149.36 exceeds tol 0 by 1e+02 + (8) 0.72727 174 Abs err 173.27 exceeds tol 0 by 2e+02 + (9) 0.81818 198 Abs err 197.18 exceeds tol 0 by 2e+02 + (10) 0.90909 223 Abs err 222.09 exceeds tol 0 by 2e+02 + (11) 1 247 Abs err 246 exceeds tol 0 by 2e+02 ***** xtest - psf = rand (16); - otf = psf2otf (psf); - assert (otf2psf (otf), psf, 4*eps); -***** test - psf = rand (8); - otf = psf2otf (psf, [16 16]); - assert (otf2psf (otf, [8 8]), psf, 2*eps); -17 tests, 17 passed, 0 known failure, 0 skipped -[inst/rgb2xyz.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/rgb2xyz.m -***** assert (rgb2xyz ([0 0 0]), [0, 0, 0], 1e-3) -***** assert (rgb2xyz ([1 0 0]), [0.4125, 0.2127, 0.0193], 1e-3) -***** assert (rgb2xyz ([1 1 0]), [0.7700, 0.9278, 0.1385], 1e-3) -***** assert (rgb2xyz ([0 1 0]), [0.3576, 0.7152, 0.1192], 1e-3) -***** assert (rgb2xyz ([0 1 1]), [0.5380, 0.7873, 1.0694], 1e-3) -***** assert (rgb2xyz ([0 0 1]), [0.1804, 0.0722, 0.9502], 1e-3) -***** assert (rgb2xyz ([1 0 1]), [0.5929, 0.2848, 0.9696], 1e-3) -***** assert (rgb2xyz ([1 1 1]), [0.9505, 1.0000, 1.0888], 1e-3) -***** assert (rgb2xyz ([0.5 0.5 0.5]), [0.2034, 0.2140, 0.2330], 1e-3) -***** assert (rgb2xyz ([0.75 0 0]), [0.2155, 0.1111, 0.0101], 1e-3) -***** assert (rgb2xyz ([0.5 0 0]), [0.0883, 0.0455, 0.0041], 1e-3) -***** assert (rgb2xyz ([0.25 0 0]), [0.0210, 0.0108, 0.0010], 1e-3) -***** assert (rgb2xyz ([1 0.5 0.5]), [0.5276, 0.3812, 0.2482], 1e-3) -***** assert (rgb2xyz ([1.5 1 1]), [1.5845, 1.3269, 1.1185], 1e-3) -***** test - rgb_map = rand (64, 3); - assert (xyz2rgb (rgb2xyz (rgb_map)), rgb_map, 2e-5); -***** test - rgb_img = rand (64, 64, 3); - assert (xyz2rgb (rgb2xyz (rgb_img)), rgb_img, 2e-5); -***** assert (rgb2xyz (sparse ([0 0 0])), [0 0 0], 1e-3) -***** assert (rgb2xyz (sparse ([0 0 1])), [0.1804, 0.0722, 0.9502], 1e-3) -***** assert (rgb2xyz (uint8([255 255 255])), [0.9505, 1.0000, 1.0888], 1e-3) -***** assert (class (rgb2xyz (single([1 1 1]))), 'single') -***** error rgb2xyz () -***** error rgb2xyz (1,2) -***** error rgb2xyz ({1}) -***** error rgb2xyz (ones (2,2)) -***** test - rgb = rand (16, 16, 3, 5); - xyz = zeros (size (rgb)); - for i = 1:5 - xyz(:,:,:,i) = rgb2xyz (rgb(:,:,:,i)); - endfor - assert (rgb2xyz (rgb), xyz) -25 tests, 25 passed, 0 known failure, 0 skipped -[inst/imapplymatrix.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imapplymatrix.m -***** error id=Octave:invalid-fun-call imapplymatrix () -***** error id=Octave:invalid-fun-call imapplymatrix (42) -***** error id=Octave:invalid-input-arg imapplymatrix (ones (2, 2, 2), 42) -***** error id=Octave:invalid-input-arg imapplymatrix ([], ones (2, 2)) -***** error id=Octave:invalid-input-arg imapplymatrix (ones (0, 2), ones (2, 2)) -***** error id=Octave:invalid-input-arg imapplymatrix (ones (2, 0), ones (2, 2)) -***** error id=Octave:invalid-input-arg imapplymatrix (4, 2, [2, 2]) -***** error id=Octave:invalid-input-arg imapplymatrix (4, 2, [2, 2], "uint8") -***** error id=Octave:invalid-input-arg imapplymatrix (4, 2, 0, 666) -***** assert (imapplymatrix ([], []), []) -***** assert (imapplymatrix ([], [], "uint16"), uint16 ([])) -***** assert (imapplymatrix (1, 10, []), 10) -***** assert (imapplymatrix (1, 10, ones (0, 5)), 10) -***** assert (imapplymatrix (1, 10, ones (5, 0)), 10) -***** assert (imapplymatrix (ones (0), ones (0), 3), []) -***** assert (imapplymatrix (ones (0), ones (4, 0), 3), zeros (4, 0)) -***** assert (imapplymatrix (ones (0), ones (0, 4), 3), zeros (0, 4)) -***** assert (imapplymatrix (ones (2, 0), ones (0, 4), 3), zeros (0, 4)) -***** assert (imapplymatrix (ones (0, 2), ones (0, 4), 3), zeros (0, 4)) -***** assert (imapplymatrix (ones (0, 2), ones (0, 4, 0), 3), zeros (0, 4, 0)) -***** assert (imapplymatrix("a", ones(2, 2)), nan (2, 2)) -***** assert (imapplymatrix("abc", ones(2, 2)), nan (2, 2)) -***** assert (imapplymatrix (1, 10), 10) -***** assert (imapplymatrix (1, 10, 3), 13) -***** assert (imapplymatrix (ones (1), uint8 (10), 3), uint8 (13)) -***** assert (imapplymatrix (uint8 (ones (1)), 10, 3), double (13)) -***** assert (imapplymatrix (uint8 (ones (1)), uint8 (10), 3), uint8 (13)) -***** assert (imapplymatrix (2.6 * ones (1), uint8 (10), 4.7), uint8 (31)) -***** assert (imapplymatrix (42, ones (1, 2)), 42 * ones (1, 2)) -***** assert (imapplymatrix (42, ones (2, 1)), 42 * ones (2, 1)) -***** assert (imapplymatrix (42, ones (2, 2)), 42 * ones (2, 2)) -***** assert (imapplymatrix (42, ones (2, 2), 0.5), 42.5 * ones (2, 2)) -***** assert (imapplymatrix ([4, 2], ones (2, 2, 2), 0.5), 6.5 * ones (2, 2)) -***** assert (imapplymatrix ([4, 2; - 4, 2], ones (2, 2, 2), [0.5, 0.5]), 6.5 * ones (2, 2, 2)) -***** assert (imapplymatrix ([4, 2; - 4, 2], ones (2, 2, 2), [0.5; 0.5]), 6.5 * ones (2, 2, 2)) -***** assert (imapplymatrix ([1, 2, 3], ones (2, 2, 3)), 6 * ones (2, 2, 1)) -***** assert (imapplymatrix ([1, 2, 3], ones (2, 2, 3), 1), 7 * ones (2, 2, 1)) -***** test - expected = zeros (2, 2, 2, "uint8"); - expected(:, :, 1) = 7 * ones (2, 2); - expected(:, :, 2) = 16 * ones (2, 2); - I = uint8 (ones (2, 2, 3)); - assert (imapplymatrix ([1, 2, 3 - 4, 5, 6], I, [1, 1]), expected) -***** test - expected = zeros (2, 2, 2, 2, "uint16"); - expected(:, :, 1, 1) = 7 * ones (2, 2); - expected(:, :, 2, 1) = 16 * ones (2, 2); - expected(:, :, 1, 2) = 13 * ones (2, 2); - expected(:, :, 2, 2) = 31 * ones (2, 2); - I(:, :, :, 1) = uint16 (ones (2, 2, 3)); - I(:, :, :, 2) = 2 * uint16 (ones (2, 2, 3)); - assert (imapplymatrix ([1, 2, 3; - 4, 5, 6], I, [1, 1]), expected) -39 tests, 39 passed, 0 known failure, 0 skipped -[inst/nlfilter.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/nlfilter.m -***** demo - ## creates a "wide" diagonal (although it can be performed more - ## efficiently with "imdilate (A, true (3))") - nlfilter (eye (10), [3 3], @(x) any (x(:) > 0)) -***** assert (nlfilter (eye (4), [2 3], @(x) sum (x(:))), - [2 2 1 0 - 1 2 2 1 - 0 1 2 2 - 0 0 1 1]); -***** assert (nlfilter (eye (4), "indexed", [2 3], @(x) sum (x(:))), - [4 2 1 2 - 3 2 2 3 - 2 1 2 4 - 4 3 4 5]); -***** assert (nlfilter (eye (4), "indexed", [2 3], @(x, y) sum (x(:)) == y, 2), - logical ([0 1 0 1 - 0 1 1 0 - 1 0 1 0 - 0 0 0 0])); -***** assert (nlfilter (uint8 (eye (4)), "indexed", [2 3], @(x) sum (x(:))), - [2 2 1 0 - 1 2 2 1 - 0 1 2 2 - 0 0 1 1]); -***** assert (nlfilter (int16 (eye (4)), "indexed", [2 3], @(x) sum (x(:))), - [4 2 1 2 - 3 2 2 3 - 2 1 2 4 - 4 3 4 5]); -***** assert (nlfilter (uint8 (eye (4)), "indexed", [2 3], @(x) int8 (sum (x(:)))), - int8 ([2 2 1 0 - 1 2 2 1 - 0 1 2 2 - 0 0 1 1])); -***** test - ## Effect of out of border elements. - expected = [ - 0.5 6.0 6.0 0.5 0 - 5.5 10.5 13.5 10.5 4.0 - 6.5 12.5 13.5 13.5 1.5 - 10.5 12.5 15.5 11.0 1.0 - 5.0 10.5 6.0 1.0 0 - ]; - assert (nlfilter (magic (5), [3 4], @(x) median (x(:))), expected) -***** test - ## The center pixel of a sliding window when its length is even - ## sized is ceil ((size (NHOOD) +1) /2) - expected = [ - 24 24 24 16 16 - 24 24 24 22 22 - 23 23 22 22 22 - 25 25 25 25 22 - 25 25 25 25 21 - ]; - assert (nlfilter (magic (5), [3 4], @(x) max (x(:))), expected) -***** function dilated = imdilate_like_nlfilter (im, nhood) - even_nhood_dims = find (mod (size (nhood), 2) == 0); - for i = 1:even_nhood_dims - im = flip (im, i); - endfor - dilated = imdilate (im, nhood); - for i = 1:even_nhood_dims - dilated = flip (dilated, i); - endfor -***** endfunction -***** test - a = randi (65535, 20, 20, 20, "uint16"); - ## extra dimensions on matrix only - assert (nlfilter (a, [5 5], @(x) max(x(:))), imdilate (a, ones (5))) - ## extra dimensions on both matrix and block - assert (nlfilter (a, [5 5 5], @(x) max(x(:))), imdilate (a, ones ([5 5 5]))) - ## extra dimensions and padding - assert (nlfilter (a, [3 7], @(x) max(x(:))), imdilate (a, ones ([3 7]))) - assert (nlfilter (a, [3 7 3], @(x) max(x(:))), imdilate (a, ones ([3 7 3]))) -***** test - a = randi (65535, 15, 15, 4, 8, 3, "uint16"); - assert (nlfilter (a, [3 4 7 5], @(x) max(x(:))), - imdilate_like_nlfilter (a, ones ([3 4 7 5]))) + J = [0.0793650794 + 0.1269841270 + 0.2222222222 + 0.3174603175 + 0.4126984127 + 0.4920634921 + 0.5873015873 + 0.6825396825 + 0.7777777778 + 0.8730158730 + 1.0000000000]; + assert (histeq (0:0.1:1), J', 10^-8); +!!!!! known failure +ASSERT errors for: assert (histeq (0:0.1:1),J',10 ^ -8) + + Location | Observed | Expected | Reason + (1) 0.090909 0.079365 Abs err 0.011544 exceeds tol 1e-08 by 0.01 + (2) 0.18182 0.12698 Abs err 0.054834 exceeds tol 1e-08 by 0.05 + (3) 0.27273 0.22222 Abs err 0.050505 exceeds tol 1e-08 by 0.05 + (4) 0.36364 0.31746 Abs err 0.046176 exceeds tol 1e-08 by 0.05 + (5) 0.45455 0.4127 Abs err 0.041847 exceeds tol 1e-08 by 0.04 + (6) 0.54545 0.49206 Abs err 0.053391 exceeds tol 1e-08 by 0.05 + (7) 0.63636 0.5873 Abs err 0.049062 exceeds tol 1e-08 by 0.05 + (8) 0.72727 0.68254 Abs err 0.044733 exceeds tol 1e-08 by 0.04 + (9) 0.81818 0.77778 Abs err 0.040404 exceeds tol 1e-08 by 0.04 + (10) 0.90909 0.87302 Abs err 0.036075 exceeds tol 1e-08 by 0.04 +22 tests, 7 passed, 15 known failures, 0 skipped +[inst/imshowpair.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imshowpair.m +***** error id=Octave:invalid-fun-call imshowpair () +***** error id=Octave:invalid-fun-call imshowpair (1) +***** error id=Octave:invalid-input-arg imshowpair (uint8 (200.*rand (100)), ... + uint8 (200.*rand (100)), "interpolation") +***** error id=Octave:invalid-input-arg imshowpair (uint8 (200.*rand (100)), ... + uint8 (200.*rand (100)), "xxxxx") +***** error id=Octave:invalid-input-arg imshowpair (1, 1, "ColorChannels", [0 0 0]) +***** error id=Octave:invalid-input-arg imshowpair (1, 1, "ColorChannels", [1 1 1]) +***** error id=Octave:invalid-input-arg imshowpair (1, 1, "ColorChannels", [2 2 2]) +***** error id=Octave:expected-less-equal imshowpair (1, 1, "ColorChannels", [42 0 0]) +***** error id=Octave:expected-greater-equal imshowpair (1, 1, "ColorChannels", [-1 2 0]) +***** error id=Octave:invalid-input-arg imshowpair (1, 1, "ColorChannels", "deep-purple") ***** test - a = randi (65535, 15, 15, 4, 3, 8, "uint16"); - ord = ordfiltn (a, 3, ones ([3 7 3 1 5])); - assert (nlfilter (a, [3 7 3 1 5], @(x) sort (x(:))(3)), ord) - assert (nlfilter (a, [3 7 3 1 5], @(x, y) sort (x(:))(y), 3), ord) + A = uint8 (200.*rand (100)); + B = uint8 (150.*rand (100)); + RA = imref2d (size (A), 0.5, 0.5); + RB = imref2d (size (B), 0.5, 0.5); + figure; + Ax=axes; + assert (imshowpair (A, B)); + assert (imshowpair (A, RA, B, RB)); + assert (imshowpair (A, B, "blend")); + assert (imshowpair (A, B, "falsecolor", "ColorChannels", "red-cyan")); + assert (imshowpair (A, B, "Parent", Ax)); + assert (imshowpair (A, B, "montage", "Scaling", "joint")); + close; 11 tests, 11 passed, 0 known failure, 0 skipped -[inst/ordfilt2.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/ordfilt2.m -***** test - order = 3; - domain = ones (3); - A = zeros (3,3); - B = ones (3,3); - C = [1 1 1; 2 2 2; 3 3 3]; - D = C'; - E = ones (3,3); - E(2,2) = 2; - F = 3 .* ones (3,3); - F(2,2) = 1; - G = [-1 2 7; -5 2 8; -7 pi 9]; - H = [5 2 8; 1 -3 1; 5 1 0]; - A_out = [0 0 0; 0 0 0; 0 0 0]; - B_out = [0 0 0; 0 1 0; 0 0 0]; - C_out = [0 0 0; 0 1 0; 0 0 0]; - D_out = [0 0 0; 0 1 0; 0 0 0]; - E_out = [0 0 0; 0 1 0; 0 0 0]; - F_out = [0 0 0; 0 3 0; 0 0 0]; - G_out = [0 0 0; -1 -1 0; 0 0 0]; - H_out = [0 0 0; 0 1 0; 0 0 0]; - assert (ordfilt2 (A, order, domain), A_out); - assert (ordfilt2 (B, order, domain), B_out); - assert (ordfilt2 (C, order, domain), C_out); - assert (ordfilt2 (D, order, domain), D_out); - assert (ordfilt2 (E, order, domain), E_out); - assert (ordfilt2 (F, order, domain), F_out); - assert (ordfilt2 (G, order, domain), G_out); - assert (ordfilt2 (H, order, domain), H_out); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/imimposemin.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imimposemin.m -***** shared im0, bw0, out0, out0_4 - im0 = uint8 ([5 5 5 5 5; - 5 4 3 4 5; - 5 3 0 3 5; - 5 4 3 4 5; - 5 5 5 5 5]); - bw0 = false (5); - bw0(4, 4) = true; - out0 = im0 + 1; - out0(4, 4) = 0; - out0_4 = out0; - out0_4(3, 3) = 4; -***** error imimposemin () -***** error imimposemin (im0) -***** error imimposemin ("hello", bw0) -***** error imimposemin (i.*im0, bw0) -***** error imimposemin (sparse (im0), bw0) -***** error imimposemin (im0, ones (2)) -***** error imimposemin (im0, 'hello') -***** error imimposemin (im0, i .* double (bw0)) -***** error imimposemin (im0, sparse (bw0)) -***** error imimposemin (im0, bw0, 'hello') -***** error imimposemin (im0, bw0, 3) -***** assert (imimposemin (im0, bw0), out0) -***** assert (imimposemin (im0, bw0, 8), out0) -***** assert (imimposemin (im0, bw0, 4), out0_4) -***** assert (imimposemin (im0, bw0, true (3)), out0) -***** test - out = imimposemin (im0, bw0); - assert (size (out), size (im0)) - assert (class (out), "uint8") -***** test - out = imimposemin (double (im0), bw0); - assert (size (out), size (im0)) - assert (class (out), "double") -***** test - out = imimposemin (single (im0), bw0); - assert (size (out), size (im0)) - assert (class (out), "single") -***** test - out = imimposemin (uint16 (im0), bw0); - assert (size (out), size (im0)) - assert (class (out), "uint16") -***** test - im = cat (3, im0, im0, im0, im0); - bw = cat (3, bw0, bw0, bw0, bw0); - out = imimposemin (im, bw); - assert (size (out), size (im)) -***** test - expected_double = double (im0); - expected_double += 0.005; - expected_double(4, 4) = -inf; - out = imimposemin (double (im0), bw0); - assert (out, expected_double, eps) -***** test - im = uint8 (10 .* ones (10)); - im(6:8, 6:8) = 2; - im(2:4, 2:4) = 7; - im(3, 3) = 5; - im(2, 9) = 9; - im(3, 8) = 9; - im(9, 2) = 9; - im(8, 3) = 9; - bw = false (10); - bw(3, 3) = true; - bw(6:8, 6:8) = true; - expected = uint8 (11 .* ones(10)); - expected(2:4, 2:4) = 8; - expected(3, 3) = 0; - expected(6:8, 6:8) = 0; - expected_double = double (expected); - expected_double -= 0.992; - expected_double (expected_double < 0) = -inf; - out = imimposemin (im, bw); - assert (out, expected, eps) - out = imimposemin (double (im), bw); - assert (out, expected_double, eps) -22 tests, 22 passed, 0 known failure, 0 skipped -[inst/getrangefromclass.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/getrangefromclass.m -***** shared img - img = ones (5); -***** assert (getrangefromclass (double (img)), [0 1]); # double returns [0 1] -***** assert (getrangefromclass (single (img)), [0 1]); # single returns [0 1] -***** assert (getrangefromclass (logical (img)), [0 1]); # logical returns [0 1] -***** assert (getrangefromclass (int8 (img)), [-128 127]); # checks int -***** assert (getrangefromclass (uint8 (img)), [0 255]); # checks unit -***** fail ("getrangefromclass ('string')"); # fails with strings -***** fail ("getrangefromclass ({3, 4})"); # fails with cells -7 tests, 7 passed, 0 known failure, 0 skipped [inst/graythresh.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/graythresh.m ***** shared img, histo @@ -12875,946 +10566,563 @@ H(1) = 100; assert (graythresh (H), 0) 12 tests, 12 passed, 0 known failure, 0 skipped -[inst/imsubtract.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imsubtract.m -***** assert (imsubtract (uint8 ([23 250]), uint8 ([24 50])), uint8 ([ 0 200])); # default to first class and truncate -***** assert (imsubtract (uint8 ([23 250]), 10), uint8 ([13 240])); # works subtracting a scalar -***** assert (imsubtract (uint8 ([23 250]), uint8 ([24 50]), "uint16"), uint16 ([ 0 200])); # defining output class works (not in matlab) -***** assert (imsubtract (logical ([ 1 0]), logical ([ 1 1])), double ([ 0 -1])); # return double for two logical images -***** assert (imsubtract (logical ([ 1 0]), logical ([ 1 1]), "logical"), logical ([ 0 0])); # this is matlab incompatible on purpose -***** error imsubtract (uint8 ([23 250]), uint16 ([23 250])); -***** warning imsubtract (uint8 ([23 250]), uint8 ([24 255]), "int8"); +[inst/colorangle.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/colorangle.m +***** error id=Octave:invalid-fun-call colorangle () +***** error id=Octave:invalid-fun-call colorangle (1, 2, 3) +***** error colorangle (2, 3) +***** error colorangle ([1, 2], [3, 4]) +***** error id=Octave:expected-real colorangle ([1, 2, 3j], [4, 5, 6]) +***** error id=Octave:expected-real colorangle ([1, 2, 3], [4j, 5, 6]) +***** error id=Octave:invalid-type colorangle ("abc", "def") ***** test - warning ("off", "all"); - assert (imsubtract (uint8 ([23 250]), uint8 ([24 255]), "int8"), - int8 ([-1 0])) -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/makelut.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/makelut.m + assert (colorangle ([0 0 0], [0 1 0]), NaN) + assert (colorangle ([0 0 0], [0 1 1]), NaN) + assert (colorangle ([0 1 0], [0 0 0]), NaN) + assert (colorangle ([1 1 0], [0 0 0]), NaN) + assert (colorangle ([1 1 1], [1 1 1]), 0) +***** assert (colorangle ([0 0 0], [0 0 0]), 0) +***** assert (colorangle ([1 0 0], [-1 0 0]), 180) +***** assert (colorangle ([0 0 1], [1 0 0]), 90) +***** assert (colorangle ([0; 0; 1], [1 0 0]), 90) +***** assert (colorangle ([0, 0, 1], [1; 0; 0]), 90) +***** assert (colorangle ([0.5 0.61237 -0.61237], [0.86603 0.35355 -0.35355]), 30.000270917, 1e-4) +***** assert (colorangle ([0.1582055390, 0.2722362096, 0.1620813305], [0.0717 0.1472 0.0975]), 5.09209927, 1e-6) +***** assert (colorangle ([0.0659838500, 0.1261619536, 0.0690643667], [0.0717 0.1472 0.0975]), 5.10358588, 1e-6) +***** assert (colorangle ([0.436871170, 0.7794672250, 0.4489702582], [0.0717 0.1472 0.0975]), 5.01339769, 1e-6) +***** test + a = [1 0 0]; + b = [1 1 0]; + expected = colorangle (a, b); + assert (colorangle (a.', b.'), expected) + assert (colorangle (a, b.'), expected) + assert (colorangle (a.', b), expected) + assert (colorangle (vec (a, 3), b.'), expected) +***** assert (colorangle ([1 0 0; 0 1 1], [1 1 1; 2 3 4]), + [colorangle([1 0 0], [1 1 1]); colorangle([0 1 1], [2 3 4])]) +***** test + a = [1 0 0; 0.5 1 0; 0 1 1; 1 1 1]; + b = [0 1 0]; + expected = zeros (4, 1); + for i = 1:4 + expected(i) = colorangle (a(i,:), b); + endfor + assert (colorangle (a, b), expected) + assert (colorangle (b, a), expected) +***** xtest + a = [1 2 3]; + b = [2 3 4]; + c = [5 6 7]; + d = [3 1 1]; + + ac = colorangle (c, a); + bc = colorangle (b, c); + ad = colorangle (a, d); + bd = colorangle (b, d); + + assert (colorangle (a, cat (3, c, d)), + cat (3, [ac ad])) + + assert (colorangle (cat (3, a, b), cat (3, c, d)), + cat (3, [ac cd])) + + assert (colorangle (cat (1, a, b), cat (3, c, d)), + reshape ([ac bc ad bd], [2 2])) +!!!!! known failure +dot: sizes of X and Y must match +21 tests, 20 passed, 1 known failure, 0 skipped +[inst/bwmorph.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwmorph.m ***** demo - makelut(@(x) sum(x(:))>=3, 2) - % Returns '1' if one or more values - % in the input matrix are 1 -***** assert(prod(makelut(@(x) sum(x(:))==2, 2)==makelut(@(x, a, b, c, d) sum(x(:))==a*b*c*d,2,2/(3*4*5),3,4,5))); # test multiple params -***** assert(prod(makelut(@(x) x(1,1)==1, 2)==[zeros(2^3,1);ones(2^3,1)])==1); # test 2-by-2 -***** assert(prod(makelut(@(x) x(1,1)==1, 3)==[zeros(2^8,1);ones(2^8,1)])==1); # test 3-by-3 -***** assert(prod(makelut(@(x) x(1,1)==1, 4)==[zeros(2^15,1);ones(2^15,1)])==1); # test 4-by-4 -***** assert(prod(makelut(@(x) x(2,1)==1, 3)==[zeros(2^7,1);ones(2^7,1);zeros(2^7,1);ones(2^7,1)])==1); # another test for 3-by-3 -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/imsmooth.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imsmooth.m + bwmorph (true (11), "shrink", Inf) + # Should return 0 matrix with 1 pixel set to 1 at (6,6) ***** test - ## checking Bilateral Filter + slBW = logical ([ 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 + 0 0 1 1 0 0 0 + 0 0 1 1 0 0 0 + 0 0 1 1 1 0 0 + 0 0 1 1 1 0 0 + 0 1 1 1 1 1 0 + 0 1 1 1 1 1 0 + 0 1 1 1 1 1 0 + 0 1 1 1 1 1 0 + 0 1 1 1 1 1 0 + 0 0 0 0 0 0 0]); - ## constant image remain the same after Bilateral Filter - A = uint8(255*ones(128,128)); - B = uint8(imsmooth(A, 'Bilateral', 2, 10)); - assert (A,B); + rslBW = logical ([ 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 + 0 0 1 1 0 0 0 + 0 0 1 1 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 1 0 0 0 + 0 0 0 1 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 1 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0]); + assert (bwmorph (slBW, "skel-lantuejoul", 1), [rslBW(1:5,:); false(7, 7)]); + assert (bwmorph (slBW, "skel-lantuejoul", 2), [rslBW(1:8,:); false(4, 7)]); + assert (bwmorph (slBW, "skel-lantuejoul", 3), rslBW); + assert (bwmorph (slBW, "skel-lantuejoul", Inf), rslBW); +***** test + bw = [ + 0 1 1 1 1 1 + 0 1 1 1 1 1 + 0 1 1 1 1 1 + 1 1 1 1 1 1 + 1 1 1 1 1 1 + 1 1 1 1 1 1 + 1 1 1 1 1 0 + 1 1 1 1 1 0 + 1 1 1 1 1 0]; - ## Bilateral Filter does not smear outlayers - A = zeros(256,256); - A(128,128) = 256; - ## bilateral filter does not smear outlayers - B = imsmooth(A, 'Bilateral', 2, 10); - assert (A,B,1.e-140); + final = logical ([ + 0 1 0 0 0 1 + 0 0 1 0 1 0 + 0 0 0 1 0 0 + 0 0 0 1 0 0 + 0 0 1 1 0 0 + 0 0 1 0 0 0 + 0 0 1 0 0 0 + 0 1 0 1 0 0 + 1 0 0 0 1 0]); + assert (bwmorph (bw, "skel", Inf), final) + assert (bwmorph (bw, "skel", 3), final) +***** error bwmorph ("not a matrix", "dilate") +***** assert (bwmorph (magic (10), "dilate"), imdilate (logical (magic (10)), ones (3))); +***** test + in = logical ([1 1 0 0 1 0 1 0 0 0 1 1 1 0 1 1 0 1 0 0 + 1 1 1 0 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 + 0 1 1 1 0 1 1 0 0 0 1 1 0 0 1 1 0 0 1 0 + 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 + 0 1 0 0 1 1 0 1 1 0 0 0 0 0 1 1 0 0 1 0 + 0 0 1 1 1 1 1 0 0 1 0 1 1 1 0 0 1 0 0 1 + 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 0 0 1 0 0 + 1 0 1 1 1 0 1 1 0 1 0 0 1 1 1 0 0 1 0 0 + 1 0 1 1 1 0 1 0 0 1 0 0 1 1 0 0 1 1 1 0 + 1 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 + 1 1 1 1 1 1 0 1 0 1 0 0 0 0 0 0 1 0 1 1 + 0 1 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 + 0 0 1 1 0 1 1 1 1 0 0 1 0 0 0 0 1 0 1 1 + 0 0 1 1 0 0 1 1 1 0 0 0 1 1 1 1 0 0 0 0 + 0 0 1 0 0 0 0 0 0 1 0 0 1 1 1 1 0 0 0 0 + 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 0 + 0 1 0 0 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 + 1 0 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 1 1 1 + 0 0 1 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 1 1 + 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 0 1]); + se = strel ("arbitrary", ones (3)); - ## When sigma_r is large the filter behaves almost - ## like the isotropic Gaussian filter + assert (bwmorph (in, "dilate"), imdilate (in, se)); + assert (bwmorph (in, "dilate", 3), imdilate (imdilate (imdilate (in, se), se), se)); + assert (bwmorph (in, "bothat"), imbothat (in, se)); + assert (bwmorph (in, "tophat"), imtophat (in, se)); + assert (bwmorph (in, "open"), imopen (in, se)); + assert (bwmorph (in, "close"), imclose (in, se)); +***** assert (bwmorph ([1 0 0; 1 0 1; 0 0 1], "bridge"), logical ([1 1 0; 1 1 1; 0 1 1])); +***** assert (bwmorph ([0 0 0; 1 0 1; 0 0 1], "clean"), logical ([0 0 0; 0 0 1; 0 0 1])); +***** assert (bwmorph ([0 0 0; 0 1 0; 0 0 0], "clean"), false (3)); +***** assert (bwmorph ([0 1 0; 1 0 0; 0 0 0], "diag"), logical ([1 1 0; 1 1 0; 0 0 0])); +***** test + in = logical ([0 1 0 1 0 + 1 1 1 0 1 + 1 0 0 1 0 + 1 1 1 0 1 + 1 1 1 1 1]); + out = logical ([0 1 0 1 0 + 1 1 1 1 1 + 1 0 0 1 0 + 1 1 1 1 1 + 1 1 1 1 1]); + assert (bwmorph (in, "fill"), out); +***** assert (bwmorph ([1 1 1; 0 1 0; 1 1 1], "hbreak"), logical ([1 1 1; 0 0 0; 1 1 1])); +***** test + in = logical ([0 1 0 0 0 + 1 0 0 1 0 + 1 0 1 0 0 + 1 1 1 1 1 + 1 1 1 1 1]); - A0 = fspecial ('gaussian',100,100); - A = uint8(A0/max(max(A0))*255); - B1 = imsmooth(A, 'Bilateral', 2, 100); - B2 = imsmooth(A, 'Gaussian', 2); - assert (B1,B2); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/lab2xyz.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2xyz.m -***** assert (lab2xyz ([0, 0, 0]), [0 0 0], 1e-3) -***** assert (lab2xyz ([53.24, 80.09, 67.20]), [0.4125, 0.2127, 0.0193], 1e-3) -***** assert (lab2xyz ([97.14, -21.55, 94.48]), [0.7700, 0.9278, 0.1385], 1e-3) -***** assert (lab2xyz ([87.74, -86.18, 83.18]), [0.3576, 0.7152, 0.1192], 1e-3) -***** assert (lab2xyz ([91.11, -48.09, -14.13]), [0.5380, 0.7873, 1.0694], 1e-3) -***** assert (lab2xyz ([32.30, 79.19, -107.86]), [0.1804, 0.07217, 0.9502], 1e-3) -***** assert (lab2xyz ([60.32, 98.24, -60.83]), [0.5929, 0.28484, 0.9696], 1e-3) -***** assert (lab2xyz ([100, 0.00, 0.00]), [0.9505, 1.0000, 1.0888], 1e-3) -***** assert (lab2xyz ([53.39, 0.00, 0.00]), [0.2034, 0.2140, 0.2330], 1e-3) -***** assert (lab2xyz ([39.77, 64.51, 54.13]), [0.2155, 0.1111, 0.0101], 1e-3) -***** assert (lab2xyz ([25.42, 47.91, 37.91]), [0.0883, 0.0455, 0.0041], 1e-3) -***** assert (lab2xyz ([9.66, 29.68, 15.24]), [0.02094, 0.0108, 0.00098], 1e-3) -***** assert (lab2xyz ([68.11, 48.39, 22.83]), [0.5276, 0.3812, 0.2482], 1e-3) -***** assert (lab2xyz ([150 130 130]), [4.596, 2.931, 0.519], 1e-3) + out = logical ([0 1 0 0 0 + 1 0 0 1 0 + 1 0 1 0 0 + 1 1 0 1 1 + 1 1 1 1 1]); + assert (bwmorph (in, "remove"), out); + + out = logical ([0 1 0 0 0 + 1 0 0 1 0 + 1 0 1 0 0 + 1 1 0 1 1 + 1 1 1 1 1]); + assert (bwmorph (in, "remove", Inf), out); +***** xtest + ## tests for spur are failing (matlab incompatible) + in = logical ([0 1 0 0 0 + 1 0 0 1 0 + 1 0 1 0 0 + 1 1 1 1 1 + 1 1 1 1 1]); + + out = logical ([0 1 0 0 0 + 1 0 0 0 0 + 1 0 1 0 0 + 1 1 1 1 1 + 1 1 1 1 1]); + assert (bwmorph (in, "spur"), out); + + out = logical ([0 1 0 0 0 + 1 0 0 0 0 + 1 0 0 0 0 + 1 1 1 1 1 + 1 1 1 1 1]); + assert (bwmorph (in, "spur", Inf), out); +!!!!! known failure +ASSERT errors for: assert (bwmorph (in, "spur"),out) + + Location | Observed | Expected | Reason + (1,2) 0 1 Abs err 1 exceeds tol 0 by 1 ***** test - lab_map = rand (64, 3); - lab_map(:,1) = lab_map(:,1) .* 100; - lab_map(:,2) = lab_map(:,2) .* 254 - 127; - lab_map(:,3) = lab_map(:,3) .* 254 - 127; - assert (xyz2lab (lab2xyz (lab_map)), lab_map, 1e-5); + bw = false (3, 3); + bw(3, 1) = true; + out = bwmorph (bw, "thicken", 0); + assert (out, bw) ***** test - lab_img = rand (64, 64, 3); - lab_img(:,:,1) = lab_img(:,:,1) .* 100; - lab_img(:,:,2) = lab_img(:,:,2) .* 254 - 127; - lab_img(:,:,3) = lab_img(:,:,3) .* 254 - 127; - assert (xyz2lab (lab2xyz (lab_img)), lab_img, 1e-5); -***** assert (lab2xyz (sparse ([0 0 0])), [0 0 0], 1e-3) -***** assert (lab2xyz (sparse ([100, 0.00, 0.00])), [0.9505, 1.0000, 1.0888], 1e-3) -***** assert (class (lab2xyz (single([50 50 50]))), 'single') -***** error lab2xyz () -***** error lab2xyz (1,2) -***** error lab2xyz ({1}) -***** error lab2xyz (ones (2,2)) + bw = false (8, 7); + bw(8, 1) = true; + expected = logical ([ + 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 + 1 1 0 0 0 0 0 + 1 1 1 0 0 0 0 + 1 1 1 1 0 0 0 + 1 1 1 1 1 0 0 + 1 1 1 1 1 1 0 + 1 1 1 1 1 1 1]); + out = bwmorph (bw, "thicken", 6); + assert (out, expected) ***** test - lab = rand (16, 16, 3, 5); - lab(:,:,1,:) = lab(:,:,1,:) .* 100; - lab(:,:,2,:) = lab(:,:,2,:) .* 254 - 127; - lab(:,:,3,:) = lab(:,:,3,:) .* 254 - 127; - xyz = zeros (size (lab)); - for i = 1:5 - xyz(:,:,:,i) = lab2xyz (lab(:,:,:,i)); - endfor - assert (lab2xyz (lab), xyz) -24 tests, 24 passed, 0 known failure, 0 skipped -[inst/imgetfile.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imgetfile.m -***** assert (1) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/findbounds.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/findbounds.m + bw = false (8, 7); + bw(2, 4) = true; + expected = logical ([ + 0 0 1 1 1 0 0 + 0 1 1 1 1 1 0 + 0 0 1 1 1 0 0 + 0 0 0 1 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0]); + out = bwmorph (bw, "thicken", 2); + assert (out, expected) ***** test - im = checkerboard (); - theta = pi/6; - T = maketform ('affine', [cos(theta) -sin(theta); ... - sin(theta) cos(theta); 0 0]); - inbnd = [0 0; 1 1]; - outbnd = findbounds (T, inbnd); - diag = 2^.5; - ang = pi/4; - assert (diff (outbnd(:,1)), diag * abs (cos (theta - ang)), eps) - assert (diff (outbnd(:,2)), diag * abs (cos (theta - ang)), eps) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/iptnum2ordinal.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/iptnum2ordinal.m -***** assert (strcmp (iptnum2ordinal (1), 'first')); # simple works -***** assert (strcmp (iptnum2ordinal (21), '21st')); # after 20, goes stupid -***** assert (strcmp (iptnum2ordinal (100), '100th')); # use th correctly -***** fail ("iptnum2ordinal (inf)"); # must be real -***** fail ("iptnum2ordinal (0)"); # must be positive -***** fail ("iptnum2ordinal (-1)"); # must be positive -***** fail ("iptnum2ordinal (3.4)"); # must be integer -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/@imref3d/imref3d.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref3d/imref3d.m -***** error id=Octave:invalid-fun-call imref3d (1, 2, 3, 4, 5) -***** error id=Octave:incorrect-size imref3d (42) -***** error id=Octave:incorrect-size imref3d ([42]) -***** error id=Octave:incorrect-size imref3d ([4, 2]) -***** error id=Octave:incorrect-size imref3d ([4, 2, 3, 3]) -***** error id=Octave:expected-integer imref3d ([4.2, 42]) -***** error id=Octave:expected-positive imref3d ([0, 0]) -***** error id=Octave:expected-positive imref3d ([-4, 2]) -***** error id=Octave:expected-positive imref3d ([4, 2, 3], 0, 1, 2) -***** error id=Octave:expected-positive imref3d ([4, 2, 3], 1, 0, 2) -***** error id=Octave:expected-positive imref3d ([4, 2, 3], 1, 2, 0) -***** error id=Octave:expected-real imref3d ([4, 2, 3], j, 1, 2) -***** error id=Octave:expected-real imref3d ([4, 2, 3], 1, j, 2) -***** error id=Octave:expected-real imref3d ([4, 2, 3], 1, 2, j) -***** error id=Octave:expected-real imref3d ([4, 2, 3], [j, 2], [3, 4], [5, 6]) -***** error id=Octave:expected-real imref3d ([4, 2, 3], [1, 2], [j, 4], [5, 6]) -***** error id=Octave:expected-real imref3d ([4, 2, 3], [1, 2], [3, 4], [5, j]) -***** error id=Octave:expected-vector imref3d ([4, 2, 3], [], [], []) -***** error id=Octave:expected-vector imref3d ([4, 2, 3], [], [1], [2]) -***** error id=Octave:expected-scalar imref3d ([4, 2, 3], [1], [], []) -***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1, 2], [3, 4], [0]) -***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1, 2], [3, 4, 5], [6, 7]) -***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1, 2], [3, 4], [5, 6, 7]) -***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1; 2], [3, 4], [5, 6]) -***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1, 2], [3; 4], [5, 6]) -***** error id=Octave:incorrect-size imref3d ([4, 2, 3], [1, 2], [3, 4], [5; 6]) -***** error id=Octave:invalid-indexing imref3d().InvalidProperty -***** error id=Octave:expected-increasing imref3d ([100, 200, 3], [1.5 0.5], [2.5, 3.5], [0.5, 1.5]) -***** error id=Octave:expected-increasing imref3d ([100, 200, 3], [1.5 2.5], [2.5, 1.5], [0.5, 1.5]) -***** error id=Octave:expected-increasing imref3d ([100, 200, 3], [1.5 2.5], [2.5, 3.5], [1.5, 0.5]) -***** assert (imref3d ([4, 2, 3]).ImageSize, [4, 2, 3]) -***** test - r = imref3d; - assert (r.XWorldLimits, [0.5, 2.5]) - assert (r.YWorldLimits, [0.5, 2.5]) - assert (r.ZWorldLimits, [0.5, 2.5]) - assert (r.ImageSize, [2, 2, 2]) - assert (r.PixelExtentInWorldX, 1) - assert (r.PixelExtentInWorldY, 1) - assert (r.PixelExtentInWorldZ, 1) - assert (r.ImageExtentInWorldX, 2) - assert (r.ImageExtentInWorldY, 2) - assert (r.ImageExtentInWorldZ, 2) - assert (r.XIntrinsicLimits, [0.5, 2.5]) - assert (r.YIntrinsicLimits, [0.5, 2.5]) - assert (r.ZIntrinsicLimits, [0.5, 2.5]) -***** test - r = imref3d ([128, 128, 27]); - assert (r.XWorldLimits, [0.5, 128.5]) - assert (r.YWorldLimits, [0.5, 128.5]) - assert (r.ZWorldLimits, [0.5, 27.5]) - assert (r.ImageSize, [128, 128, 27]) - assert (r.PixelExtentInWorldX, 1) - assert (r.PixelExtentInWorldY, 1) - assert (r.PixelExtentInWorldZ, 1) - assert (r.ImageExtentInWorldX, 128) - assert (r.ImageExtentInWorldY, 128) - assert (r.ImageExtentInWorldZ, 27) - assert (r.XIntrinsicLimits, [0.5, 128.5]) - assert (r.YIntrinsicLimits, [0.5, 128.5]) - assert (r.ZIntrinsicLimits, [0.5, 27.5]) -***** test - r = imref3d ([128, 128, 27], 2, 2, 4); - assert (r.XWorldLimits, [1, 257]) - assert (r.YWorldLimits, [1, 257]) - assert (r.ZWorldLimits, [2, 110]) - assert (r.ImageSize, [128, 128, 27]) - assert (r.PixelExtentInWorldX, 2) - assert (r.PixelExtentInWorldY, 2) - assert (r.PixelExtentInWorldZ, 4) - assert (r.ImageExtentInWorldX, 256) - assert (r.ImageExtentInWorldY, 256) - assert (r.ImageExtentInWorldZ, 108) - assert (r.XIntrinsicLimits, [0.5, 128.5]) - assert (r.YIntrinsicLimits, [0.5, 128.5]) - assert (r.ZIntrinsicLimits, [0.5, 27.5]) -***** test - r = imref3d; - assert (r.XWorldLimits, [0.5, 2.5]) - assert (r.YWorldLimits, [0.5, 2.5]) - assert (r.ZWorldLimits, [0.5, 2.5]) - assert (r.ImageSize, [2, 2, 2]) - assert (r.PixelExtentInWorldX, 1) - assert (r.PixelExtentInWorldY, 1) - assert (r.PixelExtentInWorldZ, 1) - assert (r.ImageExtentInWorldX, 2) - assert (r.ImageExtentInWorldY, 2) - assert (r.ImageExtentInWorldZ, 2) - assert (r.XIntrinsicLimits, [0.5, 2.5]) - assert (r.YIntrinsicLimits, [0.5, 2.5]) - assert (r.ZIntrinsicLimits, [0.5, 2.5]) - r.ImageSize = [128, 128, 27]; - assert (r.XWorldLimits, [0.5, 2.5]) - assert (r.YWorldLimits, [0.5, 2.5]) - assert (r.ZWorldLimits, [0.5, 2.5]) - assert (r.ImageSize, [128, 128, 27]) - assert (r.PixelExtentInWorldX, 0.015625, 1e-6) - assert (r.PixelExtentInWorldY, 0.015625, 1e-6) - assert (r.PixelExtentInWorldZ, 0.074074, 1e-6) - assert (r.ImageExtentInWorldX, 2) - assert (r.ImageExtentInWorldY, 2) - assert (r.ImageExtentInWorldZ, 2) - assert (r.XIntrinsicLimits, [0.5, 128.5]) - assert (r.YIntrinsicLimits, [0.5, 128.5]) - assert (r.ZIntrinsicLimits, [0.5, 27.5]) -***** test - r = imref3d; - assert (r.XWorldLimits, [0.5, 2.5]) - assert (r.YWorldLimits, [0.5, 2.5]) - assert (r.ZWorldLimits, [0.5, 2.5]) - assert (r.ImageSize, [2, 2, 2]) - assert (r.PixelExtentInWorldX, 1) - assert (r.PixelExtentInWorldY, 1) - assert (r.PixelExtentInWorldZ, 1) - assert (r.ImageExtentInWorldX, 2) - assert (r.ImageExtentInWorldY, 2) - assert (r.ImageExtentInWorldZ, 2) - assert (r.XIntrinsicLimits, [0.5, 2.5]) - assert (r.YIntrinsicLimits, [0.5, 2.5]) - assert (r.ZIntrinsicLimits, [0.5, 2.5]) - r.XWorldLimits = [-60, 13.33]; - r.YWorldLimits = [-900.8, -560.26]; - r.ZWorldLimits = [-302.48, 1500.333]; - assert (r.XWorldLimits, [-60, 13.33]) - assert (r.YWorldLimits, [-900.8, -560.26]) - assert (r.ZWorldLimits, [-302.48, 1500.333]) - assert (r.ImageSize, [2, 2, 2]) - assert (r.PixelExtentInWorldX, 36.6650) - assert (r.PixelExtentInWorldY, 170.27, 1e-5) - assert (r.PixelExtentInWorldZ, 901.4065) - assert (r.ImageExtentInWorldX, 73.33, 1e-5) - assert (r.ImageExtentInWorldY, 340.54, 1e-5) - assert (r.ImageExtentInWorldZ, 1802.813, 1e-5) - assert (r.XIntrinsicLimits, [0.5, 2.5]) - assert (r.YIntrinsicLimits, [0.5, 2.5]) - assert (r.ZIntrinsicLimits, [0.5, 2.5]) -***** test - r = imref3d; - fail ("r.XWorldLimits = []", "") - fail ("r.XWorldLimits = [1]", "") - fail ("r.XWorldLimits = [j]", "") - fail ("r.XWorldLimits = [1; 2]", "") - fail ("r.YWorldLimits = []", "") - fail ("r.YWorldLimits = [1]", "") - fail ("r.YWorldLimits = [j]", "") - fail ("r.YWorldLimits = [1; 2]", "") - fail ("r.ZWorldLimits = []", "") - fail ("r.ZWorldLimits = [1]", "") - fail ("r.ZWorldLimits = [j]", "") - fail ("r.ZWorldLimits = [1; 2]", "") -37 tests, 37 passed, 0 known failure, 0 skipped -[inst/@imref3d/worldToIntrinsic.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref3d/worldToIntrinsic.m -***** error id=Octave:invalid-fun-call worldToIntrinsic (imref3d) -***** error id=Octave:invalid-fun-call worldToIntrinsic (imref3d, 1, 2) -***** error id=Octave:invalid-fun-call worldToIntrinsic (imref3d, 1, 2, 3, 4) -***** error id=Octave:expected-real worldToIntrinsic (imref3d, 1j, 2, 3) -***** error id=Octave:expected-real worldToIntrinsic (imref3d, 1, 2j, 3) -***** error id=Octave:expected-real worldToIntrinsic (imref3d, 1, 2, 3j) -***** error id=Octave:invalid-input-arg worldToIntrinsic (imref3d, [1, 2], 3, 4) -***** error id=Octave:invalid-input-arg worldToIntrinsic (imref3d, 1, [2, 3], 4) -***** error id=Octave:invalid-input-arg worldToIntrinsic (imref3d, 1, 2, [3, 4]) -***** test - r = imref3d ([128, 128, 27], 2, 2, 4); - xW = [108, 108, 108.2, 2]; - yW = [92, 92, 92, -1]; - zW = [52, 55, 52, 0.33]; - [xI, yI, zI] = worldToIntrinsic (r, xW, yW, zW); - assert (xI, [54, 54, 54.1, 1], 1e-6) - assert (yI, [46, 46, 46, -0.5], 1e-6) - assert (zI, [13, 13.75, 13, 0.0825], 1e-6) -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/@imref3d/intrinsicToWorld.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref3d/intrinsicToWorld.m -***** error id=Octave:invalid-fun-call intrinsicToWorld (imref3d) -***** error id=Octave:invalid-fun-call intrinsicToWorld (imref3d, 1) -***** error id=Octave:invalid-fun-call intrinsicToWorld (imref3d, 1, 2) -***** error id=Octave:invalid-fun-call intrinsicToWorld (imref3d, 1, 2, 3, 4) -***** error id=Octave:expected-real intrinsicToWorld (imref3d, 1j, 2, 3) -***** error id=Octave:expected-real intrinsicToWorld (imref3d, 1, 2j, 3) -***** error id=Octave:expected-real intrinsicToWorld (imref3d, 1, j, 3j) -***** error id=Octave:invalid-input-arg intrinsicToWorld (imref3d, [1, 2], 3, 4) -***** error id=Octave:invalid-input-arg intrinsicToWorld (imref3d, 1, [2, 3], 4) -***** error id=Octave:invalid-input-arg intrinsicToWorld (imref3d, 1, 2, [3, 4]) -***** test - r = imref3d ([128, 128, 27], 2, 2, 4); - xI = [54, 71, 57, 70]; - yI = [46, 48, 79, 80]; - zI = [13, 13, 13, 13]; - [xW, yW, zW] = intrinsicToWorld (r, xI, yI, zI); - assert (xW, [108, 142, 114, 140]) - assert (yW, [92, 96, 158, 160]) - assert (zW, [52, 52, 52, 52]) -***** test - [xW, yW, zW] = intrinsicToWorld (imref3d, -5.3, -2.8, -15.88); - assert (xW, -5.3) - assert (yW, -2.8) - assert (zW, -15.88, 1e-6) -***** test - [xW, yW, zW] = intrinsicToWorld (imref3d, [1, 2; 3, 4], - [2, 3; 5, 9], - [-5, 8; 19, 42.8]); - assert (xW, [1, 2; 3, 4]) - assert (yW, [2, 3; 5, 9]) - assert (zW, [-5, 8; 19, 42.8]) -13 tests, 13 passed, 0 known failure, 0 skipped -[inst/@imref3d/contains.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref3d/contains.m -***** error id=Octave:invalid-fun-call contains (imref3d) -***** error id=Octave:invalid-fun-call contains (imref3d, 1) -***** error id=Octave:invalid-fun-call contains (imref3d, 1, 2) -***** error id=Octave:invalid-fun-call contains (imref3d, 1, 2, 3, 4) -***** error id=Octave:invalid-input-arg contains (imref3d, [1, 2], 3, 4) -***** error id=Octave:invalid-input-arg contains (imref3d, 1, [2, 3], 4) -***** error id=Octave:invalid-input-arg contains (imref3d, 1, 2, [3, 4]) -***** error id=Octave:expected-real contains (imref3d, 1j, 2, 3) -***** error id=Octave:expected-real contains (imref3d, 1, 2j, 3) -***** error id=Octave:expected-real contains (imref3d, 1, 2, 3j) -***** test - r = imref3d ([128, 128, 27]); - assert (contains (r, [5, 6, 6, 8], [5, 10, 10, 257], [1, 27.5, 28, 1]), logical ([1, 1, 0, 0])) -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/@imref3d/worldToSubscript.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref3d/worldToSubscript.m -***** error id=Octave:invalid-fun-call worldToSubscript (imref3d) -***** error id=Octave:invalid-fun-call worldToSubscript (imref3d, 1) -***** error id=Octave:invalid-fun-call worldToSubscript (imref3d, 1, 2) -***** error id=Octave:invalid-fun-call worldToSubscript (imref3d, 1, 2, 3, 4) -***** error id=Octave:expected-real worldToSubscript (imref3d, 1j, 2, 3) -***** error id=Octave:expected-real worldToSubscript (imref3d, 1, 2j, 3) -***** error id=Octave:expected-real worldToSubscript (imref3d, 1, 2, 3j) -***** error id=Octave:invalid-input-arg worldToSubscript (imref3d, [1, 2], 3, 4) -***** error id=Octave:invalid-input-arg worldToSubscript (imref3d, 1, [2, 3], 4) -***** error id=Octave:invalid-input-arg worldToSubscript (imref3d, 1, 2, [3, 4]) -***** test - r = imref3d ([128, 128, 27], 2, 2, 4); - xW = [108, 108, 113.2, 2]; - yW = [92, 92, 92, -1]; - zW = [52, 55, 52, 0.33]; - [rS, cS, pS] = worldToSubscript (r, xW, yW, zW); - assert (rS, [46, 46, 46, NaN]) - assert (cS, [54, 54, 57, NaN]) - assert (pS, [13, 14, 13, NaN]) -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/viscircles.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/viscircles.m -***** demo - centers = randi ([0 100], 5, 2); - radii = randi ([10 100], 5, 1); - axis equal - viscircles (centers, radii, - "Color", "magenta", - "LineStyle", ":", - "LineWidth", 5); - title ("5 random circles"); - #---------------------------------------------- - # the figure window shows 5 circles with random - # radii and positions -***** test # old undocumented property - h = viscircles ([0 0], 1, "EdgeColor", "black"); - assert (get (get (h, "children")(1), "color"), [0 0 0]) -***** test # old undocumented property - h = viscircles ([0 0], 1, "DrawBackgroundCircle", false); - assert (numel (get (h, "children")), 1) -***** error ... - viscircles ([0 0], 1, "Color", "magenta", "EdgeColor", "black") + bw = false (8, 7); + bw (6, 3) = true ; + expected1 = logical ([ + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 + 0 0 1 0 0 0 0 + 0 1 1 1 0 0 0 + 0 0 1 0 0 0 0 + 0 0 0 0 0 0 0]); + expected3 = logical ([ + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 + 0 0 1 0 0 0 0 + 0 1 1 1 0 0 0 + 1 1 1 1 1 0 0 + 1 1 1 1 1 1 0 + 1 1 1 1 1 0 0 + 0 1 1 1 0 0 0]); + out1 = bwmorph (bw, "thicken", 1); + out3 = bwmorph (bw, "thicken", 3); + assert (out1, expected1) + assert (out3, expected3) ***** test - centers = randi ([0 100], 5, 2); - radii = randi ([0 100], 5, 1); - h = viscircles (centers, radii); - close; + bw = false (10, 10); + bw(2, 3) = true; + bw(7, 7) = true; + out_inf = bwmorph (bw, "thicken", Inf); + assert (out_inf(1, 9), false) ***** test - centers = randi ([0 100], 5, 2); - radii = randi ([0 100], 5, 1); - figure (); - h = viscircles (gca (), centers, radii); - close; + bw = false (3, 3); + bw(3, 1) = true; + out = bwmorph (bw, "thicken", 4); + assert (out, true (3, 3)) +***** xtest + ## bug #44396 + in = [ + 0 0 0 1 0 + 1 1 1 1 0 + 0 0 1 1 0 + 0 0 1 1 0 + 0 0 0 1 0]; + out = [ + 0 0 0 0 0 + 0 1 1 0 0 + 0 0 0 1 0 + 0 0 0 0 0 + 0 0 0 0 0]; + assert (bwmorph (in, "shrink"), logical (out)); +!!!!! known failure +ASSERT errors for: assert (bwmorph (in, "shrink"),logical (out)) + + Location | Observed | Expected | Reason + (2,4) 1 0 Abs err 1 exceeds tol 0 by 1 + (3,4) 0 1 Abs err 1 exceeds tol 0 by 1 + (4,4) 1 0 Abs err 1 exceeds tol 0 by 1 + (5,4) 1 0 Abs err 1 exceeds tol 0 by 1 ***** test - centers = randi ([0 100], 5, 2); - radii = randi ([0 100], 5, 1); - h = viscircles (centers, radii, "Color", "magenta", - "LineStyle", ":", "LineWidth", 5); - close; + H = false (7,7); + H(2:3,2:3) = 1; + H(5:6,5:6) = 1; + T = logical([0 0 0 0 0 0 0; + 0 0 0 0 0 0 0; + 0 1 0 0 0 0 0; + 0 0 0 0 0 0 0; + 0 0 0 0 0 0 0; + 0 0 0 0 1 0 0; + 0 0 0 0 0 0 0]); + out = bwmorph (H, "thin", 1); + assert (T, out) + + H(4:6,4:6) = 1; + T = logical([0 0 0 0 0 0 0; + 0 0 0 0 0 0 0; + 0 1 1 0 0 0 0; + 0 0 0 1 0 0 0; + 0 0 0 0 1 0 0; + 0 0 0 0 0 0 0; + 0 0 0 0 0 0 0]); + out = bwmorph (H, "thin", 1); + assert (T, out) + + H3 = [0 0 0 0 0 0; + 0 1 1 1 0 0; + 0 1 1 1 0 0; + 0 0 0 1 0 1; + 0 0 0 0 1 1; + 0 0 0 1 1 1]; + out3 = bwmorph (H3, "thin", 1); + expected3 = logical( + [0 0 0 0 0 0; + 0 0 0 0 0 0; + 0 1 1 0 0 0; + 0 0 0 1 0 1; + 0 0 0 0 1 0; + 0 0 0 1 1 0]); + assert (out3, expected3) + + out33 = bwmorph (H3, "thin", 2); + expected33 = logical( + [0 0 0 0 0 0; + 0 0 0 0 0 0; + 0 1 1 0 0 0; + 0 0 0 1 0 1; + 0 0 0 0 1 0; + 0 0 0 1 0 0]); + assert (out33, expected33) + + out333 = bwmorph (H3, "thin", inf); + assert (out333, expected33) ***** test - centers = randi ([0 100],5,2); - radii = randi ([0 100],5,1); - figure (); - h = viscircles (centers, radii, "Color", "magenta", - "LineStyle", ":", "LineWidth", 5); - close; -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/deconvwnr.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/deconvwnr.m -***** shared im0, psf0, im0_out, psf1, im2, out2_0, out2_1, im3 - im0 = ones (5, 5); - psf0 = ones (3, 3); - im0_out = 0.11111 .* ones (5, 5); - psf1 = [1 0 0; 0 1 0; 0 0 1]; - im2 = checkerboard (2, 2, 2); - out2_0 = [ - -0.4713 -0.2786 0.4229 0.5161 -0.2759 -0.4685 0.5131 0.4199; - -0.4713 -0.2786 0.4229 0.5161 -0.2759 -0.4685 0.5131 0.4199; - 0.5161 0.4229 -0.2786 -0.4713 0.4199 0.5131 -0.4685 -0.2759; - 0.5161 0.4229 -0.2786 -0.4713 0.4199 0.5131 -0.4685 -0.2759; - -0.4713 -0.2786 0.4229 0.5161 -0.2759 -0.4685 0.5131 0.4199; - -0.4713 -0.2786 0.4229 0.5161 -0.2759 -0.4685 0.5131 0.4199; - 0.5161 0.4229 -0.2786 -0.4713 0.4199 0.5131 -0.4685 -0.2759; - 0.5161 0.4229 -0.2786 -0.4713 0.4199 0.5131 -0.4685 -0.2759]; - out2_1 = [ - -0.0000 0.8481 0.4288 -0.4194 0.0000 0.2765 0.1373 -0.1392; - 0.5623 -0.0000 -0.4194 0.1429 0.5623 0.0000 -0.1392 0.4231; - 0.1429 -0.4194 0 0.5623 0.4231 -0.1392 0 0.5623; - -0.4194 0.4288 0.8481 0 -0.1392 0.1373 0.2765 0; - -0.0000 0.8481 0.4288 -0.4194 0.0000 0.2765 0.1373 -0.1392; - 0.5623 -0.0000 -0.4194 0.1429 0.5623 0.0000 -0.1392 0.4231; - 0.1429 -0.4194 0 0.5623 0.4231 -0.1392 0 0.5623; - -0.4194 0.4288 0.8481 0 -0.1392 0.1373 0.2765 0]; - im3 = rot90 (diag (0.5.*ones (1,8)) + diag (ones(1,7), 1)); -***** error deconvwnr () -***** error deconvwnr (ones (5)) -***** assert (deconvwnr (ones (5), ones (3))) -***** assert (deconvwnr (ones (5), ones (3), 0.7)) -***** assert (deconvwnr (ones (5), ones (3), 0.5 .* ones (5))) -***** assert (deconvwnr (ones (5, 5, 5), ones (3))) -***** error deconvwnr (ones (5), ones (3), -0.7) -***** error - deconvwnr (ones (5), ones (7)) -***** error - deconvwnr (ones (5, 8, 2), ones (6, 5)) -***** assert (deconvwnr (im0, psf0), im0_out, 1e-5) -***** assert (deconvwnr (im0, single (psf0)), im0_out, 1e-5) -***** assert (class (deconvwnr (im0, psf0)), "double") -***** assert (deconvwnr (single (im0), psf0), single (im0_out), 1e-5) -***** assert (class (deconvwnr (single (im0), psf0)), "single") -***** assert (deconvwnr (im2uint8 (im0), psf0), im2uint8 (im0_out)) -***** assert (class (deconvwnr (im2uint8 (im0), psf0)), "uint8") -***** assert (deconvwnr (im2uint16 (im0), psf0), im2uint16 (im0_out)) -***** assert (class (deconvwnr (im2uint16 (im0), psf0)), "uint16") -***** assert (deconvwnr (im2int16 (im0), psf0), im2int16 (im0_out)) -***** assert (class (deconvwnr (im2int16 (im0), psf0)), "int16") -***** error deconvwnr (true (5), ones (3)) + in = logical ([ + 1 0 0 0 + 0 1 0 0 + 0 0 1 0 + 0 0 0 0]); + out = logical ([ + 1 0 0 0 + 0 0 0 0 + 0 0 1 0 + 0 0 0 0]); + assert (bwmorph (in, "endpoints"), out); + + A = logical ([0 0 0 0 0; 0 0 1 0 0; 0 1 1 1 0; 0 0 1 0 0; 0 0 0 0 0]); + B = logical ([0 0 0 0 0; 0 0 1 0 0; 0 1 0 1 0; 0 0 1 0 0; 0 0 0 0 0]); + assert (bwmorph (A, "endpoints"), B); + + A = logical ([0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 1 1 + 0 0 1 1 1 1 0 0 + 0 0 0 1 1 0 0 0 + 0 0 1 1 1 1 0 0 + 0 1 0 0 0 0 1 0 + 1 0 0 0 0 0 0 1]); + B = logical ([0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 1 + 0 0 0 0 0 0 0 0 + 0 0 0 1 1 0 0 0 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 1]); + assert (bwmorph (A, "endpoints"), B); + + A = logical([0 0 0 0 0; 0 1 1 1 0; 0 1 1 1 0; 0 1 1 1 0; 0 0 0 0 0]); + B = logical([0 0 0 0 0; 0 1 1 1 0; 0 1 0 1 0; 0 1 1 1 0; 0 0 0 0 0]); + assert (bwmorph (A, "endpoints"), B); + assert (bwmorph (B, "endpoints"), zeros (5, "logical")); + + A = logical([0,0,0,0,0,0,0,0,0,0,0,0,0,0 + 0,0,1,1,1,1,1,1,1,1,1,1,0,0 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0]); + B = logical([0,0,0,0,0,0,0,0,0,0,0,0,0,0 + 0,0,1,0,0,0,0,0,0,0,0,1,0,0 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0]); + C = logical([1,0,0,0,0,0,0,0,0,0,0,0,0,1 + 1,1,0,0,0,0,0,0,0,0,0,0,1,1 + 1,0,0,0,0,0,0,0,0,0,0,0,0,1]); + assert (bwmorph (!A, "endpoints"), C); +22 tests, 20 passed, 2 known failures, 0 skipped +[inst/stretchlim.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/stretchlim.m +***** error (stretchlim ()); +***** error (stretchlim ("bad parameter")); +***** error (stretchlim (zeros (10, 10), "bad parameter")); +***** error (stretchlim (zeros (10, 10), 0.01, 2)); +***** assert (stretchlim (0.01:.01:1), [0.02; 0.99]) +***** assert (stretchlim (0.01:.01:1), stretchlim (0.01:.01:1, [0.01 0.99])) +***** assert (stretchlim (0.01:.01:1, 0.15), stretchlim (0.01:.01:1, [0.15 0.85])) +***** assert (stretchlim (0.01:.01:1, [0.01,0.95]), [0.02; 0.95], eps) +***** assert (stretchlim (0.01:.01:1, 0), [0.01; 1]) ***** test - assert (deconvwnr (im0, psf0, 0.01), im0_out, 1e-4) - assert (deconvwnr (im0, psf1, 0.01), 0.333.*ones (5), 1e-4) + im = rand (5); + assert (stretchlim (im, 0), [min(im(:)); max(im(:))]) ***** test - im1 = magic (5)./25; - out1_0 = [ - -0.0820 0.5845 -0.4293 0.2372 -0.0214; - 0.6241 -0.5877 0.2768 0.0182 -0.0424; - -0.5481 0.3164 0.0578 -0.2009 0.6637; - 0.1580 0.0974 -0.1613 0.7033 -0.5085; - 0.1370 -0.1217 0.5449 -0.4689 0.1976]; - out1_1 = [ - -0.2959 -0.1363 0.4038 0.7595 0.1347; - -0.0191 0.3269 0.8768 0.0559 -0.3748; - 0.2481 0.7979 0.1731 -0.4517 0.0982; - 0.7210 0.2904 -0.5305 0.0194 0.3654; - 0.2116 -0.4132 -0.0575 0.4826 0.6422]; - assert (deconvwnr (im1, psf0, 0.01), out1_0, 1e-4) - assert (deconvwnr (im1, psf1, 0.01), out1_1, 1e-4) + im = rand (5, 5, 3); + assert (stretchlim (im, 0), + [min(im(:,:,1)(:)) min(im(:,:,2)(:)) min(im(:,:,3)(:)); + max(im(:,:,1)(:)) max(im(:,:,2)(:)) max(im(:,:,3)(:))]) ***** test - assert (deconvwnr (im2, psf0, 0.01), out2_0, 1e-4) - assert (deconvwnr (im2, psf1, 0.01), out2_1, 1e-4) + im = rand (5); + assert (stretchlim (im, 0.03), [min(im(:)); max(im(:))]) + assert (stretchlim (im, 0.0399), [min(im(:)); max(im(:))]) +***** assert (stretchlim (uint8 (1:100)), im2double (uint8 ([2; 99]))) +***** assert (stretchlim (uint8 (1:100), .25), im2double (uint8 ([26; 75]))) +***** assert (stretchlim (uint16 (1:1000)), im2double (uint16 ([11; 990]))) +***** assert (stretchlim (int16 (-100:100)), im2double (int16 ([-98; 98]))) +***** assert (stretchlim (single (0.01:.01:1)), + double (single (0.01:.01:1)([2; 99])).') +***** assert (stretchlim (uint8 ([1 repmat(2, [1, 90]) 92:100]), 0.05), + im2double (uint8 ([2; 95]))) +***** assert (stretchlim (uint8 ([1 repmat(2, [1 4]) 6:100]), 0.05), + im2double (uint8 ([6; 95]))) +***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) 7:100]), 0.05), + im2double (uint8 ([2; 95]))) +***** assert (stretchlim (uint8 ([1 repmat(2, [1 6]) 8:100]), 0.05), + im2double (uint8 ([2; 95]))) +***** assert (stretchlim (uint8 ([1 repmat(2, [1 7]) 9:100]), 0.05), + im2double (uint8 ([2; 95]))) +***** assert (stretchlim (uint8 ([1 repmat(2, [1 8]) 10:100]), 0.05), + im2double (uint8 ([2; 95]))) +***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) repmat(3, [1 5]) 9:100]), 0.04), + im2double (uint8 ([2; 96]))) +***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) repmat(3, [1 5]) 9:100]), 0.05), + im2double (uint8 ([2; 95]))) +***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) repmat(3, [1 5]) 9:100]), 0.06), + im2double (uint8 ([3; 94]))) +***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) repmat(3, [1 5]) 9:100]), 0.07), + im2double (uint8 ([3; 93]))) +***** assert (stretchlim (uint8 ([1 repmat(2, [1 5]) repmat(3, [1 5]) 9:100]), 0.08), + im2double (uint8 ([3; 92]))) ***** test - out3_0_x = [ - -1.1111 1.0556 -0.4444 -0.1111 0.5556 -0.9444 0.8889 0.0556; - 1.0556 -0.7778 0.2222 0.5556 -1.2778 1.2222 0.0556 -0.7778; - -0.4444 0.2222 0.2222 -0.9444 1.2222 -0.2778 -0.4444 0.7222; - -0.1111 0.5556 -0.9444 0.8889 0.0556 -0.4444 0.3889 -0.4444; - 0.5556 -1.2778 1.2222 0.0556 -0.7778 0.7222 -0.4444 0.2222; - -0.9444 1.2222 -0.2778 -0.4444 0.7222 -0.7778 0.5556 0.2222; - 0.8889 0.0556 -0.4444 0.3889 -0.4444 0.5556 -0.1111 -0.9444; - 0.0556 -0.7778 0.7222 -0.4444 0.2222 0.2222 -0.9444 1.2222]; - out3_0_01 = [ - -0.5064 0.2140 0.1101 -0.0993 0.0297 -0.1942 0.3223 0.0772; - 0.2140 -0.0659 0.0375 0.0891 -0.4109 0.4783 0.2202 -0.2860; - 0.1101 0.0375 -0.0525 -0.3208 0.5721 0.0034 -0.1743 0.0939; - -0.0993 0.0891 -0.3208 0.4624 0.0936 -0.1150 -0.1395 -0.0135; - 0.0297 -0.4109 0.5721 0.0936 -0.2566 -0.0027 0.1101 0.1341; - -0.1942 0.4783 0.0034 -0.1150 -0.0027 -0.0659 0.2542 -0.0819; - 0.3223 0.2202 -0.1743 -0.1395 0.1101 0.2542 -0.3023 -0.3371; - 0.0772 -0.2860 0.0939 -0.0135 0.1341 -0.0819 -0.3371 0.6794]; - out3_0_00001 = [ - -1.1087 1.0520 -0.4419 -0.1112 0.5532 -0.9410 0.8864 0.0557; - 1.0520 -0.7746 0.2213 0.5537 -1.2742 1.2190 0.0565 -0.7759; - -0.4419 0.2213 0.2211 -0.9418 1.2196 -0.2767 -0.4433 0.7195; - -0.1112 0.5537 -0.9418 0.8870 0.0557 -0.4428 0.3864 -0.4425; - 0.5532 -1.2742 1.2196 0.0557 -0.7755 0.7188 -0.4419 0.2220; - -0.9410 1.2190 -0.2767 -0.4428 0.7188 -0.7746 0.5544 0.2206; - 0.8864 0.0565 -0.4433 0.3864 -0.4419 0.5544 -0.1121 -0.9418; - 0.0557 -0.7759 0.7195 -0.4425 0.2220 0.2206 -0.9418 1.2201]; - out3_0_3 = [ - -0.0893 -0.0089 0.0446 -0.0357 -0.0268 0.0268 0.0893 0.0446; - -0.0089 0.0223 -0.0089 -0.0357 -0.0089 0.1473 0.1161 0.0179; - 0.0446 -0.0089 -0.0357 -0.0089 0.1607 0.0804 -0.0089 -0.0357; - -0.0357 -0.0357 -0.0089 0.1652 0.0804 -0.0179 -0.0714 0.0045; - -0.0268 -0.0089 0.1607 0.0804 -0.0179 -0.0446 0.0446 -0.0000; - 0.0268 0.1473 0.0804 -0.0179 -0.0446 0.0223 0.0268 -0.0000; - 0.0893 0.1161 -0.0089 -0.0714 0.0446 0.0268 -0.1071 -0.0446; - 0.0446 0.0179 -0.0357 0.0045 0.0000 -0.0000 -0.0446 0.1652]; - out3_1_x = [ - -0.3333 0.1667 -0.6667 -0.3333 0.3333 0.1667 0.3333 0.1667; - 0.1667 -0.3333 -0.3333 0.3333 0.1667 0.3333 0.1667 0.3333; - -0.6667 -0.3333 0.6667 0.1667 0.3333 0.1667 0.3333 0.1667; - -0.3333 0.3333 0.1667 -0.3333 0.1667 0.3333 0.1667 -0.6667; - 0.3333 0.1667 0.3333 0.1667 0.6667 0.1667 -0.6667 -0.3333; - 0.1667 0.3333 0.1667 0.3333 0.1667 -0.3333 -0.3333 0.3333; - 0.3333 0.1667 0.3333 0.1667 -0.6667 -0.3333 -0.3333 0.1667; - 0.1667 0.3333 0.1667 -0.6667 -0.3333 0.3333 0.1667 0.6667]; - out3_1_01 = [ - -0.1868 0.1548 -0.5994 -0.2997 0.3097 0.1548 0.3097 0.1548; - 0.1548 -0.2997 -0.2997 0.3097 0.1548 0.3097 0.1548 0.3097; - -0.5994 -0.2997 0.4965 0.1548 0.3097 0.1548 0.3097 0.1548; - -0.2997 0.3097 0.1548 -0.1247 0.1548 0.3097 0.1548 -0.5994; - 0.3097 0.1548 0.3097 0.1548 0.4965 0.1548 -0.5994 -0.2997; - 0.1548 0.3097 0.1548 0.3097 0.1548 -0.2997 -0.2997 0.3097; - 0.3097 0.1548 0.3097 0.1548 -0.5994 -0.2997 -0.1868 0.1548; - 0.1548 0.3097 0.1548 -0.5994 -0.2997 0.3097 0.1548 0.4343]; - out3_1_00001 = [ - -0.3331 0.1667 -0.6666 -0.3333 0.3333 0.1667 0.3333 0.1667; - 0.1667 -0.3333 -0.3333 0.3333 0.1667 0.3333 0.1667 0.3333; - -0.6666 -0.3333 0.6664 0.1667 0.3333 0.1667 0.3333 0.1667; - -0.3333 0.3333 0.1667 -0.3330 0.1667 0.3333 0.1667 -0.6666; - 0.3333 0.1667 0.3333 0.1667 0.6664 0.1667 -0.6666 -0.3333; - 0.1667 0.3333 0.1667 0.3333 0.1667 -0.3333 -0.3333 0.3333; - 0.3333 0.1667 0.3333 0.1667 -0.6666 -0.3333 -0.3331 0.1667; - 0.1667 0.3333 0.1667 -0.6666 -0.3333 0.3333 0.1667 0.6663]; - out3_1_3 = [ - -0.0089 0.0625 -0.1250 -0.0625 0.1250 0.0625 0.1250 0.0625; - 0.0625 -0.0625 -0.0625 0.1250 0.0625 0.1250 0.0625 0.1250; - -0.1250 -0.0625 0.1339 0.0625 0.1250 0.0625 0.1250 0.0625; - -0.0625 0.1250 0.0625 0.0982 0.0625 0.1250 0.0625 -0.1250; - 0.1250 0.0625 0.1250 0.0625 0.1339 0.0625 -0.1250 -0.0625; - 0.0625 0.1250 0.0625 0.1250 0.0625 -0.0625 -0.0625 0.1250; - 0.1250 0.0625 0.1250 0.0625 -0.1250 -0.0625 -0.0089 0.0625; - 0.0625 0.1250 0.0625 -0.1250 -0.0625 0.1250 0.0625 0.0268]; - assert (deconvwnr (im3, psf0), out3_0_x, 1e-4) - assert (deconvwnr (im3, psf0, 0.1), out3_0_01, 1e-4) - assert (deconvwnr (im3, psf0, 0.0001), out3_0_00001, 1e-4) - assert (deconvwnr (im3, psf0, 3), out3_0_3, 1e-4) - assert (deconvwnr (im3, psf1), out3_1_x, 1e-4) - assert (deconvwnr (im3, psf1, 0.1), out3_1_01, 1e-4) - assert (deconvwnr (im3, psf1, 0.0001), out3_1_00001, 1e-4) - assert (deconvwnr (im3, psf1, 3), out3_1_3, 1e-4) + RGB = zeros (100, 1, 3, "uint16"); + RGB(:,:,1) = [1:1:100]; + RGB(:,:,2) = [2:2:200]; + RGB(:,:,3) = [4:4:400]; + assert (stretchlim (RGB) , im2double (uint16 ([2 4 8; 99 198 396]))) ***** test - im_rgb = cat (3, im2, im3, magic (8)./64); - out_rgb_0(:, :, 1) = out2_0; - out_rgb_0(:, :, 2) = [ - -0.9255 0.7869 -0.2553 -0.1154 0.3801 -0.6906 0.7000 0.0651; - 0.7869 -0.5407 0.1534 0.4141 -1.0064 0.9816 0.1222 -0.6335; - -0.2553 0.1534 0.1343 -0.7453 1.0211 -0.1936 -0.3586 0.5209; - -0.1154 0.4141 -0.7453 0.7468 0.0675 -0.3247 0.2023 -0.2996; - 0.3801 -1.0064 1.0211 0.0675 -0.6045 0.4711 -0.2553 0.2032; - -0.6906 0.9816 -0.1936 -0.3247 0.4711 -0.5407 0.4692 0.1052; - 0.7000 0.1222 -0.3586 0.2023 -0.2553 0.4692 -0.1868 -0.7477; - 0.0651 -0.6335 0.5209 -0.2996 0.2032 0.1052 -0.7477 1.0630]; - out_rgb_0(:, :, 3) = [ - -0.8118 0.8805 0.8341 -0.7963 -0.6343 0.8222 0.7757 -0.6188; - 0.5720 -0.4151 -0.3687 0.5565 0.3945 -0.3567 -0.3103 0.3791; - 0.2007 -0.0438 0.0026 0.1852 0.0232 0.0146 0.0610 0.0078; - -0.6880 0.7568 0.7104 -0.6725 -0.5105 0.6984 0.6520 -0.4951; - 0.6079 -0.5392 -0.5856 0.6234 0.7854 -0.5975 -0.6439 0.8008; - 0.1051 0.0519 0.0983 0.0896 -0.0724 0.1102 0.1566 -0.0879; - -0.2662 0.4231 0.4696 -0.2817 -0.4437 0.4815 0.5279 -0.4592; - 0.7317 -0.6629 -0.7093 0.7471 0.9091 -0.7213 -0.7677 0.9246]; - out_rgb_1(:, :, 1) = out2_1; - out_rgb_1(:, :, 2) = [ - -0.3110 0.1654 -0.6593 -0.3297 0.3308 0.1654 0.3308 0.1654; - 0.1654 -0.3297 -0.3297 0.3308 0.1654 0.3308 0.1654 0.3308; - -0.6593 -0.3297 0.6418 0.1654 0.3308 0.1654 0.3308 0.1654; - -0.3297 0.3308 0.1654 -0.3016 0.1654 0.3308 0.1654 -0.6593; - 0.3308 0.1654 0.3308 0.1654 0.6418 0.1654 -0.6593 -0.3297; - 0.1654 0.3308 0.1654 0.3308 0.1654 -0.3297 -0.3297 0.3308; - 0.3308 0.1654 0.3308 0.1654 -0.6593 -0.3297 -0.3110 0.1654; - 0.1654 0.3308 0.1654 -0.6593 -0.3297 0.3308 0.1654 0.6323]; - out_rgb_1(:, :, 3) = [ - -0.0240 0.3338 0.3335 0.0329 0.0344 0.1564 0.3942 0.0913; - 0.7871 0.6512 -0.5394 -0.2225 0.7287 0.5905 -0.3619 -0.2809; - 0.1333 -0.7196 0.2335 1.0291 0.0749 -0.5421 0.1728 0.9708; - -0.2201 0.4109 0.6487 -0.1632 -0.1617 0.4716 0.4713 -0.1048; - 0.4430 -0.1331 -0.1334 0.4999 0.5014 -0.3106 -0.0727 0.5582; - -0.6326 0.1654 0.8803 0.2633 -0.6910 0.1047 1.0577 0.2049; - 0.6191 0.7001 -0.2523 -0.3905 0.5607 0.8776 -0.3130 -0.4489; - 0.2469 -0.0561 0.1818 0.3038 0.3052 0.0047 0.0043 0.3621]; - assert (deconvwnr (im_rgb, psf0, 0.01), out_rgb_0, 1e-4) - assert (deconvwnr (im_rgb, psf1, 0.01), out_rgb_1, 1e-4) + im6c = zeros (100, 1, 6, "uint16"); + im6c(:,:,1) = [1:1:100]; + im6c(:,:,2) = [2:2:200]; + im6c(:,:,3) = [4:4:400]; + im6c(:,:,4) = [8:8:800]; + im6c(:,:,5) = [16:16:1600]; + im6c(:,:,6) = [32:32:3200]; + assert (stretchlim (im6c) , + im2double (uint16 ([2 4 8 16 32 64; 99 198 396 792 1584 3168]))) ***** test - ## Test that psf and nsr can be of class single, but are usually - ## internally as doubles. Matlab requires everything all to be - ## double so this is Matlab incompatible behaviour by design. - nsr = 0.1; - psf1_recast = double (single (psf1)); - nsr_recast = double (single (0.1)); - deconvolved = deconvwnr (im2, psf1_recast, nsr_recast); - assert (deconvwnr (im2, single (psf1), single (nsr)), deconvolved, 2e-16) - assert (deconvwnr (im2, single (psf1), nsr_recast), deconvolved, 2e-16) - assert (deconvwnr (im2, psf1_recast, single (nsr)), deconvolved, 2e-16) -***** demo - I = phantom (); - figure, imshow (I); - title ("Original image"); - psf = fspecial ("motion", 30, 15); - blurred = imfilter (I, psf, "conv"); - figure, imshow (blurred); - title ("Image with added motion blur"); - var_noise = 0.00005; - blurred_noisy = imnoise (blurred, "gaussian", 0, var_noise); - figure, imshow (blurred_noisy); - title ("Image with motion blur and added Gaussian noise"); - estimated_nsr = var_noise / (var(blurred_noisy(:)) - var_noise); - J = deconvwnr (blurred_noisy, psf, estimated_nsr); - figure, imshow (J) - title ({"restored image after Wiener deconvolution", - "with known PSF and estimated NSR"}); -27 tests, 27 passed, 0 known failure, 0 skipped -[inst/imcomplement.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imcomplement.m -***** assert (imcomplement (10), -9); -***** assert (imcomplement (single (10)), single (-9)); -***** assert (imcomplement (0.2), 0.8); -***** assert (imcomplement (uint8 (0)), uint8 (255)); -***** assert (imcomplement (uint8 (1)), uint8 (254)); -***** assert (imcomplement (uint16 (0)), uint16 (65535)); -***** assert (imcomplement (uint16 (1)), uint16 (65534)); -***** assert (imcomplement (int8 (-128)), int8 ( 127)); -***** assert (imcomplement (int8 ( 127)), int8 (-128)); -***** assert (imcomplement (int16 (-1)), int16 ( 0)); -***** assert (imcomplement (int16 ( 0)), int16 (-1)); -***** assert (imcomplement (int16 ( 1)), int16 (-2)); -***** assert (imcomplement ([true false true]), [false true false]) -***** error imcomplement ("not an image") -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/lab2rgb.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2rgb.m -***** assert (lab2rgb ([0 0 0]), [0, 0, 0], 1e-3) -***** assert (lab2rgb ([53.24, 80.09, 67.20]), [1 0 0], 1e-3) -***** assert (lab2rgb ([97.14, -21.55, 94.48]), [1 1 0], 1e-3) -***** assert (lab2rgb ([87.74, -86.18, 83.18]), [0 1 0], 1e-3) -***** assert (lab2rgb ([91.11, -48.09, -14.13]), [0 1 1], 1e-3) -***** assert (lab2rgb ([32.30, 79.19, -107.86]), [0 0 1], 1e-3) -***** assert (lab2rgb ([60.32, 98.24, -60.83]), [1 0 1], 1e-3) -***** assert (lab2rgb ([100, 0.00, 0.00]), [1 1 1], 1e-3) -***** assert (lab2rgb ([53.39, 0.00, 0.00]), [0.5 0.5 0.5], 1e-3) -***** assert (lab2rgb ([39.77, 64.51, 54.13]), [0.75 0 0], 1e-3) -***** assert (lab2rgb ([25.42, 47.91, 37.91]), [0.5 0 0], 1e-3) -***** assert (lab2rgb ([9.66, 29.68, 15.24]), [0.25 0 0], 1e-3) -***** assert (lab2rgb ([68.11, 48.39, 22.83]), [1 0.5 0.5], 1e-3) -***** assert (lab2rgb ([150 130 130]), [2.714, 1.028, 0.492], 1e-3) + im = [0 0 .1 .1 .1 .1 .2 .2 .2 .4 .4 .6 .6 .7 .7 .9 .9 .9 1 1]; + + assert (stretchlim (im), [0; 1]) + + ## Consider the returned lower limit in this test. A lower limit + ## of 0.1 will saturate two elements (10%), while 0.2 will saturate + ## 6 elements (30%). Both have the same distance to 20% but returning + ## 0.1 is Matlab compatible. + ## Now looking at the higher limit. A limit of .9 will saturate + ## 2 elements (10%), while a limit of 0.7 will saturate 5 elements (25%). + ## However, for Matlab compatibility we must return .9 even though + ## 25% would be closer to 20%. + ## Basically, it's not just rounded. + assert (stretchlim (im, .2), [0.1; 0.9]) + + assert (stretchlim (im, .15), [0.1; 0.9]) + assert (stretchlim (im, .1), [0.1; 0.9]) + assert (stretchlim (im, .25), [0.1; 0.7]) + + ## Reorder the vector of values (real images don't have the values + ## already sorted), just to be sure it all works. + im([6 3 16 11 7 17 14 8 5 19 15 1 2 4 18 13 9 20 10 12]) = im; + assert (stretchlim (im, .2), [0.1; 0.9]) + assert (stretchlim (im, .15), [0.1; 0.9]) + assert (stretchlim (im, .1), [0.1; 0.9]) + assert (stretchlim (im, .25), [0.1; 0.7]) +***** assert (stretchlim (0.01:.001:1), [0.019; 0.991], eps) +***** assert (stretchlim (0.01:.001:1, [0.01,0.95]), [0.019; 0.951], eps) +***** assert (stretchlim (0.01:.001:1, 0), [0.01; 1], eps) +***** assert (stretchlim (single (0.01:.001:1)), + double (single (0.01:.001:1)([10; 982])).', eps) +***** xtest + assert (stretchlim ([(.05:.05:1) (2:4)], 0.2), [0.25; 0.95], eps) + assert (stretchlim ([(.05:.05:1) (2:5)], 0.2), [0.25; 1], eps) + assert (stretchlim ([(.05:.05:1) (2:6)], 0.2), [0.3; 1], eps) + assert (stretchlim ([(.05:.05:1) (2:7)], 0.2), [0.3; 1], eps) ***** test - lab_map = rand (64, 3); - lab_map(:,1) = lab_map(:,1) .* 100; - lab_map(:,2) = lab_map(:,2) .* 254 - 127; - lab_map(:,3) = lab_map(:,3) .* 254 - 127; - assert (rgb2lab (lab2rgb (lab_map)), lab_map, 5e-3); + assert (stretchlim ([(-6:0) (.05:.05:1)], 0.2), [0; 0.75], eps) + assert (stretchlim ([(-5:0) (.05:.05:1)], 0.2), [0; 0.75], eps) ***** test - lab_img = rand (64, 64, 3); - lab_img(:,:,1) = lab_img(:,:,1) .* 100; - lab_img(:,:,2) = lab_img(:,:,2) .* 254 - 127; - lab_img(:,:,3) = lab_img(:,:,3) .* 254 - 127; - assert (rgb2lab (lab2rgb (lab_img)), lab_img, 5e-3); -***** assert (lab2rgb (sparse ([0 0 0])), [0 0 0], 1e-3) -***** assert (lab2rgb (sparse ([100, 0.00, 0.00])), [1 1 1], 1e-3) -***** assert (class (lab2rgb (single([50 50 50]))), 'single') -***** error lab2rgb () -***** error lab2rgb (1,2) -***** error lab2rgb ({1}) -***** error lab2rgb (ones (2,2)) + im = rand (4, 4, 2, 3, 2); + rv = zeros (2, 2, 3, 2); + for p = 1:2 + for q = 1:3 + for r = 1:2 + rv(:,p,q,r) = stretchlim (im(:,:,p,q,r), 0.25); + endfor + endfor + endfor + assert (stretchlim (im, 0.25), rv) ***** test - lab = rand (16, 16, 3, 5); - lab(:,:,1,:) = lab(:,:,1,:) .* 100; - lab(:,:,2,:) = lab(:,:,2,:) .* 254 - 127; - lab(:,:,3,:) = lab(:,:,3,:) .* 254 - 127; - rgb = zeros (size (lab)); - for i = 1:5 - rgb(:,:,:,i) = lab2rgb (lab(:,:,:,i)); + im = rand (4, 4, 2, 3, 2); + rv = zeros (2, 2, 3, 2); + for p = 1:2 + for q = 1:3 + for r = 1:2 + rv(:,p,q,r) = stretchlim (im(:,:,p,q,r), 0); + endfor + endfor endfor - assert (lab2rgb (lab), rgb) -24 tests, 24 passed, 0 known failure, 0 skipped -[inst/@imref2d/sizesMatch.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/sizesMatch.m -***** error id=Octave:invalid-fun-call sizesMatch (imref2d) -***** test - I = zeros (256, 256); - r = imref2d ([256, 256]); - assert (sizesMatch (r, I), true) - I2 = zeros (246, 300); - assert (sizesMatch (r, I2), false) -***** test - r = imref2d ([256, 256]); - assert (sizesMatch (r, []), false) -***** test - r = imref2d ([256, 256]); - assert (sizesMatch (r, 42), false) -***** test - r = imref2d ([256, 256]); - assert (sizesMatch (r, zeros (256, 256, 3, 2)), true) -***** test - I = zeros (384, 512, 3); - r = imref2d (size (I)); - assert (sizesMatch (r, I), true) -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/@imref2d/imref2d.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/imref2d.m -***** error id=Octave:invalid-fun-call imref2d (1, 2, 3, 4) -***** error id=Octave:invalid-input-arg imref2d (42) -***** error id=Octave:invalid-input-arg imref2d ([42]) -***** error id=Octave:expected-integer imref2d ([4.2, 42]) -***** error id=Octave:expected-positive imref2d ([0, 0]) -***** error id=Octave:expected-positive imref2d ([-4, 2]) -***** error id=Octave:expected-positive imref2d ([4, 2], 0, 2) -***** error id=Octave:expected-positive imref2d ([4, 2], 2, 0) -***** error id=Octave:expected-real imref2d ([4, 2], j, 2) -***** error id=Octave:expected-real imref2d ([4, 2], 2, j) -***** error id=Octave:expected-real imref2d ([4, 2], [j, 2], [3, 4]) -***** error id=Octave:expected-real imref2d ([4, 2], [1, 2], [j, 4]) -***** error id=Octave:expected-vector imref2d ([4, 2], [], []) -***** error id=Octave:expected-vector imref2d ([4, 2], [], [1]) -***** error id=Octave:expected-scalar imref2d ([4, 2], [1], []) -***** error id=Octave:incorrect-size imref2d ([4, 2], [1, 2], [0]) -***** error id=Octave:incorrect-size imref2d ([4, 2], [1, 2], [1, 2, 3]) -***** error id=Octave:incorrect-size imref2d ([4, 2], [1, 2, 3], [1, 2]) -***** error id=Octave:incorrect-size imref2d ([4, 2], [1; 2], [1, 2]) -***** error id=Octave:incorrect-size imref2d ([4, 2], [1, 2], [1; 2]) -***** error id=Octave:invalid-indexing imref2d().InvalidProperty -***** error id=Octave:expected-increasing imref2d ([100 200], [1.5 0.5], [2.5 3.5]) -***** error id=Octave:expected-increasing imref2d ([100 200], [1.5 2.5], [2.5 1.5]) -***** test - r = imref2d; - assert (r.XWorldLimits, [0.5, 2.5]) - assert (r.YWorldLimits, [0.5, 2.5]) - assert (r.ImageSize, [2, 2]) - assert (r.PixelExtentInWorldX, 1) - assert (r.PixelExtentInWorldY, 1) - assert (r.ImageExtentInWorldX, 2) - assert (r.ImageExtentInWorldY, 2) - assert (r.XIntrinsicLimits, [0.5, 2.5]) - assert (r.YIntrinsicLimits, [0.5, 2.5]) -***** test - r = imref2d ([100, 200]); - assert (r.XWorldLimits, [0.5, 200.5]) - assert (r.YWorldLimits, [0.5, 100.5]) - assert (r.ImageSize, [100, 200]) - assert (r.PixelExtentInWorldX, 1) - assert (r.PixelExtentInWorldY, 1) - assert (r.ImageExtentInWorldX, 200) - assert (r.ImageExtentInWorldY, 100) - assert (r.XIntrinsicLimits, [0.5, 200.5]) - assert (r.YIntrinsicLimits, [0.5, 100.5]) -***** test - xWorldLimits = [2, 5]; - yWorldLimits = [3, 6]; - r = imref2d ([291, 240], xWorldLimits, yWorldLimits); - assert (r.XWorldLimits, [2, 5]) - assert (r.YWorldLimits, [3, 6]) - assert (r.ImageSize, [291, 240]) - assert (r.PixelExtentInWorldX, 0.0125) - assert (r.PixelExtentInWorldY, 0.0103, 1e-3) - assert (r.ImageExtentInWorldX, 3) - assert (r.ImageExtentInWorldY, 3) - assert (r.XIntrinsicLimits, [0.5, 240.5]) - assert (r.YIntrinsicLimits, [0.5, 291.5]) -***** test - pixelExtentInWorldX = 0.3125; - pixelExtentInWorldY = 0.3125; - r = imref2d ([512, 512], pixelExtentInWorldX, pixelExtentInWorldY); - assert (r.XWorldLimits, [0.15625, 160.1562], 1e-4) - assert (r.YWorldLimits, [0.15625, 160.1562], 1e-4) - assert (r.ImageSize, [512, 512]) - assert (r.PixelExtentInWorldX, 0.3125) - assert (r.PixelExtentInWorldY, 0.3125) - assert (r.ImageExtentInWorldX, 160) - assert (r.ImageExtentInWorldY, 160) - assert (r.XIntrinsicLimits, [0.5, 512.5]) - assert (r.YIntrinsicLimits, [0.5, 512.5]) -***** test - pixelExtentInWorldX = 0.1; - pixelExtentInWorldY = 0.4; - r = imref2d ([100, 200], pixelExtentInWorldX, pixelExtentInWorldY); - assert (r.XWorldLimits, [0.05, 20.05], 1e-4) - assert (r.YWorldLimits, [0.2, 40.2], 1e-4) - assert (r.ImageSize, [100, 200]) - assert (r.PixelExtentInWorldX, 0.1) - assert (r.PixelExtentInWorldY, 0.4) - assert (r.ImageExtentInWorldX, 20) - assert (r.ImageExtentInWorldY, 40) - assert (r.XIntrinsicLimits, [0.5, 200.5]) - assert (r.YIntrinsicLimits, [0.5, 100.5]) -***** test - r = imref2d; - assert (r.XWorldLimits, [0.5, 2.5]) - assert (r.YWorldLimits, [0.5, 2.5]) - assert (r.ImageSize, [2, 2]) - assert (r.PixelExtentInWorldX, 1) - assert (r.PixelExtentInWorldY, 1) - assert (r.ImageExtentInWorldX, 2) - assert (r.ImageExtentInWorldY, 2) - assert (r.XIntrinsicLimits, [0.5, 2.5]) - assert (r.YIntrinsicLimits, [0.5, 2.5]) - r.ImageSize = [800, 600]; - assert (r.XWorldLimits, [0.5, 2.5]) - assert (r.YWorldLimits, [0.5, 2.5]) - assert (r.ImageSize, [800, 600]) - assert (r.PixelExtentInWorldX, 0.003333, 1e-5) - assert (r.PixelExtentInWorldY, 0.0025) - assert (r.ImageExtentInWorldX, 2) - assert (r.ImageExtentInWorldY, 2) - assert (r.XIntrinsicLimits, [0.5, 600.5]) - assert (r.YIntrinsicLimits, [0.5, 800.5]) -***** test - r = imref2d; - assert (r.XWorldLimits, [0.5, 2.5]) - assert (r.YWorldLimits, [0.5, 2.5]) - assert (r.ImageSize, [2, 2]) - assert (r.PixelExtentInWorldX, 1) - assert (r.PixelExtentInWorldY, 1) - assert (r.ImageExtentInWorldX, 2) - assert (r.ImageExtentInWorldY, 2) - assert (r.XIntrinsicLimits, [0.5, 2.5]) - assert (r.YIntrinsicLimits, [0.5, 2.5]) - r.XWorldLimits = [-60, 13.33]; - r.YWorldLimits = [-900.8, -560.26]; - assert (r.XWorldLimits, [-60, 13.33]) - assert (r.YWorldLimits, [-900.8, -560.26]) - assert (r.PixelExtentInWorldX, 36.6650) - assert (r.PixelExtentInWorldY, 170.27, 1e-5) - assert (r.ImageExtentInWorldX, 73.33, 1e-5) - assert (r.ImageExtentInWorldY, 340.54, 1e-5) - assert (r.XIntrinsicLimits, [0.5, 2.5]) - assert (r.YIntrinsicLimits, [0.5, 2.5]) -***** test - r = imref2d; - fail ("r.XWorldLimits = []", "") - fail ("r.XWorldLimits = [1]", "") - fail ("r.XWorldLimits = [j]", "") - fail ("r.XWorldLimits = [1; 2]", "") - fail ("r.YWorldLimits = []", "") - fail ("r.YWorldLimits = [1]", "") - fail ("r.YWorldLimits = [j]", "") - fail ("r.YWorldLimits = [1; 2]", "") -***** assert (imref2d ([4, 2, 3]).ImageSize, [4, 2]); -32 tests, 32 passed, 0 known failure, 0 skipped -[inst/@imref2d/worldToIntrinsic.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/worldToIntrinsic.m -***** error id=Octave:invalid-fun-call worldToIntrinsic (imref2d) -***** error id=Octave:invalid-fun-call worldToIntrinsic (imref2d, 1, 2, 3) -***** error id=Octave:expected-real worldToIntrinsic (imref2d, 1j, 2) -***** error id=Octave:expected-real worldToIntrinsic (imref2d, 1, 2j) -***** error id=Octave:invalid-input-arg worldToIntrinsic (imref2d, [1, 2], 3) -***** error id=Octave:invalid-input-arg worldToIntrinsic (imref2d, [1], [2, 3]) -***** test - r = imref2d ([512, 512], 0.3125, 0.3125); - xW = [38.44, 39.44, 38.44, -0.2]; - yW = [68.75, 68.75, 75.75, -1]; - [xI, yI] = worldToIntrinsic (r, xW, yW); - assert (xI, [123.008, 126.208, 123.008, -0.64], 1e-6) - assert (yI, [220, 220, 242.4, -3.2], 1e-6) -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/@imref2d/intrinsicToWorld.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/intrinsicToWorld.m -***** error id=Octave:invalid-fun-call intrinsicToWorld (imref2d) -***** error id=Octave:invalid-fun-call intrinsicToWorld (imref2d, 1, 2, 3) -***** error id=Octave:expected-real intrinsicToWorld (imref2d, 1j, 2) -***** error id=Octave:expected-real intrinsicToWorld (imref2d, 1, 2j) -***** error id=Octave:invalid-input-arg intrinsicToWorld (imref2d, [1, 2], 3) -***** error id=Octave:invalid-input-arg intrinsicToWorld (imref2d, [1], [2, 3]) -***** test - r = imref2d ([512, 512], 0.3125, 0.3125); - xIntrinsic = [34, 442]; - yIntrinsic = [172, 172]; - [xWorld, yWorld] = intrinsicToWorld (r, xIntrinsic, yIntrinsic); - assert (xWorld, [10.625, 138.125]) - assert (yWorld, [53.75, 53.75]) -***** test - [xWorld, yWorld] = intrinsicToWorld (imref2d, -5.3, -2.8); - assert (xWorld, -5.3) - assert (yWorld, -2.8) -***** test - [xW, yW] = intrinsicToWorld (imref2d, [1, 2; 3, 4], [2, 3; 5, 9]); - assert (xW, [1, 2; 3, 4]) - assert (yW, [2, 3; 5, 9]) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/@imref2d/contains.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/contains.m -***** error id=Octave:invalid-fun-call contains (imref2d) -***** error id=Octave:invalid-fun-call contains (imref2d, 1) -***** error id=Octave:invalid-fun-call contains (imref2d, 1, 2, 3) -***** error id=Octave:invalid-input-arg contains (imref2d, 1, [2, 3]) -***** error id=Octave:invalid-input-arg contains (imref2d, [1, 2], 3) -***** error id=Octave:expected-real contains (imref2d, 0, j) -***** error id=Octave:expected-real contains (imref2d, j, 0) -***** assert (contains (imref2d, [], []), logical( zeros (0, 0))) -***** assert (contains (imref2d, [1, 2; 3, 4], [5, -6; 7, 8]), logical (zeros (2, 2))) -***** test - r = imref2d ([256, 256]); - assert (contains(r, [5, 8, 8], [5, 10, 257]), logical([1, 1, 0])) -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/@imref2d/worldToSubscript.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/@imref2d/worldToSubscript.m -***** error id=Octave:invalid-fun-call worldToSubscript (imref2d) -***** error id=Octave:invalid-fun-call worldToSubscript (imref2d, 1, 2, 3) -***** error id=Octave:expected-real worldToSubscript (imref2d, 1j, 2) -***** error id=Octave:expected-real worldToSubscript (imref2d, 1, 2j) -***** error id=Octave:invalid-input-arg worldToSubscript (imref2d, [1, 2], 3) -***** error id=Octave:invalid-input-arg worldToSubscript (imref2d, [1], [2, 3]) -***** test - r = imref2d ([512, 512], 0.3125, 0.3125); - xW = [38.44, 39.44, 38.44, -0.2]; - yW = [68.75, 68.75, 75.75, -1]; - [rS, cS] = worldToSubscript (r, xW, yW); - assert (rS, [220, 220, 242, NaN]) - assert (cS, [123, 126, 123, NaN]) -7 tests, 7 passed, 0 known failure, 0 skipped + assert (stretchlim (im, 0), rv) +***** assert (stretchlim (zeros (5)), [0; 1]) +***** assert (stretchlim (ones (5)), [0; 1]) +***** assert (stretchlim (.6 * ones (5)), [0; 1]) +***** assert (stretchlim (zeros (3, 3, 3, 3)), repmat ([0; 1], [1 3 3])) +***** assert (stretchlim ([0 .5 .5 .5 .5 1], .2), [0; 1]) +***** test + im = repmat ((magic (5) -1) / 24, [1 1 3 3]); + im(:,:,1,1) = 0; + im(:,:,2,2) = .5; + im(:,:,3,3) = 1; + lims = stretchlim (im, 0.2); + assert (size (lims), [2 3 3]) + assert (lims(:, [2 3 4 6 7 8]), + repmat ([(1/24)*round(24*.2); 1-((1/24)*round(24*.2))], [1 6]), eps) + assert (lims(:, [1 5 9]), repmat ([0; 1], [1 3])) +45 tests, 45 passed, 0 known failure, 0 skipped [inst/imtophat.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/imtophat.m ***** assert (imtophat (ones (3), [1 1; 0 1]), zeros (3)); @@ -13930,166 +11238,686 @@ 0 64 146 237 145 81 17 0]; ***** assert (imtophat (in, se), out); 8 tests, 8 passed, 0 known failure, 0 skipped -[inst/blockproc.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/blockproc.m +[inst/applylut.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/applylut.m ***** demo - blockproc (eye (6), [2, 2], @(x) any (x(:))) - # Returns a 3-by-3 diagonal -***** assert (blockproc (eye (6), [2, 2], "sum"), - blockproc (eye (6), [2, 2], @sum)) -***** assert (blockproc (eye (6), [2, 2], "sum"), - blockproc (eye (6), [2, 2], @(x) sum (x))) -***** assert (blockproc (eye (6), [1,2], @sum), - kron (eye (3), [1; 1])) -***** assert (blockproc (eye (6), [2,2], @(x) any (x(:))), - eye (3) != 0) -***** assert (blockproc (eye (6), [1,2],[1,1], @(x) sum (x(:))), - [2,1,0; 3,2,0; 2,3,1; 1,3,2; 0,2,3; 0,1,2]) -***** assert (blockproc (eye (6), "indexed", [1, 2], [1, 1], @(x) sum (x(:))), - [8,5,6; 6,2,3; 5,3,4; 4,3,5; 3,2,6; 6,5,8]) -***** assert (blockproc (eye (6), [2,3],[4,3], @(x) sum (x(:))), - ones (3, 2) * 6) -***** assert (blockproc (eye (6), [2, 2], @(x) int8 (sum (x(:)))), - eye (3, "int8") * 2) -***** assert (blockproc (uint8 (eye (6)), [1,2], [1,1], @(x) sum (x(:))), - [2,1,0; 3,2,0; 2,3,1; 1,3,2; 0,2,3; 0,1,2]) -***** assert (blockproc (uint8 (eye (6)), "indexed", [1,2], [1,1], @(x) sum (x(:))), - [2,1,0; 3,2,0; 2,3,1; 1,3,2; 0,2,3; 0,1,2]); -***** assert (blockproc (uint16 (eye (6)), [1,2], [1,1], @(x) sum (x(:))), - [2,1,0; 3,2,0; 2,3,1; 1,3,2; 0,2,3; 0,1,2]); -***** assert (blockproc (uint16 (eye (6)), "indexed", [1,2], [1,1], - @(x) sum (x(:))), - [2,1,0; 3,2,0; 2,3,1; 1,3,2; 0,2,3; 0,1,2]); -***** assert (blockproc (eye (6), [2, 2], "sum"), - blockproc (eye (6), [2, 2], inline ("sum (x)", "x"))) -warning: inline is obsolete; use anonymous functions instead -13 tests, 13 passed, 0 known failure, 0 skipped -[inst/xyz2rgb.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/xyz2rgb.m -***** assert (xyz2rgb ([0, 0, 0]), [0 0 0], 1e-3) -***** assert (xyz2rgb ([0.4125, 0.2127, 0.0193]), [1 0 0], 1e-3) -***** assert (xyz2rgb ([0.7700, 0.9278, 0.1385]), [1 1 0], 1e-3) -***** assert (xyz2rgb ([0.3576, 0.7152, 0.1192]), [0 1 0], 1e-3) -***** assert (xyz2rgb ([0.5380, 0.7873, 1.0694]), [0 1 1], 1e-3) -***** assert (xyz2rgb ([0.1804, 0.07217, 0.9502]), [0 0 1], 1e-3) -***** assert (xyz2rgb ([0.5929, 0.28484, 0.9696]), [1 0 1], 1e-3) -***** assert (xyz2rgb ([0.9505, 1.0000, 1.0888]), [1 1 1], 1e-3) -***** assert (xyz2rgb ([0.2034, 0.2140, 0.2330]), [0.5 0.5 0.5], 1e-3) -***** assert (xyz2rgb ([0.2155, 0.1111, 0.0101]), [0.75 0 0], 1e-3) -***** assert (xyz2rgb ([0.0883, 0.0455, 0.0041]), [0.5 0 0], 1e-3) -***** assert (xyz2rgb ([0.0210, 0.0108, 0.0010]), [0.25 0 0], 1e-3) -***** assert (xyz2rgb ([0.5276, 0.3812, 0.2482]), [1 0.5 0.5], 1e-3) -***** assert (xyz2rgb ([1.5 1 1]), [1.5712, 0.7109 0.9717], 1e-3) + lut = makelut (@(x) sum (x (:)) >= 3, 3); + S = applylut (eye (5), lut); + disp (S) + ## Everything should be 0 despite a diagonal which doesn't reach borders. +***** assert (prod (applylut (eye (3), makelut (@(x) x(1) == 1, 2)) == eye (3)), [1 1 1]); +***** assert (prod (applylut (eye (3), makelut (@(x) x(2,2) == 1, 3)) == eye (3)), [1 1 1]); +***** assert (prod (applylut (eye (3), makelut (@(x) x(3,3) == 1, 3)) == + applylut (eye (3), makelut (@(x) x(2,2) == 1, 2))), + [1 1 1]); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/lab2double.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2double.m ***** test - xyz_map = rand (64, 3); - assert (rgb2xyz (xyz2rgb (xyz_map)), xyz_map, 3e-4); + l_max_f = 100 + (25500 / 65280); + ab_max_f = 127 + (255 / 256); + cm = [ + -Inf + Inf + NaN + l_max_f + ab_max_f + -200 + -129 + -128 + -128+(255/65280)*(0.499999) + -128+(255/65280)*(0.500001) # should be 0.5, but float rounding error + -128+(255/65280)*(0.500002) + -127 + -1 + 0 + (100/65280)*(0.499999) + (100/65280)*(0.51) + (100/65280)*(0.500001) + 1 + 99 + 100 + 101 + 126 + 127 + 128 + 254 + 255 + 256 + 257]; + cm = repmat (cm, [1 3]); + im2d = reshape (cm, [7 4 3]); + imnd = permute (im2d, [1 4 3 2]); + + cm_uint8 = uint8 ([ + 0 0 0 + 255 255 255 + 255 255 255 + 255 228 228 + 255 255 255 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 1 1 + 0 127 127 + 0 128 128 + 0 128 128 + 0 128 128 + 0 128 128 + 3 129 129 + 252 227 227 + 255 228 228 + 255 229 229 + 255 254 254 + 255 255 255 + 255 255 255 + 255 255 255 + 255 255 255 + 255 255 255 + 255 255 255]); + + assert (lab2uint8 (cm), cm_uint8) + im2d_uint8 = reshape (cm_uint8, [7 4 3]); + assert (lab2uint8 (im2d), im2d_uint8) + assert (lab2uint8 (imnd), permute (im2d_uint8, [1 4 3 2])) + + cm_uint16 = uint16 ([ + 0 0 0 + 65535 65535 65535 + 65535 65535 65535 + 65535 58468 58468 + 65535 65535 65535 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 1 1 + 0 1 1 + 0 256 256 + 0 32512 32512 + 0 32768 32768 + 0 32768 32768 + 1 32768 32768 + 1 32768 32768 + 653 33024 33024 + 64627 58112 58112 + 65280 58368 58368 + 65535 58624 58624 + 65535 65024 65024 + 65535 65280 65280 + 65535 65535 65535 + 65535 65535 65535 + 65535 65535 65535 + 65535 65535 65535 + 65535 65535 65535]); + + assert (lab2uint16 (cm), cm_uint16) + im2d_uint16 = reshape (cm_uint16, [7 4 3]); + assert (lab2uint16 (im2d), im2d_uint16) + assert (lab2uint16 (imnd), permute (im2d_uint16, [1 4 3 2])) + + assert (lab2single (cm), single (cm)) + assert (lab2single (im2d), single (im2d)) + assert (lab2single (imnd), single (imnd)) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/imclearborder.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imclearborder.m ***** test - xyz_img = rand (64, 64, 3); - assert (rgb2xyz (xyz2rgb (xyz_img)), xyz_img, 3e-4); -***** assert (xyz2rgb (sparse ([0 0 0])), [0 0 0], 1e-3) -***** assert (class (xyz2rgb (single([0.5 0.5 0.5]))), 'single') -***** error xyz2rgb () -***** error xyz2rgb (1,2) -***** error xyz2rgb ({1}) -***** error xyz2rgb (ones (2,2)) + a = logical ([ + 0 1 0 0 1 0 0 0 0 1 + 1 0 0 0 0 1 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 1 0 1 0 1 0 1 0 0 1 + 0 0 0 0 0 0 0 1 1 0 + 0 0 1 0 0 1 0 1 0 0 + 0 1 0 1 0 1 1 0 0 0 + 0 0 0 1 0 0 0 0 0 0 + 0 0 0 1 0 1 1 0 0 0 + 0 0 0 1 1 0 0 0 1 0]); + + a4 = logical ([ + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 1 0 0 0 0 + 0 1 0 0 0 0 0 0 0 0 + 0 0 1 0 1 0 1 0 0 0 + 0 0 0 0 0 0 0 1 1 0 + 0 0 1 0 0 1 0 1 0 0 + 0 1 0 0 0 1 1 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 1 1 0 0 0 + 0 0 0 0 0 0 0 0 0 0]); + + a8 = logical ([ + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 1 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0]); + + assert (imclearborder (a, 4), a4) + assert (imclearborder (a, [0 1 0; 1 1 1; 0 1 0]), a4) + assert (imclearborder (a), a8) + assert (imclearborder (a, 8), a8) + assert (imclearborder (a, ones (3)), a8) ***** test - xyz = rand (16, 16, 3, 5); - rgb = zeros (size (xyz)); - for i = 1:5 - rgb(:,:,:,i) = xyz2rgb (xyz(:,:,:,i)); - endfor - assert (xyz2rgb (xyz), rgb) -23 tests, 23 passed, 0 known failure, 0 skipped -[inst/bwselect.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwselect.m + a = false (5, 5, 3); + a(2:4,2:4,:) = true; + assert (imclearborder (a, 4), a) + + a(1,2) = true; + a4 = a; + a4(:,:,1) = false; + assert (imclearborder (a, 4), a4) +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/bwpack.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwpack.m +***** error id=Octave:invalid-fun-call bwpack () +***** error id=Octave:invalid-input-arg bwpack ("text") +***** xtest + ## bug #55521 + assert (bwpack (eye (5)), uint32 ([1 2 4 8 16])) +***** xtest + ## bug #55521 + assert (bwpack (repmat (eye (4), 15, 1)), + uint32 ([286331153 572662306 1145324612 2290649224 + 17895697 35791394 71582788 143165576])) +***** xtest + ## bug #55521 + assert (bwpack (ones (3, 3, 3, 3)), repmat (uint32 (7), 1, 3, 3, 3)) +***** assert (bwpack (false (0, 10)), uint32 (zeros (0, 10))) +***** assert (bwpack (false (0, 0)), uint32 (zeros (0, 0))) +***** assert (bwpack (false (32, 0)), uint32 (zeros (1, 0))) +***** assert (bwpack (false (33, 0)), uint32 (zeros (2, 0))) +***** assert (bwpack (false (0, 10, 3)), uint32 (zeros (0, 10, 3))) +***** assert (bwpack (false (33, 0, 3)), uint32 (zeros (2, 0, 3))) +***** assert (bwpack (i), bwpack (logical (i))) +12 tests, 12 passed, 0 known failure, 0 skipped +[inst/affine3d.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/affine3d.m ***** test - BW = zeros(5, 'logical'); - BW(3, 4) = 1; - BW(4, 3) = 1; - res8 = bwselect (BW, 3, 4, 8); - assert (res8, BW) - res4 = bwselect (BW, 3, 4, 4); - res8_expected = BW; - res8_expected(4, 3) = 1; - assert (res8, res8_expected) + Sx = 1.2; + Sy = 1.6; + Sz = 2.4; + A = [Sx 0 0 0; 0 Sy 0 0; 0 0 Sz 0; 0 0 0 1]; + tform = affine3d (A); + [X, Y, Z] = transformPointsForward (tform, 5, 10, 3); + assert ([X Y Z], [6 16 7.2], 5*eps) + [U, V, W] = transformPointsInverse (tform, X, Y, Z); + assert ([U V W], [5 10 3], eps) + assert (! isRigid (tform)) + assert (! isTranslation (tform)) + assert (! isSimilarity (tform)) +***** test + A = [3 1 2 0; 4 5 8 0; 6 2 1 0; 0 0 0 1]; + tform = affine3d (A); + [X, Y, Z] = transformPointsForward (tform, 2, 3, 5); + assert (X, 48, eps) + assert (Y, 27, eps) + assert (Z, 33, eps) + [U, V, W] = transformPointsInverse (tform, X, Y, Z); + assert (U, 2, 50*eps) + assert (V, 3, 50*eps) + assert (W, 5, 50*eps) + assert (! isRigid (tform)) + assert (! isTranslation (tform)) + assert (! isSimilarity (tform)) +***** test + A = [1 0 0 0; 0 1 0 0; 0 0 1 0; 5 10 1 1]; + tform = affine3d (A); + X = transformPointsForward (tform, [1 2 3; 4 5 6; 7 8 9]); + assert (round (X), [6, 12, 4; 9, 15, 7; 12, 18, 10]) + U = transformPointsInverse (tform, X); + assert (round (U), [1 2 3; 4 5 6; 7 8 9]) + assert (isRigid (tform)) + assert (isTranslation (tform)) + assert (isSimilarity (tform)) +***** test + Sx = 1.2; + Sy = 1.6; + Sz = 2.4; + A = [Sx 0 0 0; 0 Sy 0 0; 0 0 Sz 0; 0 0 0 1]; + tform = affine3d (A); + [xlim, ylim, zlim] = outputLimits (tform, [1 128], [1 128], [1 27]); + assert (xlim, [ 1.2000 153.6000],1e-8) + assert (ylim, [1.6000 204.8000], 1e-8) + assert (zlim, [2.4000 64.8000], 1e-8) +***** error affine3d (1, 2) +***** error outputLimits (affine2d()) +***** test + a = 23; + M = [cosd(a) 0 sind(a) 0; + 0 1 0 0; + -sind(a) 0 cosd(a) 0; + 0 0 0 1]; + tform = affine3d (M); + tform2 = invert (tform); + assert (tform.T * tform2.T, diag([1 1 1 1]), eps); +***** test + tform = affine3d; + assert (tform.T, eye (4)) + assert (tform.Dimensionality, 3) +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/entropyfilt.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/entropyfilt.m +***** test + a = log2 (9) * ones (5, 5); + b = -(2*log2 (2/9) + log2 (1/9))/3; + a(1,2:4) = b; + a(5,2:4) = b; + a(2:4,1) = b; + a(2:4,5) = b; + c = -(4*log2 (4/9) + 4*log2 (2/9) + log2 (1/9))/9; + a(1,1) = c; + a(5,1) = c; + a(1,5) = c; + a(5,5) = c; + assert (entropyfilt (uint8 (magic (5)), ones (3, 3)), a, 2*eps); +***** test + assert (entropyfilt (uint8 (ones (10, 10))), zeros (10, 10)); +***** test + A = zeros (3,3); + B = ones (3,3); + C = [1 1 1; 2 2 2; 3 3 3]; + D = C'; + E = ones (3,3); + E(2,2) = 2; + F = 3 .* ones (3,3); + F(2,2) = 1; + G = [-1 2 7; -5 2 8; -7 pi 9]; + H = [5 2 8; 1 -3 1; 5 1 0]; + Hf = mat2gray(H); + X = uint8(abs(H)); + P = [0.2 0.201 0.204; 0.202 0.203 0.205; 0.205 0.206 0.202]; + Q = uint16([100 101 103; 100 105 102; 100 102 103]); + R = uint8([1 2 3 4 5; 11 12 13 14 15; 21 22 4 5 6; 5 5 3 2 1; 15 14 14 14 14]); + Aout = zeros (3); + Bout = zeros (3); + Cout = zeros (3); + Dout = zeros (3); + Eout = zeros (3); + Fout = zeros (3); + Gout_1 = -sum([2 7]./9.*log2([2 7]./9)); + Gout_2 = -sum([3 6]./9.*log2([3 6]./9)); + Gout_3 = -sum([4 5]./9.*log2([4 5]./9)); + Gout = [Gout_1 Gout_2 Gout_3; Gout_1 Gout_2 Gout_3; Gout_1 Gout_2 Gout_3]; + Hout_5 = -sum([2 7]./9.*log2([2 7]./9)) ; + Hout = [0.8916 0.8256 0.7412; 0.8256 Hout_5 0.6913; 0.7412 0.6913 0.6355]; + Hfout_5 = -sum([3 2 1 1 1 1]./9.*log2([3 2 1 1 1 1]./9)); + Hfout = [2.3613 2.3296 2.2252; 2.4571 Hfout_5 2.3090; 2.4805 2.4488 2.3445]; + Xout_5 = -sum([1 1 1 1 2 3]./9.*log2([1 1 1 1 2 3]./9)); + Xout = [2.3613 2.3296 2.2252; 2.4571 Xout_5 2.3090; 2.4805 2.4488 2.3445]; + Pout_5 = -sum([1 2 6]./9.*log2([1 2 6]./9)); + Pout = [1.1137 1.1730 1.2251; 1.1595 Pout_5 1.2774; 1.1556 1.2183 1.2635]; + Qout = zeros(3); + Rout = [3.5143 3.5700 3.4871 3.4957 3.4825; + 3.4705 3.5330 3.4341 3.4246 3.3890; + 3.3694 3.4063 3.3279 3.3386 3.3030; + 3.3717 3.4209 3.3396 3.3482 3.3044; + 3.4361 3.5047 3.3999 3.4236 3.3879]; + assert (entropyfilt (A), Aout); + assert (entropyfilt (B), Bout); + assert (entropyfilt (C), Cout); + assert (entropyfilt (D), Dout); + assert (entropyfilt (E), Eout); + assert (entropyfilt (F), Fout); + assert (entropyfilt (G), Gout, 1e-4); + assert (entropyfilt (H), Hout, 1e-4); + assert (entropyfilt (Hf), Hfout, 1e-4); + assert (entropyfilt (X), Xout, 1e-4); + assert (entropyfilt (P), Pout, 1e-4); + assert (entropyfilt (Q), Qout); + assert (entropyfilt (R), Rout, 1e-4); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/houghpeaks.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/houghpeaks.m +***** shared im1 + im1 = magic (5); +***** error houghpeaks () +***** error houghpeaks (1, 2, 3, 4, 5, 6, 7) +***** assert (houghpeaks (im1)) +***** assert (houghpeaks (im1, 2)) +***** assert (houghpeaks (im1, "Threshold", 10)) +***** assert (houghpeaks (im1, 2, "Threshold", 10)) +***** assert (houghpeaks (im1, "NHoodSize", [3 3])) +***** assert (houghpeaks (im1, 2, "NHoodSize", [3 3])) +***** assert (houghpeaks (im1, "Threshold", 10, "NHoodSize", [3 3])) +***** assert (houghpeaks (im1, "NHoodSize", [3 3], "Threshold", 10)) +***** assert (houghpeaks (im1, 2, "Threshold", 10, "NHoodSize", [3 3])) +***** assert (houghpeaks (im1, 2, "NHoodSize", [3 3], "Threshold", 10)) +***** error houghpeaks (ones (5, 5, 5)) +***** error houghpeaks ("hello") +***** error houghpeaks (im1, 1.5) +***** error houghpeaks (im1, -2) +***** error houghpeaks (im1, [1 1]) +***** error houghpeaks (im1, "Threshold", "hello") +***** error houghpeaks (im1, "Threshold", -2) +***** error houghpeaks (im1, "Threshold", [1 1]) +***** error houghpeaks (im1, "NHoodSize", [3 3 3]) +***** error houghpeaks (im1, "NHoodSize", "hello") +***** error houghpeaks (im1, "NHoodSize", [-3 -3]) +***** error houghpeaks (im1, "NHoodSize", [4 4]) +***** test + out = houghpeaks (im1); + assert (size (out), [1 2]) + assert (class (out), "double") +***** test + out = houghpeaks (im1, 3); + assert (size (out), [3 2]) +***** test + expected = [5 3; 1 2; 3 5; 1 5]; + assert (houghpeaks (im1, 4), expected) # this checks for undocumented nhood >=3 + assert (houghpeaks (im1, 4, "nhoodsize", [3,3]), expected) + assert (houghpeaks (im1, 4, "threshold", 10), expected) + assert (houghpeaks (im1, 4, "threshold", 24), expected(1:2,:)) +***** test + im2 = magic (7); + expected_a = [7 4; 1 3; 3 1; 5 6]; + expected_b = [7 4; 1 3; 4 7; 1 7]; + assert (houghpeaks (im2, 4), expected_a) + assert (houghpeaks (im2, 4, "nhoodsize", [5,5]), expected_b) + assert (houghpeaks (im2, 4, "threshold", 24), expected_a) + assert (houghpeaks (im2, 4, "threshold", 47), expected_a(1:2,:)) +***** test + im3 = magic (99); + expected_a = [99 50; 1 49; 3 47; 5 45; 7 43; 9 41; 11 39]; + expected_b = [99 50; 1 49; 7 43; 13 37; 19 31; 25 25; 31 19]; + expected_c = [99 50; 1 49; 2 48; 3 47; 4 46; 5 45; 6 44]; + assert (houghpeaks (im3, 7), expected_a) + assert (houghpeaks (im3, 7, "nhoodsize", [11 11]), expected_b) + assert (houghpeaks (im3, 7, "nhoodsize", [11 1]), expected_c) + assert (houghpeaks (im3, 7, "nhoodsize", [11 1]), expected_c) +***** test + im4 = double (im2uint16 (peaks ())); + expected_a = [37 15; 39 15; 41 15; 15 16; 17 16]; + expected_b = [37 15; 15 16; 26 21; 37 26; 20 32]; + expected_c = [37 15; 15 16; 35 16; 15 17; 35 17]; + expected_d = [37 15; 38 15; 39 15; 40 15; 41 15]; + assert (houghpeaks (im4, 5), expected_a) + assert (houghpeaks (im4, 5, "nhoodsize", [21 21]), expected_b) + assert (houghpeaks (im4, 5, "nhoodsize", [21 1]), expected_c) + assert (houghpeaks (im4, 5, "nhoodsize", [1 21]), expected_d) +***** test # tests use of anti-symmetry in H + im5 = zeros (6,4); im5(2,1) = 1; im5(5,4) = 2; + expected = [5 4; 2 1]; + assert (houghpeaks (im5, 2, "nhoodsize", [1 1]), expected); + assert (houghpeaks (im5, 2, "nhoodsize", [3 3]), expected(1,:)); +***** test #test use of anti-symmetry in the other direction + im6 = magic (100); + expected_a = [1 1; 100 99; 1 4; 100 95; 1 8; 100 91; 1 12]; + expected_b = [1 1; 100 95; 1 8; 100 87; 1 16; 100 79; 1 24]; + expected_c = [1 1; 100 99; 100 98; 1 4; 1 5; 100 95; 100 94]; + expected_d = expected_b; + assert (houghpeaks (im6, 7), expected_a) + assert (houghpeaks (im6, 7, "nhoodsize", [11 11]), expected_b) + assert (houghpeaks (im6, 7, "nhoodsize", [11 1]), expected_c) + assert (houghpeaks (im6, 7, "nhoodsize", [1 11]), expected_d) +***** test # test undocumented Matlab default value for nhoodsize + im = zeros (723, 180); + im(585,136) = 8; + im(593,135) = 7; + im(310,46) = 6; + expected = [585, 136; 310, 46]; + assert (houghpeaks (im, 2), expected) +***** test + I = max (0, phantom ()); + H = hough (I); + P0 = [585, 136; 310, 46; 595, 136; 522, 104; 373, 46]; + assert (houghpeaks (H, 5), P0) +***** demo + I = checkerboard (30, 1, 1); + I = imnoise(I, "salt & pepper", 0.2); + figure, imshow (I); + title ("noisy image with some lines"); + BW = edge (I, "canny"); + figure, imshow(BW); + title ("edge image"); + [H, theta, rho] = hough (BW); + figure, imshow (mat2gray (H), [],"XData",theta,"YData",rho); + title ("Hough transform of edge image \n 2 peaks marked"); + axis on; xlabel("theta [degrees]"); ylabel("rho [pixels]"); + peaks = houghpeaks (H, 2); + peaks_rho = rho(peaks(:,1)) + peaks_theta = theta(peaks(:,2)) + hold on; + plot(peaks_theta,peaks_rho,"sr"); + hold off; +34 tests, 34 passed, 0 known failure, 0 skipped +[inst/imhmax.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imhmax.m +***** shared im0, im0_h2_out + im0 = uint8 ([0 0 0 0 0; + 0 1 2 1 0; + 0 2 5 2 0; + 0 1 2 1 0; + 0 0 0 0 0]); + im0_h2_out = uint8 ([0 0 0 0 0; + 0 1 2 1 0; + 0 2 3 2 0; + 0 1 2 1 0; + 0 0 0 0 0]); +***** error imhmax () +***** error imhmax (im0) +***** error imhmax ("hello", 2) +***** error imhmax (i.*im0, 2) +***** error imhmax (sparse (im0), 2) +***** error imhmax (im0, -2) +***** error imhmax (im0, 'a') +***** error imhmax (im0, ones (2)) +***** error imhmax (im0, 2*i) +***** assert (imhmax (im0, 2), im0_h2_out) +***** assert (imhmax (double (im0), 2), double (im0_h2_out)) +***** assert (imhmax (im0, 2, 8), im0_h2_out) +***** assert (imhmax (im0, 2, 4), im0_h2_out) +***** assert (imhmax (im0, 2, true (3)), im0_h2_out) +***** test + out = imhmax (double (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "double") +***** test + out = imhmax (single (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "single") +***** test + out = imhmax (uint8 (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "uint8") +***** test + out = imhmax (uint16 (im0), 2); + assert (size (out), size (im0)) + assert (class (out), "uint16") +***** test + im = cat (3, im0, im0, im0, im0); + out = imhmax (im, 2); + assert (size (out), size (im)) +***** test + im = zeros (10); + im(2:4, 2:4) = 3; + im(6:8, 6:8) = 8; + expected_4 = zeros (10); + expected_4(6:8, 6:8) = 4; + expected_2 = zeros (10); + expected_2(2:4, 2:4) = 1; + expected_2(6:8, 6:8) = 6; + out = imhmax (im, 4); + assert (out, expected_4, eps) + out = imhmax (im, 2); + assert (out, expected_2, eps) + out = imhmax (0.1 .* im, 0.4); + assert (out, 0.1 .* expected_4, eps) +***** test + im2 = zeros (10); + im2(2:4, 2:4) = 3; + im2(6:9, 6:9)=8; + im2(5, 5)=8; + im2(6, 7)=0; + im2(7, 8)=0; + expected_4 = zeros (10); + expected_4(6:9, 6:9) = 4; + expected_4(5, 5) = 4; + expected_4(6, 7) = 0; + expected_4(7, 8) = 0; + expected_8 = expected_4; + expected_8(2:4, 2:4) = 3; + out2 = imhmax (im2, 4); + assert (out2, expected_8, eps) + out2 = imhmax (im2, 4, 4); + assert (out2, expected_4, eps) + out2 = imhmax (im2, 4, 8); + assert (out2, expected_8, eps) +21 tests, 21 passed, 0 known failure, 0 skipped +[inst/bestblk.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/bestblk.m +***** demo + siz = bestblk ([200; 10], 50); + disp (siz) +***** error bestblk ("string") +***** error bestblk ([100 200], "string") +***** error <2 elements> bestblk ([100], 5) +***** assert (bestblk ([ 10 12], 2), [ 2 2]); +***** assert (bestblk ([ 10 12], 3), [ 2 3]); +***** assert (bestblk ([300 100], 150), [150 100]); +***** assert (bestblk ([256 128], 17), [ 16 16]); +***** assert (bestblk ([ 17 17], 3), [ 3 3]); +***** assert (bestblk ([230 470]), bestblk ([230 470], 100)) +***** assert (bestblk ([10 12 10], 3), [2 3 2]); +***** assert (bestblk ([ 9 12 9], 3), [3 3 3]); +***** assert (bestblk ([10 12 10 11], 5), [5 4 5 4]); +12 tests, 12 passed, 0 known failure, 0 skipped +[inst/poly2mask.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/poly2mask.m +***** demo + s = [0:pi/4:2*pi]; + x = cos (s) * 90 + 101; + y = sin (s) * 90 + 101; + bw = poly2mask(x, y, 200, 200); + imshow (bw); +***** demo + s = [0:2*pi/5:pi*4]; + s = s ([1, 3, 5, 2, 4, 6]); + x = cos (s) * 90 + 101; + y = sin (s) * 90 + 101; + bw = poly2mask (x, y, 200, 200); + imshow (bw); +***** # Convex polygons +***** shared xs, ys, Rs, xt, yt, Rt + xs=[3,3,10,10]; + ys=[4,12,12,4]; + Rs=zeros(16,14); + Rs(5:12,4:10)=1; + Rs=logical(Rs); + xt=[1,4,7]; + yt=[1,4,1]; + Rt=[0,0,0,0,0,0,0; + 0,0,1,1,1,1,0; + 0,0,0,1,1,0,0; + 0,0,0,1,0,0,0; + 0,0,0,0,0,0,0]; + Rt=logical(Rt); +***** assert(poly2mask(xs,ys,16,14),Rs); # rectangle +***** assert(poly2mask(xs,ys,8,7),Rs(1:8,1:7)); # clipped +***** assert(poly2mask(xs-7,ys-8,8,7),Rs(9:16,8:14)); # more clipping +***** assert(poly2mask(xt,yt,5,7),Rt); # triangle +***** assert(poly2mask(xt,yt,3,3),Rt(1:3,1:3)); # clipped +***** # Concave polygons +***** test + x=[3,3,5,5,8,8,10,10]; + y=[4,12,12,8,8,11,11,4]; + R=zeros(16,14); + R(5:12,4:5)=1; + R(5:8,6:8)=1; + R(5:11,9:10)=1; + R=logical(R); + assert(poly2mask(x,y,16,14), R); +***** # Complex polygons +***** test + x=[1,5,1,5]; + y=[1,1,4,4]; + R=[0,0,0,0,0,0; + 0,0,1,1,0,0; + 0,0,1,1,0,0; + 0,1,1,1,1,0; + 0,0,0,0,0,0]; + R=logical(R); + assert(poly2mask(x,y,5,6), R); +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/axes2pix.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/axes2pix.m +***** error id=Octave:invalid-fun-call axes2pix () +***** error id=Octave:invalid-fun-call axes2pix (42) +***** error id=Octave:invalid-fun-call axes2pix (42, [1, 2]) +***** error id=Octave:invalid-input-arg axes2pix ([42, 43], [1, 2], [1, 2, 3]) +***** error id=Octave:invalid-input-arg axes2pix (42, [1, 2; 3, 4], [1, 2, 3]) +***** assert (axes2pix (42, [1 42], []), []) +***** assert (axes2pix (240, [1, 240], 30), 30) +***** assert (axes2pix (291, [1, 291], 30), 30) +***** assert (axes2pix (240, [400.5, 520], 450), 100) +***** assert (axes2pix (291, [-19, 271], 90), 110) +***** assert (axes2pix (1, [1 1], [0, 1, 2, 3, 4]), [0, 1, 2, 3, 4]) +***** assert (axes2pix (5, [1 1], [0, 1, 2, 3, 4]), [0, 1, 2, 3, 4]) +***** assert (axes2pix (0, [1 1], [0, 1, 2, 3, 4]), [0, 1, 2, 3, 4]) +***** assert (axes2pix (5, [5 1], [1, 2, 3, 4, 5]), [5, 4, 3, 2, 1]) +***** assert (axes2pix (5, [3 -1], [1, 2, 3, 4, 5]), [3, 2, 1, 0, -1]) +***** assert (axes2pix (25, [5 1], [1, 2, 3, 4, 5]), [25, 19, 13, 7, 1]) +***** assert (axes2pix (1, [1 5], [1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]) +***** assert (axes2pix (1, [5 1], [-1, 0, 1, 2.5]), [-5, -4, -3, -1.5]) +***** assert (axes2pix (1, [-10 -15], [-1, 0, 1.5]), [10, 11, 12.5]) +***** assert (axes2pix (5, [5; 1], [1, 2, 3, 4, 5]), [5, 4, 3, 2, 1]) +***** assert (axes2pix (5, [5; 1], [1; 2; 3; 4; 5]), [5; 4; 3; 2; 1]) +21 tests, 21 passed, 0 known failure, 0 skipped +[inst/im2bw.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/im2bw.m +***** assert(im2bw ([0 0.4 0.5 0.6 1], 0.5), logical([0 0 0 1 1])); # basic usage +***** assert(im2bw (uint8 ([0 100 255]), 0.5), logical([0 0 1])); # with a uint8 input +***** warning bw = im2bw (logical ([0 1 0])); +***** warning bw = im2bw (logical ([0 1 0]), 1); +***** test + warning ("off", "all", "local"); + assert (im2bw (logical ([0 1 0])), logical ([0 1 0])) + assert (im2bw (logical ([0 1 0]), 0), logical ([0 1 0])) + assert (im2bw (logical ([0 1 0]), 1), logical ([0 1 0])) +***** assert (nnz (im2bw (uint8 ([0:255]), 0.9)), 26) +***** test + img = uint8 ([0:255]); + s = 0; + for i=0:.1:1 + s += nnz (im2bw (img, i)); + endfor + assert (s, 1405) +***** assert (nnz (im2bw (int16 ([-128:127]), 0.499)), 194) +***** assert (nnz (im2bw (int16 ([-128:127]), 0.500)), 128) +***** assert (nnz (im2bw (int16 ([-128:127]), 0.501)), 62) ***** test - A = [0 1 0 0 1; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]; - R4 = zeros(5, 'logical'); - R4(1, 1) = 1; - R8 = logical([1 0 1 1 0; 0 1 0 1 1; 0 1 0 0 1; 0 0 0 1 1; 0 1 1 0 1]); - out = bwselect (A, 1, 1, 4); - assert (out, zeros (5, 'logical')) - out = bwselect (A, 1, 1, 8); - assert (out, zeros (5, 'logical')) - out = bwselect (! A, 1, 1, 4); - assert (out, R4) - out = bwselect (! A, 1, 1, 8); - assert (out, R8) - - B4 = logical([0 0 0 0 0; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 0 0]); - B8 = logical([0 1 0 0 0; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); - out = bwselect (A, 3, 3, 4); - assert (out, B4) - out = bwselect (A, 3, 3, 8); - assert (out, B8) - out = bwselect (A, 3, 3); - assert (out, B8) - - C4 = logical ([0 0 1 1 0; 0 0 0 1 1; 0 0 0 0 1; 0 0 0 1 1; 0 0 0 0 1]); - C8 = logical ([1 0 1 1 0; 0 1 0 1 1; 0 1 0 0 1; 0 0 0 1 1; 0 1 1 0 1]); - out = bwselect (! A, 3, 1, 8); - assert (out, C8) - out = bwselect (! A, 3, 1); - assert (out, C8) - out = bwselect (! A, 3, 1, 4); - assert (out, C4) - - D4 = logical ([0 0 0 0 0; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 0 0]); - D8 = logical ([0 1 0 0 0; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); - out = bwselect (A, [3 1], [1 3], 4); - assert (out, D4); - out = bwselect (A, [3 1], [1 3], 8); - assert (out, D8); - out = bwselect (A, [3 1], [1 3]); - assert (out, D8); + img = uint16 ([0:intmax("uint16")]); + s = 0; + for i=0:.1:1 + s += nnz (im2bw (img, i)); + endfor + assert (s, 360445) ***** test -***** error id=Octave:invalid-fun-call bwselect () -***** error id=Octave:invalid-fun-call bwselect ("aaa") -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/edgetaper.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/edgetaper.m -***** assert (class (edgetaper (rand (100), rand (16))), "double") -***** assert (class (edgetaper (randi (255, 100, "uint8"), rand (16))), "uint8") -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/imgradient.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imgradient.m + img = int16 ([intmin("int16"):intmax("int16")]); + s = 0; + for i=0:.1:1 + s += nnz (im2bw (img, i)); + endfor + assert (s, 360445) ***** test - A = [0 1 0 - 1 1 1 - 0 1 0]; - - [gMag, gDir] = imgradient (A); - assert (gMag,[sqrt(18) 4 sqrt(18); 4 0 4; sqrt(18),4,sqrt(18)]); - assert (gDir,[-45 -90 -135; -0 -0 -180; 45 90 135]); - - ## the following just test if passing gx and gy separately gets - ## us the same as the image and method though imgradient - [gxSobel, gySobel] = imgradientxy (A, "Sobel"); - [gxPrewitt, gyPrewitt] = imgradientxy (A, "Prewitt"); - [gxCd, gyCd] = imgradientxy (A, "CentralDifference"); - [gxId, gyId] = imgradientxy (A, "IntermediateDifference"); - - assert (imgradient (A), - imgradient (gxSobel, gySobel)); - assert (imgradient (A, "Sobel"), - imgradient (gxSobel, gySobel)); - assert (imgradient (A, "Prewitt"), - imgradient(gxPrewitt, gyPrewitt)); - assert (imgradient (A, "CentralDifference"), - imgradient (gxCd, gyCd)); - assert (imgradient (A, "IntermediateDifference"), - imgradient (gxId, gyId)); -1 test, 1 passed, 0 known failure, 0 skipped + im = [((randn(10)/10)+.3) ((randn(10)/10)+.7)]; + assert (im2bw (im, "Otsu"), im2bw (im, graythresh (im, "Otsu"))) + assert (im2bw (im, "moments"), im2bw (im, graythresh (im, "moments"))) +***** test + im = [((randn(10)/10)+.3) ((randn(10)/10)+.7)]; + im = reshape (im, [10 10 1 2]); + assert (im2bw (im, "Otsu"), im2bw (im, graythresh (im, "Otsu"))) + assert (im2bw (im, "moments"), im2bw (im, graythresh (im, "moments"))) +14 tests, 14 passed, 0 known failure, 0 skipped [inst/imrotate.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/imrotate.m ***** test @@ -14198,76 +12026,391 @@ endfor endfor 6 tests, 5 passed, 1 known failure, 0 skipped -[inst/imadd.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imadd.m -***** assert (imadd (uint8 ([23 250]), uint8 ([23 250])), uint8 ([46 255])); # default to first class and truncate -***** assert (imadd (uint8 ([23 250]), 10), uint8 ([33 255])); # works adding a scalar -***** assert (imadd (uint8 ([23 250]), uint8 ([23 250]), "uint16"), uint16 ([46 500])); # defining output class works -***** assert (imadd (logical ([ 1 0]), logical ([ 1 1])), double ([ 2 1])); # return double for two logical images -***** assert (imadd (logical ([ 1 0]), logical ([ 1 1]), "logical"), logical ([ 1 1])); # this is matlab incompatible on purpose -***** fail ("imadd (uint8 ([23 250]), uint16 ([23 250]))"); # input need to have same class +[inst/immse.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/immse.m +***** error immse (rand (10), rand (12)) +***** error immse (uint8 ([0 1 2 3]), uint16 ([0 1 2 3])) +***** error immse (double ([0 1 2 3]), single ([0 1 2 3])) +***** assert (immse (magic (5), magic (5)), 0) +***** assert (immse (single (magic (5)), single (magic (5))), single (0)) +***** assert (immse (uint8 (magic (5)), uint8 (magic (5))), 0) 6 tests, 6 passed, 0 known failure, 0 skipped -[inst/imshear.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imshear.m -***** error imshear () -***** error imshear (1) -***** error imshear (1, "x") -***** error imshear (1, "x", 3, "loose", 5, 6) -***** error imshear ("foo", "x", 3) -***** error imshear ({1, 2, 3}, "x", 3) -***** error imshear (reshape (1:24, 4, 3, 2), "x", 3) -***** error imshear (reshape (1:24, 2, 3, 2, 2), "x", 3) -***** error imshear (1, "Z", 3) -***** error imshear (1, "x", "foo") -***** error imshear (1, "x", "f") -***** error imshear (1, "x", [1, 2, 3]) -***** error imshear (1, "x", {3}) -***** error imshear (1, "x", 3, "foo") -***** error imshear (1, "x", 3, "loose", 7) -***** error imshear (1, "x", 3, "loose", "foo") -***** error imshear (1, "x", 3, "loose", [1 0]) -17 tests, 17 passed, 0 known failure, 0 skipped -[inst/bwpack.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwpack.m -***** error id=Octave:invalid-fun-call bwpack () -***** error id=Octave:invalid-input-arg bwpack ("text") -***** xtest - ## bug #55521 - assert (bwpack (eye (5)), uint32 ([1 2 4 8 16])) -***** xtest - ## bug #55521 - assert (bwpack (repmat (eye (4), 15, 1)), - uint32 ([286331153 572662306 1145324612 2290649224 - 17895697 35791394 71582788 143165576])) -***** xtest - ## bug #55521 - assert (bwpack (ones (3, 3, 3, 3)), repmat (uint32 (7), 1, 3, 3, 3)) -***** assert (bwpack (false (0, 10)), uint32 (zeros (0, 10))) -***** assert (bwpack (false (0, 0)), uint32 (zeros (0, 0))) -***** assert (bwpack (false (32, 0)), uint32 (zeros (1, 0))) -***** assert (bwpack (false (33, 0)), uint32 (zeros (2, 0))) -***** assert (bwpack (false (0, 10, 3)), uint32 (zeros (0, 10, 3))) -***** assert (bwpack (false (33, 0, 3)), uint32 (zeros (2, 0, 3))) -***** assert (bwpack (i), bwpack (logical (i))) +[inst/im2single.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/im2single.m +***** assert (im2single (single ([1 2 3])), single ([1 2 3])); +***** assert (im2single ([1 2 3]), single ([1 2 3])); +***** assert (im2single (uint8 ([0 127 128 255])), single ([0 127/255 128/255 1])); +***** assert (im2single (uint16 ([0 127 128 65535])), single ([0 127/65535 128/65535 1])); +***** assert (im2single (int16 ([-32768 -32767 -32766 32767])), single ([0 1/65535 2/65535 1])); +***** assert (im2single (uint8 ([0 1 255]), "indexed"), single ([1 2 256])); +***** assert (im2single (uint16 ([0 1 2557]), "indexed"), single ([1 2 2558])); +***** assert (im2single ([3 25], "indexed"), single ([3 25])); +***** error im2single ([0 1 2], "indexed"); +***** error im2single (int16 ([17 8]), "indexed"); +***** error im2single (int16 ([-7 8]), "indexed"); +***** error im2single ([false true], "indexed"); 12 tests, 12 passed, 0 known failure, 0 skipped -[inst/imhist.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/imhist.m -***** shared nn, bb, enn, ebb - [nn, bb] = imhist(logical([0 1 0 0 1])); -***** assert({nn, bb}, {[3 2]', [0 1]'}) - [nn, bb] = imhist([0 0.2 0.4 0.9 1], 5); -***** assert({nn, bb}, {[1 1 1 0 2]', [0 0.25 0.5 0.75 1]'}) - [nn, bb] = imhist([-2 0 0.2 0.4 0.9 1 5], 5); -***** assert({nn, bb}, {[2 1 1 0 3]', [0 0.25 0.5 0.75 1]'}) - [nn, bb] = imhist(uint8([0 32 255]), 256); - enn = zeros(256, 1); enn([1, 33, 256]) = 1; - ebb = 0:255; -***** assert({nn, bb}, {enn, ebb'}) - [nn, bb] = imhist(int8([-50 0 100]), 31); - enn = zeros(31, 1); enn([10, 16, 28]) = 1; - ebb = -128:8.5:127; -***** assert({nn, bb}, {enn, ebb'}) +[inst/otsuthresh.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/otsuthresh.m +***** test + histo = zeros (1, 256); + histo([ 29 33 37 41 46 50 54 58 62 66 70 74 78 82 ... + 86 90 94 98 102 106 110 114 118 122 126 131 135 139 ... + 143 147 151 155 159 163 167 171 175 179 183 187 191 195 ... + 199 203 207 211 216 220 224 228 232 236 240 244 248 252]) = ... + [2 27 51 144 132 108 43 29 22 21 22 20 10 16 17 12 13 14 12 13 ... + 15 25 19 20 23 37 23 65 92 84 87 54 50 54 33 73 76 64 57 58 47 ... + 48 30 27 22 20 20 11 12 12 11 7 17 31 37 31]; + assert (otsuthresh (histo), 114.5/255) +***** test + I = max (phantom (), 0); + H = imhist (I); + assert (otsuthresh (H), 178/255) + assert (otsuthresh (H'), 178/255) + H = imhist (I, 10); + assert (otsuthresh (H), 170/255) +***** assert (otsuthresh (100), 0) +***** assert (otsuthresh (zeros (256, 1)), 0) +***** assert (otsuthresh (zeros (5, 1)), 0) +***** assert (otsuthresh (uint8 ([10 20 30])), 0.5) +***** assert (otsuthresh (int32 ([100 200 300])), 0.5) +***** assert (otsuthresh (int32 ([100 200])), 0) +***** assert (otsuthresh (single ([10 20 30 40])), 1/3); +***** assert (otsuthresh (uint16 ([10 20 30 40 50 60 70 80 90 100])), 5/9) +***** assert (otsuthresh (int16 ([10 20 30 40 50 60 70 80 90 100])), 5/9) +***** assert (otsuthresh (int16 (1:255)), 156/254) +***** assert (otsuthresh (int16 (1:1023)), 631/1022) +***** assert (otsuthresh (int8 (1:1023)), 541/1022) +***** test + warning ("off", "Octave:data-file-in-path", "local"); + S = load ("penny.mat"); + h = imhist (uint8 (S.P)); + assert (otsuthresh (h), 94/255); +***** test + I = max (phantom (), 0); + h = imhist (I, 5); + assert (otsuthresh (h), 0.625); +***** error id=Octave:invalid-fun-call otsuthresh () +***** error id=Octave:invalid-fun-call otsuthresh (ones (10), 5) +***** error otsuthresh ([]) +***** error otsuthresh ([Inf 10]) +***** error otsuthresh ([10 NA]) +***** error otsuthresh ([10 NaN]) +***** error otsuthresh (zeros (5)) +***** error otsuthresh ([10 -10]) +***** error otsuthresh ("foo") +***** demo + I = max (phantom (), 0); + figure; imshow (I); + title ("Original image"); + h = imhist (I); + t = otsuthresh (h); + J = im2bw (I); + figure; imshow (J); + title_line = sprintf ("Black and white image after thresholding, t=%g", + t*255); + title (title_line); +***** demo + warning ("off", "Octave:data-file-in-path", "local"); + S = load ("penny.mat"); + I = uint8 (S.P); + figure; imshow (I); + title ("Original penny image"); + h = imhist (I); + t = otsuthresh (h); + J = im2bw (I); + figure; imshow (J); + title_line = sprintf ("Black and white penny image after thresholding, t=%g", + t*255); + title (title_line); + I = 255 - I; + figure; imshow(I); + title ("Negative penny image"); + h = imhist (I); + t = otsuthresh (h); + J = im2bw (I); + figure; imshow (J); + title_line = sprintf ("Black and white negative penny image after thresholding, t=%g", + t*255); + title (title_line); +25 tests, 25 passed, 0 known failure, 0 skipped +[inst/im2int16.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/im2int16.m +***** assert (im2int16 (int16 ([-2 2 3])), int16 ([-2 2 3])); +***** assert (im2int16 (uint16 ([0 65535])), int16 ([-32768 32767])); +***** assert (im2int16 ([false true]), int16 ([-32768 32767])); +***** assert (im2int16 ([true false]), int16 ([32767 -32768])); +***** assert (im2int16 (uint8 ([0 127 128 255])), int16 ([-32768 -129 128 32767])); +***** assert (im2int16 ([0 1.4/65535 1.5/65535 2/65535 1]), int16 ([-32768 -32767 -32766 -32766 32767])); +***** assert (im2int16 ([0 0.5 1]), int16 ([-32768 0 32767])); +***** assert (im2int16 ([-1 0 1 2]), int16 ([-32768 -32768 32767 32767])); +***** error im2int16 ([1 2], "indexed"); +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/imclose.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imclose.m +***** shared in, out + in = [ 0 0 0 1 1 1 0 0 1 1 + 0 1 0 1 1 1 0 0 0 1 + 1 1 1 1 1 0 0 0 0 0 + 0 1 1 1 1 0 0 0 0 0 + 0 0 0 1 0 0 0 0 1 0 + 0 0 0 0 0 0 0 1 1 1 + 0 0 0 0 1 0 1 0 1 0 + 0 0 0 1 1 1 1 1 0 0 + 0 0 0 0 1 1 1 0 0 0 + 0 0 0 1 1 1 0 0 0 0]; + + out = [ 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 0 0 0 1 + 1 1 1 1 1 0 0 0 0 1 + 1 1 1 1 1 0 0 0 0 1 + 0 0 0 1 1 0 0 0 1 1 + 0 0 0 1 1 1 1 1 1 1 + 0 0 0 1 1 1 1 1 1 1 + 0 0 0 1 1 1 1 1 0 0 + 0 0 0 1 1 1 1 0 0 0 + 0 0 0 1 1 1 1 0 0 0]; +***** assert (imclose (logical (in), ones (3)), logical (out)); + + out = [99 99 16 16 16 73 74 64 64 64 + 98 88 16 16 16 73 71 64 64 64 + 93 88 88 61 61 61 68 70 70 70 + 93 88 88 61 61 61 68 71 71 71 + 93 93 88 61 61 61 68 75 66 66 + 79 79 82 90 90 49 49 49 49 66 + 79 79 82 91 91 48 46 46 46 66 + 79 79 82 95 97 48 46 46 46 72 + 18 18 94 96 84 48 46 46 46 59 + 18 18 100 96 84 50 50 50 50 59]; +***** assert (imclose (magic (10), ones (3)), out); +***** assert (imclose (uint8 (magic (10)), strel ("square", 3)), uint8 (out)); + + ## using a se that will be decomposed in 2 pieces + out =[ 99 99 88 74 74 74 74 70 70 70 + 98 93 88 74 74 74 74 70 70 70 + 93 93 88 74 74 74 74 70 70 70 + 93 93 88 74 74 74 74 71 71 71 + 93 93 88 75 75 75 75 75 75 75 + 93 93 90 90 90 72 72 72 72 72 + 93 93 91 91 91 72 72 72 72 72 + 93 93 93 95 97 72 72 72 72 72 + 94 94 94 96 97 72 72 72 72 72 + 100 100 100 97 97 72 72 72 72 72]; +***** assert (imclose (magic (10), ones(5)), out); + + ## using a weird non-symmetric and even-size se + out =[ 92 99 16 16 16 70 74 58 58 58 + 98 88 60 73 16 73 69 70 64 58 + 88 81 88 60 60 60 69 69 70 70 + 87 87 61 68 61 60 68 69 71 69 + 86 93 87 61 61 61 68 75 68 69 + 23 82 89 89 90 45 68 45 68 66 + 23 23 82 89 91 48 45 45 45 66 + 79 23 82 95 97 46 48 46 45 72 + 18 79 94 96 78 50 46 46 46 59 + 18 18 100 94 94 78 50 50 46 59]; +***** assert (imclose (magic (10), [1 0 0 0; 1 1 1 0; 0 1 0 1]), out); 5 tests, 5 passed, 0 known failure, 0 skipped +[inst/qtgetblk.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/qtgetblk.m +***** demo + [vals,r,c]=qtgetblk(eye(4),qtdecomp(eye(4)),2) + % Returns 2 blocks, at [1,3] and [3,1] (2*2 zeros blocks) +***** shared A,S + A=[ 1, 4, 2, 5,54,55,61,62; + 3, 6, 3, 1,58,53,67,65; + 3, 6, 3, 1,58,53,67,65; + 3, 6, 3, 1,58,53,67,65; + 23,42,42,42,99,99,99,99; + 27,42,42,42,99,99,99,99; + 23,22,26,25,99,99,99,99; + 22,22,24,22,99,99,99,99]; + S=qtdecomp(A,10); +***** test + [va]=qtgetblk(A,S,8); + [vb,r,c]=qtgetblk(A,S,8); + [vc,i]=qtgetblk(A,S,8); + assert(va, vb); + assert(va, vc); + assert(i,[]); + assert(r,[]); + assert(c,[]); + R=[]; + assert(va,R); +***** test + [va]=qtgetblk(A,S,4); + [vb,r,c]=qtgetblk(A,S,4); + [vc,i]=qtgetblk(A,S,4); + assert(va, vb); + assert(va, vc); + assert(i, find(full(S)==4)); + assert(r,[1;5]); + assert(c,[1;5]); + R=zeros(4,4,2); + R(:,:,1)=A(1:4,1:4); + R(:,:,2)=A(5:8,5:8); + assert(va,R); +***** test + [va]=qtgetblk(A,S,2); + [vb,r,c]=qtgetblk(A,S,2); + [vc,i]=qtgetblk(A,S,2); + assert(va, vb); + assert(va, vc); + assert(i, find(full(S)==2)); + assert(r,[7;5;7;1;3;1;3]); + assert(c,[1;3;3;5;5;7;7]); + R=zeros(2,2,7); + R(:,:,1)=A(7:8,1:2); + R(:,:,2)=A(5:6,3:4); + R(:,:,3)=A(7:8,3:4); + R(:,:,4)=A(1:2,5:6); + R(:,:,5)=A(3:4,5:6); + R(:,:,6)=A(1:2,7:8); + R(:,:,7)=A(3:4,7:8); + assert(va,R); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/affine2d.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/affine2d.m +***** test + theta = 10; + A = [cosd(theta) -sind(theta) 0 + sind(theta) cosd(theta) 0 + 0 0 1]; + tform = affine2d (A); + [X, Y] = transformPointsForward (tform, 5, 10); + assert (X, 6.6605, 1.e-4) + assert (Y, 8.9798, 1.e-4) + + [U, V] = transformPointsInverse (tform, X, Y); + assert (U, 5, 5*eps) + assert (V, 10, 9*eps) + assert (isRigid (tform)) + assert (! isTranslation (tform)) + assert (isSimilarity (tform)) +***** test + theta = 30; + tform = affine2d([ cosd(theta) sind(theta) 0 + -sind(theta) cosd(theta) 0 + 0 0 1]); + assert (tform.T, [ 0.86603 0.5 0 + -0.5 0.86603 0 + 0 0 1], 1.e-5); + invtform = invert(tform); + assert (invtform.T, [ 0.86603 -0.5 0 + 0.5 0.86603 0 + 0 0 1], 1.e-5); + assert (isRigid (tform)) + assert (! isTranslation (tform)) + assert (isSimilarity (tform)) +***** test + tform = affine2d ([1 0 0; 0 1 0; 5 10 1]); + [X, Y] = transformPointsForward (tform, [1 2; 3 4; 5 6; 7 8]); + assert (round (X), [6; 8; 10; 12]) + assert (round (Y), [12; 14; 16; 18]) + + [U, V] = transformPointsInverse (tform, X, Y); + assert (round (U), [1; 3; 5; 7]) + assert (round (V), [2; 4; 6; 8]) + assert (isRigid (tform)) + assert (isTranslation (tform)) + assert (isSimilarity (tform)) +***** test + tform = affine2d ([1 1e-16 0; 1e-16 1 0; 5 10 1]); + assert (isRigid (tform)) + tform = affine2d ([2 1e-16 0; 1e-16 1 0; 5 10 1]); + assert (! isRigid (tform)) +***** test + theta = 10; + A = [cosd(theta) -sind(theta) 0 + sind(theta) cosd(theta) 0 + 0 0 1]; + tform = affine2d (A); + [xlim, ylim] = outputLimits (tform, [1 240], [1 291]); + assert (xlim, [1.1585 286.8855], 1.e-4) + assert (ylim, [-40.6908 286.4054], 1.e-4) +***** test + A = [1 0 0 + 0 1 0 + 40 40 1]; + tform = affine2d (A); + assert (isRigid (tform)); + assert (isSimilarity (tform)); + assert (isTranslation (tform)); +***** test + a = invert (affine2d ([1 2 0; 3 4 0; 10 20 1])); + b = affine2d(a.T); + assert (b.T, [-2, 1, 0; 1.5, -0.5, 0; -10, 0, 1], 5*eps) +***** assert (isTranslation (affine2d ([1, 0, 0; 0, 1, 0; 40, 40, 1]))) +***** assert (! isTranslation (affine2d ([1 0 0; 0 -1 0; 0 0 1]))) +***** assert (! isRigid (affine2d ([1 0 0; 0 -1 0; 0 0 1]))) +***** error affine2d ([0 0 0; 0 0 0]) +***** error affine2d ([0 0 0 0 0 0 0 0 1]) +***** error affine2d ([0 0 0; 0 0 0; 0 0 0]) +***** error affine2d ([1 0 0; 0 1 1; 0 0 1]) +***** error affine2d ([0 0 0; 0 0 0; 0 0 1]) +***** error affine2d (1, 2) +***** error outputLimits (affine2d()) +***** test + tform = affine2d; + assert (tform.T, eye (3)) + assert (tform.Dimensionality, 2) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/qtsetblk.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/qtsetblk.m +***** demo + J=qtsetblk(eye(4),qtdecomp(eye(4)),2,ones(2,2,2)) + % Sets upper-right and lower-left blocks of 2*2 zeros to ones +***** shared A, S + A=[ 1, 4, 2, 5,54,55,61,62; + 3, 6, 3, 1,58,53,67,65; + 3, 6, 3, 1,58,53,67,65; + 3, 6, 3, 1,58,53,67,65; + 23,42,42,42,99,99,99,99; + 27,42,42,42,99,99,99,99; + 23,22,26,25,99,99,99,99; + 22,22,24,22,99,99,99,99]; + S = qtdecomp (A, 10); +***** test + R=A; + vals=zeros(4,4,2); + vals(:,:,1)=reshape([1:16],4,4); + vals(:,:,2)=reshape([21:36],4,4); + R(1:4,1:4)=reshape([1:16],4,4); + R(5:8,5:8)=reshape([21:36],4,4); + assert(qtsetblk(A,S,4,vals),R); +***** test + R=A; + R(1:4,5:8)=1; + R(7:8,1:4)=1; + R(5:6,3:4)=1; + assert(qtsetblk(A,S,2,ones(2,2,7)),R); +***** test + R=A; + R(5:6,1:2)=10; + assert(qtsetblk(A,S,1,ones(1,1,4)*10),R); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/rgb2ycbcr.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/rgb2ycbcr.m +***** test + in(:,:,1) = magic (5); + in(:,:,2) = magic (5); + in(:,:,3) = magic (5); + out(:,:,1) = [31 37 17 23 29 + 36 20 22 28 30 + 19 21 27 33 35 + 25 26 32 34 19 + 25 31 37 18 24]; + out(:,:,2) = 128; + out(:,:,3) = 128; + assert (rgb2ycbcr (uint8 (in)), uint8 (out)); +***** shared cbcr + cbcr = 0.5019607843137255; + out(1:10, 1) = linspace (16/255, 235/255, 10); + out(:, [2 3]) = cbcr; + assert (rgb2ycbcr (gray (10)), out, 0.00001); +***** assert (rgb2ycbcr ([1 1 1]), [0.92157 cbcr cbcr], 0.0001); +***** assert (class (rgb2ycbcr (single (rand (5, 5, 3)))), "single") +3 tests, 3 passed, 0 known failure, 0 skipped [inst/imremap.m] >>>>> /build/reproducible-path/octave-image-2.16.0/inst/imremap.m ***** demo @@ -14317,469 +12460,2564 @@ assert (imremap (I, XI, YI, "bicubic", "reflect")(2,:), exp_ref); assert (imremap (I, XI, YI, "bicubic", "circular")(2,:), exp_cir); 1 test, 1 passed, 0 known failure, 0 skipped -[inst/poly2mask.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/poly2mask.m -***** demo - s = [0:pi/4:2*pi]; - x = cos (s) * 90 + 101; - y = sin (s) * 90 + 101; - bw = poly2mask(x, y, 200, 200); - imshow (bw); +[inst/imfilter.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imfilter.m +***** test + img = [ + 8 2 6 7 4 3 7 8 4 1 + 9 9 1 1 4 7 3 3 8 1 + 2 9 8 3 7 6 5 8 6 5 + 9 5 9 1 8 2 7 3 5 8 + 6 8 7 1 2 2 9 9 9 9 + 1 2 7 8 5 5 9 4 3 2 + 3 4 7 7 5 9 5 2 7 6 + 5 9 4 3 6 4 2 3 7 5 + 9 8 6 9 7 6 2 6 4 1 + 9 9 2 1 7 3 3 5 6 4]; + + expected_corr = [ + 46 53 30 34 44 42 40 51 42 19 + 48 66 57 42 46 50 59 58 49 34 + 48 67 55 54 44 58 50 50 64 39 + 44 77 52 43 28 55 57 75 70 50 + 29 51 65 51 42 50 60 62 55 42 + 23 44 58 59 63 59 55 57 50 36 + 36 50 52 56 56 47 48 45 47 39 + 51 64 70 62 56 50 40 38 41 31 + 58 72 50 49 58 45 41 42 49 28 + 27 37 27 21 19 26 16 23 24 17]; + assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2]), expected_corr) + + ## test order of options (and matching with defaults) + assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2], 0), expected_corr) + assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2], "corr"), expected_corr) + assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2], "corr", 0), expected_corr) + assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2], 0, "corr"), expected_corr) + + expected_conv = [ + 21 31 23 22 21 28 29 26 22 6 + 47 55 43 43 51 44 49 64 44 24 + 56 69 53 34 47 50 57 48 52 37 + 38 70 60 56 41 57 54 61 66 44 + 46 67 53 48 32 54 59 65 63 46 + 28 56 63 50 36 54 58 66 63 47 + 20 43 55 62 67 57 52 53 44 28 + 42 51 54 61 57 53 44 46 48 39 + 53 70 63 50 57 42 38 38 43 33 + 53 62 50 54 52 44 38 40 40 20]; + assert (imfilter (img, [0 1 0; 2 1 1; 1 2 2], "conv"), expected_conv) + + ## alternative class + assert (imfilter (single (img), [0 1 0; 2 1 1; 1 2 2]), + single (expected_corr)) + assert (imfilter (int8 (img), [0 1 0; 2 1 1; 1 2 2]), + int8 (expected_corr)) + assert (imfilter (uint8 (img), [0 1 0; 2 1 1; 1 2 2]), + uint8 (expected_corr)) + + assert (imfilter (single (img), [0 1 0; 2 1 1; 1 2 2], "conv"), + single (expected_conv)) + assert (imfilter (int8 (img), [0 1 0; 2 1 1; 1 2 2], "conv"), + int8 (expected_conv)) + assert (imfilter (uint8 (img), [0 1 0; 2 1 1; 1 2 2], "conv"), + uint8 (expected_conv)) + +***** test + I = zeros (6); + I(2:3,2:3) = 1; + F = zeros (4); + F(2,2:3) = 1; + result = [0 0 0 0 0 0 + 1 2 1 0 0 0 + 1 2 1 0 0 0 + 0 0 0 0 0 0 + 0 0 0 0 0 0 + 0 0 0 0 0 0]; + assert (imfilter (I, F), result) +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/isgray.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/isgray.m +***** assert (isgray ([0 0 1; 1 0 1]), true) +***** assert (isgray (zeros (3)), true) +***** assert (isgray (ones (3)), true) +***** test + a = rand (10); + assert (isgray (a), true); + a(5, 5) = 2; + assert (isgray (a), false); +***** test + a = uint8 (randi (255, 10)); + assert (isgray (a), true); + a = int8 (a); + assert (isgray (a), false); +***** test + a = rand (10); + a(50) = NaN; + assert (isgray (a), true); +***** assert (isgray (rand (5, 5, 1, 4)), true); +***** assert (isgray (rand (5, 5, 3, 4)), false); +***** assert (isgray (rand (5, 5, 3)), false); +***** assert (isgray (rand (5, 5, 1, 3, 4)), false); +***** assert (isgray (rand (5, "single")), true) +***** assert (isgray ([.1 .2 .3; .4 NaN .6; .7 .8 .9]), true) +***** assert (isgray ([.1 .2 .3; NA NaN .6; .7 .8 .9]), true) +***** assert (isgray ([.1 .2 .3; NA .5 .6; .7 .8 .9]), true) +***** assert (isgray (NaN (5)), false) +***** assert (isgray (NA (5)), false) +16 tests, 16 passed, 0 known failure, 0 skipped +[inst/blockproc.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/blockproc.m ***** demo - s = [0:2*pi/5:pi*4]; - s = s ([1, 3, 5, 2, 4, 6]); - x = cos (s) * 90 + 101; - y = sin (s) * 90 + 101; - bw = poly2mask (x, y, 200, 200); - imshow (bw); -***** # Convex polygons -***** shared xs, ys, Rs, xt, yt, Rt - xs=[3,3,10,10]; - ys=[4,12,12,4]; - Rs=zeros(16,14); - Rs(5:12,4:10)=1; - Rs=logical(Rs); - xt=[1,4,7]; - yt=[1,4,1]; - Rt=[0,0,0,0,0,0,0; - 0,0,1,1,1,1,0; - 0,0,0,1,1,0,0; - 0,0,0,1,0,0,0; - 0,0,0,0,0,0,0]; - Rt=logical(Rt); -***** assert(poly2mask(xs,ys,16,14),Rs); # rectangle -***** assert(poly2mask(xs,ys,8,7),Rs(1:8,1:7)); # clipped -***** assert(poly2mask(xs-7,ys-8,8,7),Rs(9:16,8:14)); # more clipping -***** assert(poly2mask(xt,yt,5,7),Rt); # triangle -***** assert(poly2mask(xt,yt,3,3),Rt(1:3,1:3)); # clipped -***** # Concave polygons + blockproc (eye (6), [2, 2], @(x) any (x(:))) + # Returns a 3-by-3 diagonal +***** assert (blockproc (eye (6), [2, 2], "sum"), + blockproc (eye (6), [2, 2], @sum)) +***** assert (blockproc (eye (6), [2, 2], "sum"), + blockproc (eye (6), [2, 2], @(x) sum (x))) +***** assert (blockproc (eye (6), [1,2], @sum), + kron (eye (3), [1; 1])) +***** assert (blockproc (eye (6), [2,2], @(x) any (x(:))), + eye (3) != 0) +***** assert (blockproc (eye (6), [1,2],[1,1], @(x) sum (x(:))), + [2,1,0; 3,2,0; 2,3,1; 1,3,2; 0,2,3; 0,1,2]) +***** assert (blockproc (eye (6), "indexed", [1, 2], [1, 1], @(x) sum (x(:))), + [8,5,6; 6,2,3; 5,3,4; 4,3,5; 3,2,6; 6,5,8]) +***** assert (blockproc (eye (6), [2,3],[4,3], @(x) sum (x(:))), + ones (3, 2) * 6) +***** assert (blockproc (eye (6), [2, 2], @(x) int8 (sum (x(:)))), + eye (3, "int8") * 2) +***** assert (blockproc (uint8 (eye (6)), [1,2], [1,1], @(x) sum (x(:))), + [2,1,0; 3,2,0; 2,3,1; 1,3,2; 0,2,3; 0,1,2]) +***** assert (blockproc (uint8 (eye (6)), "indexed", [1,2], [1,1], @(x) sum (x(:))), + [2,1,0; 3,2,0; 2,3,1; 1,3,2; 0,2,3; 0,1,2]); +***** assert (blockproc (uint16 (eye (6)), [1,2], [1,1], @(x) sum (x(:))), + [2,1,0; 3,2,0; 2,3,1; 1,3,2; 0,2,3; 0,1,2]); +***** assert (blockproc (uint16 (eye (6)), "indexed", [1,2], [1,1], + @(x) sum (x(:))), + [2,1,0; 3,2,0; 2,3,1; 1,3,2; 0,2,3; 0,1,2]); +***** assert (blockproc (eye (6), [2, 2], "sum"), + blockproc (eye (6), [2, 2], inline ("sum (x)", "x"))) +warning: inline is obsolete; use anonymous functions instead +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/imcomplement.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imcomplement.m +***** assert (imcomplement (10), -9); +***** assert (imcomplement (single (10)), single (-9)); +***** assert (imcomplement (0.2), 0.8); +***** assert (imcomplement (uint8 (0)), uint8 (255)); +***** assert (imcomplement (uint8 (1)), uint8 (254)); +***** assert (imcomplement (uint16 (0)), uint16 (65535)); +***** assert (imcomplement (uint16 (1)), uint16 (65534)); +***** assert (imcomplement (int8 (-128)), int8 ( 127)); +***** assert (imcomplement (int8 ( 127)), int8 (-128)); +***** assert (imcomplement (int16 (-1)), int16 ( 0)); +***** assert (imcomplement (int16 ( 0)), int16 (-1)); +***** assert (imcomplement (int16 ( 1)), int16 (-2)); +***** assert (imcomplement ([true false true]), [false true false]) +***** error imcomplement ("not an image") +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/labelmatrix.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/labelmatrix.m ***** test - x=[3,3,5,5,8,8,10,10]; - y=[4,12,12,8,8,11,11,4]; - R=zeros(16,14); - R(5:12,4:5)=1; - R(5:8,6:8)=1; - R(5:11,9:10)=1; - R=logical(R); - assert(poly2mask(x,y,16,14), R); -***** # Complex polygons + cc = struct (); + cc.Connectivity = 8; + cc.ImageSize = [7 7]; + cc.NumObjects = 4; + cc.PixelIdxList = {[1;2], [5;7;12;13;14], [22;23], [26;32;33;36;37;38]}; + + l = uint8 ([ + 1 0 0 3 0 4 0 + 1 0 0 3 0 4 0 + 0 0 0 0 0 4 0 + 0 0 0 0 4 0 0 + 2 2 0 4 4 0 0 + 0 2 0 0 0 0 0 + 2 2 0 0 0 0 0 + ]); + assert (labelmatrix (cc), l) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/bwselect.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/bwselect.m ***** test - x=[1,5,1,5]; - y=[1,1,4,4]; - R=[0,0,0,0,0,0; - 0,0,1,1,0,0; - 0,0,1,1,0,0; - 0,1,1,1,1,0; - 0,0,0,0,0,0]; - R=logical(R); - assert(poly2mask(x,y,5,6), R); -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/histeq.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/histeq.m -***** assert (histeq ([]), []); -***** assert (histeq (0), 1); -***** assert (histeq (1), 1); -***** assert (histeq (1.5), 1); -***** assert (histeq (zeros (100, 200)), ones (100, 200)); # matrix -***** xtest assert (histeq ([0 1]), [0.4920634921 1], 10^-8); -!!!!! known failure -ASSERT errors for: assert (histeq ([0, 1]),[0.4920634921, 1],10 ^ -8) + BW = zeros(5, 'logical'); + BW(3, 4) = 1; + BW(4, 3) = 1; + res8 = bwselect (BW, 3, 4, 8); + assert (res8, BW) + res4 = bwselect (BW, 3, 4, 4); + res8_expected = BW; + res8_expected(4, 3) = 1; + assert (res8, res8_expected) +***** test + A = [0 1 0 0 1; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]; + R4 = zeros(5, 'logical'); + R4(1, 1) = 1; + R8 = logical([1 0 1 1 0; 0 1 0 1 1; 0 1 0 0 1; 0 0 0 1 1; 0 1 1 0 1]); + out = bwselect (A, 1, 1, 4); + assert (out, zeros (5, 'logical')) + out = bwselect (A, 1, 1, 8); + assert (out, zeros (5, 'logical')) + out = bwselect (! A, 1, 1, 4); + assert (out, R4) + out = bwselect (! A, 1, 1, 8); + assert (out, R8) - Location | Observed | Expected | Reason - (1) 0.5 0.49206 Abs err 0.0079365 exceeds tol 1e-08 by 0.008 -***** xtest assert (histeq ([0 1]'), [0.4920634921 1]', 10^-8); # column array -!!!!! known failure -ASSERT errors for: assert (histeq ([0, 1]'),[0.4920634921, 1]',10 ^ -8) + B4 = logical([0 0 0 0 0; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 0 0]); + B8 = logical([0 1 0 0 0; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); + out = bwselect (A, 3, 3, 4); + assert (out, B4) + out = bwselect (A, 3, 3, 8); + assert (out, B8) + out = bwselect (A, 3, 3); + assert (out, B8) - Location | Observed | Expected | Reason - (1) 0.5 0.49206 Abs err 0.0079365 exceeds tol 1e-08 by 0.008 -***** xtest assert (histeq ([0 255]), [0.4920634921 1], 10^-8); -!!!!! known failure -ASSERT errors for: assert (histeq ([0, 255]),[0.4920634921, 1],10 ^ -8) + C4 = logical ([0 0 1 1 0; 0 0 0 1 1; 0 0 0 0 1; 0 0 0 1 1; 0 0 0 0 1]); + C8 = logical ([1 0 1 1 0; 0 1 0 1 1; 0 1 0 0 1; 0 0 0 1 1; 0 1 1 0 1]); + out = bwselect (! A, 3, 1, 8); + assert (out, C8) + out = bwselect (! A, 3, 1); + assert (out, C8) + out = bwselect (! A, 3, 1, 4); + assert (out, C4) - Location | Observed | Expected | Reason - (1) 0.5 0.49206 Abs err 0.0079365 exceeds tol 1e-08 by 0.008 -***** xtest assert (histeq (uint8 ([0 1])), [ 125 190]); # uint8 -!!!!! known failure -ASSERT errors for: assert (histeq (uint8 ([0, 1])),[125, 190]) + D4 = logical ([0 0 0 0 0; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 0 0]); + D8 = logical ([0 1 0 0 0; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); + out = bwselect (A, [3 1], [1 3], 4); + assert (out, D4); + out = bwselect (A, [3 1], [1 3], 8); + assert (out, D8); + out = bwselect (A, [3 1], [1 3]); + assert (out, D8); +***** test +***** error id=Octave:invalid-fun-call bwselect () +***** error id=Octave:invalid-fun-call bwselect ("aaa") +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/grayslice.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/grayslice.m +***** test + expected = uint8 ([0 4 5 5 9]); + im = [0 0.45 0.5 0.55 1]; + assert (grayslice (im), expected) + assert (grayslice (im, 10), expected) + assert (grayslice (im, uint8 (10)), expected) + assert (grayslice (im, [.1 .2 .3 .4 .5 .6 .7 .8 .9]), expected) +***** test + im = [0 0.45 0.5 0.55 1]; + assert (grayslice (im, 2), uint8 ([0 0 1 1 1])) + assert (grayslice (im, 3), uint8 ([0 1 1 1 2])) + assert (grayslice (im, 4), uint8 ([0 1 2 2 3])) + assert (grayslice (im, [0 0.5 1]), uint8 ([1 1 2 2 3])) + assert (grayslice (im, [0.5 1]), uint8 ([0 0 1 1 2])) + assert (grayslice (im, [0.6 1]), uint8 ([0 0 0 0 2])) +***** test + im = [0 .55 1]; + assert (grayslice (im, 9), uint8 ([0 4 8])) + assert (grayslice (im, 9.1), uint8 ([0 5 8])) + assert (grayslice (im, 10), uint8 ([0 5 9])) +***** assert (grayslice ([0 .5 1], [0 1 .5]), uint8 ([1 2 3])) +***** test + ## 0 > N > 1 values are treated as if they are V and N=2 + im = [0 .5 .55 .7 1]; + assert (grayslice (im, .5), uint8 ([0 1 1 1 1])) + assert (grayslice (im, .51), uint8 ([0 0 1 1 1])) + assert (grayslice (im, .7), uint8 ([0 0 0 1 1])) + assert (grayslice (im, 1), uint8 ([0 0 0 0 0])) + assert (grayslice (im, 1.2), uint8 ([0 0 0 0 0])) +***** assert (grayslice ([0 .5 .7 1], [0 .5 1 2]), uint8 ([1 2 2 4])) +***** assert (grayslice ([0 .45 .5 .65 .7 1], [.4 .5 .5 .7 .7 1]), + uint8 ([0 1 3 3 5 6])) +***** assert (grayslice ([-.5 .1 .8 1.2], [-1 -.4 .05 .6 .9 1.1 2]), + uint8 ([1 3 4 7])) +***** assert (grayslice ([0 .5 1], [-1 .5 1 2]), uint8 ([1 2 4])) +***** assert (grayslice ([-2 -1 .5 1], [-1 .5 1]), uint8 ([0 1 2 3])) +***** test + sliced = [ + repmat(0, [26 1]) + repmat(1, [25 1]) + repmat(2, [26 1]) + repmat(3, [25 1]) + repmat(4, [26 1]) + repmat(5, [25 1]) + repmat(6, [26 1]) + repmat(7, [25 1]) + repmat(8, [26 1]) + repmat(9, [26 1]) + ]; + sliced = uint8 (sliced(:).'); + assert (grayslice (uint8 (0:255)), sliced) +***** assert (grayslice (uint8 (0:255), 255), uint8 ([0:254 254])) +***** assert (class (grayslice (uint8 (0:255), 256)), "double") +***** xtest + assert (grayslice (uint8 (0:255), 256), [1:256]) - Location | Observed | Expected | Reason - (1) 0.5 125 Abs err 124.5 exceeds tol 0 by 1e+02 - (2) 1 190 Abs err 189 exceeds tol 0 by 2e+02 -***** xtest assert (histeq (uint8 ([0 255])), [ 125 255]); + ## While the above fails, this passes and should continue to do so + ## since it's the actual formula in the documentation. + assert (grayslice (uint8 (0:255), 256), + grayslice (uint8 (0:255), (1:255)./256)) !!!!! known failure -ASSERT errors for: assert (histeq (uint8 ([0, 255])),[125, 255]) +ASSERT errors for: assert (grayslice (uint8 (0:255), 256),[1:256]) Location | Observed | Expected | Reason - (1) 0.5 125 Abs err 124.5 exceeds tol 0 by 1e+02 - (2) 1 255 Abs err 254 exceeds tol 0 by 3e+02 -***** xtest assert (histeq (uint16 ([0 1])), [65535 65535]); # uint16 -!!!!! known failure -ASSERT errors for: assert (histeq (uint16 ([0, 1])),[65535, 65535]) + (129) 130 129 Abs err 1 exceeds tol 0 by 1 + (130) 131 130 Abs err 1 exceeds tol 0 by 1 + (131) 132 131 Abs err 1 exceeds tol 0 by 1 + (132) 133 132 Abs err 1 exceeds tol 0 by 1 + (133) 134 133 Abs err 1 exceeds tol 0 by 1 + (134) 135 134 Abs err 1 exceeds tol 0 by 1 + (135) 136 135 Abs err 1 exceeds tol 0 by 1 + (136) 137 136 Abs err 1 exceeds tol 0 by 1 + (137) 138 137 Abs err 1 exceeds tol 0 by 1 + (138) 139 138 Abs err 1 exceeds tol 0 by 1 + (139) 140 139 Abs err 1 exceeds tol 0 by 1 + (140) 141 140 Abs err 1 exceeds tol 0 by 1 + (141) 142 141 Abs err 1 exceeds tol 0 by 1 + (142) 143 142 Abs err 1 exceeds tol 0 by 1 + (143) 144 143 Abs err 1 exceeds tol 0 by 1 + (144) 145 144 Abs err 1 exceeds tol 0 by 1 + (145) 146 145 Abs err 1 exceeds tol 0 by 1 + (146) 147 146 Abs err 1 exceeds tol 0 by 1 + (147) 148 147 Abs err 1 exceeds tol 0 by 1 + (148) 149 148 Abs err 1 exceeds tol 0 by 1 + (149) 150 149 Abs err 1 exceeds tol 0 by 1 + (150) 151 150 Abs err 1 exceeds tol 0 by 1 + (151) 152 151 Abs err 1 exceeds tol 0 by 1 + (152) 153 152 Abs err 1 exceeds tol 0 by 1 + (153) 154 153 Abs err 1 exceeds tol 0 by 1 + (154) 155 154 Abs err 1 exceeds tol 0 by 1 + (155) 156 155 Abs err 1 exceeds tol 0 by 1 + (156) 157 156 Abs err 1 exceeds tol 0 by 1 + (157) 158 157 Abs err 1 exceeds tol 0 by 1 + (158) 159 158 Abs err 1 exceeds tol 0 by 1 + (159) 160 159 Abs err 1 exceeds tol 0 by 1 + (160) 161 160 Abs err 1 exceeds tol 0 by 1 + (161) 162 161 Abs err 1 exceeds tol 0 by 1 + (162) 163 162 Abs err 1 exceeds tol 0 by 1 + (163) 164 163 Abs err 1 exceeds tol 0 by 1 + (164) 165 164 Abs err 1 exceeds tol 0 by 1 + (165) 166 165 Abs err 1 exceeds tol 0 by 1 + (166) 167 166 Abs err 1 exceeds tol 0 by 1 + (167) 168 167 Abs err 1 exceeds tol 0 by 1 + (168) 169 168 Abs err 1 exceeds tol 0 by 1 + (169) 170 169 Abs err 1 exceeds tol 0 by 1 + (170) 171 170 Abs err 1 exceeds tol 0 by 1 + (171) 172 171 Abs err 1 exceeds tol 0 by 1 + (172) 173 172 Abs err 1 exceeds tol 0 by 1 + (173) 174 173 Abs err 1 exceeds tol 0 by 1 + (174) 175 174 Abs err 1 exceeds tol 0 by 1 + (175) 176 175 Abs err 1 exceeds tol 0 by 1 + (176) 177 176 Abs err 1 exceeds tol 0 by 1 + (177) 178 177 Abs err 1 exceeds tol 0 by 1 + (178) 179 178 Abs err 1 exceeds tol 0 by 1 + (179) 180 179 Abs err 1 exceeds tol 0 by 1 + (180) 181 180 Abs err 1 exceeds tol 0 by 1 + (181) 182 181 Abs err 1 exceeds tol 0 by 1 + (182) 183 182 Abs err 1 exceeds tol 0 by 1 + (183) 184 183 Abs err 1 exceeds tol 0 by 1 + (184) 185 184 Abs err 1 exceeds tol 0 by 1 + (185) 186 185 Abs err 1 exceeds tol 0 by 1 + (186) 187 186 Abs err 1 exceeds tol 0 by 1 + (187) 188 187 Abs err 1 exceeds tol 0 by 1 + (188) 189 188 Abs err 1 exceeds tol 0 by 1 + (189) 190 189 Abs err 1 exceeds tol 0 by 1 + (190) 191 190 Abs err 1 exceeds tol 0 by 1 + (191) 192 191 Abs err 1 exceeds tol 0 by 1 + (192) 193 192 Abs err 1 exceeds tol 0 by 1 + (193) 194 193 Abs err 1 exceeds tol 0 by 1 + (194) 195 194 Abs err 1 exceeds tol 0 by 1 + (195) 196 195 Abs err 1 exceeds tol 0 by 1 + (196) 197 196 Abs err 1 exceeds tol 0 by 1 + (197) 198 197 Abs err 1 exceeds tol 0 by 1 + (198) 199 198 Abs err 1 exceeds tol 0 by 1 + (199) 200 199 Abs err 1 exceeds tol 0 by 1 + (200) 201 200 Abs err 1 exceeds tol 0 by 1 + (201) 202 201 Abs err 1 exceeds tol 0 by 1 + (202) 203 202 Abs err 1 exceeds tol 0 by 1 + (203) 204 203 Abs err 1 exceeds tol 0 by 1 + (204) 205 204 Abs err 1 exceeds tol 0 by 1 + (205) 206 205 Abs err 1 exceeds tol 0 by 1 + (206) 207 206 Abs err 1 exceeds tol 0 by 1 + (207) 208 207 Abs err 1 exceeds tol 0 by 1 + (208) 209 208 Abs err 1 exceeds tol 0 by 1 + (209) 210 209 Abs err 1 exceeds tol 0 by 1 + (210) 211 210 Abs err 1 exceeds tol 0 by 1 + (211) 212 211 Abs err 1 exceeds tol 0 by 1 + (212) 213 212 Abs err 1 exceeds tol 0 by 1 + (213) 214 213 Abs err 1 exceeds tol 0 by 1 + (214) 215 214 Abs err 1 exceeds tol 0 by 1 + (215) 216 215 Abs err 1 exceeds tol 0 by 1 + (216) 217 216 Abs err 1 exceeds tol 0 by 1 + (217) 218 217 Abs err 1 exceeds tol 0 by 1 + (218) 219 218 Abs err 1 exceeds tol 0 by 1 + (219) 220 219 Abs err 1 exceeds tol 0 by 1 + (220) 221 220 Abs err 1 exceeds tol 0 by 1 + (221) 222 221 Abs err 1 exceeds tol 0 by 1 + (222) 223 222 Abs err 1 exceeds tol 0 by 1 + (223) 224 223 Abs err 1 exceeds tol 0 by 1 + (224) 225 224 Abs err 1 exceeds tol 0 by 1 + (225) 226 225 Abs err 1 exceeds tol 0 by 1 + (226) 227 226 Abs err 1 exceeds tol 0 by 1 + (227) 228 227 Abs err 1 exceeds tol 0 by 1 + (228) 229 228 Abs err 1 exceeds tol 0 by 1 + (229) 230 229 Abs err 1 exceeds tol 0 by 1 + (230) 231 230 Abs err 1 exceeds tol 0 by 1 + (231) 232 231 Abs err 1 exceeds tol 0 by 1 + (232) 233 232 Abs err 1 exceeds tol 0 by 1 + (233) 234 233 Abs err 1 exceeds tol 0 by 1 + (234) 235 234 Abs err 1 exceeds tol 0 by 1 + (235) 236 235 Abs err 1 exceeds tol 0 by 1 + (236) 237 236 Abs err 1 exceeds tol 0 by 1 + (237) 238 237 Abs err 1 exceeds tol 0 by 1 + (238) 239 238 Abs err 1 exceeds tol 0 by 1 + (239) 240 239 Abs err 1 exceeds tol 0 by 1 + (240) 241 240 Abs err 1 exceeds tol 0 by 1 + (241) 242 241 Abs err 1 exceeds tol 0 by 1 + (242) 243 242 Abs err 1 exceeds tol 0 by 1 + (243) 244 243 Abs err 1 exceeds tol 0 by 1 + (244) 245 244 Abs err 1 exceeds tol 0 by 1 + (245) 246 245 Abs err 1 exceeds tol 0 by 1 + (246) 247 246 Abs err 1 exceeds tol 0 by 1 + (247) 248 247 Abs err 1 exceeds tol 0 by 1 + (248) 249 248 Abs err 1 exceeds tol 0 by 1 + (249) 250 249 Abs err 1 exceeds tol 0 by 1 + (250) 251 250 Abs err 1 exceeds tol 0 by 1 + (251) 252 251 Abs err 1 exceeds tol 0 by 1 + (252) 253 252 Abs err 1 exceeds tol 0 by 1 + (253) 254 253 Abs err 1 exceeds tol 0 by 1 + (254) 255 254 Abs err 1 exceeds tol 0 by 1 + (255) 256 255 Abs err 1 exceeds tol 0 by 1 +***** test + ## Use of threshold in the [0 1] range for images of integer type does + ## not really work despite the Matlab documentation. It's Matlab + ## documentation that is wrong, see bug #55059 - Location | Observed | Expected | Reason - (1) 0.5 65535 Abs err 65534 exceeds tol 0 by 7e+04 - (2) 1 65535 Abs err 65534 exceeds tol 0 by 7e+04 -***** xtest assert (histeq (uint16 ([0 255])), [32247 48891]); -!!!!! known failure -ASSERT errors for: assert (histeq (uint16 ([0, 255])),[32247, 48891]) + assert (grayslice (uint8([0 100 200 255]), [.1 .4 .5]), + uint8 ([0 3 3 3])) + assert (grayslice (uint8([0 100 200 255]), [100 199 200 210]), + uint8 ([0 1 3 4])) - Location | Observed | Expected | Reason - (1) 0.5 32247 Abs err 32246 exceeds tol 0 by 3e+04 - (2) 1 48891 Abs err 48890 exceeds tol 0 by 5e+04 -***** xtest assert (histeq (uint16 ([0 256])), [32247 48891]); -!!!!! known failure -ASSERT errors for: assert (histeq (uint16 ([0, 256])),[32247, 48891]) + ## P (penny) is a 2d image of class double in [1 255] range + q = warning ("query", "Octave:data-file-in-path"); + warning ("off", "Octave:data-file-in-path"); + load ("penny.mat"); + warning (q.state, "Octave:data-file-in-path"); + assert (grayslice (P), repmat (uint8 (9), size (P))) +***** function gs = test_grayslice_v (I, v) + ## This is effectively what grayslice does but slower with a for + ## loop internally. + gs = zeros (size (I)); + for idx = 1:numel (v) + gs(I >= v(idx)) = idx; + endfor + if (numel (v) >= 256) + gs = gs +1; + else + gs = uint8 (gs); + endif +***** endfunction +***** test + q = warning ("query", "Octave:data-file-in-path"); + warning ("off", "Octave:data-file-in-path"); + load ("penny.mat"); + warning (q.state, "Octave:data-file-in-path"); - Location | Observed | Expected | Reason - (1) 0.5 32247 Abs err 32246 exceeds tol 0 by 3e+04 - (2) 1 48891 Abs err 48890 exceeds tol 0 by 5e+04 -***** xtest assert (histeq (uint16 ([0 65535])), [32247 65535]); -!!!!! known failure -ASSERT errors for: assert (histeq (uint16 ([0, 65535])),[32247, 65535]) + ## The loaded P in penny.mat is of size 128x128, class double, and + ## with values in the [1 255] range + penny_uint8 = uint8 (P); + penny_double = im2double (penny_uint8); # rescales to [0 1] range] - Location | Observed | Expected | Reason - (1) 0.5 32247 Abs err 32246 exceeds tol 0 by 3e+04 - (2) 1 65535 Abs err 65534 exceeds tol 0 by 7e+04 -***** test assert (histeq ([0 1 1] ), [ 1/3 1 1] , 10^-8); -***** test assert (histeq ([0 0 1]'), [ 2/3 2/3 1]', 10^-8); -***** xtest assert (histeq ([0 1 2] ), [ 1/3 1 1] , 10^-8); -!!!!! known failure -ASSERT errors for: assert (histeq ([0, 1, 2]),[1 / 3, 1, 1],10 ^ -8) + ## default of N = 10 + expected = test_grayslice_v (penny_uint8, + [26 51 77 102 128 153 179 204 230]); + assert (grayslice (penny_uint8, 10), expected) + assert (grayslice (penny_uint8), expected) - Location | Observed | Expected | Reason - (2) 0.66667 1 Abs err 0.33333 exceeds tol 1e-08 by 0.3 -***** xtest assert (histeq (uint8 ([0 1 2])), [ 85 125 215]); -!!!!! known failure -ASSERT errors for: assert (histeq (uint8 ([0, 1, 2])),[85, 125, 215]) + expected = test_grayslice_v (penny_double, + [.1 .2 .3 .4 .5 .6 .7 .8 .9]); + assert (grayslice (penny_double, 10), expected) + assert (grayslice (penny_double), expected) +***** test + ## For images with more than 2d + q = warning ("query", "Octave:data-file-in-path"); + warning ("off", "Octave:data-file-in-path"); + load ("penny.mat"); + warning (q.state, "Octave:data-file-in-path"); + penny_double = im2double (uint8 (P)); + P_3d = repmat (penny_double, [1 1 3]); + P_5d = repmat (penny_double, [1 1 3 2 3]); - Location | Observed | Expected | Reason - (1) 0.33333 85 Abs err 84.667 exceeds tol 0 by 8e+01 - (2) 0.66667 125 Abs err 124.33 exceeds tol 0 by 1e+02 - (3) 1 215 Abs err 214 exceeds tol 0 by 2e+02 -***** xtest assert (histeq (uint16 ([0 1 2])), [65535 65535 65535]); -!!!!! known failure -ASSERT errors for: assert (histeq (uint16 ([0, 1, 2])),[65535, 65535, 65535]) + v = [.3 .5 .7]; + expected_2d = test_grayslice_v (penny_double, v); + assert (grayslice (P_3d, v), repmat (expected_2d, [1 1 3])) + assert (grayslice (P_5d, v), repmat (expected_2d, [1 1 3 2 3])) +***** test + q = warning ("query", "Octave:data-file-in-path"); + warning ("off", "Octave:data-file-in-path"); + load ("penny.mat"); + warning (q.state, "Octave:data-file-in-path"); + penny_double = uint8 (P); - Location | Observed | Expected | Reason - (1) 0.33333 65535 Abs err 65535 exceeds tol 0 by 7e+04 - (2) 0.66667 65535 Abs err 65534 exceeds tol 0 by 7e+04 - (3) 1 65535 Abs err 65534 exceeds tol 0 by 7e+04 -***** xtest assert (histeq (uint16 ([0 100 200])), [43690 43690 55133]); -!!!!! known failure -ASSERT errors for: assert (histeq (uint16 ([0, 100, 200])),[43690, 43690, 55133]) + ## Test that change from uint8 to double happens at 256 exactly + assert (class (grayslice (penny_double, 255)), "uint8") + assert (class (grayslice (penny_double, 256)), "double") - Location | Observed | Expected | Reason - (1) 0.33333 43690 Abs err 43690 exceeds tol 0 by 4e+04 - (2) 0.66667 43690 Abs err 43689 exceeds tol 0 by 4e+04 - (3) 1 55133 Abs err 55132 exceeds tol 0 by 6e+04 -***** xtest - J = [20 32 57 81 105 125 150 174 198 223 247]; - assert (histeq (uint8 (0:10:100)), J); -!!!!! known failure -ASSERT errors for: assert (histeq (uint8 (0:10:100)),J) + ## If returns in class double, it's +1. + v = [10 150 200]; + v_long = [v 256:600]; + assert (double (grayslice (penny_double, v)) +1, + grayslice (penny_double, v_long)) +***** test + ## If there's a vector for floating point and goes outside the + ## range, it uses the last index of the vector. + q = warning ("query", "Octave:data-file-in-path"); + warning ("off", "Octave:data-file-in-path"); + load ("penny.mat"); + warning (q.state, "Octave:data-file-in-path"); + penny_double = im2double (uint8 (P)); + v = [.3 .5 .7 2:10]; + idx_1 = find (penny_double == 1); + assert (grayslice (penny_double, v)(idx_1), uint8 ([12; 12])) +***** error x = grayslice ([1 2; 3 4], 0) +***** error x = grayslice ([1 2; 3 4], -1) +***** error x = grayslice ([1 2; 3 4], "foo") +***** test + ## test output values for all input classes - Location | Observed | Expected | Reason - (1) 0.090909 20 Abs err 19.909 exceeds tol 0 by 2e+01 - (2) 0.18182 32 Abs err 31.818 exceeds tol 0 by 3e+01 - (3) 0.27273 57 Abs err 56.727 exceeds tol 0 by 6e+01 - (4) 0.36364 81 Abs err 80.636 exceeds tol 0 by 8e+01 - (5) 0.45455 105 Abs err 104.55 exceeds tol 0 by 1e+02 - (6) 0.54545 125 Abs err 124.45 exceeds tol 0 by 1e+02 - (7) 0.63636 150 Abs err 149.36 exceeds tol 0 by 1e+02 - (8) 0.72727 174 Abs err 173.27 exceeds tol 0 by 2e+02 - (9) 0.81818 198 Abs err 197.18 exceeds tol 0 by 2e+02 - (10) 0.90909 223 Abs err 222.09 exceeds tol 0 by 2e+02 - (11) 1 247 Abs err 246 exceeds tol 0 by 2e+02 + klasse = "uint8"; + im = cast ([intmin(klasse): intmax(klasse)], klasse); + erg05 = grayslice (im, 0.5); + first1_erg05 = im(find (erg05)(1)); + assert (first1_erg05, cast (1, klasse)); + erg5 = grayslice (im, 5); + first1_erg5 = im(find (erg5)(1)); + assert (first1_erg5, cast (51, klasse)); + ergint5 = grayslice (im, uint8 (5)); + first1_ergint5 = im(find (ergint5)(1)); + assert (first1_ergint5, cast (51, klasse)); + + klasse = "uint16"; + im = cast ([intmin(klasse): intmax(klasse)], klasse); + erg05 = grayslice (im, 0.5); + first1_erg05 = im(find (erg05)(1)); + assert (first1_erg05, cast (1, klasse)); + erg5 = grayslice (im, 5); + first1_erg5 = im(find (erg5)(1)); + assert (first1_erg5, cast (13107, klasse)); + ergint5 = grayslice (im, uint8 (5)); + first1_ergint5 = im(find (ergint5)(1)); + assert (first1_ergint5, cast (13107, klasse)); + + klasse = "int16"; + im = cast ([intmin(klasse): intmax(klasse)], klasse); + erg05 = grayslice (im, 0.5); + first1_erg05 = im(find (erg05)(1)); + assert (first1_erg05, cast (-32767, klasse)); + erg5 = grayslice (im, 5); + first1_erg5 = im(find (erg5)(1)); + assert (first1_erg5, cast (-19661, klasse)); + ergint5 = grayslice (im, uint8 (5)); + first1_ergint5 = im(find (ergint5)(1)); + assert (first1_ergint5, cast (-19661, klasse)); + + klasse = "single"; + im = cast ([0:0.001:1], klasse); + erg05 = grayslice (im, 0.5); + first1_erg05 = im(find (erg05)(1)); + assert (first1_erg05, cast (0.5, klasse)); + erg5 = grayslice (im, 5); + first1_erg5 = im(find (erg5)(1)); + assert (first1_erg5, cast (0.2, klasse)); + ergint5 = grayslice (im, uint8 (5)); + first1_ergint5 = im(find (ergint5)(1)); + assert (first1_ergint5, cast (0.2, klasse)); + + klasse = "double"; + im = cast ([0:0.001:1], klasse); + erg05 = grayslice (im, 0.5); + first1_erg05 = im(find (erg05)(1)); + assert (first1_erg05, cast (0.5, klasse)); + erg5 = grayslice (im, 5); + first1_erg5 = im(find (erg5)(1)); + assert (first1_erg5, cast (0.2, klasse)); + ergint5 = grayslice (im, uint8 (5)); + first1_ergint5 = im(find (ergint5)(1)); + assert (first1_ergint5, cast (0.2, klasse)); +23 tests, 22 passed, 1 known failure, 0 skipped +[inst/iptnum2ordinal.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/iptnum2ordinal.m +***** assert (strcmp (iptnum2ordinal (1), 'first')); # simple works +***** assert (strcmp (iptnum2ordinal (21), '21st')); # after 20, goes stupid +***** assert (strcmp (iptnum2ordinal (100), '100th')); # use th correctly +***** fail ("iptnum2ordinal (inf)"); # must be real +***** fail ("iptnum2ordinal (0)"); # must be positive +***** fail ("iptnum2ordinal (-1)"); # must be positive +***** fail ("iptnum2ordinal (3.4)"); # must be integer +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/colfilt.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/colfilt.m +***** demo + ## Perform moving average filter with a 4x4 window + A = magic (12) + colfilt (A, [4 4], "sliding", @mean) +***** test + A = reshape (1:36, [6 6]); + assert (colfilt (A, [2 2], [3 3], "sliding", @sum), + conv2 (A, ones (2), "same")); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/imattributes.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imattributes.m +***** shared x, map, img, rgb, bw + [x, map] = imread ("default.img"); + rgb = ind2rgb (x, map); + img = ind2gray (x, map); + bw = im2bw (img); +***** test + h = imshow (img); + a = imattributes (h); + assert ([a.("Height (rows)") a.("Width (columns)")], [53 40]); + assert (a.Class, "uint8"); + assert (a.("Image type"), "intensity"); + assert (a.("Minimum intensity"), uint8 (28)); + assert (a.("Maximum intensity"), uint8 (250)); ***** xtest - J = [0.0793650794 - 0.1269841270 - 0.2222222222 - 0.3174603175 - 0.4126984127 - 0.4920634921 - 0.5873015873 - 0.6825396825 - 0.7777777778 - 0.8730158730 - 1.0000000000]; - assert (histeq (0:0.1:1), J', 10^-8); + h = imshow (rgb); + a = imattributes (h); + assert ([a.("Height (rows)") a.("Width (columns)")], [53 40]); + assert (a.Class, "uint8"); + assert (a.("Image type"), "truecolor"); + assert (isfield (a, "Minimum intensity"), false); + assert (isfield (a, "Maximum intensity"), false); !!!!! known failure -ASSERT errors for: assert (histeq (0:0.1:1),J',10 ^ -8) +ASSERT errors for: assert (a.Class,"uint8") Location | Observed | Expected | Reason - (1) 0.090909 0.079365 Abs err 0.011544 exceeds tol 1e-08 by 0.01 - (2) 0.18182 0.12698 Abs err 0.054834 exceeds tol 1e-08 by 0.05 - (3) 0.27273 0.22222 Abs err 0.050505 exceeds tol 1e-08 by 0.05 - (4) 0.36364 0.31746 Abs err 0.046176 exceeds tol 1e-08 by 0.05 - (5) 0.45455 0.4127 Abs err 0.041847 exceeds tol 1e-08 by 0.04 - (6) 0.54545 0.49206 Abs err 0.053391 exceeds tol 1e-08 by 0.05 - (7) 0.63636 0.5873 Abs err 0.049062 exceeds tol 1e-08 by 0.05 - (8) 0.72727 0.68254 Abs err 0.044733 exceeds tol 1e-08 by 0.04 - (9) 0.81818 0.77778 Abs err 0.040404 exceeds tol 1e-08 by 0.04 - (10) 0.90909 0.87302 Abs err 0.036075 exceeds tol 1e-08 by 0.04 -22 tests, 7 passed, 15 known failures, 0 skipped -[inst/stdfilt.m] ->>>>> /build/reproducible-path/octave-image-2.16.0/inst/stdfilt.m + [] 'double' 'uint8' Strings don't match ***** test - im = stdfilt (ones (5)); - assert (im, zeros (5)) + h = imshow (bw); + a = imattributes (h); + assert ([a.("Height (rows)") a.("Width (columns)")], [53 40]); + assert (a.Class, "logical"); + assert (a.("Image type"), "binary"); + assert (isfield (a, "Minimum intensity"), false); + assert (isfield (a, "Maximum intensity"), false); ***** test - A = zeros (3,3); - B = ones (3,3); + h = imshow (x, map); + a = imattributes (h); + assert ([a.("Height (rows)") a.("Width (columns)")], [53 40]); + assert (a.Class, "uint8"); + assert (a.("Image type"), "indexed"); + assert (a.("Minimum intensity"), uint8 (0)); + assert (a.("Maximum intensity"), uint8 (55)); +***** test + h = imshow (img); + a1 = imattributes (); + a2 = imattributes (h); + assert (a1, a2); +5 tests, 4 passed, 1 known failure, 0 skipped +[inst/bweuler.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/bweuler.m +***** demo + A=zeros(9,10); + A([2,5,8],2:9)=1; + A(2:8,[2,9])=1 + bweuler(A) + # Euler number (objects minus holes) is 1-2=-1 in an 8-like object +***** test + A=zeros(10,10); + A(2:9,3:8)=1; + A(4,4)=0; + A(8,8)=0; # not a hole + A(6,6)=0; + assert(bweuler(A),-1); +***** test + A=zeros(10,10); + A(2:4,2:4)=1; + A(5:8,5:8)=1; + assert(bweuler(A,4),2); + assert(bweuler(A,8),1); + assert(bweuler(A),1); +***** error <2 dimensions> bweuler (true (5, 5, 1, 5)) +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/imcrop.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imcrop.m +***** test + a = randi (255, [100 100]); + rect = [20 30 3 5]; + assert (nthargout ([1 2], @imcrop, a, rect), {a(30:35, 20:23) rect}); + assert (nthargout (2, @imcrop, a, rect), rect); + assert (nthargout ([3 4], 4, @imcrop, a, rect), {a(30:35, 20:23) rect}); +***** test + rgb = randi (255, [100 100 3]); + rect = [20 30 3 5]; + assert (nthargout ([1 2], @imcrop, rgb, rect), {rgb(30:35, 20:23,:) rect}); + assert (nthargout (2, @imcrop, rgb, rect), rect); + assert (nthargout ([3 4], 4, @imcrop, rgb, rect), {rgb(30:35, 20:23,:) rect}); +***** test + a = randi (255, [100 100]); + rect = [20 30 3 5]; + cmap = jet (255); + assert (nthargout ([1 2], @imcrop, a, cmap, rect), {a(30:35, 20:23) rect}); + assert (nthargout (2, @imcrop, a, cmap, rect), rect); + assert (nthargout ([3 4], 4, @imcrop, a, cmap, rect), {a(30:35, 20:23) rect}); +***** test + a = rand (100) > 0.5; + rect = [20 30 3 5]; + assert (nthargout ([1 2], @imcrop, a, rect), {a(30:35, 20:23) rect}); + assert (nthargout (2, @imcrop, a, rect), rect); + assert (nthargout ([3 4], 4, @imcrop, a, rect), {a(30:35, 20:23) rect}); +***** assert (imcrop (0, [0.5 0.5 0.9 0.9]), 0); +***** assert (imcrop (zeros (5), [1 1 1 1]), zeros (2)); +***** test + im = magic (5); + assert (imcrop (im, [1 1 5 5]), im) + assert (imcrop (im, [0 0 5 5]), im) + assert (imcrop (im, [1 1 2 5]), im(:,1:3)) + assert (imcrop (im, [1 -3 2 5]), im(1:2,1:3)) + assert (imcrop (im, [5 -3 2 5]), im(1:2,5)) +***** test + im = [1:7] .* [1; 2; 3; 4; 5]; + assert (imcrop (im, [1 1 5 5]), im(:,1:6)) + assert (imcrop (im, [0 0 5 5]), im(:,1:5)) + assert (imcrop (im, [1 1 2 5]), im(:,1:3)) + assert (imcrop (im, [1 -3 2 7]), im(1:4,1:3)) + assert (imcrop (im, [7 -3 2 7]), im(1:4,7)) +***** test + ## Matlab returns [] (size 0x0) for this cases, while we return + ## [] (size 2x0). We are not compatible by design. If it ever + ## becomes an issue to anyone we can review this decision. + assert (imcrop (magic (5), [6 -3 2 5]), zeros (2, 0)) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/lab2single.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/lab2single.m +***** test + l_max_f = 100 + (25500 / 65280); + ab_max_f = 127 + (255 / 256); + cm = [ + -Inf + Inf + NaN + l_max_f + ab_max_f + -200 + -129 + -128 + -128+(255/65280)*(0.499) + -128+(255/65280)*(0.500) + -128+(255/65280)*(0.501) + -127 + -1 + 0 + (100/65280)*(0.499999) + (100/65280)*(0.51) + (100/65280)*(0.500001) + 1 + 99 + 100 + 101 + 126 + 127 + 128 + 254 + 255 + 256 + 257]; + cm = repmat (single (cm), [1 3]); + im2d = reshape (cm, [7 4 3]); + imnd = permute (im2d, [1 4 3 2]); + + cm_uint8 = uint8 ([ + 0 0 0 + 255 255 255 + 255 255 255 + 255 228 228 + 255 255 255 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 1 1 + 0 127 127 + 0 128 128 + 0 128 128 + 0 128 128 + 0 128 128 + 3 129 129 + 252 227 227 + 255 228 228 + 255 229 229 + 255 254 254 + 255 255 255 + 255 255 255 + 255 255 255 + 255 255 255 + 255 255 255 + 255 255 255]); + + assert (lab2uint8 (cm), cm_uint8) + im2d_uint8 = reshape (cm_uint8, [7 4 3]); + assert (lab2uint8 (im2d), im2d_uint8) + assert (lab2uint8 (imnd), permute (im2d_uint8, [1 4 3 2])) + + cm_uint16 = uint16 ([ + 0 0 0 + 65535 65535 65535 + 65535 65535 65535 + 65535 58468 58468 + 65535 65535 65535 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 1 1 + 0 1 1 + 0 256 256 + 0 32512 32512 + 0 32768 32768 + 0 32768 32768 + 1 32768 32768 + 1 32768 32768 + 653 33024 33024 + 64627 58112 58112 + 65280 58368 58368 + 65535 58624 58624 + 65535 65024 65024 + 65535 65280 65280 + 65535 65535 65535 + 65535 65535 65535 + 65535 65535 65535 + 65535 65535 65535 + 65535 65535 65535]); + + assert (lab2uint16 (cm), cm_uint16) + im2d_uint16 = reshape (cm_uint16, [7 4 3]); + assert (lab2uint16 (im2d), im2d_uint16) + assert (lab2uint16 (imnd), permute (im2d_uint16, [1 4 3 2])) + + assert (lab2double (cm), double (cm)) + assert (lab2double (im2d), double (im2d)) + assert (lab2double (imnd), double (imnd)) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/@strel/strel.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/@strel/strel.m +***** test + shape = logical ([0 0 0 1]); + assert (getnhood (strel (shape)), shape); + assert (getnhood (strel ("arbitrary", shape)), shape); + + height = [0 0 0 3]; + assert (getnhood (strel ("arbitrary", shape, height)), shape); + assert (getheight (strel ("arbitrary", shape, height)), height); +***** test + shape = logical ([0 0 1]); + height = [-2 1 3]; ## this works for matlab compatibility + assert (getnhood (strel ("arbitrary", shape, height)), shape); + assert (getheight (strel ("arbitrary", shape, height)), height); +***** test + shape = logical ([0 0 0 1 0 0 0 + 0 1 1 1 1 1 0 + 0 1 1 1 1 1 0 + 1 1 1 1 1 1 1 + 0 1 1 1 1 1 0 + 0 1 1 1 1 1 0 + 0 0 0 1 0 0 0]); + height = [ 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 + 0.00000 0.33333 0.66667 0.74536 0.66667 0.33333 0.00000 + 0.00000 0.66667 0.88192 0.94281 0.88192 0.66667 0.00000 + 0.00000 0.74536 0.94281 1.00000 0.94281 0.74536 0.00000 + 0.00000 0.66667 0.88192 0.94281 0.88192 0.66667 0.00000 + 0.00000 0.33333 0.66667 0.74536 0.66667 0.33333 0.00000 + 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000]; + assert (getnhood (strel ("ball", 3, 1)), shape); + assert (getheight (strel ("ball", 3, 1)), height, 0.0001); +***** test + shape = logical ([0 0 0 1 0 0 0 + 0 0 1 1 1 0 0 + 0 1 1 1 1 1 0 + 1 1 1 1 1 1 1 + 0 1 1 1 1 1 0 + 0 0 1 1 1 0 0 + 0 0 0 1 0 0 0]); + assert (getnhood (strel ("diamond", 3)), shape); +***** test + shape = logical ([0 0 0 1 0 0 0 + 0 1 1 1 1 1 0 + 0 1 1 1 1 1 0 + 1 1 1 1 1 1 1 + 0 1 1 1 1 1 0 + 0 1 1 1 1 1 0 + 0 0 0 1 0 0 0]); + assert (getnhood (strel ("disk", 3, 0)), shape); +***** test + shape = logical ([1 1 1]); + assert (getnhood (strel ("line", 3.9, 20.17)), shape); + shape = logical ([0 0 1 + 0 1 0 + 1 0 0]); + assert (getnhood (strel ("line", 3.9, 20.18)), shape); + shape = logical ([1 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 0 + 0 0 1 0 0 0 0 0 0 + 0 0 1 0 0 0 0 0 0 + 0 0 0 1 0 0 0 0 0 + 0 0 0 0 1 0 0 0 0 + 0 0 0 0 0 1 0 0 0 + 0 0 0 0 0 0 1 0 0 + 0 0 0 0 0 0 1 0 0 + 0 0 0 0 0 0 0 1 0 + 0 0 0 0 0 0 0 0 1]); + assert (getnhood (strel ("line", 14, 130)), shape); +***** test + se = strel ("octagon", 0); + seq = getsequence (se); + assert (getnhood (se), true (1)); + assert (getnhood (seq(1)), true (1)); + + se = strel ("octagon", 3); + seq = getsequence (se); + shape = logical ([0 0 1 1 1 0 0 + 0 1 1 1 1 1 0 + 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 + 0 1 1 1 1 1 0 + 0 0 1 1 1 0 0]); + assert (getnhood (se), shape); + assert (size (seq), [4 1]); + + templ1 = logical ([0 0 0; 1 1 1; 0 0 0]); + templ2 = logical ([0 1 0; 0 1 0; 0 1 0]); + templ3 = logical ([1 0 0; 0 1 0; 0 0 1]); + templ4 = logical ([0 0 1; 0 1 0; 1 0 0]); + assert ({getnhood(seq(1)) getnhood(seq(2)) getnhood(seq(3)) getnhood(seq(4))}, + {templ1 templ2 templ3 templ4}); + + seq = getsequence (strel ("octagon", 21)); + assert (size (seq), [28 1]); + assert (arrayfun (@(x) getnhood (seq(x)), 1:4:25, "UniformOutput", false), + repmat ({templ1}, 1, 7)); + assert (arrayfun (@(x) getnhood (seq(x)), 2:4:26, "UniformOutput", false), + repmat ({templ2}, 1, 7)); + assert (arrayfun (@(x) getnhood (seq(x)), 3:4:27, "UniformOutput", false), + repmat ({templ3}, 1, 7)); + assert (arrayfun (@(x) getnhood (seq(x)), 4:4:28, "UniformOutput", false), + repmat ({templ4}, 1, 7)); +***** test + shape = logical ([1 1 0]'); + assert (getnhood (strel ("pair", [-1 0])), shape); + shape = logical ([1 0 0 0 0 0 0 + 0 0 0 1 0 0 0 + 0 0 0 0 0 0 0]); + assert (getnhood (strel ("pair", [-1 -3])), shape); + shape = logical ([0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 1 0 0 0 + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 1]); + assert (getnhood (strel ("pair", [2 3])), shape); +***** test + assert (getnhood (strel ("rectangle", [10 5])), true (10, 5)); + assert (getnhood (strel ("square", 5)), true (5)); +***** shared se, seq + se = strel ("square", 5); + seq = getsequence (se); + assert (class (se(1)), "strel") + assert (class (se(1,1)),"strel") + assert (class (seq), "strel") + assert (class (seq(1)), "strel") + assert (class (seq(2)), "strel") + assert (numel (se), 1) + assert (numel (seq), 2) + assert (getnhood (seq(1)), true (5, 1)) + assert (getnhood (seq(2)), true (1, 5)) + assert (size (se), [1 1]) + assert (size (seq), [2 1]) + assert (isscalar (se), true) + assert (isscalar (seq), false) +***** error se(2); +***** error seq(3); +***** test + se = strel ("arbitrary", [1 0 0; 1 1 0; 0 1 0], [2 0 0; 3 1 0; 0 3 0]); + ref = reflect (se); + assert (getnhood (ref), logical([0 1 0; 0 1 1; 0 0 1])); + assert (getheight (ref), [0 3 0; 0 1 3; 0 0 2]); +***** error strel() +***** error strel("nonmethodthing", 2) +***** error strel("arbitrary", "stuff") +***** error strel("arbitrary", [0 0 1], [2 0 1; 4 5 1]) +***** error strel("arbitrary", [0 0 1], "stuff") +***** error strel("ball", -3, 1) +***** error strel("diamond", -3) +***** error strel("disk", -3) +***** error strel("line", 0, 45) +***** error strel("octagon", 3.5) +***** error strel("octagon", 4) +***** error strel("octagon", -1) +***** error strel("pair", [45 67 90]) +***** error strel("rectangle", 2) +***** error strel("rectangle", [2 -5]) +***** error strel("square", [34 1-2]) +28 tests, 28 passed, 0 known failure, 0 skipped +[inst/imimposemin.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imimposemin.m +***** shared im0, bw0, out0, out0_4 + im0 = uint8 ([5 5 5 5 5; + 5 4 3 4 5; + 5 3 0 3 5; + 5 4 3 4 5; + 5 5 5 5 5]); + bw0 = false (5); + bw0(4, 4) = true; + out0 = im0 + 1; + out0(4, 4) = 0; + out0_4 = out0; + out0_4(3, 3) = 4; +***** error imimposemin () +***** error imimposemin (im0) +***** error imimposemin ("hello", bw0) +***** error imimposemin (i.*im0, bw0) +***** error imimposemin (sparse (im0), bw0) +***** error imimposemin (im0, ones (2)) +***** error imimposemin (im0, 'hello') +***** error imimposemin (im0, i .* double (bw0)) +***** error imimposemin (im0, sparse (bw0)) +***** error imimposemin (im0, bw0, 'hello') +***** error imimposemin (im0, bw0, 3) +***** assert (imimposemin (im0, bw0), out0) +***** assert (imimposemin (im0, bw0, 8), out0) +***** assert (imimposemin (im0, bw0, 4), out0_4) +***** assert (imimposemin (im0, bw0, true (3)), out0) +***** test + out = imimposemin (im0, bw0); + assert (size (out), size (im0)) + assert (class (out), "uint8") +***** test + out = imimposemin (double (im0), bw0); + assert (size (out), size (im0)) + assert (class (out), "double") +***** test + out = imimposemin (single (im0), bw0); + assert (size (out), size (im0)) + assert (class (out), "single") +***** test + out = imimposemin (uint16 (im0), bw0); + assert (size (out), size (im0)) + assert (class (out), "uint16") +***** test + im = cat (3, im0, im0, im0, im0); + bw = cat (3, bw0, bw0, bw0, bw0); + out = imimposemin (im, bw); + assert (size (out), size (im)) +***** test + expected_double = double (im0); + expected_double += 0.005; + expected_double(4, 4) = -inf; + out = imimposemin (double (im0), bw0); + assert (out, expected_double, eps) +***** test + im = uint8 (10 .* ones (10)); + im(6:8, 6:8) = 2; + im(2:4, 2:4) = 7; + im(3, 3) = 5; + im(2, 9) = 9; + im(3, 8) = 9; + im(9, 2) = 9; + im(8, 3) = 9; + bw = false (10); + bw(3, 3) = true; + bw(6:8, 6:8) = true; + expected = uint8 (11 .* ones(10)); + expected(2:4, 2:4) = 8; + expected(3, 3) = 0; + expected(6:8, 6:8) = 0; + expected_double = double (expected); + expected_double -= 0.992; + expected_double (expected_double < 0) = -inf; + out = imimposemin (im, bw); + assert (out, expected, eps) + out = imimposemin (double (im), bw); + assert (out, expected_double, eps) +22 tests, 22 passed, 0 known failure, 0 skipped +[inst/iptcheckmap.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/iptcheckmap.m +***** test ("iptcheckmap (jet(64), 'func', 'var', 2)"); # simple must work +***** fail ("iptcheckmap (3, 'func', 'var', 2)"); # not a colormap +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/imapplymatrix.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imapplymatrix.m +***** error id=Octave:invalid-fun-call imapplymatrix () +***** error id=Octave:invalid-fun-call imapplymatrix (42) +***** error id=Octave:invalid-input-arg imapplymatrix (ones (2, 2, 2), 42) +***** error id=Octave:invalid-input-arg imapplymatrix ([], ones (2, 2)) +***** error id=Octave:invalid-input-arg imapplymatrix (ones (0, 2), ones (2, 2)) +***** error id=Octave:invalid-input-arg imapplymatrix (ones (2, 0), ones (2, 2)) +***** error id=Octave:invalid-input-arg imapplymatrix (4, 2, [2, 2]) +***** error id=Octave:invalid-input-arg imapplymatrix (4, 2, [2, 2], "uint8") +***** error id=Octave:invalid-input-arg imapplymatrix (4, 2, 0, 666) +***** assert (imapplymatrix ([], []), []) +***** assert (imapplymatrix ([], [], "uint16"), uint16 ([])) +***** assert (imapplymatrix (1, 10, []), 10) +***** assert (imapplymatrix (1, 10, ones (0, 5)), 10) +***** assert (imapplymatrix (1, 10, ones (5, 0)), 10) +***** assert (imapplymatrix (ones (0), ones (0), 3), []) +***** assert (imapplymatrix (ones (0), ones (4, 0), 3), zeros (4, 0)) +***** assert (imapplymatrix (ones (0), ones (0, 4), 3), zeros (0, 4)) +***** assert (imapplymatrix (ones (2, 0), ones (0, 4), 3), zeros (0, 4)) +***** assert (imapplymatrix (ones (0, 2), ones (0, 4), 3), zeros (0, 4)) +***** assert (imapplymatrix (ones (0, 2), ones (0, 4, 0), 3), zeros (0, 4, 0)) +***** assert (imapplymatrix("a", ones(2, 2)), nan (2, 2)) +***** assert (imapplymatrix("abc", ones(2, 2)), nan (2, 2)) +***** assert (imapplymatrix (1, 10), 10) +***** assert (imapplymatrix (1, 10, 3), 13) +***** assert (imapplymatrix (ones (1), uint8 (10), 3), uint8 (13)) +***** assert (imapplymatrix (uint8 (ones (1)), 10, 3), double (13)) +***** assert (imapplymatrix (uint8 (ones (1)), uint8 (10), 3), uint8 (13)) +***** assert (imapplymatrix (2.6 * ones (1), uint8 (10), 4.7), uint8 (31)) +***** assert (imapplymatrix (42, ones (1, 2)), 42 * ones (1, 2)) +***** assert (imapplymatrix (42, ones (2, 1)), 42 * ones (2, 1)) +***** assert (imapplymatrix (42, ones (2, 2)), 42 * ones (2, 2)) +***** assert (imapplymatrix (42, ones (2, 2), 0.5), 42.5 * ones (2, 2)) +***** assert (imapplymatrix ([4, 2], ones (2, 2, 2), 0.5), 6.5 * ones (2, 2)) +***** assert (imapplymatrix ([4, 2; + 4, 2], ones (2, 2, 2), [0.5, 0.5]), 6.5 * ones (2, 2, 2)) +***** assert (imapplymatrix ([4, 2; + 4, 2], ones (2, 2, 2), [0.5; 0.5]), 6.5 * ones (2, 2, 2)) +***** assert (imapplymatrix ([1, 2, 3], ones (2, 2, 3)), 6 * ones (2, 2, 1)) +***** assert (imapplymatrix ([1, 2, 3], ones (2, 2, 3), 1), 7 * ones (2, 2, 1)) +***** test + expected = zeros (2, 2, 2, "uint8"); + expected(:, :, 1) = 7 * ones (2, 2); + expected(:, :, 2) = 16 * ones (2, 2); + I = uint8 (ones (2, 2, 3)); + assert (imapplymatrix ([1, 2, 3 + 4, 5, 6], I, [1, 1]), expected) +***** test + expected = zeros (2, 2, 2, 2, "uint16"); + expected(:, :, 1, 1) = 7 * ones (2, 2); + expected(:, :, 2, 1) = 16 * ones (2, 2); + expected(:, :, 1, 2) = 13 * ones (2, 2); + expected(:, :, 2, 2) = 31 * ones (2, 2); + I(:, :, :, 1) = uint16 (ones (2, 2, 3)); + I(:, :, :, 2) = 2 * uint16 (ones (2, 2, 3)); + assert (imapplymatrix ([1, 2, 3; + 4, 5, 6], I, [1, 1]), expected) +39 tests, 39 passed, 0 known failure, 0 skipped +[inst/imdivide.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imdivide.m +***** assert (imdivide (uint8 ([23 250]), uint8 ([ 2 50])), uint8 ([ 12 5])); # default to first class +***** assert (imdivide (uint8 ([56 255]), uint8 ([ 0 0])), uint8 ([255 255])); # dividing by zero works (tested in matlab) +***** assert (imdivide (uint8 ([23 250]), 2), uint8 ([ 12 125])); # works subtracting a scalar +***** assert (imdivide (uint8 ([23 250]), uint8 ([ 2 50]), "uint16"), uint16 ([ 12 5])); # defining output class works (not in matlab) +***** assert (imdivide (logical ([1 1 0 0]), logical ([1 0 1 0])), double ([1 Inf 0 NaN])); # dividing logical matrix (tested in matlab) +***** fail ("imdivide (uint8 ([23 250]), uint16 ([23 250]))"); # input needs to have same class +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/fspecial.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/fspecial.m +***** test + for i = 1:9 + n = 2^i; + assert (sum (fspecial ("disk", n)(:)), 1, eps*n*n); + endfor +***** test + for r = [3 5 9 17] + f = fspecial ("disk", r); + [X, Y] = meshgrid (-r:r, -r:r); + rhi = (abs (X) + 0.5).^2 + (abs (Y) + 0.5).^2; + rlo = (abs (X) - 0.5).^2 + (abs (Y) - 0.5).^2; + fhi = (rhi <= (r^2)); + flo = (rlo >= (r^2)); + for i = 1:(2*r+1) + for j = 1:(2*r+1) + if (fhi(i,j)) + assert (f(i,j), 1/(pi*r^2), eps); + endif + if (flo(i,j)) + assert (f(i,j), 0); + endif + endfor + endfor + endfor +***** error + fspecial ("gaussian", 0) +***** error + fspecial ("gaussian", 3.9) +***** assert (fspecial ("gaussian"), fspecial ("gaussian", 3, 0.5)) +***** assert (fspecial ("gaussian"), fspecial ("gaussian", [3 3], 0.5)) +***** test + c = ([-1:1].^2) + ([-1:1]'.^2); + gauss = exp (- (c / (2 * (0.5 ^ 2)))); + f = gauss / sum (gauss(:)); + assert (fspecial ("gaussian"), f) + + expected = [ + 0.01134373655849507 0.08381950580221061 0.01134373655849507 + 0.08381950580221061 0.61934703055717721 0.08381950580221061 + 0.01134373655849507 0.08381950580221061 0.01134373655849507]; + assert (f, expected, eps) +***** function f = f_gaussian_2d (hsize, sigma) + c = ([(-hsize(1)):(hsize(1))]'.^2) + ([(-hsize(2)):(hsize(2))].^2); + gauss = exp (- (c ./ (2 * (sigma .^ 2)))); + f = gauss ./ sum (gauss(:)); +***** endfunction +***** test + f = fspecial ("gaussian"); + assert (f, f_gaussian_2d ([1 1], .5)) + expected = [ + 0.01134373655849507 0.08381950580221061 0.01134373655849507 + 0.08381950580221061 0.61934703055717721 0.08381950580221061 + 0.01134373655849507 0.08381950580221061 0.01134373655849507]; + assert (f, expected, eps) +***** test + f = fspecial ("gaussian", 7, 2); + assert (f, f_gaussian_2d ([3 3], 2)) + expected = [ + 0.00492233115934352 + 0.00919612528958620 + 0.01338028334410124 + 0.01516184737296414 + 0.01338028334410124 + 0.00919612528958620 + 0.00492233115934352 + 0.00919612528958620 + 0.01718062389630964 + 0.02499766026691484 + 0.02832606006174462 + 0.02499766026691484 + 0.01718062389630964 + 0.00919612528958620 + 0.01338028334410124 + 0.02499766026691484 + 0.03637138107390363 + 0.04121417419979795 + 0.03637138107390363 + 0.02499766026691484 + 0.01338028334410124 + 0.01516184737296414 + 0.02832606006174462 + 0.04121417419979795 + 0.04670177773892775]; + expected = reshape ([expected; expected((end-1):-1:1)], [7 7]); + assert (f, expected, eps) +***** test + f = fspecial ("gaussian", [7 5], 2); + assert (f, f_gaussian_2d ([3 2], 2)) + expected = [ + 0.01069713252648568 + 0.01998487459872362 + 0.02907782096336423 + 0.03294948784319031 + 0.02907782096336423 + 0.01998487459872362 + 0.01069713252648568 + 0.01556423598706978 + 0.02907782096336423 + 0.04230797985750011 + 0.04794122192790870 + 0.04230797985750011 + 0.02907782096336423 + 0.01556423598706978 + 0.01763658993191515 + 0.03294948784319031 + 0.04794122192790870 + 0.05432452146574315]; + expected = reshape ([expected; expected((end-1):-1:1)], [7 5]); + assert (f, expected, eps) +***** test + f = fspecial ("gaussian", [4 2], 2); + expected = [0.10945587477855045 0.14054412522144952]; + expected = expected([1 1; 2 2; 2 2; 1 1]); + assert (f, expected, eps) +***** test + expected =[0.04792235409415088 0.06153352068439959 0.07901060453704994]; + expected = expected([1 2 2 1; 2 3 3 2; 2 3 3 2; 1 2 2 1]); + assert (fspecial ("gaussian", 4, 2), expected) +***** function f = f_gaussian_3d (lengths, sigma) + [x, y, z] = ndgrid (-lengths(1):lengths(1), -lengths(2):lengths(2), + -lengths(3):lengths(3)); + sig_22 = 2 * (sigma.^2); + f = exp (-((x.^2)/sig_22 + (y.^2)/sig_22 + (z.^2)/sig_22)); + f = f / sum (f(:)); +***** endfunction +***** test + obs = fspecial ("gaussian", [5 5 5]); + assert (obs, f_gaussian_3d ([2 2 2], .5)) + + u_values = [ + 0.00000000001837155 + 0.00000000741161178 + 0.00000005476481523 + 0.00000299005759843 + 0.00002209370333384 + 0.00016325161336690 + 0.00120627532940896 + 0.00891323607975882 + 0.06586040141635063 + 0.48664620076350640]; + expected = zeros (5, 5, 5); + expected([1 5 21 25 101 105 121 125]) = u_values(1); + expected([2 4 6 10 16 20 22 24 26 30 46 50 76 80 96 100 102 104 106 110 116 120 122 124]) = u_values(2); + expected([3 11 15 23 51 55 71 75 103 111 115 123]) = u_values(3); + expected([7 9 17 19 27 29 31 35 41 45 47 49 77 79 81 85 91 95 97 99 107 109 117 119]) = u_values(4); + expected([8 12 14 18 28 36 40 48 52 54 56 60 66 70 72 74 78 86 90 98 108 112 114 118]) = u_values(5); + expected([13 53 61 65 73 113]) = u_values(6); + expected([32 34 42 44 82 84 92 94]) = u_values(7); + expected([33 37 39 43 57 59 67 69 83 87 89 93]) = u_values(8); + expected([38 58 62 64 68 88]) = u_values(9); + expected([63]) = u_values(10); + assert (obs, expected, 4 * eps) +***** test + obs = fspecial ("gaussian", [5 5 5], 1); + assert (obs, f_gaussian_3d ([2 2 2], 1)) + + u_values = [ + 0.00016177781678373 + 0.00072503787330278 + 0.00119538536377748 + 0.00324939431236223 + 0.00535734551968363 + 0.00883276951279243 + 0.01456277497493249 + 0.02400995686159072 + 0.03958572658629712 + 0.06526582943894763]; + expected = zeros (5, 5, 5); + expected([1 5 21 25 101 105 121 125]) = u_values(1); + expected([2 4 6 10 16 20 22 24 26 30 46 50 76 80 96 100 102 104 106 110 116 120 122 124]) = u_values(2); + expected([3 11 15 23 51 55 71 75 103 111 115 123]) = u_values(3); + expected([7 9 17 19 27 29 31 35 41 45 47 49 77 79 81 85 91 95 97 99 107 109 117 119]) = u_values(4); + expected([8 12 14 18 28 36 40 48 52 54 56 60 66 70 72 74 78 86 90 98 108 112 114 118]) = u_values(5); + expected([13 53 61 65 73 113]) = u_values(6); + expected([32 34 42 44 82 84 92 94]) = u_values(7); + expected([33 37 39 43 57 59 67 69 83 87 89 93]) = u_values(8); + expected([38 58 62 64 68 88]) = u_values(9); + expected([63]) = u_values(10); + assert (obs, expected, eps) +***** test + obs = fspecial ("gaussian", [3 4 1 5], 3); + assert (find (obs == max (obs(:))), [29; 32]) + assert (size (obs), [3 4 1 5]) + assert (obs(:)(1:30), obs(:)(end:-1:31)) +***** test + f = repmat (1/9, [3 3]); + assert (fspecial ("average", [3 3]), f) + + ## Test default + assert (fspecial ("average"), fspecial ("average", [3 3])) + assert (fspecial ("average"), fspecial ("average", [3])) + + f = repmat (1/21, [3 7]); + assert (fspecial ("average", [3 7]), f) + + f = repmat (1/40, [4 5 1 2]); + assert (fspecial ("average", [4 5 1 2]), f) + ## Behave even if it's a column vector + assert (fspecial ("average", [4 5 1 2]'), f) +16 tests, 16 passed, 0 known failure, 0 skipped +[inst/hough.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/hough.m +***** shared BW0, BW1, BW2, BWx, BWy + + BW0 = false (5); + BW0(2,2) = true; + + BW1 = zeros (100, 100); + BW1(1,1) = 1; + BW1(100,100) = 1; + BW1(1,100) = 1; + BW1(100, 1) = 1; + BW1(50,50) = 1; + + n = 100; + BW2 = false (n); + a = 50; # line starts at left side at row a + b = 3; # slope of line is 1:b + for column = 1:n + if (rem (column, b) == 0) + row = a - column/b; + BW2(row, column) = true; + endif + endfor + + BWx = false (10); + BWx(:,5) = true; + + BWy = false (10); + BWy(5,:) = true; +***** test + [H, T, R] = hough (BW1); + assert (size (H), [283 180]); +***** test + [H, T, R] = hough (BW1, "Theta", [-90 0 45 79]); + assert (size (H), [283 4]); +***** test + [H, T, R] = hough (BW1, "ThetaResolution", 0.5); + assert (size (H), [283 360]); +***** error hough ("foo") +***** test + I = [0 0 1 0; 1 1 1 1; 0 0 1 1; 0 0 1 0]; + I2 = I; + for v = [0.7 0.2 5] + I2(1,3) = v; + assert (hough (I2), hough (I)) + endfor +***** error + [H, T, R] = hough (BW0, "Theta"); +***** error + [H, T, R] = hough (BW0, "Theta", ones (10)); +***** error + [H, T, R] = hough (BW0, "Theta", [5 -i 7]); +***** error + [H, T, R] = hough (BW0, "RhoResolution", 0.5); +***** test + [Hd, Td, Rd] = hough (BW0); + [H1, T1, R1] = hough (BW0, "RhoResolution", 1); + assert (Hd, H1) + assert (Td, T1) + assert (Rd, R1) +***** test + [H, theta, rho] = hough (BW2); + H_max = max (H(:)); + H_size = size (H); + [~, max_idx_lin] = max (H(:)); + [max_row, max_column] = ind2sub (size (H), max_idx_lin); + theta_max = theta(max_column); + rho_max = rho(max_row); + assert (H_max , 33); + assert (H_size, [283 180]); + assert (max_row, 188); + assert (max_column, 163); + assert (theta_max, 72); + assert (rho_max, 46); +***** test + [H, theta, rho] = hough (BW2, "Theta", [65:1:75]); + H_max = max (H(:)); + H_size = size (H); + [~, max_idx_lin] = max (H(:)); + [max_row, max_column] = ind2sub (size (H), max_idx_lin); + theta_max = theta(max_column); + rho_max = rho(max_row); + assert (H_max , 33); + assert (H_size, [283 11]); + assert (max_row, 188); + assert (max_column, 8); + assert (theta_max, 72); + assert (rho_max, 46); +***** test + [H, theta, rho] = hough (BW2, "Theta", [-90:0.5:89.5]); + H_max = max (H(:)); + H_size = size (H); + [~, max_idx_lin] = max (H(:)); + [max_row, max_column] = ind2sub (size (H), max_idx_lin); + theta_max = theta(max_column); + rho_max = rho(max_row); + assert (H_max , 33); + assert (H_size, [283 360]); + assert (max_row, 188); + assert (max_column, 324); + assert (theta_max, 71.5); + assert (rho_max, 46); +***** test + [H, theta, rho] = hough (BW2, "ThetaResolution", 0.5); + H_max = max (H(:)); + H_size = size (H); + [~, max_idx_lin] = max (H(:)); + [max_row, max_column] = ind2sub (size (H), max_idx_lin); + theta_max = theta(max_column); + rho_max = rho(max_row); + assert (H_max , 33); + assert (H_size, [283 360]); + assert (max_row, 188); + assert (max_column, 324); + assert (theta_max, 71.5); + assert (rho_max, 46); +***** test + [H, theta, rho] = hough (BWx); + H_max = max (H(:)); + [~, max_idx_lin] = max (H(:)); + [max_row, max_column] = ind2sub (size (H), max_idx_lin); + theta_max = theta(max_column); + rho_max = rho(max_row); + assert (H_max , 10); + assert (max_column, 88); + assert (theta_max, -3); + assert (rho_max, 4); +***** test + [H, theta, rho] = hough (BWx); + H_size = size (H); + [~, max_idx_lin] = max (H(:)); + [max_row, max_column] = ind2sub (size (H), max_idx_lin); + assert (H_size, [27 180]); + assert (max_row, 18); +***** test + [H, theta, rho] = hough (BWy); + H_max = max (H(:)); + [~, max_idx_lin] = max (H(:)); + [max_row, max_column] = ind2sub (size (H), max_idx_lin); + theta_max = theta(max_column); + rho_max = rho(max_row); + assert (H_max , 10); + assert (max_column, 1); + assert (theta_max, -90); + assert (rho_max, -4); +***** test + [H, theta, rho] = hough (BWy); + H_size = size (H); + [~, max_idx_lin] = max (H(:)); + [max_row, max_column] = ind2sub (size (H), max_idx_lin); + assert (H_size, [27 180]); + assert (max_row, 10); +***** demo + BW = zeros (100, 150); + BW(30,:) = 1; + BW(:, 65) = 1; + BW(35:45, 35:50) = 1; + for i = 1:90 + BW(i,i) = 1; + endfor + BW = imnoise (BW, "salt & pepper"); + figure (); + imshow (BW); + title ("BW"); + [H, theta, rho] = hough (BW); + H /= max (H(:)); + figure (); + imshow (H, "XData", theta, "YData", rho); + title ("hough transform of BW"); + axis on; + xlabel ("angle \\theta [degrees]"); + ylabel ("distance \\rho to origin [pixels]"); +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/integralImage3.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/integralImage3.m +***** test + assert (integralImage3 (zeros (4)), zeros (5, 5, 2)); +***** test + J_res = zeros (2, 2, 2); + J_res(2, 2, 2) = 10; + assert (integralImage3 (10), J_res); +***** test + J = integralImage3 (10); + assert (class (J), "double"); + J = integralImage3 (uint8 (10)); + assert (class (J), "double"); +***** test + I = [1, 2; 3, 4]; + J = integralImage3 (I); + J_res = zeros (3, 3, 2); + J_res(2:3, 2:3, 2) = [1 3; 4 10]; + assert (J, J_res) +***** test + I1 = [1, 2; 3, 4]; + I2 = [5, 6; 7, 8]; + I3 = [9, 10; 11, 12]; + I = cat (3, I1, I2, I3); + J = integralImage3 (I); + J2 = [0 0 0; 0 1 3; 0 4 10]; + J3 = [0 0 0; 0 6 14; 0 16 36]; + J4 = [0 0 0; 0 15 33; 0 36 78]; + J_res = cat (3, zeros (3), J2, J3, J4); + assert (J, J_res) +***** test + I = magic (5); + J = integralImage3 (I); + J_res = zeros (6, 6, 2); + J_res(:, :, 2) = [0 0 0 0 0 0; + 0 17 41 42 50 65; + 0 40 69 77 99 130; + 0 44 79 100 142 195; + 0 54 101 141 204 260; + 0 65 130 195 260 325]; + assert (J, J_res) +***** # test of 3d input image: +***** test + K = magic (8); + K = reshape (K, [4 4 4]); + L = integralImage3 (K); + L1_ML = zeros (5); + L2_ML = [0 0 0 0 0; + 0 64 96 98 132; + 0 73 146 203 260; + 0 90 212 316 388; + 0 130 260 390 520]; + L3_ML = [0 0 0 0 0; + 0 67 134 197 260; + 0 130 260 390 520; + 0 193 386 583 780; + 0 260 520 780 1040]; + L4_ML = [0 0 0 0 0; + 0 127 222 291 392; + 0 203 406 593 780; + 0 287 606 903 1168; + 0 390 780 1170 1560]; + L5_ML = [0 0 0 0 0; + 0 134 268 394 520; + 0 260 520 780 1040; + 0 386 772 1166 1560; + 0 520 1040 1560 2080]; + L_ML = cat (3, L1_ML, L2_ML, L3_ML, L4_ML, L5_ML); + assert (L, L_ML) +***** # test of 2d input image: +***** test + X = ones (3); + Y = integralImage3 (X); + Y_ML = zeros (4, 4, 2); + Y_ML(:, :, 2) = [0 0 0 0; 0 1 2 3; 0 2 4 6; 0 3 6 9]; + assert(Y, Y_ML); +***** error id=Octave:invalid-fun-call + integralImage3 (); +***** error id=Octave:invalid-fun-call + integralImage3 (zeros (3), zeros (3)); +***** error + integralImage3 ("abcd"); +***** error + integralImage3 (1+i); +***** error + integralImage3 (reshape (1:81, 3, 3, 3, 3)); +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/imgaussfilt.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imgaussfilt.m +***** assert (imgaussfilt(ones (5) * 9)); +***** assert (isa (imgaussfilt (uint8 (ones (5))), "uint8")); +***** assert (isa (imgaussfilt (uint16 (ones (5))), "uint16")); +***** assert (isa (imgaussfilt (uint32 (ones (5))), "uint32")); +***** assert (isa (imgaussfilt (uint64 (ones (5))), "uint64")); +***** assert (isa (imgaussfilt (int8 (ones (5))), "int8")); +***** assert (isa (imgaussfilt (int16 (ones (5))), "int16")); +***** assert (isa (imgaussfilt (int32 (ones (5))), "int32")); +***** assert (isa (imgaussfilt (single (ones (5))), "single")); +***** assert (isa (imgaussfilt (double (ones (5))), "double")); +***** error (imgaussfilt (true (5))); +***** error (imgaussfilt (5i+9)); +***** error (imgaussfilt ({"sdg","sdgsd"})); +***** error (imgaussfilt ("sdjgkhsdkl")); +***** error (imgaussfilt (struct("x", "34", "y", "67"))) +***** error (imgaussfilt ()); +***** error (imgaussfilt ("asdf")); +***** assert(imgaussfilt(ones (5), 6)); +***** assert(imgaussfilt(ones (5), 1.7)); +***** assert (imgaussfilt (ones (5), [1, 4])); +***** error(imgaussfilt(ones (5), -0.5)); +***** error (imgaussfilt (ones (3), "asdf")); +***** error (imgaussfilt (ones (3), [3,5,6])); +***** error (imgaussfilt (ones (3), [3,-5])); +***** error (imgaussfilt (ones (3), [-3, 4])); +***** error (imgaussfilt (ones (3), [-3, -4])); +***** assert (imgaussfilt (ones (5), "padding", "circular")); +***** assert (imgaussfilt (ones (5), "padding", "symmetric")); +***** assert (imgaussfilt (ones (3), "padding", "replicate")); +***** assert (imgaussfilt (ones (3), "Padding", "Replicate")); +***** assert (imgaussfilt (ones (3), "Padding", 5)); +***** error (imgaussfilt (ones (3), "circular")); +***** error (imgaussfilt (ones (3), "symmetric", "padding")); +***** error (imgaussfilt (ones (3), "padding")); +***** error (imgaussfilt (ones (3), "padding", "ciircular")); +***** error (imgaussfilt (ones (3), "padding", [2, 3])); +***** error(imgaussfilt(ones (5), 5i)); +***** assert (imgaussfilt (ones (5), "filtersize", 3)); +***** assert (imgaussfilt (ones (5), "FilterSize", [5, 7])); +***** assert (imgaussfilt (ones (5), "FilterSize", [5, 3]')); +***** error (imgaussfilt (ones (5), "filter", 3)); +***** error (imgaussfilt (ones (5), "filtersize", 4)); +***** error (imgaussfilt (ones (5), "filtersize", 5.5)); +***** error (imgaussfilt (ones (5), "filterSize", [5, 2])); +***** error (imgaussfilt (ones (5), "filterSize", [5, 2]')); +***** error (imgaussfilt (ones (5), "filtersize", [5, 7.5])); +***** error (imgaussfilt (ones (5), "filtersize", [5, 7.5]')); +***** assert (imgaussfilt (ones (5), "padding", "replicate")); +***** assert (imgaussfilt (ones (5), "padding", "circular")); +***** assert (imgaussfilt (ones (5), "padding", "symmetric")); +***** assert (imgaussfilt (ones (5), "padding", 5)); +***** assert (imgaussfilt (ones (5), "FilterDomain", "auto")); +***** assert (imgaussfilt (ones (5), "FilterDomain", "frequency")); +***** assert (imgaussfilt (ones (5), "FilterDomain", "spatial")); +***** error (imgaussfilt (ones (5), "FilterDomain", "asdf")); +***** error (imgaussfilt (ones (5), "FilterDomain", 4)); +***** test + input = [1, 1, 1; 10, 10, 10; 100, 100, 100]; + expected = [12.5028 12.5028 12.5028 + 18.6271 18.6271 18.6271 + 79.8702 79.8702 79.8702]; + output = imgaussfilt (input, "padding", "circular"); + assert (output, expected, 0.0001); +***** test + input = [1, 1, 1; 10, 10, 10; 100, 100, 100]; + expected = [1.9586 1.9586 1.9586 + 18.6271 18.6271 18.6271 + 90.4144 90.4144 90.4144]; + output = imgaussfilt (input, "padding", "replicate"); + assert (output, expected, 0.0001); +***** test + input = [1 1 1 1 1 1 + 1 2 2 2 2 1; + 1 2 2 2 2 1; + 1 2 2 2 2 1; + 1 2 2 2 2 1; + 1 1 1 1 1 1]; + expected = [1.0114 1.0953 1.1067 1.1067 1.0953 1.0114 + 1.0953 1.7980 1.8930 1.8930 1.7980 1.0953 + 1.1067 1.8930 1.9995 1.9995 1.8930 1.1067 + 1.1067 1.8930 1.9995 1.9995 1.8930 1.1067 + 1.0953 1.7980 1.8930 1.8930 1.7980 1.0953 + 1.0114 1.0953 1.1067 1.1067 1.0953 1.0114]; + output = imgaussfilt (input, "filterSize", 5, "padding", "replicate"); + assert (output, expected, 0.0001); +***** test + input = [1 1 1 1 1 1 + 1 2 2 2 2 1; + 1 2 2 2 2 1; + 1 2 2 2 2 1; + 1 2 2 2 2 1; + 1 1 1 1 1 1]; + expected = [1.0114 1.0956 1.1070 1.1070 1.0956 1.0114 + 1.0956 1.7980 1.8930 1.8930 1.7980 1.0956 + 1.1070 1.8930 1.9995 1.9995 1.8930 1.1070 + 1.1070 1.8930 1.9995 1.9995 1.8930 1.1070 + 1.0956 1.7980 1.8930 1.8930 1.7980 1.0956 + 1.0114 1.0956 1.1070 1.1070 1.0956 1.0114]; + output = imgaussfilt (input, "filterSize", 5, "padding", "symmetric"); + assert (output, expected, 0.0001); +***** test + input = zeros(3,3,3,3); + input (2,2,:,:) = 9; + output = imgaussfilt (input); + expected = ones (3,3,3,3); + assert (size(output), size(expected), eps); +***** test + a1 = ones (5); + a2 = ones (5) * 2; + a3 = ones (5) * 3; + a4 = ones (5) * 4; + im = cat (4, a1, a2, a3, a4); + expected = im; + output = imgaussfilt (im); + assert (output, expected, 0.0001); +***** test + input = zeros(5,7); + input(3,4) = 1; + expected = [ -0.0000 0.0001 0.0006 0.0011 0.0006 0.0001 -0.0000 + 0.0000 0.0062 0.0397 0.0736 0.0397 0.0062 0.0000 + 0 0.0250 0.1593 0.2953 0.1593 0.0250 -0.0000 + 0 0.0062 0.0397 0.0736 0.0397 0.0062 -0.0000 + -0.0000 0.0001 0.0006 0.0011 0.0006 0.0001 -0.0000 ]; + output = imgaussfilt(input, [0.6,0.9], "filterDomain", "frequency"); + assert (output, expected, 0.01); +***** test + input = zeros(8); + input(6,4) = 1; + input(6,5) = 1; + input(7,4) = 2; + input(7,5) = 2; + expected_replicate = [-0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0030 0.0163 0.0352 0.0352 0.0163 0.0030 0.0000 + 0.0000 0.0163 0.0892 0.1932 0.1932 0.0892 0.0163 0.0000 + 0.0000 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0.0000 + 0 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0 + -0.0000 0.0192 0.1055 0.2284 0.2284 0.1055 0.0192 0.0000]; + expected_circular = [-0.0000 0.0030 0.0163 0.0352 0.0352 0.0163 0.0030 0.0000 + 0.0000 -0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0030 0.0163 0.0352 0.0352 0.0163 0.0030 0.0000 + 0.0000 0.0163 0.0892 0.1932 0.1932 0.0892 0.0163 0.0000 + 0 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0.0000 + 0.0000 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0.0000 + 0.0000 0.0163 0.0892 0.1932 0.1932 0.0892 0.0163 0.0000]; + expected_symmetric = [-0.0000 -0.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 -0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0030 0.0163 0.0352 0.0352 0.0163 0.0030 0.0000 + 0 0.0163 0.0892 0.1932 0.1932 0.0892 0.0163 0 + 0.0000 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0 + 0 0.0352 0.1932 0.4184 0.4184 0.1932 0.0352 0 + 0.0000 0.0163 0.0892 0.1932 0.1932 0.0892 0.0163 0.0000]; + output_symmetric = imgaussfilt(input, 1, "filterDomain", "frequency", "padding", "symmetric"); + output_circular = imgaussfilt(input, 1, "filterDomain", "frequency", "padding", "circular"); + output_replicate = imgaussfilt(input, 1, "filterDomain", "frequency", "padding", "replicate"); + assert (output_symmetric, expected_symmetric, 0.3); + assert (output_circular, expected_circular, 0.3); + assert (output_replicate, expected_replicate, 0.3); +***** test + im = zeros (11); + im(6,6) = 1; + out = imgaussfilt (im, [2, 0.5]); + assert (sum (out(6,:)), 0.2042, 0.0001); + assert (sum (out(:,6)), 0.7870, 0.0001); +65 tests, 65 passed, 0 known failure, 0 skipped +[inst/padarray.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/padarray.m +***** demo + padarray([1,2,3;4,5,6],[2,1]) + % pads [1,2,3;4,5,6] with a whole border of 2 rows and 1 columns of 0 +***** demo + padarray([1,2,3;4,5,6],[2,1],5) + % pads [1,2,3;4,5,6] with a whole border of 2 rows and 1 columns of 5 +***** demo + padarray([1,2,3;4,5,6],[2,1],0,'pre') + % pads [1,2,3;4,5,6] with a left and top border of 2 rows and 1 columns of 0 +***** demo + padarray([1,2,3;4,5,6],[2,1],'circular') + % pads [1,2,3;4,5,6] with a whole 'circular' border of 2 rows and 1 columns + % border 'repeats' data as if we tiled blocks of data +***** demo + padarray([1,2,3;4,5,6],[2,1],'replicate') + % pads [1,2,3;4,5,6] with a whole border of 2 rows and 1 columns which + % 'replicates' edge data +***** demo + padarray([1,2,3;4,5,6],[2,1],'symmetric') + % pads [1,2,3;4,5,6] with a whole border of 2 rows and 1 columns which + % is symmetric to the data on the edge +***** assert (padarray ([1;2], [1]), [0;1;2;0]); +***** assert (padarray ([3 4], [0 2]), [0 0 3 4 0 0]); +***** assert (padarray ([1 2 3; 4 5 6], [1 2]), + [zeros(1, 7); 0 0 1 2 3 0 0; 0 0 4 5 6 0 0; zeros(1, 7)]); +***** test + assert (padarray ([1 2 3; 4 5 6], [3 2 1]), + cat(3, zeros(8, 7), + [ [ zeros(3, 7) ] + [zeros(2, 2) [1 2 3; 4 5 6] zeros(2, 2) ] + [ zeros(3,7)] ], + zeros (8, 7))); +***** assert (padarray ([1 2], [4 5]), padarray ([1 2], [4 5], 0)); +***** assert (padarray ([1 2], [4 5]), padarray ([1 2], [4 5], "both")); +***** assert (padarray ([1;2], [1], i), [i; 1; 2; i]); +***** assert (padarray ([1;2], [1], i, "pre"), [i; 1; 2]); +***** assert (padarray ([1;2], [1], i, "post"), [1; 2; i]); +***** assert (padarray ([1;2], [1], i, "both"), [i; 1; 2; i]); +***** assert (padarray ([1 2], [0 1], i, "pre"), [i 1 2]); +***** assert (padarray ([1 2], [0 1], i, "post"), [1 2 i]); +***** assert (padarray ([1 2], [0 1], i, "both"), [i 1 2 i]); +***** assert (padarray ([1 2], [0;1], i, "both"), [i 1 2 i]); +***** test + A = [1 2 3; 4 5 6]; + B = repmat (A, 7, 9); + assert (padarray (A, [1 2], "circular", "pre"), B(2:4,2:6)); + assert (padarray (A, [1 2], "circular", "post"), B(3:5,4:8)); + assert (padarray (A, [1 2], "circular", "both"), B(2:5,2:8)); + ## This tests when padding is bigger than data + assert (padarray (A, [5 10], "circular", "both"), B(2:13,3:25)); +***** test + A = int8 ([1 2 3; 4 5 6]); + B = repmat (A, 7, 9); + assert (padarray (A, [1 2], "circular", "pre"), B(2:4,2:6)); + assert (padarray (A, [1 2], "circular", "post"), B(3:5,4:8)); + assert (padarray (A, [1 2], "circular", "both"), B(2:5,2:8)); + ## This tests when padding is bigger than data + assert (padarray (A, [5 10], "circular", "both"), B(2:13,3:25)); +***** test + A = [1 2; 3 4]; + B = kron (A, ones (10, 5)); + assert (padarray (A, [9 4], "replicate", "pre"), B(1:11,1:6)); + assert (padarray (A, [9 4], "replicate", "post"), B(10:20,5:10)); + assert (padarray (A, [9 4], "replicate", "both"), B); + ## same with uint class + assert (padarray (uint8 (A), [9 4], "replicate", "pre"), uint8 (B(1:11,1:6))); + assert (padarray (uint8 (A), [9 4], "replicate", "post"), uint8 (B(10:20,5:10))); + assert (padarray (uint8 (A), [9 4], "replicate", "both"), uint8 (B)); +***** test + A = [1:3 + 4:6]; + HA = [3:-1:1 + 6:-1:4]; + VA = [4:6 + 1:3]; + VHA = [6:-1:4 + 3:-1:1]; + B = [VHA VA VHA + HA A HA + VHA VA VHA]; + assert (padarray (A, [1 2], "symmetric", "pre"), B(2:4,2:6)); + assert (padarray (A, [1 2], "symmetric", "post"), B(3:5,4:8)); + assert (padarray (A, [1 2], "symmetric", "both"), B(2:5,2:8)); + ## same with int class + assert (padarray (int16 (A), [1 2], "symmetric", "pre"), int16 (B(2:4,2:6))); + assert (padarray (int16 (A), [1 2], "symmetric", "post"), int16 (B(3:5,4:8))); + assert (padarray (int16 (A), [1 2], "symmetric", "both"), int16 (B(2:5,2:8))); +***** assert (padarray (int8 ([1; 2]), [1]), int8 ([0; 1; 2; 0])); +***** assert (padarray (uint8 ([3 4]), [0 2]), uint8 ([0 0 3 4 0 0])); +***** assert (padarray (int16 ([1; 2]), [1], 4), int16 ([4; 1; 2; 4])); +***** assert (padarray (uint16 ([1; 2]), [1], 0), uint16 ([0; 1; 2; 0])); +***** assert (padarray (uint32 ([1; 2]), [1], 6, "post"), uint32 ([1; 2; 6])); +***** assert (padarray (int32 ([1; 2]), [1], int32 (4), "pre"), int32 ([4; 1; 2])); +***** test + in = [ 7 5 1 3 + 5 3 3 4 + 7 5 2 3 + 6 1 3 8]; + padded = [ + 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 + 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 + 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 + 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 + 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 + 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 + 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 + 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 + 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 + 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 + 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 + 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 + 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 + 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 + 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 + 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 + 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 + 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 + 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 5 7 7 5 1 3 3 1 + 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 3 5 5 3 3 4 4 3 + 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 + 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 + 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 1 6 6 1 3 8 8 3 + 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2 5 7 7 5 2 3 3 2]; + for ite = 1:10 + assert (padarray (in, [ite ite], "symmetric"), padded((11-ite):(14+ite),(11-ite):(14+ite))); + assert (padarray (in, [ite ite], "symmetric", "pre"), padded((11-ite):14,(11-ite):14)); + assert (padarray (in, [ite ite], "symmetric", "post"), padded(11:(14+ite),11:(14+ite))); + endfor +***** test + in = [ 7 5 4 9 + 6 4 5 1 + 5 3 3 3 + 2 6 7 3]; + padded = [ + 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 + 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 + 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 + 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 + 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 + 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 + 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 + 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 + 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 + 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 + 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 + 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 + 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 + 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 + 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 + 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 + 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 + 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 + 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 + 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 7 3 7 6 2 6 + 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 3 3 3 3 5 3 + 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 + 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 4 9 4 5 7 5 + 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4 5 1 5 4 6 4]; + for ite = 1:10 + assert (padarray (in, [ite ite], "reflect"), padded((11-ite):(14+ite),(11-ite):(14+ite))); + assert (padarray (in, [ite ite], "reflect", "pre"), padded((11-ite):14,(11-ite):14)); + assert (padarray (in, [ite ite], "reflect", "post"), padded(11:(14+ite),11:(14+ite))); + endfor +26 tests, 26 passed, 0 known failure, 0 skipped +[inst/label2rgb.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/label2rgb.m +***** function map = test_colormap (unused) + map = [0 0 0; 0.5 0.5 0.5; 0.125 0.125 0.125]; +***** endfunction +***** shared in, out, cmap + in = [ 0 1 1 0 2 2 0 3 3 + 0 1 1 0 2 2 0 3 3]; + + out = [255 0 0 255 128 128 255 32 32 + 255 0 0 255 128 128 255 32 32]; + out(:,:,2) = out(:,:,3) = out(:,:,1); + out = uint8(out); + + cmap = [0 0 0; 0.5 0.5 0.5; 0.125 0.125 0.125]; +***** assert (label2rgb (in, cmap), out); +***** assert (label2rgb (uint8 (in), cmap), out); +***** assert (label2rgb (in, "test_colormap"), out); +***** assert (label2rgb (in, @test_colormap), out); + + out(find (in == 0)) = 0; +***** assert (label2rgb (in, cmap, "cyan"), out); +***** assert (label2rgb (in, cmap, [0 1 1]), out); + + in(1) = 10; +***** error label2rgb (in, cmap); +***** error label2rgb (in, cmap, 89); +***** error label2rgb (in, cmap, "g", "wrong"); +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/imopen.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imopen.m +***** shared in, out + in = [ 0 0 0 1 1 1 0 0 1 1 + 0 1 0 1 1 1 0 0 0 1 + 1 1 1 1 1 0 0 0 0 0 + 0 1 1 1 1 0 0 0 0 0 + 0 0 0 1 0 0 0 0 1 0 + 0 0 0 0 0 0 0 1 1 1 + 0 0 0 0 1 0 1 0 1 0 + 0 0 0 1 1 1 1 1 0 0 + 0 0 0 0 1 1 1 0 0 0 + 0 0 0 1 1 1 0 0 0 0]; + + out = [ 0 0 0 1 1 1 0 0 0 0 + 0 0 0 1 1 1 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0]; +***** assert (imopen (logical (in), ones (3)), logical (out)); + + out = [80 80 1 8 15 51 51 51 51 40 + 80 80 7 8 15 54 55 55 55 40 + 4 7 7 8 15 54 55 55 55 40 + 17 17 17 7 3 54 55 55 55 28 + 17 17 17 2 9 54 54 54 52 33 + 17 17 17 29 29 29 29 26 33 33 + 5 5 13 29 29 29 30 32 39 39 + 6 6 13 29 29 29 30 32 39 39 + 10 12 77 77 77 35 35 35 39 39 + 10 12 77 77 77 35 35 35 27 27]; +***** assert (imopen (magic (10), ones (3)), out); +***** assert (imopen (uint8 (magic (10)), strel ("square", 3)), uint8 (out)); + + ## using a se that will be decomposed in 2 pieces + out =[ 1 1 1 8 15 40 40 40 40 40 + 4 4 4 8 15 40 40 40 40 40 + 4 4 4 8 15 40 40 40 40 40 + 5 5 5 3 3 28 28 28 28 28 + 5 5 5 2 9 28 28 28 28 28 + 5 5 13 26 26 26 26 26 26 26 + 5 5 13 29 29 29 29 29 27 27 + 6 6 13 29 29 29 29 29 27 27 + 6 6 13 29 29 29 29 29 27 27 + 6 6 13 29 29 29 29 29 27 27]; +***** assert (imopen (magic (10), ones(5)), out); + + ## using a weird non-symmetric and even-size se + out =[ 7 7 1 8 15 55 51 51 41 40 + 7 7 7 8 16 55 55 55 51 41 + 4 9 7 7 16 54 55 54 55 47 + 25 25 9 9 3 52 54 52 54 28 + 25 24 25 2 9 33 52 34 52 34 + 17 24 29 31 29 30 33 26 33 34 + 17 5 29 31 31 31 30 32 39 33 + 10 6 13 35 35 29 31 32 45 39 + 10 12 77 36 36 35 35 31 45 45 + 11 12 77 77 77 36 36 35 27 45]; +***** assert (imopen (magic (10), [1 0 0 0; 1 1 1 0; 0 1 0 1]), out); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/ycbcr2rgb.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/ycbcr2rgb.m +***** assert (ycbcr2rgb (rgb2ycbcr (jet (10))), jet (10), 0.00001); +***** assert (class (ycbcr2rgb (single (rand (5, 5, 3)))), "single") +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/imadd.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/imadd.m +***** assert (imadd (uint8 ([23 250]), uint8 ([23 250])), uint8 ([46 255])); # default to first class and truncate +***** assert (imadd (uint8 ([23 250]), 10), uint8 ([33 255])); # works adding a scalar +***** assert (imadd (uint8 ([23 250]), uint8 ([23 250]), "uint16"), uint16 ([46 500])); # defining output class works +***** assert (imadd (logical ([ 1 0]), logical ([ 1 1])), double ([ 2 1])); # return double for two logical images +***** assert (imadd (logical ([ 1 0]), logical ([ 1 1]), "logical"), logical ([ 1 1])); # this is matlab incompatible on purpose +***** fail ("imadd (uint8 ([23 250]), uint16 ([23 250]))"); # input need to have same class +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/medfilt2.m] +>>>>> /build/reproducible-path/octave-image-2.16.0/inst/medfilt2.m +***** shared b, f + b = [ 0 1 2 3 + 1 8 12 12 + 4 20 24 21 + 7 22 25 18]; + f = [ 0 1 2 0 + 1 4 12 3 + 4 12 20 12 + 0 7 20 0]; +***** assert (medfilt2 (b), f); + + f = [ 0 1 2 3 + 1 8 12 12 + 4 20 24 18 + 4 20 24 18]; +***** assert (medfilt2 (b, true (3, 1)), f); +***** assert (medfilt2 (b, [3 1]), f); + + f = [ 1 8 10 10 + 1 8 12 12 + 4 20 24 18 + 7 20 24 18]; +***** assert (medfilt2 (b, [3 1], 10), f); +***** assert (medfilt2 (b, 10, [3 1]), f); + + f = [ 0.5 4.5 7.0 7.5 + 2.5 14.0 18.0 15.0 + 2.5 14.0 18.0 15.0 + 2.0 10.0 12.0 9.0]; +***** assert (medfilt2 (b, true (4, 1)), f); +***** assert (medfilt2 (b, [4 1]), f); +***** test + A = zeros (3, 3); + B = ones (3, 3); C = [1 1 1; 2 2 2; 3 3 3]; D = C'; - E = ones (3,3); + E = ones (3, 3); E(2,2) = 2; - F = 3 .* ones (3,3); + F = 3 .* ones (3, 3); F(2,2) = 1; G = [-1 2 7; -5 2 8; -7 pi 9]; H = [5 2 8; 1 -3 1; 5 1 0]; A_out = [0 0 0; 0 0 0; 0 0 0]; - B_out = [0 0 0; 0 0 0; 0 0 0]; - C_out = repmat ([std([1 1 1 1 1 1 2 2 2]) - std([1 1 1 2 2 2 3 3 3]) - std([2 2 2 3 3 3 3 3 3])], [1 3]); - D_out = C_out'; - E_out = (1/3) .* ones (3,3); - F_out = (2/3) .* ones (3,3); - G_out = [std([-1 -1 2 -1 -1 2 -5 -5 2]), std([-1 2 7 -1 2 7 -5 2 8]), std([2 7 7 2 7 7 2 8 8]); - std([-1 -1 2 -5 -5 2 -7 -7 pi]), std([-1 2 7 -5 2 8 -7 pi 9]), std([2 7 7 2 8 8 pi 9 9]); - std([-5 -5 2 -7 -7 pi -7 -7 pi]), std([-5 2 8 -7 pi 9 -7 pi 9]), std([2 8 8 pi 9 9 pi 9 9])]; - H_out = [std([5 5 2 5 5 2 1 1 -3]), std([5 2 8 5 2 8 1 -3 1]), std([2 8 8 2 8 8 -3 1 1]); - std([5 5 2 1 1 -3 5 5 1]), std([5 2 8 1 -3 1 5 1 0]), std([2 8 8 -3 1 1 1 0 0]); - std([1 1 -3 5 5 1 5 5 1]), std([1 -3 1 5 1 0 5 1 0]), std([-3 1 1 1 0 0 1 0 0])]; - assert (stdfilt (A), A_out) - assert (stdfilt (B), B_out) - assert (stdfilt (C), C_out, 4*eps) - assert (stdfilt (D), D_out, 4*eps) - assert (stdfilt (E), E_out, 4*eps) - assert (stdfilt (F), F_out, 4*eps) - assert (stdfilt (G), G_out, 4*eps) - assert (stdfilt (H), H_out, 4*eps) - im = stdfilt (ones (5, 'logical')); - assert (im, zeros (5)) - im = stdfilt (ones (5, 'uint8')); - assert (im, zeros (5)) - assert (stdfilt (int8(H), H_out, 4*eps)) - assert (stdfilt (uint8(H), H_out, 4*eps)) - assert (stdfilt (int16(H), H_out, 4*eps)) - assert (stdfilt (uint16(H), H_out, 4*eps)) - assert (stdfilt (int32(H), H_out, 4*eps)) - assert (stdfilt (uint32(H), H_out, 4*eps)) - assert (stdfilt (int64(H), H_out, 4*eps)) - assert (stdfilt (uint64(H), H_out, 4*eps)) - assert (stdfilt (single(H), H_out, 4*eps)) -2 tests, 2 passed, 0 known failure, 0 skipped + B_out = [0 1 0; 1 1 1; 0 1 0]; + C_out = [0 1 0; 1 2 1; 0 2 0]; + D_out = [0 1 0; 1 2 2; 0 1 0]; + E_out = [0 1 0; 1 1 1; 0 1 0]; + F_out = [0 3 0; 3 3 3; 0 3 0]; + G_out = [0 0 0; 0 2 2; 0 0 0]; + H_out = [0 1 0; 1 1 0; 0 0 0]; + assert (medfilt2 (A), A_out); + assert (medfilt2 (B), B_out); + assert (medfilt2 (C), C_out); + assert (medfilt2 (D), D_out); + assert (medfilt2 (E), E_out); + assert (medfilt2 (F), F_out); + assert (medfilt2 (G), G_out); + assert (medfilt2 (H), H_out); +8 tests, 8 passed, 0 known failure, 0 skipped Checking C++ files ... -[src/bwdist.cc] ->>>>> /build/reproducible-path/octave-image-2.16.0/src/bwdist.cc -***** shared bw - - bw = [0 1 0 1 0 1 1 0 - 0 0 0 1 1 0 0 0 - 0 0 0 1 1 0 0 0 - 0 0 0 1 1 0 0 0 - 0 0 1 1 1 1 1 1 - 1 1 1 1 0 0 0 1 - 1 1 1 0 0 0 1 0 - 0 0 1 0 0 0 1 1]; +[src/bwfill.cc] +>>>>> /build/reproducible-path/octave-image-2.16.0/src/bwfill.cc ***** test - out = [ 1.00000 0.00000 1.00000 0.00000 1.00000 0.00000 0.00000 1.00000 - 1.41421 1.00000 1.00000 0.00000 0.00000 1.00000 1.00000 1.41421 - 2.23607 2.00000 1.00000 0.00000 0.00000 1.00000 2.00000 2.00000 - 2.00000 1.41421 1.00000 0.00000 0.00000 1.00000 1.00000 1.00000 - 1.00000 1.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 - 0.00000 0.00000 0.00000 0.00000 1.00000 1.00000 1.00000 0.00000 - 0.00000 0.00000 0.00000 1.00000 1.41421 1.00000 0.00000 1.00000 - 1.00000 1.00000 0.00000 1.00000 2.00000 1.00000 0.00000 0.00000]; - out = single (out); - - assert (bwdist (bw), out, 0.0001); # default is euclidean - assert (bwdist (bw, "euclidean"), out, 0.0001); - assert (bwdist (logical (bw), "euclidean"), out, 0.0001); + A = [0 1 0 0 1; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]; + R4 = logical(ones(5)); + R8 = logical([1 1 0 0 1; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); + assert (bwfill (A,1,1,4), R4) + assert (bwfill (A,1,1,8), R8) + assert (bwfill (A,1,1), R8) + B = logical([0 1 0 0 1; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); + assert (bwfill (A,3,3,4), B) + assert (bwfill (A,3,3,8), B) + assert (bwfill (A,3,3), B) + C = logical ([0 1 1 1 1; 1 0 1 1 1; 1 0 1 1 1; 1 1 1 1 1; 1 0 0 1 1]); + assert (bwfill (A,3,1,8), C) + assert (bwfill (A,3,1,4), R4) + assert (bwfill (A, [3 1], [1 3], 4), R4); + D = logical([0 1 1 1 1; 1 0 1 1 1; 1 0 1 1 1; 1 1 1 1 1; 1 0 0 1 1]); + assert (bwfill (A, [3 1], [1 3], 8), D); + assert (bwfill (A, [3 1], [1 3]), D); + E = logical ([0 1 0 0 1; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); + assert (bwfill (A, "holes", 4), E); + F = logical ([1 1 0 0 1; 1 1 1 0 0; 1 1 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); + assert (bwfill (A, "holes", 8), F); + assert (bwfill (A, "holes"), F); +***** error id=Octave:invalid-fun-call bwfill () +***** error id=Octave:invalid-fun-call bwfill ("aaa") +***** error id=Octave:invalid-fun-call bwfill (rand (5) > 0.5) +***** error id=Octave:invalid-fun-call bwfill (rand (5) > 0.5, 2) +***** error bwfill (rand (5) > 0.5, "holes", 1) +***** error bwfill (rand (5) > 0.5, 2, 2, 5) +***** error id=Octave:invalid-fun-call bwfill (rand (5) > 0.5, "xxx") +***** error id=Octave:invalid-fun-call bwfill (rand (5) > 0.5, 2, 2, 4, 5) +***** error id=Octave:invalid-fun-call bwfill (rand (5) > 0.5, "holes", 4, 2) +10 tests, 10 passed, 0 known failure, 0 skipped +[src/bwconncomp.cc] +>>>>> /build/reproducible-path/octave-image-2.16.0/src/bwconncomp.cc ***** test - out = [ 1 0 1 0 1 0 0 1 - 1 1 1 0 0 1 1 1 - 2 2 1 0 0 1 2 2 - 2 1 1 0 0 1 1 1 - 1 1 0 0 0 0 0 0 - 0 0 0 0 1 1 1 0 - 0 0 0 1 1 1 0 1 - 1 1 0 1 2 1 0 0]; - out = single (out); + a = rand (10) > 0.5; + cc = bwconncomp (a, 4); + assert (cc.Connectivity, 4) + assert (cc.ImageSize, [10 10]) - assert (bwdist (bw, "chessboard"), out); + b = false (10); + for i = 1:numel (cc.PixelIdxList) + b(cc.PixelIdxList{i}) = true; + endfor + assert (a, b) ***** test - out = [ 1 0 1 0 1 0 0 1 - 2 1 1 0 0 1 1 2 - 3 2 1 0 0 1 2 2 - 2 2 1 0 0 1 1 1 - 1 1 0 0 0 0 0 0 - 0 0 0 0 1 1 1 0 - 0 0 0 1 2 1 0 1 - 1 1 0 1 2 1 0 0]; - out = single (out); + a = rand (10, 13) > 0.5; + cc = bwconncomp (a, 4); + assert (cc.ImageSize, [10 13]) - assert (bwdist (bw, "cityblock"), out); + b = false (10, 13); + for i = 1:numel (cc.PixelIdxList) + b(cc.PixelIdxList{i}) = true; + endfor + assert (a, b) ***** test - out = [ 1.00000 0.00000 1.00000 0.00000 1.00000 0.00000 0.00000 1.00000 - 1.41421 1.00000 1.00000 0.00000 0.00000 1.00000 1.00000 1.41421 - 2.41421 2.00000 1.00000 0.00000 0.00000 1.00000 2.00000 2.00000 - 2.00000 1.41421 1.00000 0.00000 0.00000 1.00000 1.00000 1.00000 - 1.00000 1.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 - 0.00000 0.00000 0.00000 0.00000 1.00000 1.00000 1.00000 0.00000 - 0.00000 0.00000 0.00000 1.00000 1.41421 1.00000 0.00000 1.00000 - 1.00000 1.00000 0.00000 1.00000 2.00000 1.00000 0.00000 0.00000]; - out = single (out); + a = rand (15) > 0.5; + conn_8 = bwconncomp (a, 8); + assert (conn_8, bwconncomp (a)) + assert (conn_8, bwconncomp (a, ones (3))) + assert (conn_8.Connectivity, 8) + assert (bwconncomp (a, ones (3)).Connectivity, 8) + assert (bwconncomp (a, [0 1 0; 1 1 1; 0 1 0]).Connectivity, 4) +***** test + bw = logical ([ + 1 0 0 1 0 1 0 + 1 0 0 1 0 1 0 + 0 0 0 0 0 1 0 + 0 0 0 0 1 0 0 + 1 1 0 1 1 0 0 + 0 1 0 0 0 0 0 + 1 1 0 0 0 0 0 + ]); + cc = bwconncomp (bw); + cc = struct (); + cc.Connectivity = 8; + cc.ImageSize = [7 7]; + cc.NumObjects = 4; + ## The commented line has the results from Matlab. We return the + ## same result but in a slightly different order. Since the order + ## is not defined, it is not required for compatibility. + #cc.PixelIdxList = {[1;2], [5;7;12;13;14], [22;23], [26;32;33;36;37;38]}; + cc.PixelIdxList = {[1;2], [5;12;13;7;14], [22;23], [26;32;33;38;37;36]}; + assert (bwconncomp (bw), cc) +***** test + ## test that PixelIdxList is a row vector + a = rand (40, 40) > 0.2; + cc = bwconncomp (a, 4); + assert (rows (cc.PixelIdxList), 1) + assert (columns (cc.PixelIdxList), cc.NumObjects) +***** assert (bwconncomp (false (5)), struct ("ImageSize", [5 5], "NumObjects", 0, + "PixelIdxList", {cell(1, 0)}, + "Connectivity", 8)) +***** test + in = [ 0 0 1 0 0 1 0 1 0 0 + 0 0 1 0 0 0 0 0 1 1 + 1 0 0 0 0 1 1 0 0 0 + 1 0 0 0 1 0 0 0 0 0 + 1 1 1 1 0 0 0 0 0 1 + 0 1 0 1 1 0 0 1 0 0 + 1 0 0 0 1 0 0 0 0 0 + 0 0 0 1 1 0 0 1 0 0 + 0 1 0 1 1 0 0 1 1 0 + 0 1 0 1 1 1 0 0 1 0]; + assert (bwareaopen (in, 1, 4), logical (in)) - assert (bwdist (bw, "quasi-euclidean"), out, 0.0001); + out = [0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 1 1 1 1 0 0 0 0 0 0 + 0 1 0 1 1 0 0 0 0 0 + 0 0 0 0 1 0 0 0 0 0 + 0 0 0 1 1 0 0 0 0 0 + 0 0 0 1 1 0 0 0 0 0 + 0 0 0 1 1 1 0 0 0 0]; + assert (bwareaopen (logical (in), 10, 4), logical (out)) + assert (bwareaopen (in, 10, 4), logical (out)) + assert (bwareaopen (in, 10, [0 1 0; 1 1 1; 0 1 0]), logical (out)) - bw(logical (bw)) = 3; # there is no actual check if matrix is binary or 0 and 1 - assert (bwdist (bw, "quasi-euclidean"), out, 0.0001); + out = [0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 1 0 0 0 0 1 1 0 0 0 + 1 0 0 0 1 0 0 0 0 0 + 1 1 1 1 0 0 0 0 0 0 + 0 1 0 1 1 0 0 0 0 0 + 1 0 0 0 1 0 0 0 0 0 + 0 0 0 1 1 0 0 0 0 0 + 0 0 0 1 1 0 0 0 0 0 + 0 0 0 1 1 1 0 0 0 0]; + assert (bwareaopen (in, 10, 8), logical (out)) + assert (bwareaopen (in, 10, ones (3)), logical (out)) + assert (bwareaopen (in, 10), logical (out)) - bw(logical (bw)) = -2; # anything non-zero is considered object - assert (bwdist (bw, "quasi-euclidean"), out, 0.0001); + out = [0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 + 1 1 1 1 0 0 0 0 0 0 + 0 1 0 1 1 0 0 0 0 0 + 0 0 0 0 1 0 0 0 0 0 + 0 0 0 1 1 0 0 1 0 0 + 0 0 0 1 1 0 0 1 1 0 + 0 0 0 1 1 1 0 0 1 0]; + assert (bwareaopen (in, 4, [1 1 0; 1 1 1; 0 1 1]), logical (out)) +***** error bwareaopen ("not an image", 78, 8) +***** error bwareaopen (rand (10) > 0.5, 10, 100) +***** error bwareaopen (rand (10) > 0.5, 10, "maximal") +***** error bwareaopen (rand (10) > 0.5, 10, [1 1 1; 0 1 1; 0 1 0]) +11 tests, 11 passed, 0 known failure, 0 skipped +[src/conndef.cc] +>>>>> /build/reproducible-path/octave-image-2.16.0/src/conndef.cc +***** assert (conndef (1, "minimal"), [1; 1; 1]); +***** assert (conndef (2, "minimal"), [0 1 0; 1 1 1; 0 1 0]); ***** test - bw = [ 1 1 1 1 0 1 1 1 1 - 1 1 1 1 0 1 1 1 1 - 1 1 0 1 1 1 1 1 1 - 0 1 1 1 1 1 1 1 1]; + C = zeros (3, 3, 3); + C(:,2,2) = 1; + C(2,:,2) = 1; + C(2,2,:) = 1; + assert (conndef (3, "minimal"), C); +***** test + C = zeros (3, 3, 3, 3); + C(:,:,2,1) = [0 0 0 + 0 1 0 + 0 0 0]; + C(:,:,1,2) = [0 0 0 + 0 1 0 + 0 0 0]; + C(:,:,2,2) = [0 1 0 + 1 1 1 + 0 1 0]; + C(:,:,3,2) = [0 0 0 + 0 1 0 + 0 0 0]; + C(:,:,2,3) = [0 0 0 + 0 1 0 + 0 0 0]; + assert (conndef (4, "minimal"), C); +***** assert (conndef (1, "maximal"), ones (3, 1)); +***** assert (conndef (2, "maximal"), ones (3, 3)); +***** assert (conndef (3, "maximal"), ones (3, 3, 3)); +***** assert (conndef (4, "maximal"), ones (3, 3, 3, 3)); +***** assert (nnz (conndef (3, "minimal")), 7) +***** assert (nnz (conndef (4, "minimal")), 9) +***** assert (nnz (conndef (5, "minimal")), 11) +***** assert (nnz (conndef (6, "minimal")), 13) +***** assert (find (conndef (3, "minimal")), [5 11 13 14 15 17 23](:)) +***** assert (find (conndef (4, "minimal")), [14 32 38 40 41 42 44 50 68](:)) +***** assert (find (conndef (5, "minimal")), + [ 41 95 113 119 121 122 123 125 131 149 203](:)) +***** assert (find (conndef (6, "minimal")), + [ 122 284 338 356 362 364 365 366 368 374 392 446 608](:)) +***** error conndef () +***** error conndef (-2, "minimal") +***** error conndef (char (2), "minimal") +***** error conndef ("minimal", 3) +***** error conndef (3, "invalid") +***** error conndef (10) +***** assert (conndef (2, "minimal"), conndef (4)) +***** assert (conndef (2, "maximal"), conndef (8)) +***** assert (conndef (3, "minimal"), conndef (6)) +***** assert (conndef (3, "maximal"), conndef (26)) +***** assert (conndef (18), reshape ([0 1 0 1 1 1 0 1 0 + 1 1 1 1 1 1 1 1 1 + 0 1 0 1 1 1 0 1 0], [3 3 3])) +***** test iptcheckconn ( 4, "func", "var") +***** test iptcheckconn ( 6, "func", "var") +***** test iptcheckconn ( 8, "func", "var") +***** test iptcheckconn (18, "func", "var") +***** test iptcheckconn (26, "func", "var") +***** test iptcheckconn (1, "func", "var") +***** test iptcheckconn (ones (3, 1), "func", "var") +***** test iptcheckconn (ones (3, 3), "func", "var") +***** test iptcheckconn (ones (3, 3, 3), "func", "var") +***** test iptcheckconn (ones (3, 3, 3, 3), "func", "var") +***** error + iptcheckconn (3, "func", "VAR"); +***** error + iptcheckconn ([1 1 1; 1 0 1; 1 1 1], "func", "VAR"); +***** error + iptcheckconn ([1 2 1; 1 1 1; 1 1 1], "func", "VAR"); +***** error + iptcheckconn ([0 1 1; 1 1 1; 1 1 1], "func", "VAR"); +***** error + iptcheckconn (ones (3, 3, 3, 4), "func", "VAR"); +42 tests, 42 passed, 0 known failure, 0 skipped +[src/__spatial_filtering__.cc] +>>>>> /build/reproducible-path/octave-image-2.16.0/src/__spatial_filtering__.cc +***** error + __spatial_filtering__ (ones (10), ones (3), "std", ones (10), 0) +***** error + __spatial_filtering__ (ones (10), ones (3), "std", ones (3, 3, 3), 0) +***** error + __spatial_filtering__ (ones (10), ones (3), "std", ones (1, 9), 0) +***** shared a, domain, s, out + a = [ 82 2 97 43 79 43 41 65 51 11 + 60 65 21 56 94 77 36 38 75 39 + 32 68 78 1 16 75 76 90 81 56 + 43 90 82 41 36 1 87 19 18 63 + 63 64 2 48 18 43 38 25 22 99 + 12 46 90 79 3 92 39 79 10 22 + 38 98 11 10 40 90 88 38 4 76 + 54 37 9 4 33 98 36 47 53 57 + 38 76 82 50 14 74 64 99 7 33 + 88 96 41 62 84 89 97 23 41 3]; - dist = [ 0 0 0 0 1 0 0 0 0 - 0 0 0 0 1 0 0 0 0 - 0 0 1 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0]; - dist = single (dist); + domain = ones (3); + s = zeros (3); - c = [ 1 5 9 13 13 21 25 29 33 - 2 6 10 14 14 22 26 30 34 - 3 7 10 15 19 23 27 31 35 - 8 8 12 16 20 24 28 32 36]; - c = uint32 (c); + out = [ 2 1 1 1 16 36 36 11 + 21 1 1 1 1 1 18 18 + 2 1 1 1 1 1 18 18 + 2 2 2 1 1 1 10 10 + 2 2 2 3 3 25 4 4 + 9 4 3 3 3 36 4 4 + 9 4 4 4 14 36 4 4 + 9 4 4 4 14 23 7 3]; +***** assert (__spatial_filtering__ (a, domain, "ordered", s, 1), out); - [dout, cout] = bwdist (bw, "euclidean"); - assert (dout, dist) - assert (cout, c) -***** test - bw = [ 0 1 1 0 0 0 1 0 - 0 0 0 0 0 0 0 0 - 1 1 0 0 0 0 0 0 - 0 0 0 0 0 0 1 0 - 0 0 0 0 1 0 0 1 - 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 - 0 0 1 0 0 1 1 0]; - out = single ([ - 1.00000 0.00000 0.00000 1.00000 2.00000 1.00000 0.00000 1.00000 - 1.00000 1.00000 1.00000 sqrt(2) sqrt(2)+1 sqrt(2) 1.00000 sqrt(2) - 0.00000 0.00000 1.00000 2.00000 2.00000 sqrt(2) 1.00000 sqrt(2) - 1.00000 1.00000 sqrt(2) sqrt(2) 1.00000 1.00000 0.00000 1.00000 - 2.00000 2.00000 2.00000 1.00000 0.00000 1.00000 1.00000 0.00000 - 1.00000 sqrt(2) 2.00000 sqrt(2) 1.00000 sqrt(2) sqrt(2) 1.00000 - 0.00000 1.00000 1.00000 sqrt(2) sqrt(2) 1.00000 1.00000 sqrt(2) - 1.00000 1.00000 0.00000 1.00000 1.00000 0.00000 0.00000 1.00000 - ]); - assert (bwdist (bw, "quasi-euclidean"), out); -***** error bwdist (bw, "not a valid method"); -***** test - ## Special case of there being no foreground element (bug #50874) - expected_dist = single (Inf (2, 2)); - expected_idx = uint32 ([0 0; 0 0]); + out = [ 97 97 97 94 94 90 90 90 + 90 90 94 94 94 90 90 90 + 90 90 82 75 87 90 90 99 + 90 90 90 92 92 92 87 99 + 98 98 90 92 92 92 88 99 + 98 98 90 98 98 98 88 79 + 98 98 82 98 98 99 99 99 + 96 96 84 98 98 99 99 99]; +***** assert (__spatial_filtering__ (a, domain, "ordered", s, nnz (domain)), out); - [dist, idx] = bwdist (false (2, 2)); - assert (dist, expected_dist) - assert (idx, expected_idx) + out = [ 60 43 43 43 43 43 51 51 + 60 56 36 36 36 38 38 39 + 63 48 18 18 36 38 25 25 + 46 48 36 36 36 38 22 22 + 38 46 11 40 39 39 25 22 + 37 11 10 33 39 47 38 38 + 38 11 11 33 40 64 38 38 + 41 41 33 50 64 64 41 33]; +***** assert (__spatial_filtering__ (a, domain, "ordered", s, 4), out); - [dist, idx] = bwdist (zeros (2, 2)); - assert (dist, expected_dist) - assert (idx, expected_idx) -***** test - ## Special case of 1D input (bug #50874) - assert (bwdist ([1 0]), single ([0 1])) - assert (bwdist ([1 0]'), single ([0 1]')) - assert (bwdist ([0 1 0 0 0 0 1 1]), single ([1 0 1 2 2 1 0 0])) - assert (bwdist ([1 1 0 0 0 0 1 1]'), single ([0 0 1 2 2 1 0 0])') - assert (bwdist ([1 0], "euclidean"), single ([0 1])) - assert (bwdist ([1 0], "chessboard"), single ([0 1])) - assert (bwdist ([1 0], "cityblock"), single ([0 1])) - assert (bwdist ([1 0], "quasi-euclidean"), single ([0 1])) -***** test - ## test 1D input with 2nd output argument (indices) (bug #50874) - expected_dist = single ([1 0 1]); - expected_idx = uint32 ([2 2 2]); + out = [ 31.223 33.788 35.561 31.011 26.096 20.630 20.403 24.712 + 23.428 29.613 32.376 34.002 33.593 32.470 29.605 26.333 + 27.834 32.890 29.903 24.207 30.083 32.497 31.898 32.600 + 32.027 28.995 33.530 31.002 32.241 32.004 27.501 32.070 + 34.682 36.030 33.046 33.745 32.509 27.352 28.607 34.180 + 32.709 37.690 32.992 40.036 34.456 26.656 27.685 26.863 + 30.971 36.227 25.775 34.873 29.917 25.269 32.292 30.410 + 29.135 31.626 30.056 33.594 30.814 28.853 30.917 29.120]; +***** assert (__spatial_filtering__ (a, domain, "std", s), out, 0.001); - [dist, idx] = bwdist ([0 1 0]); - assert (dist, expected_dist) - assert (idx, expected_idx) + out = [ 95 96 96 93 78 54 54 79 + 69 89 93 93 93 89 72 72 + 88 89 81 74 86 89 72 81 + 88 88 88 91 91 91 77 89 + 96 96 88 89 89 67 84 95 + 89 94 87 95 95 62 84 75 + 89 94 78 94 84 63 95 95 + 87 92 80 94 84 76 92 96]; +***** assert (__spatial_filtering__ (a, domain, "range", s), out); - [dist, idx] = bwdist ([0 1 0]'); - assert (dist, expected_dist') - assert (idx, expected_idx') + domain = [ 1 1 0 + 0 1 1 + 0 1 0]; - expected_dist = single ([0 0 1 0 0]); - expected_idx = uint32 ([1 2 2 4 5]); - [dist, idx] = bwdist ([1 1 0 1 1]); - assert (dist, expected_dist) - assert (idx, expected_idx) + out = [ 2 2 1 16 36 36 38 39 + 60 1 1 16 1 36 19 18 + 32 2 1 1 1 19 18 18 + 2 2 18 3 1 1 19 10 + 46 2 2 3 18 38 10 4 + 11 9 4 3 3 36 4 4 + 9 4 4 10 36 36 38 4 + 37 9 4 4 33 36 7 7]; +***** assert (__spatial_filtering__ (a, domain, "ordered", s, 1), out); - expected_dist = single ([1 0 1 2 1 0 0 0 1 1 0 0 0 0 1 2 3 4]); - expected_idx = uint32 ([2 2 2 2 6 6 7 8 8 11 11 12 13 14 14 14 14 14]); - [dist, idx] = bwdist ([0 1 0 0 0 1 1 1 0 0 1 1 1 1 0 0 0 0]); - assert (dist, expected_dist) - assert (idx, expected_idx) + out = [ 82 97 97 94 79 76 90 81 + 90 82 56 94 94 90 90 81 + 90 82 78 36 87 87 90 90 + 90 90 82 43 92 87 87 99 + 98 90 79 92 92 88 79 25 + 98 90 90 90 98 92 79 79 + 98 98 50 98 98 90 99 57 + 96 82 62 84 98 99 99 53]; +***** assert (__spatial_filtering__ (a, domain, "ordered", s, nnz (domain)), out); - expected_dist = single ([0 0 1 2 1 0 0 0 1 1 0 0 0 0 1 2 1 0]); - expected_idx = uint32 ([1 2 2 2 6 6 7 8 8 11 11 12 13 14 14 14 18 18]); - [dist, idx] = bwdist ([1 1 0 0 0 1 1 1 0 0 1 1 1 1 0 0 0 1]); - assert (dist, expected_dist) - assert (idx, expected_idx) + out = [ 68 78 94 79 77 43 75 75 + 78 78 41 75 77 87 81 75 + 82 78 48 18 75 76 76 81 + 64 90 79 41 43 39 79 22 + 90 79 48 48 90 79 38 22 + 46 46 79 79 92 88 47 76 + 76 82 33 40 90 88 88 53 + 82 50 50 74 89 98 47 47]; +***** assert (__spatial_filtering__ (a, domain, "ordered", s, 4), out); + + out = [ 34.2389 39.2772 39.6699 31.6812 20.7364 16.5439 22.2419 17.2395 + 11.9248 36.3084 21.6217 30.8350 36.4047 21.6726 30.9144 26.1017 + 22.2980 33.2746 27.5808 14.5017 36.8890 29.0259 34.6020 33.2521 + 32.2490 37.9579 26.9685 17.1959 32.5346 31.3847 33.5976 36.8280 + 21.3354 40.1833 34.0044 33.9882 32.9894 24.1102 25.6613 9.0995 + 35.4641 35.3794 39.0871 35.4753 39.9775 28.7193 26.7451 35.6553 + 35.2179 45.3398 19.3210 35.2987 28.4042 24.0832 26.8421 25.0539 + 23.4307 26.2812 26.3287 35.6959 25.2646 28.1016 34.9829 17.9221]; +***** assert (__spatial_filtering__ (a, domain, "std", s), out, 0.001); + + out = [ 80 95 96 78 43 40 52 42 + 30 81 55 78 93 54 71 63 + 58 80 77 35 86 68 72 72 + 88 88 64 40 91 86 68 89 + 52 88 77 89 74 50 69 21 + 87 81 86 87 95 56 75 75 + 89 94 46 88 62 54 61 53 + 59 73 58 80 65 63 92 46]; +***** assert (__spatial_filtering__ (a, domain, "range", s), out); + + s = [ 1 -3 4 + 6 -7 2 + -1 3 -5]; + + out = [ -1 3 4 19 38 29 31 41 + 61 3 -6 9 4 33 22 21 + 33 5 -2 2 -6 21 12 11 + 4 -5 20 6 -2 2 16 13 + 39 -1 3 -4 19 32 12 3 + 13 4 3 0 4 36 6 -3 + 11 2 -3 11 38 29 35 1 + 34 6 1 5 34 33 9 0]; +***** assert (__spatial_filtering__ (a, domain, "ordered", s, 1), out); + + out = [ 83 94 98 87 80 79 93 84 + 93 85 53 91 95 92 83 74 + 84 75 79 29 89 80 87 91 + 87 93 83 45 95 84 88 101 + 101 83 72 94 93 91 72 26 + 91 87 91 92 101 93 76 80 + 95 99 53 100 91 91 102 59 + 99 75 65 87 95 101 92 50]; +***** assert (__spatial_filtering__ (a, domain, "ordered", s, nnz (domain)), out); + + out = [ 71 81 96 79 78 44 77 68 + 80 71 44 77 78 90 83 72 + 83 75 51 21 72 76 77 78 + 57 91 82 42 40 42 82 20 + 92 81 45 49 85 81 41 24 + 43 47 76 80 90 81 50 78 + 79 85 35 37 87 85 89 46 + 84 52 43 76 92 100 44 48]; +***** assert (__spatial_filtering__ (a, domain, "ordered", s, 4), out); + + out = [ 34.903 40.206 39.885 28.627 20.620 19.248 25.209 17.111 + 14.536 35.865 23.221 32.230 34.903 23.923 28.879 22.621 + 20.635 30.113 29.351 11.610 38.863 25.936 34.608 34.482 + 29.811 40.998 28.279 17.897 34.666 29.978 36.150 38.213 + 25.066 39.240 30.013 37.300 31.856 27.428 22.884 10.281 + 31.890 34.761 39.645 37.526 39.336 27.031 25.648 39.285 + 35.017 47.776 22.764 35.912 25.460 25.636 29.861 24.566 + 25.213 25.000 26.391 38.451 24.631 31.305 31.118 20.611]; +***** assert (__spatial_filtering__ (a, domain, "std", s), out, 0.001); + + out = [ 84 91 94 68 42 50 62 43 + 32 82 59 82 91 59 61 53 + 51 70 81 27 95 59 75 80 + 83 98 63 39 97 82 72 88 + 62 84 69 98 74 59 60 23 + 78 83 88 92 97 57 70 83 + 84 97 56 89 53 62 67 58 + 65 69 64 82 61 68 83 50]; +***** assert (__spatial_filtering__ (a, domain, "range", s), out); +18 tests, 18 passed, 0 known failure, 0 skipped +[src/graycomatrix.cc] +>>>>> /build/reproducible-path/octave-image-2.16.0/src/graycomatrix.cc +***** shared a ***** test - assert (bwdist ([0 0]), single ([Inf, Inf])) - assert (bwdist ([0 0]'), single ([Inf, Inf]')) -***** xtest - ## This is Matlab incompatible because the bottom right corners is - ## equally distant to the top right and bottom left corners. However, - ## both are correct answers, and the returned value is just - ## implementation dependent. - bw = logical ([ - 0 0 1 - 0 0 0 - 1 0 0 - ]); - expected_dist = single ([ - 2.0 1.0 0.0 - 1.0 sqrt(2) 1.0 - 0.0 1.0 2.0 - ]); - expected_idx = uint32 ([ - 3 7 7 - 3 3 7 - 3 3 3 - ]); - [dist, idx] = bwdist (bw); - assert (dist, expected_dist) - assert (idx, expected_idx) -!!!!! known failure -ASSERT errors for: assert (idx,expected_idx) + a = [0 0 0 1 2; + 1 1 0 1 1; + 2 2 1 0 0; + 1 1 0 2 0; + 0 0 1 0 1]; + squeeze(graycomatrix(a, 3, 1, -pi/4)) == [4 2 0; + 2 3 2; + 1 2 0]; - Location | Observed | Expected | Reason - (3,3) 7 3 Abs err 4 exceeds tol 0 by 4 -***** xtest - # bug #62192 - a = zeros (200, 200); - a (158, 100) = 1; - a (141, 141) = 1; - a (156, 115) = 1; - d = bwdist (a); - expected_result = single (57.9741); - assert (d (100, 100), expected_result, 1e-4) -!!!!! known failure -ASSERT errors for: assert (d (100, 100),expected_result,1e-4) +***** assert(size(graycomatrix(a, 3, 1:5, [0:3]*-pi/4)), [3, 3, 5, 4]) +***** demo - Location | Observed | Expected | Reason - () 57.9828 57.9741 Abs err 0.0086594 exceeds tol 0.0001 by 0.009 -13 tests, 11 passed, 2 known failures, 0 skipped + # Pattern Recognition Engineering (Nadler & Smith) + # Digital Image Processing (Gonzales & Woods), p. 668 + + a = [0 0 0 1 2; + 1 1 0 1 1; + 2 2 1 0 0; + 1 1 0 2 0; + 0 0 1 0 1]; + + graycomatrix(a, 3, 1, [0 1]*-pi/4) + +2 tests, 2 passed, 0 known failure, 0 skipped [src/imreconstruct.cc] >>>>> /build/reproducible-path/octave-image-2.16.0/src/imreconstruct.cc ***** function recon = parallel_reconstruction (marker, mask, @@ -15163,200 +15401,6 @@ (3,4) 2 0 Abs err 2 exceeds tol 0 by 2 (3,5) 0 4 Abs err 4 exceeds tol 0 by 4 9 tests, 7 passed, 2 known failures, 0 skipped -[src/bwconncomp.cc] ->>>>> /build/reproducible-path/octave-image-2.16.0/src/bwconncomp.cc -***** test - a = rand (10) > 0.5; - cc = bwconncomp (a, 4); - assert (cc.Connectivity, 4) - assert (cc.ImageSize, [10 10]) - - b = false (10); - for i = 1:numel (cc.PixelIdxList) - b(cc.PixelIdxList{i}) = true; - endfor - assert (a, b) -***** test - a = rand (10, 13) > 0.5; - cc = bwconncomp (a, 4); - assert (cc.ImageSize, [10 13]) - - b = false (10, 13); - for i = 1:numel (cc.PixelIdxList) - b(cc.PixelIdxList{i}) = true; - endfor - assert (a, b) -***** test - a = rand (15) > 0.5; - conn_8 = bwconncomp (a, 8); - assert (conn_8, bwconncomp (a)) - assert (conn_8, bwconncomp (a, ones (3))) - assert (conn_8.Connectivity, 8) - assert (bwconncomp (a, ones (3)).Connectivity, 8) - assert (bwconncomp (a, [0 1 0; 1 1 1; 0 1 0]).Connectivity, 4) -***** test - bw = logical ([ - 1 0 0 1 0 1 0 - 1 0 0 1 0 1 0 - 0 0 0 0 0 1 0 - 0 0 0 0 1 0 0 - 1 1 0 1 1 0 0 - 0 1 0 0 0 0 0 - 1 1 0 0 0 0 0 - ]); - cc = bwconncomp (bw); - cc = struct (); - cc.Connectivity = 8; - cc.ImageSize = [7 7]; - cc.NumObjects = 4; - ## The commented line has the results from Matlab. We return the - ## same result but in a slightly different order. Since the order - ## is not defined, it is not required for compatibility. - #cc.PixelIdxList = {[1;2], [5;7;12;13;14], [22;23], [26;32;33;36;37;38]}; - cc.PixelIdxList = {[1;2], [5;12;13;7;14], [22;23], [26;32;33;38;37;36]}; - assert (bwconncomp (bw), cc) -***** test - ## test that PixelIdxList is a row vector - a = rand (40, 40) > 0.2; - cc = bwconncomp (a, 4); - assert (rows (cc.PixelIdxList), 1) - assert (columns (cc.PixelIdxList), cc.NumObjects) -***** assert (bwconncomp (false (5)), struct ("ImageSize", [5 5], "NumObjects", 0, - "PixelIdxList", {cell(1, 0)}, - "Connectivity", 8)) -***** test - in = [ 0 0 1 0 0 1 0 1 0 0 - 0 0 1 0 0 0 0 0 1 1 - 1 0 0 0 0 1 1 0 0 0 - 1 0 0 0 1 0 0 0 0 0 - 1 1 1 1 0 0 0 0 0 1 - 0 1 0 1 1 0 0 1 0 0 - 1 0 0 0 1 0 0 0 0 0 - 0 0 0 1 1 0 0 1 0 0 - 0 1 0 1 1 0 0 1 1 0 - 0 1 0 1 1 1 0 0 1 0]; - assert (bwareaopen (in, 1, 4), logical (in)) - - out = [0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 1 1 1 1 0 0 0 0 0 0 - 0 1 0 1 1 0 0 0 0 0 - 0 0 0 0 1 0 0 0 0 0 - 0 0 0 1 1 0 0 0 0 0 - 0 0 0 1 1 0 0 0 0 0 - 0 0 0 1 1 1 0 0 0 0]; - assert (bwareaopen (logical (in), 10, 4), logical (out)) - assert (bwareaopen (in, 10, 4), logical (out)) - assert (bwareaopen (in, 10, [0 1 0; 1 1 1; 0 1 0]), logical (out)) - - out = [0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 1 0 0 0 0 1 1 0 0 0 - 1 0 0 0 1 0 0 0 0 0 - 1 1 1 1 0 0 0 0 0 0 - 0 1 0 1 1 0 0 0 0 0 - 1 0 0 0 1 0 0 0 0 0 - 0 0 0 1 1 0 0 0 0 0 - 0 0 0 1 1 0 0 0 0 0 - 0 0 0 1 1 1 0 0 0 0]; - assert (bwareaopen (in, 10, 8), logical (out)) - assert (bwareaopen (in, 10, ones (3)), logical (out)) - assert (bwareaopen (in, 10), logical (out)) - - out = [0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 1 0 0 0 0 0 0 0 0 0 - 1 1 1 1 0 0 0 0 0 0 - 0 1 0 1 1 0 0 0 0 0 - 0 0 0 0 1 0 0 0 0 0 - 0 0 0 1 1 0 0 1 0 0 - 0 0 0 1 1 0 0 1 1 0 - 0 0 0 1 1 1 0 0 1 0]; - assert (bwareaopen (in, 4, [1 1 0; 1 1 1; 0 1 1]), logical (out)) -***** error bwareaopen ("not an image", 78, 8) -***** error bwareaopen (rand (10) > 0.5, 10, 100) -***** error bwareaopen (rand (10) > 0.5, 10, "maximal") -***** error bwareaopen (rand (10) > 0.5, 10, [1 1 1; 0 1 1; 0 1 0]) -11 tests, 11 passed, 0 known failure, 0 skipped -[src/conndef.cc] ->>>>> /build/reproducible-path/octave-image-2.16.0/src/conndef.cc -***** assert (conndef (1, "minimal"), [1; 1; 1]); -***** assert (conndef (2, "minimal"), [0 1 0; 1 1 1; 0 1 0]); -***** test - C = zeros (3, 3, 3); - C(:,2,2) = 1; - C(2,:,2) = 1; - C(2,2,:) = 1; - assert (conndef (3, "minimal"), C); -***** test - C = zeros (3, 3, 3, 3); - C(:,:,2,1) = [0 0 0 - 0 1 0 - 0 0 0]; - C(:,:,1,2) = [0 0 0 - 0 1 0 - 0 0 0]; - C(:,:,2,2) = [0 1 0 - 1 1 1 - 0 1 0]; - C(:,:,3,2) = [0 0 0 - 0 1 0 - 0 0 0]; - C(:,:,2,3) = [0 0 0 - 0 1 0 - 0 0 0]; - assert (conndef (4, "minimal"), C); -***** assert (conndef (1, "maximal"), ones (3, 1)); -***** assert (conndef (2, "maximal"), ones (3, 3)); -***** assert (conndef (3, "maximal"), ones (3, 3, 3)); -***** assert (conndef (4, "maximal"), ones (3, 3, 3, 3)); -***** assert (nnz (conndef (3, "minimal")), 7) -***** assert (nnz (conndef (4, "minimal")), 9) -***** assert (nnz (conndef (5, "minimal")), 11) -***** assert (nnz (conndef (6, "minimal")), 13) -***** assert (find (conndef (3, "minimal")), [5 11 13 14 15 17 23](:)) -***** assert (find (conndef (4, "minimal")), [14 32 38 40 41 42 44 50 68](:)) -***** assert (find (conndef (5, "minimal")), - [ 41 95 113 119 121 122 123 125 131 149 203](:)) -***** assert (find (conndef (6, "minimal")), - [ 122 284 338 356 362 364 365 366 368 374 392 446 608](:)) -***** error conndef () -***** error conndef (-2, "minimal") -***** error conndef (char (2), "minimal") -***** error conndef ("minimal", 3) -***** error conndef (3, "invalid") -***** error conndef (10) -***** assert (conndef (2, "minimal"), conndef (4)) -***** assert (conndef (2, "maximal"), conndef (8)) -***** assert (conndef (3, "minimal"), conndef (6)) -***** assert (conndef (3, "maximal"), conndef (26)) -***** assert (conndef (18), reshape ([0 1 0 1 1 1 0 1 0 - 1 1 1 1 1 1 1 1 1 - 0 1 0 1 1 1 0 1 0], [3 3 3])) -***** test iptcheckconn ( 4, "func", "var") -***** test iptcheckconn ( 6, "func", "var") -***** test iptcheckconn ( 8, "func", "var") -***** test iptcheckconn (18, "func", "var") -***** test iptcheckconn (26, "func", "var") -***** test iptcheckconn (1, "func", "var") -***** test iptcheckconn (ones (3, 1), "func", "var") -***** test iptcheckconn (ones (3, 3), "func", "var") -***** test iptcheckconn (ones (3, 3, 3), "func", "var") -***** test iptcheckconn (ones (3, 3, 3, 3), "func", "var") -***** error - iptcheckconn (3, "func", "VAR"); -***** error - iptcheckconn ([1 1 1; 1 0 1; 1 1 1], "func", "VAR"); -***** error - iptcheckconn ([1 2 1; 1 1 1; 1 1 1], "func", "VAR"); -***** error - iptcheckconn ([0 1 1; 1 1 1; 1 1 1], "func", "VAR"); -***** error - iptcheckconn (ones (3, 3, 3, 4), "func", "VAR"); -42 tests, 42 passed, 0 known failure, 0 skipped [src/hough_line.cc] >>>>> /build/reproducible-path/octave-image-2.16.0/src/hough_line.cc ***** test @@ -15680,50 +15724,6 @@ ***** error bwlabel (rand (10) > 0.8, "text") ***** error bwlabel ("text", 6) 23 tests, 23 passed, 0 known failure, 0 skipped -[src/intlut.cc] ->>>>> /build/reproducible-path/octave-image-2.16.0/src/intlut.cc -***** assert (intlut (uint8 (1:4), uint8 ( 255:-1:0)), uint8 (254:-1:251)); -***** assert (intlut (uint16 (1:4), uint16 (65535:-1:0)), uint16 (65534:-1:65531)); -***** assert (intlut (int16 (1:4), int16 (32767:-1:-32768)), int16 (-2:-1:-5)); -***** assert (intlut (uint8 (255), uint8 (0:255)), uint8 (255)); -***** assert (intlut (uint16 (65535), uint16 (0:65535)), uint16 (65535)); -***** assert (intlut (int16 (32767), int16 (-32768:32767)), int16 (32767)); -***** error intlut () -***** error intlut ("text") -***** error intlut (1:20, uint8 (0:255)); -***** error intlut (uint16 (1:20), uint8 (0:255)); -***** error intlut (uint8 (1:20), uint8 (0:200)); -***** error intlut (uint16 (1:20), uint16 (0:500)); -***** error intlut (uint8 (56), uint8 (magic (16) -1)) -13 tests, 13 passed, 0 known failure, 0 skipped -[src/graycomatrix.cc] ->>>>> /build/reproducible-path/octave-image-2.16.0/src/graycomatrix.cc -***** shared a -***** test - a = [0 0 0 1 2; - 1 1 0 1 1; - 2 2 1 0 0; - 1 1 0 2 0; - 0 0 1 0 1]; - squeeze(graycomatrix(a, 3, 1, -pi/4)) == [4 2 0; - 2 3 2; - 1 2 0]; - -***** assert(size(graycomatrix(a, 3, 1:5, [0:3]*-pi/4)), [3, 3, 5, 4]) -***** demo - - # Pattern Recognition Engineering (Nadler & Smith) - # Digital Image Processing (Gonzales & Woods), p. 668 - - a = [0 0 0 1 2; - 1 1 0 1 1; - 2 2 1 0 0; - 1 1 0 2 0; - 0 0 1 0 1]; - - graycomatrix(a, 3, 1, [0 1]*-pi/4) - -2 tests, 2 passed, 0 known failure, 0 skipped [src/imerode.cc] >>>>> /build/reproducible-path/octave-image-2.16.0/src/imerode.cc ***** assert (imerode (eye (3), [1]), eye (3)); @@ -16140,222 +16140,230 @@ assert (imdilate (false (3, 3), se), false (3, 3)) assert (imdilate (zeros (3, 3), se), [-Inf 0 0; 0 0 0; 0 0 0]) 19 tests, 19 passed, 0 known failure, 0 skipped -[src/bwfill.cc] ->>>>> /build/reproducible-path/octave-image-2.16.0/src/bwfill.cc +[src/bwdist.cc] +>>>>> /build/reproducible-path/octave-image-2.16.0/src/bwdist.cc +***** shared bw + + bw = [0 1 0 1 0 1 1 0 + 0 0 0 1 1 0 0 0 + 0 0 0 1 1 0 0 0 + 0 0 0 1 1 0 0 0 + 0 0 1 1 1 1 1 1 + 1 1 1 1 0 0 0 1 + 1 1 1 0 0 0 1 0 + 0 0 1 0 0 0 1 1]; ***** test - A = [0 1 0 0 1; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]; - R4 = logical(ones(5)); - R8 = logical([1 1 0 0 1; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); - assert (bwfill (A,1,1,4), R4) - assert (bwfill (A,1,1,8), R8) - assert (bwfill (A,1,1), R8) - B = logical([0 1 0 0 1; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); - assert (bwfill (A,3,3,4), B) - assert (bwfill (A,3,3,8), B) - assert (bwfill (A,3,3), B) - C = logical ([0 1 1 1 1; 1 0 1 1 1; 1 0 1 1 1; 1 1 1 1 1; 1 0 0 1 1]); - assert (bwfill (A,3,1,8), C) - assert (bwfill (A,3,1,4), R4) - assert (bwfill (A, [3 1], [1 3], 4), R4); - D = logical([0 1 1 1 1; 1 0 1 1 1; 1 0 1 1 1; 1 1 1 1 1; 1 0 0 1 1]); - assert (bwfill (A, [3 1], [1 3], 8), D); - assert (bwfill (A, [3 1], [1 3]), D); - E = logical ([0 1 0 0 1; 1 0 1 0 0; 1 0 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); - assert (bwfill (A, "holes", 4), E); - F = logical ([1 1 0 0 1; 1 1 1 0 0; 1 1 1 1 0; 1 1 1 0 0; 1 0 0 1 0]); - assert (bwfill (A, "holes", 8), F); - assert (bwfill (A, "holes"), F); -***** error id=Octave:invalid-fun-call bwfill () -***** error id=Octave:invalid-fun-call bwfill ("aaa") -***** error id=Octave:invalid-fun-call bwfill (rand (5) > 0.5) -***** error id=Octave:invalid-fun-call bwfill (rand (5) > 0.5, 2) -***** error bwfill (rand (5) > 0.5, "holes", 1) -***** error bwfill (rand (5) > 0.5, 2, 2, 5) -***** error id=Octave:invalid-fun-call bwfill (rand (5) > 0.5, "xxx") -***** error id=Octave:invalid-fun-call bwfill (rand (5) > 0.5, 2, 2, 4, 5) -***** error id=Octave:invalid-fun-call bwfill (rand (5) > 0.5, "holes", 4, 2) -10 tests, 10 passed, 0 known failure, 0 skipped -[src/__spatial_filtering__.cc] ->>>>> /build/reproducible-path/octave-image-2.16.0/src/__spatial_filtering__.cc -***** error - __spatial_filtering__ (ones (10), ones (3), "std", ones (10), 0) -***** error - __spatial_filtering__ (ones (10), ones (3), "std", ones (3, 3, 3), 0) -***** error - __spatial_filtering__ (ones (10), ones (3), "std", ones (1, 9), 0) -***** shared a, domain, s, out - a = [ 82 2 97 43 79 43 41 65 51 11 - 60 65 21 56 94 77 36 38 75 39 - 32 68 78 1 16 75 76 90 81 56 - 43 90 82 41 36 1 87 19 18 63 - 63 64 2 48 18 43 38 25 22 99 - 12 46 90 79 3 92 39 79 10 22 - 38 98 11 10 40 90 88 38 4 76 - 54 37 9 4 33 98 36 47 53 57 - 38 76 82 50 14 74 64 99 7 33 - 88 96 41 62 84 89 97 23 41 3]; + out = [ 1.00000 0.00000 1.00000 0.00000 1.00000 0.00000 0.00000 1.00000 + 1.41421 1.00000 1.00000 0.00000 0.00000 1.00000 1.00000 1.41421 + 2.23607 2.00000 1.00000 0.00000 0.00000 1.00000 2.00000 2.00000 + 2.00000 1.41421 1.00000 0.00000 0.00000 1.00000 1.00000 1.00000 + 1.00000 1.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 + 0.00000 0.00000 0.00000 0.00000 1.00000 1.00000 1.00000 0.00000 + 0.00000 0.00000 0.00000 1.00000 1.41421 1.00000 0.00000 1.00000 + 1.00000 1.00000 0.00000 1.00000 2.00000 1.00000 0.00000 0.00000]; + out = single (out); - domain = ones (3); - s = zeros (3); + assert (bwdist (bw), out, 0.0001); # default is euclidean + assert (bwdist (bw, "euclidean"), out, 0.0001); + assert (bwdist (logical (bw), "euclidean"), out, 0.0001); +***** test + out = [ 1 0 1 0 1 0 0 1 + 1 1 1 0 0 1 1 1 + 2 2 1 0 0 1 2 2 + 2 1 1 0 0 1 1 1 + 1 1 0 0 0 0 0 0 + 0 0 0 0 1 1 1 0 + 0 0 0 1 1 1 0 1 + 1 1 0 1 2 1 0 0]; + out = single (out); - out = [ 2 1 1 1 16 36 36 11 - 21 1 1 1 1 1 18 18 - 2 1 1 1 1 1 18 18 - 2 2 2 1 1 1 10 10 - 2 2 2 3 3 25 4 4 - 9 4 3 3 3 36 4 4 - 9 4 4 4 14 36 4 4 - 9 4 4 4 14 23 7 3]; -***** assert (__spatial_filtering__ (a, domain, "ordered", s, 1), out); + assert (bwdist (bw, "chessboard"), out); +***** test + out = [ 1 0 1 0 1 0 0 1 + 2 1 1 0 0 1 1 2 + 3 2 1 0 0 1 2 2 + 2 2 1 0 0 1 1 1 + 1 1 0 0 0 0 0 0 + 0 0 0 0 1 1 1 0 + 0 0 0 1 2 1 0 1 + 1 1 0 1 2 1 0 0]; + out = single (out); - out = [ 97 97 97 94 94 90 90 90 - 90 90 94 94 94 90 90 90 - 90 90 82 75 87 90 90 99 - 90 90 90 92 92 92 87 99 - 98 98 90 92 92 92 88 99 - 98 98 90 98 98 98 88 79 - 98 98 82 98 98 99 99 99 - 96 96 84 98 98 99 99 99]; -***** assert (__spatial_filtering__ (a, domain, "ordered", s, nnz (domain)), out); + assert (bwdist (bw, "cityblock"), out); +***** test + out = [ 1.00000 0.00000 1.00000 0.00000 1.00000 0.00000 0.00000 1.00000 + 1.41421 1.00000 1.00000 0.00000 0.00000 1.00000 1.00000 1.41421 + 2.41421 2.00000 1.00000 0.00000 0.00000 1.00000 2.00000 2.00000 + 2.00000 1.41421 1.00000 0.00000 0.00000 1.00000 1.00000 1.00000 + 1.00000 1.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 + 0.00000 0.00000 0.00000 0.00000 1.00000 1.00000 1.00000 0.00000 + 0.00000 0.00000 0.00000 1.00000 1.41421 1.00000 0.00000 1.00000 + 1.00000 1.00000 0.00000 1.00000 2.00000 1.00000 0.00000 0.00000]; + out = single (out); - out = [ 60 43 43 43 43 43 51 51 - 60 56 36 36 36 38 38 39 - 63 48 18 18 36 38 25 25 - 46 48 36 36 36 38 22 22 - 38 46 11 40 39 39 25 22 - 37 11 10 33 39 47 38 38 - 38 11 11 33 40 64 38 38 - 41 41 33 50 64 64 41 33]; -***** assert (__spatial_filtering__ (a, domain, "ordered", s, 4), out); + assert (bwdist (bw, "quasi-euclidean"), out, 0.0001); - out = [ 31.223 33.788 35.561 31.011 26.096 20.630 20.403 24.712 - 23.428 29.613 32.376 34.002 33.593 32.470 29.605 26.333 - 27.834 32.890 29.903 24.207 30.083 32.497 31.898 32.600 - 32.027 28.995 33.530 31.002 32.241 32.004 27.501 32.070 - 34.682 36.030 33.046 33.745 32.509 27.352 28.607 34.180 - 32.709 37.690 32.992 40.036 34.456 26.656 27.685 26.863 - 30.971 36.227 25.775 34.873 29.917 25.269 32.292 30.410 - 29.135 31.626 30.056 33.594 30.814 28.853 30.917 29.120]; -***** assert (__spatial_filtering__ (a, domain, "std", s), out, 0.001); + bw(logical (bw)) = 3; # there is no actual check if matrix is binary or 0 and 1 + assert (bwdist (bw, "quasi-euclidean"), out, 0.0001); - out = [ 95 96 96 93 78 54 54 79 - 69 89 93 93 93 89 72 72 - 88 89 81 74 86 89 72 81 - 88 88 88 91 91 91 77 89 - 96 96 88 89 89 67 84 95 - 89 94 87 95 95 62 84 75 - 89 94 78 94 84 63 95 95 - 87 92 80 94 84 76 92 96]; -***** assert (__spatial_filtering__ (a, domain, "range", s), out); + bw(logical (bw)) = -2; # anything non-zero is considered object + assert (bwdist (bw, "quasi-euclidean"), out, 0.0001); +***** test + bw = [ 1 1 1 1 0 1 1 1 1 + 1 1 1 1 0 1 1 1 1 + 1 1 0 1 1 1 1 1 1 + 0 1 1 1 1 1 1 1 1]; - domain = [ 1 1 0 - 0 1 1 - 0 1 0]; + dist = [ 0 0 0 0 1 0 0 0 0 + 0 0 0 0 1 0 0 0 0 + 0 0 1 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0]; + dist = single (dist); - out = [ 2 2 1 16 36 36 38 39 - 60 1 1 16 1 36 19 18 - 32 2 1 1 1 19 18 18 - 2 2 18 3 1 1 19 10 - 46 2 2 3 18 38 10 4 - 11 9 4 3 3 36 4 4 - 9 4 4 10 36 36 38 4 - 37 9 4 4 33 36 7 7]; -***** assert (__spatial_filtering__ (a, domain, "ordered", s, 1), out); + c = [ 1 5 9 13 13 21 25 29 33 + 2 6 10 14 14 22 26 30 34 + 3 7 10 15 19 23 27 31 35 + 8 8 12 16 20 24 28 32 36]; + c = uint32 (c); - out = [ 82 97 97 94 79 76 90 81 - 90 82 56 94 94 90 90 81 - 90 82 78 36 87 87 90 90 - 90 90 82 43 92 87 87 99 - 98 90 79 92 92 88 79 25 - 98 90 90 90 98 92 79 79 - 98 98 50 98 98 90 99 57 - 96 82 62 84 98 99 99 53]; -***** assert (__spatial_filtering__ (a, domain, "ordered", s, nnz (domain)), out); + [dout, cout] = bwdist (bw, "euclidean"); + assert (dout, dist) + assert (cout, c) +***** test + bw = [ 0 1 1 0 0 0 1 0 + 0 0 0 0 0 0 0 0 + 1 1 0 0 0 0 0 0 + 0 0 0 0 0 0 1 0 + 0 0 0 0 1 0 0 1 + 0 0 0 0 0 0 0 0 + 1 0 0 0 0 0 0 0 + 0 0 1 0 0 1 1 0]; + out = single ([ + 1.00000 0.00000 0.00000 1.00000 2.00000 1.00000 0.00000 1.00000 + 1.00000 1.00000 1.00000 sqrt(2) sqrt(2)+1 sqrt(2) 1.00000 sqrt(2) + 0.00000 0.00000 1.00000 2.00000 2.00000 sqrt(2) 1.00000 sqrt(2) + 1.00000 1.00000 sqrt(2) sqrt(2) 1.00000 1.00000 0.00000 1.00000 + 2.00000 2.00000 2.00000 1.00000 0.00000 1.00000 1.00000 0.00000 + 1.00000 sqrt(2) 2.00000 sqrt(2) 1.00000 sqrt(2) sqrt(2) 1.00000 + 0.00000 1.00000 1.00000 sqrt(2) sqrt(2) 1.00000 1.00000 sqrt(2) + 1.00000 1.00000 0.00000 1.00000 1.00000 0.00000 0.00000 1.00000 + ]); + assert (bwdist (bw, "quasi-euclidean"), out); +***** error bwdist (bw, "not a valid method"); +***** test + ## Special case of there being no foreground element (bug #50874) + expected_dist = single (Inf (2, 2)); + expected_idx = uint32 ([0 0; 0 0]); - out = [ 68 78 94 79 77 43 75 75 - 78 78 41 75 77 87 81 75 - 82 78 48 18 75 76 76 81 - 64 90 79 41 43 39 79 22 - 90 79 48 48 90 79 38 22 - 46 46 79 79 92 88 47 76 - 76 82 33 40 90 88 88 53 - 82 50 50 74 89 98 47 47]; -***** assert (__spatial_filtering__ (a, domain, "ordered", s, 4), out); + [dist, idx] = bwdist (false (2, 2)); + assert (dist, expected_dist) + assert (idx, expected_idx) - out = [ 34.2389 39.2772 39.6699 31.6812 20.7364 16.5439 22.2419 17.2395 - 11.9248 36.3084 21.6217 30.8350 36.4047 21.6726 30.9144 26.1017 - 22.2980 33.2746 27.5808 14.5017 36.8890 29.0259 34.6020 33.2521 - 32.2490 37.9579 26.9685 17.1959 32.5346 31.3847 33.5976 36.8280 - 21.3354 40.1833 34.0044 33.9882 32.9894 24.1102 25.6613 9.0995 - 35.4641 35.3794 39.0871 35.4753 39.9775 28.7193 26.7451 35.6553 - 35.2179 45.3398 19.3210 35.2987 28.4042 24.0832 26.8421 25.0539 - 23.4307 26.2812 26.3287 35.6959 25.2646 28.1016 34.9829 17.9221]; -***** assert (__spatial_filtering__ (a, domain, "std", s), out, 0.001); + [dist, idx] = bwdist (zeros (2, 2)); + assert (dist, expected_dist) + assert (idx, expected_idx) +***** test + ## Special case of 1D input (bug #50874) + assert (bwdist ([1 0]), single ([0 1])) + assert (bwdist ([1 0]'), single ([0 1]')) + assert (bwdist ([0 1 0 0 0 0 1 1]), single ([1 0 1 2 2 1 0 0])) + assert (bwdist ([1 1 0 0 0 0 1 1]'), single ([0 0 1 2 2 1 0 0])') + assert (bwdist ([1 0], "euclidean"), single ([0 1])) + assert (bwdist ([1 0], "chessboard"), single ([0 1])) + assert (bwdist ([1 0], "cityblock"), single ([0 1])) + assert (bwdist ([1 0], "quasi-euclidean"), single ([0 1])) +***** test + ## test 1D input with 2nd output argument (indices) (bug #50874) + expected_dist = single ([1 0 1]); + expected_idx = uint32 ([2 2 2]); - out = [ 80 95 96 78 43 40 52 42 - 30 81 55 78 93 54 71 63 - 58 80 77 35 86 68 72 72 - 88 88 64 40 91 86 68 89 - 52 88 77 89 74 50 69 21 - 87 81 86 87 95 56 75 75 - 89 94 46 88 62 54 61 53 - 59 73 58 80 65 63 92 46]; -***** assert (__spatial_filtering__ (a, domain, "range", s), out); + [dist, idx] = bwdist ([0 1 0]); + assert (dist, expected_dist) + assert (idx, expected_idx) - s = [ 1 -3 4 - 6 -7 2 - -1 3 -5]; + [dist, idx] = bwdist ([0 1 0]'); + assert (dist, expected_dist') + assert (idx, expected_idx') - out = [ -1 3 4 19 38 29 31 41 - 61 3 -6 9 4 33 22 21 - 33 5 -2 2 -6 21 12 11 - 4 -5 20 6 -2 2 16 13 - 39 -1 3 -4 19 32 12 3 - 13 4 3 0 4 36 6 -3 - 11 2 -3 11 38 29 35 1 - 34 6 1 5 34 33 9 0]; -***** assert (__spatial_filtering__ (a, domain, "ordered", s, 1), out); + expected_dist = single ([0 0 1 0 0]); + expected_idx = uint32 ([1 2 2 4 5]); + [dist, idx] = bwdist ([1 1 0 1 1]); + assert (dist, expected_dist) + assert (idx, expected_idx) - out = [ 83 94 98 87 80 79 93 84 - 93 85 53 91 95 92 83 74 - 84 75 79 29 89 80 87 91 - 87 93 83 45 95 84 88 101 - 101 83 72 94 93 91 72 26 - 91 87 91 92 101 93 76 80 - 95 99 53 100 91 91 102 59 - 99 75 65 87 95 101 92 50]; -***** assert (__spatial_filtering__ (a, domain, "ordered", s, nnz (domain)), out); + expected_dist = single ([1 0 1 2 1 0 0 0 1 1 0 0 0 0 1 2 3 4]); + expected_idx = uint32 ([2 2 2 2 6 6 7 8 8 11 11 12 13 14 14 14 14 14]); + [dist, idx] = bwdist ([0 1 0 0 0 1 1 1 0 0 1 1 1 1 0 0 0 0]); + assert (dist, expected_dist) + assert (idx, expected_idx) - out = [ 71 81 96 79 78 44 77 68 - 80 71 44 77 78 90 83 72 - 83 75 51 21 72 76 77 78 - 57 91 82 42 40 42 82 20 - 92 81 45 49 85 81 41 24 - 43 47 76 80 90 81 50 78 - 79 85 35 37 87 85 89 46 - 84 52 43 76 92 100 44 48]; -***** assert (__spatial_filtering__ (a, domain, "ordered", s, 4), out); + expected_dist = single ([0 0 1 2 1 0 0 0 1 1 0 0 0 0 1 2 1 0]); + expected_idx = uint32 ([1 2 2 2 6 6 7 8 8 11 11 12 13 14 14 14 18 18]); + [dist, idx] = bwdist ([1 1 0 0 0 1 1 1 0 0 1 1 1 1 0 0 0 1]); + assert (dist, expected_dist) + assert (idx, expected_idx) +***** test + assert (bwdist ([0 0]), single ([Inf, Inf])) + assert (bwdist ([0 0]'), single ([Inf, Inf]')) +***** xtest + ## This is Matlab incompatible because the bottom right corners is + ## equally distant to the top right and bottom left corners. However, + ## both are correct answers, and the returned value is just + ## implementation dependent. + bw = logical ([ + 0 0 1 + 0 0 0 + 1 0 0 + ]); + expected_dist = single ([ + 2.0 1.0 0.0 + 1.0 sqrt(2) 1.0 + 0.0 1.0 2.0 + ]); + expected_idx = uint32 ([ + 3 7 7 + 3 3 7 + 3 3 3 + ]); + [dist, idx] = bwdist (bw); + assert (dist, expected_dist) + assert (idx, expected_idx) +!!!!! known failure +ASSERT errors for: assert (idx,expected_idx) - out = [ 34.903 40.206 39.885 28.627 20.620 19.248 25.209 17.111 - 14.536 35.865 23.221 32.230 34.903 23.923 28.879 22.621 - 20.635 30.113 29.351 11.610 38.863 25.936 34.608 34.482 - 29.811 40.998 28.279 17.897 34.666 29.978 36.150 38.213 - 25.066 39.240 30.013 37.300 31.856 27.428 22.884 10.281 - 31.890 34.761 39.645 37.526 39.336 27.031 25.648 39.285 - 35.017 47.776 22.764 35.912 25.460 25.636 29.861 24.566 - 25.213 25.000 26.391 38.451 24.631 31.305 31.118 20.611]; -***** assert (__spatial_filtering__ (a, domain, "std", s), out, 0.001); + Location | Observed | Expected | Reason + (3,3) 7 3 Abs err 4 exceeds tol 0 by 4 +***** xtest + # bug #62192 + a = zeros (200, 200); + a (158, 100) = 1; + a (141, 141) = 1; + a (156, 115) = 1; + d = bwdist (a); + expected_result = single (57.9741); + assert (d (100, 100), expected_result, 1e-4) +!!!!! known failure +ASSERT errors for: assert (d (100, 100),expected_result,1e-4) - out = [ 84 91 94 68 42 50 62 43 - 32 82 59 82 91 59 61 53 - 51 70 81 27 95 59 75 80 - 83 98 63 39 97 82 72 88 - 62 84 69 98 74 59 60 23 - 78 83 88 92 97 57 70 83 - 84 97 56 89 53 62 67 58 - 65 69 64 82 61 68 83 50]; -***** assert (__spatial_filtering__ (a, domain, "range", s), out); -18 tests, 18 passed, 0 known failure, 0 skipped + Location | Observed | Expected | Reason + () 57.9828 57.9741 Abs err 0.0086594 exceeds tol 0.0001 by 0.009 +13 tests, 11 passed, 2 known failures, 0 skipped +[src/intlut.cc] +>>>>> /build/reproducible-path/octave-image-2.16.0/src/intlut.cc +***** assert (intlut (uint8 (1:4), uint8 ( 255:-1:0)), uint8 (254:-1:251)); +***** assert (intlut (uint16 (1:4), uint16 (65535:-1:0)), uint16 (65534:-1:65531)); +***** assert (intlut (int16 (1:4), int16 (32767:-1:-32768)), int16 (-2:-1:-5)); +***** assert (intlut (uint8 (255), uint8 (0:255)), uint8 (255)); +***** assert (intlut (uint16 (65535), uint16 (0:65535)), uint16 (65535)); +***** assert (intlut (int16 (32767), int16 (-32768:32767)), int16 (32767)); +***** error intlut () +***** error intlut ("text") +***** error intlut (1:20, uint8 (0:255)); +***** error intlut (uint16 (1:20), uint8 (0:255)); +***** error intlut (uint8 (1:20), uint8 (0:200)); +***** error intlut (uint16 (1:20), uint16 (0:500)); +***** error intlut (uint8 (56), uint8 (magic (16) -1)) +13 tests, 13 passed, 0 known failure, 0 skipped Done running the unit tests. Summary: 2206 tests, 2171 passed, 35 known failures, 0 skipped dh_installdocs -O--buildsystem=octave @@ -16383,8 +16391,8 @@ dpkg-gencontrol: warning: package octave-image: substitution variable ${octave:Upstream-Description} unused, but is defined dh_md5sums -O--buildsystem=octave dh_builddeb -O--buildsystem=octave -dpkg-deb: building package 'octave-image' in '../octave-image_2.16.0-1_amd64.deb'. dpkg-deb: building package 'octave-image-dbgsym' in '../octave-image-dbgsym_2.16.0-1_amd64.deb'. +dpkg-deb: building package 'octave-image' in '../octave-image_2.16.0-1_amd64.deb'. dpkg-genbuildinfo --build=binary -O../octave-image_2.16.0-1_amd64.buildinfo dpkg-genchanges --build=binary -O../octave-image_2.16.0-1_amd64.changes dpkg-genchanges: info: binary-only upload (no source code included) @@ -16392,12 +16400,14 @@ dpkg-buildpackage: info: binary-only upload (no source included) dpkg-genchanges: info: including full source code in upload I: copying local configuration +I: user script /srv/workspace/pbuilder/2779170/tmp/hooks/B01_cleanup starting +I: user script /srv/workspace/pbuilder/2779170/tmp/hooks/B01_cleanup finished I: unmounting dev/ptmx filesystem I: unmounting dev/pts filesystem I: unmounting dev/shm filesystem I: unmounting proc filesystem I: unmounting sys filesystem I: cleaning the build env -I: removing directory /srv/workspace/pbuilder/1673451 and its subdirectories -I: Current time: Tue Mar 25 00:26:46 -12 2025 -I: pbuilder-time-stamp: 1742905606 +I: removing directory /srv/workspace/pbuilder/2779170 and its subdirectories +I: Current time: Tue Apr 28 08:54:00 +14 2026 +I: pbuilder-time-stamp: 1777316040