How to normalize heatmap image and find the shape info

조회 수: 11 (최근 30일)
Mohamed Elbeialy
Mohamed Elbeialy 2021년 4월 20일
답변: Darshak 2025년 2월 21일
The following heatmap image is non-normalized and includes RCS info. How to normalize it and use the shape of the object for classification instead of RCS?

답변 (1개)

Darshak
Darshak 2025년 2월 21일
Hi Mohamed,
When working with heatmaps for data analysis, I've had similar experiences where MATLAB made the process much more manageable. Below, I've provided a sample code that can be used for the task. Feel free to adapt its individual components for other needs as well.
heatmapImage = imread('your_heatmap_image.png');
if size(heatmapImage, 3) == 3
heatmapImage = rgb2gray(heatmapImage);
end
normalizedHeatmap = normalize(double(heatmapImage));
figure;
imshow(normalizedHeatmap, []);
title('Normalized Heatmap');
binaryImage = imbinarize(normalizedHeatmap);
stats = regionprops(binaryImage, 'Area', 'Perimeter', 'BoundingBox', 'Centroid');
figure;
imshow(binaryImage);
hold on;
for k = 1:length(stats)
rectangle('Position', stats(k).BoundingBox, 'EdgeColor', 'r', 'LineWidth', 1);
end
title('Extracted Shapes');
hold off;
The result for the given image is as follows:
There are multiple functions used here, you can explore the same using the following commands:
  • “doc normalize”
  • “doc imbinarize”
  • “doc regionprops”
I hope this helps with your issue.

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by