MATLAB Answers

kittu
0

Read .seq file in MATLAB

Asked by kittu
on 11 Sep 2012
Latest activity Commented on by Paul Siefert on 5 Jun 2019
Hi, I have a 20 minute video recording of an insect and i need to process it. Since it is the raw data,its file format is .seq.
Can anyone help me in reading the seq file in matlab?
Thanks

  2 Comments

Walter Roberson
on 12 Sep 2012
Was your .seq file created by Cyberpaint or by NorPix ?
kittu
on 12 Sep 2012
Hi, Thanks for the reply.I am not sure about it,as I have not collected the data personally.But i think that it was created by NorPix.

Sign in to comment.

Tags

3 Answers

Walter Roberson
Answer by Walter Roberson
on 12 Sep 2012
 Accepted Answer

  5 Comments

kittu
on 14 Sep 2012
Thanks for replying.Ya, i know..But some how when i am reading the header information then it is showing me these figures. I have this following code for header information:
clc
clear
fid = fopen('1.seq','r','b')
endianType = 'ieee-le';
%Reading Header Version
OFB = {28,1,'long'};
fseek(fid,OFB{1}, 'bof')
headerInfo.Version = fread(fid, OFB{2}, OFB{3}, endianType) %headerInfo is a structure
%Reading Header size
OFB = {32,1,'long'};
fseek(fid,OFB{1}, 'bof');
headerInfo.HeaderSize = fread(fid,OFB{2},OFB{3}, endianType)
%Reading Description Format
OFB = {592,1,'long'};
fseek(fid,OFB{1}, 'bof');
DescriptionFormat = fread(fid,OFB{2},OFB{3}, endianType)'
%Reading Byte Description
OFB = {36,512,'ushort'};
fseek(fid,OFB{1}, 'bof');
headerInfo.Description = fread(fid,OFB{2},OFB{3}, endianType)'
%Reading Image Information
OFB = {548,24,'uint32'};
fseek(fid,OFB{1}, 'bof');
tmp = fread(fid,OFB{2},OFB{3}, 0, endianType)
headerInfo.ImageWidth = tmp(1);
headerInfo.ImageHeight = tmp(2);
headerInfo.ImageBitDepth = tmp(3);
headerInfo.ImageBitDepthReal = tmp(4);
headerInfo.ImageSizeBytes = tmp(5);
vals = [0,100,101,200:100:900];
fmts = {'Unknown','Monochrome','Raw Bayer','BGR','Planar','RGB',...
'BGRx', 'YUV422', 'UVY422', 'UVY411', 'UVY444'};
headerInfo.ImageFormat =[fmts{vals == tmp(6)}];
%Reading information about number of allocated frames
OFB = {572,1,'ushort'};
fseek(fid,OFB{1}, 'bof');
headerInfo.AllocatedFrames = fread(fid,OFB{2},OFB{3}, endianType);
%Reading information about origin
OFB = {576,1,'ushort'};
fseek(fid,OFB{1}, 'bof');
headerInfo.Origin = fread(fid,OFB{2},OFB{3}, endianType);
%Reading information about true image size i.e number of bytes between the
%first pixel of each successive images.
OFB = {580,1,'ushort'};
fseek(fid,OFB{1}, 'bof');
headerInfo.Origin = fread(fid,OFB{2},OFB{3}, endianType);
%Reading True Image Size
OFB = {580,1,'ulong'};
fseek(fid,OFB{1}, 'bof');
headerInfo.TrueImageSize = fread(fid,OFB{2},OFB{3}, endianType);
%Reading information about fps
OFB = {584,8,'double'};
fseek(fid,OFB{1}, 'bof');
headerInfo.FrameRate = fread(fid,OFB{2},OFB{3}, endianType)
When i run this, i get the following header information: headerInfo =
Version: 0
HeaderSize: 36629
Description: [1x512 double]
ImageWidth: 404166936
ImageHeight: 522198298
ImageBitDepth: 572531232
ImageBitDepthReal: 639771172
ImageSizeBytes: 606348324
ImageFormat: []
AllocatedFrames: 9765
Origin: 10280
TrueImageSize: 673654824
FrameRate: [8x1 double]
Any suggestions?
Walter Roberson
on 14 Sep 2012
There must be a problem in reading the header. The ImageWidth shown there happens to correspond to hex 0x18171918 which is entirely too regular to be an accident.

Sign in to comment.


Answer by Davide Ferraro on 11 Sep 2012

There are some routines for working with .seq files in MATLAB. I've not been able to test them.

  2 Comments

kittu
on 12 Sep 2012
Hi, Thanks for reply.Unfortunately none of those codes are working. I guess those codes are meant for reading the sequential files which are often generated during the sequence analysis of DNA/RNA etc which are text files. But in my case, these .seq files are raw video files.
I am unable to read this file in MATLAB using any of the reader. Please provide some solution. Thanks
hey kittu,
i have the same issue currently. did you solve your problem already?
Thanks!
Here is our file output:
width: 1920
height: 1080
imageBitDepth: 12
imageBitDepthReal: 12
imageSizeBytes: 3110400
imageFormat: 630
numFrames: 239
trueImageSize: 3112960
fps: 25.1130
seqVersion: 5
codec: 'imageFormat630'
descr: 'StreamPix 6.5.0.0 (x64) Ę䀀 䀀  乐䀴  ㋈䀴  g 䀴 ⊸3…'
nHiddenFinalFrames: 0

Sign in to comment.


Answer by Vijay Yadav on 7 May 2019

Hey,
Can anyone please share matlab script for reading .seq file

  4 Comments

Show 1 older comment
Vijay Yadav on 7 May 2019
Hi Walter,
Thnxs for ur reply.
My .seq raw videos files are from StreamPix.
Paul Siefert on 5 Jun 2019
You can now read compressed and uncompresed sequences completly, or within a reading window with the above script.

Sign in to comment.