フィルターのクリア

How to open .raw files in matlab?

363 ビュー (過去 30 日間)
Pooja
Pooja 2013 年 4 月 18 日
コメント済み: zinah n 2019 年 9 月 24 日
Hello,
How will I open my .raw files in matlab?

採用された回答

Jan
Jan 2013 年 4 月 21 日
Even after the large number of questions for clarifications and a lot of comments, the actual problem does not get clearer. It seems, like our messages do no reach you, Pooja:
It is your turn to find out the details of the format.
We cannot help you, when we have to guess, what you need.
  14 件のコメント
Pooja
Pooja 2013 年 4 月 25 日
Thank you so much.Got the o/p
if true
% row=1024; col=1024;
fin=fopen('b1.raw','r');
I=fread(fin,row*col,'uint8=>uint8');
Z=reshape(I,row,col);
Z=Z';
k=imshow(Z)
end
Walter Roberson
Walter Roberson 2013 年 4 月 25 日
If the question is finished please Accept one of the Answers.

サインインしてコメントする。

その他の回答 (3 件)

Image Analyst
Image Analyst 2013 年 4 月 18 日
Pooja, do you have any idea at all ...
  1. what the lateral size of the image is (number of rows and columns), and
  2. whether it's grayscale, RGB color or multispectral,
  3. if color how the red, green, and blue values are positioned (interleaved)
  4. how many bits (8 or 16 are typical) is the pixel written out
  5. if there is a header and how long it might be?
Or are you willing to guess at some typical values? You can pass in an array to the fread() function to get back a 2D array.
  8 件のコメント
Pooja
Pooja 2013 年 4 月 21 日
sorry, instead of stHeader.BytesPerVoxel == 1 what should i give?
fid = fopen('mars.raw');
rawdata = fread(fid, inf, '*uint8');
fclose(fid);
stHeader.BytesPerVoxel is an undefined function.
Image Analyst
Image Analyst 2013 年 4 月 21 日
As you can see from the '*uint8' or '*uint16' in the fread() statement, it's either 1 or 2, for 8 bit (one byte) or 16 bit (2 bytes) respectively. x_size will be the number of columns, and y_size is the number of rows that you want in your 2D array (which I called oneSlice but you can call rawdata if you want).
Now, notice how your fread() doesn't look like mine because you didn't put in the desired output matrix size ([x_size y_size]) like I did. Why not?

サインインしてコメントする。


Walter Roberson
Walter Roberson 2013 年 4 月 18 日
  2 件のコメント
Pooja
Pooja 2013 年 4 月 18 日
Thanks for the reply.I am having .raw files of consultative committee for space data standards (CCSDS) .I am not able to open it.
Walter Roberson
Walter Roberson 2013 年 4 月 18 日
The most I can seem to find is the commercial product from ledin.com which is a Telemetry toolbox for MATLAB.
I have not checked to see if that handles DELTA-DOR files.

サインインしてコメントする。


Jan
Jan 2013 年 4 月 18 日
"Raw" means an individually defined binary format usually. Because there are many different formats named "raw", you have to ask the creator how this file has been created and how the format is defined. But it is not reliable to let the forum's users guess, which RAW-format it might be.
  11 件のコメント
Surendra Maharjan
Surendra Maharjan 2018 年 10 月 11 日
clear; clc; width = 256; height = 256; fileID = fopen('Phase0004.raw','r'); A=fread(fileID,[width height]); fclose(fileID);
The output A is empty. I can not understand why?
zinah n
zinah n 2019 年 9 月 24 日
clear; clc;
width = 256;
height = 256;
ccnt=width*height;
fileID = fopen('Phase0004.raw','r');
A=fread(fileID,ccnt,'uint8=>uint8');
fclose(fileID);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by