C
C
Cyril2014-06-15 08:43:08
Python
Cyril, 2014-06-15 08:43:08

How to convert "InMemoryUploadedFile" image to OpenCV?

image = form.cleaned_data.get('image')
gray = cv2.cvtColor(image.read(), cv2.COLOR_BGR2GRAY)

It returns the error "src is not a numpy array, neither a scalar", how to convert it correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gw8311, 2015-02-02
@gw8311

May be

image = cv2.imread("filename")
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

And if not from a file, thencv2.imdecode

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question