logo
down
shadow

Why is the mean filter giving totally white output?


Why is the mean filter giving totally white output?

By : Mohamed Abo el enien
Date : November 20 2020, 11:01 PM
I wish did fix the issue. If you use this kernel as it is, you compute the sum of all the pixels in the 8-neighborhood. So I guess that for most of the pixels, the result is greater than 255, and then it is truncated.
If you want to compute the mean, use 1.0/9.0 instead of 1.
code :


Share : facebook icon twitter icon
filter() arguments not giving correct output

filter() arguments not giving correct output


By : omoe
Date : March 29 2020, 07:55 AM
around this issue The value attribute of an input tag is not the same thing as the value property of an input element. The first one happens to be in the HTML, gets parsed in the DOM and acts as the defaultValue. The latter one is the dynamic value which represents the currently entered input. See also .prop() vs .attr()
Your element does not even have a value attribute, so it will never match the selector. Instead, you will need to use a filter function that checks the properties:
code :
inputs.filter(function() {
     return this.required && this.value=="";
     // equivalent: $(this).prop("required")
     // and         $(this).prop("value") or $(this).val()
})
Css - Padding being totally ignored, white space appear where it should not

Css - Padding being totally ignored, white space appear where it should not


By : Hua Yang
Date : March 29 2020, 07:55 AM
wish help you to fix your issue The margin-top that you're adding to #menu is what is causing that gap.
Issue with ember-bootstrap: page background rendered half gray, should normally be totally white

Issue with ember-bootstrap: page background rendered half gray, should normally be totally white


By : Brian Hyte
Date : March 29 2020, 07:55 AM
like below fixes the issue The following example will ensure the .page-wrapper class is always at 100% screen height.
HTML
code :
<body>
    <div class="page-wrapper">
        <!-- Page content -->
    </div>
</body>
body {
    background-color: #eee;
}

.page-wrapper {
    background-color: #fff;
    min-height: 100vh; /* Important bit */
}
Array.prototype.filter() is not giving expected output when i am using in my reducer

Array.prototype.filter() is not giving expected output when i am using in my reducer


By : Liam Tonner
Date : March 29 2020, 07:55 AM
it should still fix some issue , I did silly mistake :(
code :
searchChatFromRecentChatContactList = (state, text) => {
    if(state.response && state.response.length > 0) {
        const searchText = text.toLowerCase();
        const response = [...state.response];
        const searchResults = response.filter(item => {
            if(item.displayName.includes(searchText)) {
                return true;
            } else {
                return false;
            }
        });
        return searchResults;
    }
    return [];
}
Why is 2d FFT giving a totally black output?

Why is 2d FFT giving a totally black output?


By : IDfrumer
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I have solved the problem.
I had to use a function called Limit() in my code whose objective is to keep the values between 0 and 1.
code :
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        Bitmap bmp = Bitmap.FromFile("lenagr.png") as Bitmap;
        pictureBox1.Image = bmp;

        Complex[,] cImage = ToComplex(bmp);

        for (int y = 0; y < cImage.GetLength(1); y++)
        {
            for (int x = 0; x < cImage.GetLength(0); x++)
            {
                if (((x + y) & 0x1) != 0)
                {
                    double real = cImage[y, x].Real * (-1);
                    double imaginary = cImage[y, x].Imaginary * (-1);

                    cImage[y, x] = new Complex(real, imaginary);
                }
            }
        }

        FourierTransform.FFT2(cImage, FourierTransform.Direction.Forward);

        double[,] intImage = ToDouble(cImage);

        intImage = Limit(intImage);

        Bitmap bmpMagImg = ToBitmap(intImage, PixelFormat.Format24bppRgb);
        pictureBox2.Image = bmpMagImg;
    }

    public static double[,] Limit(double[,] image)
    {
        double[,] imageCopy = (double[,])image.Clone();

        double min = 0;
        double max = 1;

        int Width = imageCopy.GetLength(0);
        int Height = imageCopy.GetLength(1);

        double[,] array2d = new double[Width, Height];

        for (int i = 0; i < Width; i++)
        {
            for (int j = 0; j < Height; j++)
            {
                array2d[i, j] = Math.Max(min, Math.Min(imageCopy[i, j], max));
            }
        }

        return array2d;
    }

    public double[,] ToDouble(Complex[,] image)
    {
        int Width = image.GetLength(0);
        int Height = image.GetLength(1);

        double[,] array2d = new double[Width, Height];

        for (int j = 0; j < Height; j++)
        {
            for (int i = 0; i < Width; i++)
            {
                array2d[i, j] = (double)image[i, j].Magnitude;
            }
        }

        return array2d;
    }

    public Bitmap ToBitmap(double[,] image, PixelFormat pixelFormat)
    {
        double[,] imageCopy = (double[,])image.Clone();

        // Image is Grayscale
        // Each element is scaled to (0-255) range.
        int Width = imageCopy.GetLength(0);
        int Height = imageCopy.GetLength(1);

        Bitmap bitmap = new Bitmap(Width, Height, pixelFormat);

        for (int y = 0; y < Height; y++)
        {
            for (int x = 0; x < Width; x++)
            {
                // In case of a grayscale image, 
                // each pixel has same R,G, and B values.
                double d = imageCopy[x, y];

                int iii = Convert.ToInt32(d * 255.0);

                Color clr = Color.FromArgb(iii, iii, iii);

                bitmap.SetPixel(x, y, clr);
            }
        }

        Grayscale.SetPalette(bitmap);

        return bitmap;
    }



    public Complex[,] ToComplex(Bitmap image)
    {
        if (!Grayscale.IsGrayscale(image))
        {
            throw new Exception("Source image must not be color");
        }

        int[,] array2d = ToInteger(image);

        return ToComplex(array2d);
    }



    public int[,] ToInteger(Bitmap input)
    {
        if (!Grayscale.IsGrayscale(input))
        {
            throw new Exception("Source image must not be color");
        }

        int Width = input.Width;
        int Height = input.Height;

        int[,] array2d = new int[Width, Height];

        for (int y = 0; y < Height; y++)
        {
            for (int x = 0; x < Width; x++)
            {
                Color cl = input.GetPixel(x, y);

                int gray = (int)Convert.ChangeType(cl.R * 0.3 + cl.G * 0.59 + cl.B * 0.11, typeof(int));

                array2d[x, y] = gray;
            }
        }

        return array2d;
    }

    public Complex[,] ToComplex(int[,] image)
    {
        int Width = image.GetLength(0);
        int Height = image.GetLength(1);

        Complex[,] array2d = new Complex[Width, Height];

        for (int i = 0; i < Width; i++)
        {
            for (int j = 0; j < Height; j++)
            {
                double d = (double)image[i, j];

                Complex tempComp = new Complex(d, 0.0);
                array2d[i, j] = tempComp;
            }
        }

        return array2d;
    }
}
shadow
Privacy Policy - Terms - Contact Us © soohba.com