Access to the camera from the system the application is running on
I am building a web application with django and opencv for computer vision. In the web application there exists a button which when pressed starts the web cam of my computer. The problem is when i host the web application using my IP and access the application with a different computer and press the button, The webcam in my computer start.
I knew the problem lied in this line of code
cam = cv2.VideoCapture(0)
I looked online and found this post , which asks me to use javascript to access the webcam.
Is that the best option available or can I somehow change that line of opencv code to access the camera in the system the application is running on?
If there is no better way to do it than javascript, then I would also like to know once I access the webcam and display the feed onto the screen, how do I link the rest of the python code like the face detectors and classifiers to the javascript code?
I have just started getting my hands dirty with python and i still have a lot to learn.
Thanks in advance
javascript python django opencv
add a comment |
I am building a web application with django and opencv for computer vision. In the web application there exists a button which when pressed starts the web cam of my computer. The problem is when i host the web application using my IP and access the application with a different computer and press the button, The webcam in my computer start.
I knew the problem lied in this line of code
cam = cv2.VideoCapture(0)
I looked online and found this post , which asks me to use javascript to access the webcam.
Is that the best option available or can I somehow change that line of opencv code to access the camera in the system the application is running on?
If there is no better way to do it than javascript, then I would also like to know once I access the webcam and display the feed onto the screen, how do I link the rest of the python code like the face detectors and classifiers to the javascript code?
I have just started getting my hands dirty with python and i still have a lot to learn.
Thanks in advance
javascript python django opencv
How does your question differ from the one you have linked?
– Klaus D.
Nov 21 '18 at 4:26
I want to know if I can accomplish the task with python itself. I also want to know how to link the python code with the video feed from javascript
– Sashaank
Nov 21 '18 at 4:28
add a comment |
I am building a web application with django and opencv for computer vision. In the web application there exists a button which when pressed starts the web cam of my computer. The problem is when i host the web application using my IP and access the application with a different computer and press the button, The webcam in my computer start.
I knew the problem lied in this line of code
cam = cv2.VideoCapture(0)
I looked online and found this post , which asks me to use javascript to access the webcam.
Is that the best option available or can I somehow change that line of opencv code to access the camera in the system the application is running on?
If there is no better way to do it than javascript, then I would also like to know once I access the webcam and display the feed onto the screen, how do I link the rest of the python code like the face detectors and classifiers to the javascript code?
I have just started getting my hands dirty with python and i still have a lot to learn.
Thanks in advance
javascript python django opencv
I am building a web application with django and opencv for computer vision. In the web application there exists a button which when pressed starts the web cam of my computer. The problem is when i host the web application using my IP and access the application with a different computer and press the button, The webcam in my computer start.
I knew the problem lied in this line of code
cam = cv2.VideoCapture(0)
I looked online and found this post , which asks me to use javascript to access the webcam.
Is that the best option available or can I somehow change that line of opencv code to access the camera in the system the application is running on?
If there is no better way to do it than javascript, then I would also like to know once I access the webcam and display the feed onto the screen, how do I link the rest of the python code like the face detectors and classifiers to the javascript code?
I have just started getting my hands dirty with python and i still have a lot to learn.
Thanks in advance
javascript python django opencv
javascript python django opencv
asked Nov 21 '18 at 4:14
Sashaank
498
498
How does your question differ from the one you have linked?
– Klaus D.
Nov 21 '18 at 4:26
I want to know if I can accomplish the task with python itself. I also want to know how to link the python code with the video feed from javascript
– Sashaank
Nov 21 '18 at 4:28
add a comment |
How does your question differ from the one you have linked?
– Klaus D.
Nov 21 '18 at 4:26
I want to know if I can accomplish the task with python itself. I also want to know how to link the python code with the video feed from javascript
– Sashaank
Nov 21 '18 at 4:28
How does your question differ from the one you have linked?
– Klaus D.
Nov 21 '18 at 4:26
How does your question differ from the one you have linked?
– Klaus D.
Nov 21 '18 at 4:26
I want to know if I can accomplish the task with python itself. I also want to know how to link the python code with the video feed from javascript
– Sashaank
Nov 21 '18 at 4:28
I want to know if I can accomplish the task with python itself. I also want to know how to link the python code with the video feed from javascript
– Sashaank
Nov 21 '18 at 4:28
add a comment |
1 Answer
1
active
oldest
votes
There are a lot of different ways to accomplish what you're trying to do so you will need to focus on how you want to design your application.
If you only need to perform face-detection and tracking on the client camera you might want to take a look to https://trackingjs.com/ , a JS library that is able to perform various simple computer vision tasks on the client-side.
If you need to perform some more sophisticated image processing or classification tasks on the incoming video stream you might want to do something like:
STEP 1: Get the client camera feed using JS on the client-side.
STEP 2: Serve your web application in HTTPS mode (you will need to generate an SSL certificate): if you don't do that, the JS getUserMedia()
function won't execute and you will get the
getusermedia no longer works on insecure origins
If you're uncertain how to generate an SSL certificate in Python, https://pypi.org/project/pyOpenSSL/ is the way to go.
STEP 3: Now that the client camera is opened, use WebSocket to stream your client video feed to your back-end server
STEP 4: You're now on the server side and you can perform all the funcy processing here and stream back to the client through WebSocket the result of your computation.
STEP 5: The JS WebSocket listener on the client side will receive all incoming information and will display the final result on client screen.
Hope this helps
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53405163%2faccess-to-the-camera-from-the-system-the-application-is-running-on%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are a lot of different ways to accomplish what you're trying to do so you will need to focus on how you want to design your application.
If you only need to perform face-detection and tracking on the client camera you might want to take a look to https://trackingjs.com/ , a JS library that is able to perform various simple computer vision tasks on the client-side.
If you need to perform some more sophisticated image processing or classification tasks on the incoming video stream you might want to do something like:
STEP 1: Get the client camera feed using JS on the client-side.
STEP 2: Serve your web application in HTTPS mode (you will need to generate an SSL certificate): if you don't do that, the JS getUserMedia()
function won't execute and you will get the
getusermedia no longer works on insecure origins
If you're uncertain how to generate an SSL certificate in Python, https://pypi.org/project/pyOpenSSL/ is the way to go.
STEP 3: Now that the client camera is opened, use WebSocket to stream your client video feed to your back-end server
STEP 4: You're now on the server side and you can perform all the funcy processing here and stream back to the client through WebSocket the result of your computation.
STEP 5: The JS WebSocket listener on the client side will receive all incoming information and will display the final result on client screen.
Hope this helps
add a comment |
There are a lot of different ways to accomplish what you're trying to do so you will need to focus on how you want to design your application.
If you only need to perform face-detection and tracking on the client camera you might want to take a look to https://trackingjs.com/ , a JS library that is able to perform various simple computer vision tasks on the client-side.
If you need to perform some more sophisticated image processing or classification tasks on the incoming video stream you might want to do something like:
STEP 1: Get the client camera feed using JS on the client-side.
STEP 2: Serve your web application in HTTPS mode (you will need to generate an SSL certificate): if you don't do that, the JS getUserMedia()
function won't execute and you will get the
getusermedia no longer works on insecure origins
If you're uncertain how to generate an SSL certificate in Python, https://pypi.org/project/pyOpenSSL/ is the way to go.
STEP 3: Now that the client camera is opened, use WebSocket to stream your client video feed to your back-end server
STEP 4: You're now on the server side and you can perform all the funcy processing here and stream back to the client through WebSocket the result of your computation.
STEP 5: The JS WebSocket listener on the client side will receive all incoming information and will display the final result on client screen.
Hope this helps
add a comment |
There are a lot of different ways to accomplish what you're trying to do so you will need to focus on how you want to design your application.
If you only need to perform face-detection and tracking on the client camera you might want to take a look to https://trackingjs.com/ , a JS library that is able to perform various simple computer vision tasks on the client-side.
If you need to perform some more sophisticated image processing or classification tasks on the incoming video stream you might want to do something like:
STEP 1: Get the client camera feed using JS on the client-side.
STEP 2: Serve your web application in HTTPS mode (you will need to generate an SSL certificate): if you don't do that, the JS getUserMedia()
function won't execute and you will get the
getusermedia no longer works on insecure origins
If you're uncertain how to generate an SSL certificate in Python, https://pypi.org/project/pyOpenSSL/ is the way to go.
STEP 3: Now that the client camera is opened, use WebSocket to stream your client video feed to your back-end server
STEP 4: You're now on the server side and you can perform all the funcy processing here and stream back to the client through WebSocket the result of your computation.
STEP 5: The JS WebSocket listener on the client side will receive all incoming information and will display the final result on client screen.
Hope this helps
There are a lot of different ways to accomplish what you're trying to do so you will need to focus on how you want to design your application.
If you only need to perform face-detection and tracking on the client camera you might want to take a look to https://trackingjs.com/ , a JS library that is able to perform various simple computer vision tasks on the client-side.
If you need to perform some more sophisticated image processing or classification tasks on the incoming video stream you might want to do something like:
STEP 1: Get the client camera feed using JS on the client-side.
STEP 2: Serve your web application in HTTPS mode (you will need to generate an SSL certificate): if you don't do that, the JS getUserMedia()
function won't execute and you will get the
getusermedia no longer works on insecure origins
If you're uncertain how to generate an SSL certificate in Python, https://pypi.org/project/pyOpenSSL/ is the way to go.
STEP 3: Now that the client camera is opened, use WebSocket to stream your client video feed to your back-end server
STEP 4: You're now on the server side and you can perform all the funcy processing here and stream back to the client through WebSocket the result of your computation.
STEP 5: The JS WebSocket listener on the client side will receive all incoming information and will display the final result on client screen.
Hope this helps
edited Nov 21 '18 at 8:34
answered Nov 21 '18 at 8:29
Loss of human identity
7661621
7661621
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53405163%2faccess-to-the-camera-from-the-system-the-application-is-running-on%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How does your question differ from the one you have linked?
– Klaus D.
Nov 21 '18 at 4:26
I want to know if I can accomplish the task with python itself. I also want to know how to link the python code with the video feed from javascript
– Sashaank
Nov 21 '18 at 4:28