Hi Juan, thank you for your response.
I’m working on a script to automatically detect images with satellite trails, I’m a retired mechanical engineer and my only previous programing experience was Matlab. I’m thoroughly enjoying learning to write pixinsight scripts, I don’t mean any disrespect, but the lack of documentation makes it especially challenging and it can be quite satisfying finding out what a particular object does and how to format the inputs. Recently I was defeated and you helped me lean how to turn a matrix into an image.
My current script identifies about 50~60% of images containing trails, no false identifications, the trails that are not found are typically quite faint. Since time is not a constraint (being retired) I wanted to try to improve the initial edge detection by adding some further steps of the Canny edge detection method. My problem is as follows;
Ix and Iy are the images after Sobel Filter. The edge intensity is sqrt(Ix^2+Iy^2) and to further refine the edges I also need atan2(Iy/Ix).
Ix and Iy should have both positive and negative values, but they are always positive, the values are either truncated or rescaled when using the convolution process. I recently found a post of yours from Aug 25, 2010 which showed how to use the image.convolve command and I tried this, but again only positive numbers. I didn’t see any matrix.convolve commands where positive and negative values would no doubt be produced. I was thinking that calculating this manually using for loops would not be particularly elegant or efficient, but obviously it can be done.
I noticed that PixelMath has an option to disable both truncation and rescale. Your Jan 21, 2021 post showed how to use kconv so I tried ;
kconv( $T, 1.000000, 0.000000, -1.000000, 2.000000, 0.000000, -2.000000, 1.000000, 0.000000, -1.000000) (I think its a Sobel kernel)
With rescale and truncation set to false, I was surprised to find only positive values. Does kconv automatically truncate or rescale ?
Any suggestions you might have would be most welcome. Also thank you for looking at the atan2 option in a pixel math update.