# Process crashes Java

**URL:** https://discourse.processing.org/t/process-crashes-java/33077
**Category:** Libraries
**Created:** [October 26, 2021, 10:40am UTC](https://discourse.processing.org/t/process-crashes-java/33077 "2021-10-26T10:40:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![RMead](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@RMead](https://discourse.processing.org/u/RMead)
#### Post date: [October 26, 2021, 10:40am UTC](https://discourse.processing.org/t/process-crashes-java/33077/1 "2021-10-26T10:40:12Z")

</div>

I’m trying to set up a facial recognition system for my art degree - where I want it to print off peoples faces each time they enter the gallery space. The code I’ve used, from a couple of guides, is included below - and is apparently a basic facial recognition script. Unfortunately, I get the following error - can anyone help?

“2021-10-26 11:34:32.472 java[2098:69034] Warning: Expected min height of view: (\<NSButton: 0x7fb107884470\>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.  
2021-10-26 11:34:32.475 java[2098:69034] Warning: Expected min height of view: (\<NSButton: 0x7fb107855dd0\>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.  
Processing video library using GStreamer 1.16.2  
OpenCV for Processing 0.5.4 by Greg Borenstein [http://gregborenstein.com](http://gregborenstein.com)  
Using Java OpenCV 2.4.5.0  
Load cascade from: /Users/richardmead/Documents/Processing/libraries/opencv\_processing/library/cascade-files/haarcascade\_frontalface\_alt.xml  
Cascade loaded: haarcascade\_frontalface\_alt.xml  
BaseSrc: [avfvideosrc0] : Device video access permission has just been denied  
Could not run the sketch (Target VM failed to initialize).  
For more information, read revisions.txt and Help → Troubleshooting.”

```auto
import gab.opencv.*;
import processing.video.*;
import java.awt.*;

Capture video;
OpenCV opencv;

void setup() {
  size(640, 480);
  video = new Capture(this, 640/2, 480/2);
  opencv = new OpenCV(this, 640/2, 480/2);
  opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);  

  video.start();
}

void draw() {
  scale(2);
  opencv.loadImage(video);

  image(video, 0, 0 );

  noFill();
  stroke(0, 255, 0);
  strokeWeight(3);
  Rectangle[] faces = opencv.detect();
  
  for (int i = 0; i < faces.length; i++) {
    rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
  }
}

void captureEvent(Capture c) {
  c.read();
}

```

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [October 26, 2021, 10:17pm UTC](https://discourse.processing.org/t/process-crashes-java/33077/2 "2021-10-26T22:17:25Z")

</div>

Hello,

The code provided works here with:

- Processing 3.5.4
- Logitech C922
- W10

It thinks the corner of a piece of furniture is a face!

With Processing 4.0b2:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/ece69b4a86b9cb47b0f5a56a2493a25c46cbcccc.png)

Try a search for this if you are using a Mac::  
“BaseSrc: [avfvideosrc0] : Device video access permission has just been denied”

`:)`

---

<div class="post-metadata">

### Author: ![RMead](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@RMead](https://discourse.processing.org/u/RMead)
#### Post date: [October 27, 2021, 9:22am UTC](https://discourse.processing.org/t/process-crashes-java/33077/3 "2021-10-27T09:22:57Z")

</div>

I’m using 3.5.4 - I’m not technically minded enough to use the beta haha!

Ahh - any idea what to change to do the inbuilt camera on a Mac? I’m so confused!

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [October 27, 2021, 10:17am UTC](https://discourse.processing.org/t/process-crashes-java/33077/4 "2021-10-27T10:17:26Z")

</div>

Hello,

Resources here:  
[https://processing.org/](https://processing.org/)

Video is in the libraries section:  
[https://processing.org/reference/libraries/video/index.html](https://processing.org/reference/libraries/video/index.html)

Example of how to detect cameras:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b24a3edd37da61a13010a10bbed0906ad2706b24.png)

This would be my “Logitech QuickCam Pro 9000”:

```auto
cam = new Capture(this, cameras[1]);

```

`:)`

---

<div class="post-metadata">

### Author: ![RMead](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@RMead](https://discourse.processing.org/u/RMead)
#### Post date: [October 29, 2021, 8:41am UTC](https://discourse.processing.org/t/process-crashes-java/33077/5 "2021-10-29T08:41:16Z")

</div>

> [@glv](#):
>
> `cam = new Capture(this, cameras[1]);`

Hey, thanks for the reply! This is insane for my first coding thing - especially since I failed maths at High School!

SO, for the below code, where would I add the [0] for the Facetime built in cam? I’m going mad haha

 ![Screenshot 2021-10-29 at 09.39.24](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/d2707c3782b1ee9b550849a7702da0c19494d260.png)

```auto
import gab.opencv.*;
import processing.video.*;
import java.awt.*;

Capture video;
OpenCV opencv;

void setup() {
  size(640, 480);
  video = new Capture(this, 640/2, 480/2);
  opencv = new OpenCV(this, 640/2, 480/2);
  opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);  

  video.start();
}

void draw() {
  scale(2);
  opencv.loadImage(video);

  image(video, 0, 0 );

  noFill();
  stroke(0, 255, 0);
  strokeWeight(3);
  Rectangle[] faces = opencv.detect();
  
  for (int i = 0; i < faces.length; i++) {
    rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
  }
}

void captureEvent(Capture c) {
  c.read();
}

```

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [October 30, 2021, 10:47am UTC](https://discourse.processing.org/t/process-crashes-java/33077/6 "2021-10-30T10:47:54Z")

</div>

> [@RMead](#):
>
> SO, for the below code, where would I add the [0] for the Facetime built in cam? I’m going mad haha

When the madness subsides… go to to the link I provided and explore.

Each of these lines has a link with details:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/0950aca7475c8317004338653bfb6c5189446c8c.png)

`:)`
