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 | ||||
|     angenähert um  abschließend das Bild auf diese Farben reduziert | ||||
|     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 | ||||
| AUTOR: Alexander Kimmig (a.kimmig@dhg-rw.de) | ||||
| BENUTZERHINWEISE: Die ChartDirector_s.jar muss in den BlueJ-Einstellungen | ||||
|     als externe Benutzerbibliothek eingebunden werden. | ||||
|     (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); | ||||
|     } | ||||
|      | ||||
|     /** | ||||
|      * 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 | ||||
|      */ | ||||
|  |  | |||
							
								
								
									
										36
									
								
								Window.java
								
								
								
								
							
							
						
						
									
										36
									
								
								Window.java
								
								
								
								
							|  | @ -10,7 +10,7 @@ import java.util.Collections; | |||
|  * Zeigt das Fenster an mit allen Komponenten | ||||
|  *  | ||||
|  * @author Alexander Kimmig  | ||||
|  * @version 1.0 | ||||
|  * @version 1.0.1 | ||||
|  */ | ||||
| public class Window implements ActionListener | ||||
| { | ||||
|  | @ -24,6 +24,9 @@ public class Window implements ActionListener | |||
|     private int alpha = 25; | ||||
|     private int beta = 45; | ||||
|      | ||||
|     private int size; | ||||
|     private boolean colorize; | ||||
|      | ||||
|     private JButton vl; | ||||
|     private JButton vr; | ||||
|     private JButton vu; | ||||
|  | @ -42,8 +45,11 @@ public class Window implements ActionListener | |||
|     /** | ||||
|      * 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.addWindowListener(new WindowAdapter() { | ||||
|             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)); | ||||
|          | ||||
|         drawPanel = new JPanel(); | ||||
|         drawPanel.setPreferredSize(new Dimension(1000, 1000)); | ||||
|         drawPanel.setPreferredSize(new Dimension(size, size)); | ||||
|         drawPanel.setBackground(new Color(0xFFFFFF)); | ||||
|         JPanel view = new JPanel(); | ||||
|         JPanel steps = new JPanel(); | ||||
|  | @ -130,8 +136,8 @@ public class Window implements ActionListener | |||
|         ChartViewer viewer = new ChartViewer(); | ||||
|          | ||||
|         // Einstellungen setzen
 | ||||
|         ThreeDScatterChart c = new ThreeDScatterChart(1000, 1000); | ||||
|         c.setPlotRegion(500, 480, 600, 600, 450); | ||||
|         ThreeDScatterChart c = new ThreeDScatterChart(this.size, this.size); | ||||
|         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.yAxis().setTitle("G", "Arial Bold", 10); | ||||
|         c.zAxis().setTitle("B", "Arial Bold", 10); | ||||
|  | @ -140,10 +146,23 @@ public class Window implements ActionListener | |||
|         c.zAxis().setDateScale(0, 255); | ||||
|         c.setViewAngle(alpha, beta); | ||||
|          | ||||
|         double[] x, y, z; | ||||
|         // Bildpunkte
 | ||||
|         double[] x = new double[image.size()]; | ||||
|         double[] y = new double[image.size()]; | ||||
|         double[] z = new double[image.size()]; | ||||
|         if (colorize) { | ||||
|             x = new double[1]; | ||||
|             y = new double[1]; | ||||
|             z = new double[1]; | ||||
|             for (RGB p : image) { | ||||
|                 x[0] = p.r; | ||||
|                 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; | ||||
|  | @ -151,6 +170,7 @@ public class Window implements ActionListener | |||
|             } | ||||
|             //               Koordinaten    Form        Größe  Farbe ARGB  Rahmen ARGB
 | ||||
|             c.addScatterGroup(x,y,z, "", Chart.CircleShape, 5, 0xE0FF0000, 0xFF000000); | ||||
|         } | ||||
|          | ||||
|         // Quantenpunkte
 | ||||
|         x = new double[quants.size()]; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue