The posted code looks like C++ with parts of it described rather than coded.
I see this:
- sort color_array in descending manner;
I presume you could write a function which when passed the address of color_array[0] and an int with the number of elements in the array would sort the array in descending sequence.
I suggest you make // comments out of every line of the code and removr all /* and */. Then surround all these commented lines with:
- int main()
-
{
-
put the commented lines here
-
}
Now compile it and Bingo! you have a running program.
Next, UN-COMMENT:
- image cov_img, output_cov_img; /* input and output images
and re-compile. This will fail because image is not declared.
So determine how to declare image.
Recompile. Keep a it until it compiles.
Then UN-COMMENT something else yu can get your head around. Then recompile.
The idea is to keep the code compiling without error all the time. When you add to it and it doesn't compile it's probably the last thing you added that has a problem.
Eventually, all of the code will be uncommented and replaced with code that compiles.
Post again and let us know how it's going.