问题描述
我是图像处理的新手,我想做的是调整图像的大小并以tif格式存储它,但是命令窗口报告一个错误,提示您没有写权限"
I am new to image processing and what I am trying to do is resize an image and store it in tif format, but command window reports an error saying "you don't have the permission to write"
我的代码是imwrite(B,'myNewFile.tif');
运行后会显示
my code is imwrite(B,'myNewFile.tif');
and after running it shows
在编写上面的代码之前,我是否必须创建名称为'myNewFile'
的文件?
Do I have to create a file by the name 'myNewFile'
before writing the above code?
推荐答案
错误消息指出,您正在尝试将文件myNewFile.tif
写入当前工作目录.但是,您没有当前工作目录的书面许可.这是一个操作系统问题,而不是Matlab问题.
As the error message states, you are trying to write the file myNewFile.tif
to the current working directory. However, you do not have writing permission in the current working direcoty. This is an OS issue, not a Matlab one.
您可以做的是更改当前工作目录(使用cd
命令),然后将映像写入您确实具有写许可权的其他文件夹中.
What you can do is change the current working directory (using cd
command) and write the image to a different folder where you do have writing permissions.
或者,您可以提供图像文件名的完整路径,将其定向到您具有写权限的文件夹中.
Alternatively, you can supply a full path to the image file name, directing it to a folder where you have writing permissions.
imwrite( B, fullfile( '/path/to/where/you/can/write', 'myNewFile.tif' ) );
以下是一些可以帮助您的Matlab命令说明的链接:
Here are links to the description of some Matlab commands that might help you:
这篇关于使用imwrite时遇到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!