Re: help me on image filtering
On 7/23, in comp.soft-sys.ptolemy, Paul.Shumacher wrote: Hi, I am new to Ptolemy so please forgive me if this question has been raised already. I am interested in doing various operations on 2-D images/frames. For example, using a 1-D FIR filter to smooth or find edges. I have tried the ImageSequence actor followed by MatrixToSequence or ImagePartition, but I get the following error: Conversion is not supported from ptolemy.data.IntToken '3' to the type [int]. I am using Ptolemy II 3.0. Any suggestions? Well, you could use the new JAIEdgeDetection actor to do this, there is a test at http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII3.0/ptII3.0-beta/ptolemy/actor/lib/jai/demo/test/JAIEdgeDetection.xml If you install Ptolemy II 3.0 under Windows with the built in JRE, the Java Advanced Imaging API will be included in the JRE. If you are building from source, you would need to install the Java Advanced Imaging API and rerun configure cd $PTII rm config.*; ./configure cd ptolemy/actor/lib/jai make If you start up Ptolemy II 3.0 and do File - Open URL and cut and paste the above URL in, the model will open for you. You will need to change the JAIImageReader fileOrURL path to an image on your local disk. When you run the image, edge detection will occur. The actors you refer to are part of the Vector Quantization actors in sdf/lib/vq. These actors are somewhat special purpose, see the sdf/demo/HTVQ/HTVQ.xml demo for an example use. You should be able to create a model that has ImageSequence - ImagePartition - ImageDisplay 1. ImageSequence reads in a series of images and outputs IntMatrices. If you use it, you may need to change the imageURLTemplate from /ptolemy/domains/sdf/lib/vq/data/seq/missa/missa***.qcf to ptolemy/domains/sdf/lib/vq/data/seq/missa/missa***.qcf (I fixed this in the release and development trees) 2. ImagePartition reads in IntegerMatrices, not integers, so this could be part of the problem in your example Change the partitionColumns to 88 and the partitionRows to 72 3. Add a SDFDirector and set the iterations to 100 When you run it, the ImageDisplay should pop up. You may need to mouse on the ImageDisplay actor to get it to display each frame. I think the problem you were having with ImageSequence - MatrixToSequence - ImagePartition is that ImagePartition expects an IntMatrix, not a sequence of Integers. You could do ImageSequence - MatrixToSequence - Quantizer - Round -SequenceToMatrix - ImageDisplay 1. ImageSequence needs the imageURLTemplate adjusted as per above. 2. In MatrixToSequence and SequenceToMatrix, set the rows to 144 and the columns to 176 4. Change the Quantizer to {-1.0, 40.0} to Quantize the values -Christopher Christopher Hylands Brooks [EMAIL PROTECTED] University of California Programmer/Analyst Chess/Ptolemy/GSRC US Mail: 558 Cory Hall #1770 ph: 510.643.9841 fax:510.642.2739 Berkeley, CA 94720-1770 home: (F-Tu) 707.665.0131 (W-F) 510.655.5480 (office: 400A Cory) Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]
Re: [Ptolemy] Re: The ID PI is undefined. in Ptolemy II 3.0-beta ...
Yes, this is a bug in the code generator that shipped with the beta. It is likely that the final release will include a fix that allows constants (like PI) to be dealt with correctly. Note that for other reasons, the Butterfly demo will not generate usable code. (Because the plotter uses parts of Ptolemy II that are not initialized or understood by the code generator). This is also something I'm working on, but it is unlikely that a fix will be included in the release. Steve At 04:04 PM 8/18/2003 -0700, Christopher Hylands Brooks wrote: Sorry for the delay in getting back to you on this, I was away on vacation On 8/02, in comp.soft-sys.ptolemy, [EMAIL PROTECTED] (Long-Bao) wrote: Hi, everyone: I've encounterd the following exception when I used code generator (for Java) with the Demo Butterfly (or something else) in SDF Domain: Soot started on Sat Aug 02 21:58:46 CST 2003 WatchDogTimer.internalTransform(wjtp.watchDog, {time=60, cancel=false}) ModelTransformer.internalTransform(wjtp.mt, {targetPackage=ptolemy.copernicus.java.cg.Butterfly}) ModelTransformer: Creating actor class ptolemy.copernicus.java.cg.Butterfly.CGRamp for actor .Butterfly.Ramp based on ptolemy.actor.lib.Ramp ptolemy.kernel.util.IllegalActionException: The ID PI is undefined. at ptolemy.copernicus.java.DataUtilities$ActorCodeGenerationScope.getType(DataUtilities.java:366) at ptolemy.data.expr.ParseTreeTypeInference._getTypeForName(ParseTreeTypeInference.java:495) at ptolemy.data.expr.ParseTreeTypeInference.visitLeafNode(ParseTreeTypeInference.java:303) at ptolemy.data.expr.ASTPtLeafNode.visit(ASTPtLeafNode.java:115) at ptolemy.data.expr.ParseTreeTypeInference._inferChild(ParseTreeTypeInference.java:536) at ptolemy.data.expr.ParseTreeTypeInference._inferAllChildren(ParseTreeTypeInference.java:519) at ptolemy.data.expr.ParseTreeTypeInference.visitProductNode(ParseTreeTypeInference.java:400) at ptolemy.data.expr.ASTPtProductNode.visit(ASTPtProductNode.java:124) at ptolemy.data.expr.ParseTreeTypeInference.inferTypes(ParseTreeTypeInference.java:78) at ptolemy.copernicus.java.ParseTreeCodeGenerator.generateCode(ParseTreeCodeGenerator.java:74) at ptolemy.copernicus.java.DataUtilities.generateExpressionCodeBefore(DataUtilities.java:184) at ptolemy.copernicus.java.ModelTransformer.computeAttributesBefore(ModelTransformer.java:185) at ptolemy.copernicus.java.GenericAtomicActorCreator.createAtomicActor(GenericAtomicActorCreator.java:196) at ptolemy.copernicus.java.ModelTransformer._createActorsIn(ModelTransformer.java:1462) at ptolemy.copernicus.java.ModelTransformer._createCompositeActor(ModelTransformer.java:1493) at ptolemy.copernicus.java.ModelTransformer.internalTransform(ModelTransformer.java:914) at soot.SceneTransformer.transform(SceneTransformer.java:46) at soot.Pack.apply(Pack.java:79) at soot.Main.run(Main.java:1649) at ptolemy.copernicus.kernel.KernelMain.generateCode(KernelMain.java:17 5) at ptolemy.copernicus.java.Main.main(Main.java:450) Code generation of 'jar:file:/C:/Ptolemy/Ptolemy_II_3.0-beta/ptolemy/domain s/sdf/demo/demo.jar!/ptolemy/domains/sdf/demo/Butterfly/Butterfly.xml' failed: java.lang.RuntimeException: ptolemy.kernel.util.IllegalActionException: The ID PI is undefined. at ptolemy.copernicus.java.DataUtilities.generateExpressionCodeBefore(DataUtilities.java:188) at ptolemy.copernicus.java.ModelTransformer.computeAttributesBefore(ModelTransformer.java:185) at ptolemy.copernicus.java.GenericAtomicActorCreator.createAtomicActor(GenericAtomicActorCreator.java:196) at ptolemy.copernicus.java.ModelTransformer._createActorsIn(ModelTransformer.java:1462) at ptolemy.copernicus.java.ModelTransformer._createCompositeActor(ModelTransformer.java:1493) at ptolemy.copernicus.java.ModelTransformer.internalTransform(ModelTransformer.java:914) at soot.SceneTransformer.transform(SceneTransformer.java:46) at soot.Pack.apply(Pack.java:79) at soot.Main.run(Main.java:1649) at ptolemy.copernicus.kernel.KernelMain.generateCode(KernelMain.java:175) at ptolemy.copernicus.java.Main.main(Main.java:450) WARNING: Default charset MS950 not supported, using ISO-8859-1 instead All Done. Have anyone met the same problem as me ?? Or I've done something wrong?? I'm using Ptolemy II Windows executable file that includes JVM on Windows XP Professional SP1 and Compaq Presario 1500. How to overcome it??? Thans a lot!!! Long-Bao I see the same problem in Ptolemy 3.0-beta in the Windows prebuilt executable and in a 3.0-beta binary built from scratch. I think the problem is the Expression actor. Generating code for