A ColorFlowVectorPanel accelerated using OpenGL.
A wrapper for cogdebugger.ui.fieldvisualizations.vector.ColorFlowGL that adds a few nice features, such as a hideable color key that shows the mapping between angle and color.
A wrapper for cogdebugger.ui.fieldvisualizations.vector.ColorFlowGL that adds a few nice features, such as a hideable color key that shows the mapping between angle and color. It's expected that this is the component that'll be dropped into GUIs, rather than ColorFlowGL directly.
A visualization for VectorFields of two dimensions containing vectors of two dimensions.
A visualization for VectorFields of two dimensions containing vectors of two dimensions. Renders the field as a color image, one pixel per vector in the field, with the color hue of a pixel denoting the orientation of its corresponding vector and color saturation denoting magnitude. By default, shorter vectors appear desaturated (white), and longer vectors appear more saturated.
To speed up rendering, this visualization does not attempt to
discover or report the minimum and maximum lengths of vectors in the field.
Instead, the toolbarComponents
method provides a control that allows
users to specify a 'clip length' denoting the magnitude at which vectors
should appear maximally saturated in the visualization. Vectors longer than
this clip length are considered "out of range" and rendered as black.
Vectors shorter than this clip length will appear more and more desaturated
as their length approaches zero (how desaturated is proportional to their
distance between the clip length and zero), with vectors of length zero
rendering as pure white.
The color encoding used by this visualization is based on the encoding used in the Middlebury studies on Optical Flow. Rather than a more straightforward translation from from vector orientation to hue in an HSV color space, the Middlebury institude modified their transformation on the basis that certain colors are difficult for human eyes to differentiate. Thus, in the HSV color space, the rate at which colors appear to vary with orientation is non-linear. The Middlebury color key stretches some color transitions while compressing others in attempt to make the color space appear more linear to human vision and thus make the vector display easier to interpret.
A wrapper for cogdebugger.ui.fieldvisualizations.vector.ColorFlowGL that adds a few nice features, such as a hideable color key that shows the mapping between angle and color.
A wrapper for cogdebugger.ui.fieldvisualizations.vector.ColorFlowGL that adds a few nice features, such as a hideable color key that shows the mapping between angle and color. It's expected that this is the component that'll be dropped into GUIs, rather than ColorFlowGL directly.
Created with IntelliJ IDEA.
Created with IntelliJ IDEA. User: gonzatob Date: 9/6/12 Time: 3:46 PM
Viewer for fields of two-dimensional geometric vectors. Vectors are displayed as directed lines on a grid, whith the grid having identical dimensions to that of the field.
Cog uses a row, column coordinate system. We can think of rows and columns corresponding to y and x in a Cartesian coordinate system, but bear in mind then that row indices increase in the downward direction, and thus our y coordinate increases in the downward direction as well. Also note the order in which we present row, column coordinates: the vertical or y component comes first. For these reasons, the canonical 2D geometric vector in Cog maps to a (-y, x) ordered pair in a traditional x-increases-to-the- right and y-increased-up Cartesian space.
So, a Cog vector v = Vector(-5, 7) looks like this in Cartesian coordinates:
| v
| . .
| . .
| . .
| . .
- - - - - - - - - - 0 - - - - - - - - - -
|
|
|
|
A ColorFlowVectorPanel accelerated using OpenGL.
A ColorFlowVectorPanel accelerated using OpenGL. "ColorFlow" here is a mapping from a 2D geometric vector to a single pixel: the color of the pixel indicates the vector's direction, and saturation denotes the vector's magnitude.
The 'maxVectorLength' variable within this class controls the saturation of a pixel representing a vector. The saturation value of a pixel for a given vector is determined by dividing the vector length by maxVectorLength. 0-length vectors will make for white pixels, and vectors with lengths meeting or exceeding maxVectorLength will produce fully saturated pixels.
Implementation notes:
Cog VectorFields are stored in a planar format (as opposed to interleaved). Since OpenGL doesn't have any built-in planar image formats, we slice the VectorField into individual component planes and load each plane into a separate texture. The fragment shader can then sample a single component out of each texture, reassemble the vector, and encode it.
All the real work is done in the fragment shader. All we're rendering is a single full-screen (or rather full-canvas) quad, so there's not much to the vertex shader; it really just passes its input through the pipeline.
A wrapper for VectorFieldMemory that presents a single component slice of it as a ScalarFieldReader.
A wrapper for VectorFieldMemory that presents a single component slice of it as a ScalarFieldReader. Handy for re-using viewers that already know how to present scalar fields but don't have explicit support for vector fields.
This is perhaps dodging the Cog API too much. The last checkin that didn't use this system was revision 7386.
A display for VectorFields that breaks the vectors apart into their individual components and displays each set of components as a grayscale image - essentially, slicing each component out of the field as displaying it with a ScalarMemoryView.
A display for VectorFields that breaks the vectors apart into their individual components and displays each set of components as a grayscale image - essentially, slicing each component out of the field as displaying it with a ScalarMemoryView.
Just as a vector is a linear collection of scalars, a VectorField can be thought of as a linear collection of ScalarFields, one for each component. This visualization treats the target VectorField just so, and essentially serves to translate the vector field into a multi-layer (3D) ScalarField and view it as such.
Each individual vector component is "sliced" out of the field to create a scalar field with the same dimensions as the original vector field. That scalar field is visually represented as a grayscale image, with a single pixel per field element. The default color mapping represents the minimum value for the vector component as black, the maximum as white, and intermediate values falling on a linear gradient between those two extremes. Thus, a vector field of n dimensions will be displayed as n grayscale images. Each image annotated with a title indicating the vector component it represents as well as a color key showing which colors correspond to the minimum and maximum values for that component, as well as the value of the minimum and maximums themselves.
As a rought example, a vector field with 50 rows and 100 columns containing two-dimensional vectors would look something like this:
Component 0 Component 1 +---------------+ +---------------+ | | | | | 100x50 image | | 100x50 image | | | | | +---------------+ +---------------+ [X] = <min> [ ] = <max> [X] = <min> [ ] = <max>
A VectorField display that collects together the same-indexed components of the vectors and shows them like we do ScalarFields.
A VectorField display that collects together the same-indexed components of the vectors and shows them like we do ScalarFields.
E.g., for a vector field of vectors with three compnents, x, y, and z, all the x's will be grouped together and displayed like a single ScalarField, as will the y's and z's.
Note that this sort of visualization can be made with a bit of field slicing in the Cog model itself.
A panel for displaying vector fields that allows you to change the format of the display at runtime.
Created with IntelliJ IDEA.
Created with IntelliJ IDEA. User: gonzatob Date: 9/6/12 Time: 3:46 PM
A visualization for VectorFields that treats vector components as Cartesian components in two-dimensional space. Two components of each vector are treated as x and y and then displayed as directed lines on a grid.
For fields of three dimensions, each layer is sliced out into a separate grid. Each cell in the grid(s) renders a directed line representing a single vector. Lines originates from the center of their respective cells, and the visual length of all lines are normalized such that the longest line/vector in the field is fully contained in its cell.
Since this visual representation can only account for two components of
vectors at a time, the toolbarComponents
method will return a user
control for picking which components to treat as 'x' and 'y' if the field
contains vectors of three or more dimensions. This user control is not
provided if the field contains vectors of exactly two dimensions - in that
case, the first component is taken to be -y and the second component as x.
This is the mapping between Cog's (row, column) indexing an a conventional
Cartesian space with y increasing in the upward direction and x increasing
to the right.
A special purpose viewer for 2-D vector fields having vector lengths that are a multiple of 3.
A special purpose viewer for 2-D vector fields having vector lengths that are a multiple of 3.
If you think of the vector field as a stack of planes, one plane per vector element index, then every three planes are taken to the RGB color planes of a single image.
All values in the vector field are assumed to be on the range [0, 1]. Zero represents no intensity, and one represent maximum intensity.
E.g.
Vector element planes --> color images _______ / r / ------ /_______/ \ +---------------+ _______ \ | | / g / ------------- | color image 1 | /_______/ / | | _______ / +---------------+ / b / ------ /_______/ _______ / r / ------ /_______/ \ +---------------+ _______ \ | | / g / ------------- | color image 2 | /_______/ / | | _______ / +---------------+ / b / ------ /_______/
Created by gonztobi on 11/12/2014.
A ColorFlowVectorPanel accelerated using OpenGL. "ColorFlow" here is a mapping from a 2D geometric vector to a single pixel: the color of the pixel indicates the vector's direction, and saturation denotes the vector's magnitude.
The 'maxVectorLength' variable within this class controls the saturation of a pixel representing a vector. The saturation value of a pixel for a given vector is determined by dividing the vector length by maxVectorLength. 0-length vectors will make for white pixels, and vectors with lengths meeting or exceeding maxVectorLength will produce fully saturated pixels.
Implementation notes:
Cog VectorFields are stored in a planar format (as opposed to interleaved). Since OpenGL doesn't have any built-in planar image formats, we slice the VectorField into individual component planes and load each plane into a separate texture. The fragment shader can then sample a single component out of each texture, reassemble the vector, and encode it.
All the real work is done in the fragment shader. All we're rendering is a single full-screen (or rather full-canvas) quad, so there's not much to the vertex shader; it really just passes its input through the pipeline.