16 lines
339 B
Python
16 lines
339 B
Python
import cv2
|
|
import numpy as np
|
|
|
|
# Create some data
|
|
data = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
|
|
|
|
# Write to XML
|
|
fs = cv2.FileStorage("data.yaml", cv2.FILE_STORAGE_WRITE)
|
|
fs.write("data", data)
|
|
fs.release()
|
|
|
|
# Read from XML
|
|
fs = cv2.FileStorage("data.yaml", cv2.FILE_STORAGE_READ)
|
|
data_read = fs.getNode("data").mat()
|
|
print(data_read)
|