Matlab - Leer DNG imagenes

 
Vista:
sin imagen de perfil

Leer DNG imagenes

Publicado por Joaquín (50 intervenciones) el 02/06/2014 23:13:30
Buen día, vengo hoy con una duda, alguien ha conseguido poder leer en Matlab las imagenes RAW? Vienen siendo como el negativo capturado por la camaram, usualmente tienen la extensión DNG, pero al intentar leerlo con el comando "imread" lees la imagen pero queda toda "pixeleada", y mis imagenes son en RGB... y lo muy muy poco que he encontrado en google es para imagenes en escala de grises...

Muchos hemos leído imagenes jpg,png o tif.... pero al tratar con el formato original o más óptimo de la imagen, no he encontrado como matlab lo haga...


Esta es la info de la imagen

info =

Filename: 'C:\Users\pee.imanufactura\Documents\Joako\Pentaxk30 DNG\IMGP6059.DNG'
FileModDate: '30-may-2014 11:37:16'
FileSize: 19119849
Format: 'tif'
FormatVersion: []
Width: 160
Height: 120
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: [77 77 42 0]
ByteOrder: 'big-endian'
NewSubFileType: 1
BitsPerSample: [8 8 8]
Compression: 'Uncompressed'
PhotometricInterpretation: 'RGB'
StripOffsets: 104480
SamplesPerPixel: 3
RowsPerStrip: 120
StripByteCounts: 57600
XResolution: 300
YResolution: 300
ResolutionUnit: 'Inch'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 8
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: [255 255 255]
MinSampleValue: 0
Thresholding: 1
Offset: 8
Make: 'PENTAX '
Model: 'PENTAX K-30 '
Software: 'K-30 Ver 1.00 '
DateTime: '2014:05:25 13:00:27 '
Artist: ' '
SubIFDs: {2x1 cell}
Copyright: ' '
DigitalCamera: [1x1 struct]
GPSInfo: [1x1 struct]
DNGVersion: [4x1 double]
DNGBackwardVersion: [4x1 double]
UniqueCameraModel: 'PENTAX K-30 '
ColorMatrix1: [9x1 double]
ColorMatrix2: [9x1 double]
AnalogBalance: [3x1 double]
AsShotNeutral: [3x1 double]
BaselineExposure: -0.5470
BaselineNoise: 1
BaselineSharpness: 1
LinearResponseUnit: 1
DNGPrivateData: [102400x1 double]
CalibrationIlluminant1: 17
CalibrationIlluminant2: 21

>> info.SubIFDs{1}

ans =

Filename: 'C:\Users\pee.imanufactura\Documents\Joako\Pentaxk30 DNG\IMGP6059.DNG'
FileModDate: '30-may-2014 11:37:16'
FileSize: 19119849
Format: 'tif'
FormatVersion: []
Width: 4960
Height: 3300
BitDepth: 12
ColorType: 'CFA'
FormatSignature: [77 77 42 0]
ByteOrder: 'big-endian'
NewSubFileType: 0
BitsPerSample: 12
Compression: 'JPEG'
PhotometricInterpretation: 'CFA'
StripOffsets: 162080
SamplesPerPixel: 1
RowsPerStrip: 3300
StripByteCounts: 17686238
XResolution: 300
YResolution: 300
ResolutionUnit: 'Inch'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: 4095
MinSampleValue: 0
Thresholding: 1
Offset: 103370
CFALayout: 1
BlackLevelRepeatDim: [2x1 double]
BlackLevel: [4x1 double]
WhiteLevel: 3965
DefaultScale: [2x1 double]
DefaultCropOrigin: [2x1 double]
DefaultCropSize: [2x1 double]
BayerGreenSplit: 0
AntiAliasStrength: 1
ActiveArea: [4x1 double]
UnknownTags: [2x1 struct]


Y también adjunto la misma imagen en DNG..

Si alguien alguna vez lo hizo, muchas gracias

Saludos




Un código que tengo es este.... pero no leo la imagen.. sino puro ruido!!!.. como cuando la tele sintoniza pura estática... una pantalla gris es lo que obtengo...

id = fopen('C:\Users\pee.imanufactura\Documents\Joako\Pentaxk30 DNG\IMGP6059.DNG', 'r');
x = fread(id,inf,'uint8')'; x=x/256;
fclose(id);

width=4960; height=3300; N=width*height;
%ind1=1:N; ind2=N+1:2*N; ind3=2*N+1:3*N;
ind1=1:N; ind2=1:N; ind3=1:N;

Ir=x(ind1); Ig=x(ind2); Ib=x(ind3);
Ir=reshape(Ir,width,height);
Ig=reshape(Ig,width,height);
Ib=reshape(Ib,width,height);

figure(1); clf;
C=zeros(height,width,3);
C(:,:,1)=Ir';
C(:,:,2)=Ig';
C(:,:,3)=Ib';
imagesc(C);




P.D no puedo adjuntar la imagen :/ pesa 18 megas... pero cualquier imagen DNG a color debería servir..

Saludos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder