Average value of H in HSV of a picture
2 ビュー (過去 30 日間)
古いコメントを表示
I was asked to divide a jpg picture to several parts with equal area. And I need to get average value of H in HSV of the picture. I want to know how to get the average value of H.
0 件のコメント
採用された回答
Jan
2012 年 9 月 10 日
編集済み: Jan
2012 年 9 月 10 日
Calculate the mean over 4x4 blocks:
RGB = rand(100, 200, 3);
HSV = rgb2hsv(RGB);
H = HSV(:, :, 1);
meanH = mean(H(:));
BlockH = reshape(H, 4, 25, 4, 50);
meanBlockH = reshape(sum(sum(H, 1), 3), 25, 50) / 16;
Care about the overflow, when you use UINT8 images.
3 件のコメント
Jan
2012 年 9 月 11 日
Exactly as shown in my example:
BlockH = reshape(H, 16, 40, 16, 30);
meanBlockH = reshape(sum(sum(H, 1), 3), 40, 30) / 256;
その他の回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!