85011

C++:如何使用C++读取npy文件

<h3>1..npy文件是numpy专用的二进制文件;</h3> <h3>一般只能用python才能打开;</h3> <h3>2.如果想用C++打开:</h3> <h3>(1)可以先用python打开,然后保存成txt:</h3> <code class="language-python">detection_file = './detections/MOT16_POI_test/MOT16-06.npy' detections = None if detection_file is not None: detections = np.load(detection_file) # .npy文件 np.savetxt('detections.txt', detections, fmt='%0.18f') print(detections) <h3>(2)github上有一个开源程序,可以实现C++打开npy文件;</h3>

地址:https://github.com/rogersce/cnp

里面有示例;

来源:51CTO

作者:SSS_369

链接:https://blog.csdn.net/sss_369/article/details/100126117

Recommend