this is an active contour method in python 2.7 I need to adjust just this program import Tkinter fro

this is an active contour method in python 2.7 I need to adjust just this program 

import Tkinter

Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now

from Tkinter import *

import os

import sys

import ImageTk, Image

import PIL

from PIL import *

from array import array

from turtle import *

import math

from math import pi

 

#creating a window

window=Tkinter.Tk()

window.geometry(“650×650”)

window.title(“Active Contour Implementation”)

window.configure()

 

 

#function for  open file 

 

    

#function for new form   

def OpenNew():

    openNew=Tkinter.Tk()

    openNew.title(“Welcome”)

    openNew.geometry(“500×500”)

    

    menubar = Menu(openNew)

    filemenu = Menu(menubar, tearoff=0)

    filemenu.add_command(label=”New”, command=OpenNew)

    filemenu.add_command(label=”Open”, command=openFile)

    filemenu.add_command(label=”Save”)

    filemenu.add_command(label=”Save as…”, command=saveAs)

 

    filemenu.add_separator()

 

    filemenu.add_command(label=”Exit”, command=OpenNew.quit)

 

    openNew.config(menu=menubar)

    openNew.mainloop()

    

#Enter the value

entr=Entry(window)

entr.pack(fill=Y)

entr.delete(0, END)

entr.insert(0, ”  input the value”)

 

 

#Active Contour Implementation

 

imgOpen=”image3.jpg”

 

image1 = ImageTk.PhotoImage(Image.open(imgOpen))

w = image1.width()

h = image1.height()

x = 0

y = 0

window.geometry(“%dx%d+%d+%d” % (w, h, x, y))  

Lbl = Tkinter.Label(window, image=image1)

Lbl.pack(side='top', fill='both', expand='yes')

Lbl.image = image1

 

print w

print h

 

newX=w/2

newY=h/2

 

 

print 'newwwwww'

 

print newX

print newY

 

n=150

s_radius=250

 

LCV=array(“i”)

for i in range (n):

    LCV.append(i)

        

L1X = array(“i”)

for i in range (n):

    L1X.append(i)

 

L1Y = array(“i”)

for i in range (n):

 L1Y.append(i)

 

L2X = array(“i”)

for i in range (n):

 L2X.append(i)  

 

L2Y = array(“i”)

for i in range (n):

 L2Y.append(i)   

 

BordersX = array(“i”)

for i in range (n):

 BordersX.append(i)   

     

BordersY = array(“i”)

for i in range (n):

  BordersY.append(i)  

    

xFill=[BordersX, -1]

yFill=[BordersY, -1]

 

 

#Set=color('red')

step_size=15

jump_threshold=25

#setWidth?

 

 

radius=s_radius

radius>10

radius=radius-step_size

 

if radius==s_radius:

   i=0

   while i

       x_0=radius *  cos ( i * (2*pi)/n)

       y_0=radius *  sin ( i * (2*pi)/n)

       x_0 = x_0 + newX

       y_0 = y_0 + newY

       BordersX[i]= x_0

       BordersY[i]= y_0

       LCV[i] = -1

       i+=1

   

pnt_cnt=0

j=0

while j

    if LCV[j]== -1:

        x_0=radius *  cos( i * (2*pi)/n)   + newX

        y_0=radius *  sin ( i * (2*pi)/n)  + newY

        

        x_1=((radius  – step_size) *  cos( i * (2*pi)/n)   ) + newX

        y_1=((radius  – step_size) *  sin ( i * (2*pi)/n)  ) + newY

        v_0 = getPixel(x_0, y_0)

       

        v_1 = getPixel(x_1, y_1)

        if gVal(v_0) – gVal(v_1)  > jump_threshold:

            

            LCV[i]=1

        else:

            BordersX[i]= x_1 

            BordersY[i]= y_1

            Pol=Tkinter.Canvas(window)

            Pol.pack()

            Pol.create_line(BordersX, BordersY)

            wait(20)

    pnt_cnt=pnt_cnt + 1

    i+=1

    

def gVal(v):

     red = (v>>16)&0xff

     green = (v>>8)&0xff

     blue = v&0xff

     return (00.56 * red + 0.33*green + 0.11 * blue)

 

# Menu Option

#File menu

menubar=Menu(window)

filemenu=Menu(menubar, tearoff=0)

filemenu.add_command(label=”New”,command=OpenNew)

filemenu.add_command(label=”Open”, command=openFile)

filemenu.add_command(label=”Save”)

filemenu.add_command(label=”Save As”,command=saveAs)

filemenu.add_separator()

filemenu.add_command(label=”Exit”,command= window.quit)

menubar.add_cascade(label=”File”, menu=filemenu)

 

#Edit menu

editmenu=Menu(menubar, tearoff=0)

editmenu.add_command(label=”Cut”)

editmenu.add_command(label=”Copy”)

editmenu.add_command(label=”Paste”)

editmenu.add_command(label=”Delete”)

editmenu.add_command(label=”Select All”)

menubar.add_cascade(label=”Edit”,menu=editmenu)

 

#Help menu

helpmenu=Menu(menubar, tearoff=0)

helpmenu.add_command(label=”About”, command=help)

helpmenu.add_command(label=”Help”, command=help)

menubar.add_cascade(label=”Help”, menu=helpmenu)

 

window.config(menu=menubar)

 

window.mainloop()

 

    • Posted: 4 years ago
    • Due: 07/12/2015
    • Budget: $8

     

    “Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!”

    The post this is an active contour method in python 2.7 I need to adjust just this program import Tkinter fro appeared first on Nursing Assignment.