Prima Homepage
ImaLab
Generating C++ Modules
User Manual
The Command Shell
Running Imalab
Plugin Process
Pixels and Images
Interactive selection
Graphics: plots, profiles
Image file I/O
Image display
Connectivity Analysis
Image Processing(1)
Gaussian operators
Technical Documentation
Creating New Modules
Tutorial
Tutorial Download

[PREV][SUIV]

Pixels and Image Manipulation

Accessing Pixels

A fundamental aspect of Imalab is that it gives access to all important data structures. In this respect, the most basic data in image processing are pixels. A single pixel is accessed through the method GetPixel, defined for all image classes. The following two functions print all pixels in an imagette, which usually is more informative.

pixrect(bmp,x0,y0,w,h,[ch]) displays the pixels of an imagette of Bitmap imabe bmp. The imagette is defined by its upper left corner coordinates (x0,y0) and width/height (w,h). The optional argument ch is the channel: 1-2-3 for G-B-R. Without the channel argument, pixels are printed as gray level floating point numbers (G+B+R)/3.0.

print-rectangle(rect,bmp[,ch])prints in the same fashion pixels of a rectangle defined interactively, see the paragraph hereafter on interactive features.

vec-segment(vec,i1,12)prints the values in a segment of a vector (classes TIntVector etc.)

Interactive feature selection: points, lines, rectangles

It frequently happens that you want to study the behavior of an algorithm for a precise place in an image, trying several commands.

To facilitate this kind of work, several Imalab functions take a "geometric feature" argument which may either have the value false indicating that you want to define the feature by mouse click, or a numeric value indicating a stored feature, 0 meaning the last one.

As you may guess, geometric features defined through mouse interaction are memorized in a list (stack), and can later on be designated by their position. These lists are global Imalab variables, you may use them whenever you want: points are stored in point-list, lines in line-list, rectangles in rectangle-list.

Example: a function taking a point as argument, like lap-profile. In a first call, we give argument false to define the point with the mouse. In succeeding calls, we use the value 0 to designate this same point.


lap-profile false
lap-profile 0
...

In this documentation, any arguments named point, line, rectanglework in this way. Functions using this kind of argument, like plot-mu-plot, mu-circle, use the functions get-point, get-line, get-rectangle, resp. managing each of these features.

The function get-point gets a point. Without argument, this point is defined by a mouse-click. The point coordinates always are relative to the image, i.e. modulo sequence-width and sequence-height.


get-point()   waits for click, adds this point to point-list
get-point(n)  recovers the nth point in point-list (0 for most recent)

get-point(x,y) gives (x . y) - not used in user interaction get-point cons(x,y)

The functions get-line and get-rectangle are analogous.


get-line(false)   activates mouse, adds line to line-list
get-line(n)    fetches nth line

Of course, you may use these variables in any way you like:


p2=get-point(false);
p3=point-list[5]   // indexing a list calls list-ref
lap-profile(p3);