release/close capture of camera

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












2















I have opened webcam for capturing using OpenCV in C++.
Then I stopped the program using CTRL+Z;



The webcam could not turn off, Because was not defined in program. And I can not start my program again because the capture program is still using webcam and is busy.



Error:



libv4l2: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl S_FMT
...


I found the process id using lsof|grep libv4l2:



capture 5591 mylove mem REG 8,8 52584 1737777 /usr/lib64/libv4l2.so.0.0.0


and tried to close the capture using kill 5591 and also pkill capture using normal user and root user. But the camera LED is still turned on and my program can not start.



What is fastest and best method to release/close the camera?










share|improve this question
























  • Could you add the output of ps -eo uid,state,comm? The line with your process (capture) would be enough.

    – John WH Smith
    Dec 16 '14 at 23:33












  • Of course, Now I have not OpenCV on my System. I'll put it when I install if I remember. Thank you.

    – Mohammad Etemaddar
    Oct 10 '16 at 11:44















2















I have opened webcam for capturing using OpenCV in C++.
Then I stopped the program using CTRL+Z;



The webcam could not turn off, Because was not defined in program. And I can not start my program again because the capture program is still using webcam and is busy.



Error:



libv4l2: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl S_FMT
...


I found the process id using lsof|grep libv4l2:



capture 5591 mylove mem REG 8,8 52584 1737777 /usr/lib64/libv4l2.so.0.0.0


and tried to close the capture using kill 5591 and also pkill capture using normal user and root user. But the camera LED is still turned on and my program can not start.



What is fastest and best method to release/close the camera?










share|improve this question
























  • Could you add the output of ps -eo uid,state,comm? The line with your process (capture) would be enough.

    – John WH Smith
    Dec 16 '14 at 23:33












  • Of course, Now I have not OpenCV on my System. I'll put it when I install if I remember. Thank you.

    – Mohammad Etemaddar
    Oct 10 '16 at 11:44













2












2








2








I have opened webcam for capturing using OpenCV in C++.
Then I stopped the program using CTRL+Z;



The webcam could not turn off, Because was not defined in program. And I can not start my program again because the capture program is still using webcam and is busy.



Error:



libv4l2: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl S_FMT
...


I found the process id using lsof|grep libv4l2:



capture 5591 mylove mem REG 8,8 52584 1737777 /usr/lib64/libv4l2.so.0.0.0


and tried to close the capture using kill 5591 and also pkill capture using normal user and root user. But the camera LED is still turned on and my program can not start.



What is fastest and best method to release/close the camera?










share|improve this question
















I have opened webcam for capturing using OpenCV in C++.
Then I stopped the program using CTRL+Z;



The webcam could not turn off, Because was not defined in program. And I can not start my program again because the capture program is still using webcam and is busy.



Error:



libv4l2: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl S_FMT
...


I found the process id using lsof|grep libv4l2:



capture 5591 mylove mem REG 8,8 52584 1737777 /usr/lib64/libv4l2.so.0.0.0


and tried to close the capture using kill 5591 and also pkill capture using normal user and root user. But the camera LED is still turned on and my program can not start.



What is fastest and best method to release/close the camera?







camera v4l opencv






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 10 '16 at 4:15









Mongrel

2,10331747




2,10331747










asked Dec 16 '14 at 17:53









Mohammad EtemaddarMohammad Etemaddar

6,70651730




6,70651730












  • Could you add the output of ps -eo uid,state,comm? The line with your process (capture) would be enough.

    – John WH Smith
    Dec 16 '14 at 23:33












  • Of course, Now I have not OpenCV on my System. I'll put it when I install if I remember. Thank you.

    – Mohammad Etemaddar
    Oct 10 '16 at 11:44

















  • Could you add the output of ps -eo uid,state,comm? The line with your process (capture) would be enough.

    – John WH Smith
    Dec 16 '14 at 23:33












  • Of course, Now I have not OpenCV on my System. I'll put it when I install if I remember. Thank you.

    – Mohammad Etemaddar
    Oct 10 '16 at 11:44
















Could you add the output of ps -eo uid,state,comm? The line with your process (capture) would be enough.

– John WH Smith
Dec 16 '14 at 23:33






Could you add the output of ps -eo uid,state,comm? The line with your process (capture) would be enough.

– John WH Smith
Dec 16 '14 at 23:33














Of course, Now I have not OpenCV on my System. I'll put it when I install if I remember. Thank you.

– Mohammad Etemaddar
Oct 10 '16 at 11:44





Of course, Now I have not OpenCV on my System. I'll put it when I install if I remember. Thank you.

– Mohammad Etemaddar
Oct 10 '16 at 11:44










1 Answer
1






active

oldest

votes


















0














When you use Ctrl+z, the process is sending to background, so never was stopped.
You can see your processes in background with jobs command. And restore the process with fg command.



Try to stop the process with Ctrl+c.






share|improve this answer

























  • Then the issue is that, I can not stop the process using Ctrl + C. Because the camera reader, is in infinite loop. and won't stop using this signal. Maybe it's better to create a function to listen to Ctrl + Z or maybe Ctrl + C signal and then close the camera using it.

    – Mohammad Etemaddar
    Oct 10 '16 at 11:41











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f174543%2frelease-close-capture-of-camera%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









0














When you use Ctrl+z, the process is sending to background, so never was stopped.
You can see your processes in background with jobs command. And restore the process with fg command.



Try to stop the process with Ctrl+c.






share|improve this answer

























  • Then the issue is that, I can not stop the process using Ctrl + C. Because the camera reader, is in infinite loop. and won't stop using this signal. Maybe it's better to create a function to listen to Ctrl + Z or maybe Ctrl + C signal and then close the camera using it.

    – Mohammad Etemaddar
    Oct 10 '16 at 11:41
















0














When you use Ctrl+z, the process is sending to background, so never was stopped.
You can see your processes in background with jobs command. And restore the process with fg command.



Try to stop the process with Ctrl+c.






share|improve this answer

























  • Then the issue is that, I can not stop the process using Ctrl + C. Because the camera reader, is in infinite loop. and won't stop using this signal. Maybe it's better to create a function to listen to Ctrl + Z or maybe Ctrl + C signal and then close the camera using it.

    – Mohammad Etemaddar
    Oct 10 '16 at 11:41














0












0








0







When you use Ctrl+z, the process is sending to background, so never was stopped.
You can see your processes in background with jobs command. And restore the process with fg command.



Try to stop the process with Ctrl+c.






share|improve this answer















When you use Ctrl+z, the process is sending to background, so never was stopped.
You can see your processes in background with jobs command. And restore the process with fg command.



Try to stop the process with Ctrl+c.







share|improve this answer














share|improve this answer



share|improve this answer








edited Oct 10 '16 at 4:21









HalosGhost

3,76392236




3,76392236










answered Oct 10 '16 at 3:25









mvilchismvilchis

1




1












  • Then the issue is that, I can not stop the process using Ctrl + C. Because the camera reader, is in infinite loop. and won't stop using this signal. Maybe it's better to create a function to listen to Ctrl + Z or maybe Ctrl + C signal and then close the camera using it.

    – Mohammad Etemaddar
    Oct 10 '16 at 11:41


















  • Then the issue is that, I can not stop the process using Ctrl + C. Because the camera reader, is in infinite loop. and won't stop using this signal. Maybe it's better to create a function to listen to Ctrl + Z or maybe Ctrl + C signal and then close the camera using it.

    – Mohammad Etemaddar
    Oct 10 '16 at 11:41

















Then the issue is that, I can not stop the process using Ctrl + C. Because the camera reader, is in infinite loop. and won't stop using this signal. Maybe it's better to create a function to listen to Ctrl + Z or maybe Ctrl + C signal and then close the camera using it.

– Mohammad Etemaddar
Oct 10 '16 at 11:41






Then the issue is that, I can not stop the process using Ctrl + C. Because the camera reader, is in infinite loop. and won't stop using this signal. Maybe it's better to create a function to listen to Ctrl + Z or maybe Ctrl + C signal and then close the camera using it.

– Mohammad Etemaddar
Oct 10 '16 at 11:41


















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • 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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f174543%2frelease-close-capture-of-camera%23new-answer', 'question_page');

);

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






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay