first, i tried to view color bars test pattern in this way:
captured image with ov7670 into raspberry pi pico internal memory
Asked today
Modified today
Viewed 5 times
0
I try to capture and save a small photo with ov7670 camera module and save it to raspberry pi PICO internal memory as a BMP file format using circuitpython liberaries. any solution or sample code?
first, i tried to view color bars test pattern in this way:
Code: Select all
import time
import board
import busio
import digitalio
import storage
from adafruit_bitmapsaver import save_pixels
from ulab import numpy as np
from displayio import (
Bitmap,
Group,
TileGrid,
Palette,
ColorConverter,
Colorspace,
)
from adafruit_ov7670 import (
OV7670,
OV7670_SIZE_DIV8,
OV7670_SIZE_DIV16,
OV7670_COLOR_RGB,
OV7670_COLOR_YUV,
OV7670_TEST_PATTERN_COLOR_BAR
)
with digitalio.DigitalInOut(board.GP10) as reset:
reset.switch_to_output(False)
time.sleep(0.001)
bus = busio.I2C(board.GP1, board.GP0)
cam = OV7670(
bus,
data_pins=[
board.GP12,
board.GP13,
board.GP14,
board.GP15,
board.GP16,
board.GP17,
board.GP18,
board.GP19,
],
clock=board.GP11,
vsync=board.GP7,
href=board.GP21,
mclk=board.GP20,
shutdown=None,
reset=board.GP10,
)
cam.size = OV7670_SIZE_DIV8
cam.colorspace = OV7670_COLOR_RGB
cam.test_pattern = OV7670_TEST_PATTERN_COLOR_BAR
bitmap = Bitmap(cam.width,cam.height, 65535)
arr = np.zeros((2*cam.width, 2*cam.height), dtype=np.uint16)
cam.capture(arr)
palette=Palette(cam.width*cam.height)
for y in range(cam.height):
for x in range(cam.width):
palette[y*cam.width+x]=arr[x,y]
x=0
y=0
for y in range(cam.height):
for x in range(cam.width):
bitmap[x,y]=y*cam.width+x
save_pixels('/test.bmp', bitmap, palette)
print("done")
what s the problem? how can i get a clear image?