How to extract highest intensity area from a greyscale spectrogram?

Hello.
I got greyscale mel-spectrograms images from a dataset and I want to divide it into several areas and to obtain the area where pixels have highest intensity in average.
This will be useful to label the images with rectangles for a deep learning training.
Hope somebody will help me.
I attach a greyscale spectrogram I got where you can show me the way to do it.
Thank you.

 採用された回答

Image Analyst
Image Analyst 2021 年 1 月 23 日

1 投票

You've given no criteria for how those areas are to be determined. You might want to use watershed() or superpixels(). Or use imbinarize() to segment on intensity (adaptive or global), or multithresh() for several global thresholds.

3 件のコメント

Claudio Eutizi
Claudio Eutizi 2021 年 1 月 23 日
編集済み: Claudio Eutizi 2021 年 1 月 23 日
I wanted to divide the image equally in some areas(e.g: if the image is 224x224, 16 blocks with 56x56 pixel each) and to find the area that has highest average intensity.
I managed to split the image with a guide I found here on MATLAB answers and then i wrote the code for the intensity calculation.
Image Analyst
Image Analyst 2021 年 1 月 23 日
Oh, OK. I would have used blockproc() if you wanted rectangular blocks but glad you solved it somehow.
I'm attaching several blockproc() demos in case you're still interested.
Claudio Eutizi
Claudio Eutizi 2021 年 1 月 23 日
Thank you so much.

サインインしてコメントする。

その他の回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 1 月 22 日
編集済み: KALYAN ACHARJYA 2021 年 1 月 22 日

1 投票

  1. Apply thresholding to cluster the image into two segment, certain higher pixel and lower value pixels.
  2. Get the largest blob as per requirement. (bwareafilt function)
What does "Major Intensity" mean here?

5 件のコメント

Claudio Eutizi
Claudio Eutizi 2021 年 1 月 22 日
I've just edited the question. I mean highest intensity.
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 1 月 22 日
編集済み: KALYAN ACHARJYA 2021 年 1 月 22 日
Lets say, the grayscale image is grayImage
temp=grayImage;
extract_roi=grayImage==max(grayImage(:));
temp(~extract_roi)=0;
imshow(temp); % Extracted ROI Image as temp variable
Claudio Eutizi
Claudio Eutizi 2021 年 1 月 22 日
編集済み: Claudio Eutizi 2021 年 1 月 22 日
Thank you for the answer, but this code you wrote here shows a black image.
'temp' variable is a 224x224 logical with all 0s and only the pixel with the highest intensity with 1.
I'll explain my problem better:
For instance: In this image there are different frequencies, some of them with low intensity and other ones with high intensity.
I want to divide this image in different areas that will contain the same number of pixel, calculate the average of the pixel's intensities and choose the area that has the highest one.
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 1 月 23 日
編集済み: KALYAN ACHARJYA 2021 年 1 月 23 日
"but this code you wrote here shows a black image".
Most probably, there is only one maximum value pixel, so it is not easily visualized (check carefully). You can confirm the same with the extract_roi matrix, which must be the non-zero matrix.
Claudio Eutizi
Claudio Eutizi 2021 年 1 月 23 日
Yes I found that pixel you're talking about.
I managed to do what I asked to in this question.
Can you help me with this? Thank you so much.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

製品

リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by