Download presentation
Presentation is loading. Please wait.
1
ECE Department: University of Massachusetts, Amherst ECE 354 Spring 2006 Lab 2: Capturing and Displaying Digital Image
2
2 ECE 354 Big Picture Introduction Capture an image using a digital camera Download image data to NIOS II serially through the use of a UART A handshaking protocol will be used to communicate with digital camera Display the image on a CRT monitor with the use of a VGA controller Perform simple image processing Primarily written in C code Use a preexisting SOPC system with some slight modifications
3
3 ECE 354 Additional Hardware ITM-C-328 Serial Color Digital Camera Serial Connector and Cable CRT Monitor
4
4 ECE 354 Skills to learn Integrate code with preexisting code Understanding previously written code Connect to a device that you did not design Writing a communication protocol to somebody else’s specifications
5
5 ECE 354 Steps taken to complete project Begin by looking over ITM-C-328 camera documentation Plan out the series of events needed to communicate with the camera Write a C program to send a simple request message and receive a message in return Build up the program until ready to receive image data Image data should be stored in one continuous buffer in SDRAM (example: char received[64]) Gain knowledge of how the DE2_NIOS_HOST_MOUSE_VGA project displays an image to the CRT monitor Use that knowledge to display your image Finally have fun performing image processing
6
6 ECE 354 Communicating with the camera Communication with the camera is accomplished through a series of commands A single command consists of 6 continuous single-byte RS- 232 transmissions A listing and description of the command set can be found in ITM-C 328_Manual.pdf
7
7 ECE 354 Communicating with the camera (continued) This is the command protocol to receive an uncompressed snapshot picture Initial command to configure preview image size and color type Snapshot command takes a snapshot and stores data in camera buffer Get picture is used to transfer image data to host Your task is to implement this in C code
8
8 ECE 354 Information for C program To write/read to/from the UART fd = open(“/dev/uart”, O_RDWR | O_NONBLOCK, 0); charReceived = read(fd, to, length); write(fd, from, length); I recommend looking over section II of the NIOS II Software Developer’s Handbook A blocking read holds the program until the read operation completes with the length you specify Think about why a nonblocking read is needed
9
9 ECE 354 Recommended C code functions A function to … Establish a connection with the camera (Sync function) Send a message to the camera Receive and check a message from the camera Receive image data from camera Print bits of a byte received (debugging) Print hex equivalent of a message received (debugging)
10
10 ECE 354 A little help Use the form on the bottom of this slide to hold messages that will be sent to camera hold messages to check received messages against The message can be written to the UART in the following way: write(fd, SYNC, 6)
11
11 ECE 354 Additional information The image should be 2-bit gray scale with a resolution of 640x480 Uncompressed image I recommend starting with the smallest image resolution and work from there
12
12 ECE 354 Overview of DE2_NIOS_HOST_MOUSE_VGA project Implements a monochrome display, with a preloaded image, where the user can draw on it with a mouse USB mouse should be connected USB HOST port CRT monitor should be connected to the VGA port You will integrate your code so that the project displays the image received from digital camera
13
13 ECE 354 Displaying image through VGA controller Look through VGA.h for VGA functions Write C code similar to that shown below that calls functions from VGA.h to display each pixel It is your job to come up with an equation to check each pixel in your receive buffer
14
14 ECE 354 Image Processing It is required that you implement two forms of image processing Recommendations include: Add timestamp onto image Counter to keep track of number of pictures taken Rotate, mirror, invert image Simple edge detection (challenging) Detect changes in images (challenging)
15
15 ECE 354 Where does this project lead? Next lab will be on the topic sending data over a network Sending image between DE2 boards Using computer networking knowledge learned from Professor Ganz’s course Don’t worry if you have not taken computer networking
16
16 ECE 354 References Camera documentation (ITM-C-328) http://www.tdc.co.uk/camera/ Information and Datasheets DE2_NIOS_HOST_MOUSE_VGA project NIOS II Software Developer’s Handbook http://www.altera.com/literature/lit-nio2.jsp
17
17 ECE 354 Hints You may need to slightly modify the SOPC system of the MOUSE_VGA project Set the initial baud rate to what the camera initially wants Attend my lab hours and ask lots of questions
18
18 ECE 354 Questions and Comments
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.