On Tue, May 10, 2011 at 17:42, Craig DeForest <[email protected]>wrote:

> Two errors.  David caught the "package -> use" error.  I wrote another
> error -- I used "all" when I should have used "andover".  "all" collapses
> all the way to a Perl scalar; "andover" collapses in one dimension.
>

@ Craig and David first thank you very much to let me understand better how
does PDL works.

I made all the modifications and I have an output that does no produce any
error but I have to understand better how to fit the code to solve my needs.

First i put here the cleaned code that works:


#!/usr/bin/env perl

    use PDL;
    use PDL::IO::Pic;
    use PDL::Primitive;
    use strict;

    my $im = PDL->rpic('sem.jpg');

    my $color = pdl(128,200,128); # light green for 8-bit RGB


   #####
   # Generate a list of all pixels within a 3-D "slop distance" in RGB
space
   # of a certain color
   my $slop = 7;
   my $dist_sq = (($im-$color)*($im-$color))->sumover;   # (X,Y) distance
image -- collapsed over RGB
   my $mask = ($dist_sq <= $slop*$slop);                 # mask of  matching
pixels
   my $wh_sloppy = $mask->whichND; # (2 x M) -- coordinates of all  matching
points


       $im->wpic("sem.png");


This code just take sem.jpg and write sem.png I made it just to understand
if I can have control on writing output images that it's a part of my test.

Now I do not understand how can I transform the $wh_sloppy raw information
into an image composed by sem.jpg plus modification of the color $color at
the matching point at $wh_sloppy to produce a new image mapped into sem.png

I mean I understand more and less that I have tyo build a new matrix
containing someting like a X,Y,RGB dimension but I don't know where to start
and I find the documentation fragmented for my very little knowledge...


Thanks,

Luca













-- 
---
Luca Cappelletti
http://developerinfodomestic.blogspot.com

"...Together we stand, divided we fall."

.O.
..O
OOO

Zeitgeist Activist

GTalk,MSN: luca <dot> cappelletti <at> gmail <dot> com
FSF Member: #9269
Linux Registered User: #223411
Ubuntu Registered User: #7221

"l'intelligenza è utile per la sopravvivenza se ci permette di estinguere
una cattiva idea prima che la cattiva idea estingua noi"

"La chiave di ogni uomo è il suo pensiero. Benché egli possa apparire saldo
e autonomo, ha un criterio cui obbedisce, che è l'idea in base alla quale
classifica tutte le cose. Può essere cambiato solo mostrandogli una nuova
idea che sovrasti la sua"

"Uno studioso è soltanto un modo in cui una biblioteca crea un’altra
biblioteca "
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to