I'm trying to read a barcode though my computer's webcam

enter image description here

but it fails because the ImageCapture won't refocus the camera when I put the code close to it, and this it is blurry:

enter image description here

Is there anyway to force a refocus to happen?

  • $\begingroup$ No. None of the built in functions has anything for that. How would you get it to refocus without Mathematica. You might be able to write a wrapper. $\endgroup$
    – Searke
    Commented Feb 22, 2016 at 1:38
  • $\begingroup$ mathematica.stackexchange.com/search?q=[image-processing]+focus $\endgroup$ Commented Feb 22, 2016 at 2:04
  • $\begingroup$ Perhaps the squares at the corners have enough information to guess a PSF and then deconvolve. But we need at least an actual capture to test it $\endgroup$ Commented Feb 22, 2016 at 2:43
  • $\begingroup$ and not in JPG format, please! $\endgroup$ Commented Feb 22, 2016 at 2:54
  • 1
    $\begingroup$ Do you want to trigger a focus change during capture or a post-processing of the blurry image? $\endgroup$
    – Yves Klett
    Commented Feb 22, 2016 at 6:33

1 Answer 1


In order to manipulate the camera from Mathematica, requires a device with a SDK API kit . THis are small software to allow developers manipulate the device. THe SDK will have to be C++ or .NET and use the CCompiler with pipe to interact from Mathematica.This is a subject that I been trying to work around.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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