Author Topic: modification to Image Annotation Script  (Read 2881 times)

Offline aworonow

  • PixInsight Addict
  • ***
  • Posts: 258
    • Faint Light Photography
modification to Image Annotation Script
« on: 2019 December 01 12:40:45 »
In many cases, annotations collide or virtually overlap, making the annotation unreadable. Maybe some of this could be alleviated by an option that allowed an annotation to be displaced a small random amount in +X and +Y. The user might be allowed to adjust the magnitude range for such offsets.

Thanks, Alex

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: modification to Image Annotation Script
« Reply #1 on: 2019 December 01 12:56:25 »
Hi Alex,

Yes, this is a known problem. We'll try to fix it as soon as possible with an update. A manual option is not necessary; the solution is relatively easy to implement by applying font metrics correctly on all platforms. Sorry for the inconvenience.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline james7

  • Member
  • *
  • Posts: 55
Re: modification to Image Annotation Script
« Reply #2 on: 2019 December 23 21:13:04 »
Yes, a way to offset the labels would be very useful. However, wouldn't that have to operate on each individual object? I'm not sure how that could be done. I guess what Juan is suggesting is that the annotation script itself should use the font metrics to detect and prevent any conflicts. But, that could be a little difficult if there are multiple labels that overlay each other, you could certainly offset those automatically using the font metrics, but would that arrangement really make any sense in the final annotation (it could be difficult to tell which label goes with each object).

However, you can currently create individual layers that are transparent and then overlay those layers in a program like Photoshop. Once you do that you can offset or move each individual layer.

That said, it would also be nice if you could create custom catalogs directly as output from the annotation script. Currently you can output all of the annotation objects to a simple text file but the format isn't the same as needed to create a custom catalog. The custom catalog has a format as defined below (by Andres.Pozo):
Quote
The custom catalog format is a text file where each line is a record with fields separated by tabs. The first line must be a header that defines the columns of each record. The available columns are these:

NAME: (Optional) Screen name of the object (i.e. NGC4565)
RA: (Mandatory) Right ascension in degrees (not hours) (i.e. 225.211545)
DEC: (Mandatory) Declination in degrees (i.e. -53.25664)
DIAMETER: (Optional) Diameter of the object in arcminutes. If this column doesn't exist or the value is 0, the object is considered as a point.
MAGNITUDE: (Optional) Magnitude of the object.
So, if you can output a text file that has all of the objects why can't you output a custom catalog that is in the same format as needed by the annotation script? With that custom catalog you could edit/change whatever you wanted (including the removal of unwanted objects or addition of others). Worse case, you could change the RA and DEC values to offset the name (and use a separate transparent overlay to output just the names -- without the markers). However, it would be nice if the NAME field in the above format allowed leading space characters, since that padding would allow individual horizontal offsets to the names. Right now it looks like the custom catalog parsing just ignores leading spaces in the names, which seems unnecessary since tabs are used as field separators (the parser should allowing all white space, except tabs, to be taken as literal).

Also, it looks like the MAGNITUDE field only accepts numbers which precludes doing something like: mag=11.2. I don't know maybe this limitation is in the annotation mechanism itself, but it would be useful to have MAGNITUDE be a simple text field, or just redefine that field -- or add another -- for optional text. Right now it looks like the custom catalog doesn't do anything with the MAGNITUDE field except allow it to be printed in one of the selected field positions, there is no magnitude limit or test option in the custom catalog parameters (just the marker and label options).

I guess best case would be to keep the MAGNITUDE as it is and then add a range test for that field. Then add a custom text field that could be positioned as done with the other labels. That way you could add something like "mag=11.2" (or whatever) along with the object name. So, the new custom catalog format would look something like the following:

NAME: (Optional) Screen name of the object (i.e. NGC4565)
RA: (Mandatory) Right ascension in degrees (not hours) (i.e. 225.211545)
DEC: (Mandatory) Declination in degrees (i.e. -53.25664)
DIAMETER: (Optional) Diameter of the object in arcminutes. If this column doesn't exist or the value is 0, the object is considered as a point.
MAGNITUDE: (Optional, must be numeric value) Magnitude of the object.
TEXT: (Optional) Custom text defined by the user.
« Last Edit: 2019 December 23 21:53:26 by james7 »

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: modification to Image Annotation Script
« Reply #3 on: 2019 December 24 04:23:47 »

However, you can currently create individual layers that are transparent and then overlay those layers in a program like Photoshop. Once you do that you can offset or move each individual layer.
AnnotateImage can generate a SVG overlay that can be edited using a vector image program (i.e. Inkscape) and then merged with the original image.

Offline james7

  • Member
  • *
  • Posts: 55
Re: modification to Image Annotation Script
« Reply #4 on: 2019 December 24 08:14:39 »

However, you can currently create individual layers that are transparent and then overlay those layers in a program like Photoshop. Once you do that you can offset or move each individual layer.
AnnotateImage can generate a SVG overlay that can be edited using a vector image program (i.e. Inkscape) and then merged with the original image.
Thanks, I'll give that a try. However, I'd still prefer being able to edit a custom catalog that could be output (optionally) from the ImageAnnotation tool. As it is, I've just created custom catalogs that use data from the object text file that can already be output by the script. But, I don't think I'd want to do that very often because there is a fair amount of manual work to create the catalog.