Image feature vector length calculation - image

Here is the problem: I have an image 256x256 on which wavelet transform is applied. As a result I get a table 16x64 coefficients (3.066568 3.386725 and so on). Do you have any idea how the feature vector length can be calculated?

Related

Keras - Mean Squared Error (MSE) calculation definition for images?

I am using
loss = 'mse'
in Keras for an autoencoder model that reconstructs greyscale images. My batch size is 1. A single loss value is being produced during training.
I can't seem to find anywhere an answer to this question. How does Keras calculate this MSE loss value for these 2 images? They're represented as 2d NumPy arrays. Does it compute the squared difference between each pixel and then divide by the number of pixels (considering the batch size is 1)?
Is this process the same if the input is more than 1 greyscale image into the model; computing the squared pixel difference across all the images, then dividing by the total number of pixels in all the images?
Many thanks
def mse(y_true, y_pred):
return K.mean(K.square(y_pred - y_true), axis=-1)
This is the code for the mse, the operations (difference and square) are bitwise (pixel by pixel), then it computes the mean, so it divides for the number of values (pixel).

Plotting ROC curve for binary image

I think ROC has some limitation to evaluate the performance of some binary classifier. I plot the ROC for an image classifier with this instruction: first I apply my detection method to the image, it's result is a gray-scale image. Now I must apply different threshold to obtain different binary images. For a range of threshold (for example th=0.01:0.01:1), I obtain a binary image corresponding to each threshold. Then for each binary image, true positive rate(TPR) and false positive rate(FPR) are calculated which (TPR,FPR) determines a point on the ROC curve. The whole curve includes the points that are calculated for each binary image.
And my problem: if at the first step I have a binary image against a gray-scale image, how I can apply different threshold to it for plotting ROC. Is there any performance evaluation instead of ROC that be suitable for this state?

median filter for color images

When performing median filtering on grayscale images we rank the intensity values of pixels. How do we rank intensity values of pixels in color images as each pixel has 3 channels R,G,B. What is the formula.Thank You.
One of the options is vector median filter (VMF). See Fast Modified Vector Median Filter for detailed algorithm description and efficient implementation. One of the features of VMF is that it doesn't produce "false" colors - only the actual colors present in original image are used in filtered image.
here are 2 options for noise filtering with median filter:
do the median filter for each on of the RGB components separately, this is not a good choice, because the components are correlated, and false colors may appear.
you can also convert to HSV from RGB and then do the median filter on the hue, saturation and value, then convert back to RGB, this method is usually better (for most applications).
HSV description:

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?

Calculate covariance of two images in matlab

I am doing a project on image quality assessment. I converted the image to grayscale & divided the entire image into 8x8 matrices using mat2cell function. I did this for two images, and now I want to calculate covariance between these two images (i.e the covariance between the matrix of image 1 and covariance between the same matrix of image 2). Note that both are the same images: one a pure image without distortions and one with distortions.
First convert your image to matrix:
I = double(imread('photo.jpg'));
then calculate covariance:
x=cov(I);
For single matrix input, C has size [size(A,2) size(A,2)] based on the number of random variables (columns) represented by A. The variances of the columns are along the diagonal. If A is a row or column vector, C is the scalar-valued variance.
For two-vector or two-matrix input, C is the 2-by-2 covariance matrix between the two random variables. The variances are along the diagonal of C.

Resources