0
Matrix in array
I wanna ask a question that i cant solve it by my self. Create a program to create 2 grayscale image matrices A and B whose random element value (0.255) then specify the matrix of image C which is a combination of A and B (Cij = Aij + Bij) with the rule if Cij> 255 then Cij = Max (Aij, Bij). Please help me
3 Answers
+ 1
i assume you able to create matrix and fit it.
A[i][j]+B[i][j] > 255 ? C[i][j] = max(A[i][j], B[i][j]) : C[i][j] = A[i][j]+B[i][j];
and don't forget use:
#include <algorithm>
0
How to use the rand function in that matrix?
0
try to use google to searching simple things
http://www.cplusplus.com/reference/cstdlib/rand/
v1 = rand() % 101; // v1 in the range 0 to 100