請問Octave要怎麼像matlab一樣讀取圖片

OOo,TeX,KO,ABI,GIMP,Picasa,ProE,QCAD,Inkscape,Kicad,Eagle
回复
uranus0206
帖子: 129
注册时间: 2006-06-03 5:10
送出感谢: 0
接收感谢: 0

請問Octave要怎麼像matlab一樣讀取圖片

#1

帖子 uranus0206 » 2007-06-21 5:15

我這樣下指令,卻得到錯誤...

[I,map]=imread('test.tif');
error: element number 2 undefined in return list
error: evaluating assignment expression near line 3, column 8
xaerochina
帖子: 67
注册时间: 2007-02-10 21:14
来自: The Earth
送出感谢: 0
接收感谢: 0
联系:

#2

帖子 xaerochina » 2007-06-27 11:13

没事多help:
help imread
imread is the user-defined function from the file
/usr/share/octave/site/m/octave-forge/image/imread.m

IMREAD: read images into octave from various file formats

Note: this requires the ImageMagick "convert" utility
get this from www.imagemagick.org if required
additional documentation of options is available from the
convert man page

BASIC USAGE:
img = imread( fname )
- img is a greyscale (0-255) of image in fname
[im,map]=imread( fname )
- map is a matrix of [r,g,b], 0-1 triples
- img is a matrix on indeces into map
[r,g,b]= imread( fname )
- r,g,b are red,green,blue (0-255) compondents

Formats for image fname
1. simple guess from extention ie "fig.jpg", "blah.gif"
2. specify explicitly "jpg:fig.jpg", "gif:blah.gif"
[b] 3. specify subimage for multi-image format "tiff:file.tif[3]"[/b]
4. raw images (row major format) specify geometry
"raw:img[256x180]"

IMREAD OPTIONS:
imread will support most of the options for convert.1

img = imread( fname , options)
[r,g,b]= imread( fname , options)

where options is a string matrix (or list) of options

example: options= ["-rotate 25";
"-crop 200x200+150+150";
"-sample 200%" ];
will rotate, crop, and then expand the image.
note that the order of operations is important

The following options are supported
-antialias remove pixel-aliasing
-blur geometry blur the image
-border geometry surround image with a border of color
-bordercolor color border color
-colors value maximum number of colors in the image
-contrast enhance or reduce the image contrast
-crop geometry preferred size and location of the cropped image
-despeckle reduce the speckles within an image
-dither apply Floyd/Steinberg error diffusion to image
-draw string annotate the image with a graphic primitive
-edge radius apply a filter to detect edges in the image
-emboss radius emboss an image
-enhance apply a digital filter to enhance a noisy image
-equalize perform histogram equalization to an image
-filter type use this filter when resizing an image
-flip flip image in the vertical direction
-flop flop image in the horizontal direction
-font name font for rendering text
-frame geometry surround image with an ornamental border
-fuzz distance colors within this distance are considered equal
-gamma value level of gamma correction
-geometry geometry perferred size or location of the image
-gaussian geometry gaussian blur an image
-gravity type vertical and horizontal text placement
-implode amount implode image pixels about the center
-intent type Absolute, Perceptual, Relative, or Saturation
-interlace type None, Line, Plane, or Partition
-level value adjust the level of image contrast
[后面省略。。。]
urmysweety
帖子: 99
注册时间: 2006-06-09 9:37
送出感谢: 0
接收感谢: 0

#3

帖子 urmysweety » 2007-06-27 19:42

我尝试了下,jpg格式的可以读入,bmp格式的不行,应该是现在还不支持。
xf3i
帖子: 82
注册时间: 2007-08-03 14:37
送出感谢: 0
接收感谢: 0
联系:

#4

帖子 xf3i » 2008-04-03 22:10

我的octave 2.9.19怎么没有imread这个函数?我倒现在也不知道octave能够读入什么格式的图片,出了它自己的img文件
回复

回到 “办公、图像、机械电子设计等”