how to display the image
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
RAMESH MUNIRATHINAM
el 2 de Dic. de 2014
Comentada: RAMESH MUNIRATHINAM
el 6 de Dic. de 2014
I=process(x,y,z) % "process" is the sub problem called in the main program to produce some output
Imshow(I) % displays the image
imwrite(I,path) % it does not save that image
instead it gives me the error that "the file format is not found from file name"
i tried using imsave % it works but i have to give the location and hence not suitable for large data
i have to save some 120 images that is not possible using imsave
someone pls help me how to save the image I which is displayed using imshow
4 comentarios
Stephen23
el 3 de Dic. de 2014
Editada: Stephen23
el 3 de Dic. de 2014
Please read my comment again: I did not write that you defined path as the function name, I wrote that path is being used as a variable name. However, note that both of these cases are best avoided, as path is an inbuilt function and shadowing inbuilt functions can cause problems that you really want to avoid.
Respuesta aceptada
Stephen23
el 3 de Dic. de 2014
Editada: Stephen23
el 3 de Dic. de 2014
According the imwrite documentation , there are several accepted input combinations:
imwrite(A,filename,fmt)
imwrite(X,map,filename,fmt)
imwrite(...,filename)
or online:
imwrite(A,filename)
imwrite(A,map,filename)
imwrite(___,fmt)
In your case you are only supplying one image A and the filename. The documentation states that in this case " imwrite(A,filename) writes image data A to the file specified by filename, inferring the file format from the extension. imwrite creates the new file in your current folder". Note that filename (which should not be named path, as you have done) must therefore include the image file extension. Without this, I also get exactly the same error as you:
>> load spine
>> imshow(X,map)
>> imwrite(X,map,'temp1')
??? Error using ==> imwrite at 435
Unable to determine the file format from the filename.
>> imwrite(X,map,'temp1.png')
>>
Note how I specify the image file format in filename, and it does not throw an error. You also need to specify the image file format, either within filename or in the fmt variable.
And do not use path as the name of your filename variable.
5 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Convert Image Type en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!