Pixelate Face Tracking with OpenCV

Hi, I’m trying to get my code to pixelate faces in live video. I have a face tracking sketch that works, as well as a pixelate sketch that works to pixelate the whole screen, however I am having trouble combining them so it only pixelates a face.

My face tracking code is:

1. import processing.video.*;
2. import java.awt.Rectangle;
3. import gab.opencv.*;

4. OpenCV opencv;
5. Capture video;
6. Rectangle[] faces;

7. void setup() {

8.   size( 640, 480 );

9.   String[] cameras = Capture.list();
10.   video = new Capture(this, cameras[0]);
11.   opencv = new OpenCV(this, width, height);
12.   opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE); 
13.   faces = opencv.detect();
14.   frameRate(24.0);
15.   video.start();
16. }

17. void draw() {

18.   opencv.loadImage(video);
19.   image(video, 0, 0);
20.   video.read();

21.   faces = opencv.detect(1.2, 3, 0, 40, 400);    //adjust last two numbers to give min and max for face size
22.   noFill();
23.   stroke(255, 20, 255);
24.   strokeWeight(2);
25.   for (int i = 0; i < faces.length; i++) {
26.     rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
27.   }
28. }

And my pixelate code is:

1. import processing.video.*;

2. int blockSize = 25;
3. int numPixelsWide, numPixelsHigh;

4. Capture video;

5. color movColors[];

6. void setup() {
7.   size(640, 480);
8.   noStroke();
9.   
10.   String[] cameras = Capture.list();
11.   video = new Capture(this, cameras[0]);
12.   video.start();

13.   numPixelsWide = width; 
14.   numPixelsHigh = height; 
15.   println(numPixelsWide);
16.   movColors = new color[numPixelsWide * numPixelsHigh];
17. }


18. void draw() {

19.   if (video.available() == true) {
20.     video.read();
21.     video.loadPixels();
22.     
23.     int count = 0;
24.     for (int j = 0; j < numPixelsHigh; j++) {
25.       for (int i = 0; i < numPixelsWide; i++) {
26.         movColors[count] = video.get(i*blockSize, j*blockSize);
27.         count++;
28.       }
29.     }
30.   }

31.   background(255);
32.   for (int j = 0; j < numPixelsHigh; j++) {
33.     for (int i = 0; i < numPixelsWide; i++) {
34.       fill(movColors[j*numPixelsWide + i]);
35.       rect(i*blockSize, j*blockSize, blockSize, blockSize);
36.     }
37.   }
38. }

Any advice on how to combine the two would be greatly appreciated, Thanks