Looking for help developing a custom function intended for astronomy and astrophotography.
Feature: - identify biggest brightest star in the center of an image
- repeat exposure, identify star's new location in subsequent images
- estimate the change in location dX, dY, and dT
- exposure times for the images would range from 10ms to 10 seconds
- use dX, dY, and dT to generate commands to a 2 axis controller to keep the star from moving on the image
- the commands would be sent to the PC, and a special ASCOM compatible Windows driver sent the commands to the steppers
- there is a calibration step that determines how a command to the 2 axis controller results in a change in X,Y for the star
Progress to date- I've tried setting up a custom function in C but have had trouble getting it defined and called properly from UBASIC
Reference material-phd guide is an open source application that is a template for this and has code available on code.google.com Also, I will add my notes
http://code.google.com/p/open-phd-guiding/My basice outline
rem Author: Chris Schmidt
rem Tested on A700
rem build v 885
rem Use with caution!
@title Autoguide
@param binsize 2by2binning
@default binsize 2
@param tv exposure time
@default tv 50
@param intv exposure interval
@default intv 100
@param boxsize pixel size of search
@default boxsize 100
cls
print "Begin Autoguiding"
t=get_tick_count
print "get image"
vp_h = get_viewport_height
vp_w = get_viewport_width
img = vid_get_viewport_live_fb
cy=0
L_max=0
print "finding a star"
for y=0 to (vp_h - binsize)
for x=0 to (vp_w-binsize)
cy = (img[x+1+y*vp_w]+img[x+(y+1)*vp_w]+img[x+1+(y+1)*vp_w]+img[x+y*vp_w])/4
if cy > L_max
L_max = cy
max_x = x
max_y = y
endif
next x
next y
print "draw box"
int color;
color=COLOR_RED;
draw_rect( max_x, max_y, max_x+2, max_y-2,color)
print "remember star"
star_x= max_x
star_y= max_y
star_l= L_max
print "next image"
:starloop
img = vid_get_viewport_live_fb
cy=0
L_max=0
print "finding a star"
for y=(star_y-boxsize/2) to (vp_h - binsize)
for x=(star_x-boxsize/2) to (vp_w-binsize)
cy = (img[x+1+y*vp_w]+img[x+(y+1)*vp_w]+img[x+1+(y+1)*vp_w]+img[x+y*vp_w])/4
if cy > L_max
L_max = cy
max_x = x
max_y = y
endif
next x
next y
print "draw box"
int color;
color=COLOR_RED;
draw_rect( max_x, max_y, max_x+2, max_y-2,color)
print "find star again"
goto starloop
end