How to get actual value from the .mat ref file

44 views Asked by At
def read_mat_file(mat_file_path):
    with h5py.File(mat_file_path, 'r') as f:
        
        digitStruct = f['digitStruct']
        print(digitStruct.keys())
        bbox = digitStruct['bbox']
        name = digitStruct['name']
        print('bbox:',bbox[0])
        print('name:',name)
        print(len(bbox))    
        print(bbox[0][0])
        bbox_entry = bbox[0][0]
        name_entry = name[0][0]
        print('bbox_entry', bbox_entry)
        bbox_data = f[bbox_entry]
        name_data = f[name_entry]
        print('bbox_data Heght:', bbox_data['height'][0])
        height_ref = bbox_data['height'][0]
        print(height_ref[(0)])

I try to read the actual value of the 'height' from the file. but the output is looks like this

<KeysViewHDF5 ['bbox', 'name']>

bbox: [<HDF5 object reference>]
name: <HDF5 dataset "name": shape (33402, 1), type "|O">
33402
<HDF5 object reference>
bbox_entry <HDF5 object reference>
bbox_data Heght: [<HDF5 object reference>]
<HDF5 object reference>

how I get the actual value height from the reference file of .mat?

0

There are 0 answers