Ask Your Question
1

Saving an Opencv Mat into a YAML file using python

asked 2015-10-06 11:24:50 -0600

diegomez_86 gravatar image

updated 2015-10-06 11:25:20 -0600

Hello, Does anyone know how to save, write, convert, etc an Opencv Mat into a YAML file using python?

I tried with cv.Save but it tells me "Cannot identify type of 'structPtr'", and with ImWrite it tells me error: "(-2) could not find a writer for the specified extension in function imwrite"

Thanks a lot for your help.

edit retag flag offensive close merge delete

Comments

please, avoid the outdated cv module in python at all cost . it is no more available in current 3.0

can't you just use numpy to save it to a text file ?

berak gravatar imageberak ( 2015-10-06 11:37:29 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-01-18 09:40:12 -0600

miks gravatar image

I had the same problem. Wrap the numpy array with cv.fromarray()

import numpy 
import cv  
a = numpy.ones((5,5,1),float)
cv.Save("a.xml",cv.fromarray(a))

It is depreciated functionality but ATM works.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-10-06 11:24:50 -0600

Seen: 2,368 times

Last updated: Oct 06 '15