(资料图)
各个参数的解释意义如下:
filename 表示读写的文件名称
flags表示文件类型cv::FileStorage::Mode,当前支持的模式包含:
写入
读出
释放文件
importcv2ascvparam1=25param2=0.25param3="lena.jpg"#写文件model_settings=cv.FileStorage("mytest.yaml",cv.FILE_STORAGE_WRITE)model_settings.write("version","v1.0")model_settings.write("author","gloomyfish")model_settings.write("param1",param1)model_settings.write("param2",param2)model_settings.write("param3",param3)model_settings.release()#读文件cv_setting=cv.FileStorage("mytest.yaml",cv.FileStorage_READ)param1=cv_setting.getNode("param1").real()param2=cv_setting.getNode("param2").real()param3=cv_setting.getNode("param3").real()
扫码查看 CV系统化学习路线图(OpenCV+Pytorch)
关键词: