Re: Can't call method "Convolve" on unblessed reference at gifaninmation.pl line 47.

William Torrez Corea <[email protected]>
Newsgroups gmane.comp.lang.perl.beginners
Message-ID <CAGiORHdfXd7sT14rWSqv8V9JhEmg9qEcPaqK+vzWRP=a6YWTQg@mail.gmail.com>
>
> #!/usr/local/bin/perl
> use Image::Magick;
> use PDL::ImageND;
>
> # The script reads three images, crops them, and writes a single image as
> a GIF animation sequence
> my($image,$p,$q);
>
> $image = new Image::Magick;
> $image->Read('Bugs_Bunny.svg.png');
>
> $image->Read('ng-clipart-bugs-bunny-witch-hazel-drawing-looney-tunes-cartoon-bugs-and-lola-bunny.png');
> $image->Read('k.miff[1, 5, 3]');
> $image->Contrast();
> for($x = 0; $image->[$x]; $x++){
>         $image->[$x]->Frame('100x200') if $image->[$x]->Get('magick') eq
> 'GIF';
>         undef $image->[$x] if $image->[$x]->Get('columns') < 100;
> }
>
> $p = $image->[1];
>
> # Suppose you want to start out with a 100x100 pixel white canvas with a
> red
> $image = Image::Magick->new;
> $image->Set(size=>'100x100');
> $image->ReadImage('canvas:white');
> $image->Set('pixel[49,49]'=>'red');
>
> # Here we reduce the intensity of the red component at (1,1) by half:
> @pixels = $image->GetPixel(x=>1,y=>1);
> $pixels[0]*=0.5;
> $image->SetPixel(x=>1,y=>1,color=>\@pixels);
>
> # Or suppose you want to convert your color image to grayscale
> $image->Quantize(colorspace=>'gray');
>
> # Let's annotate an image with a taipai truetype font
> $text = 'Works like magick!';
> $image->Annotate(font=>'kai.ttf', pointsize=>40,fill=>'green',text=>$text);
>
> # Perhaps you want to extract all the pixel intensities from an image and
> write them to STDOUT
> @pixels = $image->GetPixels(map=>'I',
> height=>$height,width=>$width,normalize=>true);
> binmode STDOUT;
> print pack('B*',join('',@pixels));
>
> # Other clever things you can do with a PerlMagick objects include
> $i = "$#$p+1";   # return the number of images associated with object p
> push(@$q, @$p); # push the images from object p onto object q
> @$p = (); #delete the images but not the object p
> $p->Convolve([1, 2, 1, 2, 4, 2, 1, 2, 1]);
>

On Fri, Feb 4, 2022 at 9:41 AM David Mertens <[email protected]>
wrote:

> The issue isn't having the method, the issue is calling it on an unblessed
> reference. Can you show the code that gives this problem?
>
> Btw, my bet is that it's not a matter of having PDL's method. You would
> use PDL for number crunching, not gif animation. :-)
>
> David
>
> On Fri, Feb 4, 2022, 10:14 AM William Torrez Corea <[email protected]>
> wrote:
>
>> Ready, install the method from https://metacpan.org/pod/PDL::ImageND.
>>
>> $p->Convolve([1, 2, 1, 2, 4, 2, 1, 2, 1]);
>>>
>>
>>
>> According to the function convolve this declaration is of the following
>> way
>>
>>> $new = convolve $x, $kernel
>>>
>>> But when I declare the function in my code the result is wrong.
>>
>> Can't call method "Convolve" on unblessed reference at gifaninmation.pl
>>> line 47.
>>>
>>
>> I don't know in what part I am confused.
>>
>>
>>
>>
>>
>>
>> On Fri, Feb 4, 2022 at 8:34 AM Andrew Solomon <[email protected]> wrote:
>>
>>> Is this what you're looking for?
>>>
>>> https://metacpan.org/pod/PDL::ImageND
>>>
>>>
>>> On Fri, Feb 4, 2022 at 2:30 PM William Torrez Corea <
>>> [email protected]> wrote:
>>>
>>>> I'm using cpanm trying to find a method that contains the function
>>>> convolve but I only found the method Imager.
>>>>
>>>> https://metacpan.org/pod/Imager
>>>>
>>>> When I try to declare the method and use it in the code, the result is
>>>> always wrong.
>>>>
>>>> I am using the following libraries:
>>>>
>>>>>
>>>>>
>>>>>
>>>>> *#!/usr/local/bin/perl use Image::Magick;use Imager;*
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> With kindest regards, William.
>>>>
>>>> ⢀⣴⠾⠻⢶⣦⠀
>>>> ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
>>>> ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
>>>> ⠈⠳⣄⠀⠀⠀⠀
>>>>
>>>>
>>>
>>> --
>>> Andrew Solomon
>>> Director, Geekuni <https://geekuni.com/>
>>> P: +44 7931 946 062
>>> E: [email protected]
>>>
>>
>>
>> --
>>
>> With kindest regards, William.
>>
>> ⢀⣴⠾⠻⢶⣦⠀
>> ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
>> ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
>> ⠈⠳⣄⠀⠀⠀⠀
>>
>>

-- 

With kindest regards, William.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.