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?

enter image description here

  • $\begingroup$ Please do not put keywords or technical phrases in code tags. Use bold or italics for emphasis. $\endgroup$
    – Mr.Wizard
    Oct 19, 2014 at 1:44
  • $\begingroup$ @Mr.Wizard,sorry!. I will edit my question! $\endgroup$ Oct 19, 2014 at 1:45
  • $\begingroup$ No need, I just did. $\endgroup$
    – Mr.Wizard
    Oct 19, 2014 at 1:46
  • $\begingroup$ 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. $\endgroup$
    – Mr.Wizard
    Oct 19, 2014 at 1:48

1 Answer 1


We can try like this:

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


ParallelTry[imageSubtract, {{imag1, fond1}, {imag2, fond2}}, 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?

  • $\begingroup$ any explanation please? $\endgroup$ Oct 19, 2014 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.