Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result seems off in my side #3

Open
ziyuang opened this issue Nov 13, 2019 · 0 comments
Open

Result seems off in my side #3

ziyuang opened this issue Nov 13, 2019 · 0 comments

Comments

@ziyuang
Copy link

ziyuang commented Nov 13, 2019

My run produces (left: input; middle: my implementation; right: this implementation; radius=10):
noisy_square

Can you try this input? It's a 201x201 FP32 square, stored with little-endian:
noisy-square.tar.gz

I use this routine to read the file:

template<typename T>
std::vector<T> read_raw(const std::string &path, bool little_endian = false)
{
    std::ifstream file(path, std::ifstream::binary);
    std::streamsize buffer_size = 1 << 20;
    char buffer[buffer_size];
    std::vector<T> raw;
    while(!file.eof())
    {
        file.read(buffer, buffer_size);
        for (int i = 0; i < std::min(buffer_size, file.gcount()); i += sizeof(T))
        {
            char *begin = &buffer[i];
            if (little_endian)
                std::reverse(begin, begin + sizeof(T));
            raw.push_back(*(T *)begin);
        }
    }
    file.close();
    return raw;
}

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant