Cell Phone Afocal Astrophotography

Post Reply
pcstair
Posts: 7
Joined: Tue Jan 11, 2022 7:02 pm

Cell Phone Afocal Astrophotography

#1

Post by pcstair »

Hi Robin,

I have just downloaded SharpCap and am investigating its use with a cell phone in an afocal setup. The phone, an LG G5, can operate in manual mode using a variety of apps, with a shutter speed down to 30s. I have successfully connected it to my laptop as a webcam, using USB and 2 different apps. SharpCap recognizes it as a webcam and it seems to work properly, although without any camera controls other than frame rate. I would like to make use of the long shutter speed and other controls, which is not possible using the phone as a webcam.

It should be possible to use the Virtual Camera feature, running the cell phone camera in an interval mode. Basically, the cell phone camera will take and save images, repeatedly, with shutter speed, ISO, and focus set by the camera app on the phone. Using the Virtual Camera, SharpCap would then read and process the image files as they appear from the cell phone camera.

While this seemed to me like a neat strategy, I can't get it to work. The folder and the image files on the phone show up and can be accessed via Windows Explorer, but the phone is not treated as an external USB drive; it doesn't have a drive letter in Windows, and SharpCap doesn't seem to be able to access the files. Interestingly, when I try to set the source folder to one on the phone, navigation to the folder works fine, but it never shows up in the SharpCap source folder window, and SharpCap can't work with the image files.

I think the ability to use the cell phone as a Virtual Camera would allow SharpCap users to take advantage of the hardware and software improvements that are lavished on cell phone cameras.

Best,
Peter
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Cell Phone Afocal Astrophotography

#2

Post by admin »

Hi Peter,

I just had a look at what is going on here - it looks like most phones let the PC access files using a protocol called MTP. Windows kind of makes this look like files and folders, but it isn't really - you can't get a folder name for anything on the phone (at least not one that works - you might get 'Camera' or 'DCIM'), and if you select a file from the phone, Windows copies it to a temporary folder behind the scenes and then gives you the filename of that temporary copy. That explains why nothing really works properly - at most you can get one file transferred and then SharpCap will watch the temporary folder that the one file is copied into to see if more files arrive :(

To be honest, there's no easy fix for this. There may be programs out there that can synchronize files from an MTP device to a Windows folder - if you can get one of those to work then SharpCap could monitor the folder that the files are being copied to.

cheers,

Robin
pcstair
Posts: 7
Joined: Tue Jan 11, 2022 7:02 pm

Re: Cell Phone Afocal Astrophotography

#3

Post by pcstair »

Hi Robin,

Thanks for looking into this!

I found an app that’s supposed to make the phone’s sd card look like usb mass storage. I’ll have to root the phone, but it’s a used LG G5, so not much of a loss if I brick it. I’ll let you know how it turns out.

Peter
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Cell Phone Afocal Astrophotography

#4

Post by admin »

Hi Peter,

yes, USB mass storage is certainly likely to work better. You will be able to select the folder and should be able to work with existing files in the folder. What I'm not sure about is if SharpCap will notice new files that are being added by the phone - SharpCap relies on a notification from the Windows operating system about new files appearing in the folder, and I have no idea if that will work for files being added to the USB storage that are not put there by Windows.

cheers,

Robin
pcstair
Posts: 7
Joined: Tue Jan 11, 2022 7:02 pm

Re: Cell Phone Afocal Astrophotography

#5

Post by pcstair »

Hi Robin,

I have worked out a workflow that will allow me to feed images to SharpCap from my cell phone via the Virtual Camera. If there is any interest, I can elaborate on what worked and didn't work.

Now I have a question. At the moment SharpCap can process jpg and png images from the cell phone camera. However, the LG G5 and newer Android phones can also produce RAW images in the digital negative, dng, format. Is there any chance that SharpCap could deal with images in this format?

Thanks,
Peter
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Cell Phone Afocal Astrophotography

#6

Post by admin »

Hi Peter,

right now there is no support for DNG or other RAW DSLR/phone cam formats.

In the past, some people have worked around this by using the 'dcraw' program to convert to a format that SharpCap supports - see this thread which includes a script to do this in real time as new RAW images arrive. viewtopic.php?t=2178

cheers,

Robin
pcstair
Posts: 7
Joined: Tue Jan 11, 2022 7:02 pm

Re: Cell Phone Afocal Astrophotography

#7

Post by pcstair »

HI Robin:

This post is part report on how I am transferring images from a cell phone to SharpCap and part question about the best strategy for using the Virtual Camera function. The report may serve to help someone else us a cell phone camera with SharpCap.

Cell phone images can be transferred to a PC via drag and drop, but I found this clumsy. Instead, I have implemented a two-part process.

Part 1: Setup the cell phone sdcard storage as a mapped network drive on the PC
a) Download and install WebDAV Server Pro from the Play Store. Follow the instructions in the app to use a USB connection and select a folder on the sdcard where photos from the camera will be stored. Connect the phone and PC via USB cable and start the WebDAV server.
b) Download and install the Android Debug Bridge (ADB) program on the PC. This can be obtained from a variety of internet locations.
c) From the directory on the PC where ADB is installed execute the following three commands using the Windows command prompt (cmd):
adb start-server
adb forward tcp:8080 tcp:8080
net use Y: http://127.0.0.1:8080

These commands serve to establish the photo storage location on the phone as a folder that can be addressed via Windows Explorer or a cmd line. At first I thought this would be sufficient, but it turns out that the PC can only copy image files.

Part 2: File transfer.
The image files on the phone can't be deleted, modified or moved. I want to use a simple command like "copy *.*" but then old files will be copied along with new ones. I decided on a strategy to erase the camera files after each transfer to the PC. That way the images would accumulate on the PC but not on the phone, and they would be transferred only once. A 2-line batch file, running via the command line serves this purpose:

Robocopy Y:\OpenCamera D:\SharpCap
adb shell rm /storage/3467-1AFA/DCIM/OpenCamera/*.*

The first line copies all the files saved by the "Open Camera" app in the "OpenCamera" folder on the phone to the "SharpCap" directory on drive D:, of the PC where the images are accumulated and monitored by SharpCap. The second line (via a Unix command) erases the image files from the folder where they are stored on the phone by the Android app "Open Camera".

More could be done with the cmd and adb commands to automate this process, but this works for me. I just take some pictures with the cell phone and then execute the 2-line batch file to transfer them to the folder monitored by SharpCap.

Now I have a question about the "best" way to use the Virtual Camera. I could either allow the image files to accumulate in the folder monitored by SharpCap, or I could maintain only a single image in that folder by judiciously moving each image in and out of the monitored folder and accumulating them elsewhere. Is there an advantage one way or the other in terms of how the Virtual Camera works? For example, when polar aligning, would it be better to have only a single image file in the monitored folder?

Best,
Peter
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Cell Phone Afocal Astrophotography

#8

Post by admin »

Hi Peter,

great to hear that you managed to get things working, and thanks for sharing the details :)

With respect to the single/multiple images, the folder monitor camera internally has a queue of images to process - that queue starts out containing the images already in the folder when the camera is started, and new images get added to the queue as they appear in the folder (SharpCap listens for folder/file change updates). Unless SharpCap ends up getting behind in processing the incoming images then there it shouldn't matter whether you just let them pile up or try to keep only one there. If you do try to keep only one image there then you will have to cope with errors deleting images, as you might get a failure from trying to delete one that SharpCap is currently reading.

cheers,

Robin
Post Reply