在Octave中加载图像并转成灰度图时,发现rgb2gray()函数不存在,上网搜了一下,stackoverflow上给出了相关解释,如下:
The problem is that you didn‘t load your packages. When you type pkg list
you can find which ones are loaded by an asterisk in front of their names. Load a package with
pkg load image
.
Having to load a packages is that thing that most users find strange but if you compare with other languages, such as Python, Perl, or C++, would you expect them to
import
, use
, or #include
every libraries available in the system by default? See
Octave‘s FAQ for more details.
原来Octave缺省状态下缺少相关包,比如图像处理、信号处理方面的包,需要我们手动安装。
去sourceforge上下载相关包,放在Octave的搜索路径上,在Octave的命令行中执行安装命令:
pkg install -forge package_name
rgb2gray()函数需要安装image包。
附一下sourceforge上Octave的相关包:
Packages
These packages are meant for current versions of Octave. See the unmaintainedsection for information on older versions.
bim
Package for solving Diffusion Advection Reaction (DAR) Partial Differential Equations
bsltl
The BSLTL package is a free collection of OCTAVE/MATLAB routines for working with the biospeckle laser technique
cgi
Common Gatway Interface for Octave
communications
Digital Communications, Error Correcting Codes (Channel Code), Source Code functions, Modulation and Galois Fields
control
Computer-Aided Control System Design (CACSD) Tools for GNU Octave, based on the proven SLICOT Library
data-smoothing
Algorithms for smoothing noisy data
database
Interface to SQL databases, currently only postgresql using libpq
dataframe
Data manipulation toolbox similar to R data
dicom
Digital communications in medicine (DICOM) file io
divand
divand performs an n-dimensional variational analysis (interpolation) of arbitrarily located observations
doctest
The Octave-Forge Doctest package finds specially-formatted blocks of example code within documentation files
econometrics
Econometrics functions including MLE and GMM based techniques
fem-fenics
pkg for the resolution of partial differential equations based on fenics
financial
Monte Carlo simulation, options pricing routines, financial manipulation, plotting functions and additional date manipulation tools
fits
The Octave-FITS package provides functions for reading, and writing FITS (Flexible Image Transport System) files
fl-core
The package contains code for basic functions in Fuzzy Logic for Octave
fpl
Collection of routines to export data produced by Finite Elements or Finite Volume Simulations in formats used by some visualization programs
fuzzy-logic-toolkit
A mostly MATLAB-compatible fuzzy logic toolkit for Octave
ga
Genetic optimization code
general
General tools for Octave
generate_html
This package provides functions for generating HTML pages that contain the help texts for a set of functions
geometry
Library for geometric computing extending MatGeom functions
image
The Octave-forge Image package provides functions for processing images
image-acquisition
The Octave-forge Image Aquisition package provides functions to capture images from connected devices
instrument-control
Low level I/O functions for serial, i2c, parallel, tcp, gpib, vxi11 and usbtmc interfaces
interval
The interval package for real-valued interval arithmetic allows one to evaluate functions over subsets of their domain
io
Input/Output in external formats.
java
Provides Java interface with OO-like Java objects manipulation
level-set
Routines for calculating the time-evolution of the level-set equation and extracting geometric information from the level-set function
linear-algebra
Additional linear algebra code, including general SVD and matrix functions
lssa
A package implementing tools to compute spectral decompositions of irregularly-spaced time series
ltfat
The Large Time/Frequency Analysis Toolbox (LTFAT) is a Matlab/Octave toolbox for working with time-frequency analysis, wavelets and signal processing
mapping
Simple mapping and GIS .shp and raster file functions
mechanics
Library with functions useful for numerical computation in classical mechanics and structural analysis
miscellaneous
Miscellaneous tools that don‘t fit somewhere else
mpi
Octave bindings for basic Message Passing Interface (MPI) functions for parallel computing
msh
Create and manage triangular and tetrahedral meshes for Finite Element or Finite Volume PDE solvers
mvn
Multivariate normal distribution clustering and utility functions
nan
A statistics and machine learning toolbox for data with and w/o missing values
ncarray
Access a single or a collection of NetCDF files as a multi-dimensional array
netcdf
A MATLAB compatible NetCDF interface for Octave
nurbs
Collection of routines for the creation, and manipulation of Non-Uniform Rational B-Splines (NURBS), based on the NURBS toolbox by Mark Spink
ocs
Package for solving DC and transient electrical circuit equations
octcdf
A NetCDF interface for octave
octclip
This package allows to do boolean operations with polygons using the Greiner-Hormann algorithm
octproj
This package allows to call functions of PROJ
odepkg
A package for solving ordinary differential equations and more
optics
Functions covering various aspects of optics
optim
Non-linear optimization toolkit
optiminterp
An optimal interpolation toolbox for octave
parallel
Parallel execution package
quaternion
Quaternion package for GNU Octave, includes a quaternion class with overloaded operators
queueing
The queueing package provides functions for queueing networks and Markov chains analysis
secs1d
A Drift-Diffusion simulator for 1d semiconductor devices
secs2d
A Drift-Diffusion simulator for 2d semiconductor devices
secs3d
A Drift-Diffusion simulator for 3d semiconductor devices
signal
Signal processing tools, including filtering, windowing and display functions
sockets
Socket functions for networking from within octave
sparsersb
Interface to the librsb package implementing the RSB sparse matrix format
specfun
Special functions including ellipitic functions, etc
splines
Additional spline functions
statistics
Additional statistics functions for Octave
stk
The STK is a (not so) Small Toolbox for Kriging
strings
Additional functions for manipulation and analysis of strings
struct
Additional Structure manipulations functions
symbolic
The Octave-Forge Symbolic package adds symbolic calculation features to GNU Octave
tisean
Port of TISEAN 3
tsa
Stochastic concepts and maximum entropy methods for time series analysis
video
A wrapper for ffmpeg‘s libavformat and libavcodec, implementing addframe, avifile, aviinfo and aviread
vrml
3D graphics using VRML
windows
Provides COM interface and additional functionality on Windows
zeromq
ZeroMQ bindings for GNU Octave
Renamed or moved packages
Some packages have been renamed or merged over time. When thishappens, a dummy transitional package is created -- empty anddependent on its new package. After some time, those are removedas well. The following is a list of such packages:
- combinatorics -merged into miscellaneous and specfun
- openmpi_ext - renamed mpi.
- physicalconstants - merged into miscellaneous.
- time - merged into financial.
Unmaintained packages
The Octave Forge project is a location to develop multiple packages for GNUOctave. With time, some packages become unmaintained, usually because the originalauthor no longer requires it and no one steps up to take its position. Without amaintainer or active
user base, and as Octave evolves, we do not know how usablethey are, so we can no longer honestly recommend their use.
They are still stored and release tarballs can be downloaded from ourFile Release System(same for the very oldmonolithic
releases) .However, many of them have accumulated bug fixes and new features in themercurial orSVNrepositories,
it simply happens that no maintainer has prepared a release.Because of this, we encourage users to check the development sources, not the releasedtarballs. Furthermore,bug reports for
those packagescontinue to be welcome, and anyone wishing to take up the position of maintainer, please contactus through themaintainers mailing list.
The complete list of unmaintained packages is:
- actuarial
- ad
- ann
- audio
- benchmark
- bioinfo
- civil-engineering
- engine
- fenv
- gnuplot
- gsl
- informationtheory
- integration
- irsa
- missing-functions
- multicore
- nlwing2
- nnet
- oct2mat
- octgpr
- odebvp
- outliers
- pdb
- plot
- simp
- special-matrix
- symband
- tcl-octave
- xraylib
- zenity
参考:
[1]:http://octave.sourceforge.net/
[2]:http://octave.sourceforge.net/packages.php