I’m trying to run the color_drawing.py example.
This code runs just fine …
But when I try to modify using that as an example … in order to draw a line from the top of the image in the middle to the bottom of the image in the middle, I get an error “Can not convert float to int”.
# Color Drawing Example # # This example shows off your OpenMV Cam's built-in drawing capabilities. This # example was originally a test but serves as good reference code. Please put # your IDE into non-JPEG mode to see the best drawing quality. import sensor, image, time sensor.reset() sensor.set_framesize(sensor.QVGA) # All drawing functions use the same code to pass color. # So we just need to test one function. while(True): # Test Draw Line (RGB565) sensor.set_pixformat(sensor.RGB565) img = sensor.snapshot() width = img.width()*.5 height = img.height() for i in range(img.width()): img.draw_line([0,0,width,img.height()])
Any ideas why that the snippet ‘img.width()/2’ works in the example but not in this code?