During the astronomy camp, I turned my telescope multiple times towards M33 with little success. Although it seems like an easy target, the weather was working against me, or perhaps the planets were simply misaligned :P Finally I settled with 18×5 min, ISO 1600, with the modified Canon 1100D, N 150/750, Baader MPCC Mark III, HEQ5 with the resurrected guiding system. And I say settle, because the collimation was visibly off. So I had to invent a way to correct it, and I came up with a very crude php script that basically says: if you are a bright star, show me your center of gravity, then let me go around you and put some of your misaligned light to the other side. The outcome was far from a success but spared me from doing it manually on each and every star.
M 33, NGC 598 [galaxy in Tri] Triangulum galaxy, Triangulum-galaxis, Galaxia Triunghiului 5.8m ø70.8′ [wiki] [simbad] 750mm, 400mm
<?php
set_time_limit(1480);
ini_set('memory_limit', '2048M');
function findcenter($i, &$x, &$y, $rad, $kuszob){
$delta = array(0,0,0,0);
$angle = array(0, M_PI / 2, M_PI, M_PI*3/2);
for ($ind =0; $ind<4; $ind++){
for ($r=1; $r<$rad; $r++){
$x1 = round($x + $r * cos($angle[$ind]));
$y1 = round($y + $r * sin($angle[$ind]));
$pix = imagecolorat($i, $x1, $y1) % 256;
if ($pix < $kuszob){
$delta[$ind] = $r;
$r = $rad*2;
}
}
}
$y = $y + round(($delta[1] - $delta[3]) / 2);
$x = $x + round(($delta[0] - $delta[2]) / 2);
}
function imagecolorat_($i, $x, $y, $prev){
if ($x < 0){
return $prev;
}
if ($y < 0){
return $prev;
}
if ($x >= imagesx($i)){
return $prev;
}
if ($y >= imagesy($i)){
return $prev;
}
return imagecolorat($i, $x, $y);
}
function imagesetpixel_($i, $x,$y,$col,$prev=false){
if ($x < 0){
return $prev;
}
if ($y < 0){
return $prev;
}
if ($x >= imagesx($i)){
return $prev;
}
if ($y >= imagesy($i)){
return $prev;
}
return imagesetpixel($i, $x, $y, $col);
}
function benne($cx, $cy, &$processed){
$r = 3;
for ($x=-$r; $x<=$r; $x++){
for ($y=-$r; $y<=$r; $y++){
$key = ($cx+$x).'_'.($cy+$y);
if (in_array($key, $processed)){
return false;
}
};
}
$processed[] = $cx.'_'.$cy;
return true;
}
$i = imagecreatefromstring(file_get_contents("input.jpg"));
$o = imagecreatetruecolor(imagesx($i), imagesy($i));
imagecopy ($o, $i, 0,0,0,0, imagesx($i), imagesy($i));
$radius = 65;
$kuszob = 235;
$fenyeskuszob = 250;
$processed = array();
$alsokuszob = 0;
$tol=3;
for ($x = 0; $x<imagesx($i); $x++){
for ($y = 0; $y<imagesy($i); $y++){
$pix = imagecolorat($i, $x, $y);
if ($pix % 256 >= $fenyeskuszob){
//find the white center
$cx = $x;
$cy = $y;
findcenter($i, $cx, $cy, $radius, $kuszob);
$key = $cx."_".$cy;
//imagesetpixel($o, $cx, $cy, 0xFF0000);
if (!benne($cx, $cy, $processed)){
for ($angle = 0; $angle < M_PI; $angle+=0.005){
$prev1 = 255;
$prev2 = 255;
for ($r =1; $r<$radius; $r++){
$x1 = round($cx + $r * cos($angle));
$y1 = round($cy + $r * sin($angle));
$x2 = round($cx + $r * cos($angle+M_PI));
$y2 = round($cy + $r * sin($angle+M_PI));
$p1 = imagecolorat_($i, $x1, $y1, $p1) % 256;
$p2 = imagecolorat_($i, $x2, $y2, $p2) % 256;
if (($p1-$tol > $prev1) OR ($p2-$tol > $prev2)){
$r = $radius+1;//break
}
if (
($p1 <= $kuszob) AND ($p2 <= $kuszob)
AND
($p1 <= $prev1) AND ($p2 <= $prev2)
AND
($p1 >= $alsokuszob) AND ($p2 >= $alsokuszob)
){
$prev1 = $p1;
$prev2 = $p2;
$p3 = floor(($p2+$p1)/2);
imagesetpixel_($o, $x1, $y1, $p3*256*256 + $p3*256 + $p3);
imagesetpixel_($o, $x2, $y2, $p3*256*256 + $p3*256 + $p3);
}
}
}
}
}
}
}
imagejpeg($o, "output.jpg", 100);
?>
<div style="display:relative" >
<img style="left:0; top:0; position:absolute; width:100%" id="i" src="input.jpg">
<img style="left:0; top:0; position: absolute;width:100%" id="o" src="output.jpg">
</div>
<script>
var o = document.getElementById("o");
setInterval(function (){
if (o.style.display != "none"){
o.style.display = "none";
}else{
o.style.display = "";
}
}, 1000);
</script>











