SyntaxError: can't assign to expression出错误报出如何解决,求大神帮忙
-
import sensor, image, time, math sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.VGA) # Set frame size to QVGA (320x240) sensor.skip_frames(time = 2000) # Wait for settings take effect. clock = time.clock() # Create a clock object to track the FPS. while(True): #img = sensor.snapshot() # Take a picture and return the image. img = sensor.snapshot() #红色阈值 for y in range(0,480,3): for x in range(0,640): #img.get_pixel(x,y) if img.get_pixel(x,y)>=205: img.get_pixel(x,y)=255 elif img.get_pixel(x,y)<=195: img.get_pixel(x,y)=0 else: img.get_pixel(x,y)=img.get_pixel(x,y)
-
img.get_pixel(x,y)=0
get_pixel返回的具体的数值,不能直接赋值,要用set_pixel赋值。