Forum Discussion
Altera_Forum
Honored Contributor
15 years agoNo Reply's are coming so let me explain it in an other way.
A Camera sends its pixel from left to right and top to bottom. (Like you read a text). I need to find the brightest pixel in a column (Vertically). Therefor i need to memorize the maximum value for each column. I use 2 array's : Position array and Amplitude_array - Amplitude array witch holds the maximum value of the pixel for each column - Position array witch holds the position of the pixel for each column At start both array's are filled with '0' First line is read -> I compare the value of the first image_pixel with the value that is stored in the amplitude_array. If the read value is more than the stored one: Than overwrite the stored value with the new one in the amplitude_array. Also store the linenumber in the position_array. If not -> Do nothing to the array's I need to do this for 1280 columns (image size is 200x1280) The result: An array with the position of 1280 pixels (brightest) I wrote some code but the problem is that it generates logic to find the brightest pixel 1280 times. I need code that that generates logic, to find the brightest pixel and use it 1280 times in stead of making it. EXPLANATION OF MY CODE:
signal send_data : std_logic := '0';
signal line_counter : integer range 0 to 255 := 0;
signal column_counter : integer range 0 to 1279 := 0;
signal max_column : integer range 0 to 1279 := 0;
type array_type is array (0 to 1279) of std_logic_vector (7 downto 0);
signal array_position , array_amplitude : array_type; Declaration Array
if CAM_DATA_VALID = '1' then
column_counter <= column_counter +1 ;
if (CAM_DATA >= array_amplitude(column_counter)) then
array_position(column_counter) <= std_logic_vector (to_unsigned (line_counter, 8));
array_amplitude(column_counter) <= CAM_DATA;
end if;
end if;
Need to wait untill DATA_VALID for camera. If valid add index (column) with one. T'check if New pixel is brighter than stored one If so -> Store position (line number) to array_position -> Store new pixel in array_amplitude For each new line there is a counter that increases line_number. Why doe's this code generates so dam'n much logic ? Plz Help