text stringlengths 0 234 |
|---|
for m in 1..256 loop |
for i in 1..img.dx loop |
for j in 1..img.dy loop |
if img.pixel(i,j) = m then |
histArray1(m) := histArray1(m) + 1; |
end if; |
end loop; |
end loop; |
end loop; |
--Populate Probability Density Arr |
for m in 1..256 loop |
PDFArray1(m) := (Float(histArray1(m))) / (Float(totalPixels)); |
end loop; |
--Calculate Cumulative Histogram |
cumuHistArray1(1) := PDFArray1(1); |
for m in 2..256 loop |
cumuHistArray1(m) := PDFArray1(m) + cumuHistArray1(m-1); |
end loop; |
--multiply the CH by 255 and round, forming a new integer array |
for m in 1..256 loop |
CHIntArray1(m) := Integer(cumuHistArray1(m) * 255.0); |
end loop; |
--map the new greyscale values to a histogram record |
for i in 1..img.dx loop |
for j in 1..img.dy loop |
equalImage.pixel(i,j) := CHIntArray1(img.pixel(i,j)); |
end loop; |
end loop; |
return equalImage; |
Function Definition: procedure Remove_Target is |
Function Body: use AAA.Strings; |
begin |
for I in Lines.First_Index .. Lines.Last_Index loop |
declare |
Line : constant String := Replace (Lines (I), " ", ""); |
begin |
if Armed and then Has_Prefix (Line, Target) then |
Found := True; |
Lines.Delete (I); |
exit; |
elsif Has_Prefix (Line, "[[") then |
-- Detect a plain [[array]] with optional comment |
Armed := |
Line = Enter_Marker or else |
Has_Prefix (Line, Enter_Marker & '#'); |
elsif Armed and then Line /= "" and then |
Line (Line'First) /= '[' -- not a table or different array |
then |
-- We are seeing a different entry in the same array |
-- entry; we can still remove our target if later found |
-- in this entry. |
null; |
elsif Line = "" or else Has_Prefix (Line, "#") then |
-- We still can remove an entry found in this array entry |
null; |
else |
-- Any other sighting complicates matters and we won't |
-- touch it. |
Armed := False; |
-- TODO: be able to remove a table in the array named as |
-- Entry, i.e., something like: |
-- [[array]] |
-- [array.entry] or [array.entry.etc] |
-- etc |
-- Or, be able to remove something like |
-- [[array]] |
-- entry.field = ... |
end if; |
Function Definition: procedure Remove_Empty_Arrays is |
Function Body: -- This might probably be done with multiline regular expressions |
Deletable : Natural := 0; |
-- Tracks how many empty lines we have seen since the last [[ |
Can_Delete : Boolean := True; |
-- We can delete as long as we are only seeing empty lines |
use AAA.Strings; |
begin |
-- Traverse lines backwards |
for I in reverse Lines.First_Index .. Lines.Last_Index loop |
declare |
Line : constant String := Replace (Lines (I), " ", ""); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.