Hello guys,
I have a question. I have an image and I am wondering how to use MATLAB to
generate a text file that contains the pixel values of the image?
Thanks
Haidar
pixel values
Started by ●January 29, 2007
Reply by ●January 30, 20072007-01-30
Hi Haidar,
u can proceed the steps:
x = imread('\'); % pixel values
imshow(x) % to show the image in MATLAB
now x is ur pixel values of the image.
On 1/28/07, heidar mhr wrote:
>
> Hello guys,
>
> I have a question. I have an image and I am wondering how to use MATLAB to
> generate a text file that contains the pixel values of the image?
>
> Thanks
>
> Haidar
>
>
u can proceed the steps:
x = imread('\'); % pixel values
imshow(x) % to show the image in MATLAB
now x is ur pixel values of the image.
On 1/28/07, heidar mhr wrote:
>
> Hello guys,
>
> I have a question. I have an image and I am wondering how to use MATLAB to
> generate a text file that contains the pixel values of the image?
>
> Thanks
>
> Haidar
>
>
Reply by ●January 30, 20072007-01-30
Open the read matrix (image) in array editor in Matlab. Then copy and paste
whole matrix into a notepad.
Reply by ●January 31, 20072007-01-31
--- In m..., Naveen wrote:
>
> Open the read matrix (image) in array editor in Matlab. Then copy
and paste whole matrix into a notepad.
>
alternatively for automatic transfer write to a file using the fopen
and fprintf commands so something like
im = imread('myimage');
fid = fopen('mytxtfile.txt', 'w+');
for i=1:numel(im)
fprintf(fid, '%c\t', im(i));
end
It's slightly more complicated than that depending on whether you
just want the values or whether you also want the structure of the
image (i.e. maintaining rows and columns).
hth
>
> Open the read matrix (image) in array editor in Matlab. Then copy
and paste whole matrix into a notepad.
>
alternatively for automatic transfer write to a file using the fopen
and fprintf commands so something like
im = imread('myimage');
fid = fopen('mytxtfile.txt', 'w+');
for i=1:numel(im)
fprintf(fid, '%c\t', im(i));
end
It's slightly more complicated than that depending on whether you
just want the values or whether you also want the structure of the
image (i.e. maintaining rows and columns).
hth