Forgot Password
Pentax Camera Forums Home
 

Reply
Show Printable Version Search this Thread
01-03-2019, 12:38 AM   #1
New Member




Join Date: Jan 2019
Posts: 6
Need information how to get focus pulse / distance information from camera

Dear all,

Let me introduce myself, I am a computer science student from Bina Nusantara University. I am researching in computer vision. I want to measure an object size using a camera. I need Focus Pulse information since it leads to knowing the distance between the object and the camera.
I visited Welcome to Pentax Hack but the information is rather old (2010). Is there any newer information on how to get/ hack Focus Pulse?

Thank you very much in advance for your help and attention.

warmest regards,
suryadi

01-03-2019, 08:47 AM   #2
Administrator
Site Webmaster
Adam's Avatar

Join Date: Sep 2006
Location: Arizona
Photos: Gallery | Albums
Posts: 48,987
Some cameras (from Canon, and possibly others) will save the approximate subject distance directly in the EXIF, which I believe is what you need to carry out your calculations.

Unfortunately, Pentax cameras only report the distance categorically, e.g. "Near" or "Distant". Likewise, there is no way to extract the subject distance or focus setting information using tethering (AFAIK other brands do support this).

In any case, you will want to look at the data available in the EXIF. You can do so here (or, if working programmatically, execute exiftool on your local system):
Check Camera Shutter Count and Manufacture Date

You do get the focal length, aperture, and hyperfocal distance, which may allow you to estimate the actual distance using this formula:

formula - How to know or calculate depth of field of a photo from EXIF tags? - Stack Overflow

You also get a lens-specific focus index, so if you know which lens is being used, you may be able to get a ballpark distance after empirically profiling the lens. Good luck!

Adam
PentaxForums.com Webmaster (Site Usage Guide | Site Help | My Photography)



PentaxForums.com server and development costs are user-supported. You can help cover these costs by donating. Or, buy your photo gear from our affiliates, Adorama, B&H Photo, or Topaz Labs, and get FREE Marketplace access - click here to see how! Trusted Pentax retailers:

01-03-2019, 12:53 PM   #3
Pentaxian
Wasp's Avatar

Join Date: Mar 2017
Location: Pretoria
Photos: Gallery
Posts: 1,300
There is a software development kit (SDK) for Pentax cameras that allows developers to create mobile and desktop apps to control the camera via USB cable or Wi-Fi.

Ricoh releases SDK for Pentax cameras, opening the door to 3rd party remote control apps: Digital Photography Review

This might help. Or not.

https://api.ricoh/products/camera-sdk/

01-03-2019, 01:41 PM   #4
Administrator
Site Webmaster
Adam's Avatar

Join Date: Sep 2006
Location: Arizona
Photos: Gallery | Albums
Posts: 48,987
QuoteOriginally posted by Wasp Quote
There is a software development kit (SDK) for Pentax cameras that allows developers to create mobile and desktop apps to control the camera via USB cable or Wi-Fi.
There's unfortunately no way to get the focus point out of the camera (though I hope they will add such support in the future).


Adam
PentaxForums.com Webmaster (Site Usage Guide | Site Help | My Photography)



PentaxForums.com server and development costs are user-supported. You can help cover these costs by donating. Or, buy your photo gear from our affiliates, Adorama, B&H Photo, or Topaz Labs, and get FREE Marketplace access - click here to see how! Trusted Pentax retailers:

01-04-2019, 02:37 AM   #5
New Member




Join Date: Jan 2019
Posts: 6
Original Poster
Million thanks, guys for information. I will learn them.

warmest regards,
suryadi
01-06-2019, 08:24 AM   #6
PEG Moderator
Loyal Site Supporter
Kerrowdown's Avatar

Join Date: Aug 2008
Location: Hielands o' Scootlund
Photos: Gallery
Posts: 42,117
Welcome to the forum, is this not using like using an old school method, a tape measure to give you the answer?

It would give you a very scientific and repeatability, provided you use a calibrated form of measure.
01-06-2019, 07:31 PM   #7
New Member




Join Date: Jan 2019
Posts: 6
Original Poster
If the computer program success, it will be used to measure the length of fishes on a conveyor belt. they are a lot of fishes, so it cannot use a tape measure.
01-07-2019, 08:50 AM   #8
Pentaxian
photoptimist's Avatar

Join Date: Jul 2016
Photos: Albums
Posts: 3,676
The AF system is not going to help you solve your problem. A DSLR's AF system never measures or estimates distance at any time, it only measures whether the lens should be adjusted closer or farther from the lenses' unknown distance setting to improve the focus. Some lenses do report their distance to the camera but that data is very very rough.


Instead, If you locate the camera in a fixed location above the conveyor belt and looking straight down (so the edges of the conveyor belt appear parallel to the edges of the image edges), then you only need to take a few calibration images to estimate a millimeters-per-pixel scale factor.

01-08-2019, 02:43 AM   #9
New Member




Join Date: Jan 2019
Posts: 6
Original Poster
According to Method for calculating distance and the actual size of shot object at US20080101784A1 - Method for calculating distance and actual size of shot object - Google Patents
if I could get the Focus Pulse from the lens (or camera), I can get the distance between object and camera.
Is there any way to get the Focus Pulse from autofocus lens? thank you.
01-08-2019, 03:09 AM   #10
Pentaxian
Wasp's Avatar

Join Date: Mar 2017
Location: Pretoria
Photos: Gallery
Posts: 1,300
The way I see it, you can write an app that uses the SDK to control the camera. Your app takes the picture. You can then read the image file and extract the focus distance from the EXIF data. it doesn't seem to be possible to get the focus distance without actually taking a picture.
01-08-2019, 08:27 AM   #11
Pentaxian
photoptimist's Avatar

Join Date: Jul 2016
Photos: Albums
Posts: 3,676
QuoteOriginally posted by sliawatimena Quote
According to Method for calculating distance and the actual size of shot object at US20080101784A1 - Method for calculating distance and actual size of shot object - Google Patents
if I could get the Focus Pulse from the lens (or camera), I can get the distance between object and camera.
Is there any way to get the Focus Pulse from autofocus lens? thank you.
That patent is based on a deep misunderstanding of how autofocus works for most cameras and lenses. Simply put, the vast majority of cameras and lenses don't ever use, calculate, or measure the "focus pulse" number as defined and required by that patent.

When you turn a camera on, the camera has no clue whether the lens is set at infinity or close up. And it does not need to know that to work. The PDAF system can tell whether the lens needs to be focused closer or farther, and may even have some estimate of how far to move the lens, but it does not know the starting position.
01-08-2019, 10:26 PM   #12
New Member




Join Date: Jan 2019
Posts: 6
Original Poster
I read from Samsung Accidentally Confirms Killer Galaxy S9 Feature that There's also a new Super Phase Detection autofocus that will on the fly determine the distance to moving objects and adapt the picture's lighting controls to ensure improved autofocus speeds.

Is there any hint that a camera knows its lens home position. So I program to move the stepper motor into lens home position to start with.

Thank you very much.
01-09-2019, 07:31 AM   #13
Pentaxian
photoptimist's Avatar

Join Date: Jul 2016
Photos: Albums
Posts: 3,676
QuoteOriginally posted by sliawatimena Quote
I read from Samsung Accidentally Confirms Killer Galaxy S9 Feature that There's also a new Super Phase Detection autofocus that will on the fly determine the distance to moving objects and adapt the picture's lighting controls to ensure improved autofocus speeds.

Is there any hint that a camera knows its lens home position. So I program to move the stepper motor into lens home position to start with.

Thank you very much.
The typical interchangable camera lens does not have a "home position." It does have two limits of motion: the minimum focus distance and infinity (or beyond). But these limits of motion are not precise and will vary from lens to lens, vary over time, and may vary with temperature.

The design of typical camera autofocus systems is such that neither the camera nor the lens need to know an exact position.
Reply

Bookmarks
  • Submit Thread to Facebook Facebook
  • Submit Thread to Twitter Twitter
  • Submit Thread to Digg Digg
Tags - Make this thread easier to find by adding keywords to it!
camera, computer, focus, focus pulse, hack, information, object, pulse
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulse light setting on pentax k5? longlivenintendo Flashes, Lighting, and Studio 7 04-03-2018 04:20 PM
Calculating effect of flange focal distance on infinity and minimum focus distance? BigMackCam Pentax SLR Lens Discussion 11 01-14-2018 12:27 PM
Hi there. Screw drive vs PLM pulse. MichaelS Welcomes and Introductions 10 06-18-2017 04:10 PM
K-S2 No sync pulse using M when above 1/160 fb_penpho Pentax K-S1 & K-S2 4 07-08-2015 05:04 AM
HA! Utah pulse.. jeffkrol General Talk 7 08-26-2012 08:35 PM



All times are GMT -7. The time now is 04:29 PM. | See also: NikonForums.com, CanonForums.com part of our network of photo forums!
  • Red (Default)
  • Green
  • Gray
  • Dark
  • Dark Yellow
  • Dark Blue
  • Old Red
  • Old Green
  • Old Gray
  • Dial-Up Style
Hello! It's great to see you back on the forum! Have you considered joining the community?
register
Creating a FREE ACCOUNT takes under a minute, removes ads, and lets you post! [Dismiss]
Top