久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 NumPy 數(shù)組數(shù)據(jù)編寫原始二進制文件

Write a raw binary file with NumPy array data(使用 NumPy 數(shù)組數(shù)據(jù)編寫原始二進制文件)
本文介紹了使用 NumPy 數(shù)組數(shù)據(jù)編寫原始二進制文件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我想將 numpy 浮點數(shù)組的內(nèi)容作為有符號 16 位整數(shù)保存到原始二進制文件中.我嘗試使用 ndarray.tofile 來完成此操作但我無法找出正確的格式字符串.似乎文件以雙重格式保存,無論我如何選擇格式字符串.我該怎么做呢?謝謝.

I'd like to save the contents of a numpy float array into a raw binary file as signed 16 bit integers. I tried to accomplish this using ndarray.tofile but I can't figure out the right format string. It seems that the file is saved in double format, mo matter how I choose the format string. How do I do this? Thanks.

推薦答案

我認為最簡單的方法是先將數(shù)組轉(zhuǎn)換為int16,

I think the easiest way to do this is to first convert the array to int16,

array.astype('int16').tofile(filename)

這篇關(guān)于使用 NumPy 數(shù)組數(shù)據(jù)編寫原始二進制文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區(qū)域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應(yīng)用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據(jù)文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 91欧美精品 | 国产精品a级| 久久久久久九九九九 | av影音资源 | 久久免费精品 | 久久香焦 | 欧美狠狠操 | 亚洲精品在线视频 | 青青草原精品99久久精品66 | 91久久伊人 | 草草在线观看 | 亚洲一区成人 | 久久亚洲一区二区三区四区 | 国产精品自产拍在线观看蜜 | 国产精品久久久久久一区二区三区 | 久久久青草婷婷精品综合日韩 | 日本成人福利视频 | 中文字幕 国产 | 国产黄色在线观看 | 中文字幕一区二区在线观看 | 日韩在线观看视频一区 | 久久久久国产一级毛片高清网站 | 日本精品一区二区三区在线观看视频 | 久久夜视频| 日韩二区| 国产亚洲成av人在线观看导航 | 中文在线一区 | 91综合在线视频 | 91xxx在线观看 | 亚洲精品91 | 91精品国产色综合久久 | 91精品国产91久久综合桃花 | 日韩一级免费大片 | 一级毛片观看 | 欧美一级小视频 | 国产一区二区三区在线视频 | 日韩福利 | 2018国产大陆天天弄 | 黄色片网站在线观看 | 又爽又黄axxx片免费观看 | 亚洲午夜av久久乱码 |