There is an example of a simple image processing code.
The process contains next steps:
- loading image,
- cloning it,
- performing some operations with the first copy
- and showing results on the user screen.
Project files: Rebecca-E-0.9.zip
Project dir: Rebecca-E-0.9
ImageLoaderDialog.java
…
the pipeline’s scheme:
the pipeline’s code:
package Run;
import java.awt.image.BufferedImage;
import rebecca.e9.core.*;
import rebecca.e9.pipes.*;
public class SimpleImageProcessingPipeline extends PipeLine {
public SimpleImageProcessingPipeline() {
super(“Simple image processing pipeline”);
//Load image—————————————————–
Slot bi = new Slot();
Pipe imageLoader=new ImageLoaderDialog(bi);
//Clone image—————————————————–
Slot bi1 = new Slot();
Slot bi2 = new Slot();
Pipe clone=new ImageClone(bi,bi1,bi2);
//Convert it to vector-function implemented by ObrazC3 (3 channels)
Slot c31 = new Slot();
Pipe convert2obrazC3=new Image2ObrazC3(bi1,c31);
//Do some code we provided in our “DoSomeImageOperations” pipe—
Slot c33 = new Slot();
Pipe MyTestPipe=new DoSomeImageOperations(c31,c33);
//Convert image back———————————————
Slot ib = new Slot();
Pipe C2=new Obraz2Image(c33,ib);
//Plug in user screen to see the results————————–
Pipe S=new Screen(“After”,ib);
Pipe D=new Screen(“Before”,bi2);
//Register all pipes———————————————-
this.registerPipe(imageLoader);
this.registerPipe(clone);
this.registerPipe(convert2obrazC3);
this.registerPipe(MyTestPipe);
this.registerPipe(C2);
this.registerPipe(S);
this.registerPipe(D);
}
}
image processing code:
package rebecca.e9.pipes;
import rebecca.e9.core.*;
public class DoSomeImageOperations extends Pipe {
private ObrazC3 tempO1=null;
private ObrazC3 tempO2=null;
private Slot in;
private Slot out;
public DoSomeImageOperations(Slot input,Slot output) {
super(“Image Processing…”);
if (input!=null&output!=null)
{
this.in=input;
this.out=output;
this.registerInSlot(input);
this.registerOutSlot(output);
}else{this.setDamage();}
}
public void Init() {
}
public void ShutDown() {
}
public void Execute() {
tempO2 = in.GetDATA(this);
int H=tempO2.getHeight();
int W=tempO2.getWidth();
tempO1 = new ObrazC3(H,W);
char r=0;
char g=0;
char b=0;
char w=0;
for(int i=0;i
for(int j=0;j
r=tempO2.getR(i, j);
g=tempO2.getG(i, j);
b=tempO2.getB(i, j);
tempO1.setR(i, j, 255-r);
tempO1.setG(i, j, 0);
tempO1.setB(i, j, (g+b)/2);
}}
this.out.PushDATA(tempO1, this);
}
}

