I am encountering an error while using imwrite

前端 未结 1 1289
自闭症患者
自闭症患者 2021-01-25 19:43

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 permissio

1条回答
  •  失恋的感觉
    2021-01-25 20:25

    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.

    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' ) );
    

    Here are links to the description of some Matlab commands that might help you:

    • pwd can be used to check what is your current working directory.
    • You can use cd to change the current working directory.
    • fullfile helps you construct file names and paths in a generic way without worrying about OS pecularities.

    0 讨论(0)
提交回复
热议问题