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]

Reply via email to