distance between images, pixel by pixel
I'm need to calculate the euclidean distance between two cv::Mat
images in a pixel by pixel manner. Is there a function that does this?
Specifically, I need the result to be of the form
diff[i] = sqrt( (r1-r2)^2 + (g1-g2)^2 + (b1-b2)^2 )
where diff
is a Mat
. If there is no function, is there a simple way to calculate this?
Thanks!
just saying:
^
is the 'binary or' operator in c++, not pow !you can use cv::norm for the L2 distance:
How can I store the result in a
Mat
? Sorry - I justed started using opencv yesterday.don't ever feel sorry for asking ;)
why do you want to do that ? (and there's no easy way)
I'm implemented painterly rendering for a project. One of the steps is the calculate the distance between the source and a blurred image in a pixel by pixel manner, then sum square regions of the distance map to make decisions. I found the sum of the regions in a Mat using
operator()
andsum
-- I'm hoping that the distance map can be found as a Mat then.