Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help with comparing two pictures in Python
    primarykey
    data
    text
    <p>Hey guys, Im working on an assignment for my comp sci class, I dont know where Im going wrong here. The function is supposed to take two pictures, pic1 and pic2, and return how different they are.</p> <p>Heres what I have</p> <pre><code>def smart_difference(pic1, pic2): '''Given two Pictures, pic1 and pic2 of any size and colour, return the difference''' red = red_average(pic2) blue = blue_average(pic2) green = green_average(pic2) pic1_height, pic1_width = media.get_height(pic1), media.get_width(pic1) pic2_height, pic2_width = media.get_height(pic2), media.get_width(pic2) if (pic1_height &gt; pic2_height) and (pic1_width &gt; pic2_width): new_pic1 = media.create_picture(pic2_width, pic2_height) new_pic2 = pic2 elif (pic1_height &gt; pic2_height) and (pic2_width &gt; pic1_width): new_pic1 = media.create_picture(pic2_width, pic1_height) new_pic2 = media.create_picture(pic2_width, pic1_height) elif (pic2_height &gt; pic1_height) and (pic2_width &gt; pic1_width): new_pic1 = pic1 new_pic2 = media.create_picture(pic1_width, pic1_height) elif (pic2_height &gt; pic1_height) and (pic1_width &gt; pic2_width): new_pic1 = media.create_picture(pic2_width, pic1_height) new_pic2 = media.create_picture(pic2_width, pic1_height) scale_red(new_pic1, red) scale_blue(new_pic1, blue) scale_green(new_pic1, green) scale_red(new_pic2, red) scale_blue(new_pic2, blue) scale_green(new_pic2, green) return simple_difference(new_pic1, new_pic2) </code></pre> <p>I run a self_test file (which was given to us for our assignment), but I keep getting an error here, can anyone help? </p> <p>*Notes:Simple_difference is another function I wrote beforehand that finds the distance between pixels in the two pictures and scales accordingly </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload