NullPointerException 질문이 잇습니다.

겸@Naver의 이미지

안녕하세요 이번에 코딩에 처음 입문한 코린이입니다.
이번에 코딩을 접하면서 프로세싱으로 처음 시작하게 되었는데 막히게 되어 질문합니다 ㅠㅠ
프로세싱도 자바 기반이여서 질문해요. 혹시 문제시 삭제하겠습니다.

제가 원하는 형태는 사람들의 얼굴 위에 도형이 나오고, 3개가 중첩되는 형태입니다.
여기까지는 코드를 완성했는데 이제 사람들마다 각기 다른 색상을 가진 도형이 올라갔으면 해서
색상을 변수로 지정하는 순간

NullPointerException
WARNING: no real random source present!

이라는 버그가 생기고, 61번째 줄에 선이 그어집니다 ㅠㅠ

다른 버그들은 검색으로 어떻게든 해결했는데 도무지 제 힘으로는 어디서 NULL이 발생하는지
파악이 안되서 질문을 올립니다..!

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

Capture video;
OpenCV opencv;
Aura[] aura;
color[] col;
int num;

void setup() {
size(800, 500);
background(255);

video = new Capture(this, width, height, "pipeline:autovideosrc");
opencv = new OpenCV(this, width, height);
opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);

video.start();

blendMode(BLEND);
background(0);
blendMode(SCREEN);
noStroke();
translate(width/2, height/2);

Rectangle[] faces = opencv.detect();
//for (int k = 0; k < faces.length; k++) {
//println(faces[k].x + "," + faces[k].y);
// rect(faces[k].x, faces[k].y, faces[k].width, faces[k].height);
//}
color[] col = new color[faces.length];

aura = new Aura[3];

for ( int k = 0; k < aura.length; k++) {
for (int i = 0; i < faces.length; i++) {
//col[i] = color(random(0, 255), random(0, 255), random(0, 255));
aura[k] = new Aura (float(int(random(12, 18))), int(random(45, 60)), int(random(15, 20)), int(random(100, 150)));
}
}
}

void draw() {
opencv.loadImage(video);
background(0);

if (video.available()) {
video.read();
}
image(video, 0, 0);

Rectangle[] faces = opencv.detect();

for (int i = 0; i < faces.length; i++) {
//println(faces[i].x + "," + faces[i].y);
//rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
fill(col[i]);
for (int j = 0; j < aura.length; j++) {
aura[j].show(faces[i].x + faces[i].width/2, faces[i].y + faces[i].height/2, map(faces[i].width, 0, 500, 0.05, 1.4 ));
}
clear();
}
}

class Aura {
float vNnum;
int nm;
int sm;
int fcm;
float dot = random(0.3, 0.5);

Aura(float vNnum1, int nm1, int sm1, int fcm1) {
vNnum = vNnum1;
nm = nm1;
sm = sm1;
fcm = fcm1;
}

void show(float x, float y, float sc) {
//fill(c);
push();
translate(x, y);

rotate(frameCount/fcm*2);
float dr = TWO_PI/vNnum;

beginShape();
scale(sc);
for (int i = 0; i < vNnum + 3; i++) {
float ind = i%vNnum;
float rad = dr *ind;
float r = height*dot + noise(frameCount/nm + ind) * height*dot + sin(frameCount/sm + ind)*height*0.1;
curveVertex(cos(rad)*r, sin(rad)*r);
}
endShape();
pop();
}


}

ehaakdl의 이미지

61번줄부터 표시해주시져;;

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.