It crashes before it even starts executing anything in main.
You don't really have any globals that run constructors that do significant amounts of work, so it sounds like a build problem rather than a programming problem.
An alternative to pass by value on this example:
Scalar meanpixel(Mat matrx)
is to pass by const reference. It looks like this:
so i decided to reduce the size of the 3d array to 60 and no more stack over flow error
but it now comes error to when i used pass by const reference
Assertion failed (!fixedSize() || ((Mat*)obj)->size.operator()()==_sz) in unknow function, file .... matrix.cpp, line 1313.