View Issue Details

IDProjectCategoryView StatusLast Update
0000254Siril[All Projects] Sirilpublic2018-09-27 22:06
ReportervinvinAssigned To 
PrioritylowSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product Version 
Target Version1.0.0Fixed in Version 
Summary0000254: Mosaic mode
DescriptionSee if we can reintroduce in a correct way the patch from Steffen.
TagsNo tags attached.

Activities

vinvin

2018-05-22 23:29

administrator  

mosaic-patch.diff (39,194 bytes)
Index: src/gui/siril3.glade
===================================================================
--- src/gui/siril3.glade	(Revision 1915)
+++ src/gui/siril3.glade	(Arbeitskopie)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.1 
+<!-- Generated with glade 3.20.0 
 
 Copyright (C) The free-astro development team, 2016
 
@@ -672,9 +672,6 @@
         </child>
       </object>
     </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkFileFilter" id="filefilter1">
     <patterns>
@@ -3179,9 +3176,6 @@
     <action-widgets>
       <action-widget response="0">button_bkg_extract_close</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="Median_dialog">
     <property name="width_request">300</property>
@@ -3387,9 +3381,6 @@
     <action-widgets>
       <action-widget response="0">Median_Apply</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="SCNR_dialog">
     <property name="width_request">300</property>
@@ -3549,9 +3540,6 @@
     <action-widgets>
       <action-widget response="0">SCNR_Apply</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="StatWindow">
     <property name="can_focus">False</property>
@@ -3730,9 +3718,6 @@
         </child>
       </object>
     </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="canon_fixbanding_dialog">
     <property name="width_request">300</property>
@@ -3954,9 +3939,6 @@
         </child>
       </object>
     </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="composition_dialog">
     <property name="can_focus">False</property>
@@ -4359,9 +4341,6 @@
     <action-widgets>
       <action-widget response="0">compositing_cancel</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="cosmetic_dialog">
     <property name="width_request">300</property>
@@ -4653,9 +4632,6 @@
         </child>
       </object>
     </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="crop_dialog">
     <property name="width_request">300</property>
@@ -4759,9 +4735,6 @@
     <action-widgets>
       <action-widget response="0">crop_Apply</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="data_dialog">
     <property name="width_request">330</property>
@@ -4839,9 +4812,6 @@
     <action-widgets>
       <action-widget response="0">button_data_ok</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="deconvolution_dialog">
     <property name="width_request">300</property>
@@ -5007,9 +4977,6 @@
     <action-widgets>
       <action-widget response="0">deconvolution_Apply</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="dialog1">
     <property name="can_focus">False</property>
@@ -5102,9 +5069,6 @@
     <action-widgets>
       <action-widget response="0">button4</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="dialog_FFT">
     <property name="can_focus">False</property>
@@ -5406,9 +5370,6 @@
       <action-widget response="0">button_fft_close</action-widget>
       <action-widget response="0">button_fft_apply</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="extract_channel_dialog">
     <property name="width_request">300</property>
@@ -5606,9 +5567,6 @@
       <action-widget response="0">separate_button_close</action-widget>
       <action-widget response="0">extract_channel_button_ok</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="extract_wavelets_layers_dialog">
     <property name="width_request">300</property>
@@ -5746,9 +5704,6 @@
         </child>
       </object>
     </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkWindow" id="histogram_window">
     <property name="width_request">500</property>
@@ -6506,9 +6461,6 @@
         </child>
       </object>
     </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="satu_dialog">
     <property name="width_request">300</property>
@@ -6668,9 +6620,6 @@
     <action-widgets>
       <action-widget response="0">satu_Apply</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="savepopup">
     <property name="can_focus">False</property>
@@ -7360,9 +7309,6 @@
       <action-widget response="0">button_cancelpopup</action-widget>
       <action-widget response="0">button_savepopup</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="settings_window">
     <property name="can_focus">False</property>
@@ -8862,9 +8808,6 @@
     <action-widgets>
       <action-widget response="0">close_settings_button</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="stars_list_window">
     <property name="width_request">650</property>
@@ -9363,9 +9306,6 @@
     <action-widgets>
       <action-widget response="0">button_stars_list_ok</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkDialog" id="wavelets_dialog">
     <property name="width_request">400</property>
@@ -9919,9 +9859,6 @@
         </child>
       </object>
     </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkImage" id="rotate90-cw_dark">
     <property name="visible">True</property>
@@ -10090,9 +10027,6 @@
         </child>
       </object>
     </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkAdjustment" id="stack_sighigh_adjustment">
     <property name="upper">9.9900000000000002</property>
@@ -12435,7 +12369,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">4</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
                 <child>
@@ -12447,36 +12381,39 @@
                     <property name="expand">False</property>
                     <property name="fill">False</property>
                     <property name="padding">5</property>
-                    <property name="position">5</property>
+                    <property name="position">4</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkBox" id="box5">
+                  <object class="GtkGrid">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="margin_top">2</property>
+                    <property name="margin_bottom">4</property>
+                    <property name="column_spacing">10</property>
                     <child>
                       <object class="GtkLabel" id="label31">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="halign">start</property>
                         <property name="label" translatable="yes">Choose registration method:</property>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="padding">12</property>
-                        <property name="position">0</property>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkComboBoxText" id="comboboxregmethod">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="halign">start</property>
+                        <property name="valign">center</property>
                         <signal name="changed" handler="on_comboboxregmethod_changed" swapped="no"/>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
                       </packing>
                     </child>
                     <child>
@@ -12483,83 +12420,40 @@
                       <object class="GtkLabel" id="label14">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="halign">start</property>
                         <property name="label" translatable="yes">Select registration layer:</property>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="padding">16</property>
-                        <property name="position">2</property>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkComboBoxText" id="comboboxreglayer">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Layer on which the registration is done. It can only be done on one layer at a time, so on monochrome images.
 The (*) sign appearing after the layer's name means that registration data is already available for this layer.
 When processing images, registration data is taken from the default layer if available (for RGB images: Green, else fallback to Blue then Red).</property>
-                        <property name="margin_right">4</property>
+                        <property name="halign">start</property>
+                        <property name="valign">center</property>
                         <signal name="changed" handler="on_comboboxreglayer_changed" swapped="no"/>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">3</property>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="padding">2</property>
-                    <property name="position">6</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkBox" id="box29">
-                    <property name="can_focus">False</property>
-                    <property name="spacing">5</property>
                     <child>
-                      <object class="GtkLabel" id="preproseqname_label1">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Prefix:</property>
-                        <property name="justify">center</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="padding">12</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkEntry" id="regseqname_entry">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="tooltip_text" translatable="yes">Prefix of the image names resulting from the registration.</property>
-                        <property name="max_length">10</property>
-                        <property name="width_chars">10</property>
-                        <property name="text">r_</property>
-                        <property name="caps_lock_warning">False</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
                       <object class="GtkLabel" id="GtkLabelRegAlgo">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="halign">start</property>
                         <property name="label" translatable="yes">Algorithm: </property>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
                       </packing>
                     </child>
                     <child>
@@ -12567,7 +12461,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Type of algorithm used for rotation</property>
-                        <property name="halign">end</property>
+                        <property name="halign">start</property>
                         <property name="valign">center</property>
                         <property name="active">3</property>
                         <items>
@@ -12579,10 +12473,8 @@
                         </items>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="padding">8</property>
-                        <property name="position">3</property>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
                       </packing>
                     </child>
                     <child>
@@ -12593,13 +12485,12 @@
                         <property name="receives_default">False</property>
                         <property name="tooltip_text" translatable="yes">Check this box if you want to perform the Global Star Alignment algorithm within the selected area in the reference image. If no selection are done, this option is ignored.
 WARNING: Make sure to draw a selection with a sufficient number of stars.</property>
+                        <property name="halign">start</property>
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="padding">4</property>
-                        <property name="position">4</property>
+                        <property name="left_attach">2</property>
+                        <property name="top_attach">0</property>
                       </packing>
                     </child>
                     <child>
@@ -12612,48 +12503,17 @@
 This is useful for image sequences with very small rotation angle.
 
 WARNING: no new sequence is built, registration data is stored in the original sequence.</property>
+                        <property name="halign">start</property>
                         <property name="margin_right">4</property>
                         <property name="draw_indicator">True</property>
                         <signal name="toggled" handler="on_regTranslationOnly_toggled" swapped="no"/>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="padding">4</property>
-                        <property name="position">5</property>
+                        <property name="left_attach">3</property>
+                        <property name="top_attach">0</property>
                       </packing>
                     </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="padding">2</property>
-                    <property name="position">7</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkBox" id="box4">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <child>
-                      <object class="GtkButton" id="goregister_button">
-                        <property name="label" translatable="yes">Go register</property>
-                        <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="tooltip_text" translatable="yes">Start the registration process. It will register images in the loaded sequence using the selected method and reference layer (loaded in the 'Image sequences' tab, current sequence name is at the bottom of the window too).</property>
-                        <property name="use_underline">True</property>
-                        <signal name="clicked" handler="on_seqregister_button_clicked" swapped="no"/>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="padding">16</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
                       <object class="GtkCheckButton" id="upscaleCheckButton">
                         <property name="label" translatable="yes">Simplified Drizzle</property>
                         <property name="visible">True</property>
@@ -12663,28 +12523,27 @@
 This option is adapted for under-sampled images, i.e, when the telescope focal length is too short for the pixel size. One may consider that the system is under-sampled when FWHM is smaller than 2 pixels.
 
 WARNING: the counterpart of this technic is that the amount of memory and disk space needed to create and process drizzled images is multiplied by the square of the Drizzle factor.</property>
+                        <property name="halign">start</property>
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
+                        <property name="left_attach">2</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="labelregisterinfo">
+                      <object class="GtkCheckButton" id="mosaicBorderCheckButton">
+                        <property name="label" translatable="yes">Mosaic Border</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="halign">end</property>
-                        <property name="label" translatable="yes">Load a sequence first.</property>
-                        <attributes>
-                          <attribute name="foreground" value="#bfb200000000"/>
-                        </attributes>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="tooltip_text" translatable="yes">Add a border around the reference frame in the final output images to enlarge the usable area. (Pseudo-Mosaic mode)</property>
+                        <property name="halign">start</property>
+                        <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
+                        <property name="left_attach">3</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                     <child>
@@ -12694,24 +12553,106 @@
                         <property name="receives_default">False</property>
                         <property name="tooltip_text" translatable="yes">Use this option to use the position of the star found in the previous image as new centre for the current image registration. This allows the selection area to be smaller, registration faster, and accounts for drift or images with a large number of stars.
 WARNING: enabling this option requires the registration to not be parallelized, it will run on one CPU core only.</property>
-                        <property name="halign">end</property>
+                        <property name="halign">start</property>
                         <property name="margin_right">4</property>
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="padding">16</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">3</property>
+                        <property name="left_attach">3</property>
+                        <property name="top_attach">2</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkBox" id="box4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="preproseqname_label1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Prefix:</property>
+                            <property name="justify">center</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="padding">12</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="regseqname_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="tooltip_text" translatable="yes">Prefix of the image names resulting from the registration.</property>
+                            <property name="max_length">10</property>
+                            <property name="width_chars">10</property>
+                            <property name="text">r_</property>
+                            <property name="caps_lock_warning">False</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="goregister_button">
+                        <property name="label" translatable="yes">Go register</property>
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="tooltip_text" translatable="yes">Start the registration process. It will register images in the loaded sequence using the selected method and reference layer (loaded in the 'Image sequences' tab, current sequence name is at the bottom of the window too).</property>
+                        <property name="use_underline">True</property>
+                        <signal name="clicked" handler="on_seqregister_button_clicked" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">4</property>
+                        <property name="width">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="labelregisterinfo">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="halign">end</property>
+                        <property name="label" translatable="yes">Load a sequence first.</property>
+                        <attributes>
+                          <attribute name="foreground" value="#bfb200000000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">3</property>
+                        <property name="top_attach">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="spacingLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">3</property>
+                        <property name="width">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="padding">2</property>
-                    <property name="position">8</property>
+                    <property name="fill">True</property>
+                    <property name="position">5</property>
                   </packing>
                 </child>
                 <child>
@@ -12723,7 +12664,7 @@
                     <property name="expand">False</property>
                     <property name="fill">False</property>
                     <property name="padding">5</property>
-                    <property name="position">9</property>
+                    <property name="position">6</property>
                   </packing>
                 </child>
                 <child>
@@ -12739,7 +12680,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">10</property>
+                    <property name="position">7</property>
                   </packing>
                 </child>
                 <child>
@@ -12890,7 +12831,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">12</property>
+                    <property name="position">8</property>
                   </packing>
                 </child>
                 <child>
@@ -12927,7 +12868,7 @@
                     <property name="expand">True</property>
                     <property name="fill">True</property>
                     <property name="padding">2</property>
-                    <property name="position">13</property>
+                    <property name="position">9</property>
                   </packing>
                 </child>
               </object>
@@ -13702,7 +13643,7 @@
                               <item translatable="yes">Additive with scaling</item>
                               <item translatable="yes">Multiplicative with scaling</item>
                             </items>
-			    <signal name="changed" handler="on_combonormalize_changed" swapped="no"/>
+                            <signal name="changed" handler="on_combonormalize_changed" swapped="no"/>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -14189,9 +14130,6 @@
       <action-widget response="0">confirmcancel</action-widget>
       <action-widget response="0">confirmok</action-widget>
     </action-widgets>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkAdjustment" id="upWhiteColorCalibAdj">
     <property name="upper">1</property>
@@ -14806,8 +14744,5 @@
         </child>
       </object>
     </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
 </interface>
Index: src/registration/registration.c
===================================================================
--- src/registration/registration.c	(Revision 1915)
+++ src/registration/registration.c	(Arbeitskopie)
@@ -599,6 +599,11 @@
 			ref.y *= 2.0;
 		}
 	}
+	/* enlarge the target frame size by adding some border around the
+	 * reference frame
+	 */
+	ref.x += (2 * args->borderX);
+	ref.y += (2 * args->borderY);
 
 	/* we copy com.stars to refstars in case user take a look to another image of the sequence
 	 * that would destroy com.stars
@@ -728,6 +733,11 @@
 							H.h02 *= 2.0;
 							H.h12 *= 2.0;
 						}
+
+						/* add the border shift... */
+						H.h02 += args->borderX;
+						H.h12 += args->borderY;
+
 						cvTransformImage(&fit, ref, H, args->interpolation);
 						fits_flip_top_to_bottom(&fit);
 					}
@@ -741,6 +751,21 @@
 					if (args->x2upscale && !args->translation_only) {
 						cvResizeGaussian(&fit, fit.rx * 2, fit.ry * 2, OPENCV_NEAREST);
 					}
+					/* this is the reference frame, just do a translation to
+					 * account for the added border
+					 */
+					H.h00 = 1;
+					H.h01 = 0;
+					H.h02 = args->borderX;
+					H.h10 = 0;
+					H.h11 = 1;
+					H.h12 = args->borderY;
+					H.h20 = 0;
+					H.h21 = 0;
+					H.h22 = 1;
+					if (!args->translation_only) {
+						cvTransformImage(&fit, ref, H, args->interpolation);
+					}
 				}
 
 				if (!args->translation_only) {
@@ -1127,7 +1152,7 @@
 	struct registration_args *reg_args;
 	struct registration_method *method;
 	char *msg;
-	GtkToggleButton *regall, *follow, *matchSel, *no_translate, *x2upscale;
+	GtkToggleButton *regall, *follow, *matchSel, *no_translate, *x2upscale, *mosaicBorder;
 	GtkComboBox *cbbt_layers;
 	GtkComboBoxText *ComboBoxRegInter;
 
@@ -1159,6 +1184,7 @@
 	matchSel = GTK_TOGGLE_BUTTON(lookup_widget("checkStarSelect"));
 	no_translate = GTK_TOGGLE_BUTTON(lookup_widget("regTranslationOnly"));
 	x2upscale = GTK_TOGGLE_BUTTON(lookup_widget("upscaleCheckButton"));
+	mosaicBorder = GTK_TOGGLE_BUTTON(lookup_widget("mosaicBorderCheckButton"));
 	cbbt_layers = GTK_COMBO_BOX(
 			gtk_builder_get_object(builder, "comboboxreglayer"));
 	ComboBoxRegInter = GTK_COMBO_BOX_TEXT(
@@ -1171,6 +1197,10 @@
 	reg_args->matchSelection = gtk_toggle_button_get_active(matchSel);
 	reg_args->translation_only = gtk_toggle_button_get_active(no_translate);
 	reg_args->x2upscale = gtk_toggle_button_get_active(x2upscale);
+	/* TODO: get the border values from UI */
+	int border = gtk_toggle_button_get_active(mosaicBorder) ? 1000 : 0;
+	reg_args->borderX = border;
+	reg_args->borderY = border;
 	/* getting the selected registration layer from the combo box. The value is the index
 	 * of the selected line, and they are in the same order than layers so there should be
 	 * an exact matching between the two */
Index: src/registration/registration.h
===================================================================
--- src/registration/registration.h	(Revision 1915)
+++ src/registration/registration.h	(Arbeitskopie)
@@ -25,6 +25,8 @@
 	opencv_interpolation interpolation; // type of rotation interpolation
 	gboolean translation_only;	// don't rotate images
 	gboolean x2upscale; // apply an x2 upscale for pseudo drizzle
+	int borderX; // width of the border to add around the reference frame
+	int borderY; // height of the border to add around the reference frame
 
 	/* data for generated sequence, for star alignment registration */
 	int new_total;
Index: src/stacking/stacking.c
===================================================================
--- src/stacking/stacking.c	(Revision 1915)
+++ src/stacking/stacking.c	(Arbeitskopie)
@@ -1168,6 +1168,9 @@
 			uint64_t crej[2] = {0, 0};
 	
 			for (x = 0; x < naxes[0]; ++x){
+
+				int N = 0;// N is the number of frames that contribute data to the current pixel
+
 				/* copy all images pixel values in the same row array `stack'
 				 * to optimize caching and improve readability */
 				for (frame = 0; frame < nb_frames; ++frame) {
@@ -1178,14 +1181,20 @@
 					if (shiftx && (x - shiftx >= naxes[0] || x - shiftx < 0)) {
 						/* outside bounds, images are black. We could
 						 * also set the background value instead, if available */
-						data->stack[frame] = 0;
+						// data->stack[frame] = 0;
+						/** Skip that frame! */
 					}
+					else if ( data->pix[frame][pix_idx+x-shiftx] == 0) {
+						/* HACK: assume that 0 is not actual image data but
+						 * the border added by the registration.
+						 * Skip that frame.  */
+					}
 					else {
 						double tmp;
 						switch (args->normalize) {
 						default:
 						case NO_NORM:		// no normalization (scale[frame] = 1, offset[frame] = 0, mul[frame] = 1)
-							data->stack[frame] = data->pix[frame][pix_idx+x-shiftx];
+							data->stack[N] = data->pix[frame][pix_idx+x-shiftx];
 							/* it's faster if we don't convert it to double
 							 * to make identity operations */
 							break;
@@ -1192,18 +1201,19 @@
 						case ADDITIVE:		// additive (scale[frame] = 1, mul[frame] = 1)
 						case ADDITIVE_SCALING:		// additive + scale (mul[frame] = 1)
 							tmp = (double)data->pix[frame][pix_idx+x-shiftx] * args->coeff.scale[frame];
-							data->stack[frame] = round_to_WORD(tmp - args->coeff.offset[frame]);
+							data->stack[N] = round_to_WORD(tmp - args->coeff.offset[frame]);
 							break;
 						case MULTIPLICATIVE:		// multiplicative  (scale[frame] = 1, offset[frame] = 0)
 						case MULTIPLICATIVE_SCALING:		// multiplicative + scale (offset[frame] = 0)
 							tmp = (double)data->pix[frame][pix_idx+x-shiftx] * args->coeff.scale[frame];
-							data->stack[frame] = round_to_WORD(tmp * args->coeff.mul[frame]);
+							data->stack[N] = round_to_WORD(tmp * args->coeff.mul[frame]);
 							break;
 						}
+						/** this frame contributed data, count it */
+						N++;
 					}
 				}
 
-				int N = nb_frames;// N is the number of pixels kept from the current stack
 				double median;
 				int n, j, r = 0;
 				switch (args->type_of_rejection) {
mosaic-patch.diff (39,194 bytes)

Issue History

Date Modified Username Field Change
2018-05-22 23:29 vinvin New Issue
2018-05-22 23:29 vinvin File Added: mosaic-patch.diff
2018-09-27 22:06 vinvin Target Version 0.9.10 => 1.0.0