Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

hi all.. i am writing a program to convert image to text... but i am getting an error " Invalid file identifier. Use fopen to generate a valid file identifier."...can pls get me out of it...i am attaching the code with it...

1 visualización (últimos 30 días)
clc; clear all; img=imread('F:\TEST PICTURES\car.jpg'); %Read a Gray image from workspace img=rgb2gray(img); [r c] = size(img); img=imnoise(img,'salt & pepper',0.50); img=uint8(img); img_double=double(img); k=img_double'; %Transpose the matrix m=reshape(k,r*c,1); %Pixels are reshaped into 262144 rows with single column fid=fopen('c:\lena512_50.txt', 'w'); %Open the file outfile.txt for writing purpose for j=1:65536 z(j)=m(j); end fprintf(fid, '%x\n', z'); %Write hex formated data to file id fclose('all'); imshow(img); %Display the image for which text equivalent is generated

Respuestas (1)

Image Analyst
Image Analyst el 15 de Abr. de 2014
What is the value of fid? Where is your code that checks the value of fid? Don't you want to write robust code that checks for things like failures of certain functions?
Why do you want to write all the pixel values of out to a text file anyway? And why are you naming the values from car.jpg as "lena512_50.txt"???? That seems like a deceptive name.

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by