Git Product home page Git Product logo

opencv_exercises-butterworth's Introduction

opencv_exercises-butterworth's People

Contributors

alessandro-gentilini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

opencv_exercises-butterworth's Issues

[Question] How to implement an ideal bandpass filter

Hi, thank you for giving this great example. That helps me a lot understanding what's going on in a filter.

I want to adopt this to create an ideal bandpass filter, according to Eq.(5.4-1), page 244, paragraph 5.4.1, Gonzalez Woods, "Digital Image Processing 2nd Edition", it can be written as following:

/**
 * create_ideal_bandpass_filter -   create a 2-channel ideal band-pass filter
 *      with radius D, order n (assumes pre-aollocated size of dft_Filter specifies dimensions)
 *
 * @param dft_Filter    -   destinate filter
 * @param D             -   radius
 * @param W             -   band width
 */
void create_ideal_bandpass_filter(cv::Mat &dft_Filter, int D, int W)
{
    cv::Mat tmp = cv::Mat(dft_Filter.rows, dft_Filter.cols, CV_32F);

    Point centre = Point(dft_Filter.rows / 2, dft_Filter.cols / 2);
    double radius;

    for (int i = 0; i < dft_Filter.rows; i++)
    {
        for (int j = 0; j < dft_Filter.cols; j++)
        {
            // D(u, v)
            radius = (double) sqrt(pow((i - centre.x), 2.0) + pow((double) (j - centre.y), 2.0));

            if (radius >= D - W/2 && radius <= D + W/2)
                tmp.at<float>(i, j) = 1;
            else
                tmp.at<float>(i, j) = 0;
        }
    }

    cv::Mat toMerge[] = {tmp, tmp};
    merge(toMerge, 2, dft_Filter);
}

But what confuses me is that if I want to filter an image with a low cut-off frequency fl and a high cut-off frequency fh instead of radius D and band width W. For example, I want to band pass the image with fl=0.83 and fh=1, how to translate these two value into D and W so that I can call the above function?

I will be very grateful for your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.