A problem with operations stack

16 views
Skip to first unread message

Yaroslav Glushchenko

unread,
Feb 1, 2012, 12:48:50 PM2/1/12
to F-Script
Hello all,
I have a strange problem with an operation stack. In fact, I'm a
newbie with F-Script and I hope it's something simple... Here is the
script:
processor := [:image|
image := hue value:#{
'image' -> image,
'angle' -> inputAngle
}.
image := gaussianBlur value:#{
'image' -> image,
'radius' -> (inputBlurPower * inputScale)
}.
^ image
].
^ processor value:inputImage

Where "hue" and "gaussianBlur" a blocks which process the image with
corresponding filters. Both "hue" and "blur" works just fine, BUT when
I apply them one-by-one to an image - I don't get both filters
applied, but the first one only. I.e. the script above applies "hue",
but not "blur". I can switch the execution order and I will get
"blur", but not "hue"!

However, I can get the proper result if I flatten the "hue" and
"gaussianBlur" blocks to the direct CIFilter code...

The question: where is the problem in the script above? How can I
apply two image-processings blocks to an image, one after another?
Any help is highly appreciated!

Regards,
Yaroslav

Philippe Mougin

unread,
Feb 8, 2012, 2:27:40 PM2/8/12
to F-Script
Hi,

In all your F-Script blocks, could you try to not using the explicit
return instruction (i.e., ^) but the implicit return (the value of the
last expression of a block is returned).
I got strange behavior with ^ on 10.7.

Thanks,

Philippe

On Feb 1, 6:48 pm, Yaroslav Glushchenko <neatberry.softw...@gmail.com>
wrote:

Philippe Mougin

unread,
Feb 8, 2012, 3:22:40 PM2/8/12
to F-Script
After further investigation, the way F-Script behave with ^ is ok
after all (phew)... but it may not be what you want to do in your code
(it seems you are using it with mere blocks, which is not what it is
made for). If you use it in your hue and gaussianBlur blocks, that
could explain the result you describe, and you should try without it
instead.
Philippe
Reply all
Reply to author
Forward
0 new messages