Ditutup

Write some Software

I'm looking for help with Python. The below is basic white balance that selects X location and Y location, but I need to change it to the user selecting the X & Y as the starting point for a selection radius (box) then having an additional requestinteger input for width and height. having issues using for ~ in range and getting the same output as below

def whiteBalance():

anthony = makePicture(pickAFile())

xPoint = requestInteger("Enter the reference X location")

yPoint = requestInteger("Enter the reference Y location")

refL = getPixel(anthony,xPoint,yPoint)

gValue = (getRed(refL)+getGreen(refL)+getBlue(refL))/3.0

gRed = getRed(refL)/gValue

gGreen = getGreen(refL)/gValue

gBlue = getBlue(refL)/gValue

explore(anthony)

for px in getPixels(anthony):

wRed = getRed(px)

wGreen = getGreen(px)

wBlue = getBlue(px)

setColor(px,makeColor(wRed*gRed,wGreen*gGreen,wBlue*gBlue))

makePicture

explore(anthony)

print refL,gValue,gRed,gGreen,gBlue

The below is my attempt at using range and loops to get the same result.

def whiteBalance2():

anthony = makePicture(pickAFile())

xPoint = requestInteger("Enter the reference X location")

yPoint = requestInteger("Enter the reference Y location")

wPoint = requestInteger("Enter the reference Width")

hPoint = requestInteger("Enter the reference Height")

targetX = xPoint,yPoint

explore(anthony)

for sourceX in range(xPoint,wPoint):

for sourceY in range(yPoint,hPoint):

px = getPixel(anthony,sourceX,sourceY)

gValue = (getRed(px)+getGreen(px)+getBlue(px))/3.0

gRed = getRed(px)/gValue

gGreen = getGreen(px)/gValue

gBlue = getBlue(px)/gValue

wRed = getRed(px)

wGreen = getGreen(px)

wBlue = getBlue(px)

setColor(px,makeColor(wRed*gRed,wGreen*gGreen,wBlue*gBlue))

makePicture

explore(anthony)

Kemahiran: Python

Lihat lagi: free software write company profile, software write websites idea, software write book images, software emulator keyboard input, software write books, software write protection, free software write book, software write book, software write protect software, software write technical manual

Tentang Majikan:
( 0 ulasan ) Japan

ID Projek: #10113364

5 pekerja bebas membida secara purata $27 untuk pekerjaan ini

juanzapico

Send me a message so we can discuss about your requirement, I can help you with your project. Thanks.

$30 AUD dalam sehari
(9 Ulasan)
3.3
agragaurav

There is a logical error in your code. I believe a simple change should give you the desired output. But, that can only be done once I get to look at properly aligned code. I've authored books on Java, C++ and Data Str Lagi

$50 AUD dalam sehari
(2 Ulasan)
3.4
makert40

Hi, I am an experienced Backend Developer with 4 years knowledge on python scripting and databases. Please contact for discussion. Thanks.

$25 AUD dalam sehari
(1 Ulasan)
2.0
Khapalov

Hello! The 1st thing i see here is you should write: for sourceX in range(xPoint, (xPoint + wPoint)): for sourceY in range(yPoint, (yPoint + hPoint)): Because as you did it works with rectangles from xPoint to wP Lagi

$10 AUD dalam 0 hari
(1 Ulasan)
1.8
danishsaba

Hi, I have working experience of two years in C++ and Python. Pls Find my profile at [login to view URL]@[login to view URL] Thanks, Danish

$20 AUD dalam 4 hari
(0 Ulasan)
0.0