I have a raw data file and don`t know how to deal with it
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
NoYeah
el 23 de Jul. de 2020
Respondida: Image Analyst
el 24 de Jul. de 2020
Greeting
I have a .raw file which is not an image file
it is consist raw bits of the sensor but don`t know its attribute number
I have used code below
fin=fopen('mydata.raw','r');
I=fread(fin);
and got
I = 241280*1 double
I want to see its data structure and column names but can`t do any
How to open raw file properly and check its columns name?
again, It is not an image file
0 comentarios
Respuesta aceptada
Walter Roberson
el 23 de Jul. de 2020
Most .raw files do not have any data structure or column names.
Most .raw files are not completely double() datatype: most of them include a lot of bytes or integers.
There is no general way to interpret .raw files. You either need documentation on the file format, or else you need very controlled conditions on producing the file to be able to try to cryptographic analysis to figure out what the format is. Documentation is the recommended approach.
0 comentarios
Más respuestas (1)
Image Analyst
el 24 de Jul. de 2020
Matthew, if you want, you can try trial and error. See this script and adapt as needed:
numPoints = 241280;
data = rand(241280, 1);
numHeaderPoints = 1180; % Whatever you want - take a guess. Can be 0 if you want.
for k = 1 : sqrt(numPoints - numHeaderPoints)
if rem(numPoints - numHeaderPoints, k) == 0
theImage = reshape(data(numHeaderPoints + 1 : end), k, []);
imshow(theImage, []);
[rows, columns] = size(theImage);
caption = sprintf('%d rows by %d columns', rows, columns);
title(caption, 'FontSize', 15);
fprintf('Image could be %d rows by %d columns.\n', rows, columns);
promptMessage = sprintf('%d rows by %d columns\n\nDo you want to continue processing,\nor quit processing?', rows, columns);
titleBarCaption = 'Continue?';
buttonText = questdlg(promptMessage, titleBarCaption, 'OK', 'Cancel', 'OK');
if contains(buttonText, 'Cancel', 'IgnoreCase', true)
return;
end
end
end
You'll see a variety of image sizes and this:
Image could be 1 rows by 240100 columns.
Image could be 2 rows by 120050 columns.
Image could be 4 rows by 60025 columns.
Image could be 5 rows by 48020 columns.
Image could be 7 rows by 34300 columns.
Image could be 10 rows by 24010 columns.
Image could be 14 rows by 17150 columns.
Image could be 20 rows by 12005 columns.
Image could be 25 rows by 9604 columns.
Image could be 28 rows by 8575 columns.
Image could be 35 rows by 6860 columns.
Image could be 49 rows by 4900 columns.
Image could be 50 rows by 4802 columns.
Image could be 70 rows by 3430 columns.
Image could be 98 rows by 2450 columns.
Image could be 100 rows by 2401 columns.
Image could be 140 rows by 1715 columns.
Image could be 175 rows by 1372 columns.
Image could be 196 rows by 1225 columns.
Image could be 245 rows by 980 columns.
Image could be 343 rows by 700 columns.
Image could be 350 rows by 686 columns.
Image could be 490 rows by 490 columns.
The image might look sheared but as it gets closer to the right size, it will start to look recognizable.
0 comentarios
Ver también
Categorías
Más información sobre Image Acquisition Support Packages for Hardware Adaptors (Generic Video Interface) en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!