CRIMP
Check-in [04e81e77be]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added image rotation (90, 180 degree steps). Documented. Added to flip chain demo.
Timelines: family | ancestors | descendants | both | ak-experimental
Files: files | file ages | folders
SHA1: 04e81e77bedd5f85d9c62417b9dcbd9b3771a524
User & Date: andreask 2010-08-18 23:40:22.000
Context
2010-08-19
05:46
Added documentation for the binary operators (add, subtract, difference, multiply, screen, min, max), and regenerated the embedded docs check-in: 37d50a4bf3 user: andreask tags: ak-experimental
2010-08-18
23:40
Added image rotation (90, 180 degree steps). Documented. Added to flip chain demo. check-in: 04e81e77be user: andreask tags: ak-experimental
07:20
Added demo, pseudo-bandpass images via median filter check-in: a360af1032 user: andreask tags: ak-experimental
Changes
Unified Diff Ignore Whitespace Patch
Changes to crimp_tcl.tcl.
199
200
201
202
203
204
205


206
207
208
209
210
211
212
213
214
215
216
217


218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236



















237
238
239
240
241
242
243
		    return -code error "Unable to convert images of type \"$type\" to \"@\""
		}
		return [::crimp::$f $image]
	    }]
    }
} ::crimp::convert}



namespace eval ::crimp::join {
    namespace export *
    namespace ensemble create
}

::apply {{} {
    foreach fun [::crimp::List join_*] {
	proc [::crimp::P $fun] {args} [string map [list @ $fun] {
	    return [@ {*}$args]
	}]
    }
} ::crimp::join}



namespace eval ::crimp::flip {
    namespace export *
    namespace ensemble create
}

::apply {{} {
    foreach fun [::crimp::List flip_*] {
	proc [lindex [::crimp::P $fun] 0] {image} \
	    [string map [list @ [lindex [::crimp::P $fun] 0]] {
		set type [::crimp::TypeOf $image]
		set f    flip_@_$type
		if {![::crimp::Has $f]} {
		    return -code error "Unable to flip @ images of type \"$type\""
		}
		return [::crimp::$f $image]
	    }]
    }
} ::crimp::flip}




















# # ## ### ##### ######## #############

proc ::crimp::invert {image} {
    remap $image [map invers]
}








>
>












>
>



















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
		    return -code error "Unable to convert images of type \"$type\" to \"@\""
		}
		return [::crimp::$f $image]
	    }]
    }
} ::crimp::convert}

# # ## ### ##### ######## #############

namespace eval ::crimp::join {
    namespace export *
    namespace ensemble create
}

::apply {{} {
    foreach fun [::crimp::List join_*] {
	proc [::crimp::P $fun] {args} [string map [list @ $fun] {
	    return [@ {*}$args]
	}]
    }
} ::crimp::join}

# # ## ### ##### ######## #############

namespace eval ::crimp::flip {
    namespace export *
    namespace ensemble create
}

::apply {{} {
    foreach fun [::crimp::List flip_*] {
	proc [lindex [::crimp::P $fun] 0] {image} \
	    [string map [list @ [lindex [::crimp::P $fun] 0]] {
		set type [::crimp::TypeOf $image]
		set f    flip_@_$type
		if {![::crimp::Has $f]} {
		    return -code error "Unable to flip @ images of type \"$type\""
		}
		return [::crimp::$f $image]
	    }]
    }
} ::crimp::flip}

# # ## ### ##### ######## #############

namespace eval ::crimp::rotate {
    namespace export *
    namespace ensemble create
}

proc ::crimp::rotate::ccw {image} {
    return [crimp flip vertical [crimp flip transpose $image]]
}

proc ::crimp::rotate::cw {image} {
    return [crimp flip horizontal [crimp flip transpose $image]]
}

proc ::crimp::rotate::half {image} {
    return [crimp flip horizontal [crimp flip vertical $image]]
}

# # ## ### ##### ######## #############

proc ::crimp::invert {image} {
    remap $image [map invers]
}

1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
    namespace export read write convert join flip split table
    namespace export invert solarize gamma degamma remap map
    namespace export wavy psychedelia matrix blank filter crop
    namespace export alpha histogram max min screen add pixel
    namespace export subtract difference multiply pyramid
    namespace export downsample upsample decimate interpolate
    namespace export kernel expand threshold-le threshold-ge
    namespace export statistics
    #
    namespace ensemble create
}

# # ## ### ##### ######## #############
return







|






1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
    namespace export read write convert join flip split table
    namespace export invert solarize gamma degamma remap map
    namespace export wavy psychedelia matrix blank filter crop
    namespace export alpha histogram max min screen add pixel
    namespace export subtract difference multiply pyramid
    namespace export downsample upsample decimate interpolate
    namespace export kernel expand threshold-le threshold-ge
    namespace export statistics rotate
    #
    namespace ensemble create
}

# # ## ### ##### ######## #############
return
Changes to demos/flip.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19




20
21
22
23



24
25
26
27
28
29
def op_flip_vertical {
    label {Flip Chaining}
    setup {
	proc show {} {
	    variable image
	    show_image $image
	}
	proc do {args} {
	    variable image
	    set image [crimp {*}$args $image]
	    show
	    return
	}

	button .left.h  -text \u2191\u2193 -command [list [namespace current]::do flip vertical]
	button .left.v  -text \u2194       -command [list [namespace current]::do flip horizontal]
	button .left.tp -text \\           -command [list [namespace current]::do flip transpose]
	button .left.tv -text /            -command [list [namespace current]::do flip transverse]





	grid .left.h  -row 0 -column 0
	grid .left.v  -row 1 -column 0
	grid .left.tp -row 2 -column 0
	grid .left.tv -row 3 -column 0



    }
    setup_image {
	variable image [base]
	show
    }
}

|

















>
>
>
>




>
>
>






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def op_flip_vertical {
    label {Flip & Rotate}
    setup {
	proc show {} {
	    variable image
	    show_image $image
	}
	proc do {args} {
	    variable image
	    set image [crimp {*}$args $image]
	    show
	    return
	}

	button .left.h  -text \u2191\u2193 -command [list [namespace current]::do flip vertical]
	button .left.v  -text \u2194       -command [list [namespace current]::do flip horizontal]
	button .left.tp -text \\           -command [list [namespace current]::do flip transpose]
	button .left.tv -text /            -command [list [namespace current]::do flip transverse]

	button .left.rl -text 90\u00b0\ \u27f2 -command [list [namespace current]::do rotate ccw]
	button .left.rr -text 90\u00b0\ \u27f3 -command [list [namespace current]::do rotate cw]
	button .left.rh -text 180\u00b0        -command [list [namespace current]::do rotate half]

	grid .left.h  -row 0 -column 0
	grid .left.v  -row 1 -column 0
	grid .left.tp -row 2 -column 0
	grid .left.tv -row 3 -column 0
	grid .left.rl -row 4 -column 0
	grid .left.rr -row 5 -column 0
	grid .left.rh -row 6 -column 0
    }
    setup_image {
	variable image [base]
	show
    }
}
Changes to doc/crimp.man.
787
788
789
790
791
792
793











794
795
796
797
798
799
800
image as their output.  Transpose mirrors along the main diagonal,
transverse along the secondary diagonal.  These two methods also
exchange width and height of the image in the output.

[para] The methods currently support the image types [const rgb],
[const rgba], [const hsv], and [const grey8].












[list_end]


[subsection Converters]
[list_begin definitions]
[call [cmd ::crimp] [method {convert 2grey8}] [arg image]]
[call [cmd ::crimp] [method {convert 2hsv}] [arg image]]







>
>
>
>
>
>
>
>
>
>
>







787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
image as their output.  Transpose mirrors along the main diagonal,
transverse along the secondary diagonal.  These two methods also
exchange width and height of the image in the output.

[para] The methods currently support the image types [const rgb],
[const rgba], [const hsv], and [const grey8].


[call [cmd ::crimp] [method {rotate cw}]  [arg image]]
[call [cmd ::crimp] [method {rotate ccw}] [arg image]]

This set of methods rotates the image in steps of 90 degrees, either
clockwise and counter to it.

[call [cmd ::crimp] [method {rotate half}] [arg image]]

This methods rotates the image a half-turn, i.e. 180 degrees.

[list_end]


[subsection Converters]
[list_begin definitions]
[call [cmd ::crimp] [method {convert 2grey8}] [arg image]]
[call [cmd ::crimp] [method {convert 2hsv}] [arg image]]