First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

out of scope for this forum.

you can use cv.imencode() to turn a numpy array (or cv::Mat) into an array of bytes that contains the picture file, but in memory. this resulting numpy array can be turned into a python bytes object.

you can write an SQL query that inserts this bytestring into your database.

I would strongly recommend using "prepared statements" for safety and security reasons. you should pass slicedImage as an argument, not splice it into the query string.

click to hide/show revision 2
No.2 Revision

out of scope for this forum.

you can use cv.imencode() to turn a numpy array (or cv::Mat) into an array of bytes that contains the picture file, but in memory. this resulting numpy array can be turned into a python bytes object.

you can write an SQL query that inserts this bytestring into your database.

I would strongly recommend using "prepared statements" for safety and security reasons. you should pass slicedImage as an argument, not splice it into the query string.