Compare commits

..

No commits in common. "35378ef3fe991b87b46b9a1b3d0a2651a83d4c86" and "740df07be688d5930f0c8d407144be872ba90569" have entirely different histories.

3 changed files with 15 additions and 50 deletions

View File

@ -4,16 +4,9 @@ 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.1 (26.10.2023)
VERSION oder DATUM: 1.0 (20.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)

View File

@ -110,13 +110,6 @@ 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
*/

View File

@ -10,7 +10,7 @@ import java.util.Collections;
* Zeigt das Fenster an mit allen Komponenten
*
* @author Alexander Kimmig
* @version 1.0.1
* @version 1.0
*/
public class Window implements ActionListener
{
@ -24,9 +24,6 @@ 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;
@ -45,11 +42,8 @@ public class Window implements ActionListener
/**
* Konstruktor: legt JFrame und alle Panels/Buttons an
*/
public Window(int size, boolean colorize)
public Window()
{
this.size = size;
this.colorize = colorize;
frame = new JFrame();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) { System.exit(0); }
@ -59,7 +53,7 @@ public class Window implements ActionListener
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
drawPanel = new JPanel();
drawPanel.setPreferredSize(new Dimension(size, size));
drawPanel.setPreferredSize(new Dimension(1000, 1000));
drawPanel.setBackground(new Color(0xFFFFFF));
JPanel view = new JPanel();
JPanel steps = new JPanel();
@ -136,8 +130,8 @@ public class Window implements ActionListener
ChartViewer viewer = new ChartViewer();
// Einstellungen setzen
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));
ThreeDScatterChart c = new ThreeDScatterChart(1000, 1000);
c.setPlotRegion(500, 480, 600, 600, 450);
c.xAxis().setTitle("R", "Arial Bold", 10);
c.yAxis().setTitle("G", "Arial Bold", 10);
c.zAxis().setTitle("B", "Arial Bold", 10);
@ -146,31 +140,17 @@ public class Window implements ActionListener
c.zAxis().setDateScale(0, 255);
c.setViewAngle(alpha, beta);
double[] x, y, z;
// Bildpunkte
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;
z[i] = image.get(i).b;
}
// Koordinaten Form Größe Farbe ARGB Rahmen ARGB
c.addScatterGroup(x,y,z, "", Chart.CircleShape, 5, 0xE0FF0000, 0xFF000000);
double[] x = new double[image.size()];
double[] y = new double[image.size()];
double[] 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);
// Quantenpunkte
x = new double[quants.size()];
@ -233,7 +213,6 @@ public class Window implements ActionListener
if (e.getSource() == this.b_load) {
try {
this.orig = Image.readFile("./inputs/" + (String)this.s_input.getSelectedItem());
this.image = new ArrayList<>();
for (RGB p : this.orig) {
// kopiere die originalen Daten, damit die Liste später gemischt werden kann
this.image.add(p);