Plate solving for Camera Orientation

Anything that doesn't fit into any of the other forums
Post Reply
User avatar
oopfan
Posts: 1321
Joined: Sat Jul 08, 2017 2:37 pm
Location: New York
Contact:

Plate solving for Camera Orientation

#1

Post by oopfan »

Robin,

The other day I contacted Mr. Philippe Deverchère, the author of C2A, with two questions. The first he answered in great detail and I am thankful. The second he did not offer a reply so I am guessing that C2A is not yet capable of it.

I've attached a screenshot of a 4-frame mosaic of the Horsehead and Flame Nebulae that I am composing in C2A. Notice that each of the four frames contains a red-colored cross at the center. Also know that each frame is rotated 106 degrees.

From my experience with plate solving using SharpCap and C2A with ASCOM as the glue, I can initiate a plate solve at any time and within 30 seconds a "Field Marker" in C2A will position itself to show exactly where my scope is pointing. My plan is to make small changes to my slow motion controls and redo plate solving until the Field Marker is at the center of the mosaic frame that I wish to image that night.

The problem (if you want to call it that) is that I need to tell C2A what the camera orientation is by modifying the Field Marker definition. Fortunately I wrote some IronPython code to use the star drift method to obtain that. But with my experience using nova.astrometry.net I know that the plate solver can figure out the camera orientation by inspecting the star field, so in an ideal world I don't need my IronPython code.

It would be really nice if SharpCap could send the camera orientation angle to C2A via ASCOM. I don't know if the ASCOM protocol has a named field or property for it or if not perhaps there is an auxiliary field that could be used. And of course this would require a code modification on the C2A-side.

I thought I would plant that idea for some future version of SharpCap.

Thanks,
Brian

PS: I attached another image: an APOD from AstroBin from a few years ago by Stefan Muckenhuber. I cropped it down to the dimensions and orientation of my mosaic. What do you think? I think I might rotate it by 10 degrees clockwise. Sorry for the weird angle -- I am using Windows Paint that only allows rotation of an image by increments of 90 degrees so you need to tilt your head.
Attachments
Horsehead plan.jpg
Horsehead plan.jpg (135.79 KiB) Viewed 3039 times
Horsehead envisioned.jpg
Horsehead envisioned.jpg (103.37 KiB) Viewed 3039 times
User avatar
admin
Site Admin
Posts: 13173
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Plate solving for Camera Orientation

#2

Post by admin »

Very interesting :D

I was expecting this info to be in the output of the astrometry.net engine (the solve-field script), which goes straight into the SharpCap log, but it turns out that isn't the case :(

So it turns out that we have two problems here

1) how to get the info - I presume that the plate solve must work it out, but not sure how it can be made to output it
2) the fact that there is no ASCOM way to specify rotation of the camera (this might mean that even at best there would need to be a manual step of copying the value from one app to the other).

Anyway, it might be worth you having a look at the command line params to solve-field to see if you can work out how to get the orientation - if you can get that sorted and it is compatible with what SharpCap already does I'd be happy to add the info to the log.

cheers,

Robin

ps. current solve-field output from SharpCap log

Code: Select all

Extracting sources...
simplexy: found 360 sources.
Solving...
Reading file "/tmp/796090b3-5e57-4864-a14f-d101beec2909/frame.axy"...
Field 1 did not solve (index index-4219.fits, field objects 1-10).
Field 1 did not solve (index index-4218.fits, field objects 1-10).
Field 1 did not solve (index index-4217.fits, field objects 1-10).
Field 1 did not solve (index index-4216.fits, field objects 1-10).
Field 1 did not solve (index index-4215.fits, field objects 1-10).
Field 1 did not solve (index index-4214.fits, field objects 1-10).
Field 1 did not solve (index index-4213.fits, field objects 1-10).
Field 1 did not solve (index index-4212.fits, field objects 1-10).
Field 1 did not solve (index index-4211.fits, field objects 1-10).
Field 1 did not solve (index index-4210.fits, field objects 1-10).
Field 1 did not solve (index index-4209.fits, field objects 1-10).
Field 1 did not solve (index index-4208.fits, field objects 1-10).
Field 1 did not solve (index index-4207-11.fits, field objects 1-10).
Field 1 did not solve (index index-4207-10.fits, field objects 1-10).
Field 1 did not solve (index index-4207-09.fits, field objects 1-10).
Field 1 did not solve (index index-4207-08.fits, field objects 1-10).
Field 1 did not solve (index index-4207-07.fits, field objects 1-10).
Field 1 did not solve (index index-4207-06.fits, field objects 1-10).
Field 1 did not solve (index index-4207-05.fits, field objects 1-10).
Field 1 did not solve (index index-4207-04.fits, field objects 1-10).
Field 1 did not solve (index index-4207-03.fits, field objects 1-10).
Field 1 did not solve (index index-4207-02.fits, field objects 1-10).
Field 1 did not solve (index index-4207-01.fits, field objects 1-10).
Field 1 did not solve (index index-4207-00.fits, field objects 1-10).
Field 1 did not solve (index index-4219.fits, field objects 11-20).
Field 1 did not solve (index index-4218.fits, field objects 11-20).
Field 1 did not solve (index index-4217.fits, field objects 11-20).
Field 1 did not solve (index index-4216.fits, field objects 11-20).
Field 1 did not solve (index index-4215.fits, field objects 11-20).
Field 1 did not solve (index index-4214.fits, field objects 11-20).
Field 1 did not solve (index index-4213.fits, field objects 11-20).
Field 1 did not solve (index index-4212.fits, field objects 11-20).
Field 1 did not solve (index index-4211.fits, field objects 11-20).
Field 1 did not solve (index index-4210.fits, field objects 11-20).
Field 1 did not solve (index index-4209.fits, field objects 11-20).
Field 1 did not solve (index index-4208.fits, field objects 11-20).
Field 1 did not solve (index index-4207-11.fits, field objects 11-20).
Field 1 did not solve (index index-4207-10.fits, field objects 11-20).
Field 1 did not solve (index index-4207-09.fits, field objects 11-20).
Field 1 did not solve (index index-4207-08.fits, field objects 11-20).
Field 1 did not solve (index index-4207-07.fits, field objects 11-20).
Field 1 did not solve (index index-4207-06.fits, field objects 11-20).
  log-odds ratio 167.339 (4.72476e+72), 64 match, 2 conflict, 28 distractors, 133 index.
  RA,Dec = (83.8356,-5.307), pixel scale 4.29314 arcsec/pix.
  Hit/miss: +++++++++++-+++++-++++-++-++----++++---+++++++-+-++++--+c++---+++++++-+---+-+++++--c-+++++--++(best)-c++++
Field 1: solved with index index-4207-05.fits.
Field 1 solved: writing to file /tmp/796090b3-5e57-4864-a14f-d101beec2909/frame.solved to indicate this.
Field: /tmp/796090b3-5e57-4864-a14f-d101beec2909/frame.png
Field center: (RA,Dec) = (83.84, -5.309) deg.
Field center: (RA H:M:S, Dec D:M:S) = (05:35:20.575, -05:18:32.716).
Field size: 1.55142 x 1.13939 degrees

User avatar
oopfan
Posts: 1321
Joined: Sat Jul 08, 2017 2:37 pm
Location: New York
Contact:

Re: Plate solving for Camera Orientation

#3

Post by oopfan »

Robin,

It turns out that All Sky Plate Solver (ASPS) ships with a VERY OLD version of Astrometry.net -- November, 2010.

I should try to download the code from GitHub and rebuild the executables but that seems like overkill for what I want: Orientation.

I looked in the latest source code and discovered how they compute it:

Code: Select all

       
double CalculateOrientation(double cd1_1, double cd1_2, double cd2_1, double cd2_2)
{
    double det = cd1_1 * cd2_2 - cd1_2 * cd2_1;
    double parity = det >= 0 ? 1.0 : -1.0;
    double T = parity * cd1_1 + cd2_2;
    double A = parity * cd2_1 - cd1_2;
    double orientation = -Math.Atan2(A, T) / Math.PI * 180;
    return orientation;
}
The values for the four input arguments come from the WCS file. For example here are the values of an image that I took of NGC 457:

Code: Select all

CD1_1   =   -0.000537271410424 / Transformation matrix                          
CD1_2   =    8.26530642148E-06 / no comment                                     
CD2_1   =    -8.2472830252E-06 / no comment                                     
CD2_2   =   -0.000537342438505 / no comment                                     
When I run those numbers through the function I get 179.12 degrees. This agrees with nova.astrometry.net. I also have agreement with an image of M51.

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

Re: Plate solving for Camera Orientation

#4

Post by admin »

Hi Brian,

thanks for that info - looks like adding the -W option to the command line will cause a WCS file to be generated, which sould then be easy to read. The angle code looks like the standard way to extract an angle from a rotation matrix, so no problem there.

I'll look into this when I get a chance.

cheers,

Robin
User avatar
oopfan
Posts: 1321
Joined: Sat Jul 08, 2017 2:37 pm
Location: New York
Contact:

Re: Plate solving for Camera Orientation

#5

Post by oopfan »

Robin,

I am guessing that you are parsing the log file for the RA and DEC. You won't need to do that anymore since that info can be found in the WCS file from keys CRVAL1 and CRVAL2, respectively. The format of the WCS is like a stack of punch cards. All records are exactly 80 characters wide without a LF at the end, so it looks crazy in a normal text editor. I simply read each record and look to see if it contains an equal sign, and if it does I add a (key, value) pair to a dictionary. You will still want to read the log file but only to show progress. You will be able to throw out some code and write some new code. On balance you end up with the same number of lines of code.

The default behavior is that you get the WCS file. If you don't want it then you would say "-W none".

Brian
Last edited by oopfan on Wed Mar 14, 2018 6:08 pm, edited 1 time in total.
User avatar
admin
Site Admin
Posts: 13173
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Plate solving for Camera Orientation

#6

Post by admin »

Hi Brian,

this is in the latest version - I look in the WCS file for the rotation matrix and calculate the direction - as far as I can see my results are agreeing with astrometry.net, but pleas let me know if you find any gremlins.

cheers,

Robin
Post Reply