2 Replies - 1508 Views - Last Post: 04 May 2010 - 06:35 PM Rate Topic: -----

#1 Bmxguy34  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 02-April 10

Need help with Python Code for Sharpening an Image/Recursive Functions

Posted 03 May 2010 - 02:09 PM

I'm new to programming and I've started taking classes that uses the Python language. I have an extremely bad professor and have no idea how to start the problems that were assigned. The problems are in the attachment. If you could help or give any tips I would greatly appreciate it.
Attached File  hw6.pdf (90.28K)
Number of downloads: 166

This post has been edited by Bmxguy34: 03 May 2010 - 02:10 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Need help with Python Code for Sharpening an Image/Recursive Functions

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6081
  • View blog
  • Posts: 23,556
  • Joined: 23-August 08

Re: Need help with Python Code for Sharpening an Image/Recursive Functions

Posted 03 May 2010 - 03:34 PM

This is pretty prominent in your assignment:

Quote

Assistance should only be sought or accepted from the course instructor. Any violation of this rule will be dealt with harshly.


In any event, our rules are:

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
Was This Post Helpful? 0
  • +
  • -

#3 Bmxguy34  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 02-April 10

Re: Need help with Python Code for Sharpening an Image/Recursive Functions

Posted 04 May 2010 - 06:35 PM

If you have any tips let me know ASAP. This is what I have so far:

from cImage import *

def sharpen (origimage):
    image1=FileImage(origimage)
    width1=image1.getWidth()
    height1=image1.getHeight()
    for row in range(height1):
        for col in range(width1):
            boarder=0
            if (row-1)==0:
                if (col-1)==0:
                    boarder=boarder+1
            if (row-1)>0:
                if (col-1)>0:
                    boarder=boarder+1
                    
def processimage():
    procimage=input("Please specify the file you'd like to sharpen: ")
    sharpimg=sharpen(procimage)
    saveimage=input("Please specify the file you'd like to save the sharpened image in: ")


def num_double_letters(astr):
    doubleletters=0
    if len(astr)==1:
        return doubleletters+0
    else:
        pass

def power(a,B)/>:
    if b == 1:
        return a*1
    if b == 0:     
        return 1
    if b< 0:       
        result1= (power(a,b+1))
        return (1/a)*float(result1)
    if b>0 and (b%2==1):
        result2 = (power(a,(b-2)))
        return (a*(a*float(result2)))
    elif b>0 and b%2==0:
        result3 = (power(a,(b//2)-1))
        return (a*float(result3))*(a*float(result3))

def count_pattern(astr,substr):
    occurrences=0
    if len(astr)==0:
        occurrences=occurrences+0
    elif len(astr)==len(substr):
        if astr==substr:
            occurrences=occurrences+1
    else:
        count_pattern(astr[1:],substr)
    return occurrences

def zerosum(L):
    if len(L)==2:
        if L[0]+L[1]==0:
            return True
    else:
        pass

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1