NOTE: This server needs to run on the robot (similar to the
PioneerServer), otherwise you will not get the right
images
To facilitate rudimentary image processing, another AgeS server, called "CamViewServer" is provided, which in addition to the functionality of the Framegrabber interface also provides color blob information.
To get images and blob information from the camera the following steps need to be followed:
try {
//name of remote host on which the registry is running
// put in the right host name here!
String serverObjectName = "rmi://airolab2/AgeSRegistry";
//look for object in remote RMI registry
AgeSRegistry talk = (AgeSRegistry)Naming.lookup(serverObjectName);
// request a camview server; note you don't have to request a
// framegrabber server as the camview server will have done it for
// you already
CamViewServer cam=(CamViewServer)talk.requestConnection("CamView","admin","MscheutZ");
} catch (Exception e) { System.err.println("Problems connecting to servers: " + e); }
public interface FramegrabberServer extends AgeSServer {
// grabs and returns an image in JPEF format, quality specifies
// the compression rate
public byte[] getCameraPicture(int quality) throws RemoteException;
}
public interface CamViewServer extends AgeSServer {
// returns a JPEG image from the framegrabber
public byte[] getCameraPicture() throws RemoteException;
// return an image with blobs marked in bright green
public byte[] getBlobPicture() throws RemoteException;
// returns a vector of detected blobs
public Vector getBlobs() throws RemoteException;
// returns a JPEG form the framegrabber using a particular compression
public byte[] getCameraPicture(int quality) throws RemoteException;
// returns the width of the image
public int getPictureWidth() throws RemoteException;
}
public class Blob implements Serializable {
int label; // label of the blob
public int xcg; // x coordinate of the centroid
public int ycg; // y coordinate of the centroid
public int area; // area of blob
int top; // bounding rectangle of the blob
int left;
int right;
int bottom;
float alpha; // not used
float beta; // not used
float shape; // not used
int colorrange; // the color range of the blob
int rgbav; // the average of the blob color
public Blob(int l,int cr) {
label = l;
xcg = 0;
ycg = 0;
area = 0;
// invalidate boundaries
top = -1;
left = -1;
right = -1;
bottom = -1;
alpha = -1;
beta = -1;
shape = -1;
colorrange = cr;
}
}