Upload
others
View
16
Download
0
Embed Size (px)
Citation preview
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 1 / 1 4
RAW3 Specification version 3.0.0
The RAW3 f i le is composed of a RAW3 f i le header, repeatedly fol lowed by an image
header and image data . I f the sequence is recorded with an S -Ser ies or a Q-Ser ies
camera, there are FPN coeff icients inserted between the RAW3 f i le header and the
f i r st image f rame header as shown in the fol lowing f igure . For non Q- or S-Ser ies
cameras the Fi le Header is fol lowed by the image data header of image 1.
RAW3 Fi le Header
(4096 bytes)
Image Data Header of Image 1
Image Data of Image 1
…
FPN Coeff icients (16Bit)
(S-Ser ies: 5’308’416 bytes)
(Q-Ser ies: 17’400’960 bytes)
Image Data Header of Image 2
Image Data of Image 2
Image Data Header of Image 3
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 2 / 1 4
RAW3 File Header
The RAW3 f i le header has a s ize of 4096 bytes according to the fol lowing definit ion:
Name Offset
[byte]
Size
[byte]
Data
Type Description
File Signature 0 8 Byte[8]
0x52 0x41 0x57 0x56 0x33 0x00 (hex
values for null terminated ASCII string
"RAWV3" in network byte order)
File Version 8 8 uint64
1 = for v1.0 2 = for v2.0
11 = for v1.1 21 = for 2.1
111 = for v1.1.1 211 = for 2.1.1
File Creator 16 64 char[64] Name of the application, which
created this file
Camera Series 80 8 uint64
0: X-Series
1: S-Series
2: TRI-Series
3: Q-Series
4: Promon-Series
Camera Vendor Name 88 56 char[56] Name of the camera vendor
Camera Model Name 144 64 char[64] Name of the camera model
Camera ID 208 64 char[64] Serial number of the camera used to
create this recording
Camera Version 272 64 char[64] Version of the camera
Camera Firmware Version 336 64 char[64] Camera firmware version
Camera FPGA Version 400 64 char[64] Camera FPGA version
User Comment 464 512 char[512] User comment
Recording Date 976 16 char[16] recording date (YYYY-MM-DD)
Recording Time 992 16 char[16] recording time (hh:mm:ss[.msec])
Image Data Header Size 1008 8 uint64 Size of the Image Data Header
FPN Header Size 1016 8 uint64 Size of the FPN Header Table (FPN
coefficients)
Image Data Size 1024 8 uint64 Size of the Image Data (not used)
Color Filter Type 1032 1 Byte
Bayer pattern:
0: Mono
1: BG 2: RG 3: GB 4: GR
GR GB RG BG
Frame Type 1033 1 Byte Bit 0-3: FrameType 0: raw
Bit 4-7: reserved
OSD 1034 1 Byte 0: deactivated
1: activated
FPN 1035 1 Byte 0: deactivated
1: activated
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 3 / 1 4
Name Offset
[byte]
Size
[byte]
Data
Type Description
Pixel size 1036 4 uint32 pixelsize [µm]
Frame Count 1040 8 uint64 Number of frames in this file
Image Size 1048 8 uint64 Size of the Image Data including
Image Data Header
Frame Width 1056 4 uint32 Frame width in pixels
Frame Height 1060 4 uint32 Frame height in pixels
Sensor Frame Width 1064 4 uint32 Width of the frame on the sensor in
pixel
Sensor Frame Height 1068 4 uint32 Height of the frame on the sensor in
pixel
SyncSource 1072 4 uint32
0: internal sync
1: external sync
2: IRIG sync
Framerate 1076 4 uint32 actual recording rate fps
ShutterValue 1080 4 uint32 shutter time in microseconds,
0 if unknown
TimeSource 1084 4 uint32
0: None
1: Host Clock
2: Camera Clock
3: IRIG
Frame0 TimeStamp 1088 4 uint32 Unix Timestamp of Frame 0 in seconds
in the original recording
Frame0 SubSec 1092 4 uint32 Sub seconds of Frame 0 in units of
100ns in the original recording
T0 TimeStamp 1096 4 uint32
Unix Timestamp of trigger signal
detection in seconds in the original
recording (used if Image Data Header
Size is zero)1
T0 SubSec 1100 4 uint32
Sub seconds of trigger signal
detection in units of 100ns in the
original recording1
T0 FrameIndex 1104 8 uint64 Index of the T0 frame in this file, if
contained.
T0 Frame 1112 8 uint64 Index of T0 frame in the original
recording
Original Sequence Length 1120 8 uint64 Sequence length in the original
recording
Mark IN 1128 8 uint64 Mark IN of the original recording
Mark OUT 1136 8 uint64 Mark OUT of the original recording
BitCount 1144 4 uint32 Bits per pixel ( 5 / 8 / 10 )
BitMode 1148 2 uint16
0: low
1: mid
2: high
1 used if Image Data Header Size is zero
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 4 / 1 4
Name Offset
[byte]
Size
[byte]
Data
Type Description
Autoexposure 1150 2 uint16 0: deactivated
1: activated
Horizontal Flip 1152 2 uint16 0: deactivated
1: activated
Vertical Flip 1154 2 uint16 0: deactivated
1: activated
ImageRotation 1156 4 uint32 The Image Rotation Value [degree]
Eventmarkers 1160 2 uint16 0: deactivated
1: activated
Position Eventmarkers 1162 2 uint16
0: TopLeft
1: TopRight
2: BottomRight
3: BottomLeft
Number of Eventmarker
Channels 1164 4 uint32
Number of available Eventmarker
channels
OSD Mode 1168 2 uint16
000001: Enable Logo
000010: Enable Comment
000100: Enable Cameraname
001000: Enable Resolution / FPS
010000: Enable Frame-number / -time
100000: Enable IRIG-B Time
OSD Position 1170 2 uint16
0: TopLeft
1: TopRight
2: BottomRight
3: BottomLeft
OSD FontSize 1172 4 uint32 Font Size of the OSD
OSD Font 1176 40 char[40] Font Type of the OSD
OSD Font Style 1216 64 char[64] Font Style of the OSD
OSD Color 1280 40 char[40] Font Color of the OSD
ImageCorrection 1320 1 Byte
Bit 0: Enable/Disable
Bit 1: Saturation
Bit 2: Sharpen
Bit 3: Edge Enhancement
Bit 4: Brightness & Contrast Scaling
Bit 5: Manual White balance
Bit 6: Auto White balance
Red Channel 1321 1 Byte Red Channel Value
Green Channel 1322 1 Byte Green Channel Value
Blue Channel 1323 1 Byte Blue Channel Value
Brightness 1324 1 Byte Brightness
Contrast 1325 1 Byte Contrast
Gamma 1326 1 Byte Gamma
Saturation 1327 1 Byte Saturation
HDR 1328 1 Byte High Dynamic Range [%]
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 5 / 1 4
Name Offset
[byte]
Size
[byte]
Data
Type Description
Free 1329 2423
FREE
Promon header 3752 136 3752…3887 Reserved for promon
specific parameters
Free 3888 208 FREE
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 6 / 1 4
Fixed Pattern Noise FPN
FPN is that part of the image noise that does not change with t ime. Therefore thi s
k ind of noise can be removed. There are two sources for the FPN. Fi r st an individual
noise per pixel . These variat ions ar ise from variat ions in the ampl i f ier within each
pixel . The Second source comes f rom the column ampl i f iers . The second one, the
column noise, i s much more not iceable.
Fig. 1: uncorrected image with fixed pattern noise Fig. 2: image after removing fixed pattern noise
The cameras are cal ibrated under control led condit ions, and for each pixel
coeff icients (a, b and c) are calculated. With these FPN -coeff icients the FPN could
be removed using thi s formula:
Fig. 3: formula to remove FPN
Where i s the pixelvalue at posit ion i in the rawimage. i s the corrected
pixelvalue at posit ion i . are the FPN coeff icients at post ion i . are
constant values.
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 7 / 1 4
Relat ion between image size and coeff icient posi t ion
The FPN coeff icient data covers always the whole sensor , independent of the image
size. Therefore an offset must be calculated to get the corresponding coeff icients
for each imagepixel . The calculat ion of this offset depends on the camera model .
Coeff icient Data
coeffOff setX
co
eff
Off
se
tY
SensorF rame Wi dth
Se
nso
rFra
me
He
igh
t
SensorWi dth
Se
nso
rHe
igh
t
Fig. 4: fpn coefficient offset
Image Data
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 8 / 1 4
S-Ser ies
For the cameras from the S -ser ies al l the coeff icients (F ig. 3) don’t exi st . So the
f i r st term of the formula is always zero. The two constants and are both set to
1600. The coeff icient data start at index 2. The f i rst two 16 -bit values must be
ignored.
Index 0 1 2 3 4 5 6 7 …
P ixe l X X
P 0 P 0 P 1 P 1 P 2 P 2 …
Coeff ic ient c 0 b 0 c 1 b 1 c 2 b 2 …
Offset calculation
(
)
(
)
The sensors i ze i s 1296 x 1024 and the kernels i ze i s 24.
The sensorFrameWidth must be a mult iple of the kernels i ze .
Sample Code
const int sensorWidth = 1296; //horizontal sensor resolution const int sensorHeight = 1024; //vertical sensor resolution const int kernelSize = 24; //sensors kernel size const int coeffFactor = 1600; //constant fpn-coefficient factor //the next 3 values are just an example int sensorFrameWidth = 816; //rounded up image width int sensorFrameHeight = 600; //the image height int bitMode = 0; //bitMode 0 means lowGainMode, 1=middle, 2=high int posCoeff, posIn, posOut; int coeffOffSetX = sensorWidth / 2 - kernelSize * ceil(sensorFrameWidth / kernelSize / 2.0f); int coeffOffsetY = 2 * floor((sensorHeight - sensorFrameHeight + 1) / 4.0f); int lineStartOut = 0; int lineStartCoeff = coeffOffSetX + coeffOffsetY * sensorWidth + 1; //position of the //coefficient corresponding //to the first imagepixel for(int y=0; y<sensorFrameHeight; y++) { posOut = lineStartOut; posCoeff = lineStartCoeff; for(int x=0; x<sensorFrameWidth; x++, posOut++, posCoeff++) { posIn = iHeaderSize + 4 * (posOut / 4) - (posOut & 3) + 3; //swap 4 bytes //if inputvalue is saturated, no fpn correction is calculated (set output to fix value) //otherwise: Output = (Coeff0 * iMode + Coeff1 * Input) / coeffFactor output[posOut] = input[posIn] == 255 ? 255 : input[posIn] == 0 ? 0 : ByteClamp(((fpnCoeff_c[posCoeff] << bitMode) + fpnCoeff_b[posCoeff] * input[posIn]) / coeffFactor); } lineStartCoeff += sensorWidth; lineStartOut += sensorFrameWidth; }
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 9 / 1 4
Q-Series
The three constants (Fig. 3) are set to =22 0 , =2 1 2 and =28 .
Index 0 1 2 3 4 5 6 7 . .
P ixe l P 0 P 0 P 0 P 1 P 1 P 1 P 2 P 2 …
Coeff ic ient c 0 b 0 a 0 c 1 b 1 a 1 c 2 b 2 …
Offset calculation
(
)
(
)
The sensors i ze i s 1696 x 1710 and the kernels i ze i s 32.
The sensorFrameWidth must be a mult iple of the kernels i ze .
Sample Code for Q-Series cameras
const int sensorWidth = 1696; //horizontal sensor resolution const int sensorHeight = 1710; //vertical sensor resolution const int kernelSize = 32; //sensors kernel size const int coeffFactor_d = 1048576;//constant fpn-coefficient factor const int coeffFactor_e = 4096; //constant fpn-coefficient factor const int coeffFactor_f = 256; //constant fpn-coefficient factor //the next 2 values are just an example int sensorFrameWidth = 816; //rounded up image width int sensorFrameHeight = 600; //the image height int posCoeff, posIn, posOut; int coeffOffSetX = sensorWidth/2 + 1.5*kernelSize – ceil((sensorFrameWidth + 3*kernelSize) / (4.0f*kernelSize)) * 2*kernelSize; int coeffOffsetY = 2 * floor((sensorHeight - sensorFrameHeight + 1) / 4.0f); int lineStartOut = 0; int lineStartCoeff = coeffOffSetX + coeffOffsetY * sensorWidth; //position of the //coefficient corresponding //to the first imagepixel for(int y=0; y<sensorFrameHeight; y++) { posOut = lineStartOut; posCoeff = lineStartCoeff; for(int x=0; x<sensorFrameWidth; x++, posOut++, posCoeff++) { posIn = iHeaderSize + posOut //if input is saturated, no fpn correction is calculated output[posOut] = input[posIn] == 255 ? 255 : input[posIn] == 0 ? 0 : ByteClamp( (double)(fpnCoeff_c[posCoeff]) / coeffFactor_f + (double)(fpnCoeff_b[posCoeff]) / coeffFactor_e * input[posIn] + (double)(fpnCoeff_a[posCoeff]) / coeffFactor_d * input[posIn] * input[posIn]); } lineStartCoeff += sensorWidth; lineStartOut += sensorFrameWidth; }
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 1 0 / 1 4
Image Data Header
TIMESTAMP_SECONDS Seconds of Camera time base (Unix Time)
TIMESTAMP_SUBSECONDS Subseconds of Camera time base
(0..9'999'999), Units of 100ns
IRIGB_TIMESTAMP_SECONDS Seconds of decoded IRIGB Time (Unix Time)
IRIGB_TIMESTAMP_SUBSECONDS Subseconds of decoded IRIGB Time
(0..9'999'999), Units of 100ns
EXPOSURE MEASUREMENT Exposure Measurement (0…1023)
ST1: State of STATUS1 line
ST2: State of STATUS2 line
ST3: State of STATUS3 line
ST4: State of STATUS4 line
ITV:
IRIG-B Time valid
0: No IRIG-B Time Signal available
1: IRIG-B Time valid
Important: The image header s i ze var ies between the camera ser ies. The
exact s i ze can be read out f rom the f i le header at the “Offset Image Data
Header” posit ion.
W ORD 1
W ORD 2
W ORD 3
W ORD 4
W ORD 5
W ORD 15
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 1 1 / 1 4
Sample Code for reading image data header
// framedata is a bytearray pointing to the image data header // get timestamp seconds __time32_t time; memcpy(&time, &frameData[0], 4); unsigned int frameSec = ntohl(time); // get timestamp subseconds unsigned int subSec1, subSec2, subSec3; subSec1 = frameData[5]; subSec2 = frameData[6]; subSec3 = frameData[7]; unsigned int frameSubSec = (subSec1 << 16) + (subSec2 << 8) + subSec3; // get IRIGB valid flag unsigned int IRIGTimeValid = frameData[12]; // get IRIGB timestamp seconds memcpy(&time, &frameData[8], 4); unsigned int IRIGFrameSec = ntohl(time); // get IRIGB timestamp subseconds subSec1 = frameData[13]; subSec2 = frameData[14]; subSec3 = frameData[15]; unsigned int IRIGFrameSubSec = (subSec1 << 16) + (subSec2 << 8) + subSec3; // get eventmarker info unsigned int eventMarkers = frameData[4] & 0xF;
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 1 2 / 1 4
5 Bit Image Data (only for X-Series and S-Series cameras)
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 1 3 / 1 4
8 Bit Image Data
Important for Q-Ser ies and Promon-Ser ies cameras:
The pixel sequence shown above 3 – 2 – 1 – 0 does not apply for the Q-Ser ies
cameras. The pixel sequence is exact ly opposite (0 – 1 – 2 – 3), which makes
the pixel rotat ion inside a 32Bit image data word unnecessary.
www.aostechnologies.com
A O S R A W 3 F i l e F o r m a t v 3 . 0 . 0 . d o c x V e r s i o n 3 . 0 . 0 p a g e 1 4 / 1 4
10 Bit Image Data (X-Series and S-Series cameras)
10 Bit Image Data (TRI-Series cameras)