First time here? Check out the FAQ!
answered 2020-04-21 04:22:06 -0600
imread() CAN fail, so please check like image.empty() before trying to process it.
image.empty()
also -- please try to avoid per-pixel loops, they're slow and error-prone.
your whole code coud be simply written as:
modified *= 0.5;