-2

I want to insert captured frame to database. please let me know.

cap = cv2.VideoCapture(0)
while True:
         ret, frame = cap.read()
chandan p
  • 23
  • 6
  • An image is just a 2D array. An OpenCV image, is a 2D numpy array. Therefore, this question is probably a duplicate of: https://stackoverflow.com/q/18621513/176769 – karlphillip Feb 02 '20 at 11:47
  • 1
    Okay. But It store like array not image. I want to store as image even using sqlite browser can see the image. It's not off topic. – chandan p Feb 03 '20 at 01:11
  • `frame` is actually a 2D numpy array, a representation of an image file in RAM memory. sqlite is designed to store data like this. If you want to store the actual image file, you need to look into document-oriented databases like MongoDB or CouchDB. – karlphillip Feb 03 '20 at 08:58
  • 1
    My frame is 3D I checked using frame.ndim it's prints 3 dimensional – chandan p Feb 03 '20 at 15:38

1 Answers1

1

encode the frame using opencv after insert to the table.

image_encode = cv2.imencode('.jpg', frame)[1].tostring()
Chandan
  • 571
  • 4
  • 21