Half plotting problem of spectrogram
2 ビュー (過去 30 日間)
古いコメントを表示
I am producing spectrograms of 10 hour audio in chunks of 4 seconds, by using the "for" loop and storing it in a folder. But many of the spectrograms generated and saved are incomplete. Why it is so? and how I can stop this to happen![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1170918/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1170918/image.jpeg)
This problem is not for all spectrograms, only for 30% of the total.
2 件のコメント
採用された回答
VBBV
2022 年 11 月 7 日
編集済み: VBBV
2022 年 11 月 7 日
imwrite(outputImage, destFile,'Quality',"lossless");
It appears that some part of the image data is being lost during write operation. Try with name value argument specifying quality as lossless
6 件のコメント
VBBV
2022 年 11 月 8 日
編集済み: VBBV
2022 年 11 月 8 日
I = imread('peppers.png');
imshow(I)
[r c] = size(I) % get the size of image
if r == c
outputImage = imresize(I,[r c]); % this could be reason, change using scale value
elseif r < c
outputImage = imresize(I,[r+abs(c-r) c]); ;% this could be reason, change using scale value
elseif r > c
outputImage = imresize(I,[r c+abs(c-r)]);
end
outputImage = imresize(I,[120 c]); % see the difference with fixed row and col values
imshow(outputImage)
% imwrite(outputImage, destFile,"Quality",100); % switch back to normal mode
Note the difference when you use fixed numbers for rows and cols for all image sizes, Try with the higher or scaled values for rows and cols inside the imresize function and switch back to normal mode. May be some images have high resolution with large or different sizes,
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Time-Frequency Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!