Missing depth attribute on images

asked 2012-08-16 14:46:09 -0500

kobald gravatar image

updated 2012-08-17 04:14:05 -0500

sammy gravatar image

New to OpenCV. Working in Python. I am storing images to a SQLite3 database as a blob. I can get the height, width, and num of channels to store with blob to help reconstruct on the database select...but no depth found!

Here is code specifics...

im = cv.LoadImageM(imageFile)
imSize = cv.GetSize(im)
imWidth = im.width
imHeight = im.height
imChannels = im.channels
#imDepth = im.depth()  #Not found
imStr = im.tostring()
blob = sqlite3.Binary(imStr)

When I retrieve the blob, I can reconstruct image with all but I must guess depth. Right now using cv.IPL_DEPTH_8U as best guess. Noticed c++ has hooks to get depth, but not in Python. Use cv.CreateImageHeader to reconstruct.

edit retag flag offensive close merge delete



Saving images as blobs in a database sounds like a really bad idea. The best database for images out there is the file system. You can save the filenames in the database, and that sounds much better.

sammy gravatar imagesammy ( 2012-08-17 04:11:39 -0500 )edit