필터 지우기
필터 지우기

How can i calculate the entropy of the region of interest of an RGB image?

조회 수: 2 (최근 30일)
I know how to calculate the entropy of an RGB image.First ,vectorize the image and finally use it as a parameter of the entropy() function.
image_vector = double(original_RGB_image(:));
entropy_of_the_image = entropy(image_vector);
But what should we do to calculate the entropy of the region of interest of image?
I know one approach.Somehow,convert it into a black-white image(white=1) and use the inverse of the black-white image as a parameter of the original RGB image.I think,then the background color will be black .But it doesnot work.The background(sourrounding) became blue(something like that) instead of black? what should i do? Here is my code...
a=imread('ISIC_0000001 w.jpg');
a=imresize(a,[300 300]);
mkr=a;
figure,
imshow(mkr);
im=rgb2gray(a);
level=graythresh(im);
a=im2bw(im,level);
figure,
imshow(a);
mkr(a)=nan;
figure,
imshow(mkr);

채택된 답변

Image Analyst
Image Analyst 2017년 8월 19일
편집: Image Analyst 2017년 8월 19일
You can do this:
entropyWithinMask = entropy(im(a));
You might also want to look at entropyfilt() for a spatial filter based on entropy.
  댓글 수: 3
Walter Roberson
Walter Roberson 2017년 8월 20일
편집: Walter Roberson 2017년 8월 20일
"Entropy is defined as
-sum(p.*log2(p))
where p contains the histogram counts returned from imhist."
This does not imply that an image with more colors has higher entropy: it depends on how the bins are distributed.
Sadia Iffat
Sadia Iffat 2017년 8월 20일
So,why entropy is used for image classification? How can i understand when i should measure entropy for the classification problem?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by