Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
公告
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 讨论

How to implement an histogram in a FPGA device??

Altera_Forum
名誉分销商 II
3,591 次查看

I need to implement an histogram in a FPGA for 2D image frames.  

 

Any suggestion or reference design???  

 

Thanks in advance.
0 项奖励
8 回复数
Altera_Forum
名誉分销商 II
2,337 次查看

Take a RAM block full of zeros 

 

As each pixel comes in, use it as an *address* into the RAM block, take the data, increment it and write it back in. 

 

If your FPGA clock is less than 2x the pixel clock, you need to be a bit cleverer to account for the RAM read latency... 

 

Cheers, 

Martin
0 项奖励
Altera_Forum
名誉分销商 II
2,337 次查看

Hi Martin, 

 

Thanks a lot for giving to me such a good trick, I've got implemented it in dspbuilder and i'm testing it using Simulink. At this point I've have the histogram values within a double port RAM, but i have some doubts about how get the statistical mode. 

 

I've attached a part of my design for more information. 

 

best regards!!!
0 项奖励
Altera_Forum
名誉分销商 II
2,337 次查看

For the mode, don't you just find the histogram bin with the highest value in? 

 

At the end of the frame, go through each address in the histogram with a counter and latch the address and data values if the data is bigger than your previous "biggest value". 

 

Cheers 

Martin
0 项奖励
Altera_Forum
名誉分销商 II
2,337 次查看

Ok martin, I'll try using a latch, thanks again!!!

0 项奖励
Altera_Forum
名誉分销商 II
2,337 次查看

Latch might not have been the best choice of terminology on my part - what I meant was a set of flipflops which are enabled only when you want to store data in them (ie when you have a new "biggest value"). I didn't mean a latch in the old 7475 latch sense - They're usually a bad idea in FPGA-land! 

 

Cheers, 

Martin
0 项奖励
Altera_Forum
名誉分销商 II
2,337 次查看

OK Martin I know what you wanted to mean, I'm trying to do using two 8 bit d-type flip-flop updating the new maximun value of the frequency and the value associated. 

 

Your explanation was enough for me. Are you currently working with FPGA's??? or just in image processing? 

 

regards
0 项奖励
Altera_Forum
名誉分销商 II
2,337 次查看

i've got a project to write a VHDL program for Histogram computation of a 16x16 grey image...... can you please guide me on how to do it?? i'm new to vhdl and fpga's......

0 项奖励
Altera_Forum
名誉分销商 II
2,337 次查看

 

--- Quote Start ---  

i've got a project to write a VHDL program for Histogram computation of a 16x16 grey image...... can you please guide me on how to do it?? i'm new to vhdl and fpga's...... 

--- Quote End ---  

 

 

This thread already gives you a few good hints.
0 项奖励
回复