Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # change to the name of your python interpreter
- python="python3"
- # file name of original binary (filtermagic before you changed anything)
- old="filtermagic_old"
- # name of test image
- test_img="img.bmp"
- # check a given filter
- function check {
- printf "%s %13s" "checking" "$1: "
- # run your implementation
- ./filtermagic $test_img $1 > /dev/null
- # move output to results folder
- mv out.bmp results/$1.bmp
- # run reference implementation
- ./$old $test_img $1 > /dev/null
- # move output to results folder
- mv out.bmp results/$1_reference.bmp
- # calculate md5 checksum of results
- result=$(md5sum results/$1.bmp)
- reference=$(md5sum results/$1_reference.bmp)
- # compare md5 sums
- echo $($python -c "print('success' if '$result'.split(' ')[0] == '$reference'.split(' ')[0] else 'failed')")
- }
- # make sure everything is compiled!
- make >/dev/null
- # make results directory
- mkdir results > /dev/null 2> /dev/null
- # run tests
- check grayscale
- check valuecap
- check edge
- check sequence
- check mark
- check maxcolor
- check reduce
- check threshold
- check lucy
- check bleed
- check luminance
- check enhance
Add Comment
Please, Sign In to add comment