Author Topic: Bug in DBE in a Process Container  (Read 5262 times)

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Bug in DBE in a Process Container
« on: 2009 May 15 11:39:58 »
Hi,

I'm trying to automatize a post-calibration process that includes a DBE, but I have a problem that I think it is because a bug in PI:
* Open a image R1.
* Open DBE, select some points and mark the options "Correction: substraction", "replace target" and "discard background".
* Add this DBE process to a Process Container
* Iconify the DBE to the workspace
* Open a second image G1 and clone it
* Open the DBE icon and apply it to G1
* Apply the process container to G1_clone

In my opinion the result of the last two steps should be the same but it is not.

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Bug in DBE in a Process Container
« Reply #1 on: 2009 May 17 04:33:06 »
Hi Andrés,

I can't reproduce this problem here (the results of the last two steps are the same). Could I see the images and a psm file with the DBE and ProcessContainer instances you're using?

Thanks!
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Bug in DBE in a Process Container
« Reply #2 on: 2009 May 17 09:57:14 »
Hi Andrés,

I can't reproduce this problem here (the results of the last two steps are the same). Could I see the images and a psm file with the DBE and ProcessContainer instances you're using?

Thanks!


I have prepared a small test data set. For reproducing the problem you have to follow this steps:
  • Open I1.png, I2.png and TestDBE.psm
  • Select I1 and open the DBE icon
  • Drag the DBE dialog to a new Process Container
  • Close the DBE dialog
  • Clone I2
  • Apply the process container to I2
  • Select I2_clone and open the DBE icon
  • Apply the DBE to I2_clone

The result of applying a DBE with the same sample points to I2 is different if it is done directly or by a process container.

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Bug in DBE in a Process Container
« Reply #3 on: 2009 May 17 10:07:42 »
Gotta love it when someone can create a reproducible test case with a dataset measured in KB. Nice work!
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 Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Bug in DBE in a Process Container
« Reply #4 on: 2009 May 18 16:29:23 »
Hi Andrés,

Tomorrow I'll take a look at this problem. Thank you for your excellent report!
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Bug in DBE in a Process Container
« Reply #5 on: 2009 May 22 02:30:11 »
Hi Andrés,

Definitely no bug here :)

In your test case, you aren't applying the same DBE instances with and without a ProcessContainer. In the first step (when the DBE instance is applied through a container) I1's background is subtracted, since you first open the DBE icon over I1. In the second step, you select I2_clone and open the DBE icon. When you do this,  DBE recomputes all background samples over I2_clone. When you apply, I2_clone's background is subtracted.

To prove this, modify your test case as follows:

- Load I1, I2 and TestDBE.psm.
- Open ProcessContainer, reset it, and drag the DBE icon to it.
- Drag the DBE icon to I1 (do not open the icon, just drag).
- Drag the ProcessContainer to I2.

Both results are identical, as expected.

When you open the DBE interface, all background samples are automatically recalculated for the selected image. In this way you can be sure the generated background model is coherent with the working image. Now that DBE can modify images, we have opened the door to potentially confusing situations like this one :) Special care is needed to keep track of which background model is being "transported" by each DBE instance.

Thank you for your nice test example. As Sander has said, it's great when things are described so concisely and accurately.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Bug in DBE in a Process Container
« Reply #6 on: 2009 May 22 07:07:56 »
Definitely no bug here :)
It is a feature not a bug  ;)

In your test case, you aren't applying the same DBE instances with and without a ProcessContainer. In the first step (when the DBE instance is applied through a container) I1's background is subtracted, since you first open the DBE icon over I1. In the second step, you select I2_clone and open the DBE icon. When you do this,  DBE recomputes all background samples over I2_clone. When you apply, I2_clone's background is subtracted.

I insist in that this behavior is not correct. IMVHO when the DBE is applied from a ProcessContainer, the DBE should recompute the background samples the same way as when opened from the icon. Otherwise, the DBE process is not usable from a ProcessContainer: the background is extracted using samples weighted from another image.

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Bug in DBE in a Process Container
« Reply #7 on: 2009 May 23 02:14:00 »
Hi Andrés,

I think we are talking of two different things here. The DBE process by itself has no background sample generation capabilities; it is the DBE interface who carries out the task of defining and computing background samples, and it does that task through user interaction.

A DBE instance just stores a collection of samples that define a three-dimensional function (actually, three functions, each for an individual RGB channel), and knows how to interpolate them to build a background model, and --since PI 1.5-- how to apply it to correct a target image. DBE is just what it is: an interactive background modeling system.

A different question is if it would be convenient/necessary to have another process with similar interpolating/correction capabilities to DBE, but with the ability to compute samples directly from a target image. Or a modified version of DBE that would replicate some capabilities of DBE's interface into the DBE process, without requiring user interaction.

The AutomaticBackgroundExtractor (ABE) process, which was an original idea of Carlos Milovic, has been designed to perform automatic background modeling and correction. It uses a different modelization scheme (least squares fitting, as opposed to DBE's 2D splines) that has its own strong and weak points with respect to DBE (summarizing: ABE tends to be more robust and DBE is much more flexible, so DBE has the potential to be both much more and much less accurate, while ABE usually gives less surprises).
Juan Conejero
PixInsight Development Team
http://pixinsight.com/