Revision 4577
trunk/extensions/extRasterTools/text.properties | ||
---|---|---|
11 | 11 |
linf_der=Inf Der |
12 | 12 |
mtspixel=Mts/pixel |
13 | 13 |
msg_save_raster=Se va a cancelar la operaci?n. ?Desea continuar? |
14 |
onSharpening=Activar Pansharpening |
|
14 | 15 |
props=Propiedades |
15 | 16 |
no=No |
16 | 17 |
resolution=Resoluci?n |
17 | 18 |
salvar_raster=Salvar a Raster Georreferenciado. |
18 | 19 |
scale=Escala |
19 | 20 |
seleccionar=Seleccionar |
20 |
selecccionar_fichero=Seleccionar el fichero |
|
21 |
seleccionar_fichero=Seleccionar el fichero |
|
22 |
selectBandaRefinado=Seleccionar Banda de Refinado |
|
21 | 23 |
size=Tama?o |
22 | 24 |
tarea_en_progreso=Tarea En Progreso |
23 | 25 |
time=Tiempo |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/pansharpening/ui/PanSharpeningPanel.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.gvsig.rasterTools.pansharpening.ui; |
|
25 |
|
|
26 |
import java.awt.Component; |
|
27 |
import java.awt.Dimension; |
|
28 |
import java.awt.FlowLayout; |
|
29 |
import java.awt.GridBagConstraints; |
|
30 |
import java.awt.GridBagLayout; |
|
31 |
import java.awt.event.ActionEvent; |
|
32 |
import java.awt.event.ActionListener; |
|
33 |
import java.awt.event.KeyEvent; |
|
34 |
import java.awt.event.KeyListener; |
|
35 |
import java.awt.image.DataBuffer; |
|
36 |
import java.io.File; |
|
37 |
import java.util.Vector; |
|
38 |
|
|
39 |
import javax.swing.AbstractCellEditor; |
|
40 |
import javax.swing.ButtonGroup; |
|
41 |
import javax.swing.JCheckBox; |
|
42 |
import javax.swing.JPanel; |
|
43 |
import javax.swing.JRadioButton; |
|
44 |
import javax.swing.JScrollPane; |
|
45 |
import javax.swing.JSlider; |
|
46 |
import javax.swing.JTable; |
|
47 |
import javax.swing.JTextField; |
|
48 |
import javax.swing.SwingConstants; |
|
49 |
import javax.swing.SwingUtilities; |
|
50 |
import javax.swing.event.ChangeEvent; |
|
51 |
import javax.swing.event.ChangeListener; |
|
52 |
import javax.swing.event.TableModelEvent; |
|
53 |
import javax.swing.event.TableModelListener; |
|
54 |
import javax.swing.table.DefaultTableModel; |
|
55 |
import javax.swing.table.TableCellEditor; |
|
56 |
import javax.swing.table.TableCellRenderer; |
|
57 |
import javax.swing.table.TableColumn; |
|
58 |
|
|
59 |
import org.cresques.io.GeoRasterFile; |
|
60 |
import org.cresques.io.raster.IRasterOperationsRegistrablePanels; |
|
61 |
import org.cresques.io.raster.RasterFilterStackManager; |
|
62 |
import org.cresques.ui.raster.FilterRasterDialogPanel; |
|
63 |
import org.cresques.ui.raster.RasterTransparencyPanel; |
|
64 |
import org.gvsig.rasterTools.pansharpening.filter.PanSharpeningStackManager; |
|
65 |
|
|
66 |
import com.iver.andami.PluginServices; |
|
67 |
import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
|
68 |
import com.iver.cit.gvsig.gui.Panels.IRasterPropertiesRegistrable; |
|
69 |
import com.iver.cit.gvsig.gui.Panels.PropertiesRasterDialog; |
|
70 |
import com.iver.cit.gvsig.gui.toc.FLyrRasterAdjustPropertiesTocMenuEntry; |
|
71 |
|
|
72 |
/** |
|
73 |
* Selecciona las bandas visibles en un raster. Contiene una tabla con una fila por cada |
|
74 |
* banda de la imagen. Por medio de checkbox se selecciona para cada RGB que banda de la |
|
75 |
* imagen ser? visualizada. |
|
76 |
* @author Luis W. Sevilla (sevilla_lui@gva.es) |
|
77 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
78 |
*/ |
|
79 |
public class PanSharpeningPanel extends JPanel implements TableModelListener, |
|
80 |
KeyListener, ChangeListener, |
|
81 |
ActionListener, |
|
82 |
IRasterPropertiesRegistrable, |
|
83 |
IRasterOperationsRegistrablePanels{ |
|
84 |
final private static long serialVersionUID = -3370601314380922368L; |
|
85 |
|
|
86 |
private final static String[] columnNames = { " ", "Band" }; |
|
87 |
|
|
88 |
/** |
|
89 |
* Nombre del panel |
|
90 |
*/ |
|
91 |
private String nom = "Pansharp"; |
|
92 |
private JTable rgbTable = null; |
|
93 |
private JScrollPane rgbBandAssignPane = null; |
|
94 |
RGBBandAsignTableModel tableModel = null; |
|
95 |
private int sizeX = 445; |
|
96 |
private int sizeY = 174; |
|
97 |
private JPanel activationPanel = null; |
|
98 |
private JCheckBox cbActiveSharpening = null; |
|
99 |
private JPanel pSharpNorth = null; |
|
100 |
private JPanel pSharpSouth = null; |
|
101 |
private JRadioButton rbBrovey = null; |
|
102 |
private JRadioButton rbHSL = null; |
|
103 |
private JPanel pHSL = null; |
|
104 |
private JSlider jSlider = null; |
|
105 |
private JTextField jTextField = null; |
|
106 |
private JPanel pBrovey = null; |
|
107 |
private JSlider slBrovey = null; |
|
108 |
private JTextField jTextField1 = null; |
|
109 |
private PanSharpeningStackManager pStackManager = null; |
|
110 |
|
|
111 |
/** |
|
112 |
* This method initializes |
|
113 |
* |
|
114 |
*/ |
|
115 |
public PanSharpeningPanel() { |
|
116 |
super(); |
|
117 |
initialize(); |
|
118 |
this.setTranslation(); |
|
119 |
} |
|
120 |
|
|
121 |
/** |
|
122 |
* This method initializes this |
|
123 |
* |
|
124 |
* @return void |
|
125 |
*/ |
|
126 |
void initialize() { |
|
127 |
this.setPreferredSize(new Dimension(sizeX, sizeY)); |
|
128 |
this.setLayout(new FlowLayout()); |
|
129 |
this.setLocation(0, 0); |
|
130 |
this.setSize(445, 239); |
|
131 |
this.add(getPSharpNorth(), null); |
|
132 |
this.setTableEnabled(false); |
|
133 |
} |
|
134 |
|
|
135 |
/** |
|
136 |
* Obtiene el nombre del panel |
|
137 |
* @return Cadena con el nombre del panel |
|
138 |
*/ |
|
139 |
public String getName(){ |
|
140 |
return this.nom; |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* Activa o desactiva la tabla de selecci?n de banda de refinado |
|
145 |
* @param enable |
|
146 |
*/ |
|
147 |
public void setTableEnabled(boolean enabled){ |
|
148 |
this.getRGBBandAssignPane().setEnabled(enabled); |
|
149 |
this.getRGBTable().setEnabled(enabled); |
|
150 |
this.getJSlider().setEnabled(enabled); |
|
151 |
this.getJSlider1().setEnabled(enabled); |
|
152 |
this.getJTextField().setEnabled(enabled); |
|
153 |
this.getJTextField1().setEnabled(enabled); |
|
154 |
this.getRbBrovey().setEnabled(enabled); |
|
155 |
this.getRbHSL().setEnabled(enabled); |
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* Traducciones del panel |
|
160 |
*/ |
|
161 |
public void setTranslation(){ |
|
162 |
this.getCbActiveSharpening().setText(PluginServices.getText(this,"onSharpening")); |
|
163 |
this.getPSharpNorth().setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"selectBandaRefinado"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
164 |
} |
|
165 |
|
|
166 |
/** |
|
167 |
* This method initializes jTable |
|
168 |
* |
|
169 |
* @return javax.swing.JTable |
|
170 |
*/ |
|
171 |
private JScrollPane getRGBBandAssignPane() { |
|
172 |
if (rgbBandAssignPane == null) { |
|
173 |
rgbBandAssignPane = new JScrollPane(getRGBTable()); |
|
174 |
rgbBandAssignPane.setPreferredSize(new java.awt.Dimension(400,60)); |
|
175 |
rgbBandAssignPane.setEnabled(true); |
|
176 |
TableColumn column = null; |
|
177 |
|
|
178 |
for (int i = 0; i < 1; i++) { |
|
179 |
column = rgbTable.getColumnModel().getColumn(i); |
|
180 |
column.setCellRenderer(new RadioColumnRenderer()); |
|
181 |
column.setCellEditor(new RadioColumnEditor()); |
|
182 |
column.setMaxWidth(22); |
|
183 |
column.setMinWidth(22); |
|
184 |
} |
|
185 |
} |
|
186 |
return rgbBandAssignPane; |
|
187 |
} |
|
188 |
|
|
189 |
/** |
|
190 |
* Obtiene la Tabla |
|
191 |
* @return Tabla de bandas de la imagen |
|
192 |
*/ |
|
193 |
public JTable getRGBTable() { |
|
194 |
if (rgbTable == null) { |
|
195 |
tableModel = new RGBBandAsignTableModel(); |
|
196 |
tableModel.addTableModelListener(this); |
|
197 |
rgbTable = new JTable(tableModel); |
|
198 |
rgbTable.setPreferredScrollableViewportSize(new Dimension(300, 60)); |
|
199 |
} |
|
200 |
return rgbTable; |
|
201 |
} |
|
202 |
|
|
203 |
|
|
204 |
/** |
|
205 |
* A?ade una banda a la tabla bandas de la imagen asignandole un |
|
206 |
* nombre y valor a los checkbox |
|
207 |
* @param bandName Nombre de la banda |
|
208 |
*/ |
|
209 |
private void addBand(String bandName) { |
|
210 |
Vector v = new Vector(); |
|
211 |
v.add(new Boolean(false)); |
|
212 |
v.add(bandName); |
|
213 |
((DefaultTableModel) rgbTable.getModel()).addRow(v); |
|
214 |
} |
|
215 |
|
|
216 |
/** |
|
217 |
* Obtiene el n?mero de bandas de la lista |
|
218 |
* @return |
|
219 |
*/ |
|
220 |
public int getNBands() { |
|
221 |
return ((DefaultTableModel) rgbTable.getModel()).getRowCount(); |
|
222 |
} |
|
223 |
|
|
224 |
/** |
|
225 |
* Obtiene el nombre de la banda de la posici?n i de la tabla |
|
226 |
* @param i |
|
227 |
* @return |
|
228 |
*/ |
|
229 |
public String getBandName(int i) { |
|
230 |
String s = (String) ((DefaultTableModel) rgbTable.getModel()).getValueAt(i, 1); |
|
231 |
return s.substring(s.lastIndexOf("[8U]") + 5, s.length()); |
|
232 |
} |
|
233 |
|
|
234 |
/** |
|
235 |
* Selecciona una banda de la tabla. |
|
236 |
* @param i |
|
237 |
*/ |
|
238 |
public void selectRow(int i){ |
|
239 |
((DefaultTableModel) rgbTable.getModel()).setValueAt(new Boolean(true),i,0); |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 |
* Elimina todas las filas seleccionadas |
|
244 |
*/ |
|
245 |
public void removeSelections(){ |
|
246 |
for(int i=0;i<((DefaultTableModel) rgbTable.getModel()).getRowCount();i++){ |
|
247 |
((DefaultTableModel) rgbTable.getModel()).setValueAt(new Boolean(false),i,0); |
|
248 |
} |
|
249 |
} |
|
250 |
|
|
251 |
/* (non-Javadoc) |
|
252 |
* @see javax.swing.event.TableModelListener#tableChanged(javax.swing.event.TableModelEvent) |
|
253 |
*/ |
|
254 |
public void tableChanged(TableModelEvent e) { |
|
255 |
rgbTable.revalidate(); |
|
256 |
rgbBandAssignPane.revalidate(); |
|
257 |
revalidate(); |
|
258 |
} |
|
259 |
|
|
260 |
/* (non-Javadoc) |
|
261 |
* @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent) |
|
262 |
*/ |
|
263 |
public void keyPressed(KeyEvent arg0) { |
|
264 |
// TODO Auto-generated method stub |
|
265 |
} |
|
266 |
|
|
267 |
/* (non-Javadoc) |
|
268 |
* @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent) |
|
269 |
*/ |
|
270 |
public void keyReleased(KeyEvent arg0) { |
|
271 |
// TODO Auto-generated method stub |
|
272 |
} |
|
273 |
|
|
274 |
/* (non-Javadoc) |
|
275 |
* @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent) |
|
276 |
*/ |
|
277 |
public void keyTyped(KeyEvent arg0) { |
|
278 |
// TODO Auto-generated method stub |
|
279 |
} |
|
280 |
|
|
281 |
/** |
|
282 |
* |
|
283 |
*/ |
|
284 |
public void actionPerformed(ActionEvent e) { |
|
285 |
if(e.getSource() == this.cbActiveSharpening){ |
|
286 |
if(this.cbActiveSharpening.isSelected()){ |
|
287 |
this.setTableEnabled(true); |
|
288 |
}else{ |
|
289 |
this.setTableEnabled(false); |
|
290 |
} |
|
291 |
} |
|
292 |
} |
|
293 |
|
|
294 |
class RadioColumnEditor extends AbstractCellEditor |
|
295 |
implements TableCellEditor { |
|
296 |
final private static long serialVersionUID = -3370601314380922368L; |
|
297 |
public JRadioButton theRadioButton; |
|
298 |
|
|
299 |
public RadioColumnEditor() { |
|
300 |
super(); |
|
301 |
theRadioButton = new JRadioButton(); |
|
302 |
theRadioButton.addActionListener(new ActionListener() { |
|
303 |
public void actionPerformed(ActionEvent event) { |
|
304 |
fireEditingStopped(); |
|
305 |
} |
|
306 |
}); |
|
307 |
} |
|
308 |
|
|
309 |
public Component getTableCellEditorComponent(JTable table, Object obj, |
|
310 |
boolean isSelected, |
|
311 |
int row, int col) { |
|
312 |
theRadioButton.setHorizontalAlignment(SwingUtilities.CENTER); |
|
313 |
|
|
314 |
Boolean lValueAsBoolean = (Boolean) obj; |
|
315 |
theRadioButton.setSelected(lValueAsBoolean.booleanValue()); |
|
316 |
|
|
317 |
return theRadioButton; |
|
318 |
} |
|
319 |
|
|
320 |
public Object getCellEditorValue() { |
|
321 |
return new Boolean(theRadioButton.isSelected()); |
|
322 |
} |
|
323 |
} |
|
324 |
|
|
325 |
class RadioColumnRenderer extends JRadioButton implements TableCellRenderer { |
|
326 |
final private static long serialVersionUID = -3370601314380922368L; |
|
327 |
|
|
328 |
public Component getTableCellRendererComponent(JTable table, |
|
329 |
Object value, |
|
330 |
boolean isSelected, |
|
331 |
boolean hasFocus, |
|
332 |
int row, int column) { |
|
333 |
if (value == null) { |
|
334 |
this.setSelected(false); |
|
335 |
} |
|
336 |
|
|
337 |
Boolean ValueAsBoolean = (Boolean) value; |
|
338 |
this.setSelected(ValueAsBoolean.booleanValue()); |
|
339 |
this.setHorizontalAlignment(SwingConstants.CENTER); |
|
340 |
|
|
341 |
return this; |
|
342 |
} |
|
343 |
} |
|
344 |
|
|
345 |
class RGBBandAsignTableModel extends DefaultTableModel { |
|
346 |
final private static long serialVersionUID = -3370601314380922368L; |
|
347 |
|
|
348 |
public RGBBandAsignTableModel() { |
|
349 |
super(new Object[0][2], columnNames); |
|
350 |
} |
|
351 |
|
|
352 |
public Class getColumnClass(int c) { |
|
353 |
if (c < 1) { |
|
354 |
return Boolean.class; |
|
355 |
} |
|
356 |
|
|
357 |
return String.class; |
|
358 |
} |
|
359 |
|
|
360 |
public void setValueAt(Object value, int row, int col) { |
|
361 |
if ((col < 1) && ((Boolean) value).booleanValue()) { |
|
362 |
for (int i = 0; i < getRowCount(); i++) { |
|
363 |
if (i != row) { |
|
364 |
setValueAt(new Boolean(false), i, col); |
|
365 |
} |
|
366 |
} |
|
367 |
} |
|
368 |
|
|
369 |
super.setValueAt(value, row, col); |
|
370 |
} |
|
371 |
|
|
372 |
public void addNew() { |
|
373 |
super.addRow(new Object[] { |
|
374 |
new Boolean(false), "" |
|
375 |
}); |
|
376 |
} |
|
377 |
} |
|
378 |
|
|
379 |
/** |
|
380 |
* This method initializes jPanel |
|
381 |
* |
|
382 |
* @return javax.swing.JPanel |
|
383 |
*/ |
|
384 |
private JPanel getActivationPanel() { |
|
385 |
if (activationPanel == null) { |
|
386 |
FlowLayout flowLayout = new FlowLayout(); |
|
387 |
flowLayout.setAlignment(java.awt.FlowLayout.LEFT); |
|
388 |
flowLayout.setVgap(0); |
|
389 |
flowLayout.setHgap(0); |
|
390 |
activationPanel = new JPanel(); |
|
391 |
activationPanel.setLayout(flowLayout); |
|
392 |
activationPanel.setPreferredSize(new java.awt.Dimension(340,30)); |
|
393 |
activationPanel.add(getCbActiveSharpening(), null); |
|
394 |
} |
|
395 |
return activationPanel; |
|
396 |
} |
|
397 |
/** |
|
398 |
* This method initializes jCheckBox |
|
399 |
* |
|
400 |
* @return javax.swing.JCheckBox |
|
401 |
*/ |
|
402 |
public JCheckBox getCbActiveSharpening() { |
|
403 |
if (cbActiveSharpening == null) { |
|
404 |
cbActiveSharpening = new JCheckBox(); |
|
405 |
cbActiveSharpening.setText("Activar Pansharpening"); |
|
406 |
cbActiveSharpening.setPreferredSize(new java.awt.Dimension(150,23)); |
|
407 |
cbActiveSharpening.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); |
|
408 |
cbActiveSharpening.addActionListener(this); |
|
409 |
} |
|
410 |
return cbActiveSharpening; |
|
411 |
} |
|
412 |
/** |
|
413 |
* This method initializes jPanel |
|
414 |
* |
|
415 |
* @return javax.swing.JPanel |
|
416 |
*/ |
|
417 |
public JPanel getPSharpNorth() { |
|
418 |
if (pSharpNorth == null) { |
|
419 |
GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); |
|
420 |
gridBagConstraints10.gridx = 0; |
|
421 |
gridBagConstraints10.gridy = 1; |
|
422 |
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
|
423 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
|
424 |
pSharpNorth = new JPanel(); |
|
425 |
pSharpNorth.setLayout(new GridBagLayout()); |
|
426 |
pSharpNorth.setPreferredSize(new java.awt.Dimension(440,225)); |
|
427 |
pSharpNorth.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Selector de banda de refinado", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
428 |
gridBagConstraints2.gridx = 0; |
|
429 |
gridBagConstraints2.gridy = 0; |
|
430 |
gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST; |
|
431 |
gridBagConstraints2.gridwidth = 0; |
|
432 |
gridBagConstraints2.gridheight = 1; |
|
433 |
gridBagConstraints3.gridx = 0; |
|
434 |
gridBagConstraints3.gridy = 2; |
|
435 |
gridBagConstraints3.weightx = 0.0D; |
|
436 |
gridBagConstraints3.weighty = 0.0D; |
|
437 |
gridBagConstraints3.fill = java.awt.GridBagConstraints.NONE; |
|
438 |
gridBagConstraints3.ipadx = 0; |
|
439 |
gridBagConstraints3.ipady = 0; |
|
440 |
gridBagConstraints3.insets = new java.awt.Insets(0,0,0,0); |
|
441 |
gridBagConstraints3.gridheight = 0; |
|
442 |
gridBagConstraints3.gridwidth = 0; |
|
443 |
pSharpNorth.add(getActivationPanel(), gridBagConstraints2); |
|
444 |
pSharpNorth.add(getRGBBandAssignPane(), gridBagConstraints3); |
|
445 |
pSharpNorth.add(getPSharpSouth(), gridBagConstraints10); |
|
446 |
} |
|
447 |
return pSharpNorth; |
|
448 |
} |
|
449 |
|
|
450 |
private JPanel getPSharpSouth() { |
|
451 |
if (pSharpSouth == null) { |
|
452 |
GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); |
|
453 |
GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); |
|
454 |
pSharpSouth = new JPanel(); |
|
455 |
pSharpSouth.setLayout(new GridBagLayout()); |
|
456 |
pSharpSouth.setPreferredSize(new java.awt.Dimension(410,62)); |
|
457 |
gridBagConstraints9.gridy = 1; |
|
458 |
gridBagConstraints8.gridy = 0; |
|
459 |
pSharpSouth.add(getJPanel(), gridBagConstraints8); |
|
460 |
ButtonGroup group = new ButtonGroup(); |
|
461 |
group.add(getRbBrovey()); |
|
462 |
group.add(getRbHSL()); |
|
463 |
gridBagConstraints9.ipadx = 0; |
|
464 |
pSharpSouth.add(getPKernel(), gridBagConstraints9); |
|
465 |
} |
|
466 |
return pSharpSouth; |
|
467 |
} |
|
468 |
/** |
|
469 |
* This method initializes jRadioButton |
|
470 |
* |
|
471 |
* @return javax.swing.JRadioButton |
|
472 |
*/ |
|
473 |
public JRadioButton getRbBrovey() { |
|
474 |
if (rbBrovey == null) { |
|
475 |
rbBrovey = new JRadioButton(); |
|
476 |
rbBrovey.setText("Brovey"); |
|
477 |
rbBrovey.setPreferredSize(new java.awt.Dimension(70,23)); |
|
478 |
rbBrovey.setSelected(true); |
|
479 |
} |
|
480 |
return rbBrovey; |
|
481 |
} |
|
482 |
/** |
|
483 |
* This method initializes jRadioButton |
|
484 |
* |
|
485 |
* @return javax.swing.JRadioButton |
|
486 |
*/ |
|
487 |
public JRadioButton getRbHSL() { |
|
488 |
if (rbHSL == null) { |
|
489 |
rbHSL = new JRadioButton(); |
|
490 |
rbHSL.setText("HSL"); |
|
491 |
rbHSL.setPreferredSize(new java.awt.Dimension(70,23)); |
|
492 |
} |
|
493 |
return rbHSL; |
|
494 |
} |
|
495 |
/** |
|
496 |
* This method initializes jPanel |
|
497 |
* |
|
498 |
* @return javax.swing.JPanel |
|
499 |
*/ |
|
500 |
private JPanel getPKernel() { |
|
501 |
if (pHSL == null) { |
|
502 |
GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); |
|
503 |
GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); |
|
504 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
|
505 |
pHSL = new JPanel(); |
|
506 |
pHSL.setLayout(new GridBagLayout()); |
|
507 |
pHSL.setPreferredSize(new java.awt.Dimension(400,30)); |
|
508 |
gridBagConstraints5.gridx = 0; |
|
509 |
gridBagConstraints5.gridy = 0; |
|
510 |
gridBagConstraints5.insets = new java.awt.Insets(0,0,0,0); |
|
511 |
gridBagConstraints5.gridheight = 0; |
|
512 |
gridBagConstraints6.gridx = 1; |
|
513 |
gridBagConstraints6.gridwidth = 1; |
|
514 |
gridBagConstraints6.gridy = 0; |
|
515 |
gridBagConstraints6.weightx = 1.0; |
|
516 |
gridBagConstraints6.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
517 |
gridBagConstraints6.insets = new java.awt.Insets(0,0,0,0); |
|
518 |
gridBagConstraints6.gridheight = 0; |
|
519 |
gridBagConstraints7.weightx = 1.0D; |
|
520 |
gridBagConstraints7.weighty = 1.0D; |
|
521 |
gridBagConstraints7.gridwidth = 1; |
|
522 |
gridBagConstraints7.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
523 |
gridBagConstraints7.gridheight = 1; |
|
524 |
gridBagConstraints7.gridy = 0; |
|
525 |
gridBagConstraints7.gridx = 2; |
|
526 |
pHSL.add(getJTextField(), gridBagConstraints7); |
|
527 |
pHSL.add(getRbHSL(), gridBagConstraints5); |
|
528 |
pHSL.add(getJSlider(), gridBagConstraints6); |
|
529 |
this.getJSlider().setValue(0); |
|
530 |
} |
|
531 |
return pHSL; |
|
532 |
} |
|
533 |
/** |
|
534 |
* This method initializes jSlider |
|
535 |
* |
|
536 |
* @return javax.swing.JSlider |
|
537 |
*/ |
|
538 |
public JSlider getJSlider() { |
|
539 |
if (jSlider == null) { |
|
540 |
jSlider = new JSlider(); |
|
541 |
jSlider.setMinimum(0); |
|
542 |
jSlider.setPreferredSize(new java.awt.Dimension(180,16)); |
|
543 |
jSlider.setMaximum(100); |
|
544 |
jSlider.addChangeListener(this); |
|
545 |
} |
|
546 |
return jSlider; |
|
547 |
} |
|
548 |
/** |
|
549 |
* This method initializes jTextField |
|
550 |
* |
|
551 |
* @return javax.swing.JTextField |
|
552 |
*/ |
|
553 |
public JTextField getJTextField() { |
|
554 |
if (jTextField == null) { |
|
555 |
jTextField = new JTextField(); |
|
556 |
jTextField.setPreferredSize(new java.awt.Dimension(20,19)); |
|
557 |
jTextField.setText("0.0"); |
|
558 |
} |
|
559 |
return jTextField; |
|
560 |
} |
|
561 |
|
|
562 |
public void stateChanged(ChangeEvent e) { |
|
563 |
//Ponemos el valor del texto del coeficiente |
|
564 |
if (e.getSource().equals(this.getJSlider())) { |
|
565 |
this.getJTextField().setText(String.valueOf((getJSlider().getValue()/200.0))); |
|
566 |
} |
|
567 |
|
|
568 |
if (e.getSource().equals(this.getJSlider1())) { |
|
569 |
this.getJTextField1().setText(String.valueOf((getJSlider1().getValue()/2))); |
|
570 |
} |
|
571 |
|
|
572 |
} |
|
573 |
|
|
574 |
/** |
|
575 |
* This method initializes jPanel |
|
576 |
* |
|
577 |
* @return javax.swing.JPanel |
|
578 |
*/ |
|
579 |
private JPanel getJPanel() { |
|
580 |
if (pBrovey == null) { |
|
581 |
GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
|
582 |
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
583 |
gridBagConstraints11.gridx = 2; |
|
584 |
gridBagConstraints11.gridy = 0; |
|
585 |
gridBagConstraints11.weighty = 1.0D; |
|
586 |
gridBagConstraints11.weightx = 1.0; |
|
587 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
588 |
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
589 |
gridBagConstraints1.gridheight = 0; |
|
590 |
gridBagConstraints1.gridx = 1; |
|
591 |
gridBagConstraints1.gridy = 0; |
|
592 |
gridBagConstraints1.weightx = 1.0; |
|
593 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
|
594 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER; |
|
595 |
gridBagConstraints.gridy = 0; |
|
596 |
gridBagConstraints.gridheight = 0; |
|
597 |
gridBagConstraints.gridx = 0; |
|
598 |
pBrovey = new JPanel(); |
|
599 |
pBrovey.setLayout(new GridBagLayout()); |
|
600 |
pBrovey.setPreferredSize(new java.awt.Dimension(400,30)); |
|
601 |
pBrovey.add(getRbBrovey(), gridBagConstraints); |
|
602 |
pBrovey.add(getJSlider1(), gridBagConstraints1); |
|
603 |
this.getJSlider1().setValue(0); |
|
604 |
pBrovey.add(getJTextField1(), gridBagConstraints11); |
|
605 |
} |
|
606 |
return pBrovey; |
|
607 |
} |
|
608 |
|
|
609 |
/** |
|
610 |
* This method initializes jSlider1 |
|
611 |
* |
|
612 |
* @return javax.swing.JSlider |
|
613 |
*/ |
|
614 |
public JSlider getJSlider1() { |
|
615 |
if (slBrovey == null) { |
|
616 |
slBrovey = new JSlider(); |
|
617 |
slBrovey.setMaximum(100); |
|
618 |
slBrovey.setPreferredSize(new java.awt.Dimension(180,16)); |
|
619 |
slBrovey.addChangeListener(this); |
|
620 |
} |
|
621 |
return slBrovey; |
|
622 |
} |
|
623 |
|
|
624 |
/** |
|
625 |
* This method initializes jTextField1 |
|
626 |
* |
|
627 |
* @return javax.swing.JTextField |
|
628 |
*/ |
|
629 |
public JTextField getJTextField1() { |
|
630 |
if (jTextField1 == null) { |
|
631 |
jTextField1 = new JTextField(); |
|
632 |
jTextField1.setPreferredSize(new java.awt.Dimension(20,19)); |
|
633 |
jTextField1.setText("0"); |
|
634 |
} |
|
635 |
return jTextField1; |
|
636 |
} |
|
637 |
|
|
638 |
/** |
|
639 |
* Asigna el gestor del filtro de pansharpening |
|
640 |
* @param p PanSharpeningStackManager |
|
641 |
*/ |
|
642 |
public void setPanSharpeningStackManager(PanSharpeningStackManager p){ |
|
643 |
pStackManager = p; |
|
644 |
} |
|
645 |
|
|
646 |
//-------------------------------------------------------------- |
|
647 |
//IRasterPropertiesRegistrable |
|
648 |
|
|
649 |
/** |
|
650 |
* M?todo que es ejecutado desde PropertiesRasterDialog cuando se pulsa "Aceptar" |
|
651 |
* en todas los paneles que tiene a?adidos. |
|
652 |
* @param fLayer FLyrRaster |
|
653 |
* @param propsDialog PropertiesRasterDialog |
|
654 |
*/ |
|
655 |
public void actionPerformed(RasterFilterStackManager stackManager, PropertiesRasterDialog propsDialog, FLyrRaster fLayer){ |
|
656 |
PanSharpeningPanel pSharp = (PanSharpeningPanel)((FilterRasterDialogPanel)propsDialog.getContentPane()).getPanelByClassName("PanSharpeningPanel"); |
|
657 |
if(pSharp.getCbActiveSharpening().isSelected()){ |
|
658 |
String pancr = null; |
|
659 |
|
|
660 |
//Obtenemos el nombre de la banda seleccionada |
|
661 |
for(int i=0;i<(pSharp.getRGBTable()).getRowCount();i++){ |
|
662 |
if(((Boolean) (pSharp.getRGBTable()).getValueAt(i, 0)).booleanValue()) |
|
663 |
pancr = ((String) (pSharp.getRGBTable()).getValueAt(i, 1)); |
|
664 |
} |
|
665 |
|
|
666 |
//Buscamos el GeoRasterFile que corresponde a la capa y a?adimos el filtro con el |
|
667 |
if(pancr!=null){ |
|
668 |
pancr = pancr.substring(pancr.lastIndexOf("] ") + 2, pancr.length()); |
|
669 |
for(int i=0; i<fLayer.getSource().getFiles().length;i++){ |
|
670 |
if(fLayer.getSource().getFiles()[i].getName().endsWith(File.separator+pancr)){ |
|
671 |
int[] order = { propsDialog.getAssignedBand(GeoRasterFile.RED_BAND), |
|
672 |
propsDialog.getAssignedBand(GeoRasterFile.GREEN_BAND), |
|
673 |
propsDialog.getAssignedBand(GeoRasterFile.BLUE_BAND)}; |
|
674 |
|
|
675 |
RasterTransparencyPanel tpan = (RasterTransparencyPanel)((FilterRasterDialogPanel)propsDialog.getContentPane()).getPanelByClassName("RasterTransparencyPanel"); |
|
676 |
int opac = Integer.parseInt(tpan.getOpacityText().getText()); |
|
677 |
opac = (int)((opac*255)/100); |
|
678 |
|
|
679 |
String method = "brovey"; |
|
680 |
if(pSharp.getRbHSL().isSelected()) |
|
681 |
method = "hsl"; |
|
682 |
|
|
683 |
double coef = 0D; |
|
684 |
if(pSharp.getRbHSL().isSelected()) |
|
685 |
coef = Double.parseDouble(pSharp.getJTextField().getText()); |
|
686 |
|
|
687 |
int coefBrovey = 0; |
|
688 |
if(pSharp.getRbBrovey().isSelected()) |
|
689 |
coefBrovey = Integer.parseInt(pSharp.getJTextField1().getText()); |
|
690 |
|
|
691 |
pStackManager.addSharpeningFilter(fLayer.getSource().getFiles(), i, order, opac, method, coef, coefBrovey); |
|
692 |
} |
|
693 |
} |
|
694 |
} |
|
695 |
}else{ |
|
696 |
stackManager.removeFilter(stackManager.getTypeFilter("sharpening")); |
|
697 |
} |
|
698 |
fLayer.getFMap().invalidate(); |
|
699 |
} |
|
700 |
|
|
701 |
public void addTabPanel(FLyrRasterAdjustPropertiesTocMenuEntry menu) { |
|
702 |
//Este m?todo no tiene funcionalidad para el panel |
|
703 |
} |
|
704 |
|
|
705 |
public void setStackManager(RasterFilterStackManager stackManager) { |
|
706 |
//Este m?todo no tiene funcionalidad para el panel |
|
707 |
} |
|
708 |
|
|
709 |
//-------------------------------------------------------------- |
|
710 |
//IRasterOperationsRegistrablePanels |
|
711 |
|
|
712 |
/** |
|
713 |
* M?todo del interfaz IRasterOperationsRegistrablePanels |
|
714 |
* A?ade la lista de georasterfiles a la tabla |
|
715 |
* @param files lista de ficheros a a?adir |
|
716 |
*/ |
|
717 |
public void addFiles(GeoRasterFile[] files) { |
|
718 |
for (int i = 0; i < files.length; i++) { |
|
719 |
String fName = files[i].getName(); |
|
720 |
|
|
721 |
String bandName = new File(fName).getName(); |
|
722 |
String bandType = ""; |
|
723 |
|
|
724 |
switch (files[i].getDataType()) { |
|
725 |
case DataBuffer.TYPE_BYTE: |
|
726 |
bandType = "8U"; |
|
727 |
break; |
|
728 |
case DataBuffer.TYPE_INT: |
|
729 |
bandType = "32"; |
|
730 |
break; |
|
731 |
case DataBuffer.TYPE_DOUBLE: |
|
732 |
bandType = "64"; |
|
733 |
break; |
|
734 |
case DataBuffer.TYPE_FLOAT: |
|
735 |
bandType = "32"; |
|
736 |
break; |
|
737 |
case DataBuffer.TYPE_SHORT: |
|
738 |
bandType = "16"; |
|
739 |
break; |
|
740 |
case DataBuffer.TYPE_USHORT: |
|
741 |
bandType = "16U"; |
|
742 |
break; |
|
743 |
case DataBuffer.TYPE_UNDEFINED: |
|
744 |
bandType = "??"; |
|
745 |
break; |
|
746 |
} |
|
747 |
|
|
748 |
if (files[i].getBandCount() > 1) { |
|
749 |
for (int b = 0; b < files[i].getBandCount(); b++) |
|
750 |
addBand((b + 1) + " [" + bandType + "] " + bandName); |
|
751 |
} else { |
|
752 |
addBand("1 [" + bandType + "] " + bandName); |
|
753 |
} |
|
754 |
} |
|
755 |
} |
|
756 |
|
|
757 |
/** |
|
758 |
* M?todo del interfaz IRasterOperationsRegistrablePanels |
|
759 |
* Elimina un fichero de la lista |
|
760 |
* @param file Nombre del fichero a eliminar |
|
761 |
*/ |
|
762 |
public void removeFile(String file) { |
|
763 |
for (int i = 0; i < ((DefaultTableModel) rgbTable.getModel()).getRowCount(); i++) { |
|
764 |
if (((String) ((DefaultTableModel) rgbTable.getModel()).getValueAt(i, 1)).endsWith(file)) { |
|
765 |
((DefaultTableModel) rgbTable.getModel()).removeRow(i); |
|
766 |
i--; //Ojo! que hemos eliminado una fila |
|
767 |
} |
|
768 |
} |
|
769 |
} |
|
770 |
|
|
771 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
0 | 772 |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/pansharpening/PanSharpeningModule.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.rasterTools.pansharpening; |
|
20 |
|
|
21 |
import org.gvsig.rasterTools.pansharpening.toc.PanSharpeningTocMenuEntry; |
|
22 |
|
|
23 |
import com.iver.andami.PluginServices; |
|
24 |
import com.iver.andami.plugins.Extension; |
|
25 |
import com.iver.cit.gvsig.gui.View; |
|
26 |
import com.iver.cit.gvsig.gui.toc.FLyrRasterAdjustPropertiesTocMenuEntry; |
|
27 |
import com.iver.cit.gvsig.gui.toc.FPopupMenu; |
|
28 |
|
|
29 |
|
|
30 |
/** |
|
31 |
* Extensi?n para el filtro de pansharpening de raster |
|
32 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
33 |
*/ |
|
34 |
public class PanSharpeningModule implements Extension { |
|
35 |
|
|
36 |
/* (non-Javadoc) |
|
37 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
38 |
*/ |
|
39 |
public void inicializar() { |
|
40 |
FLyrRasterAdjustPropertiesTocMenuEntry menu = |
|
41 |
(FLyrRasterAdjustPropertiesTocMenuEntry)FPopupMenu.getEntry("FLyrRasterAdjustPropertiesTocMenuEntry"); |
|
42 |
|
|
43 |
//La llamada al constructor hace que se registre en FilterRasterDialogPanel |
|
44 |
PanSharpeningTocMenuEntry menuEntry = new PanSharpeningTocMenuEntry(menu); |
|
45 |
} |
|
46 |
|
|
47 |
/** |
|
48 |
* Cargamos el listener y ejecutamos la herramienta de salvar a Raster. |
|
49 |
*/ |
|
50 |
public void execute(String actionCommand) { |
|
51 |
|
|
52 |
} |
|
53 |
|
|
54 |
/* (non-Javadoc) |
|
55 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
56 |
*/ |
|
57 |
public boolean isEnabled() { |
|
58 |
return true; |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* Mostramos el control si hay alguna capa cargada. |
|
63 |
*/ |
|
64 |
public boolean isVisible() { |
|
65 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager() |
|
66 |
.getActiveView(); |
|
67 |
if (f == null) |
|
68 |
return false; |
|
69 |
|
|
70 |
return (f.getClass() == View.class); |
|
71 |
} |
|
72 |
} |
|
0 | 73 |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/pansharpening/filter/PanSharpeningStackManager.java | ||
---|---|---|
1 |
package org.gvsig.rasterTools.pansharpening.filter; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
|
|
5 |
import org.cresques.io.GeoRasterFile; |
|
6 |
import org.cresques.io.raster.IStackManager; |
|
7 |
import org.cresques.io.raster.RasterBuf; |
|
8 |
import org.cresques.io.raster.RasterFilter; |
|
9 |
import org.cresques.io.raster.RasterFilterStack; |
|
10 |
import org.cresques.io.raster.RasterFilterStackManager; |
|
11 |
|
|
12 |
/** |
|
13 |
* Gestor de pila para el filtro de panshapening. |
|
14 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
15 |
* |
|
16 |
*/ |
|
17 |
public class PanSharpeningStackManager implements IStackManager{ |
|
18 |
|
|
19 |
public final static int sharpening = 5; |
|
20 |
protected RasterFilterStack filterStack = null; |
|
21 |
private GeoRasterFile[] grfList = null; |
|
22 |
private RasterFilterStackManager filterStackManager = null; |
|
23 |
|
|
24 |
public PanSharpeningStackManager(RasterFilterStackManager filterStackManager){ |
|
25 |
this.filterStackManager = filterStackManager; |
|
26 |
this.filterStack = filterStackManager.getFilterStack(); |
|
27 |
filterStackManager.addTypeFilter("sharpening", PanSharpeningStackManager.sharpening, 0); |
|
28 |
filterStackManager.register(this); |
|
29 |
} |
|
30 |
|
|
31 |
/** |
|
32 |
* A?ade un filtro ComputeMinMax |
|
33 |
* @param files Ficheros que componen la imagen |
|
34 |
* @param i Posici?n de la imagen de refinado dentro de la lista de GeoRasterFile |
|
35 |
* @param order Orden de visualizado de las bandas RGB |
|
36 |
* @param alpha Alpha aplicado a toda la imagen |
|
37 |
* @param method M?todo de calculo del refinado |
|
38 |
* @param coef Coeficiente |
|
39 |
*/ |
|
40 |
public void addSharpeningFilter(GeoRasterFile[] files, int i, int[] order, int alpha, String method, double coef, int coefBrovey) { |
|
41 |
//Si ya hay un filtro de sharpening nos lo cargamos |
|
42 |
if (filterStack.isActive(((Integer)filterStackManager.getTypeFilters().get("sharpening")).intValue())) { |
|
43 |
filterStack.removeFilter(((Integer) filterStackManager.getTypeFilters().get("sharpening")).intValue()); |
|
44 |
} |
|
45 |
|
|
46 |
RasterFilter filtro = null; |
|
47 |
|
|
48 |
switch (filterStack.getDataTypeInFilter(((Integer) filterStackManager.getTypeFilters().get("sharpening")).intValue())) { |
|
49 |
case RasterBuf.TYPE_IMAGE: |
|
50 |
filtro = new PanSharpeningImageFilter(); |
|
51 |
break; |
|
52 |
case RasterBuf.TYPE_SHORT: |
|
53 |
case RasterBuf.TYPE_USHORT: |
|
54 |
case RasterBuf.TYPE_INT: |
|
55 |
//filtro = new SharpeningShortFilter(); |
|
56 |
break; |
|
57 |
} |
|
58 |
|
|
59 |
if(filtro != null){ |
|
60 |
filtro.addParam("stats", filterStack.getStats()); |
|
61 |
filtro.addParam("pancromatica", new Integer(i)); |
|
62 |
filtro.addParam("files", files); |
|
63 |
filtro.addParam("order", order); |
|
64 |
filtro.addParam("alpha", new Integer(alpha)); |
|
65 |
filtro.addParam("method", method); |
|
66 |
filtro.addParam("coef", new Double(coef)); |
|
67 |
filtro.addParam("coefBrovey", new Integer(coefBrovey)); |
|
68 |
filterStack.addFilter(((Integer) filterStackManager.getTypeFilters().get("sharpening")).intValue(),filtro); |
|
69 |
|
|
70 |
filterStackManager.controlTypes(); |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 |
public int getType(RasterFilter rasterFilter){ |
|
75 |
if(rasterFilter instanceof PanSharpeningFilter) |
|
76 |
return PanSharpeningStackManager.sharpening; |
|
77 |
|
|
78 |
return filterStackManager.getType(rasterFilter); |
|
79 |
} |
|
80 |
|
|
81 |
public ArrayList getStringsFromStack(ArrayList filterList, RasterFilter rf){ |
|
82 |
System.out.println("... getStringsFromStack "+rf.getClass().getName()); |
|
83 |
if (rf instanceof PanSharpeningFilter) { |
|
84 |
System.out.println("... POZI"); |
|
85 |
PanSharpeningFilter sharp = ((PanSharpeningFilter) rf); |
|
86 |
filterList.add("filter.pansharpening.active=true"); |
|
87 |
filterList.add("filter.pansharpening.posPancromatica="+sharp.posPancromatica); |
|
88 |
filterList.add("filter.pansharpening.bandOrder="+sharp.bandOrder[0]+","+sharp.bandOrder[1]+","+sharp.bandOrder[2]); |
|
89 |
for(int file=0;file<sharp.files.length;file++) |
|
90 |
filterList.add("filter.pansharpening.file"+file+"="+sharp.files[file].getName()); |
|
91 |
filterList.add("filter.pansharpening.method="+sharp.method); |
|
92 |
filterList.add("filter.pansharpening.coefHSL="+sharp.coef); |
|
93 |
filterList.add("filter.pansharpening.coefBrovey="+sharp.coefBrovey); |
|
94 |
filterList.add("filter.pansharpening.alpha="+sharp.alpha); |
|
95 |
} |
|
96 |
return filterList; |
|
97 |
} |
|
98 |
|
|
99 |
public int createStackFromStrings(String fil, ArrayList filters, int filteri){ |
|
100 |
if (fil.startsWith("filter.pansharpening.active") && |
|
101 |
RasterFilterStackManager.getValue(fil).equals("true")) { |
|
102 |
filters.remove(filteri); |
|
103 |
|
|
104 |
int posPancromatica = 0; |
|
105 |
int[] bandOrder = {0, 1, 2}; |
|
106 |
ArrayList files = new ArrayList(); |
|
107 |
int alpha = 0; |
|
108 |
String method = ""; |
|
109 |
double coef = 0D; |
|
110 |
int coefBrovey = 0; |
|
111 |
|
|
112 |
for (int propFilter = 0;propFilter < filters.size();propFilter++) { |
|
113 |
String elem = (String) filters.get(propFilter); |
|
114 |
|
|
115 |
if (elem.startsWith("filter.pansharpening.posPancromatica")) { |
|
116 |
posPancromatica = Integer.parseInt(RasterFilterStackManager.getValue(elem)); |
|
117 |
filters.remove(propFilter); |
|
118 |
propFilter--; |
|
119 |
} |
|
120 |
if (elem.startsWith("filter.pansharpening.bandOrder")) { |
|
121 |
String rango = RasterFilterStackManager.getValue(elem); |
|
122 |
bandOrder[0] = Integer.parseInt(rango.substring(0, rango.indexOf(","))); |
|
123 |
bandOrder[1] = Integer.parseInt(rango.substring(rango.indexOf(",") + 1, rango.lastIndexOf(","))); |
|
124 |
bandOrder[2] = Integer.parseInt(rango.substring(rango.lastIndexOf(",") + 1, rango.length())); |
|
125 |
filters.remove(propFilter); |
|
126 |
propFilter--; |
|
127 |
} |
|
128 |
if (elem.startsWith("filter.pansharpening.file")) { |
|
129 |
files.add(RasterFilterStackManager.getValue(elem)); |
|
130 |
filters.remove(propFilter); |
|
131 |
propFilter--; |
|
132 |
} |
|
133 |
if (elem.startsWith("filter.pansharpening.alpha")) { |
|
134 |
alpha = Integer.parseInt(RasterFilterStackManager.getValue(elem)); |
|
135 |
filters.remove(propFilter); |
|
136 |
propFilter--; |
|
137 |
} |
|
138 |
if (elem.startsWith("filter.pansharpening.method")) { |
|
139 |
method = RasterFilterStackManager.getValue(elem); |
|
140 |
filters.remove(propFilter); |
|
141 |
propFilter--; |
|
142 |
} |
|
143 |
if (elem.startsWith("filter.pansharpening.coefHSL")) { |
|
144 |
coef = Double.parseDouble(RasterFilterStackManager.getValue(elem)); |
|
145 |
filters.remove(propFilter); |
|
146 |
propFilter--; |
|
147 |
} |
|
148 |
if (elem.startsWith("filter.pansharpening.coefBrovey")) { |
|
149 |
coefBrovey = Integer.parseInt(RasterFilterStackManager.getValue(elem)); |
|
150 |
//filters.remove(propFilter); |
|
151 |
//propFilter--; |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
addSharpeningFilter(this.grfList, posPancromatica, bandOrder, alpha, method, coef, coefBrovey); |
|
156 |
filteri = -1; |
|
157 |
} |
|
158 |
return filteri; |
|
159 |
} |
|
160 |
|
|
161 |
public void createStackFromStrings(ArrayList f, Integer pos) { |
|
162 |
// TODO Auto-generated method stub |
|
163 |
|
|
164 |
} |
|
165 |
|
|
166 |
public ArrayList getStringsFromStack() { |
|
167 |
// TODO Auto-generated method stub |
|
168 |
return null; |
|
169 |
} |
|
170 |
|
|
171 |
} |
|
0 | 172 |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/pansharpening/filter/PanSharpeningFilter.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.gvsig.rasterTools.pansharpening.filter; |
|
25 |
|
|
26 |
import java.awt.Image; |
|
27 |
|
|
28 |
import org.cresques.io.GeoRasterFile; |
|
29 |
import org.cresques.io.raster.RasterFilter; |
|
30 |
|
|
31 |
|
|
32 |
/** |
|
33 |
* Clase base para los filtros de sharpening en sus diferentes tipos |
|
34 |
* de datos. |
|
35 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
36 |
* |
|
37 |
*/ |
|
38 |
public abstract class PanSharpeningFilter extends RasterFilter { |
|
39 |
|
|
40 |
/** |
|
41 |
* Posici?n en la lista de GeoRasterFiles de la imagen de refinado. |
|
42 |
*/ |
|
43 |
public int posPancromatica = 0; |
|
44 |
|
|
45 |
/** |
|
46 |
* Lista de GeoRasterFiles que componen los datos de entrada |
|
47 |
*/ |
|
48 |
public GeoRasterFile[] files = null; |
|
49 |
|
|
50 |
/** |
|
51 |
* Alto de la imagen pancrom?tica |
|
52 |
*/ |
|
53 |
protected int heightPancr = 0; |
|
54 |
|
|
55 |
/** |
|
56 |
* Ancho de la imagen pancrom?tica |
|
57 |
*/ |
|
58 |
protected int widthPancr = 0; |
|
59 |
|
|
60 |
/** |
|
61 |
* Alto de las bandas multiespectrales |
|
62 |
*/ |
|
63 |
protected int heightMultiespec = 0; |
|
64 |
|
|
65 |
/** |
|
66 |
* Ancho de las bandas multiespectrales |
|
67 |
*/ |
|
68 |
protected int widthMultiespec = 0; |
|
69 |
|
|
70 |
/** |
|
71 |
* Image que corresponde a la imagen de refinado |
|
72 |
*/ |
|
73 |
protected Image imagePancr = null; |
|
74 |
|
|
75 |
/** |
|
76 |
* Image que corresponde a la imagen de entrada |
|
77 |
*/ |
|
78 |
protected Image imageMultiespec = null; |
|
79 |
|
|
80 |
/** |
|
81 |
* N?mero de bandas de la operaci?n incluido la de refinado |
|
82 |
*/ |
|
83 |
protected int nBands = 0; |
|
84 |
|
|
85 |
/** |
|
86 |
* Relaci?n entre la pancromatica y la multiespectral en X |
|
87 |
*/ |
|
88 |
protected int relX = 0; |
|
89 |
|
|
90 |
/** |
|
91 |
* Relaci?n entre la pancromatica y la multiespectral en Y |
|
92 |
*/ |
|
93 |
protected int relY = 0; |
|
94 |
|
|
95 |
/** |
|
96 |
* Vector de 3 elementos que corresponden a R, G y B respectivamente. El valor contenido |
|
97 |
* en cada uno de ellos corresponde al n?mero de banda de fichero que se visualiza en R, G y B. |
|
98 |
*/ |
|
99 |
public int[] bandOrder = null; |
|
100 |
|
|
101 |
/** |
|
102 |
* Valor de alpha aplicado a toda la imagen |
|
103 |
*/ |
|
104 |
public int alpha = 0; |
|
105 |
|
|
106 |
/** |
|
107 |
* M?todo de calculo del refinado |
|
108 |
*/ |
|
109 |
public String method = "ihs"; |
|
110 |
|
|
111 |
/** |
|
112 |
* Coeficiente |
|
113 |
*/ |
|
114 |
public double coef = 0.20; |
|
115 |
|
|
116 |
/** |
|
117 |
* Coeficiente Brovey |
|
118 |
*/ |
|
119 |
public int coefBrovey = 0; |
|
120 |
|
|
121 |
/** |
|
122 |
* Nombre de la banda pancrom?tica |
|
123 |
*/ |
|
124 |
protected String pancrName = null; |
|
125 |
|
|
126 |
/** |
|
127 |
* Constructor |
|
128 |
* |
|
129 |
*/ |
|
130 |
public PanSharpeningFilter() { |
|
131 |
super(); |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* |
|
136 |
*/ |
|
137 |
public void pre() { |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
} |
|
0 | 142 |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/pansharpening/filter/PanSharpeningImageFilter.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.gvsig.rasterTools.pansharpening.filter; |
|
25 |
|
|
26 |
import java.awt.Graphics2D; |
|
27 |
import java.awt.Image; |
|
28 |
import java.awt.image.BufferedImage; |
|
29 |
import java.awt.image.PixelGrabber; |
|
30 |
|
|
31 |
import org.cresques.geo.ViewPortData; |
|
32 |
import org.cresques.io.GeoRasterFile; |
|
33 |
import org.cresques.io.raster.ColorSpaceConversion; |
|
34 |
import org.cresques.io.raster.RasterBuf; |
|
35 |
import org.cresques.px.PxRaster; |
|
36 |
|
|
37 |
|
|
38 |
/** |
|
39 |
* Filtro de sharpening que se aplica sobre la vista. Tiene como entradas el objeto Image |
|
40 |
* con las bandas del raster visualizadas en la Vista y la banda pancrom?tica. A partir de |
|
41 |
* estas entradas genera un Image de salida como la que hay pero de resoluci?n igual a la |
|
42 |
* de la pancrom?tica. |
|
43 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
44 |
* |
|
45 |
*/ |
|
46 |
public class PanSharpeningImageFilter extends PanSharpeningFilter { |
|
47 |
|
|
48 |
//Variable que dice para cada pixel de la imagen de entrada cuantos de salida hay. |
|
49 |
private int nOutputPixelsPerInputPixel; |
|
50 |
//Vector con los desplazamientos de los pixeles de salida dentro del vector |
|
51 |
private int[] outKernel; |
|
52 |
//Kernel aplicado a la pancromatica |
|
53 |
private Kernel kernel = null; |
|
54 |
private PixelGrabber pgAct = null, pgPrev = null, pgNext = null; |
|
55 |
int[] bufferPrev = null, bufferAct = null, bufferNext = null; |
|
56 |
|
|
57 |
/** |
|
58 |
* Constructor |
|
59 |
* |
|
60 |
*/ |
|
61 |
public PanSharpeningImageFilter() { |
|
62 |
super(); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Validamos que haya alguna otra banda adem?s de la pancrom?tica y que la pancrom?tica |
|
67 |
* sea de mayor resoluci?n que las dem?s. |
|
68 |
*/ |
|
69 |
private void checkInput(){ |
|
70 |
exec = true; |
|
71 |
if(heightMultiespec >= heightPancr || widthMultiespec >= widthPancr || heightMultiespec == 0 || widthMultiespec == 0) |
|
72 |
exec = false; |
|
73 |
for(int i=0;i<files.length;i++){ |
|
74 |
if(i != posPancromatica){ |
|
75 |
if(files[i].getHeight() != heightMultiespec || files[i].getWidth() != widthMultiespec){ |
|
76 |
exec = false; |
|
77 |
break; |
|
78 |
} |
|
79 |
} |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* Carga los par?metros pasados al filtro en las variables de |
|
85 |
* instancia que corresponde, |
|
86 |
*/ |
|
87 |
private void loadParam(){ |
|
88 |
//Carga de parametros |
|
89 |
this.image = (Image) params.get("raster"); |
|
90 |
posPancromatica = ((Integer) params.get("pancromatica")).intValue(); |
|
91 |
files = (GeoRasterFile[]) params.get("files"); |
|
92 |
bandOrder = (int[]) params.get("order"); |
|
93 |
alpha = ((Integer) params.get("alpha")).intValue(); |
|
94 |
method = (String) params.get("method"); |
|
95 |
coef = ((Double) params.get("coef")).doubleValue(); |
|
96 |
coefBrovey = ((Integer) params.get("coefBrovey")).intValue(); |
|
97 |
|
|
98 |
//Asignamos el nombre de la banda pancrom?tica como par?metro para que cuando |
|
99 |
//volvamos a abrir el dialogo pueda recuperarse y seleccionarse en el cuadro |
|
100 |
pancrName = files[posPancromatica].getName().substring( |
|
101 |
files[posPancromatica].getName().lastIndexOf("/")+1, |
|
102 |
files[posPancromatica].getName().length()); |
|
103 |
this.addParam("pancrName", pancrName); |
|
104 |
|
|
105 |
height = image.getHeight(null); |
|
106 |
width = image.getWidth(null); |
|
107 |
heightPancr = files[posPancromatica].getHeight(); |
|
108 |
widthPancr = files[posPancromatica].getWidth(); |
|
109 |
for(int i=0;i<files.length;i++){ |
|
110 |
if(i != posPancromatica){ |
|
111 |
heightMultiespec = files[i].getHeight(); |
|
112 |
widthMultiespec = files[i].getWidth(); |
|
113 |
} |
|
114 |
} |
|
115 |
|
|
116 |
relX = (int)widthPancr/widthMultiespec; |
|
117 |
relY = (int)heightPancr/heightMultiespec; |
|
118 |
} |
|
119 |
|
|
120 |
/* (non-Javadoc) |
|
121 |
* @see org.cresques.io.raster.IRasterFilter#pre() |
|
122 |
*/ |
|
123 |
public void pre() { |
|
124 |
|
|
125 |
loadParam(); |
|
126 |
checkInput(); |
|
127 |
|
|
128 |
//Creamos el buffer donde se pinta la pancromatica |
|
129 |
|
|
130 |
imagePancr = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); |
|
131 |
Graphics2D graphicsPancr = (Graphics2D)imagePancr.getGraphics(); |
|
132 |
PxRaster rasterPancr = new PxRaster(files[posPancromatica], null, files[posPancromatica].getView()); |
|
133 |
|
|
134 |
rasterPancr.setBand(GeoRasterFile.RED_BAND, 0); |
|
135 |
rasterPancr.setBand(GeoRasterFile.GREEN_BAND, 1); |
|
136 |
rasterPancr.setBand(GeoRasterFile.BLUE_BAND, 2); |
|
137 |
|
|
138 |
ViewPortData vp = (ViewPortData)viewPortData.clone(); |
|
139 |
vp.zoom(extent); |
|
140 |
rasterPancr.draw(graphicsPancr, vp); |
|
141 |
rasterPancr = null; |
|
142 |
|
|
143 |
//Creamos el buffer donde se pinta la imagen de entrada |
|
144 |
|
|
145 |
imageMultiespec = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); |
|
146 |
Graphics2D graphicsMultiespec = (Graphics2D)imageMultiespec.getGraphics(); |
|
147 |
PxRaster rasterMultiespec = null; |
|
148 |
boolean first = true; |
|
149 |
for(int i = 0;i<files.length;i++){ |
|
150 |
if(first){ |
|
151 |
rasterMultiespec = new PxRaster(files[i], null, files[posPancromatica].getView()); |
|
152 |
first = false; |
|
153 |
}else |
|
154 |
rasterMultiespec.addFile(files[i].getName()); |
|
155 |
} |
|
156 |
|
|
157 |
rasterMultiespec.setBand(GeoRasterFile.RED_BAND, bandOrder[0]); |
|
158 |
rasterMultiespec.setBand(GeoRasterFile.GREEN_BAND, bandOrder[1]); |
|
159 |
rasterMultiespec.setBand(GeoRasterFile.BLUE_BAND, bandOrder[2]); |
|
160 |
|
|
161 |
rasterMultiespec.draw(graphicsMultiespec, vp); |
|
162 |
rasterMultiespec = null; |
|
163 |
|
|
164 |
super.pre(); |
|
165 |
} |
|
166 |
|
|
167 |
/** |
|
168 |
* Aplica la operaci?n de refinamiento sobre el buffer Multiespectral que contiene |
|
169 |
* el RGB que es pasado por par?metro utilizando la pancrom?tica. |
|
170 |
* @param bufferInput Buffer rgb |
|
171 |
* @param length longitud del buffer de la pancromatica utilizado |
|
172 |
* @param iLine l?nea leida de la imagen multiespectral |
|
173 |
* @return buffer con el resultado de la operaci?n |
|
174 |
*/ |
|
175 |
private int[] processBrovey(int[] bufferInput, int iLine){ |
|
176 |
double[] hsl; |
|
177 |
int[] rgb; |
|
178 |
PixelGrabber pg = null; |
|
179 |
|
|
180 |
//Longitud del buffer de salida |
|
181 |
int widthDst = width * relX; |
|
182 |
//Buffer de salida |
|
183 |
int[] bufferPancr = new int[width]; |
|
184 |
|
|
185 |
pg = new PixelGrabber(imagePancr, 0, iLine, width, 1, bufferPancr , 0, width); |
|
186 |
|
|
187 |
|
|
188 |
try { |
|
189 |
pg.grabPixels(); |
|
190 |
} catch (InterruptedException e) { |
|
191 |
e.printStackTrace(); |
|
192 |
} |
|
193 |
|
|
194 |
for(int iElem=0; iElem<width; iElem++){ |
|
195 |
int r = ((bufferInput[iElem] >> 16) & 0xff); |
|
196 |
int g = ((bufferInput[iElem] >> 8) & 0xff); |
|
197 |
int b = (bufferInput[iElem] & 0xff); |
|
198 |
byte i = (byte)((bufferPancr[iElem] >> 16) & 0xff); |
|
199 |
double scale = (3.0*(i+coefBrovey))/(r+g+b+1.0); |
|
200 |
r *= scale;g *= scale;b *= scale; |
|
201 |
bufferPancr[iElem] = ((alpha << 24) & 0xff000000) | |
|
202 |
((r << 16) & 0x00ff0000)| |
|
203 |
((g << 8) & 0x0000ff00) | |
|
204 |
(b & 0x000000ff); |
|
205 |
} |
|
206 |
return bufferPancr; |
|
207 |
|
|
208 |
} |
|
209 |
|
|
210 |
/** |
|
211 |
* Aplica la operaci?n de refinamiento sobre el buffer Multiespectral que contiene |
|
212 |
* el RGB que es pasado por par?metro utilizando la pancrom?tica. |
|
213 |
* @param bufferInput Buffer rgb |
|
214 |
* @param length longitud del buffer de la pancromatica utilizado |
|
215 |
* @param iLine l?nea leida de la imagen multiespectral |
|
216 |
* @return buffer con el resultado de la operaci?n |
|
217 |
*/ |
|
218 |
private int[] processKernel(int[] bufferInput, int iLine){ |
|
219 |
int[] bufferDst = new int[width]; |
|
220 |
|
|
221 |
if(iLine != 0){ |
|
222 |
bufferPrev = bufferAct; |
|
223 |
bufferAct = bufferNext; |
|
224 |
}else{ |
|
225 |
bufferPrev = null; |
|
226 |
bufferAct = new int[width]; |
|
227 |
pgAct = new PixelGrabber(imagePancr, 0, iLine, width, 1, bufferAct , 0, width); |
|
228 |
try { |
|
229 |
pgAct.grabPixels(); |
|
230 |
} catch (InterruptedException e) {e.printStackTrace();} |
|
231 |
} |
|
232 |
|
|
233 |
if(iLine != (height - 1)){ |
|
234 |
bufferNext = new int[width]; |
|
235 |
pgNext = new PixelGrabber(imagePancr, 0, iLine + 1, width, 1, bufferNext , 0, width); |
|
236 |
try { |
|
237 |
pgNext.grabPixels(); |
|
238 |
} catch (InterruptedException e) {e.printStackTrace();} |
|
239 |
}else |
|
240 |
bufferNext = null; |
|
241 |
|
|
242 |
|
|
243 |
for(int iElem=0; iElem<width; iElem++){ |
|
244 |
int a = ((bufferInput[iElem] >> 24) & 0xff); |
|
245 |
int r = ((bufferInput[iElem] >> 16) & 0xff); |
|
246 |
int g = ((bufferInput[iElem] >> 8) & 0xff); |
|
247 |
int b = (bufferInput[iElem] & 0xff); |
|
248 |
|
|
249 |
float[][] op = new float[3][3]; |
|
250 |
if(bufferPrev != null){ |
|
251 |
if(iElem != 0)op[0][0] = (bufferPrev[iElem - 1] & 0x000000ff); |
|
252 |
op[0][1] = (bufferPrev[iElem] & 0x000000ff); |
|
253 |
if(iElem != (width -1))op[0][2] = (bufferPrev[iElem + 1] & 0x000000ff); |
|
254 |
} |
|
255 |
if(iElem != 0)op[1][0] = (bufferAct[iElem - 1] & 0x000000ff); |
|
256 |
op[1][1] = (bufferAct[iElem] & 0x000000ff); |
|
257 |
if(iElem != (width -1))op[1][2] = (bufferAct[iElem + 1] & 0x000000ff); |
|
258 |
if(bufferNext != null){ |
|
259 |
if(iElem != 0)op[2][0] = (bufferNext[iElem - 1] & 0x000000ff); |
|
260 |
op[2][1] = (bufferNext[iElem] & 0x000000ff); |
|
261 |
if(iElem != (width -1))op[2][2] = (bufferNext[iElem + 1] & 0x000000ff); |
|
262 |
} |
|
263 |
Kernel operando = new Kernel(op); |
|
264 |
double i = kernel.kernelOperation(operando) * 0.15; |
|
265 |
r += i; |
|
266 |
g += i; |
|
267 |
b += i; |
Also available in: Unified diff