tags:

views:

67

answers:

2

I am doing a project that recognize human face from camera. Here is the workflow:

  1. acquire a frame of image from camera
  2. detect if there is motion in the frame, if motion detected in current frame, put the motion frame in queue for further process.
  3. search faces in the output frame from step2
  4. if there is faces, save the face

what I want:

  1. the workflow can be easily extend, say i may wanna add new steps to the workflow to add new features.
  2. a step can be easily turned on/off without affect following steps

what i can think of is a service bus-like architecture. for example. step2. can publish message that indicating a motion frame is detected, the subscriber can then proceed with its process with the captured motion frame.

so what do you think?

+2  A: 

The application seems to be similar to a pipeline. I would go for the chain-of-responsibility pattern.

spa
yes. it's kinda like a pipeline, but the steps may need to know each other. say, step 3 may need to know status of step 2, how can i solve this problem
Benny
If step 2 does not detect any movement in a frame step 3 might not be called at all. Step 2 drops the request. On the other hand you might pass a status object along the frames down the pipeline.
spa
A: 

I would use a plugin architecture and a linked-list of callbacks for each frame to process.

This way, in C at-least, they are just pointers. You can create different callback linked-list chains for different purposes, for example:

Chain 1: sobel()->generic_features()->eigenfaces()->metric_analysis()->save()

So the chain is applies as callbacks accepting the frame, or result of a previous step as input.

Hope my poor explanation helps.

Aiden Bell