1 | initial version |
bool button1pressed = false;
void action1(ActionEvent e) {
button1pressed = true;
}
main() {
VideoCapture camera1 = new VideoCapture(0);
if (!camera1.isOpened()) {
System.out.println("Error! Camera1 can't be opened!");
return;
}
VideoCapture camera2 = new VideoCapture(1); // next id
if (!camera2.isOpened()) {
System.out.println("Error! Camera2 can't be opened!");
return;
}
Mat frame1 = new Mat();
Mat frame2 = new Mat();
while (true) {
if (! camera1.read(frame1)) {
System.out.println("cam1 disconnected");
return;
}
if (! camera2.read(frame2)) {
System.out.println("cam2 disconnected");
return;
}
//
// your processing code for frame1 and frame2 here
//
// check events (poll)
if (button1pressed) {
// do something
button1pressed = false;
}
}
}
some notes:
2 | No.2 Revision |
main() {
VideoCapture camera1 = new VideoCapture(0);
if (!camera1.isOpened()) {
System.out.println("Error! Camera1 can't be opened!");
return;
}
VideoCapture camera2 = new VideoCapture(1); // next id
if (!camera2.isOpened()) {
System.out.println("Error! Camera2 can't be opened!");
return;
}
Mat frame1 = new Mat();
Mat frame2 = new Mat();
while (true) {
if (! camera1.read(frame1)) {
System.out.println("cam1 disconnected");
return;
}
if (! camera2.read(frame2)) {
System.out.println("cam2 disconnected");
return;
}
//
// your processing code for frame1 and frame2 here
//
// check events (poll)
if (button1pressed) {
// do something
button1pressed = false;
}
}
}
some notes:
3 | No.3 Revision |
bool button1pressed = false;
void action1(ActionEvent e) {
button1pressed = true;
}
}
main() {
VideoCapture camera1 = new VideoCapture(0);
if (!camera1.isOpened()) {
System.out.println("Error! Camera1 can't be opened!");
return;
}
VideoCapture camera2 = new VideoCapture(1); // next id
if (!camera2.isOpened()) {
System.out.println("Error! Camera2 can't be opened!");
return;
}
Mat frame1 = new Mat();
Mat frame2 = new Mat();
while (true) {
if (! camera1.read(frame1)) {
System.out.println("cam1 disconnected");
return;
}
if (! camera2.read(frame2)) {
System.out.println("cam2 disconnected");
return;
}
//
// your processing code for frame1 and frame2 here
//
// check events (poll)
if (button1pressed) {
// do something
button1pressed = false;
}
}
}
some notes:
4 | No.4 Revision |
bool button1pressed = false;
void action1(ActionEvent e) {
button1pressed = true;
}
main() {
VideoCapture camera1 = new VideoCapture(0);
if (!camera1.isOpened()) {
System.out.println("Error! Camera1 can't be opened!");
return;
}
VideoCapture camera2 = new VideoCapture(1); // next id
if (!camera2.isOpened()) {
System.out.println("Error! Camera2 can't be opened!");
return;
}
Mat frame1 = new Mat();
Mat frame2 = new Mat();
while (true) {
if (! camera1.read(frame1)) {
System.out.println("cam1 disconnected");
return;
}
if (! camera2.read(frame2)) {
System.out.println("cam2 disconnected");
return;
}
//
// your processing code for frame1 and frame2 here
//
// check events (poll)
if (button1pressed) {
// do something
button1pressed = false;
}
}
}
some notes:
5 | No.5 Revision |
bool button1pressed = false;
void action1(ActionEvent e) {
button1pressed = true;
}
main() {
VideoCapture camera1 = new VideoCapture(0);
if (!camera1.isOpened()) {
System.out.println("Error! Camera1 can't be opened!");
return;
}
VideoCapture camera2 = new VideoCapture(1); // next id
if (!camera2.isOpened()) {
System.out.println("Error! Camera2 can't be opened!");
return;
}
Mat frame1 = new Mat();
Mat frame2 = new Mat();
while (true) {
if (! camera1.read(frame1)) {
System.out.println("cam1 disconnected");
return;
}
if (! camera2.read(frame2)) {
System.out.println("cam2 disconnected");
return;
}
//
// your processing code for frame1 and frame2 here
//
// check events (poll)
if (button1pressed) {
// do something
button1pressed = false;
}
}
}
some notes:
6 | No.6 Revision |
bool button1pressed = false;
void action1(ActionEvent e) {
button1pressed = true;
}
main() {
VideoCapture camera1 = new VideoCapture(0);
if (!camera1.isOpened()) {
System.out.println("Error! Camera1 can't be opened!");
return;
}
VideoCapture camera2 = new VideoCapture(1); // next id
if (!camera2.isOpened()) {
System.out.println("Error! Camera2 can't be opened!");
return;
}
Mat frame1 = new Mat();
Mat frame2 = new Mat();
while (true) {
if (! camera1.read(frame1)) {
System.out.println("cam1 disconnected");
return;
}
if (! camera2.read(frame2)) {
System.out.println("cam2 disconnected");
return;
}
//
// your processing code for frame1 and frame2 here
//
// check events (poll)
if (button1pressed) {
// do something
button1pressed = false;
}
}
}
some notes:
7 | No.7 Revision |
bool button1pressed = false;
void action1(ActionEvent e) {
button1pressed = true;
}
main() {
VideoCapture camera1 = new VideoCapture(0);
if (!camera1.isOpened()) {
System.out.println("Error! Camera1 can't be opened!");
return;
}
VideoCapture camera2 = new VideoCapture(1); // next id
if (!camera2.isOpened()) {
System.out.println("Error! Camera2 can't be opened!");
return;
}
Mat frame1 = new Mat();
Mat frame2 = new Mat();
while (true) {
if (! camera1.read(frame1)) {
System.out.println("cam1 disconnected");
return;
}
if (! camera2.read(frame2)) {
System.out.println("cam2 disconnected");
return;
}
// check events (poll)
if (button1pressed) {
// do something
button1pressed = false;
}
//
// your processing code for frame1 and frame2 here
//
// check events (poll)
if (button1pressed) {
// do something
button1pressed = false;
}
}
}
some notes: