在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
detailsdownload
bsltl
The BSLTL package is a free collection of OCTAVE/MATLAB routines for working with the biospeckle laser technique
detailsdownload
cgi
Common Gatway Interface for Octave
detailsdownload
communications
Digital Communications, Error Correcting Codes (Channel Code), Source Code functions, Modulation and Galois Fields
detailsdownload
control
Computer-Aided Control System Design (CACSD) Tools for GNU Octave, based on the proven SLICOT Library
detailsdownload
data-smoothing
Algorithms for smoothing noisy data
detailsdownload
database
Interface to SQL databases, currently only postgresql using libpq
detailsdownload
dataframe
Data manipulation toolbox similar to R data
detailsdownload
dicom
Digital communications in medicine (DICOM) file io
detailsdownload
divand
divand performs an n-dimensional variational analysis (interpolation) of arbitrarily located observations
detailsdownload
doctest
The Octave-Forge Doctest package finds specially-formatted blocks of example code within documentation files
detailsdownload
econometrics
Econometrics functions including MLE and GMM based techniques
detailsdownload
fem-fenics
pkg for the resolution of partial differential equations based on fenics
detailsdownload
financial
Monte Carlo simulation, options pricing routines, financial manipulation, plotting functions and additional date manipulation tools
detailsdownload
fits
The Octave-FITS package provides functions for reading, and writing FITS (Flexible Image Transport System) files
detailsdownload
fl-core
The package contains code for basic functions in Fuzzy Logic for Octave
detailsdownload
fpl
Collection of routines to export data produced by Finite Elements or Finite Volume Simulations in formats used by some visualization programs
detailsdownload
A mostly MATLAB-compatible fuzzy logic toolkit for Octave
detailsdownload
ga
Genetic optimization code
detailsdownload
general
General tools for Octave
detailsdownload
generate_html
This package provides functions for generating HTML pages that contain the help texts for a set of functions
detailsdownload
geometry
Library for geometric computing extending MatGeom functions
detailsdownload
image
The Octave-forge Image package provides functions for processing images
detailsdownload
image-acquisition
The Octave-forge Image Aquisition package provides functions to capture images from connected devices
detailsdownload
instrument-control
Low level I/O functions for serial, i2c, parallel, tcp, gpib, vxi11 and usbtmc interfaces
detailsdownload
interval
The interval package for real-valued interval arithmetic allows one to evaluate functions over subsets of their domain
detailsdownload
io
Input/Output in external formats.
detailsdownload
java
Provides Java interface with OO-like Java objects manipulation
detailsdownload
level-set
Routines for calculating the time-evolution of the level-set equation and extracting geometric information from the level-set function
detailsdownload
linear-algebra
Additional linear algebra code, including general SVD and matrix functions
detailsdownload
lssa
A package implementing tools to compute spectral decompositions of irregularly-spaced time series
detailsdownload
ltfat
The Large Time/Frequency Analysis Toolbox (LTFAT) is a Matlab/Octave toolbox for working with time-frequency analysis, wavelets and signal processing
detailsdownload
mapping
Simple mapping and GIS .shp and raster file functions
detailsdownload
mechanics
Library with functions useful for numerical computation in classical mechanics and structural analysis
detailsdownload
miscellaneous
Miscellaneous tools that don't fit somewhere else
detailsdownload
mpi
Octave bindings for basic Message Passing Interface (MPI) functions for parallel computing
detailsdownload
msh
Create and manage triangular and tetrahedral meshes for Finite Element or Finite Volume PDE solvers
detailsdownload
mvn
Multivariate normal distribution clustering and utility functions
detailsdownload
nan
A statistics and machine learning toolbox for data with and w/o missing values
detailsdownload
ncarray
Access a single or a collection of NetCDF files as a multi-dimensional array
detailsdownload
netcdf
A MATLAB compatible NetCDF interface for Octave
detailsdownload
nurbs
Collection of routines for the creation, and manipulation of Non-Uniform Rational B-Splines (NURBS), based on the NURBS toolbox by Mark Spink
detailsdownload
ocs
Package for solving DC and transient electrical circuit equations
detailsdownload
octcdf
A NetCDF interface for octave
detailsdownload
octclip
This package allows to do boolean operations with polygons using the Greiner-Hormann algorithm
detailsdownload
octproj
This package allows to call functions of PROJ
detailsdownload
odepkg
A package for solving ordinary differential equations and more
detailsdownload
optics
Functions covering various aspects of optics
detailsdownload
optim
Non-linear optimization toolkit
detailsdownload
optiminterp
An optimal interpolation toolbox for octave
detailsdownload
parallel
Parallel execution package
detailsdownload
quaternion
Quaternion package for GNU Octave, includes a quaternion class with overloaded operators
detailsdownload
queueing
The queueing package provides functions for queueing networks and Markov chains analysis
detailsdownload
secs1d
A Drift-Diffusion simulator for 1d semiconductor devices
detailsdownload
secs2d
A Drift-Diffusion simulator for 2d semiconductor devices
detailsdownload
secs3d
A Drift-Diffusion simulator for 3d semiconductor devices
detailsdownload
signal
Signal processing tools, including filtering, windowing and display functions
detailsdownload
sockets
Socket functions for networking from within octave
detailsdownload
sparsersb
Interface to the librsb package implementing the RSB sparse matrix format
detailsdownload
specfun
Special functions including ellipitic functions, etc
detailsdownload
splines
Additional spline functions
detailsdownload
statistics
Additional statistics functions for Octave
detailsdownload
stk
The STK is a (not so) Small Toolbox for Kriging
detailsdownload
strings
Additional functions for manipulation and analysis of strings
detailsdownload
struct
Additional Structure manipulations functions
detailsdownload
symbolic
The Octave-Forge Symbolic package adds symbolic calculation features to GNU Octave
detailsdownload
tisean
Port of TISEAN 3
detailsdownload
tsa
Stochastic concepts and maximum entropy methods for time series analysis
detailsdownload
video
A wrapper for ffmpeg's libavformat and libavcodec, implementing addframe, avifile, aviinfo and aviread
detailsdownload
vrml
3D graphics using VRML
detailsdownload
windows
Provides COM interface and additional functionality on Windows
detailsdownload
zeromq
ZeroMQ bindings for GNU Octave
detailsdownload
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