v1.0.1
							parent
							
								
									3ad65fd7bb
								
							
						
					
					
						commit
						35378ef3fe
					
				|  | @ -4,9 +4,16 @@ PROJEKTZWECK: Liest ein Bild aus einer JPG-Datei ein und stellt die | ||||||
|     Anschließend werden zufallsverteilte Punkte den Originaldaten |     Anschließend werden zufallsverteilte Punkte den Originaldaten | ||||||
|     angenähert um  abschließend das Bild auf diese Farben reduziert |     angenähert um  abschließend das Bild auf diese Farben reduziert | ||||||
|     wieder abzuspeichern. |     wieder abzuspeichern. | ||||||
| VERSION oder DATUM: 1.0 (20.10.2023) | VERSION oder DATUM: 1.0.1 (26.10.2023) | ||||||
| WIE IST DAS PROJEKT ZU STARTEN: Instanz der Klasse Window anlegen | WIE IST DAS PROJEKT ZU STARTEN: Instanz der Klasse Window anlegen | ||||||
| AUTOR: Alexander Kimmig (a.kimmig@dhg-rw.de) | AUTOR: Alexander Kimmig (a.kimmig@dhg-rw.de) | ||||||
| BENUTZERHINWEISE: Die ChartDirector_s.jar muss in den BlueJ-Einstellungen | BENUTZERHINWEISE: Die ChartDirector_s.jar muss in den BlueJ-Einstellungen | ||||||
|     als externe Benutzerbibliothek eingebunden werden. |     als externe Benutzerbibliothek eingebunden werden. | ||||||
|     (Quelle: https://www.advsofteng.com/doc/cdjava.htm) |     (Quelle: https://www.advsofteng.com/doc/cdjava.htm) | ||||||
|  | 
 | ||||||
|  | CHANGELOG: | ||||||
|  | * Version 1.0.1 (26.10.2023) | ||||||
|  |     *  Möglichkeit, das Fenster in kleinerer Auflösung anzuzeigen | ||||||
|  |     *  Möglichkeit, die Punktwolke farbig anzuzeigen | ||||||
|  |        -> Achtung: sehr langsam, nur mit kleinem Bild möglich! | ||||||
|  | * Version 1.0 (20.10.2023) | ||||||
							
								
								
									
										7
									
								
								RGB.java
								
								
								
								
							
							
						
						
									
										7
									
								
								RGB.java
								
								
								
								
							|  | @ -110,6 +110,13 @@ public class RGB | ||||||
|         return (this.r << 16) + (this.g << 8) + (this.b); |         return (this.r << 16) + (this.g << 8) + (this.b); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     /** | ||||||
|  |      * Ausgabe als int mit alpha-Kanal | ||||||
|  |      */ | ||||||
|  |     public int toInt(int alpha) { | ||||||
|  |         return (alpha << 24) + (this.r << 16) + (this.g << 8) + (this.b); | ||||||
|  |     } | ||||||
|  |      | ||||||
|     /** |     /** | ||||||
|      * Setze zufällige Koordinaten |      * Setze zufällige Koordinaten | ||||||
|      */ |      */ | ||||||
|  |  | ||||||
							
								
								
									
										48
									
								
								Window.java
								
								
								
								
							
							
						
						
									
										48
									
								
								Window.java
								
								
								
								
							|  | @ -10,7 +10,7 @@ import java.util.Collections; | ||||||
|  * Zeigt das Fenster an mit allen Komponenten |  * Zeigt das Fenster an mit allen Komponenten | ||||||
|  *  |  *  | ||||||
|  * @author Alexander Kimmig  |  * @author Alexander Kimmig  | ||||||
|  * @version 1.0 |  * @version 1.0.1 | ||||||
|  */ |  */ | ||||||
| public class Window implements ActionListener | public class Window implements ActionListener | ||||||
| { | { | ||||||
|  | @ -24,6 +24,9 @@ public class Window implements ActionListener | ||||||
|     private int alpha = 25; |     private int alpha = 25; | ||||||
|     private int beta = 45; |     private int beta = 45; | ||||||
|      |      | ||||||
|  |     private int size; | ||||||
|  |     private boolean colorize; | ||||||
|  |      | ||||||
|     private JButton vl; |     private JButton vl; | ||||||
|     private JButton vr; |     private JButton vr; | ||||||
|     private JButton vu; |     private JButton vu; | ||||||
|  | @ -42,8 +45,11 @@ public class Window implements ActionListener | ||||||
|     /** |     /** | ||||||
|      * Konstruktor: legt JFrame und alle Panels/Buttons an |      * Konstruktor: legt JFrame und alle Panels/Buttons an | ||||||
|      */ |      */ | ||||||
|     public Window() |     public Window(int size, boolean colorize) | ||||||
|     { |     { | ||||||
|  |         this.size = size; | ||||||
|  |         this.colorize = colorize; | ||||||
|  |          | ||||||
|         frame = new JFrame(); |         frame = new JFrame(); | ||||||
|         frame.addWindowListener(new WindowAdapter() { |         frame.addWindowListener(new WindowAdapter() { | ||||||
|             public void windowClosing(WindowEvent e) { System.exit(0); } |             public void windowClosing(WindowEvent e) { System.exit(0); } | ||||||
|  | @ -53,7 +59,7 @@ public class Window implements ActionListener | ||||||
|         mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); |         mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); | ||||||
|          |          | ||||||
|         drawPanel = new JPanel(); |         drawPanel = new JPanel(); | ||||||
|         drawPanel.setPreferredSize(new Dimension(1000, 1000)); |         drawPanel.setPreferredSize(new Dimension(size, size)); | ||||||
|         drawPanel.setBackground(new Color(0xFFFFFF)); |         drawPanel.setBackground(new Color(0xFFFFFF)); | ||||||
|         JPanel view = new JPanel(); |         JPanel view = new JPanel(); | ||||||
|         JPanel steps = new JPanel(); |         JPanel steps = new JPanel(); | ||||||
|  | @ -130,8 +136,8 @@ public class Window implements ActionListener | ||||||
|         ChartViewer viewer = new ChartViewer(); |         ChartViewer viewer = new ChartViewer(); | ||||||
|          |          | ||||||
|         // Einstellungen setzen
 |         // Einstellungen setzen
 | ||||||
|         ThreeDScatterChart c = new ThreeDScatterChart(1000, 1000); |         ThreeDScatterChart c = new ThreeDScatterChart(this.size, this.size); | ||||||
|         c.setPlotRegion(500, 480, 600, 600, 450); |         c.setPlotRegion((int)(this.size / 2), (int)(this.size * 0.48), (int)(this.size * 0.6), (int)(this.size * 0.6), (int)(this.size * 0.45)); | ||||||
|         c.xAxis().setTitle("R", "Arial Bold", 10); |         c.xAxis().setTitle("R", "Arial Bold", 10); | ||||||
|         c.yAxis().setTitle("G", "Arial Bold", 10); |         c.yAxis().setTitle("G", "Arial Bold", 10); | ||||||
|         c.zAxis().setTitle("B", "Arial Bold", 10); |         c.zAxis().setTitle("B", "Arial Bold", 10); | ||||||
|  | @ -140,17 +146,31 @@ public class Window implements ActionListener | ||||||
|         c.zAxis().setDateScale(0, 255); |         c.zAxis().setDateScale(0, 255); | ||||||
|         c.setViewAngle(alpha, beta); |         c.setViewAngle(alpha, beta); | ||||||
|          |          | ||||||
|  |         double[] x, y, z; | ||||||
|         // Bildpunkte
 |         // Bildpunkte
 | ||||||
|         double[] x = new double[image.size()]; |         if (colorize) { | ||||||
|         double[] y = new double[image.size()]; |             x = new double[1]; | ||||||
|         double[] z = new double[image.size()]; |             y = new double[1]; | ||||||
|         for (int i = 0; i < image.size(); i++) { |             z = new double[1]; | ||||||
|             x[i] = image.get(i).r; |             for (RGB p : image) { | ||||||
|             y[i] = image.get(i).g; |                 x[0] = p.r; | ||||||
|             z[i] = image.get(i).b; |                 y[0] = p.g; | ||||||
|  |                 z[0] = p.b; | ||||||
|  |                 //               Koordinaten    Form        Größe  Farbe ARGB    Rahmen ARGB
 | ||||||
|  |                 c.addScatterGroup(x,y,z, "", Chart.CircleShape, 5, p.toInt(224), 0xFF000000); | ||||||
|  |             } | ||||||
|  |         } else { | ||||||
|  |             x = new double[image.size()]; | ||||||
|  |             y = new double[image.size()]; | ||||||
|  |             z = new double[image.size()]; | ||||||
|  |             for (int i = 0; i < image.size(); i++) { | ||||||
|  |                 x[i] = image.get(i).r; | ||||||
|  |                 y[i] = image.get(i).g; | ||||||
|  |                 z[i] = image.get(i).b; | ||||||
|  |             } | ||||||
|  |             //               Koordinaten    Form        Größe  Farbe ARGB  Rahmen ARGB
 | ||||||
|  |             c.addScatterGroup(x,y,z, "", Chart.CircleShape, 5, 0xE0FF0000, 0xFF000000); | ||||||
|         } |         } | ||||||
|         //               Koordinaten    Form        Größe  Farbe ARGB  Rahmen ARGB
 |  | ||||||
|         c.addScatterGroup(x,y,z, "", Chart.CircleShape, 5, 0xE0FF0000, 0xFF000000); |  | ||||||
|          |          | ||||||
|         // Quantenpunkte
 |         // Quantenpunkte
 | ||||||
|         x = new double[quants.size()]; |         x = new double[quants.size()]; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue