Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace lena #709

Merged
merged 27 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
30b012a
Replace "lena" with cameraman, mandrill, and peppers test images.
i-make-robots Sep 25, 2023
a144b9e
Create Filter_Difference.java
i-make-robots Sep 25, 2023
066eb0c
Create Filter_Scale.java
i-make-robots Sep 25, 2023
f553f27
Create Filter_Threshold.java
i-make-robots Sep 25, 2023
73dce88
make ImageFilter abstract
i-make-robots Sep 25, 2023
0656432
move to correct test folder
i-make-robots Sep 25, 2023
a1faf9f
update to new ImageFilter api
i-make-robots Sep 25, 2023
5118b8b
added test chicken
i-make-robots Sep 26, 2023
1a5b9b7
rename
i-make-robots Sep 26, 2023
84437d6
renamed FilterGreyscale to FilterDesaturate
i-make-robots Sep 26, 2023
ef6b079
use FilterExtendedDifferenceOfGaussians before canny edge detection.
i-make-robots Sep 26, 2023
31d6bbd
name updates
i-make-robots Sep 26, 2023
eebfd3f
Delete FilterDifferenceTest.java
i-make-robots Sep 26, 2023
ad36c91
name update
i-make-robots Sep 26, 2023
6e4f4eb
added test
i-make-robots Sep 26, 2023
495f013
Revert "Delete FilterDifferenceTest.java"
i-make-robots Sep 26, 2023
bd8ea53
undelete difference test
i-make-robots Sep 26, 2023
764100b
Update FilterDifferenceTest.java
i-make-robots Sep 26, 2023
8084866
updated NodeGraphCore to 1.0.20-SNAPSHOT
i-make-robots Sep 29, 2023
e6b0d54
clean up warnings
i-make-robots Oct 2, 2023
a7ccc89
added "center image on paper" action
i-make-robots Oct 2, 2023
34c759f
update donatello nodes
i-make-robots Oct 2, 2023
d2a112f
update dependencies and upgrade to java 21.
i-make-robots Oct 2, 2023
f89e458
update batik
i-make-robots Oct 2, 2023
1ed13b9
update dependency
i-make-robots Oct 2, 2023
bef1ecc
update missing dependency
i-make-robots Oct 2, 2023
91b3d2a
java 17, not 21.
i-make-robots Oct 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 35 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.marginallyclever</groupId>
<artifactId>Makelangelo</artifactId>
<version>7.47.0</version>
<version>7.47.1</version>
<name>Makelangelo</name>
<description>Makelangelo Software is a Java program that prepares art for CNC plotters. It is especially designed for the Makelangelo Robot.
It pairs really well with Marlin-polargraph, the code in the brain of the robot that receives instructions and moves the motors.</description>
Expand All @@ -20,7 +20,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<licenses>
<license>
<name>GPLv2</name>
<url>http://opensource.org/licenses/GPL-2.0</url>
<url>https://opensource.org/licenses/GPL-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
Expand Down Expand Up @@ -353,7 +353,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
<version>2.11.0</version>
</dependency>
<!-- https://github.com/java-native/jssc/ -->
<dependency>
Expand All @@ -365,12 +365,12 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.4.0</version>
<version>2.5.0-rc-20230523</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.4.0</version>
<version>2.5.0-rc-20230523</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
Expand All @@ -382,13 +382,13 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.14</version>
<version>4.4.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.13</version>
<version>4.5.14</version>
</dependency>
<!-- for bz2 compression -->
<dependency>
Expand All @@ -412,19 +412,19 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.10</version>
<version>1.4.7</version>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>3.1.6</version>
<version>3.1.9</version>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
<version>2.0.5</version>
</dependency>

<dependency>
Expand All @@ -447,7 +447,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>20.1.0</version>
<version>24.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-validator/commons-validator -->
<dependency>
Expand All @@ -459,7 +459,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-all</artifactId>
<version>1.16</version>
<version>1.17</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
Expand All @@ -477,44 +477,55 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<dependency>
<groupId>me.saharnooby</groupId>
<artifactId>qoi-java</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
</dependency>
<!-- Also add this, if you want to use QOI with ImageIO -->
<dependency>
<groupId>me.saharnooby</groupId>
<artifactId>qoi-java-awt</artifactId>
<version>1.2.0</version>
</dependency>

<dependency>
<groupId>com.github.marginallyclever</groupId>
<artifactId>nodegraphcore</artifactId>
<version>1.0.19</version>
<version>1.2.1</version>
</dependency>

<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>2.1</version>
<version>3.2.1</version>
</dependency>

<!-- for voronoi -->
<!-- https://mvnrepository.com/artifact/org.locationtech.jts/jts -->
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.18.2</version>
<version>1.19.0</version>
</dependency>
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.161</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.10.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.marginallyclever</groupId>
<artifactId>nodegraphcore</artifactId>
<version>1.0.21</version>
<scope>compile</scope>
</dependency>
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<minimum.maven.version>3.8.1</minimum.maven.version>
<minimum.java.version>15</minimum.java.version>
<minimum.java.version>17</minimum.java.version>
<jogl.version>2.4.0-rc-20200307</jogl.version>
<maven-dependency-plugin.ignoreNonCompile>true</maven-dependency-plugin.ignoreNonCompile>
<maven.compiler.source>${minimum.java.version}</maven.compiler.source>
<maven.compiler.target>${minimum.java.version}</maven.compiler.target>
<maven.compiler.release>${minimum.java.version}</maven.compiler.release>
</properties>
</project>
</project>
10 changes: 6 additions & 4 deletions src/main/java/com/marginallyclever/makelangelo/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,12 @@ private JMenu createToolsMenu() {
logger.debug("PiCaptureAction unavailable.");
}

TurtleModifierAction a6 = new ResizeTurtleToPaperAction(app.getPaper(),false,Translator.get("ConvertImagePaperFit"));
TurtleModifierAction a7 = new ResizeTurtleToPaperAction(app.getPaper(),true,Translator.get("ConvertImagePaperFill"));
a6.setSource(app); a6.addModifierListener(app::setTurtle); menu.add(a6);
a7.setSource(app); a7.addModifierListener(app::setTurtle); menu.add(a7);
TurtleModifierAction paperFit = new ResizeTurtleToPaperAction(app.getPaper(),false,Translator.get("ConvertImagePaperFit"));
TurtleModifierAction paperFill = new ResizeTurtleToPaperAction(app.getPaper(),true,Translator.get("ConvertImagePaperFill"));
TurtleModifierAction paperCenter = new CenterTurtleToPaperAction(Translator.get("ConvertImagePaperCenter"));
paperFit.setSource(app); paperFit.addModifierListener(app::setTurtle); menu.add(paperFit);
paperFill.setSource(app); paperFill.addModifierListener(app::setTurtle); menu.add(paperFill);
paperCenter.setSource(app); paperCenter.addModifierListener(app::setTurtle); menu.add(paperCenter);

JMenuItem translate = new JMenuItem(Translator.get("Translate"));
menu.add(translate);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.marginallyclever.makelangelo.donatelloimpl.nodes;

import com.marginallyclever.makelangelo.turtle.Turtle;
import com.marginallyclever.nodegraphcore.DockReceiving;
import com.marginallyclever.nodegraphcore.DockShipping;
import com.marginallyclever.nodegraphcore.Node;
import com.marginallyclever.nodegraphcore.NodeVariable;
import com.marginallyclever.nodegraphcore.Packet;

public class AddTurtles extends Node {
private final NodeVariable<Turtle> turtleA = NodeVariable.newInstance("A", Turtle.class, new Turtle(),true,false);
private final NodeVariable<Turtle> turtleB = NodeVariable.newInstance("B", Turtle.class, new Turtle(),true,false);
private final NodeVariable<Turtle> output = NodeVariable.newInstance("output", Turtle.class, new Turtle(),false,true);
private final DockReceiving<Turtle> turtleA = new DockReceiving<>("A", Turtle.class, new Turtle());
private final DockReceiving<Turtle> turtleB = new DockReceiving<>("B", Turtle.class, new Turtle());
private final DockShipping<Turtle> output = new DockShipping<>("output", Turtle.class, new Turtle());

public AddTurtles() {
super("AddTurtles");
Expand All @@ -17,12 +19,14 @@ public AddTurtles() {
}

@Override
public void update() throws Exception {
public void update() {
if(turtleA.hasPacketWaiting()) turtleA.receive();
if(turtleB.hasPacketWaiting()) turtleB.receive();

Turtle a = turtleA.getValue();
Turtle b = turtleB.getValue();
Turtle sum = new Turtle(a);
sum.add(b);
output.setValue(sum);
cleanAllInputs();
output.send(new Packet<>(sum));
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
package com.marginallyclever.makelangelo.donatelloimpl.nodes;

import com.marginallyclever.nodegraphcore.DockReceiving;
import com.marginallyclever.nodegraphcore.DockShipping;
import com.marginallyclever.nodegraphcore.Node;
import com.marginallyclever.nodegraphcore.NodeVariable;
import com.marginallyclever.convenience.ColorRGB;
import com.marginallyclever.makelangelo.turtle.MovementType;
import com.marginallyclever.makelangelo.turtle.Turtle;
import com.marginallyclever.makelangelo.turtle.TurtleMove;
import com.marginallyclever.nodegraphcore.Packet;

public class ColorTurtle extends Node {
private final NodeVariable<Turtle> turtle = NodeVariable.newInstance("turtle", Turtle.class,new Turtle(),true,false);
private final NodeVariable<Number> red = NodeVariable.newInstance("red",Number.class,0,true,false);
private final NodeVariable<Number> green = NodeVariable.newInstance("green",Number.class,0,true,false);
private final NodeVariable<Number> blue = NodeVariable.newInstance("blue",Number.class,0,true,false);
private final NodeVariable<Turtle> output = NodeVariable.newInstance("output", Turtle.class,new Turtle(),false,true);
private final DockReceiving<Turtle> turtle = new DockReceiving<>("turtle", Turtle.class,new Turtle());
private final DockReceiving<Number> red = new DockReceiving<>("red",Number.class,0);
private final DockReceiving<Number> green = new DockReceiving<>("green",Number.class,0);
private final DockReceiving<Number> blue = new DockReceiving<>("blue",Number.class,0);
private final DockShipping<Turtle> output = new DockShipping<>("output", Turtle.class,new Turtle());

public ColorTurtle() {
super("ColorTurtle");
Expand All @@ -24,11 +26,16 @@ public ColorTurtle() {
}

@Override
public void update() throws Exception {
public void update() {
if(turtle.hasPacketWaiting()) turtle.receive();
if(red.hasPacketWaiting()) red.receive();
if(green.hasPacketWaiting()) green.receive();
if(blue.hasPacketWaiting()) blue.receive();

Turtle input = turtle.getValue();
int r = red.getValue().intValue();
int b = blue.getValue().intValue();
int g = green.getValue().intValue();
int b = blue.getValue().intValue();
ColorRGB c = new ColorRGB(r, g, b);
Turtle moved = new Turtle();
for( TurtleMove m : input.history ) {
Expand All @@ -38,7 +45,6 @@ public void update() throws Exception {
moved.history.add(new TurtleMove(m));
}
}
output.setValue(moved);
cleanAllInputs();
output.send(new Packet<>(moved));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

import com.marginallyclever.makelangelo.makeart.io.TurtleFactory;
import com.marginallyclever.makelangelo.turtle.Turtle;
import com.marginallyclever.nodegraphcore.DockReceiving;
import com.marginallyclever.nodegraphcore.DockShipping;
import com.marginallyclever.nodegraphcore.Node;
import com.marginallyclever.nodegraphcore.NodeVariable;
import com.marginallyclever.nodegraphcore.Packet;

import java.awt.geom.Rectangle2D;

public class LoadTurtle extends Node {
private final NodeVariable<String> filename = NodeVariable.newInstance("filename",String.class,null,true,false);
private final NodeVariable<Turtle> contents = NodeVariable.newInstance("contents", Turtle.class, new Turtle(),false,true);
private final NodeVariable<Number> w = NodeVariable.newInstance("width", Number.class, 0,false,true);
private final NodeVariable<Number> h = NodeVariable.newInstance("height", Number.class, 0,false,true);
private final NodeVariable<Number> length = NodeVariable.newInstance("length", Number.class, 0,false,true);
private final DockReceiving<String> filename = new DockReceiving<>("filename",String.class,null);
private final DockShipping<Turtle> contents = new DockShipping<>("contents", Turtle.class, new Turtle());
private final DockShipping<Number> w = new DockShipping<>("width", Number.class, 0);
private final DockShipping<Number> h = new DockShipping<>("height", Number.class, 0);
private final DockShipping<Number> length = new DockShipping<>("length", Number.class, 0);


public LoadTurtle() {
Expand All @@ -24,13 +26,18 @@ public LoadTurtle() {
}

@Override
public void update() throws Exception {
Turtle t = TurtleFactory.load(filename.getValue());
contents.setValue(t);
Rectangle2D r = t.getBounds();
w.setValue(r.getWidth());
h.setValue(r.getHeight());
length.setValue(t.getDrawDistance());
cleanAllInputs();
public void update() {
if(filename.hasPacketWaiting()) filename.receive();

try {
Turtle t = TurtleFactory.load(filename.getValue());
contents.send(new Packet<>(t));
Rectangle2D r = t.getBounds();
w.send(new Packet<>(r.getWidth()));
h.send(new Packet<>(r.getHeight()));
length.send(new Packet<>(t.getDrawDistance()));
} catch (Exception e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import com.marginallyclever.convenience.*;
import com.marginallyclever.makelangelo.turtle.Turtle;
import com.marginallyclever.nodegraphcore.DockReceiving;
import com.marginallyclever.nodegraphcore.DockShipping;
import com.marginallyclever.nodegraphcore.Node;
import com.marginallyclever.nodegraphcore.NodeVariable;
import com.marginallyclever.nodegraphcore.Packet;

import java.awt.image.BufferedImage;

Expand All @@ -14,12 +16,12 @@
* @since 2022-03-08
*/
public class PathImageMask extends Node {
private final NodeVariable<BufferedImage> image = NodeVariable.newInstance("image", BufferedImage.class,new BufferedImage(1,1,BufferedImage.TYPE_INT_RGB),true,false);
private final NodeVariable<Turtle> turtle = NodeVariable.newInstance("turtle", Turtle.class,new Turtle(),true,false);
private final NodeVariable<Number> stepSize = NodeVariable.newInstance("stepSize", Number.class, 5,true,false);
private final NodeVariable<Number> threshold = NodeVariable.newInstance("threshold", Number.class, 128,true,false);
private final NodeVariable<Turtle> outputAbove = NodeVariable.newInstance("above", Turtle.class,new Turtle(),false,true);
private final NodeVariable<Turtle> outputBelow = NodeVariable.newInstance("below", Turtle.class,new Turtle(),false,true);
private final DockReceiving<BufferedImage> image = new DockReceiving<>("image", BufferedImage.class,new BufferedImage(1,1,BufferedImage.TYPE_INT_RGB));
private final DockReceiving<Turtle> turtle = new DockReceiving<>("turtle", Turtle.class,new Turtle());
private final DockReceiving<Number> stepSize = new DockReceiving<>("stepSize", Number.class, 5);
private final DockReceiving<Number> threshold = new DockReceiving<>("threshold", Number.class, 128);
private final DockShipping<Turtle> outputAbove = new DockShipping<>("above", Turtle.class,new Turtle());
private final DockShipping<Turtle> outputBelow = new DockShipping<>("below", Turtle.class,new Turtle());

private final LineCollection listAbove = new LineCollection();
private final LineCollection listBelow = new LineCollection();
Expand All @@ -35,7 +37,12 @@ public PathImageMask() {
}

@Override
public void update() throws Exception {
public void update() {
if(image.hasPacketWaiting()) image.receive();
if(turtle.hasPacketWaiting()) turtle.receive();
if(stepSize.hasPacketWaiting()) stepSize.receive();
if(threshold.hasPacketWaiting()) threshold.receive();

Turtle myTurtle = turtle.getValue();
if(myTurtle==null || myTurtle.history.isEmpty()) return;

Expand All @@ -54,13 +61,11 @@ public void update() throws Exception {

Turtle resultAbove = new Turtle();
resultAbove.addLineSegments(listAbove);
outputAbove.setValue(resultAbove);
outputAbove.send(new Packet<>(resultAbove));

Turtle resultBelow = new Turtle();
resultBelow.addLineSegments(listBelow);
outputBelow.setValue(resultBelow);

cleanAllInputs();
outputBelow.send(new Packet<>(resultBelow));
}

/**
Expand Down
Loading