how can I calculate the entropy of individual pixels - image

How can I calculate the entropy of individual pixels? The function entropy of matlab calculates the entropy of an image. I want to calculate the entropy of every pixel

As I pointed out in my comment, it is meaningless to ask the entropy of a single pixel.
Having said that, you might want to look at entropyfilt - measuring the entropy of a region around a pixel.

Related

What does the rawintden measurement in ImageJ mean?

I am having trouble understanding the rawintden measurement in imageJ. It outputs numbers as large as 300,000, but pixel intensity is only measured on a scale of 0-255. Why is this scale so much larger and what does the calculation represent?
Thank you for your help!!
The value raw integrated density (RawIntDen) is the sum of all pixel values in the ROI (region of interest). Dividing this value by the number of pixels in the ROI gives the Mean. Since it is the sum of several pixels, its value is usually larger than the bit-depth of the image.
There is another measurement called IntDen which is the Area multiplied by the Mean. In an uncalibrated image, RawIntDen and IntDen are equal.

Can't understand the SIFT keypoint extraction (not description) algorithm

I have read two references about the SIFT algorithm here and here and I am not truly understanding how just some key points are detected considering that the algorithm works on the difference of Gaussians calculated on several resolutions (they call them octaves). Here are the steps from the technique according to what I've understood from the paper.
Given the input image, blur them with Gaussian filters using different sigmas, resulting in Gaussian filtered images. In the paper, they used 5 Gaussian filters per octave (they tell that two adjacent Gaussian filtered images were filtered using sigma and k * sigma gaussian filter parameters), and they consider 4 octaves in the algorithm. So, there are a total of 20 gaussian filtered images (5 per octave), but we will act on 5 Gaussian filtered images from each octave individually.
For each octave, we calculate 4 Difference Of Gaussian images (DOG) from the 5 Gaussian filtered images by just subtracting adjacent Gaussian filtered images. So, now we have a total of 16 difference of Gaussian images, but we will consider 4 Difference of Gaussian images from each octave individually.
Find local extrema (maximum or minimum values) pixels by comparing a pixel in each DOG with 26 neighbor pixels. Among these, 8 pixels are in the same scale as the pixel (in a 3x3 window), 9 are in a 3x3 window in the scale above (Difference of Gaussian image from the same octave) and 9 others in a 3x3 window in the scale below.
Once finding these local extrema in different octaves, we must refine them, eliminating low-contrast points or weak edge points. They filter bad candidates using threshold in a Taylor expansion function and eigenvalue ratio threshold calculated in a Hessian matrix.
(this part I don't understand perfectly): For each interest point that survived (in each octave, I believe), they consider a neighborhood around it and calculate gradient magnitudes and orientation of each pixel from that region. They build a gradient orientation histogram covering 360 degrees and select the highest peak and also peaks that are higher than 80% of the highest peak. They define that the orientation of the keypoint is defined in a parabola (fitting function?) to the 3 histogram values closest to each peak to interpolate the peak position (I really dont understand this part perfectly).
What I am not understanding
1- The tutorial and even the original paper are not clear on how to detect a single key point as we are dealing with multiple octaves (images resolutions). For example, suppose I have detected 1000 key points in the first octave, 500 in the second, 250 in the third and 125 in the fourth octave. The SIFT algorithm will return me the following data about the key points: 1-(x,y) coordinates 2- scale (what is that?) 3-orientation and 4- the feature vector (which I easily understood how it is built). There are also Python functions from Opencv that can draw these keypoints using the original image (thus, the first octave), but how if the keypoints are detected in different octaves and thus the algorithm considers DOG images with different resolutions?
2- I don't understand the part 5 of the algorithm very well. Is it useful for defining the orientation of the keypoint, right? can somebody explain that to me with other words and maybe I can understand?
3- To find Local extrema per octave (step 3), they don't explain how to do that in the first and last DOG images. As we are considering 4 DOG images, It is possible to do that only in the second and third DOG images.
4- There is another thing that the author wrote that completely messed the understanding of the approach from me:
Figure 1: For each octave of scale space, the initial image is
repeatedly convolved with Gaussians to produce the set of scale space
images shown on the left. Adjacent Gaussian images are subtracted to
produce the difference-of-Gaussian images on the right. After each
octave, the Gaussian image is down-sampled by a factor of 2, and the
process repeated.
What? Does he downsample only one Gaussian image? how can the process be repeated by doing that? I mean, the difference of Gaussians is originally done by filtering the INPUT IMAGE differently. So, I believe the INPUT IMAGE, and not the Gaussian image must be resampled. Or the author forgot to write that THE GAUSSIAN IMAGES from a given octave are downsampled and the process is repeated for another octave?

bilateral filtering in image processing

Can anyone explain me how can I use the equation of bilateral filter in an image ,each coefficient in equation how can use it on an array and how the filter leave the edge without smoothing ? can anyone help me, please?and why(Ip - Iq) multiply in Iq
The filter computes a weighted sum of the pixel intensities. A normalization factor is always required in a weighted average, so that a constant signal keeps the same value.
The space factor makes sure that the filter value is influenced by nearby pixels only, with a smooth decrease of the weighting. The range factor makes sure that the filter value is influenced by pixels with close gray value only, with a smooth decrease of the weighting.
The idea behind this filter is to average the pixels belonging to the same homogeneous region as the center pixel, as if performing a local segmentation. The average performs smoothing/noise reduction, while restricting to the same region avoids spoling the edges by mixing with pixels of a very different intensity.

Is there any implementation of supersampled nearest-neighbor upscaling?

Nearest-neighbor is a commonly-used "filtering" technique for scaling pixel art while showing individual pixels. However, it doesn't work well for scaling with non-integral factors. I had an idea for a modification that works well for non-integral factors significantly larger than the original size.
Nearest-neighbor: For each output pixel, sample the original image at one location.
Linear: For each output pixel, construct a gradient between the two input pixels, and sample the gradient.
Instead, I want to calculate which portion of the original image would map to the output pixel rectangle, then calculate the average color within that region by blending the input pixels according to their coverage of the mapped rectangle.
This algorithm would produce the same results as supersampling with an infinite number of samples. It is not the same as linear filtering, as it does not produce gradients, only blended pixels on the input-pixel boundaries of the output image.
A better description of the algorithm is at this link: What is the best image downscaling algorithm (quality-wise)? . Note that the URL mentions downscaling, which could potentially have more than four pixels per output pixel. Upscaling has a maximum of four input pixels per output pixel processed, though.
Now is there any image editor or utility that supports weighted-average scaling?

writing a similarity function for images for clustering data

I know how to write a similarity function for data points in euclidean space (by taking the negative min sqaured error.) Now if I want to check my clustering algorithms on images how can I write a similarity function for data points in images? Do I base it on their RGB values or what? and how?
I think we need to clarify better some points:
Are you clustering only on color? So, take RGB values for pixels and apply your metric function (minimize sum of sq. error, or just calculate SAD - Sum of Absolute Differences).
Are you clustering on space basis (in an image)? In this case, you should take care of position, as you specified for euclidean space, just considering the image as your samples' domain. It's a 2D space anyway... 3D if you consider color information too (see next).
Are you looking for 3D information from image? (2D position + 1D color) It's the most probable case. Consider segmentation techniques if your image shows regular or well defined shapes, as first approach. If it fails, or you wanted a less hand tuned algorithm, consider reducing the 3D space of information to 2D or even 1D by doing PCA on data. By analyzing Principal Components you could drop off unuseful information from your collection and/or exploiting intrinsic data structure in some way.
The argument would need much more than a post to be solved, but I hope this could help a bit.

Resources