'How to convert NumPy array into OpenCV (cv2) image
I have attached the image of the code here for better understanding, this would help you figure out what I am actually doingI am working on a project in which I am converting the images (basically faces) captured from the webcam and recognized into NumPy arrays, and then into cv2 image.
I am doing this to
- Executing easy conversion of data, to ensure compatibility with the recognition function.
- Fasten my software by leveraging the fast array-processing in Python through NumPy.
I tried the basic array to image conversion using PIL's im.fromarray()
function, but it's not working.
The main problem is that each and every time, the shape of the array is different, less than the usual dimensions (1024*720) in which it could be possibly be reshaped into.
after all this, here is the error it is throwing->AttributeError: 'Image' object has no attribute 'clip'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|