![]() |
|
|
|
#1 |
|
I'm working on sobel edge detection on an fpga using a 3x3 mask. To store the pixel values of the input image, I've decided to use an array. I wrote the code for just the array and some test code to see how it's working. The code worked, so I tried adding a "full" bit that would say when to stop loading the memory. For some reason, whenever I use the "full" bit and implement it to prevent the array from loading again once it's full, the array won't load at all and I get no output. The code is pretty simple and it seems like adding the full bit shouldn't be an issue. Does anyone have any suggestions on what I might be doing wrong?
And the code: Library IEEE; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_misc.all; entity sobel is PORT ( input: IN integer:=0; SW: IN integer:=0; output: OUT integer:=0; LEDR: OUT integer:=0; LEDG: OUT std_logic_vector(8 DOWNTO 0); CLOCK_50: IN std_logic); end sobel; architecture sobelizer of sobel is constant num_cols: Natural:=640; constant num_rows: Natural:=480; constant edge: Natural:=0; constant foreground: Natural:=255; constant threshold: Natural:=68; subtype pixel is integer; signal full: std_logic:='0'; type memory_array is array (1 to 3, 1 to num_cols) of pixel; type mask is array (1 to 3, 1 to 3) of pixel; type next3 is array (1 to 3) of pixel; begin process variable A : mask:=((0,0,0),(0,0,0),(0,0,0)); variable X1 : Natural:=1; variable Y1 : Natural:=1; variable Current_X: Integer:=1; variable Current_Y: Integer:=1; variable memory: memory_array; begin Wait Until CLOCK_50'EVENT and CLOCK_50='1'; if full='0' then memory(X1,Y1):=input; X1:=X1+1; Current_X:=X1; CUrrent_Y:=Y1 if X1=num_cols+1 then X1:=1; Y1:=Y1+1; current_Y:=Y1; end if; if (current_X=num_cols) and (current_Y=num_rows) then full<='1'; X1:=0; Y1:=0; end if; elsif full='1' then X1:=0; Y1:=0; end if; end process; end sobelizer; dashdingo Last edited by dashdingo : 06-15-2007 at 06:56 PM. |
|
|
|
|
|
|
#2 |
|
Member
Join Date: Nov 2006
Posts: 32
|
You have not defined parameters in sensitivity lists. signal "full" should be in sensitivity list. Or you can modify your process like :
process( CLOCK_50 ) variable A : mask:=((0,0,0),(0,0,0),(0,0,0)); variable X1 : Natural:=1; variable Y1 : Natural:=1; variable Current_X: Integer:=1; variable Current_Y: Integer:=1; variable memory: memory_array; begin if CLOCK_50'EVENT and CLOCK_50='1' then if full='0' then memory(X1,Y1):=input; X1:=X1+1; Current_X:=X1; CUrrent_Y:=Y1 if X1=num_cols+1 then X1:=1; Y1:=Y1+1; current_Y:=Y1; end if; if (current_X=num_cols) and (current_Y=num_rows) then full<='1'; X1:=0; Y1:=0; end if; elsif full='1' then X1:=0; Y1:=0; end if; end if; end process; end sobelizer; quantum_dot |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jun 2007
Posts: 4
|
Thank you for your help! I ended up changing the code around so the "full" issue could be worked around. I now have a working edge detection algorithm with a few issues that need to be worked out. I keep getting triples of the input image on the output. I'm thinking it's because I set a lower resolution for the output because the FPGA can't hold a full 640x3 array in addition to all the other code. Either that, or I'm having a timing issue.
dashdingo |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Sep 2009
Posts: 1
|
I have 1 code about 8 mask sobel as follows. Please help me.
Thanks you very much!!! Code:
minhhn0205 Last edited by minhhn0205 : 09-26-2009 at 07:00 PM. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| i need Golf Ball motion detection simulator | meao | Software | 1 | 10-11-2006 06:41 AM |
| KQEK.com DVD Reviews of Kolberg, River's Edge, Border Street & more! | markh29@sympatico.ca | DVD Video | 0 | 07-16-2006 10:50 PM |
| DVD Verdict reviews: BAMBI: PLATINUM EDITION, BRIDGET JONES: THE EDGE OF REASON, and more! | DVD Verdict | DVD Video | 0 | 03-28-2005 10:13 AM |
| Edge Enhancement Questions? | Peter Mason | DVD Video | 29 | 11-09-2003 03:51 AM |
| Anyone Out There Like: The Cutting Edge ?? -- Or know anyting about it? | Jeff | DVD Video | 0 | 09-12-2003 03:26 PM |