Trouble using Open Image Denoise I'm trying to use open image denoise. Here's the code:

int main() {
    int width, height, nrChannels;
    unsigned char* image = stbi_load("img_cornell_box.png", &amp;width, &amp;height, &amp;nrChannels, 0);
    unsigned char* resultImage = new unsigned char[width*height*nrChannels];
    oidn::DeviceRef device = oidn::newDevice();
    device.commit();
    std::cout &lt;&lt; nrChannels &lt;&lt; std::endl;
    oidn::FilterRef filter = device.newFilter("RT");
    filter.setImage("color", image, oidn::Format::Float4, width, height);
    filter.setImage("output", resultImage, oidn::Format::Float4, width, height);
    filter.set("hdr", false);
    filter.set("srgb", true);
    filter.commit();
    filter.execute();

    const char* errorMessage;
    if (device.getError(errorMessage) != oidn::Error::None) {
        std::cout &lt;&lt; "Error: " &lt;&lt; errorMessage &lt;&lt; std::endl;
    }
    else {
        stbi_write_png("img.png", width, height, nrChannels, resultImage, width * nrChannels);
    }
}


I'm getting an error saying that the image format is unsupported.

If I use jpg, and change Format::Float4 to Format::Float3 I get this error:

Exception thrown at 0x00007FFC5588E1F5 (OpenImageDenoise.dll) in oidntest.exe: 0xC0000005: Access violation reading location 0x0000021D9C42FA70.


Am I doing something wrong?
This is the image I'm using: https://drive.google.com/open?id=1uSjsyWCRisXNFUJG6R8iL5AdVbM7_18u
As far as I remember, you need to input data in float array. Right now your input is unsigned char array. To quick check this, try loading any HDR image in float array &amp; pass it on to the setImage functions, this seems to work. 

In your case, you would need to read individual image channel data &amp; cast it to float. If your image color is stored in [0-255] range, you would then need to bring it to [0-1] range (Not completely sure about this stage!) &amp; then pass the data in float array to denoiser functions.

Hope this helps.