Mercurial > octave
view libinterp/corefcn/__magick_read__.cc @ 24534:194eb4bd202b
maint: Update punctuation for GPL v3 license text.
* COPYING, Makefile.am, README,
bootstrap, bootstrap.conf, OctJavaQry.java, changelog.tmpl,
check-subst-vars.in.sh, find-defun-files.sh, find-files-with-tests.sh,
get-source-mtime.sh, mk-hg-id.sh, mk-octave-config-h.sh, mk-opts.pl,
stl_algo.h-fixed, subst-config-vals.in.sh, subst-cross-config-vals.in.sh,
subst-default-vals.in.sh, subst-script-vals.in.sh, configure.ac,
Doxyfile.in, arith.txi, audio.txi, basics.txi, bugs.txi, config-images.sh,
container.txi, cp-idx.txi, data.txi, debug.txi, diagperm.txi, diffeq.txi,
add_to_aspell_dict, mk_undocumented_list, spellcheck, errors.txi, eval.txi,
expr.txi, external.txi, fn-idx.txi, func.txi, genpropdoc.m, geometry.txi,
geometryimages.m, grammar.txi, gui.txi, image.txi, images.awk, install.txi,
interp.txi, interpimages.m, intro.txi, io.txi, linalg.txi, macros.texi,
matrix.txi, mk-doc-cache.pl, mkcontrib.awk, mkoctfile.1, munge-texi.pl,
nonlin.txi, numbers.txi, obsolete.txi, octave-cli.1, octave-config.1, octave.1,
octave.css, octave.texi, oop.txi, op-idx.txi, optim.txi, package.txi, plot.txi,
plotimages.m, poly.txi, preface.txi, quad.txi, set.txi, signal.txi, sparse.txi,
sparseimages.m, splineimages.m, stats.txi, stmt.txi, strings.txi, system.txi,
testfun.txi, var.txi, vectorize.txi, array.texi, bugs.texi, cp-idx.texi,
dae.texi, diffeq.texi, error.texi, factor.texi, fn-idx.texi, gpl.texi,
install.texi, intro.texi, liboctave.texi, matvec.texi, nleqn.texi, nlfunc.texi,
ode.texi, optim.texi, preface.texi, quad.texi, range.texi, refcard-a4.tex,
refcard-legal.tex, refcard-letter.tex, refcard.tex, HACKING.md,
octave.appdata.xml.in, Backend.cc, Backend.h, BaseControl.cc, BaseControl.h,
ButtonControl.cc, ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc,
Canvas.h, CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h,
ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc,
Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h,
GenericEventNotify.h, KeyMap.cc, KeyMap.h, ListBoxControl.cc, ListBoxControl.h,
Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, MouseModeActionGroup.cc,
MouseModeActionGroup.h, Object.cc, Object.h, ObjectFactory.cc, ObjectFactory.h,
ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc,
PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc,
PushTool.h, QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc,
RadioButtonControl.h, SliderControl.cc, SliderControl.h, TextControl.cc,
TextControl.h, TextEdit.cc, TextEdit.h, ToggleButtonControl.cc,
ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h,
ToolBarButton.cc, ToolBarButton.h, __init_qt__.cc, __init_qt__.h,
annotation-dialog.cc, annotation-dialog.h, gl-select.cc, gl-select.h,
liboctgui-build-info.h, liboctgui-build-info.in.cc,
mk-default-qt-settings.in.sh, QTerminal.cc, QTerminal.h, BlockArray.cpp,
BlockArray.h, Character.h, CharacterColor.h, Emulation.cpp, Emulation.h,
Filter.cpp, Filter.h, History.cpp, History.h, KeyboardTranslator.cpp,
KeyboardTranslator.h, QUnixTerminalImpl.cpp, QUnixTerminalImpl.h, Screen.cpp,
Screen.h, ScreenWindow.cpp, ScreenWindow.h, SelfListener.cpp, SelfListener.h,
TerminalCharacterDecoder.cpp, TerminalCharacterDecoder.h, TerminalModel.cpp,
TerminalModel.h, TerminalView.cpp, TerminalView.h, Vt102Emulation.cpp,
Vt102Emulation.h, kpty.cpp, kpty.h, kpty_p.h, QTerminalColors.cpp,
QTerminalColors.h, QWinTerminalImpl.cpp, QWinTerminalImpl.h, main.cpp,
color-picker.cc, color-picker.h, dialog.cc, dialog.h,
documentation-dock-widget.cc, documentation-dock-widget.h,
external-editor-interface.cc, external-editor-interface.h,
files-dock-widget.cc, files-dock-widget.h, find-files-dialog.cc,
find-files-dialog.h, find-files-model.cc, find-files-model.h,
history-dock-widget.cc, history-dock-widget.h, file-editor-interface.h,
file-editor-tab.cc, file-editor-tab.h, file-editor.cc, file-editor.h,
find-dialog.cc, find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc,
octave-qscintilla.h, octave-txt-lexer.cc, octave-txt-lexer.h, main-window.cc,
main-window.h, octave-cmd.cc, octave-cmd.h, octave-dock-widget.cc,
octave-dock-widget.h, octave-gui.cc, octave-gui.h, octave-qt-link.cc,
octave-qt-link.h, octave-settings.h, texinfo-parser.cc, texinfo-parser.h,
webinfo.cc, webinfo.h, resource-manager.cc, resource-manager.h,
settings-dialog.cc, settings-dialog.h, shortcut-manager.cc, shortcut-manager.h,
terminal-dock-widget.cc, terminal-dock-widget.h, thread-manager.cc,
thread-manager.h, variable-editor-model.cc, variable-editor-model.h,
variable-editor.cc, variable-editor.h, welcome-wizard.cc, welcome-wizard.h,
workspace-model.cc, workspace-model.h, workspace-view.cc, workspace-view.h,
build-env.h, build-env.in.cc, builtins.h, Cell.cc, Cell.h, __contourc__.cc,
__dsearchn__.cc, __ichol__.cc, __ilu__.cc, __lin_interpn__.cc, __luinc__.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc,
base-text-renderer.h, besselj.cc, betainc.cc, bitfcns.cc, bsxfun.cc,
c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h,
cdisplay.c, cdisplay.h, cellfun.cc, coct-hdf5-types.c, colloc.cc, conv2.cc,
daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, default-defs.in.h,
defaults.cc, defaults.h, defun-dld.h, defun-int.h, defun.cc, defun.h, det.cc,
dirfns.cc, dirfns.h, display.cc, display.h, dlmread.cc, dot.cc, dynamic-ld.cc,
dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc,
error.h, errwarn.cc, errwarn.h, event-queue.cc, event-queue.h, fcn-info.cc,
fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, file-io.h, filter.cc,
find.cc, ft-text-renderer.cc, ft-text-renderer.h, gammainc.cc, gcd.cc,
genprops.awk, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc,
gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-handle.h,
graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gripes.cc,
gripes.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h,
hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h,
interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h,
inv.cc, kron.cc, load-path.cc, load-path.h, load-save.cc, load-save.h,
lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-hdf5.cc, ls-hdf5.h,
ls-mat-ascii.cc, ls-mat-ascii.h, ls-mat4.cc, ls-mat4.h, ls-mat5.cc, ls-mat5.h,
ls-oct-binary.cc, ls-oct-binary.h, ls-oct-text.cc, ls-oct-text.h, ls-utils.cc,
ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex.cc, mex.h,
mexproto.h, mgorth.cc, mk-errno-list.sh, mk-mxarray-h.in.sh, mxarray.in.h,
nproc.cc, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc, oct-fstrm.h,
oct-handle.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hdf5.h, oct-hist.cc,
oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-map.cc, oct-map.h, oct-obj.h,
oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h,
oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h,
oct-tex-lexer.in.ll, oct-tex-parser.in.yy, oct.h, octave-default-image.h,
octave-link.cc, octave-link.h, ordschur.cc, pager.cc, pager.h, pinv.cc,
pr-output.cc, pr-output.h, procstream.cc, procstream.h, psi.cc, quad.cc,
quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc,
sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h,
sparse.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc,
sub2ind.cc, svd.cc, sylvester.cc, symrec.cc, symrec.h, symscope.cc, symscope.h,
symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-renderer.cc,
text-renderer.h, time.cc, toplev.cc, toplev.h, tril.cc, tsearch.cc, txt-eng.cc,
txt-eng.h, typecast.cc, url-handle-manager.cc, url-handle-manager.h,
urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, workspace-element.h,
xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, zfstream.cc, zfstream.h,
deprecated-config.h, __delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc,
__glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc,
__osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc,
ccolamd.cc, chol.cc, colamd.cc, config-module.awk, config-module.sh,
convhulln.cc, dmperm.cc, fftw.cc, gzip.cc, oct-qhull.h, qr.cc, symbfact.cc,
symrcm.cc, liboctinterp-build-info.h, liboctinterp-build-info.in.cc,
mk-build-env-features.sh, mk-builtins.pl, mk-doc.pl, mk-pkg-add.sh,
mk-version-h.in.sh, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc,
ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc,
ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.cc, ov-base.h,
ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc,
ov-bool.h, ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc,
ov-ch-mat.h, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h,
ov-colon.cc, ov-colon.h, ov-complex.cc, ov-complex.h, ov-cs-list.cc,
ov-cs-list.h, ov-cx-diag.cc, ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h,
ov-cx-sparse.cc, ov-cx-sparse.h, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc,
ov-fcn-handle.h, ov-fcn-inline.cc, ov-fcn-inline.h, ov-fcn.cc, ov-fcn.h,
ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h,
ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h,
ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h,
ov-int-traits.h, ov-int16.cc, ov-int16.h, ov-int32.cc, ov-int32.h, ov-int64.cc,
ov-int64.h, ov-int8.cc, ov-int8.h, ov-intx.h, ov-java.cc, ov-java.h,
ov-lazy-idx.cc, ov-lazy-idx.h, ov-mex-fcn.cc, ov-mex-fcn.h, ov-null-mat.cc,
ov-null-mat.h, ov-oncleanup.cc, ov-oncleanup.h, ov-perm.cc, ov-perm.h,
ov-range.cc, ov-range.h, ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc,
ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h,
ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-typeinfo.cc,
ov-typeinfo.h, ov-uint16.cc, ov-uint16.h, ov-uint32.cc, ov-uint32.h,
ov-uint64.cc, ov-uint64.h, ov-uint8.cc, ov-uint8.h, ov-usr-fcn.cc,
ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, ovl.h, octave.cc, octave.h, op-kw-docs,
mk-ops.sh, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc,
op-bm-sbm.cc, op-cdm-cdm.cc, op-cdm-cm.cc, op-cdm-cs.cc, op-cdm-dm.cc,
op-cdm-m.cc, op-cdm-s.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cdm.cc,
op-cm-cm.cc, op-cm-cs.cc, op-cm-dm.cc, op-cm-m.cc, op-cm-pm.cc, op-cm-s.cc,
op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc,
op-cs-scm.cc, op-cs-sm.cc, op-dm-cdm.cc, op-dm-cm.cc, op-dm-cs.cc, op-dm-dm.cc,
op-dm-m.cc, op-dm-s.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc,
op-dms-template.cc, op-fcdm-fcdm.cc, op-fcdm-fcm.cc, op-fcdm-fcs.cc,
op-fcdm-fdm.cc, op-fcdm-fm.cc, op-fcdm-fs.cc, op-fcm-fcdm.cc, op-fcm-fcm.cc,
op-fcm-fcs.cc, op-fcm-fdm.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcm-pm.cc,
op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc,
op-fdm-fcdm.cc, op-fdm-fcm.cc, op-fdm-fcs.cc, op-fdm-fdm.cc, op-fdm-fm.cc,
op-fdm-fs.cc, op-fm-fcdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fdm.cc,
op-fm-fm.cc, op-fm-fs.cc, op-fm-pm.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc,
op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc,
op-int-concat.cc, op-int.h, op-m-cdm.cc, op-m-cm.cc, op-m-cs.cc, op-m-dm.cc,
op-m-m.cc, op-m-pm.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-cm.cc,
op-pm-fcm.cc, op-pm-fm.cc, op-pm-m.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc,
op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc,
op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc,
op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc,
op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc,
op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc,
op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h,
options-usage.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h,
jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, jit-util.cc, jit-util.h,
lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.in.yy, octave.gperf,
parse.h, profiler.cc, profiler.h, pt-all.h, pt-arg-list.cc, pt-arg-list.h,
pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc,
pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc,
pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h,
pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h,
pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h,
pt-fcn-handle.cc, pt-fcn-handle.h, pt-funcall.cc, pt-funcall.h, pt-id.cc,
pt-id.h, pt-idx.cc, pt-idx.h, pt-jit.cc, pt-jit.h, pt-jump.cc, pt-jump.h,
pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h,
pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-stmt.cc, pt-stmt.h,
pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-walk.cc, pt-walk.h,
pt.cc, pt.h, token.cc, token.h, Array-jit.cc, Array-tc.cc, version.cc,
version.in.h, Array-C.cc, Array-b.cc, Array-ch.cc, Array-d.cc, Array-f.cc,
Array-fC.cc, Array-i.cc, Array-idx-vec.cc, Array-s.cc, Array-str.cc,
Array-util.cc, Array-util.h, Array-voidp.cc, Array.cc, Array.h, CColVector.cc,
CColVector.h, CDiagMatrix.cc, CDiagMatrix.h, CMatrix.cc, CMatrix.h,
CNDArray.cc, CNDArray.h, CRowVector.cc, CRowVector.h, CSparse.cc, CSparse.h,
DiagArray2.cc, DiagArray2.h, MArray-C.cc, MArray-d.cc, MArray-f.cc,
MArray-fC.cc, MArray-i.cc, MArray-s.cc, MArray.cc, MArray.h, MDiagArray2.cc,
MDiagArray2.h, MSparse-C.cc, MSparse-d.cc, MSparse.cc, MSparse.h, Matrix.h,
MatrixType.cc, MatrixType.h, PermMatrix.cc, PermMatrix.h, Range.cc, Range.h,
Sparse-C.cc, Sparse-b.cc, Sparse-d.cc, Sparse.cc, Sparse.h, boolMatrix.cc,
boolMatrix.h, boolNDArray.cc, boolNDArray.h, boolSparse.cc, boolSparse.h,
chMatrix.cc, chMatrix.h, chNDArray.cc, chNDArray.h, dColVector.cc,
dColVector.h, dDiagMatrix.cc, dDiagMatrix.h, dMatrix.cc, dMatrix.h,
dNDArray.cc, dNDArray.h, dRowVector.cc, dRowVector.h, dSparse.cc, dSparse.h,
dim-vector.cc, dim-vector.h, fCColVector.cc, fCColVector.h, fCDiagMatrix.cc,
fCDiagMatrix.h, fCMatrix.cc, fCMatrix.h, fCNDArray.cc, fCNDArray.h,
fCRowVector.cc, fCRowVector.h, fColVector.cc, fColVector.h, fDiagMatrix.cc,
fDiagMatrix.h, fMatrix.cc, fMatrix.h, fNDArray.cc, fNDArray.h, fRowVector.cc,
fRowVector.h, idx-vector.cc, idx-vector.h, int16NDArray.cc, int16NDArray.h,
int32NDArray.cc, int32NDArray.h, int64NDArray.cc, int64NDArray.h,
int8NDArray.cc, int8NDArray.h, intNDArray.cc, intNDArray.h, uint16NDArray.cc,
uint16NDArray.h, uint32NDArray.cc, uint32NDArray.h, uint64NDArray.cc,
uint64NDArray.h, uint8NDArray.cc, uint8NDArray.h, cconv2.f, cdotc3.f, cmatm3.f,
csconv2.f, dconv2.f, ddot3.f, dmatm3.f, sconv2.f, sdot3.f, smatm3.f, zconv2.f,
zdconv2.f, zdotc3.f, zmatm3.f, crsf2csf.f, zrsf2csf.f, mk-f77-def.in.sh,
liboctave-build-info.h, liboctave-build-info.in.cc, CollocWt.cc, CollocWt.h,
DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK-opts.in, DASPK.cc, DASPK.h,
DASRT-opts.in, DASRT.cc, DASRT.h, DASSL-opts.in, DASSL.cc, DASSL.h, DET.h,
EIG.cc, EIG.h, LSODE-opts.in, LSODE.cc, LSODE.h, ODE.h, ODEFunc.h, ODES.cc,
ODES.h, ODESFunc.h, Quad-opts.in, Quad.cc, Quad.h, aepbalance.cc, aepbalance.h,
base-dae.h, base-de.h, base-min.h, bsxfun-decl.h, bsxfun-defs.cc, bsxfun.h,
chol.cc, chol.h, eigs-base.cc, eigs-base.h, fEIG.cc, fEIG.h, gepbalance.cc,
gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-amos-proto.h,
lo-arpack-proto.h, lo-blas-proto.h, lo-fftpack-proto.h, lo-lapack-proto.h,
lo-mappers.cc, lo-mappers.h, lo-qrupdate-proto.h, lo-ranlib-proto.h,
lo-slatec-proto.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc,
oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc,
oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h,
randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc,
randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h,
sparse-dmsolve.cc, sparse-dmsolve.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc,
sparse-qr.h, svd.cc, svd.h, Sparse-diag-op-defs.h, Sparse-op-decls.h,
Sparse-op-defs.h, Sparse-perm-op-defs.h, config-ops.sh, mk-ops.awk, mx-base.h,
mx-defs.h, mx-ext.h, mx-inlines.cc, mx-op-decl.h, mx-op-defs.h, mx-ops,
smx-ops, vx-ops, child-list.cc, child-list.h, cmach-info.c, cmach-info.h,
dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h,
lo-sysdep.cc, lo-sysdep.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h,
oct-group.cc, oct-group.h, oct-passwd.cc, oct-passwd.h, oct-syscalls.cc,
oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h,
action-container.h, base-list.h, blaswrap.c, byte-swap.h, caseless-str.h,
cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, cquit.c, data-conv.cc,
data-conv.h, f2c-main.c, f77-fcn.c, f77-fcn.h, file-info.cc, file-info.h,
functor.h, glob-match.cc, glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc,
lo-array-errwarn.h, lo-array-gripes.cc, lo-array-gripes.h, lo-cutils.c,
lo-cutils.h, lo-error.c, lo-error.h, lo-hash.cc, lo-hash.h, lo-ieee.cc,
lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-traits.h, lo-utils.cc, lo-utils.h,
oct-base64.cc, oct-base64.h, oct-binmap.h, oct-cmplx.h, oct-glob.cc,
oct-glob.h, oct-inttypes-fwd.h, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.h,
oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-rl-edit.c, oct-rl-edit.h,
oct-rl-hist.c, oct-rl-hist.h, oct-shlib.cc, oct-shlib.h, oct-sort.cc,
oct-sort.h, oct-sparse.cc, oct-sparse.h, oct-string.cc, oct-string.h,
octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h,
singleton-cleanup.cc, singleton-cleanup.h, sparse-sort.cc, sparse-sort.h,
sparse-util.cc, sparse-util.h, str-vec.cc, str-vec.h, sun-utils.h,
unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h,
areadlink-wrapper.c, areadlink-wrapper.h, async-system-wrapper.c,
async-system-wrapper.h, base64-wrappers.c, base64-wrappers.h,
canonicalize-file-name-wrapper.c, canonicalize-file-name-wrapper.h,
dirent-wrappers.c, dirent-wrappers.h, fcntl-wrappers.c, fcntl-wrappers.h,
filepos-wrappers.c, filepos-wrappers.h, fpucw-wrappers.c, fpucw-wrappers.h,
gen-tempname-wrapper.c, gen-tempname-wrapper.h, getopt-wrapper.c,
getopt-wrapper.h, glob-wrappers.c, glob-wrappers.h, hash-wrappers.c,
hash-wrappers.h, localcharset-wrapper.c, localcharset-wrapper.h,
math-wrappers.c, math-wrappers.h, mkostemp-wrapper.c, mkostemp-wrapper.h,
nanosleep-wrapper.c, nanosleep-wrapper.h, nproc-wrapper.c, nproc-wrapper.h,
octave-popen2.c, octave-popen2.h, putenv-wrapper.c, putenv-wrapper.h,
set-program-name-wrapper.c, set-program-name-wrapper.h, signal-wrappers.c,
signal-wrappers.h, stat-wrappers.c, stat-wrappers.h, strdup-wrapper.c,
strdup-wrapper.h, strftime-wrapper.c, strftime-wrapper.h, strmode-wrapper.c,
strmode-wrapper.h, strptime-wrapper.c, strptime-wrapper.h, time-wrappers.c,
time-wrappers.h, tmpfile-wrapper.c, tmpfile-wrapper.h, uname-wrapper.c,
uname-wrapper.h, uniconv-wrappers.c, uniconv-wrappers.h, unistd-wrappers.c,
unistd-wrappers.h, unsetenv-wrapper.c, unsetenv-wrapper.h, vasprintf-wrapper.c,
vasprintf-wrapper.h, wait-for-input.c, wait-for-input.h, wait-wrappers.c,
wait-wrappers.h, acinclude.m4, ax_blas.m4, ax_lapack.m4, ax_openmp.m4,
ax_pthread.m4, octave_blas_f77_func.m4, pkg.m4, oct-conf-post.in.h,
run-octave.in, Map.m, ascii.m, binary.m, cd.m, close.m, delete.m,
dir.m, disp.m, ftp.m, loadobj.m, mget.m, mkdir.m, mput.m, rename.m, rmdir.m,
saveobj.m, __get_properties__.m, audioplayer.m, disp.m, get.m, isplaying.m,
pause.m, play.m, playblocking.m, resume.m, set.m, stop.m, subsasgn.m,
subsref.m, __get_properties__.m, audiorecorder.m, disp.m, get.m,
getaudiodata.m, getplayer.m, isrecording.m, pause.m, play.m, record.m,
recordblocking.m, resume.m, set.m, stop.m, subsasgn.m, subsref.m, lin2mu.m,
mu2lin.m, record.m, sound.m, soundsc.m, bitmax.m, chop.m, comma.m, isstr.m,
mahalanobis.m, md5sum.m, octave_config_info.m, onenormest.m, paren.m,
semicolon.m, sleep.m, usleep.m, wavread.m, wavwrite.m, acosd.m, acot.m,
acotd.m, acoth.m, acsc.m, acscd.m, acsch.m, asec.m, asecd.m, asech.m, asind.m,
atan2d.m, atand.m, cosd.m, cot.m, cotd.m, coth.m, csc.m, cscd.m, csch.m, sec.m,
secd.m, sech.m, sind.m, tand.m, accumarray.m, accumdim.m, bincoeff.m, bitcmp.m,
bitget.m, bitset.m, blkdiag.m, cart2pol.m, cart2sph.m, cell2mat.m, celldisp.m,
circshift.m, common_size.m, cplxpair.m, cumtrapz.m, curl.m, dblquad.m, deal.m,
deg2rad.m, del2.m, divergence.m, flip.m, flipdim.m, fliplr.m, flipud.m,
gradient.m, idivide.m, int2str.m, integral.m, integral2.m, integral3.m,
interp1.m, interp2.m, interp3.m, interpft.m, interpn.m, isequal.m, isequaln.m,
logspace.m, nextpow2.m, num2str.m, pol2cart.m, polyarea.m, postpad.m, prepad.m,
__splinen__.m, quad2d.m, quadgk.m, quadl.m, quadv.m, rad2deg.m, randi.m, rat.m,
repelem.m, repmat.m, rot90.m, rotdim.m, shift.m, shiftdim.m, sortrows.m,
sph2cart.m, structfun.m, subsindex.m, trapz.m, triplequad.m, xor.m, convhull.m,
delaunay.m, delaunayn.m, dsearch.m, dsearchn.m, griddata.m, griddata3.m,
griddatan.m, inpolygon.m, rectint.m, tsearchn.m, voronoi.m, voronoin.m,
dialog.m, errordlg.m, getappdata.m, guidata.m, guihandles.m, helpdlg.m,
inputdlg.m, isappdata.m, listdlg.m, msgbox.m, __file_filter__.m,
__fltk_file_filter__.m, __get_funcname__.m, __is_function__.m,
__uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiobject_split_args__.m,
__uiputfile_fltk__.m, questdlg.m, rmappdata.m, setappdata.m, uibuttongroup.m,
uicontextmenu.m, uicontrol.m, uigetdir.m, uigetfile.m, uimenu.m, uipanel.m,
uipushtool.m, uiputfile.m, uiresume.m, uitoggletool.m, uitoolbar.m, uiwait.m,
waitbar.m, waitforbuttonpress.m, warndlg.m, __gripe_missing_component__.m,
__makeinfo__.m, __unimplemented__.m, ans.m, debug.m, doc.m, doc_cache_create.m,
error_ids.m, get_first_help_sentence.m, help.m, lookfor.m, print_usage.m,
__additional_help_message__.m, __strip_html_tags__.m, slash.m, type.m,
warning_ids.m, which.m, autumn.m, bone.m, brighten.m, cmpermute.m, cmunique.m,
colorcube.m, colormap.m, contrast.m, cool.m, copper.m, cubehelix.m, flag.m,
frame2im.m, getframe.m, gray.m, gray2ind.m, hot.m, hsv.m, hsv2rgb.m,
im2double.m, im2frame.m, image.m, imagesc.m, imfinfo.m, imformats.m, imread.m,
imshow.m, imwrite.m, ind2gray.m, ind2rgb.m, iscolormap.m, jet.m, lines.m,
ntsc2rgb.m, ocean.m, pink.m, prism.m, __imfinfo__.m, __imread__.m,
__imwrite__.m, colorspace_conversion_input_check.m,
colorspace_conversion_revert.m, imageIO.m, imwrite_filename.m, ind2x.m,
rainbow.m, rgb2hsv.m, rgb2ind.m, rgb2ntsc.m, rgbplot.m, spinmap.m, spring.m,
summer.m, viridis.m, white.m, winter.m, beep.m, csvread.m, csvwrite.m,
dlmwrite.m, fileread.m, importdata.m, is_valid_file_id.m, strread.m,
textread.m, javaArray.m, java_get.m, java_set.m, javaaddpath.m, javachk.m,
javaclasspath.m, javamem.m, javarmpath.m, ClassHelper.java, Matrix.java,
OctClassLoader.java, Octave.java, OctaveReference.java, usejava.m, bandwidth.m,
commutation_matrix.m, cond.m, condeig.m, condest.m, cross.m,
duplication_matrix.m, expm.m, gls.m, housh.m, isbanded.m, isdefinite.m,
isdiag.m, ishermitian.m, issymmetric.m, istril.m, istriu.m, krylov.m,
linsolve.m, logm.m, lscov.m, normest.m, normest1.m, null.m, ols.m, orth.m,
planerot.m, qzhess.m, rank.m, rref.m, subspace.m, trace.m, vech.m, vecnorm.m,
bug_report.m, bunzip2.m, cast.m, citation.m, compare_versions.m, computer.m,
copyfile.m, delete.m, desktop.m, dir.m, dos.m, edit.m, fact.m, fieldnames.m,
fileattrib.m, fileparts.m, fullfile.m, genvarname.m, getfield.m, grabcode.m,
gunzip.m, info.m, inputParser.m, inputname.m, isdeployed.m, isdir.m, ismac.m,
ispc.m, isunix.m, license.m, list_primes.m, loadobj.m, ls.m, ls_command.m,
menu.m, methods.m, mex.m, mexext.m, mkdir.m, mkoctfile.m, movefile.m,
namelengthmax.m, nargchk.m, narginchk.m, nargoutchk.m, news.m, nthargout.m,
open.m, orderfields.m, pack.m, parseparams.m, perl.m,
__publish_html_output__.m, __publish_latex_output__.m, __w2mpth__.m,
display_info_file.m, publish.m, python.m, recycle.m, run.m, saveobj.m,
setfield.m, substruct.m, swapbytes.m, symvar.m, tar.m, tempdir.m, tmpnam.m,
unix.m, unpack.m, untar.m, unzip.m, validateattributes.m, ver.m, version.m,
what.m, zip.m, mk-doc.pl, mk-pkg-add.sh, decic.m, ode15i.m, ode15s.m, ode23.m,
ode45.m, odeget.m, odeplot.m, odeset.m, AbsRel_norm.m, check_default_input.m,
integrate_adaptive.m, kahan.m, ode_event_handler.m, odedefaults.m,
odemergeopts.m, runge_kutta_23.m, runge_kutta_45_dorpri.m,
runge_kutta_interpolate.m, starting_stepsize.m, __all_opts__.m, fminbnd.m,
fminsearch.m, fminunc.m, fsolve.m, fzero.m, glpk.m, humps.m, lsqnonneg.m,
optimget.m, optimset.m, pqpnonneg.m, __fdjac__.m, qp.m, sqp.m, import.m,
matlabroot.m, pathdef.m, getsavepath.m, savepath.m, pkg.m, build.m,
configure_make.m, default_prefix.m, describe.m, dirempty.m, get_description.m,
get_forge_download.m, get_forge_pkg.m, get_unsatisfied_deps.m, getarch.m,
getarchdir.m, install.m, installed_packages.m, list_forge_packages.m,
load_packages.m, load_packages_and_dependencies.m, rebuild.m, save_order.m,
uninstall.m, unload_packages.m, __clabel__.m, __getlegenddata__.m,
__rotate_around_axis__.m, annotation.m, axis.m, box.m, camlookat.m, camorbit.m,
campos.m, camroll.m, camtarget.m, camup.m, camva.m, camzoom.m, caxis.m,
clabel.m, daspect.m, datetick.m, diffuse.m, grid.m, gtext.m, hidden.m,
legend.m, lighting.m, material.m, orient.m, pbaspect.m, __axis_label__.m,
__axis_limits__.m, rticks.m, shading.m, specular.m, text.m, thetaticks.m,
title.m, view.m, whitebg.m, xlabel.m, xlim.m, xticklabels.m, xticks.m,
ylabel.m, ylim.m, yticklabels.m, yticks.m, zlabel.m, zlim.m, zticklabels.m,
zticks.m, area.m, bar.m, barh.m, camlight.m, colorbar.m, comet.m, comet3.m,
compass.m, contour.m, contour3.m, contourc.m, contourf.m, cylinder.m,
ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m,
ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m,
fplot.m, hist.m, isocaps.m, isocolors.m, isonormals.m, isosurface.m, light.m,
line.m, loglog.m, loglogerr.m, mesh.m, meshc.m, meshz.m, pareto.m, patch.m,
pcolor.m, peaks.m, pie.m, pie3.m, plot.m, plot3.m, plotmatrix.m, plotyy.m,
polar.m, __add_datasource__.m, __bar__.m, __calc_isovalue_from_data__.m,
__contour__.m, __errplot__.m, __ezplot__.m, __interp_cube__.m, __line__.m,
__marching_cube__.m, __patch__.m, __pie__.m, __plt__.m, __quiver__.m,
__scatter__.m, __stem__.m, __unite_shared_vertices__.m, quiver.m, quiver3.m,
rectangle.m, reducepatch.m, reducevolume.m, ribbon.m, rose.m, scatter.m,
scatter3.m, semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m,
shrinkfaces.m, slice.m, smooth3.m, sombrero.m, sphere.m, stairs.m, stem.m,
stem3.m, stemleaf.m, surf.m, surface.m, surfc.m, surfl.m, surfnorm.m,
tetramesh.m, trimesh.m, triplot.m, trisurf.m, waterfall.m,
__actual_axis_position__.m, __default_plot_options__.m, __gnuplot_drawnow__.m,
__next_line_color__.m, __next_line_style__.m, __opengl_info__.m,
__plt_get_axis_arg__.m, __pltopt__.m, allchild.m, ancestor.m, axes.m, cla.m,
clf.m, close.m, closereq.m, colstyle.m, copyobj.m, figure.m, findall.m,
findfigs.m, findobj.m, gca.m, gcbf.m, gcbo.m, gcf.m, gco.m, ginput.m,
gnuplot_binary.in.m, graphics_toolkit.m, groot.m, hdl2struct.m, hggroup.m,
hgload.m, hgsave.m, hgtransform.m, hold.m, isaxes.m, isfigure.m, isgraphics.m,
ishandle.m, ishold.m, isprop.m, linkaxes.m, linkprop.m, meshgrid.m, ndgrid.m,
newplot.m, pan.m, print.m, printd.m, __add_default_menu__.m, __ghostscript__.m,
__gnuplot_draw_axes__.m, __gnuplot_draw_figure__.m, __gnuplot_get_var__.m,
__gnuplot_ginput__.m, __gnuplot_has_feature__.m, __gnuplot_has_terminal__.m,
__gnuplot_open_stream__.m, __gnuplot_print__.m, __gnuplot_version__.m,
__opengl_print__.m, __print_parse_opts__.m, __set_default_mouse_modes__.m,
refresh.m, refreshdata.m, rotate.m, rotate3d.m, saveas.m, shg.m, struct2hdl.m,
subplot.m, zoom.m, compan.m, conv.m, deconv.m, mkpp.m, mpoles.m, padecoef.m,
pchip.m, poly.m, polyaffine.m, polyder.m, polyeig.m, polyfit.m, polygcd.m,
polyint.m, polyout.m, polyreduce.m, polyval.m, polyvalm.m, ppder.m, ppint.m,
ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m, unmkpp.m,
addpref.m, getpref.m, ispref.m, prefdir.m, preferences.m, loadprefs.m,
prefsfile.m, saveprefs.m, rmpref.m, setpref.m, style.css, profexplore.m,
profexport.m, profile.m, profshow.m, intersect.m, ismember.m, powerset.m,
validsetargs.m, setdiff.m, setxor.m, union.m, unique.m, arch_fit.m, arch_rnd.m,
arch_test.m, arma_rnd.m, autoreg_matrix.m, bartlett.m, blackman.m, detrend.m,
diffpara.m, durbinlevinson.m, fftconv.m, fftfilt.m, fftshift.m, filter2.m,
fractdiff.m, freqz.m, freqz_plot.m, hamming.m, hanning.m, hurst.m, ifftshift.m,
periodogram.m, rectangle_lw.m, rectangle_sw.m, triangle_lw.m, triangle_sw.m,
sinc.m, sinetone.m, sinewave.m, spectral_adf.m, spectral_xdf.m, spencer.m,
stft.m, synthesis.m, unwrap.m, yulewalker.m, bicg.m, bicgstab.m, cgs.m,
colperm.m, eigs.m, etreeplot.m, gmres.m, gplot.m, ichol.m, ilu.m, nonzeros.m,
pcg.m, pcr.m, __sprand__.m, qmr.m, spaugment.m, spconvert.m, spdiags.m,
speye.m, spfun.m, spones.m, sprand.m, sprandn.m, sprandsym.m, spstats.m, spy.m,
svds.m, treelayout.m, treeplot.m, bessel.m, beta.m, betaln.m, ellipke.m,
expint.m, factor.m, factorial.m, isprime.m, lcm.m, legendre.m, nchoosek.m,
nthroot.m, perms.m, pow2.m, primes.m, reallog.m, realpow.m, realsqrt.m,
gallery.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, pascal.m,
rosser.m, toeplitz.m, vander.m, wilkinson.m, __finish__.m, center.m, cloglog.m,
corr.m, corrcoef.m, cov.m, crosstab.m, histc.m, iqr.m, kendall.m, kurtosis.m,
logit.m, mean.m, meansq.m, median.m, mode.m, moment.m, ppplot.m, prctile.m,
probit.m, qqplot.m, quantile.m, range.m, ranks.m, run_count.m, runlength.m,
skewness.m, spearman.m, statistics.m, std.m, var.m, zscore.m, betacdf.m,
betainv.m, betapdf.m, betarnd.m, binocdf.m, binoinv.m, binopdf.m, binornd.m,
cauchy_cdf.m, cauchy_inv.m, cauchy_pdf.m, cauchy_rnd.m, chi2cdf.m, chi2inv.m,
chi2pdf.m, chi2rnd.m, discrete_cdf.m, discrete_inv.m, discrete_pdf.m,
discrete_rnd.m, empirical_cdf.m, empirical_inv.m, empirical_pdf.m,
empirical_rnd.m, expcdf.m, expinv.m, exppdf.m, exprnd.m, fcdf.m, finv.m,
fpdf.m, frnd.m, gamcdf.m, gaminv.m, gampdf.m, gamrnd.m, geocdf.m, geoinv.m,
geopdf.m, geornd.m, hygecdf.m, hygeinv.m, hygepdf.m, hygernd.m,
kolmogorov_smirnov_cdf.m, laplace_cdf.m, laplace_inv.m, laplace_pdf.m,
laplace_rnd.m, logistic_cdf.m, logistic_inv.m, logistic_pdf.m, logistic_rnd.m,
logncdf.m, logninv.m, lognpdf.m, lognrnd.m, nbincdf.m, nbininv.m, nbinpdf.m,
nbinrnd.m, normcdf.m, norminv.m, normpdf.m, normrnd.m, poisscdf.m, poissinv.m,
poisspdf.m, poissrnd.m, stdnormal_cdf.m, stdnormal_inv.m, stdnormal_pdf.m,
stdnormal_rnd.m, tcdf.m, tinv.m, tpdf.m, trnd.m, unidcdf.m, unidinv.m,
unidpdf.m, unidrnd.m, unifcdf.m, unifinv.m, unifpdf.m, unifrnd.m, wblcdf.m,
wblinv.m, wblpdf.m, wblrnd.m, wienrnd.m, logistic_regression.m,
logistic_regression_derivatives.m, logistic_regression_likelihood.m, anova.m,
bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m,
cor_test.m, f_test_regression.m, hotelling_test.m, hotelling_test_2.m,
kolmogorov_smirnov_test.m, kolmogorov_smirnov_test_2.m, kruskal_wallis_test.m,
manova.m, mcnemar_test.m, prop_test_2.m, run_test.m, sign_test.m, t_test.m,
t_test_2.m, t_test_regression.m, u_test.m, var_test.m, welch_test.m,
wilcoxon_test.m, z_test.m, z_test_2.m, base2dec.m, bin2dec.m, blanks.m,
cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m, erase.m, findstr.m,
hex2dec.m, index.m, isletter.m, isstring.m, isstrprop.m, mat2str.m,
native2unicode.m, ostrsplit.m, regexptranslate.m, rindex.m, str2num.m,
strcat.m, strchr.m, strjoin.m, strjust.m, strmatch.m, strsplit.m, strtok.m,
strtrim.m, strtrunc.m, substr.m, unicode2native.m, untabify.m,
validatestring.m, __have_feature__.m, __printf_assert__.m,
__prog_output_assert__.m, __run_test_suite__.m, assert.m, demo.m, example.m,
fail.m, compare_plot_demos.m, dump_demos.m, html_compare_plot_demos.m,
rundemos.m, runtests.m, speed.m, test.m, addtodate.m, asctime.m, calendar.m,
clock.m, ctime.m, date.m, datenum.m, datestr.m, datevec.m, eomday.m, etime.m,
is_leap_year.m, now.m, weekday.m, display-available.c, display-available.h,
main-cli.cc, main-gui.cc, main.in.cc, mkoctfile.in.cc, octave-build-info.h,
octave-build-info.in.cc, octave-config.in.cc, shared-fcns.h, args.tst,
bug-31371.tst, bug-35448.tst, bug-35881.tst, bug-36025.tst, bug-38236.tst,
bug-38565.tst, bug-38576.tst, bug-38691.tst, bug-41723.tst, bug-44940.tst,
bug-46330.tst, bug-46660.tst, bug-50014.tst, bug-50035.tst, bug-50716.tst,
bug-51192.tst, bug-51532.tst, bug-51534.tst, bug-51599.tst, bug-52075.tst,
class-concat.tst, classdef-multiple-inheritance.tst, classdef.tst, classes.tst,
colormaps.tst, command.tst, complex.tst, ctor-vs-method.tst,
deprecate-props.tst, diag-perm.tst, error.tst, eval-catch.tst,
fcn-handle-derived-resolution.tst, fntests.m, for.tst, func.tst, global.tst,
if.tst, index.tst, io.tst, jit.tst, leftdiv.tst, line-continue.tst,
logical-index.tst, mk-bc-overloads-tst.sh, mk-conv-tst.sh, mk-sparse-tst.sh,
nest.tst, null-assign.tst, parser.tst, prefer.tst, publish.tst, range.tst,
recursion.tst, return.tst, show-failures.awk, single-index.tst, slice.tst,
struct.tst, switch.tst, system.tst, transpose.tst, try.tst, unwind.tst,
while.tst:
Changed punctuation of GPL license text to match that suggested by FSF.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 06 Jan 2018 07:57:19 -0800 |
parents | 336f89b6208b |
children | 6652d3823428 |
line wrap: on
line source
/* Copyright (C) 2013-2017 Carnë Draug Copyright (C) 2002-2016 Andy Adler Copyright (C) 2008 Thomas L. Scofield Copyright (C) 2010 David Grundberg This file is part of Octave. Octave is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Octave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, see <https://www.gnu.org/licenses/>. */ #if defined (HAVE_CONFIG_H) # include "config.h" #endif #include "file-stat.h" #include "oct-env.h" #include "oct-time.h" #include "defun.h" #include "error.h" #include "ov-struct.h" #include "errwarn.h" #if defined (HAVE_MAGICK) #include <Magick++.h> #include <clocale> // In theory, it should be enough to check the class: // Magick::ClassType // PseudoClass: // Image is composed of pixels which specify an index in a color palette. // DirectClass: // Image is composed of pixels which represent literal color values. // // GraphicsMagick does not really distinguishes between indexed and // normal images. After reading a file, it decides itself the optimal // way to store the image in memory, independently of the how the // image was stored in the file. That's what ClassType returns. While // it seems to match the original file most of the times, this is // not necessarily true all the times. See // https://sourceforge.net/mailarchive/message.php?msg_id=31180507 // In addition to the ClassType, there is also ImageType which has a // type for indexed images (PaletteType and PaletteMatteType). However, // they also don't represent the original image. Not only does DirectClass // can have a PaletteType, but also does a PseudoClass have non Palette // types. // // We can't do better without having format specific code which is // what we are trying to avoid by using a library such as GM. We at // least create workarounds for the most common problems. // // 1) A grayscale jpeg image can report being indexed even though the // JPEG format has no support for indexed images. We can at least // fix this one. // 2) A PNG file is only an indexed image if color type orig is 3 (value comes // from libpng) static bool is_indexed (const Magick::Image& img) { bool indexed = (img.classType () == Magick::PseudoClass); // Our problem until now is non-indexed images, being represented as indexed // by GM. The following attempts educated guesses to undo this optimization. if (indexed) { const std::string fmt = img.magick (); if (fmt == "JPEG") // The JPEG format does not support indexed images, but GM sometimes // reports grayscale JPEG as indexed. Always false for JPEG. indexed = false; else if (fmt == "PNG") { // Newer versions of GM (at least does not happens with 1.3.16) will // store values from the underlying library as image attributes. In // the case of PNG files, this is libpng where an indexed image will // always have a value of 3 for "color-type-orig". This property // always has a value in libpng so if we get nothing, we assume this // GM version does not store them and we have to go with whatever // GM PseudoClass says. const std::string color_type = const_cast<Magick::Image&> (img).attribute ("PNG:IHDR.color-type-orig"); if (! color_type.empty () && color_type != "3") indexed = false; } } return indexed; } // The depth from depth() is not always correct for us but seems to be the // best value we can get. For example, a grayscale png image with 1 bit // per channel should return a depth of 1 but instead we get 8. // We could check channelDepth() but then, which channel has the data // is not straightforward. So we'd have to check all // the channels and select the highest value. But then, I also // have a 16bit TIFF whose depth returns 16 (correct), but all of the // channels gives 8 (wrong). No idea why, maybe a bug in GM? // Anyway, using depth() seems that only causes problems for binary // images, and the problem with channelDepth() is not making set them // all to 1. So we will guess that if all channels have depth of 1, // then we must have a binary image. // Note that we can't use AllChannels it doesn't work for this. // We also can't check only one from RGB, one from CMYK, and grayscale // and transparency, we really need to check all of the channels (bug #41584). static octave_idx_type get_depth (Magick::Image& img) { octave_idx_type depth = img.depth (); if (depth == 8 && img.channelDepth (Magick::RedChannel) == 1 && img.channelDepth (Magick::GreenChannel) == 1 && img.channelDepth (Magick::BlueChannel) == 1 && img.channelDepth (Magick::CyanChannel) == 1 && img.channelDepth (Magick::MagentaChannel) == 1 && img.channelDepth (Magick::YellowChannel) == 1 && img.channelDepth (Magick::BlackChannel) == 1 && img.channelDepth (Magick::OpacityChannel) == 1 && img.channelDepth (Magick::GrayChannel) == 1) depth = 1; return depth; } // We need this in case one of the sides of the image being read has // width 1. In those cases, the type will come as scalar instead of range // since that's the behavior of the colon operator (1:1:1 will be a scalar, // not a range). static Range get_region_range (const octave_value& region) { Range output; if (region.is_range ()) output = region.range_value (); else if (region.is_scalar_type ()) { double value = region.scalar_value (); output = Range (value, value); } else error ("__magick_read__: unknown datatype for Region option"); return output; } class image_region { public: image_region (const octave_scalar_map& options) { // FIXME: should we have better checking on the input map and values // or is that expected to be done elsewhere? const Cell pixel_region = options.getfield ("region").cell_value (); // Subtract 1 to account for 0 indexing. const Range rows = get_region_range (pixel_region (0)); const Range cols = get_region_range (pixel_region (1)); m_row_start = rows.base () - 1; m_col_start = cols.base () - 1; m_row_end = rows.max () - 1; m_col_end = cols.max () - 1; m_row_cache = m_row_end - m_row_start + 1; m_col_cache = m_col_end - m_col_start + 1; m_row_shift = m_col_cache * rows.inc (); m_col_shift = m_col_cache * (m_row_cache + rows.inc () - 1) - cols.inc (); m_row_out = rows.numel (); m_col_out = cols.numel (); } // Default copy, move, and delete methods are all OK for this class. image_region (const image_region&) = default; image_region (image_region&&) = default; image_region& operator = (const image_region&) = default; image_region& operator = (image_region&&) = default; ~image_region (void) = default; octave_idx_type row_start (void) const { return m_row_start; } octave_idx_type col_start (void) const { return m_col_start; } octave_idx_type row_end (void) const { return m_row_end; } octave_idx_type col_end (void) const { return m_col_end; } // Length of the area to load into the Image Pixel Cache. We use max and // min to account for cases where last element of range is the range limit. octave_idx_type row_cache (void) const { return m_row_cache; } octave_idx_type col_cache (void) const { return m_col_cache; } // How much we have to shift in the memory when doing the loops. octave_idx_type row_shift (void) const { return m_row_shift; } octave_idx_type col_shift (void) const { return m_col_shift; } // The actual height and width of the output image octave_idx_type row_out (void) const { return m_row_out; } octave_idx_type col_out (void) const { return m_col_out; } private: octave_idx_type m_row_start; octave_idx_type m_col_start; octave_idx_type m_row_end; octave_idx_type m_col_end; // Length of the area to load into the Image Pixel Cache. We use max and // min to account for cases where last element of range is the range limit. octave_idx_type m_row_cache; octave_idx_type m_col_cache; // How much we have to shift in the memory when doing the loops. octave_idx_type m_row_shift; octave_idx_type m_col_shift; // The actual height and width of the output image octave_idx_type m_row_out; octave_idx_type m_col_out; }; static octave_value_list read_maps (Magick::Image& img) { // can't call colorMapSize on const Magick::Image const octave_idx_type mapsize = img.colorMapSize (); Matrix cmap = Matrix (mapsize, 3); // colormap ColumnVector amap = ColumnVector (mapsize); // alpha map for (octave_idx_type i = 0; i < mapsize; i++) { const Magick::ColorRGB c = img.colorMap (i); cmap(i,0) = c.red (); cmap(i,1) = c.green (); cmap(i,2) = c.blue (); amap(i) = c.alpha (); } octave_value_list maps; maps(0) = cmap; maps(1) = amap; return maps; } template <typename T> static octave_value_list read_indexed_images (const std::vector<Magick::Image>& imvec, const Array<octave_idx_type>& frameidx, const octave_idx_type& nargout, const octave_scalar_map& options) { typedef typename T::element_type P; octave_value_list retval (1); image_region region (options); const octave_idx_type nFrames = frameidx.numel (); const octave_idx_type nRows = region.row_out (); const octave_idx_type nCols = region.col_out (); // imvec has all of the pages of a file, even the ones we are not // interested in. We will use the first image that we will be actually // reading to get information about the image. const octave_idx_type def_elem = frameidx(0); T img = T (dim_vector (nRows, nCols, 1, nFrames)); P *img_fvec = img.fortran_vec (); const octave_idx_type row_start = region.row_start (); const octave_idx_type col_start = region.col_start (); const octave_idx_type row_shift = region.row_shift (); const octave_idx_type col_shift = region.col_shift (); const octave_idx_type row_cache = region.row_cache (); const octave_idx_type col_cache = region.col_cache (); // When reading PixelPackets from the Image Pixel Cache, they come in // row major order. So we keep moving back and forth there so we can // write the image in column major order. octave_idx_type idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); const Magick::IndexPacket *pix = imvec[frameidx(frame)].getConstIndexes (); for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { img_fvec[idx++] = static_cast<P> (*pix); pix += row_shift; } pix -= col_shift; } } retval(0) = octave_value (img); // Only bother reading the colormap if it was requested as output. if (nargout > 1) { // In theory, it should be possible for each frame of an image to // have different colormaps but for Matlab compatibility, we only // return the colormap of the first frame. To obtain the colormaps // of different frames, one needs can either use imfinfo or a for // loop around imread. const octave_value_list maps = read_maps (const_cast<Magick::Image&> (imvec[frameidx(def_elem)])); retval(1) = maps(0); // only interpret alpha channel if it exists and was requested as output if (imvec[def_elem].matte () && nargout >= 3) { const Matrix amap = maps(1).matrix_value (); const double *amap_fvec = amap.fortran_vec (); NDArray alpha (dim_vector (nRows, nCols, 1, nFrames)); double *alpha_fvec = alpha.fortran_vec (); // GraphicsMagick stores the alpha values inverted, i.e., // 1 for transparent and 0 for opaque so we fix that here. const octave_idx_type nPixels = alpha.numel (); for (octave_idx_type pix = 0; pix < nPixels; pix++) alpha_fvec[pix] = 1 - amap_fvec[static_cast<int> (img_fvec[3])]; retval(2) = alpha; } } return retval; } // This function is highly repetitive, a bunch of for loops that are // very similar to account for different image types. They are different // enough that trying to reduce the copy and paste would decrease its // readability too much. template <typename T> octave_value_list read_images (std::vector<Magick::Image>& imvec, const Array<octave_idx_type>& frameidx, const octave_idx_type& nargout, const octave_scalar_map& options) { typedef typename T::element_type P; octave_value_list retval (3, Matrix ()); image_region region (options); const octave_idx_type nFrames = frameidx.numel (); const octave_idx_type nRows = region.row_out (); const octave_idx_type nCols = region.col_out (); T img; // imvec has all of the pages of a file, even the ones we are not // interested in. We will use the first image that we will be actually // reading to get information about the image. const octave_idx_type def_elem = frameidx(0); const octave_idx_type row_start = region.row_start (); const octave_idx_type col_start = region.col_start (); const octave_idx_type row_shift = region.row_shift (); const octave_idx_type col_shift = region.col_shift (); const octave_idx_type row_cache = region.row_cache (); const octave_idx_type col_cache = region.col_cache (); // GraphicsMagick (GM) keeps the image values in memory using whatever // QuantumDepth it was built with independently of the original image // bitdepth. Basically this means that if GM was built with quantum 16 // all values are scaled in the uint16 range. If the original image // had an 8 bit depth, we need to rescale it for that range. // However, if the image had a bitdepth of 32, then we will be returning // a floating point image. In this case, the values need to be rescaled // for the range [0 1] (this is what Matlab has documented on the page // about image types but in some cases seems to be doing something else. // See bug #39249). // Finally, we must do the division ourselves (set a divisor) instead of // using quantumOperator for the cases where we will be returning floating // point and want things in the range [0 1]. This is the same reason why // the divisor is of type double. // uint64_t is used in expression because default 32-bit value overflows // when depth() is 32. // FIXME: in the next release of GraphicsMagick, MaxRGB should be replaced // with QuantumRange since MaxRGB is already deprecated in ImageMagick. double divisor; if (imvec[def_elem].depth () == 32) divisor = std::numeric_limits<uint32_t>::max (); else divisor = MaxRGB / ((uint64_t (1) << imvec[def_elem].depth ()) - 1); // FIXME: this workaround should probably be fixed in GM by creating a // new ImageType BilevelMatteType // Despite what GM documentation claims, opacity is not only on the types // with Matte on the name. It is possible that an image is completely // black (1 color), and have a second channel set for transparency (2nd // color). Its type will be bilevel since there is no BilevelMatte. The // only way to check for this seems to be by checking matte (). Magick::ImageType type = imvec[def_elem].type (); if (type == Magick::BilevelType && imvec[def_elem].matte ()) type = Magick::GrayscaleMatteType; // FIXME: ImageType is the type being used to represent the image in memory // by GM. The real type may be different (see among others bug #36820). For // example, a png file where all channels are equal may report being // grayscale or even bilevel. But we must always return the real image in // file. In some cases, the original image attributes are stored in the // attributes but this is undocumented. This should be fixed in GM so that // a method such as original_type returns an actual Magick::ImageType if (imvec[0].magick () == "PNG") { // These values come from libpng, not GM: // Grayscale = 0 // Palette = 2 + 1 // RGB = 2 // RGB + Alpha = 2 + 4 // Grayscale + Alpha = 4 // We won't bother with case 3 (palette) since those should be // read by the function to read indexed images const std::string type_str = imvec[0].attribute ("PNG:IHDR.color-type-orig"); if (type_str == "0") type = Magick::GrayscaleType; else if (type_str == "2") type = Magick::TrueColorType; else if (type_str == "6") type = Magick::TrueColorMatteType; else if (type_str == "4") type = Magick::GrayscaleMatteType; // Color types 0, 2, and 3 can also have alpha channel, conveyed // via the "tRNS" chunk. For 0 and 2, it's limited to GIF-style // binary transparency, while 3 can have any level of alpha per // palette entry. We thus must check matte() to see if the image // really doesn't have an alpha channel. if (imvec[0].matte ()) { if (type == Magick::GrayscaleType) type = Magick::GrayscaleMatteType; else if (type == Magick::TrueColorType) type = Magick::TrueColorMatteType; } } // If the alpha channel was not requested, treat images as if // it doesn't exist. if (nargout < 3) { switch (type) { case Magick::GrayscaleMatteType: type = Magick::GrayscaleType; break; case Magick::PaletteMatteType: type = Magick::PaletteType; break; case Magick::TrueColorMatteType: type = Magick::TrueColorType; break; case Magick::ColorSeparationMatteType: type = Magick::ColorSeparationType; break; default: // Do nothing other than silencing warnings about enumeration // values not being handled in switch. ; } } const octave_idx_type color_stride = nRows * nCols; switch (type) { case Magick::BilevelType: // Monochrome bi-level image case Magick::GrayscaleType: // Grayscale image { img = T (dim_vector (nRows, nCols, 1, nFrames)); P *img_fvec = img.fortran_vec (); octave_idx_type idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { img_fvec[idx++] = pix->red / divisor; pix += row_shift; } pix -= col_shift; } } break; } case Magick::GrayscaleMatteType: // Grayscale image with opacity { img = T (dim_vector (nRows, nCols, 1, nFrames)); T alpha (dim_vector (nRows, nCols, 1, nFrames)); P *img_fvec = img.fortran_vec (); P *a_fvec = alpha.fortran_vec (); octave_idx_type idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { img_fvec[idx] = pix->red / divisor; a_fvec[idx] = (MaxRGB - pix->opacity) / divisor; pix += row_shift; idx++; } pix -= col_shift; } } retval(2) = alpha; break; } case Magick::PaletteType: // Indexed color (palette) image case Magick::TrueColorType: // Truecolor image { img = T (dim_vector (nRows, nCols, 3, nFrames)); P *img_fvec = img.fortran_vec (); const octave_idx_type frame_stride = color_stride * 3; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); octave_idx_type idx = 0; P *rbuf = img_fvec; P *gbuf = img_fvec + color_stride; P *bbuf = img_fvec + color_stride * 2; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { rbuf[idx] = pix->red / divisor; gbuf[idx] = pix->green / divisor; bbuf[idx] = pix->blue / divisor; pix += row_shift; idx++; } pix -= col_shift; } img_fvec += frame_stride; } break; } case Magick::PaletteMatteType: // Indexed color image with opacity case Magick::TrueColorMatteType: // Truecolor image with opacity { img = T (dim_vector (nRows, nCols, 3, nFrames)); T alpha (dim_vector (nRows, nCols, 1, nFrames)); P *img_fvec = img.fortran_vec (); P *a_fvec = alpha.fortran_vec (); const octave_idx_type frame_stride = color_stride * 3; // Unlike the index for the other channels, this one won't need // to be reset on each frame since it's a separate matrix. octave_idx_type a_idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); octave_idx_type idx = 0; P *rbuf = img_fvec; P *gbuf = img_fvec + color_stride; P *bbuf = img_fvec + color_stride * 2; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { rbuf[idx] = pix->red / divisor; gbuf[idx] = pix->green / divisor; bbuf[idx] = pix->blue / divisor; a_fvec[a_idx++] = (MaxRGB - pix->opacity) / divisor; pix += row_shift; idx++; } pix -= col_shift; } img_fvec += frame_stride; } retval(2) = alpha; break; } case Magick::ColorSeparationType: // Cyan/Magenta/Yellow/Black (CMYK) image { img = T (dim_vector (nRows, nCols, 4, nFrames)); P *img_fvec = img.fortran_vec (); const octave_idx_type frame_stride = color_stride * 4; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); octave_idx_type idx = 0; P *cbuf = img_fvec; P *mbuf = img_fvec + color_stride; P *ybuf = img_fvec + color_stride * 2; P *kbuf = img_fvec + color_stride * 3; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { cbuf[idx] = pix->red / divisor; mbuf[idx] = pix->green / divisor; ybuf[idx] = pix->blue / divisor; kbuf[idx] = pix->opacity / divisor; pix += row_shift; idx++; } pix -= col_shift; } img_fvec += frame_stride; } break; } // Cyan, magenta, yellow, and black with alpha (opacity) channel case Magick::ColorSeparationMatteType: { img = T (dim_vector (nRows, nCols, 4, nFrames)); T alpha (dim_vector (nRows, nCols, 1, nFrames)); P *img_fvec = img.fortran_vec (); P *a_fvec = alpha.fortran_vec (); const octave_idx_type frame_stride = color_stride * 4; // Unlike the index for the other channels, this one won't need // to be reset on each frame since it's a separate matrix. octave_idx_type a_idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); // Note that for CMYKColorspace + matte (CMYKA), the opacity is // stored in the assocated IndexPacket. const Magick::IndexPacket *apix = imvec[frameidx(frame)].getConstIndexes (); octave_idx_type idx = 0; P *cbuf = img_fvec; P *mbuf = img_fvec + color_stride; P *ybuf = img_fvec + color_stride * 2; P *kbuf = img_fvec + color_stride * 3; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { cbuf[idx] = pix->red / divisor; mbuf[idx] = pix->green / divisor; ybuf[idx] = pix->blue / divisor; kbuf[idx] = pix->opacity / divisor; a_fvec[a_idx++] = (MaxRGB - *apix) / divisor; pix += row_shift; idx++; } pix -= col_shift; } img_fvec += frame_stride; } retval(2) = alpha; break; } default: error ("__magick_read__: unknown Magick++ image type"); } retval(0) = img; return retval; } // Read a file into vector of image objects. void static read_file (const std::string& filename, std::vector<Magick::Image>& imvec) { try { Magick::readImages (&imvec, filename); } catch (Magick::Warning& w) { warning ("Magick++ warning: %s", w.what ()); } catch (Magick::Exception& e) { error ("Magick++ exception: %s", e.what ()); } } static void maybe_initialize_magick (void) { static bool initialized = false; if (! initialized) { // Save locale as GraphicsMagick might change this (fixed in // GraphicsMagick since version 1.3.13 released on December 24, 2011) const char *static_locale = setlocale (LC_ALL, nullptr); const std::string locale (static_locale); const std::string program_name = octave::sys::env::get_program_invocation_name (); Magick::InitializeMagick (program_name.c_str ()); // Restore locale from before GraphicsMagick initialisation setlocale (LC_ALL, locale.c_str ()); // Why should we give a warning? // Magick does not tell us the real bitdepth of the image in file. // The best we can have is the minimum between the bitdepth of the // file and the quantum depth. So we never know if the file will // actually be read correctly so we warn the user that it might // be limited. // // Why we warn if < 16 instead of < 32 ? // The reasons for < 32 is simply that it's the maximum quantum // depth they support. However, very few people would actually // need such support while being a major inconvenience to anyone // else (8 bit images suddenly taking 4x more space will be // critical for multi page images). It would also suggests that // it covers all images which does not (it still does not support // float point and signed integer images). // On the other hand, 16bit images are much more common. If quantum // depth is 8, there's a good chance that we will be limited. It // is also the GraphicsMagick recommended setting and the default // for ImageMagick. if (QuantumDepth < 16) warning_with_id ("Octave:GraphicsMagick-Quantum-Depth", "your version of %s limits images to %d bits per pixel\n", MagickPackageName, QuantumDepth); initialized = true; } } #endif DEFUN (__magick_read__, args, nargout, doc: /* -*- texinfo -*- @deftypefn {} {[@var{img}, @var{map}, @var{alpha}] =} __magick_read__ (@var{fname}, @var{options}) Read image with GraphicsMagick or ImageMagick. This is a private internal function not intended for direct use. Use @code{imread} instead. @seealso{imfinfo, imformats, imread, imwrite} @end deftypefn */) { #if defined (HAVE_MAGICK) if (args.length () != 2 || ! args(0).is_string ()) print_usage (); maybe_initialize_magick (); const octave_scalar_map options = args(1).xscalar_map_value ("__magick_read__: OPTIONS must be a struct"); octave_value_list output; std::vector<Magick::Image> imvec; read_file (args(0).string_value (), imvec); // Prepare an Array with the indexes for the requested frames. const octave_idx_type nFrames = imvec.size (); Array<octave_idx_type> frameidx; const octave_value indexes = options.getfield ("index"); if (indexes.is_string () && indexes.string_value () == "all") { frameidx.resize (dim_vector (1, nFrames)); for (octave_idx_type i = 0; i < nFrames; i++) frameidx(i) = i; } else { frameidx = indexes.xint_vector_value ("__magick_read__: invalid value for Index/Frame"); // Fix indexes from base 1 to base 0, and at the same time, make // sure none of the indexes is outside the range of image number. const octave_idx_type n = frameidx.numel (); for (octave_idx_type i = 0; i < n; i++) { frameidx(i)--; if (frameidx(i) < 0 || frameidx(i) > nFrames - 1) { // We do this check inside the loop because frameidx does not // need to be ordered (this is a feature and even allows for // some frames to be read multiple times). error ("imread: index/frames specified are outside the number of images"); } } } // Check that all frames have the same size. We don't do this at the same // time we decode the image because that's done in many different places, // to cover the different types of images which would lead to a lot of // copy and paste. { const unsigned int nRows = imvec[frameidx(0)].rows (); const unsigned int nCols = imvec[frameidx(0)].columns (); const octave_idx_type n = frameidx.numel (); for (octave_idx_type frame = 0; frame < n; frame++) { if (nRows != imvec[frameidx(frame)].rows () || nCols != imvec[frameidx(frame)].columns ()) { error ("imread: all frames must have the same size but frame %i is different", frameidx(frame) +1); } } } const octave_idx_type depth = get_depth (imvec[frameidx(0)]); if (is_indexed (imvec[frameidx(0)])) { if (depth <= 1) output = read_indexed_images<boolNDArray> (imvec, frameidx, nargout, options); else if (depth <= 8) output = read_indexed_images<uint8NDArray> (imvec, frameidx, nargout, options); else if (depth <= 16) output = read_indexed_images<uint16NDArray> (imvec, frameidx, nargout, options); else error ("imread: indexed images with depths greater than 16-bit are not supported"); } else { if (depth <= 1) output = read_images<boolNDArray> (imvec, frameidx, nargout, options); else if (depth <= 8) output = read_images<uint8NDArray> (imvec, frameidx, nargout, options); else if (depth <= 16) output = read_images<uint16NDArray> (imvec, frameidx, nargout, options); else if (depth <= 32) output = read_images<FloatNDArray> (imvec, frameidx, nargout, options); else error ("imread: reading of images with %i-bit depth is not supported", depth); } return output; #else octave_unused_parameter (args); octave_unused_parameter (nargout); err_disabled_feature ("imread", "Image IO"); #endif } /* ## No test needed for internal helper function. %!assert (1) */ #if defined (HAVE_MAGICK) template <typename T> static uint32NDArray img_float2uint (const T& img) { typedef typename T::element_type P; uint32NDArray out (img.dims ()); octave_uint32 *out_fvec = out.fortran_vec (); const P *img_fvec = img.fortran_vec (); const octave_uint32 max = octave_uint32::max (); const octave_idx_type numel = img.numel (); for (octave_idx_type idx = 0; idx < numel; idx++) out_fvec[idx] = img_fvec[idx] * max; return out; } // Gets the bitdepth to be used for an Octave class, i.e, returns 8 for // uint8, 16 for uint16, and 32 for uint32 template <typename T> static octave_idx_type bitdepth_from_class () { typedef typename T::element_type P; const octave_idx_type bitdepth = sizeof (P) * std::numeric_limits<unsigned char>::digits; return bitdepth; } static Magick::Image init_enconde_image (const octave_idx_type& nCols, const octave_idx_type& nRows, const octave_idx_type& bitdepth, const Magick::ImageType& type, const Magick::ClassType& klass) { Magick::Image img (Magick::Geometry (nCols, nRows), "black"); // Ensure that there are no other references to this image. img.modifyImage (); img.classType (klass); img.type (type); // FIXME: for some reason, setting bitdepth doesn't seem to work for // indexed images. img.depth (bitdepth); switch (type) { case Magick::GrayscaleMatteType: case Magick::TrueColorMatteType: case Magick::ColorSeparationMatteType: case Magick::PaletteMatteType: img.matte (true); break; default: img.matte (false); } return img; } template <typename T> static void encode_indexed_images (std::vector<Magick::Image>& imvec, const T& img, const Matrix& cmap) { typedef typename T::element_type P; const octave_idx_type nFrames = (img.ndims () < 4 ? 1 : img.dims ()(3)); const octave_idx_type nRows = img.rows (); const octave_idx_type nCols = img.columns (); const octave_idx_type cmap_size = cmap.rows (); const octave_idx_type bitdepth = bitdepth_from_class<T> (); // There is no colormap object, we need to build a new one for each frame, // even if it's always the same. We can least get a vector for the Colors. std::vector<Magick::ColorRGB> colormap; { const double *cmap_fvec = cmap.fortran_vec (); const octave_idx_type G_offset = cmap_size; const octave_idx_type B_offset = cmap_size * 2; for (octave_idx_type map_idx = 0; map_idx < cmap_size; map_idx++) colormap.push_back (Magick::ColorRGB (cmap_fvec[map_idx], cmap_fvec[map_idx + G_offset], cmap_fvec[map_idx + B_offset])); } for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, Magick::PaletteType, Magick::PseudoClass); // Insert colormap. m_img.colorMapSize (cmap_size); for (octave_idx_type map_idx = 0; map_idx < cmap_size; map_idx++) m_img.colorMap (map_idx, colormap[map_idx]); // Why are we also setting the pixel values instead of only the // index values? We don't know if a file format supports indexed // images. If we only set the indexes and then try to save the // image as JPEG for example, the indexed values get discarded, // there is no conversion from the indexes, it's the initial values // that get used. An alternative would be to only set the pixel // values (no indexes), then set the image as PseudoClass and GM // would create a colormap for us. However, we wouldn't have control // over the order of that colormap. And that's why we set both. Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows); Magick::IndexPacket *ind = m_img.getIndexes (); const P *img_fvec = img.fortran_vec (); octave_idx_type GM_idx = 0; for (octave_idx_type column = 0; column < nCols; column++) { for (octave_idx_type row = 0; row < nRows; row++) { ind[GM_idx] = double (*img_fvec); pix[GM_idx] = m_img.colorMap (double (*img_fvec)); img_fvec++; GM_idx += nCols; } GM_idx -= nCols * nRows - 1; } // Save changes to underlying image. m_img.syncPixels (); imvec.push_back (m_img); } } static void encode_bool_image (std::vector<Magick::Image>& imvec, const boolNDArray& img) { const octave_idx_type nFrames = (img.ndims () < 4 ? 1 : img.dims ()(3)); const octave_idx_type nRows = img.rows (); const octave_idx_type nCols = img.columns (); // The initialized image will be black, this is for the other pixels const Magick::Color white ("white"); const bool *img_fvec = img.fortran_vec (); octave_idx_type img_idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); // For some reason, we can't set the type to Magick::BilevelType or // the output image will be black, changing to white has no effect. // However, this will still work fine and a binary image will be // saved because we are setting the bitdepth to 1. Magick::Image m_img = init_enconde_image (nCols, nRows, 1, Magick::GrayscaleType, Magick::DirectClass); Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows); octave_idx_type GM_idx = 0; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { if (img_fvec[img_idx]) pix[GM_idx] = white; img_idx++; GM_idx += nCols; } GM_idx -= nCols * nRows - 1; } // Save changes to underlying image. m_img.syncPixels (); // While we could not set it to Bilevel at the start, we can do it // here otherwise some coders won't save it as binary. m_img.type (Magick::BilevelType); imvec.push_back (m_img); } } template <typename T> static void encode_uint_image (std::vector<Magick::Image>& imvec, const T& img, const T& alpha) { typedef typename T::element_type P; const octave_idx_type channels = (img.ndims () < 3 ? 1 : img.dims ()(2)); const octave_idx_type nFrames = (img.ndims () < 4 ? 1 : img.dims ()(3)); const octave_idx_type nRows = img.rows (); const octave_idx_type nCols = img.columns (); const octave_idx_type bitdepth = bitdepth_from_class<T> (); Magick::ImageType type; const bool has_alpha = ! alpha.isempty (); switch (channels) { case 1: if (has_alpha) type = Magick::GrayscaleMatteType; else type = Magick::GrayscaleType; break; case 3: if (has_alpha) type = Magick::TrueColorMatteType; else type = Magick::TrueColorType; break; case 4: if (has_alpha) type = Magick::ColorSeparationMatteType; else type = Magick::ColorSeparationType; break; default: // __imwrite should have already filtered this cases error ("__magick_write__: wrong size on 3rd dimension"); } // We will be passing the values as integers with depth as specified // by QuantumDepth (maximum value specified by MaxRGB). This is independent // of the actual depth of the image. GM will then convert the values but // while in memory, it always keeps the values as specified by QuantumDepth. // From GM documentation: // Color arguments are must be scaled to fit the Quantum size according to // the range of MaxRGB const double divisor = static_cast<double>((uint64_t (1) << bitdepth) - 1) / MaxRGB; const P *img_fvec = img.fortran_vec (); const P *a_fvec = alpha.fortran_vec (); switch (type) { case Magick::GrayscaleType: { for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows); octave_idx_type GM_idx = 0; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { const double grey = octave::math::round (double (*img_fvec) / divisor); Magick::Color c (grey, grey, grey); pix[GM_idx] = c; img_fvec++; GM_idx += nCols; } GM_idx -= nCols * nRows - 1; } // Save changes to underlying image. m_img.syncPixels (); imvec.push_back (m_img); } break; } case Magick::GrayscaleMatteType: { for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows); octave_idx_type GM_idx = 0; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { double grey = octave::math::round (double (*img_fvec) / divisor); Magick::Color c (grey, grey, grey, MaxRGB - octave::math::round (double (*a_fvec) / divisor)); pix[GM_idx] = c; img_fvec++; a_fvec++; GM_idx += nCols; } GM_idx -= nCols * nRows - 1; } // Save changes to underlying image. m_img.syncPixels (); imvec.push_back (m_img); } break; } case Magick::TrueColorType: { // The fortran_vec offset for the green and blue channels const octave_idx_type G_offset = nCols * nRows; const octave_idx_type B_offset = nCols * nRows * 2; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows); octave_idx_type GM_idx = 0; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { Magick::Color c (octave::math::round (double (*img_fvec) / divisor), octave::math::round (double (img_fvec[G_offset]) / divisor), octave::math::round (double (img_fvec[B_offset]) / divisor)); pix[GM_idx] = c; img_fvec++; GM_idx += nCols; } GM_idx -= nCols * nRows - 1; } // Save changes to underlying image. m_img.syncPixels (); imvec.push_back (m_img); img_fvec += B_offset; } break; } case Magick::TrueColorMatteType: { // The fortran_vec offset for the green and blue channels const octave_idx_type G_offset = nCols * nRows; const octave_idx_type B_offset = nCols * nRows * 2; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows); octave_idx_type GM_idx = 0; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { Magick::Color c (octave::math::round (double (*img_fvec) / divisor), octave::math::round (double (img_fvec[G_offset]) / divisor), octave::math::round (double (img_fvec[B_offset]) / divisor), MaxRGB - octave::math::round (double (*a_fvec) / divisor)); pix[GM_idx] = c; img_fvec++; a_fvec++; GM_idx += nCols; } GM_idx -= nCols * nRows - 1; } // Save changes to underlying image. m_img.syncPixels (); imvec.push_back (m_img); img_fvec += B_offset; } break; } case Magick::ColorSeparationType: { // The fortran_vec offset for the Magenta, Yellow, and blacK channels const octave_idx_type M_offset = nCols * nRows; const octave_idx_type Y_offset = nCols * nRows * 2; const octave_idx_type K_offset = nCols * nRows * 3; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows); octave_idx_type GM_idx = 0; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { Magick::Color c (octave::math::round (double (*img_fvec) / divisor), octave::math::round (double (img_fvec[M_offset]) / divisor), octave::math::round (double (img_fvec[Y_offset]) / divisor), octave::math::round (double (img_fvec[K_offset]) / divisor)); pix[GM_idx] = c; img_fvec++; GM_idx += nCols; } GM_idx -= nCols * nRows - 1; } // Save changes to underlying image. m_img.syncPixels (); imvec.push_back (m_img); img_fvec += K_offset; } break; } case Magick::ColorSeparationMatteType: { // The fortran_vec offset for the Magenta, Yellow, and blacK channels const octave_idx_type M_offset = nCols * nRows; const octave_idx_type Y_offset = nCols * nRows * 2; const octave_idx_type K_offset = nCols * nRows * 3; for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows); Magick::IndexPacket *ind = m_img.getIndexes (); octave_idx_type GM_idx = 0; for (octave_idx_type col = 0; col < nCols; col++) { for (octave_idx_type row = 0; row < nRows; row++) { Magick::Color c (octave::math::round (double (*img_fvec) / divisor), octave::math::round (double (img_fvec[M_offset]) / divisor), octave::math::round (double (img_fvec[Y_offset]) / divisor), octave::math::round (double (img_fvec[K_offset]) / divisor)); pix[GM_idx] = c; ind[GM_idx] = MaxRGB - octave::math::round (double (*a_fvec) / divisor); img_fvec++; a_fvec++; GM_idx += nCols; } GM_idx -= nCols * nRows - 1; } // Save changes to underlying image. m_img.syncPixels (); imvec.push_back (m_img); img_fvec += K_offset; } break; } default: error ("__magick_write__: unrecognized Magick::ImageType"); } return; } // Meant to be shared with both imfinfo and imwrite. static std::map<octave_idx_type, std::string> init_disposal_methods () { // GIF Specifications: // // Disposal Method - Indicates the way in which the graphic is to // be treated after being displayed. // // 0 - No disposal specified. The decoder is // not required to take any action. // 1 - Do not dispose. The graphic is to be left // in place. // 2 - Restore to background color. The area used by the // graphic must be restored to the background color. // 3 - Restore to previous. The decoder is required to // restore the area overwritten by the graphic with // what was there prior to rendering the graphic. // 4-7 - To be defined. static std::map<octave_idx_type, std::string> methods; if (methods.empty ()) { methods[0] = "doNotSpecify"; methods[1] = "leaveInPlace"; methods[2] = "restoreBG"; methods[3] = "restorePrevious"; } return methods; } static std::map<std::string, octave_idx_type> init_reverse_disposal_methods () { static std::map<std::string, octave_idx_type> methods; if (methods.empty ()) { methods["donotspecify"] = 0; methods["leaveinplace"] = 1; methods["restorebg"] = 2; methods["restoreprevious"] = 3; } return methods; } void static write_file (const std::string& filename, const std::string& ext, std::vector<Magick::Image>& imvec) { try { Magick::writeImages (imvec.begin (), imvec.end (), ext + ':' + filename); } catch (Magick::Warning& w) { warning ("Magick++ warning: %s", w.what ()); } catch (Magick::ErrorCoder& e) { warning ("Magick++ coder error: %s", e.what ()); } catch (Magick::Exception& e) { error ("Magick++ exception: %s", e.what ()); } } #endif DEFUN (__magick_write__, args, , doc: /* -*- texinfo -*- @deftypefn {} {} __magick_write__ (@var{fname}, @var{fmt}, @var{img}, @var{map}, @var{options}) Write image with GraphicsMagick or ImageMagick. This is a private internal function not intended for direct use. Use @code{imwrite} instead. @seealso{imfinfo, imformats, imread, imwrite} @end deftypefn */) { #if defined (HAVE_MAGICK) if (args.length () != 5 || ! args(0).is_string () || ! args(1).is_string ()) print_usage (); maybe_initialize_magick (); const std::string filename = args(0).string_value (); const std::string ext = args(1).string_value (); const octave_scalar_map options = args(4).xscalar_map_value ("__magick_write__: OPTIONS must be a struct"); const octave_value img = args(2); const Matrix cmap = args(3).xmatrix_value ("__magick_write__: invalid MAP"); std::vector<Magick::Image> imvec; if (cmap.isempty ()) { const octave_value alpha = options.getfield ("alpha"); if (img.islogical ()) encode_bool_image (imvec, img.bool_array_value ()); else if (img.is_uint8_type ()) encode_uint_image<uint8NDArray> (imvec, img.uint8_array_value (), alpha.uint8_array_value ()); else if (img.is_uint16_type ()) encode_uint_image<uint16NDArray> (imvec, img.uint16_array_value (), alpha.uint16_array_value ()); else if (img.is_uint32_type ()) encode_uint_image<uint32NDArray> (imvec, img.uint32_array_value (), alpha.uint32_array_value ()); else if (img.isfloat ()) { // For image formats that support floating point values, we write // the actual values. For those who don't, we only use the values // on the range [0 1] and save integer values. // But here, even for formats that would support floating point // values, GM seems unable to do that so we at least make them uint32. uint32NDArray clip_img; uint32NDArray clip_alpha; if (img.is_single_type ()) { clip_img = img_float2uint<FloatNDArray> (img.float_array_value ()); clip_alpha = img_float2uint<FloatNDArray> (alpha.float_array_value ()); } else { clip_img = img_float2uint<NDArray> (img.array_value ()); clip_alpha = img_float2uint<NDArray> (alpha.array_value ()); } encode_uint_image<uint32NDArray> (imvec, clip_img, clip_alpha); } else error ("__magick_write__: image type not supported"); } else { // We should not get floating point indexed images here because we // converted them in __imwrite__.m. We should probably do it here // but it would look much messier. if (img.is_uint8_type ()) encode_indexed_images<uint8NDArray> (imvec, img.uint8_array_value (), cmap); else if (img.is_uint16_type ()) encode_indexed_images<uint16NDArray> (imvec, img.uint16_array_value (), cmap); else error ("__magick_write__: indexed image must be uint8, uint16 or float."); } static std::map<std::string, octave_idx_type> disposal_methods = init_reverse_disposal_methods (); const octave_idx_type nFrames = imvec.size (); const octave_idx_type quality = options.getfield ("quality").int_value (); const ColumnVector delaytime = options.getfield ("delaytime").column_vector_value (); const Array<std::string> disposalmethod = options.getfield ("disposalmethod").cellstr_value (); for (octave_idx_type i = 0; i < nFrames; i++) { imvec[i].quality (quality); imvec[i].animationDelay (delaytime(i)); imvec[i].gifDisposeMethod (disposal_methods[disposalmethod(i)]); } // If writemode is set to append, read the image and append to it. Even // if set to append, make sure that something was read at all. const std::string writemode = options.getfield ("writemode").string_value (); if (writemode == "append" && octave::sys::file_stat (filename).exists ()) { std::vector<Magick::Image> ini_imvec; read_file (filename, ini_imvec); if (ini_imvec.size () > 0) { ini_imvec.insert (ini_imvec.end (), imvec.begin (), imvec.end ()); ini_imvec.swap (imvec); } } // FIXME: LoopCount or animationIterations // How it should work: // // This value is only set for the first image in the sequence. Trying // to set this value with the append mode should have no effect, the // value used with the first image is the one that counts (that would // also be Matlab compatible). Thus, the right way to do this would be // to have an else block on the condition above, and set this only // when creating a new file. Since Matlab does not interpret a 4D // matrix as sequence of images to write, its users need to use a for // loop and set LoopCount only on the first iteration (it actually // throws warnings otherwise) // // Why is this not done the right way: // // When GM saves a single image, it discards the value if there is only // a single image and sets it to "no loop". Since our default is an // infinite loop, if the user tries to do it the Matlab way (setting // LoopCount only on the first image) that value will go nowhere. // See https://sourceforge.net/p/graphicsmagick/bugs/248/ // Because of this, we document to set LoopCount on every iteration // (in Matlab will cause a lot of warnings), or pass a 4D matrix with // all frames (won't work in Matlab at all). // Note that this only needs to be set on the first frame imvec[0].animationIterations (options.getfield ("loopcount").uint_value ()); const std::string compression = options.getfield ("compression").string_value (); #define COMPRESS_MAGICK_IMAGE_VECTOR(GM_TYPE) \ for (std::vector<Magick::Image>::size_type i = 0; i < imvec.size (); i++) \ imvec[i].compressType (GM_TYPE) if (compression == "none") COMPRESS_MAGICK_IMAGE_VECTOR (Magick::NoCompression); else if (compression == "bzip") COMPRESS_MAGICK_IMAGE_VECTOR (Magick::BZipCompression); else if (compression == "fax3") COMPRESS_MAGICK_IMAGE_VECTOR (Magick::FaxCompression); else if (compression == "fax4") COMPRESS_MAGICK_IMAGE_VECTOR (Magick::Group4Compression); else if (compression == "jpeg") COMPRESS_MAGICK_IMAGE_VECTOR (Magick::JPEGCompression); else if (compression == "lzw") COMPRESS_MAGICK_IMAGE_VECTOR (Magick::LZWCompression); else if (compression == "rle") COMPRESS_MAGICK_IMAGE_VECTOR (Magick::RLECompression); else if (compression == "deflate") COMPRESS_MAGICK_IMAGE_VECTOR (Magick::ZipCompression); #undef COMPRESS_MAGICK_IMAGE_VECTOR write_file (filename, ext, imvec); return ovl (); #else octave_unused_parameter (args); err_disabled_feature ("imwrite", "Image IO"); #endif } /* ## No test needed for internal helper function. %!assert (1) */ // Gets the minimum information from images such as its size and format. Much // faster than using imfinfo, which slows down a lot since. Note than without // this, we need to read the image once for imfinfo to set defaults (which is // done in Octave language), and then again for the actual reading. DEFUN (__magick_ping__, args, , doc: /* -*- texinfo -*- @deftypefn {} {} __magick_ping__ (@var{fname}, @var{idx}) Ping image information with GraphicsMagick or ImageMagick. This is a private internal function not intended for direct use. @seealso{imfinfo} @end deftypefn */) { #if defined (HAVE_MAGICK) if (args.length () < 1 || ! args(0).is_string ()) print_usage (); maybe_initialize_magick (); const std::string filename = args(0).string_value (); int idx; if (args.length () > 1) idx = args(1).int_value () -1; else idx = 0; Magick::Image img; img.subImage (idx); // start ping from this image (in case of multi-page) img.subRange (1); // ping only one of them try { img.ping (filename); } catch (Magick::Warning& w) { warning ("Magick++ warning: %s", w.what ()); } catch (Magick::Exception& e) { error ("Magick++ exception: %s", e.what ()); } static const char *fields[] = {"rows", "columns", "format", nullptr}; octave_scalar_map ping = octave_scalar_map (string_vector (fields)); ping.setfield ("rows", octave_value (img.rows ())); ping.setfield ("columns", octave_value (img.columns ())); ping.setfield ("format", octave_value (img.magick ())); return ovl (ping); #else octave_unused_parameter (args); err_disabled_feature ("imfinfo", "Image IO"); #endif } #if defined (HAVE_MAGICK) static octave_value magick_to_octave_value (const Magick::CompressionType& magick) { switch (magick) { case Magick::NoCompression: return octave_value ("none"); case Magick::BZipCompression: return octave_value ("bzip"); case Magick::FaxCompression: return octave_value ("fax3"); case Magick::Group4Compression: return octave_value ("fax4"); case Magick::JPEGCompression: return octave_value ("jpeg"); case Magick::LZWCompression: return octave_value ("lzw"); case Magick::RLECompression: // This is named "rle" for the HDF, but the same thing is named // "ccitt" and "PackBits" for binary and non-binary images in TIFF. return octave_value ("rle"); case Magick::ZipCompression: return octave_value ("deflate"); // The following are present only in recent versions of GraphicsMagick. // At the moment the only use of this would be to have imfinfo report // the compression method. In the future, someone could implement // the Compression option for imwrite in which case a macro in // configure.ac will have to check for their presence of this. // See bug #39913 // case Magick::LZMACompression: // return octave_value ("lzma"); // case Magick::JPEG2000Compression: // return octave_value ("jpeg2000"); // case Magick::JBIG1Compression: // return octave_value ("jbig1"); // case Magick::JBIG2Compression: // return octave_value ("jbig2"); default: return octave_value ("undefined"); } } static octave_value magick_to_octave_value (const Magick::EndianType& magick) { switch (magick) { case Magick::LSBEndian: return octave_value ("little-endian"); case Magick::MSBEndian: return octave_value ("big-endian"); default: return octave_value ("undefined"); } } static octave_value magick_to_octave_value (const Magick::OrientationType& magick) { switch (magick) { // Values come from the TIFF6 spec case Magick::TopLeftOrientation: return octave_value (1); case Magick::TopRightOrientation: return octave_value (2); case Magick::BottomRightOrientation: return octave_value (3); case Magick::BottomLeftOrientation: return octave_value (4); case Magick::LeftTopOrientation: return octave_value (5); case Magick::RightTopOrientation: return octave_value (6); case Magick::RightBottomOrientation: return octave_value (7); case Magick::LeftBottomOrientation: return octave_value (8); default: return octave_value (1); } } static octave_value magick_to_octave_value (const Magick::ResolutionType& magick) { switch (magick) { case Magick::PixelsPerInchResolution: return octave_value ("Inch"); case Magick::PixelsPerCentimeterResolution: return octave_value ("Centimeter"); default: return octave_value ("undefined"); } } static bool is_valid_exif (const std::string& val) { // Sometimes GM will return the string "unknown" instead of empty // for an empty value. return (! val.empty () && val != "unknown"); } static void fill_exif (octave_scalar_map& map, Magick::Image& img, const std::string& key) { const std::string attr = img.attribute ("EXIF:" + key); if (is_valid_exif (attr)) map.setfield (key, octave_value (attr)); return; } static void fill_exif_ints (octave_scalar_map& map, Magick::Image& img, const std::string& key) { const std::string attr = img.attribute ("EXIF:" + key); if (is_valid_exif (attr)) { // string of the type "float,float,float....." float number; ColumnVector values (std::count (attr.begin (), attr.end (), ',') +1); std::string sub; std::istringstream sstream (attr); octave_idx_type n = 0; while (std::getline (sstream, sub, char (','))) { sscanf (sub.c_str (), "%f", &number); values(n++) = number; } map.setfield (key, octave_value (values)); } return; } static void fill_exif_floats (octave_scalar_map& map, Magick::Image& img, const std::string& key) { const std::string attr = img.attribute ("EXIF:" + key); if (is_valid_exif (attr)) { // string of the type "int/int,int/int,int/int....." int numerator; int denominator; ColumnVector values (std::count (attr.begin (), attr.end (), ',') +1); std::string sub; std::istringstream sstream (attr); octave_idx_type n = 0; while (std::getline (sstream, sub, ',')) { sscanf (sub.c_str (), "%i/%i", &numerator, &denominator); values(n++) = double (numerator) / double (denominator); } map.setfield (key, octave_value (values)); } return; } #endif DEFUN (__magick_finfo__, args, , doc: /* -*- texinfo -*- @deftypefn {} {} __magick_finfo__ (@var{fname}) Read image information with GraphicsMagick or ImageMagick. This is a private internal function not intended for direct use. Use @code{imfinfo} instead. @seealso{imfinfo, imformats, imread, imwrite} @end deftypefn */) { #if defined (HAVE_MAGICK) if (args.length () < 1 || ! args(0).is_string ()) print_usage (); maybe_initialize_magick (); const std::string filename = args(0).string_value (); std::vector<Magick::Image> imvec; read_file (filename, imvec); const octave_idx_type nFrames = imvec.size (); const std::string format = imvec[0].magick (); // Here's how this function works. We need to return a struct array, one // struct for each image in the file (remember, there are image // that allow for multiple images in the same file). Now, Matlab seems // to have format specific code so the fields on the struct are different // for each format. It only has a small subset that is common to all // of them, the others are undocumented. Because we try to abstract from // the formats we always return the same list of fields (note that with // GM we support more than 88 formats. That's way more than Matlab, and // I don't want to write specific code for each of them). // // So what we do is we create an octave_scalar_map, fill it with the // information for that image, and then insert it into an octave_map. // Because in the same file, different images may have values for // different fields, we can't create a field only if there's a value. // Bad things happen if we merge octave_scalar_maps with different // fields from the others (suppose for example a TIFF file with 4 images, // where only the third image has a colormap. static const char *fields[] = { // These are fields that must always appear for Matlab. "Filename", "FileModDate", "FileSize", "Format", "FormatVersion", "Width", "Height", "BitDepth", "ColorType", // These are format specific or not existent in Matlab. The most // annoying thing is that Matlab may have different names for the // same thing in different formats. "DelayTime", "DisposalMethod", "LoopCount", "ByteOrder", "Gamma", "Chromaticities", "Comment", "Quality", "Compression", // same as CompressionType "Colormap", // same as ColorTable (in PNG) "Orientation", "ResolutionUnit", "XResolution", "YResolution", "Software", // sometimes is an Exif tag "Make", // actually an Exif tag "Model", // actually an Exif tag "DateTime", // actually an Exif tag "ImageDescription", // actually an Exif tag "Artist", // actually an Exif tag "Copyright", // actually an Exif tag "DigitalCamera", "GPSInfo", // Notes for the future: GM allows one to get many attributes, and even has // attribute() to obtain arbitrary ones, that may exist in only some // cases. The following is a list of some methods and into what possible // Matlab compatible values they may be converted. // // colorSpace() -> PhotometricInterpretation // backgroundColor() -> BackgroundColor // interlaceType() -> Interlaced, InterlaceType, and PlanarConfiguration // label() -> Title nullptr }; // The one we will return at the end octave_map info (dim_vector (nFrames, 1), string_vector (fields)); // Some of the fields in the struct are about file information and will be // the same for all images in the file. So we create a template, fill in // those values, and make a copy of the template for each image. octave_scalar_map template_info = (string_vector (fields)); template_info.setfield ("Format", octave_value (format)); // We can't actually get FormatVersion but even Matlab sometimes can't. template_info.setfield ("FormatVersion", octave_value ("")); const octave::sys::file_stat fs (filename); if (! fs) error ("imfinfo: error reading '%s': %s", filename.c_str (), fs.error ().c_str ()); const octave::sys::localtime mtime (fs.mtime ()); const std::string filetime = mtime.strftime ("%e-%b-%Y %H:%M:%S"); template_info.setfield ("Filename", octave_value (filename)); template_info.setfield ("FileModDate", octave_value (filetime)); template_info.setfield ("FileSize", octave_value (fs.size ())); for (octave_idx_type frame = 0; frame < nFrames; frame++) { octave_quit (); octave_scalar_map info_frame (template_info); const Magick::Image img = imvec[frame]; info_frame.setfield ("Width", octave_value (img.columns ())); info_frame.setfield ("Height", octave_value (img.rows ())); info_frame.setfield ("BitDepth", octave_value (get_depth (const_cast<Magick::Image&> (img)))); // Stuff related to colormap, image class and type // Because GM is too smart for us... Read the comments in is_indexed() { std::string color_type; Matrix cmap; if (is_indexed (img)) { color_type = "indexed"; cmap = read_maps (const_cast<Magick::Image&> (img))(0).matrix_value (); } else { switch (img.type ()) { case Magick::BilevelType: case Magick::GrayscaleType: case Magick::GrayscaleMatteType: color_type = "grayscale"; break; case Magick::TrueColorType: case Magick::TrueColorMatteType: color_type = "truecolor"; break; case Magick::PaletteType: case Magick::PaletteMatteType: // we should never get here or is_indexed needs to be fixed color_type = "indexed"; break; case Magick::ColorSeparationType: case Magick::ColorSeparationMatteType: color_type = "CMYK"; break; default: color_type = "undefined"; } } info_frame.setfield ("ColorType", octave_value (color_type)); info_frame.setfield ("Colormap", octave_value (cmap)); } { // Not all images have chroma values. In such cases, they'll // be all zeros. So rather than send a matrix of zeros, we will // check for that, and send an empty vector instead. RowVector chromaticities (8); double *chroma_fvec = chromaticities.fortran_vec (); img.chromaWhitePoint (&chroma_fvec[0], &chroma_fvec[1]); img.chromaRedPrimary (&chroma_fvec[2], &chroma_fvec[3]); img.chromaGreenPrimary (&chroma_fvec[4], &chroma_fvec[5]); img.chromaBluePrimary (&chroma_fvec[6], &chroma_fvec[7]); if (chromaticities.nnz () == 0) chromaticities = RowVector (0); info_frame.setfield ("Chromaticities", octave_value (chromaticities)); } info_frame.setfield ("Gamma", octave_value (img.gamma ())); info_frame.setfield ("XResolution", octave_value (img.xResolution ())); info_frame.setfield ("YResolution", octave_value (img.yResolution ())); info_frame.setfield ("DelayTime", octave_value (img.animationDelay ())); info_frame.setfield ("LoopCount", octave_value (img.animationIterations ())); info_frame.setfield ("Quality", octave_value (img.quality ())); info_frame.setfield ("Comment", octave_value (img.comment ())); info_frame.setfield ("Compression", magick_to_octave_value (img.compressType ())); info_frame.setfield ("Orientation", magick_to_octave_value (img.orientation ())); info_frame.setfield ("ResolutionUnit", magick_to_octave_value (img.resolutionUnits ())); info_frame.setfield ("ByteOrder", magick_to_octave_value (img.endian ())); // It is not possible to know if there's an Exif field so we just // check for the Exif Version value. If it does exists, then we // bother about looking for specific fields. { Magick::Image& cimg = const_cast<Magick::Image&> (img); // These will be in Exif tags but must appear as fields in the // base struct array, not as another struct in one of its fields. // This is likely because they belong to the Baseline TIFF specs // and may appear out of the Exif tag. So first we check if it // exists outside the Exif tag. // See Section 4.6.4, table 4, page 28 of Exif specs version 2.3 // (CIPA DC- 008-Translation- 2010) static const char *base_exif_str_fields[] = { "DateTime", "ImageDescription", "Make", "Model", "Software", "Artist", "Copyright", nullptr, }; static const string_vector base_exif_str (base_exif_str_fields); static const octave_idx_type n_base_exif_str = base_exif_str.numel (); for (octave_idx_type field = 0; field < n_base_exif_str; field++) { info_frame.setfield (base_exif_str[field], octave_value (cimg.attribute (base_exif_str[field]))); fill_exif (info_frame, cimg, base_exif_str[field]); } octave_scalar_map camera; octave_scalar_map gps; if (! cimg.attribute ("EXIF:ExifVersion").empty ()) { // See Section 4.6.5, table 7 and 8, over pages page 42 to 43 // of Exif specs version 2.3 (CIPA DC- 008-Translation- 2010) // Listed on the Exif specs as being of type ASCII. static const char *exif_str_fields[] = { "RelatedSoundFile", "DateTimeOriginal", "DateTimeDigitized", "SubSecTime", "DateTimeOriginal", "SubSecTimeOriginal", "SubSecTimeDigitized", "ImageUniqueID", "CameraOwnerName", "BodySerialNumber", "LensMake", "LensModel", "LensSerialNumber", "SpectralSensitivity", // These last two are of type undefined but most likely will // be strings. Even if they're not GM returns a string anyway. "UserComment", "MakerComment", nullptr }; static const string_vector exif_str (exif_str_fields); static const octave_idx_type n_exif_str = exif_str.numel (); for (octave_idx_type field = 0; field < n_exif_str; field++) fill_exif (camera, cimg, exif_str[field]); // Listed on the Exif specs as being of type SHORT or LONG. static const char *exif_int_fields[] = { "ColorSpace", "ExifImageWidth", // PixelXDimension (CPixelXDimension in Matlab) "ExifImageHeight", // PixelYDimension (CPixelYDimension in Matlab) "PhotographicSensitivity", "StandardOutputSensitivity", "RecommendedExposureIndex", "ISOSpeed", "ISOSpeedLatitudeyyy", "ISOSpeedLatitudezzz", "FocalPlaneResolutionUnit", "FocalLengthIn35mmFilm", // Listed as SHORT or LONG but with more than 1 count. "SubjectArea", "SubjectLocation", // While the following are an integer, their value have a meaning // that must be represented as a string for Matlab compatibility. // For example, a 3 on ExposureProgram, would return // "Aperture priority" as defined on the Exif specs. "ExposureProgram", "SensitivityType", "MeteringMode", "LightSource", "Flash", "SensingMethod", "FileSource", "CustomRendered", "ExposureMode", "WhiteBalance", "SceneCaptureType", "GainControl", "Contrast", "Saturation", "Sharpness", "SubjectDistanceRange", nullptr }; static const string_vector exif_int (exif_int_fields); static const octave_idx_type n_exif_int = exif_int.numel (); for (octave_idx_type field = 0; field < n_exif_int; field++) fill_exif_ints (camera, cimg, exif_int[field]); // Listed as RATIONAL or SRATIONAL static const char *exif_float_fields[] = { "Gamma", "CompressedBitsPerPixel", "ExposureTime", "FNumber", "ShutterSpeedValue", // SRATIONAL "ApertureValue", "BrightnessValue", // SRATIONAL "ExposureBiasValue", // SRATIONAL "MaxApertureValue", "SubjectDistance", "FocalLength", "FlashEnergy", "FocalPlaneXResolution", "FocalPlaneYResolution", "ExposureIndex", "DigitalZoomRatio", // Listed as RATIONAL or SRATIONAL with more than 1 count. "LensSpecification", nullptr }; static const string_vector exif_float (exif_float_fields); static const octave_idx_type n_exif_float = exif_float.numel (); for (octave_idx_type field = 0; field < n_exif_float; field++) fill_exif_floats (camera, cimg, exif_float[field]); // Inside a Exif field, it is possible that there is also a // GPS field. This is not the same as ExifVersion but seems // to be how we have to check for it. if (cimg.attribute ("EXIF:GPSInfo") != "unknown") { // The story here is the same as with Exif. // See Section 4.6.6, table 15 on page 68 of Exif specs // version 2.3 (CIPA DC- 008-Translation- 2010) static const char *gps_str_fields[] = { "GPSLatitudeRef", "GPSLongitudeRef", "GPSAltitudeRef", "GPSSatellites", "GPSStatus", "GPSMeasureMode", "GPSSpeedRef", "GPSTrackRef", "GPSImgDirectionRef", "GPSMapDatum", "GPSDestLatitudeRef", "GPSDestLongitudeRef", "GPSDestBearingRef", "GPSDestDistanceRef", "GPSDateStamp", nullptr }; static const string_vector gps_str (gps_str_fields); static const octave_idx_type n_gps_str = gps_str.numel (); for (octave_idx_type field = 0; field < n_gps_str; field++) fill_exif (gps, cimg, gps_str[field]); static const char *gps_int_fields[] = { "GPSDifferential", nullptr }; static const string_vector gps_int (gps_int_fields); static const octave_idx_type n_gps_int = gps_int.numel (); for (octave_idx_type field = 0; field < n_gps_int; field++) fill_exif_ints (gps, cimg, gps_int[field]); static const char *gps_float_fields[] = { "GPSAltitude", "GPSDOP", "GPSSpeed", "GPSTrack", "GPSImgDirection", "GPSDestBearing", "GPSDestDistance", "GPSHPositioningError", // Listed as RATIONAL or SRATIONAL with more than 1 count. "GPSLatitude", "GPSLongitude", "GPSTimeStamp", "GPSDestLatitude", "GPSDestLongitude", nullptr }; static const string_vector gps_float (gps_float_fields); static const octave_idx_type n_gps_float = gps_float.numel (); for (octave_idx_type field = 0; field < n_gps_float; field++) fill_exif_floats (gps, cimg, gps_float[field]); } } info_frame.setfield ("DigitalCamera", octave_value (camera)); info_frame.setfield ("GPSInfo", octave_value (gps)); } info.fast_elem_insert (frame, info_frame); } if (format == "GIF") { static std::map<octave_idx_type, std::string> disposal_methods = init_disposal_methods (); string_vector methods (nFrames); for (octave_idx_type frame = 0; frame < nFrames; frame++) methods[frame] = disposal_methods[imvec[frame].gifDisposeMethod ()]; info.setfield ("DisposalMethod", Cell (methods)); } else info.setfield ("DisposalMethod", Cell (dim_vector (nFrames, 1), octave_value (""))); return ovl (info); #else octave_unused_parameter (args); err_disabled_feature ("imfinfo", "Image IO"); #endif } /* ## No test needed for internal helper function. %!assert (1) */ DEFUN (__magick_formats__, args, , doc: /* -*- texinfo -*- @deftypefn {} {} __magick_imformats__ (@var{formats}) Fill formats info with GraphicsMagick CoderInfo. @seealso{imfinfo, imformats, imread, imwrite} @end deftypefn */) { if (args.length () != 1 || ! args(0).isstruct ()) print_usage (); octave_map formats = args(0).map_value (); #if defined (HAVE_MAGICK) maybe_initialize_magick (); for (octave_idx_type idx = 0; idx < formats.numel (); idx++) { try { octave_scalar_map fmt = formats.checkelem (idx); Magick::CoderInfo coder (fmt.getfield ("coder").string_value ()); fmt.setfield ("description", octave_value (coder.description ())); fmt.setfield ("multipage", coder.isMultiFrame () ? true : false); // default for read and write is a function handle. If we can't // read or write them, them set it to an empty value if (! coder.isReadable ()) fmt.setfield ("read", Matrix ()); if (! coder.isWritable ()) fmt.setfield ("write", Matrix ()); formats.fast_elem_insert (idx, fmt); } catch (Magick::Exception& e) { // Exception here are missing formats. So we remove the format // from the structure and reduce idx. formats.delete_elements (idx); idx--; } } #else formats = octave_map (dim_vector (1, 0), formats.fieldnames ()); #endif return ovl (formats); } /* ## No test needed for internal helper function. %!assert (1) */