Use cv::integral() on multi-channel image?
Can you use cv::integral on a BGR
Mat? I want to calculate the integral image for each channel. Do I need to split the channels and call cv::integral
for each channel or can I just use the function with a 3 channel Mat?
I am currently using this utility class that helps but I'm not sure if its made to handle multichannel Mats?
what are you trying to achieve here ? what is the context ?
@berak In a video frame I am sliding a window over a 3 channel image and inspecting the variance under that window. If its above a threshold I perform more operations. Integral images will provide a more efficient and faster way to achieve this than
meanStdDev()
.do you have to inspect many more than one window ?
checking integral images is cheap, but calculating them is terribly expensive. (do some profiling, you'll see.)
@berak, thats exactly what I am doing, reimplementing my algorithm using
cv::integral
instead ofmeanStdDev()
to test if or how much frames per second increase I get.oh sliding window (i missed that). that's enough checks to justify it, then ;)
@berak thanks, is that link to an integral image correctly handling/calculating the variance and mean for a 3 channel image? I get some weird results on 3 channel images (like numbers over 100 million).
no idea, how large your image is, and how you check the values
you can also use CV_64F as result type (if you suspect a int32 overflow)
maybe we need to see your code ?