The following page provides a basic technique for detecting if a pixel is inside an irregular polygon:
Pixel Test[
^].
A similar principle can be applied. Given the set of points making your polygon, find the min/max along the x/y coordinates. Then, for each scan line, track when you are inside or outside the polygon as you go.
You can then apply your sunspot detection algorithm only to those points that enumerate within the polygon.