Hello
Yes, it wasn't a good night for troubleshooting code. I have incorporated your suggestions and fixed the code.
I used a hash because I have a couple of switches and args that determine which camera is being used and where the files should go.
Moving onto my next problem. I want to call a subroutine ImageNotDark. I want to pass an Image::Magick object ($pic).
By design, the object is not changed inside the subroutine. My problem is that I am not passing the image object correctly.
# Convert to Image::Maggick image
my $pic = Image::Magick->new(magick=>'jpg'); # create new image obj
+ect
$pic->BlobToImage($img); #convert the grabbed blob image to Image::Ma
+gick object
## test point A
#pass the $pic object to the subroutine and measure image darkness.
my $test = ImageNotDark ($pic); #
The code snippet at the start of the subroutine is as follows:
sub ImageNotDark {
# Argument is one reference to an image object.
# ImageNotDark compares the image with a blank black canvas. If the c
+omparison is
# above the defined threshold, the image is bright enough to send (not
+ dark).
# the return value is true if the images is bright enough.
my $iutImage = Image::Magick->new; #the image tested for darkness
$iutImage->Read(@_); # get the image under test (iut)
So the debugger shows that $iutImage is not initialised. At test point A, I temporarily added code to save the $pic image to a file.
I was able to confirm that $pic holds a valid image. So I am reasonably certain the problem is the way I call the subroutine and attempt to pass the image.
Any tips would be much appreciated.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.