3

Blocking the camera isn't something new, using a piece of tape.

When I try to create or launch or run multiple programs which take a feed from camera, only the first one gets access, others don't get access.

Instead of physically blocking a camera with a piece of paper or scotch-tape, what if I logically block the camera, by running a script like this.

import cv2


def show_webcam(mirror=False):
cam = cv2.VideoCapture(0)
while True:
    ret_val, img = cam.read()
    if mirror: 
        img = cv2.flip(img, 1)
    cv2.imshow('my webcam', img)
    if cv2.waitKey(1) == 27: 
        break  # esc to quit
cv2.destroyAllWindows()


def main():
    show_webcam(mirror=True)


if __name__ == '__main__':
    main()

Wouldn't it be more smarter to secure privacy.

Is there something I am missing?

  • 2
    There is a mismatch between the title in the question. In the title you ask if it would be a possible way to block surveillance, in the body you ask if this would be smarter to actually putting something physically on top of the camera. Also, all the images and the code are not needed to understand your question and the code is actually confusing - do you plan on running exactly this code, i.e. always showing some mirrored image on the display? – Steffen Ullrich May 8 at 19:54
  • I'm so sorry , suggest an edit please .. – Maifee Ul Asad May 9 at 3:13
  • 2
    Since I have no idea what the real intention with your question is I cannot suggest you an edit. I can only point out what seems to be wrong with the question. You should know yourself what you want to know and adjust the question accordingly. – Steffen Ullrich May 9 at 3:24
3

I take it as a dilemma whether a physical protection of a camera is significantly better than a software protection (given an example of the latter). With that in mind, this is ultimately a risk assessment question. For an ordinary user, there might really be no difference, but they could probably as well get away without any camera covers.

Physical security is so much different from a software security. If a recording device is disabled physically, there's virtually no way to get around it, if a camera cover isn't supplied by the NSA. Contrary, for a software solution, there would always be a plenty of theoretically possible ways to get over a simple script.

E.g. your Python script allocates some memory, thus might be forced externally to be killed by the OOM killer, and after that a malicious process might immediately take over the recording device. Or, the mutual locking within your OS around the camera might not be as strong as you think. Or, your script could be broken by a software dependency update. Or, anything else.

Those are issues that are there even if there's no possibility that a rogue process might have a system-level access to your computer (whereafter you have no chances to win against a skilled attacker, whilst a camera cover would cover you — taking in account though that your microphone device would still be exposed).

Physical solutions are tough and always hard to maintain, but they are reliable as well.

  • +1 for NSA's cover, that's hilarious! Totally agree with rest of the answer though. – mike May 10 at 6:47
1

This is ineffective. Camera software get exclusive lock on the hardware because there's only one configuration that a camera can physically be in at any point in time, if one program tells the camera to increase focus and reduce aperture while the other tells it to reduce focus and increase aperture you may end up with a configuration that neither cameras wanted.

With that said, there's no reason multiple programs can't share camera feed, as long as they co-ordinate control. For a malicious program, this is fairly simple as they don't need to actually control the camera, but just get the feed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.