Granted the three arrays contain 3x365400 pixel values. But this takes minutes. The same done in PHP takes three seconds including to get the image!
I am not very experienced in bash scripting, so it might have crucial error.
for index in ${!R_pixel_array[@]}; do
blue_red=bc <<< ${B_pixel_array[index]}-${R_pixel_array[index]}
green_red=bc <<< ${G_pixel_array[index]}-${R_pixel_array[index]}
if (( $(echo "$blue_red < 10" |bc -l) )) && (( $(echo "$green_red < 10" |bc -l) )) && (( $(echo "${B_pixel_array[index]} > 100" |bc -l) ))
then
((count=count+1))
fi
done