On Thu, Nov 17, 2011 at 4:42 PM, Yaowang
<address@hidden> wrote:
Dear Mr. /Ms
There is a problem about "imwrite", which I can not save my matrix
what is the result of a image as follow:
octave:1> x=imread('1149.tiff')
octave:2> imshow(x)
octave:3> y=fft(x);
octave:4> imshow(y)
warning: imshow: only showing real part of complex image
octave:5> imwrite("1149.img",y)
error: Invalid call to imwrite. Correct usage is:
-- Function File: imwrite (IMG, FILENAME, FMT, P1, V1, ...)
-- Function File: imwrite (IMG, MAP, FILENAME, FMT, P1, V1, ...)
Additional help for built-in functions and operators is
available in the on-line version of the manual. Use the command
`doc <topic>' to search the manual index.
Help and information about Octave is also available on the WWW
at http://www.octave.org and via the address@hidden
mailing list.
I also try with other ways, like that
imwrite('1149.tif', y)
error: Invalid call to imwrite.
octave:5> imwrite(y, "1149.tif")
error: invalid conversion from complex matrix to uint8 matrix
error: called from:
error: /usr/share/octave/3.2.4/m/image/imwrite.m at line 109,
column 13
octave:5> imwrite(y, "1149.tif",tif)
error: `tif' undefined near line 5 column 23
error: evaluating argument list element number 3
error: evaluating argument list element number 1
So could you tell me what is the problem and how to solve it? Thank
you very much!
Yaowang
Leiden Institute of Chemistry
First off, you need to make sure that you have your arguments in the correct order. From the help file (from typing "help imwrite") you get that the arguments are:
Function File: imwrite (IMG, FILENAME, FMT, P1, V1, ...)
where IMG is your array, FILENAME is the string for your filename, and FMT (though they don't spell it out well in the help file) is the format of the image as a string, so your second try used the correct order:
octave:5> imwrite(y, "1149.tif")
Where the FMT was implied (it is an optional argument).