Image shows with imshowpair, but not with imshow
3 ビュー (過去 30 日間)
古いコメントを表示
Ashley Salisbury
2020 年 7 月 22 日
回答済み: Constantino Carlos Reyes-Aldasoro
2020 年 7 月 22 日
I am writing a function that reads an image and converts it to BW. I am able to use imshowpair to display the unedited and edited images next to each other, but can't individually show just the edited (BW) image. What should I do?
midAirImage = imread("MidAirTest.jpg");
bwImage = imbinarize(midAirImage,'adaptive','ForegroundPolarity','dark','Sensitivity',0.4);
imshowpair(midAirImage, bwImage, 'montage')
0 件のコメント
採用された回答
Abhishek Gangwar
2020 年 7 月 22 日
編集済み: Abhishek Gangwar
2020 年 7 月 22 日
Your binary image should be 2 dimensional, if it is not convert the original image into gray cale and then create binary image,
midAirImage = imread("MidAirTest.jpg");
midAirImage = rgb2gray(midAirImage);
bwImage = imbinarize(midAirImage,'adaptive','ForegroundPolarity','dark','Sensitivity',0.4);
imshowpair(midAirImage, bwImage, 'montage')
imshow(bwImage);
その他の回答 (1 件)
Constantino Carlos Reyes-Aldasoro
2020 年 7 月 22 日
You have two options, use subplots
subplot(121)
imagesc(midAirImage)
subplot(122)
imagesc( bwImage)
Alternatively you can concatenate your images like this
imagesc( [ midAirImage bwImage])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/335583/image.jpeg)
Notice that the binary will be between 0 and 1 and the original between 0 and 255 so you need to scale:
imagesc( [ midAirImage 255*bwImage])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/335586/image.jpeg)
Hope this helps to solve your problem.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!