# Image background subtraction using parallel computing

I am developing a program for pattern recognition. I want to use the parallel computing to get a real time application.

I have two cameras where each one gives n frames/second. I need to process the data given by both cameras (i.e background subtraction) in the same time using the parallel computing as shown in the image:

I can use ImageSubtract[] or ImageDifference[] for background subtraction. So the question is how I can Evaluate two functions (i.e ImageSubtract with different inputs) in the same time?

Which package is used on Mathematica for parallel computing? Any suggestions?

• Please do not put keywords or technical phrases in code tags. Use bold or italics for emphasis. – Mr.Wizard Oct 19 '14 at 1:44
• @Mr.Wizard,sorry!. I will edit my question! – BetterEnglish Oct 19 '14 at 1:45
• No need, I just did. – Mr.Wizard Oct 19 '14 at 1:46
• By the way I think I (re?)created the "threading" tag today and now I see why it probably didn't exist: confusion between the meaning I intended i.e. Thread and evaluation threads. I have removed it from this question as I think parallel is sufficient and less ambiguious. I should probably think of a different tag for Thread-like behavior. – Mr.Wizard Oct 19 '14 at 1:48

We can try like this:

Parallelize[MapThread[ImageSubtract, {{image1,image2}, {fond1,fond2}}]]


or

ParallelTry[imageSubtract, {{imag1, fond1}, {imag2, fond2}}, 2]


While

imageSubtract[{image_,fond_}]:=Module[{},(

Image[(ImageData[image1]-ImageData[fond1]+1)/2]
)]


We can use also ParallelMap[]

ParallelMap[imageSubtract, {{imag1, fond1}, {imag2, fond2}}, 2]


I remark that Parallelize is faster than ParallelTry[] and the ParallelTry[] is faster than ParallelMap[] Any deep explanation about this? And it is possible to define imageSubtract[image1,fond1] and used it with ParallelTry[] and ParallelMap[] or I must to define it with one argument?

• any explanation please? – BetterEnglish Oct 19 '14 at 21:09