Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[MOVED] Image processing and VHDL

Status
Not open for further replies.

lamrita

Newbie level 1
Joined
Dec 8, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
aURANGABAD
Activity points
1,288
Hi everbody
I want read a text file of integer matrix in VHDL . My problem is that i want to read the singal intger from a line at a time. for example if my file is
12 23 56 102......
13 23 43 1.....
14 89 67 2....
15 90 123 30 ....
From this file i want read 12 first than 13 than14 (columnwise reading ) and stored it in vector.
 

Re: Image processing and VHDL

Hello,
I think you cannot read any file in VHDL. You can store the file contents in the Memory Initialisation File(.mif). Then u can read the contents to ur main program and use it.

If u need more details contact me.

Regards,
N.Muralidhara
 

Re: Image processing and VHDL

You must first create a text file
example:It was a image of the text file conversion,in matlab:
Code:
[sourcepic,phatsource]=uigetfile(('*.jpg;*.tif;*.png;*.gif;*.bmp'),'select a picture');
A=imread([phatsource sourcepic]);

B=rgb2gray(A);
% B=edgeim;
disp('Image file read successful');
%figure,imshow(B),title('org');

C=imresize(B,[176 286]);
figure,imshow(C),title('croped');
d=reshape(C,1,[]);
disp('Reshapping done');
fid = fopen('img.txt', 'wt');
fprintf(fid, '%8d\n', d);
disp('Text file write done');disp('');
fclose(fid);
Of course, a grayscale image
Then read this file with commands:
use IEEE.STD_LOGIC_TEXTIO.ALL;
Code:
reading : process
	file infile : text is in "img1.txt"; --declare input file 1987
	file infile2 : text is in "img2.txt"; --declare input file 1987
	variable inline,inline2 : line; --line number declaration
	variable dataread1 : real;
	begin
		wait until clk = '1' and clk'event;
		 
			if (not (endfile(infile) or endfile(infile2)) ) then --checking the "END OF FILE" is not reached.
					readline(infile, inline); 
					read(inline, dataread1);
					d1 <=integer(dataread1);
				a <= CONV_INT2STDLV(d1,8);
					readline(infile2, inline2); 
					read(inline2, dataread1);
					d2 <=integer(dataread1);
				b <= CONV_INT2STDLV(d2,8);
			else
				a<=x"00";
				b<=x"00";
			 
		 
		  endoffile <='1'; --set signal to tell end of file read file is reached.
		end if;
	end process reading;
of course,in testbench,because it not syntesised
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top