Created
May 4, 2014 14:44
-
-
Save vivahiraj/a8fe861e0d07ea48cc42 to your computer and use it in GitHub Desktop.
OpenCVで加工した画像をwebsocket経由で受け取るクライアントです
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>WebCam</title> | |
</head> | |
<body> | |
<div id="capture-area"> | |
</div> | |
<script src="http://codeorigin.jquery.com/jquery-2.0.3.min.js"></script> | |
<script> | |
$(function() { | |
var ws = new WebSocket('ws://raspberrypi.local:51234'); | |
ws.onopen = function() { | |
$('#capture-area').append($('<img>').attr('id', 'capture')); | |
$('#capture').css("width","800px"); | |
}; | |
ws.onclose = function() { | |
}; | |
ws.onmessage = function(evt) { | |
var src = 'data:image/jpeg;base64,' + evt.data; | |
$('#capture').attr('src', src); | |
}; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment