Thank you @abarnert! This was what i searched for to load an image from a dataset like sklearn.datasets.fetch_olivetti_faces(), which has dtype of float32 and Value ranges from 0-1 to work with OpenCV which uses a dtype of uint8 and Values ranging from 0-255.
import numpy as np
import cv2 as cv
from sklearn import datasets
data = datasets.fetch_olivetti_faces()
image = data.images[15]
image
array([[0.6694215 , 0.6818182 , 0.7066116 , ..., 0.5082645 , 0.55785125,
0.58677685],
[0.677686 , 0.70247936, 0.71487606, ..., 0.5289256 , 0.5495868 ,
0.58264464],
[0.6983471 , 0.7107438 , 0.70247936, ..., 0.5495868 , 0.55785125,
0.5785124 ],
...,
[0.59917355, 0.59917355, 0.54545456, ..., 0.10743801, 0.11157025,
0.10330579],
[0.59090906, 0.6198347 , 0.5785124 , ..., 0.11157025, 0.10743801,
0.10743801],
[0.5661157 , 0.6280992 , 0.59917355, ..., 0.11157025, 0.11157025,
0.10743801]], dtype=float32)
img = (image * 255).round().astype(np.uint8)
img
array([[171, 174, 180, ..., 130, 142, 150],
[173, 179, 182, ..., 135, 140, 149],
[178, 181, 179, ..., 140, 142, 148],
...,
[153, 153, 139, ..., 27, 28, 26],
[151, 158, 148, ..., 28, 27, 27],
[144, 160, 153, ..., 28, 28, 27]], dtype=uint8)
The img is now ready for further processing in cv library.