【问题标题】:Reading XM2VTS image database from "bindata file format" in Python or (MATLAB)在 Python 或(MATLAB)中从“bindata 文件格式”读取 XM2VTS 图像数据库
【发布时间】:2021-09-14 02:43:17
【问题描述】:

我无法将 XM2VTS 数据库 (https://www.idiap.ch/resource/faceverif/data/xm2vts/face32x40-eyecenter.tar.gz) 读取为 40x32(或 32x40)灰度图像。

每个文件为 10248 字节 = 8 + (32 x 40 x 8)。

Python

import numpy as np
A=np.fromfile("000_1_1.bindata", dtype=np.uint8)
print(A.shape)

MATLAB

fileID = fopen('000_1_1.bindata');
A = fread(fileID,'uint8');

【问题讨论】:

    标签: python matlab binary multiclass-classification


    【解决方案1】:
    import numpy as np
    import matplotlib.pyplot as plt
    
    
    I0=(np.fromfile('000_1_1.bindata','float32'))
    I0=I0[2:]
    I0 =I0.reshape(80, 32)
    
    I=I0[:40,:]
    plt.imshow(I, cmap='gray')
    

    【讨论】:

    • 如果您在回答中提供解释将会很有帮助。
    猜你喜欢
    • 1970-01-01
    • 2014-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多