Cv::imshow() on a 32FC1 image

Hello, I am very confused as to why i get either black or white when i use cv::imshow() with a 32FC1 image. From the documentation, the image is somehow scaled in order to fit the values within 0-255, but in my case i get either 0 or 255 nothing inbetween, why is that. Ive been lost for a while on issue.

in python :

import numpy as np
import cv2 as cv

x = cv.imread(cv.samples.findFile("baboon.jpg"), cv.IMREAD_GRAYSCALE)
img = x.astype(np.float32)/256
cv.imshow('baboon', img)
print("MinMax ", img.min(), img.max())

cv.waitKey()
cv.destroyAllWindows()

c++

        Mat image = imread(samples::findFile("butterfly.jpg"), IMREAD_GRAYSCALE);
        image.convertTo(image, CV_32FC1, 1.0/256);
        imshow("butterfly", image);
        waitKey();

This link gave me an anwser: Difference between depth image types - ROS Answers: Open Source Q&A Forum

The issue after more testing is that im working with, image integrals and and i have values that are nowehere between 0-1, and each time id use imshow id get either balck or white. Thanks for the help tho :slight_smile:

https://docs.opencv.org/4.x/d7/dfc/group__highgui.html#ga453d42fe4cb60e5723281a89973ee563

If the image is 32-bit or 64-bit floating-point, the pixel values are multiplied by 255. That is, the value range [0,1] is mapped to [0,255].