how to create an image from text file?

4 views (last 30 days)
DINESH
DINESH on 25 Apr 2014
Answered: Image Analyst on 25 Apr 2014
%i hav created an text file from an image..... how to create an image from text file...?thanks %i have added my code
a=imread('coins.png');
dlmwrite('1.txt',a,'delimiter',' ');

Answers (1)

Image Analyst
Image Analyst on 25 Apr 2014
Use dlmread(). Did you try this:
filename = 'coins.txt';
grayImage = imread('coins.png');
dlmwrite(filename, grayImage, 'delimiter',' ');
recalledImage = dlmread(filename, ' ');
whos recalledImage;
grayImage = uint8(recalledImage); % Convert to uint8.
whos grayImage;
% Check against original
differenceImage = abs(recalledImage - double(grayImage));
max(differenceImage(:))
delete(filename); % Delete temporary text file.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!