File Exchange

image thumbnail

Reader class for Photron .mraw-Files

version 1.0.0.0 (4.19 KB) by Markus Lindner
Reads 8 - 16 bit monchrome and color image data from Photron .mraw (and .cih) files

10 Downloads

Updated 23 Mar 2017

View License

mraw.m
MRAW - Read 8 - 16 bit monchrome and color Photron image data as a class
C=MRAW('c:\Photron\Filename') loads video infos from 'c:\Photron\Filename' into class C.
Remarks

This class must be handed the common *.cih and *.mraw file name.
A file extension is not allowed.
his function is intended for color and monochrome 8 to 16 bit *.mraw files.
NOTE: Both the *.cih file and the *.mraw file are utilized
partly adapted from Autor: SEP Creation Date: June 20,2013

Added support for 8 to 16 bit.
Added support for big/little endian bit order.
Added support for variable header information.
Lookup table transformation to 16 bit output.
Included LUT Function to class.
Included Videoplayer with VideoFig from João Filipe Henriques.
Autor: Markus Lindner Creation Date: Feb 24,2017

Added ExtendedInfos from .cih file
Autor: Markus Lindner Creation Date: Mar 23,2017

Examples

Load image 10
C=mraw('c:\Photron\Moviefile');
Image = C.getFrame(10);
Access camera setup Framerate
fRate = C.FrameRate;
Play whole Video with LUT
C = mraw('c:\Photron\Moviefile');
lastImage = C.TotalFrames;
C.makeLut(0,200,1);
for i = 1:lastImage
imshow(C.getFrame_uint8(i))
end
Play whole Video with included Player
C = mraw('c:\Photron\Moviefile');
C.play;

Cite As

Markus Lindner (2021). Reader class for Photron .mraw-Files (https://www.mathworks.com/matlabcentral/fileexchange/62219-reader-class-for-photron-mraw-files), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Denny Hermawanto

Thanks Jonah. It works for horzcat error.

John Montgomery

Use fix below by Jonah Zimmerman

jonah zimmerman

I got the horzcat error that others noted, but found that the edit suggested by MartinFJFI was deleting the ExtendedInfos data and I wanted to preserve it. Instead I replaced line 108 with the following:

obj.ExtendedInfos = deblank(cihdata(1:end-1));

Jonny Cheng

I also got the problem with the examples. My errors as below:
Error using fseek
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in mraw/getFrame (line 131)
fseek(obj.FidVideo,start,'bof');

Error in readmrawimage (line 3)
Image = C.getFrame(10);

MartinFJFI

Code from examples did not work as it should. I got the following errors:
Error using horzcat
Dimensions of arrays being concatenated are not consistent.

Error in mraw (line 108)
obj.ExtendedInfos = deblank([cihdata{1:2}]);

For anyone wandering, I solved the errors by inputting the following code in line 108:
cihdata{1} = cell(217,1);
cihdata{2} = cihdata{1};

James Michael

plasmageek

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!