I am using Python 3.6.7, Open<cv 4.3.0.36, PyQt5 5.15.2
I have a .tif image of size (222, 230), im2 dtype = uint16, and I created a mask of size (222, 230), mask2 dtype = uint16.
Here is a snippet of my code below :-
im2 = cv2.imread(input_dir, flags= (cv2.IMREAD_GRAYSCALE | cv2.IMREAD_ANYDEPTH))
mask2 = np.zeros(im.shape, dtype = np.uint16)
mask2 = cv2.circle(mask2, (165, 151), 75, (255,255,255), -1)
hist = cv2.calcHist(im2, [0], mask2, 256, [0,65536])
And I get the following error,
Traceback (most recent call last):
File "cv2_hist2.py", line 38, in <module>
hist = cv2.calcHist(im2, [0], mask2, 256, [0,65536])
SystemError: <built-in function calcHist> returned NULL without setting an error
Can someone help me understand what is my mistake here?
Thanks in advance!