Mat.forEach for 2 Matrices? Compare elements

Hey there,

i successful implemented Mat.forEach for efficient computing values of one Matrix. However for my next step i need to compare each value of 2 matrixes and compute the difference in percent. The most efficient way to iterate over each element of a Matrix is using forEach. Is there a possible way to compare each elements of 2 matrixes using forEach?

edit retag close merge delete

1

i need to compare each value of 2 matrixes

please be more concise. what's the purpose of it ?

The most efficient way to iterate

you should avoid iterating at all cost, and prefer builtin vectorized functions like compare() instead.

again this is somewhat an XY problem. the solution Y you ask about is most likely not the correct answer to problem X, but we need to know the problem to answer.

( 2019-10-04 03:02:08 -0500 )edit
1

which language are you talking about, even ?

( 2019-10-04 03:04:19 -0500 )edit
1

I need to compute the difference of brightness of each frame in percent. My brightness is a 1 Channel Mat. I use c++ because i need real time observation.

I know that iterating should be avoided. Because of that i want to use .forEach Method for maximum speed because it also uses multithreading. However i dont see how i can implement the per value comparison of 2 Mat with .forEach

( 2019-10-04 06:12:59 -0500 )edit
1

difference of brightness

absdiff() and sum()

difference in percent

in percent of what ?

( 2019-10-04 06:16:13 -0500 )edit
1

in percent to the first recorded frame

( 2019-10-04 06:41:03 -0500 )edit