Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

35
LINES

< > BotCompany Repo | #1008988 // Webcam Motion Detection [probably works]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 2596K of libraries. Click here for Pure Java version (427L/4K).

1  
!7
2  
3  
lib 1008985 // webcam
4  
lib 1008987 // bridj
5  
lib 1004016 // slf4j api
6  
7  
import com.github.sarxos.webcam.Webcam;
8  
import com.github.sarxos.webcam.WebcamMotionDetector;
9  
import com.github.sarxos.webcam.WebcamMotionEvent;
10  
import com.github.sarxos.webcam.WebcamMotionListener;
11  
12  
13  
/**
14  
 * Detect motion. This example demonstrates how to use build-in motion detector
15  
 * and motion listener to fire motion events.
16  
 * 
17  
 * @author Bartosz Firyn (SarXos)
18  
 */
19  
sclass DetectMotionExample implements WebcamMotionListener {
20  
	*() {
21  
		WebcamMotionDetector detector = new(Webcam.getDefault());
22  
		detector.setInterval(500); // one check per 500 ms
23  
		detector.addMotionListener(this);
24  
		detector.start();
25  
	}
26  
27  
	@Override
28  
	public void motionDetected(WebcamMotionEvent wme) {
29  
		print("Detected motion I, alarm turn on you have");
30  
	}
31  
}
32  
33  
p {
34  
	new DetectMotionExample;
35  
}

Author comment

Began life as a copy of #1008986

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008988
Snippet name: Webcam Motion Detection [probably works]
Eternal ID of this version: #1008988/2
Text MD5: e0c115ad8a29ad7a0ac6de97a4a35bbb
Transpilation MD5: aa374bff2383c24e25227527443f61d0
Author: stefan
Category: javax / desktop / camera
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-22 19:40:01
Source code size: 878 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 397 / 904
Version history: 1 change(s)
Referenced in: [show references]