How to find entropy of Depth images in Matlab? - image

I want to compute depth entropy of a depth image in Matlab (same as this work ). Unfortunately, the authors don't reply my emails. There is a function,"entropyfilt", that compute the local entropy of grayscale image. I've used this function with a depth input image that captured by Kinect but it hasn't worked probably. Here is my input depth image:
Here is the code used for entropy computing:
J = entropyfilt(Depth);
imshow(mat2gray(J))
Sorry, My "reputation view" isn't enough, so I can't upload my result image.
How can I compute entropy image of a depth image? I want to acquire an image same as figure 4 in above paper.
Thanks in advance.

It is written in the paper, for each pixel you first extract two patches from the image, then you calculate the entropy of each patch. The formula for which is also in the paper and well-known in statistics.
If you want to use the function entropyfilt, you need to provide as a second argument a mask image that describes the patch (all pixels within the patch need to be 1 in the mask, others need to be 0). This is detailed in the documentation of said function.
The authors generate one color image from two entropy images. How they do so they seemingly forgot to mention.
I think the paper is low quality.

image1= imread('where is located ')
entropy(image1)
imshow(image1)

Related

MATALB Kinnect sensor depth image(Too Dark)

I am using Kinect2 with Matlab; however, the depth images shown in the video stream are much brighter than when I saved it in Matlab?
do you know the solution for this problem
Firstly, you should provide the code that you are using at the moment so we can see where you are going wrong.. this is a generic advice for posting on any forum; to provide with all your information, so others can help.
If you use the histogram to check your depth values, you will see that the image is a uint8 image with values from 0 to 255. And since the depth distances are scaled to grayscale value, the values are scaled to new values and using imshow, will not provide enough contrast.
An easy workaround for displaying images is to use any type of
histogram equalization such as
figure(1);
C= adapthisteq(A, 'clipLimit',0.02,'Distribution','rayleigh');
imshow(C);
The image will be contrast adjusted for display.
I used mat2gray and it solved the problem.

Applying an image as a mask in matlab

I am a new user on image processing via Matlab. My first aim is applying the article and comparing my results and authors' results.
The article can be found here: http://arxiv.org/ftp/arxiv/papers/1306/1306.0139.pdf
First problem, Image Quality: In Figure 7, masks are defined but I couldn't reach the mask data set, and I use the screenshot so image quality is low. In my view, it can effect the results. Is there any suggestions?
Second problem, Merging images: I want to apply mask 1 on the Lena. But I don't want to use paint =) On the other hand, is it possible merging the images and keeping the lena?
You need to create the mask array. The first step is probably to turn your captured image from Figure 7 into a black and white image:
Mask = im2bw(Figure7, 0.5);
Now the background (white) is all 1 and the black line (or text) is 0.
Let's make sure your image of Lena that you got from imread is actually grayscale:
LenaGray = rgb2gray(Lena);
Finally, apply your mask on Lena:
LenaAndMask = LenaGray.*Mask;
Of course, this last line won't work if Lena and Figure7 don't have the same size, but this should be an easy fix.
First of all, You have to know that this paper is published in archive. when papers published in archive it is always a good idea to know more about the author and/or the university that published the paper.
TRUST me on that: you do not need to waste your time on this paper.
I understand your demand: but it is not a good idea to do get the mask by doing print screen. The pixel values that can be achieved by using print screen may not be the same as the original values. The zoom may change the size. so you need to be sure that the sizes are the same.
you can do print screen. past the image.
crop the mask.
convert rgb to gray scale.
threshold the gray scale to get the binary.
if you saved the image as jpeg. distortions because of high frequency edges will change edge shape.

Image sort with matlab

I am trying to do some kind of image sorting.
I have 5 images and first one is my main image. I am trying to sort images according to their similarity.(Most similar image to less similar image).
Matlab had matchfeature method but I dont think I jave used it correctly because my results are wrong.I try to use:
[indexPairs,matchmetric] = matchFeatures(features1,features2,"MatchThreshold,10")
then i try to sort the matchmetric array.But it didnt work
Can anyone tell me some algorithm or any tips ?Thank you..
You could compute the correlation coefficient between every images and your main image and then sort them based on the coefficient.
doc corr2
For example, let's say you store all your images in a cell array (called ImageCellArray) in which the first image is your "main image":
for i = 2:size(ImageCellArray,2) % size(ImageCellArray,2) is the total # of images, i.e. the size of the cell array containing them.
CorrCoeff(i) = corr2(rgb2gray(ImageCellArray{1}),rgb2gray(ImageCellArray{i}));
end
[values indices] = sort(CorrCoeff); % sort the coefficients and get the number of the corresponging image.
Then you're good to go I guess.
You could compute the PSNR (peak signal-to-noise ratio) for each image compared to the main image. PSNR is a metric commonly used to measure the quality of a reconstructed compression against the original image.
It's implemented in Matlab in the Computer Vision System toolbox as a functional block, and there is also a psnr function in the Image Processing toolbox. The result will be a number in decibels you could use to rank the images. A higher PSNR value indicates greater similarity.
Take a look at this example of image retrieval. Instead of matching the features between pairs of images it uses the KDTreeSearcher from the Statistics Toolbox to find nearest neighbors of each feature from the query image across the whole set of database images.

entropyfilt in OpenCV

I am working on an image processing project and I have to use entopyfilt (from matlab).
I researched and found some information to do it but not enough. I can calculate the entropy value of an image, but I don't know how to write an entropy filter. There is a similar question in the site, but I also didn't understand it.
Can anybody help me to understand entropy filter?
From the MATLAB documentation:
J = entropyfilt(I) returns the array J, where each output pixel contains the entropy value of the 9-by-9 neighborhood around the corresponding pixel in the input image I. I can have any dimension. If I has more than two dimensions, entropyfilt treats it as a multidimensional grayscale image and not as a truecolor (RGB) image. The output image J is the same size as the input image I.
For each pixel, you look at the 9 by 9 area around the pixel and calculate the entropy. Since the entropy calculation is a nonlinear calculation, it is not something you can do with a simple kernel filter. You have to loop over each pixel and do the calculation on a per-pixel basis.

Choosing an area on the image for classification

If anybody is familiar with classification in remote sensing
you know at first we should choose a region on the image and use information on this region to extract statistical parameters.
how can I choose this area of the image in matlab?
I think I found the answer to my own question.
As our friend user2466766 said I used roipoly to have a mask image and then I multiplied this mask with my image using '.*'.
then I extracted nonzero elements of the resulted matrix with the function nonzeros.
and know I have the digital numbers of the region within the polygon in a columnal matrix that can be used to calculate statistical parameters like variance, mean and etc
Try roipoly. It allows you to create a mask image. If you are looking for more flexibility you can use poly2mask.

Resources