Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22189

MSP430FR5994: Problems of Connecting MSP430FR5994 with OV7670 (with FIFO Memory)

$
0
0
Part Number: MSP430FR5994

Tool/software:

Hello everyone,

I'm trying to connect MSP430FR5994 with OV7670 (with FIFO memory), getting an image data (not for video streaming) and show it on the PC screen (with Python code). I can successfully read the data from OV7670's FIFO memory and store it into MSP430FR5994's FRAM. I can also send this data to PC via MSP430FR5994's UART. However, when I want to show the image on the sceen, I will get the window which is all garbled, shown as below:

I also noticed that the data received on PC would include some weird data, like "m", "i", "~". I thought the data I got should be the number between 0~f.

This is my Python code to show the image window:

import serial
import numpy as np
import cv2


SERIAL_PORT = 'COM9'
BAUD_RATE = 115200
IMAGE_WIDTH = 160
IMAGE_HEIGHT = 120
IMAGE_SIZE = IMAGE_WIDTH * IMAGE_HEIGHT

def receive_image():
    with serial.Serial(SERIAL_PORT, BAUD_RATE, timeout=5) as ser:
        print("waiting for data...")
        data = ser.read(IMAGE_SIZE)
        if len(data) == IMAGE_SIZE:
            print("receive successfully, data length:", len(data))
            print(data)
            return np.frombuffer(data, dtype=np.uint8).reshape((IMAGE_HEIGHT, IMAGE_WIDTH))
        else:
            print("receive failed, data length:", len(data))
            return None

image = receive_image()
if image is not None:
    cv2.imshow("OV7670 Image", image)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

The image format I used is 160x120 with RGB565.

I am wondering how to fix this problem? Is it caused by some image encoding/decoding problems?

Thanks,

YaTong


Viewing all articles
Browse latest Browse all 22189

Trending Articles