Hey, ich mache dieses Bildfilterprojekt in Python und ich habe es schon einmal gemacht, aber auf eine ganz andere Art und Weise und ich habe nicht meinen alten Code (schreit in Python) und der Filter2 ist immer schwarz, egal WAS ich mache. Ich habe verschiedene RBG-Werte ausprobiert, ohne Operationen, und bin mir nicht sicher, was ich sonst noch versuchen kann. Ich hatte das gleiche Problem, als ich Filter1 ausführte, und ich habe einfach den Filter2-Code gelöscht, damit Filter1 funktioniert, daher bin ich mir nicht sicher, was los ist: „
print("\n\n")
img = Image.open('StudentWork/image.jpg')
//rescale img code
def gray():
//code for grey, i just deleted it for room
def filter1():
//code for filter1, works perfect and lowk same format as filter2, js no input
def filter2():
print("Code for filter2")
red_input = int(input("From 0-255, how red would you like the image?"))
green_input = int(input("From 0-255, how green would you like the image?"))
blue_input = int(input("From 0-255 how blue would you like the image?"))
pixels = img.getdata()
filter2_pixels = []
for p in pixels:
r , g , b = p
filter2_pixels.append((red_input , green_input , blue_input))
#filter2_pixels.append(p)
location = 0
#ok = True
while location < len(filter2_pixels):
p = filter2_pixels[location]
r = p[0]
g = p[1]
b = p[2]
new_red = r + red_input
new_green = g + green_input
new_blue = b + blue_input
filter2_pixels[location] = (new_red, new_green , new_blue)
location = location + 1
newImage2 = Image.new("RGB", img.size)
newImage2.putdata(filter2_pixels)
return newImage2
a = gray()
a.save("StudentWork/gray.jpg")
b = filter1()
b.save("StudentWork/filter1.jpg")
c = filter2()
c.save("StudentWork/filter2.jpg")
# Image filter names for use below
f1 = "filter1"
f2 = "filter2"
f3 = "filter3"
# Apply multiple filters through prompts with the user
print("\nThe following prompt will ask you which filter to apply to the combined filter. It will keep asking until you answer 'none'.")
answer = input("\nWhich filter do you want me to apply?\n gray\n " + f1 + "\n " + f2 + "\n " + f3 + "\n none\n\n")
while answer != "gray" and answer != f1 and answer != f2 and answer != f3 and answer != "none":
answer = input("\nIncorrect filter, please enter:\n gray\n " + f1 + "\n " + f2 + "\n " + f3 + "\n none\n\n")
//determines which filter to apply code
img.save("StudentWork/combinedFilters.jpg")
Hey, ich mache dieses Bildfilterprojekt in Python und ich habe es schon einmal gemacht, aber auf eine ganz andere Art und Weise und ich habe nicht meinen alten Code (schreit in Python) und der Filter2 ist immer schwarz, egal WAS ich mache. Ich habe verschiedene RBG-Werte ausprobiert, ohne Operationen, und bin mir nicht sicher, was ich sonst noch versuchen kann. Ich hatte das gleiche Problem, als ich Filter1 ausführte, und ich habe einfach den Filter2-Code gelöscht, damit Filter1 funktioniert, daher bin ich mir nicht sicher, was los ist: „ [code]
//rescale img code def gray(): //code for grey, i just deleted it for room def filter1(): //code for filter1, works perfect and lowk same format as filter2, js no input def filter2(): print("Code for filter2") red_input = int(input("From 0-255, how red would you like the image?")) green_input = int(input("From 0-255, how green would you like the image?")) blue_input = int(input("From 0-255 how blue would you like the image?")) pixels = img.getdata() filter2_pixels = [] for p in pixels: r , g , b = p filter2_pixels.append((red_input , green_input , blue_input)) #filter2_pixels.append(p) location = 0 #ok = True while location < len(filter2_pixels): p = filter2_pixels[location] r = p[0] g = p[1] b = p[2] new_red = r + red_input new_green = g + green_input new_blue = b + blue_input filter2_pixels[location] = (new_red, new_green , new_blue) location = location + 1 newImage2 = Image.new("RGB", img.size) newImage2.putdata(filter2_pixels) return newImage2 a = gray() a.save("StudentWork/gray.jpg") b = filter1() b.save("StudentWork/filter1.jpg") c = filter2() c.save("StudentWork/filter2.jpg")
# Image filter names for use below f1 = "filter1" f2 = "filter2" f3 = "filter3"
# Apply multiple filters through prompts with the user print("\nThe following prompt will ask you which filter to apply to the combined filter. It will keep asking until you answer 'none'.") answer = input("\nWhich filter do you want me to apply?\n gray\n " + f1 + "\n " + f2 + "\n " + f3 + "\n none\n\n") while answer != "gray" and answer != f1 and answer != f2 and answer != f3 and answer != "none": answer = input("\nIncorrect filter, please enter:\n gray\n " + f1 + "\n " + f2 + "\n " + f3 + "\n none\n\n") //determines which filter to apply code img.save("StudentWork/combinedFilters.jpg") [/code]
Hey, ich mache dieses Bildfilterprojekt in Python und ich habe es schon einmal gemacht, aber auf eine ganz andere Art und Weise und ich habe nicht meinen alten Code (schreit in Python) und der...
Ich benutze Pycharm. Wenn ich Bibliotheken wie Numpy oder Pandas in meinem Projekt installiere, zeigt der Dolmetscher alles, was mit der Bibliothek zu tun hat, als ob er es nicht erkennt. Der Code...
Verwenden eines Technologiestacks namens VUE3. Ich habe zwei Dienste angerufen. Ich habe auch zwei Proxys konfiguriert, aber als ich erneut nach der Schnittstelle fragte Die Schnittstelle und...
Ich studiere neuronale Netzwerke und als Praxis habe ich versucht, ein Modell zu machen, das Zahlen klassifiziert. Es dauert Zahlen als Eingänge und gibt eine 1 aus, wenn die Zahl gerade oder 0 ist,...