Skip to content

Commit

Permalink
added polar and rect cod transforms
Browse files Browse the repository at this point in the history
In the filter menu
  • Loading branch information
jcupitt committed Nov 19, 2015
1 parent c593c15 commit 2cc6d01
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ started 8.2 on 4/11/15
- version bump to match vips
- fix icc_import with RGBA images
- added mapim and Image / Transform / Map
- added Filter / Coordinate Transform ... polar and rect in there

started 8.0 on 3/5/15
- version bump for vips-8.0 release
Expand Down
69 changes: 69 additions & 0 deletions share/nip2/start/Filter.def
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,75 @@ Filter_hough_item = class
}
}

Filter_coordinate_item = class
Menupullright "_Coordinate Transform" "various coordinate transforms" {
// run a function which wants a complex arg on a non-complex two-band
// image
run_cmplx fn x
= re x' ++ im x'
{
x' = fn (x?0, x?1);
}

Polar_item = class
Menuaction "_Polar" "transform to polar coordinates" {
action a = class
_result {
_vislevel = 3;

interp = Interpolate_picker Interpolate_type.BILINEAR;

_result
= map_unary to_polar a
{
to_polar im
= mapim interp.value map' im
{
// xy image, centre in the centre, scaled to fit image to
// a circle
xy = make_xy im.width im.height;
xy' = xy - Vector [im.width / 2, im.height / 2];
scale = min [im.width, im.height] / im.width;
xy'' = 2 * xy' / scale;

// to polar, and scale vertical axis to 360 degrees
map = run_cmplx polar xy'';
map' = map * Vector [1, im.height / 360];
}
}
}
}

Rectangular_item = class
Menuaction "_Rectangular" "transform to rectangular coordinates" {
action a = class
_result {
_vislevel = 3;

interp = Interpolate_picker Interpolate_type.BILINEAR;

_result
= map_unary to_rect a
{
to_rect im
= mapim interp.value map'' im
{
// xy image, vertical scaled to 360 degrees
xy = make_xy im.width im.height;
xy' = xy * Vector [1, 360 / im.height];

// to rect, scale to fit to image rect
map = run_cmplx rectangular xy';
scale = min [im.width, im.height] / im.width;
map' = map * scale / 2;

map'' = map' + Vector [im.width / 2, im.height / 2];
}
}
}
}
}

#separator

Filter_tilt_item = class
Expand Down

0 comments on commit 2cc6d01

Please sign in to comment.