- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello friends.....i am trying to do image processing using DE2 board in verilog hdl and i had written the code...but i got stucked at taking image as input and to load it into the memory on the board.....
GuptaLink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should post more information in order to allow the community helping you. What do you mean by "got stucked"? Where exactly is the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is your video capture device? it's a terasic camera?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i am not capturing any image for my project and i am just taking already captured image...i have an idea of taking image by LUT register or by using SD ram...do u have any idea regarding these methods??...anyways thanks for ur reply and interest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i got stucked means...i dont have any knowledge regarding image processing using FPGA...i wrote code to process image after taking it as input....i dont know how to connect image inout to my code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try with a .mif file related to a lpm_rom megafunction.
In this file you should include the image contents, organized, i.e, by rows. This matlab function takes a matlab vector var and creates a .mif file of depth cells and width bits each one. function miffile(filename,var,width,depth) fh=fopen(strcat(filename,'.mif'),'w+'); fprintf(fh,'WIDTH=%d;\r\n',width); fprintf(fh,'DEPTH=%d;\r\n',depth); fprintf(fh,'ADDRESS_RADIX=DEC;\r\n'); fprintf(fh,'DATA_RADIX=DEC;\r\n'); fprintf(fh,'CONTENT BEGIN\r\n'); for k=1:length(var) fprintf(fh,strcat(num2str(k-1),':',num2str(var(k)),';\n')); end fprintf(fh,'END;\r\n'); fclose(fh); Matlab stores the image as a matrix, you should resize it as a vector. in order to read the ROM include two counters, index_column and index_row. index_rom=index_row*(columns_per_row) + index_column- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree with parrado, and another way could be to instantiate an ALTSYNCRAM block and use it as a ROM (it is a possibility offered by the MegaWizard). The ROM should be initialized by a MIF file and the ROM cells should be read sequentially by building a simple external verilog code that generates the addresses that are sent to the read_addr port of the ALTSYNCRAM block.
It is a simple job, just try it out and tell us if you encounter problems.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your replies...i will check them and tell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Try with a .mif file related to a lpm_rom megafunction. In this file you should include the image contents, organized, i.e, by rows. This matlab function takes a matlab vector var and creates a .mif file of depth cells and width bits each one. function miffile(filename,var,width,depth) fh=fopen(strcat(filename,'.mif'),'w+'); fprintf(fh,'WIDTH=%d;\r\n',width); fprintf(fh,'DEPTH=%d;\r\n',depth); fprintf(fh,'ADDRESS_RADIX=DEC;\r\n'); fprintf(fh,'DATA_RADIX=DEC;\r\n'); fprintf(fh,'CONTENT BEGIN\r\n'); for k=1:length(var) fprintf(fh,strcat(num2str(k-1),':',num2str(var(k)),';\n')); end fprintf(fh,'END;\r\n'); fclose(fh); Matlab stores the image as a matrix, you should resize it as a vector. in order to read the ROM include two counters, index_column and index_row. index_rom=index_row*(columns_per_row) + index_column --- Quote End --- In the above matlab code what do you mean by filename in the arguments.....should i need to give image name...if so i gave the filename as avergra2.bmp (function miffile(avergra2,var,width,depth)) can you also explain what is the purpose of index_rom (the last command)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You must read the image:
I=imread('your_image-bmp'); Resize the image in order to access it from a plain rom Ir=reshape(I',prod(size(I)),1); Now you can generate your mif file: miffile('your_image.mif',Ir,8,length(Ir)) Each pixel is coded using 8 bits. (gray scale images). If you are going to process true color images, you should instance 3 memories for each color plane. This .mif file can be used in an altsyncram megafunction instantiated in ROM mode. The index_rom is the address of the altsyncram. This logic must be implemented in your hardware.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yeah...i did all this things and i got the result later...i am sorry that i did not updated it here.....
i took image of size 64*64 and i got result a vector of length 4096..... now i am trying to implment altsyncram...i will write the code and if i get any errors i will paste it here..... anyways thank you very much for your help......i promise that it was really very helpful- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.....i had a problem with my quartus II software...i think all features are not available for my software.....when i am creating altsyncram megafunction i didnt fine it in my dialog box....i am really poor in creating megafunctions...can u please tell me the steps i need to follow....
can i take input to my code as hexadecimal using this megafunction...because i wrote my code with inputs as hexadecimal values Regards, Gupta...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1) double-click in a free area of your bdf file where you want to insert the altsyncram
2) a window will open up 3) in the field "Name:" (left side of the window) write down "altsyncram" and automatically the Altsyncram symbol will appear on the right side 4) tick "launch MegaWizard plug-in" and press OK 5) follow the instructions of the wizard 6) at page 3 of 12 of the wizard select "with one read port (ROM mode)" 7) at page 10 of 12 you can select the .mif file format or the .hex format![](/skins/images/B7BA37F9CE4B52FF7CAE1FB0388839C8/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page