Reading a .dat image file - image

I have an image stored in .dat format an I want to read and then show the image. imshow and imread functions don't work.what are the other functions that I can use?
Note that I'm using Matlab R2010a

The load function should work
load("filename.dat")

Related

How to use imread for big images on matlab?

I have big a tiff file (2.19gb). When im using imread fuction matlab says
"Requested 47937x51599x4 (9.2GB)..."
My question is how can i read and make my calculations on big image file like this?
If it is a *.tiff image, then you can read a portion of the image with:
im=imread('img.tif','PixelRegion',{[1 100],[1 100]});

Matlab image file convert from *.PPM into *.PGM?

I have dataset of training images in .ppm format.
But when I want to extract the feature using SIFT descriptor from Lowe, I have an problem.
Because my training images dataset is in *.PPM format, but to use SIFT function from lowe, the images required is in *.PGM format.
Everytime I give my *.PPM image file, I always get this error
Error using '
Transpose on ND array is not defined.
Error in sift (line 38)
fwrite(f, image', 'uint8');
I know that I can convert my *.PPM image inti *.PGM by using
imwrite(image,'test.pgm')
But it means, that I'll make new file with *.PGM format, And I dont need it..
Any idea??

Reading a PGM file in Matlab

I'm trying to run the command:
[face,MAP]=imread('face1.pgm');
but I get an empty array for MAP. I was able to successfully read the file data into face though.
PGM is a grayscale image format. There is no colormap. Were you expecting one? The normal behavior for imread is to return an empty colormap if the file didn't contain one.

Ghostscript Stamp Image on PDF

Is there any way to stamp or overlap a tiff image on a existing PDF file and output the result using Ghostscript?
I have two PDF which i want to merge in a result PDF with one over the other using ghostscript. I want to know if this can be done and how, or if it may work with one PDF as tiff image on top of the base PDF.
Can ghostscript make this stamp using layers in the PDF?
Thank you for your answers
The pdfwrite device in Ghostscript doesn't really support layers, so you can't use that. Also its unclear why you think layers would help.
TIFF isn't part of PostScript (or PDF), so you can't directly read a TIFF file into GS. I have elsewhere posted a PostScript program which reads TIFF files and renders them for output. You could use that to read a TIFF file.
However, you would have to mess about with either the PDF interpreter or a custom EndPage procedure in order to read and render the TIFF file. And unless you take specific kinds of action, it will be opaque, which may well not be what you want.
The Ghostscript PDF interpreter doesn't really lend itself to this kind of manipulation, have you considered using pdftk instead ?

Converting image to data file (.dat) in matlab

Is there a way in matlab to convert an image file i.e; .png to .dat file?
It depends on the format of your .dat file. .dat is not a standard extension so you can get this from somewhere or design your own writer and reader. In terms of reading the .png you can just use matlabs imread('filename') function. This will return a NxMx3 matrix of the image and RGB values.
I would suggest combining the RGB values into a single float value and then using dlmwrite or csvwrite to store it. If you want to manipulate the image first that will be up to you.

Resources