Ask Your Question
-1

adding several images

asked 2013-12-19 08:11:56 -0600

mahsa gravatar image

updated 2013-12-20 02:53:33 -0600

is there any way to add several images two each other using opencv?

thanks in advance...

after editing:

 int N;
     cin >> N;
     for(int i=0; i<sen; i++){
        Nframes.push_back(pClose); //pclose is a float pointer which points to the current frame
        if(Nframes.size() == N){
            for(int i=N; i>0; i--){
               Nframes.pop_front();

             //  addWeighted(src1, alpha, src2, beta, gamma, dst, -1);

           }
        }
     }
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-12-19 08:18:43 -0600

Here's an answer as short as your question

Mat A, B, C;

C= A + B;
edit flag offensive delete link more

Comments

really? so, what is addweighted function?!!

mahsa gravatar imagemahsa ( 2013-12-19 08:30:01 -0600 )edit

I want to apply medianblur function into a sequence of frames...So, is it possible two add some frames the same as yours, then get the average of them and give it as an input to the medianBlur function?

mahsa gravatar imagemahsa ( 2013-12-19 08:31:40 -0600 )edit
1

You don't need to add frames before applying the medianBlur function. It works on each frame by assigning each pixel a value which is equal to the median of the values of the neighboring pixels. The number of neighboring pixels considered is based on the kernel size that you pass as a parameter. More details and example code here: http://docs.opencv.org/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.html

pyro gravatar imagepyro ( 2013-12-19 21:51:36 -0600 )edit

thanks for the comment but what I mean is using some kind of Temporal Filtering..I want to use medianBlur function in temporal domain

mahsa gravatar imagemahsa ( 2013-12-19 23:30:32 -0600 )edit
1

In that case, you may add the n number of frames and take an average (assuming this is your logic) using the above answer. cv::addWeighted() helps to assign different weights while adding. For example, assigning equal weights of 0.5 to two frames will result in a typical average, whereas weighing one frame higher than another (say 0.3 for Frame1 and 0.7 for Frame 2) would give you a weighted average with 70% of the content in frame 2 appearing in the result. (http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#addweighted)

pyro gravatar imagepyro ( 2013-12-20 01:00:38 -0600 )edit

Thanks a lot for your help...what I am doing is difficult for me since I am completely newbie. I edited the code, it would be appreciated if you give me some hints on what I am doing..

mahsa gravatar imagemahsa ( 2013-12-20 02:44:37 -0600 )edit

Question Tools

Stats

Asked: 2013-12-19 08:11:56 -0600

Seen: 237 times

Last updated: Dec 20 '13