Author Topic: ColorCalibration using masks?  (Read 1242 times)

Offline scheidtmann

  • Newcomer
  • Posts: 3
ColorCalibration using masks?
« on: 2020 January 27 13:03:16 »
Hallo fellow PixInsight users,

I would like to ColorCalibrate a star trail image, which somehow has pinkish stars and quite some blue background gradients, which I would like to preserve in the final image. I therefore flattened my image using DBE and created a manual range mask, selecting only the star trails. I applied the mask to the image. When running ColorCalibration now the stars get more pinkish, probably because a lot of the blue needs to be cancelled to become color neutral (gray). My bluish gradients get converted to (dark) gray.

So it seems ColorCalibration does not honor the mask?
If this is so, is there a different way to achieve what I want?

Thanks in advance, Jens

 
« Last Edit: 2020 January 28 07:37:51 by scheidtmann »

Offline scheidtmann

  • Newcomer
  • Posts: 3
Re: Does ColorCalibration use masks?
« Reply #1 on: 2020 January 27 13:16:27 »
Here's a small sample of the image:

Offline ngc1535

  • PixInsight Old Hand
  • ****
  • Posts: 326
Re: Does ColorCalibration use masks?
« Reply #2 on: 2020 January 27 13:49:35 »
To summarize, you have an image that has good star trails.
And another image that has a good background (after DBE) but clobbers the stars.
Does this sound correct?

If so, there are a number of ways of blending the two images to get what you want. If your mask is good enough- protect the star trails and then use pixel math to write the background corrected version on top (in to) the this good star trail image.

All of that being said, I am surprised that DBE affects the star trails (strongly) relative to the background. I assume the trails are much brighter than the sky...but I haven't seen the data of course.

-adam

Offline scheidtmann

  • Newcomer
  • Posts: 3
Re: Does ColorCalibration use masks?
« Reply #3 on: 2020 January 28 07:32:48 »
No, you got me wrong.
  • I've good a nice image (see screen shot) but it has a gradient, so applying the RangeMask feature of ColorCalibration doesn't work.
  • I clone that picture, use DBE and extract a RangeMask, so that only star trails are visible through the mask.
  • I now apply that mask to the original picture.
  • Do a ColorCalibration to the original image with the mask.
  • This also "calibrates" the masked area.

So, I'd like to know, if there's a way, to apply ColorCalibration only to unmasked parts of a picture.

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: ColorCalibration using masks?
« Reply #4 on: 2020 January 28 09:14:56 »
i guess another thing to try is to clone the image before color calibration, then do the color calilbration to the clone. then mask the original image with your mask and apply the pixelmath expression "calibrated_image" to the original image. this will copy the pixels that are unmasked from the calibrated image to the uncalibrated one. well, more precisely it copies all the pixels from the calibrated image but the mask prevents the masked pixels from being written to the target image.

if the mask isn't perfect though you might get weird effects at the edges of the trails.

rob



Offline ngc1535

  • PixInsight Old Hand
  • ****
  • Posts: 326
Re: Does ColorCalibration use masks?
« Reply #5 on: 2020 January 28 14:00:22 »
No, you got me wrong.
  • I've good a nice image (see screen shot) but it has a gradient, so applying the RangeMask feature of ColorCalibration doesn't work.
  • I clone that picture, use DBE and extract a RangeMask, so that only star trails are visible through the mask.
  • I now apply that mask to the original picture.
  • Do a ColorCalibration to the original image with the mask.
  • This also "calibrates" the masked area.

I think the short answer is no. Color Calibration is a global process by its nature and not amenable to a mask.
The method I mention above will achieve the result you are looking to get (in two steps instead of one).
-adam
So, I'd like to know, if there's a way, to apply ColorCalibration only to unmasked parts of a picture.
« Last Edit: 2020 January 28 14:11:40 by ngc1535 »

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: ColorCalibration using masks?
« Reply #6 on: 2020 January 29 03:35:19 »
Any process that can be executed on images is automatically maskable in PixInsight. The masking operation is always performed by the core application in a completely automatic (and highly optimized) way.

There are processes that remove the active mask in the target image prior to execution; for example, this happens with processes pertaining to the Geometry category that change the dimensions or orientation of the image, such as Crop, Resample, etc. Naturally, this is not the case for ColorCalibration.

So yes, you can mask the ColorCalibration process. A completely different thing is whether or not doing that makes sense. As Adam has said, it normally doesn't. But it can be done without problems from a pure data processing perspective.

To verify this, create a grayscale image with the same dimensions of the image you want to process, then apply the following PixelMath expression:

X() < 0.5

This will create a mask where the left half is white and the right half is black. Activate this mask on the image, then apply a ColorCalibration instance with parameters set so that the color change is conspicuous. You should see a clear difference between the left and right halves of the image.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline ngc1535

  • PixInsight Old Hand
  • ****
  • Posts: 326
Re: ColorCalibration using masks?
« Reply #7 on: 2020 January 29 21:09:55 »
Ah... I stand corrected. I didn't know you *could* do this...
(I just tested... yep!)
Interesting! Thanks Juan.