Declare locals up front so that code will compile with -Werror=declaration-after-statement

It appears -Werror=declaration-after-statement is used when 1.9.3 is
built and image_science uses the same gcc flags.