error in writing an image
10 ビュー (過去 30 日間)
古いコメントを表示
I have an error in the code below in writing an image please help
imwrite((gsq, []),strtemp)
Expression or statement is incorrect--possibly unbalanced (, {, or [
I have posted question regarding this and have got answer,but still getting same error
0 件のコメント
採用された回答
Image Analyst
2011 年 12 月 10 日
Why do you have the () and [] in there? You're supposed to be passing a numerical array and a string that is the filename. Did you look up the help for imwrite?
8 件のコメント
Image Analyst
2011 年 12 月 12 日
You use [] when displaying a floating point image in imshow. That will scale it for display. Otherwise it expects the image to be in the range 0-1 and if you have values outside that it will clip them and only show you the pixels that ARE within the range 0-1, which may be very very few, if any, pixels. So, you basically see all black if you don't use [] with imshow and you're displaying a floating point image. Now, with your imwrite, it normally wants an integer image. Exactly what do you think you're doing when you do (gsq, [])? Why are you doing that instead of simply gsq? Why??? We've told you a few times now: use [] with imshow, NOT with imwrite. Please believe us. And why didn't you cast gsq into an integer, scaling it if necessary, like Walter suggested? Please please do that. At least give it a try. If you really need to save it as a floating point image for later use in MATLAB, then I recommend saving the variable in a .mat file using save() instead of using imwrite().
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!