Author Topic: [Unofficial] New Module: Seed (MaskGeneration category)  (Read 8380 times)

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
[Unofficial] New Module: Seed (MaskGeneration category)
« on: 2009 October 05 21:48:40 »
Hello everybody

Another pre-release, for you to test ;)

This one, called Seed (because this is a common name for this algorithm in the image processing argot), allows the user to plant a seed anywhere on a image, and it will grow to reach some boundaries, defined by the user by some parameters (I'll comment them later). So, as you may guess, this is the so called magic wand by other programs I'm not allowed to speak of (just joking ;) ).

In a more sophisticated seed algorithm (as is this case), there are two ways to determine if a neighbor pixel should be considered as part of the region of interest. There is either a global tolerance, or in other words, each new pixel is compared to the original seed point; or, we use an adaptative (local) tolerance, wich compares a new pixel intensity to it's region included neighbors. By the way, here you may select between a square (all the 8 ways) or diamond (only 4 ways, not the diagonals) neighborhoods.
Sometimes it is handy to use statistical information to determine the tolerance, either with maximum/minimum values or the standard deviation. Because of that, I implemented not only point samples, but rectangular ones. Image statistical data is calculated for the seed rectangle, and it's maximum/minimum values are used to determine a global tolerance, while the standard deviation is used for the local tolerance (see Statistical Tolerance parameters). If you select this kind of tolerances for a point sample, global statistical are used, of the whole image. Fixed valued tolerances work for rectangles pretty much the same as for points, using the median value of it for the global tolerance calculation.

Last interfase comment: there are special readout buttons that allows a simple/quick input of coordinates.


So, here is the Win32 compilation:
http://pteam.pixinsight.com/carlos/modules/Seed-pxm.zip

And the source code:
http://pteam.pixinsight.com/carlos/modules/Seed-src-2009-10-05.zip


Enjoy!

PS: Next in the development queue is the ColorRange mask generation tool. After that, DeffectMapPatcher.
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Simon Hicks

  • PixInsight Old Hand
  • ****
  • Posts: 333
Re: [Unofficial] New Module: Seed (MaskGeneration category)
« Reply #1 on: 2009 October 05 23:58:31 »
Hi Carlos,

Very cool. It seemed to work fine.

It would be really handy to have a live preview....I found it hard to know what number to enter and just ended up creating preview after preview before I could get a feel for things. Interactive feedback would really help.

Also, it would be really cool to have a smoothing feature (feathering)....similar to the StarMask set of parameters....so that you can create a usable mask all in one go. Just a thought.

Cheers
         Simon

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: [Unofficial] New Module: Seed (MaskGeneration category)
« Reply #2 on: 2009 October 06 00:01:44 »
Hi all,

I also find the same problem with StarMask itself - no LivePreview. So, when I am trying to create a mask, I end up with 'hundreds' of new mask images all over the screen as I tweak and adjust parameters. If a preview option could be added to both of these GUIs, I think that would be a step forward.

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: [Unofficial] New Module: Seed (MaskGeneration category)
« Reply #3 on: 2009 October 06 04:27:09 »
Hi guys

I'll take a look at the RealTime preview system, and see if I can use it here. The main problem, of course, would be accuracy. As you know, real time previews are just an approximation to the image itself, so the results may vary with an actual application to the main view.

About feathering and other features (add selections, intersect, etc). I thought a lot about this. And decided to leave them out in this implementation for two main reasons: a) for the sake of simplicity b) masks are images. So, anybody may apply convolutions, morphological filters, etc., in a much more controlled and versatile way with the current stand alone processes than with a in-build one. Also, to add selections, intersect, subtract, etc. is PixelMath.
Another possible way to go with Seed was to incorporate other color spaces... but also it is quite easy to extract those channels and work with them directly, and maybe much more intuitive (btw, I'm having some design issues with ColorRange for the same reason, any thoughts for that process?)
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: [Unofficial] New Module: Seed (MaskGeneration category)
« Reply #4 on: 2009 October 06 07:29:37 »
I forgot to say something important about the Seed process:

The output is a 8bit integer image, with the same number of channels that the target image. Please note that the seeding/grow process is done independly for each nominal channel (i.e. no alpha channels).

The output image will contain 3 types of pixels:
- Black: they indicate that they belong to the region that was included in the growing process.
- White: these are boundary pixels, that are not part of the selection.
- Gray: zones of the image that were not evaluated, because a closed boundary was found (this is perfectly normal).

So, if you want to create a mask protecting the seeded region, use the binarize process to quickly turn all those gray pixels into white. If you want to extract the boundaries, do the opposite, turn the gray area black (this procedure is quite usefull for object detection algorithms, like preparation for a hough transformation).

Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: [Unofficial] New Module: Seed (MaskGeneration category)
« Reply #5 on: 2009 October 08 10:43:48 »
You're one busy man! Thanks very much for all these modules you've been writing. Now of course we need to learn how to use them. Ah, things to do for the video makers and tutorial writers among us :)
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
Re: [Unofficial] New Module: Seed (MaskGeneration category)
« Reply #6 on: 2010 April 08 06:51:17 »
Hi Carlos,

Some of these modules looked very useful.
Now that 1.60 is out is worthwhile fix the code now?
That is if you have the time.

Max

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: [Unofficial] New Module: Seed (MaskGeneration category)
« Reply #7 on: 2010 April 08 06:59:32 »
All the modules are in Juan's hands. He said he wanted to introduce small changes, improve the interface, etc.
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Harry page

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1458
    • http://www.harrysastroshed.com
Re: [Unofficial] New Module: Seed (MaskGeneration category)
« Reply #8 on: 2010 April 08 10:06:11 »
Hi Carlos


I miss selective blend and your other works , any plans to do these  :D

Harry
Harry Page

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: [Unofficial] New Module: Seed (MaskGeneration category)
« Reply #9 on: 2010 April 08 12:36:07 »
The same reply :P I have send all my finished modules (and a few that still had problems) to Juan. Now is up to him to edit them to his taste, and incorporate them to the app. Next week I'll have a window of free time, and I'll begin to write new stuff.
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com