Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Image Processing Project on the DE2 board

Greetings!

I am making this project using the DE2 development board (with a CMOS Camera and LCD display attached) which has the following objectives:

1. Capture an image

2. Display the Image on the LCD

3. Store the Image in an SD card

4. Convert the image into a JPEG format.

5. Have a user interface to control these functions.

6. The user interface should be implemented on top of a controller

7. The controller should load the JPEG algorithm bit stream into the FPGA to configure it at runtime from a memory (like the SD card). *very important

My project also should have HDL codes to interface to an embedded RAM (where the Image captured will be stored temporarily), CMOS camera, and SD card.

Can the embedded RAM, the DE2 board has, generally hold the RAW image from the camera?

In reconfiguring the Cyclone II, does the whole chip need to be altered? or can only a portion of it alloted for JPEG compression be changed? I ask this because I plan to implement the controller in the FPGA chip instead of the NIOS II embedded controller.

Some of my mentors in school pointed out that the FPGA chip (Cyclone II) might run out of space if I implement the controller and the image processing there.

Thank you for your time, some advise, insights, referrals are highly appreciated:)

16 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    The memory can be for image data, or also your compression algorithm. I'm not sure how you are going to load the algorithm into the FPGA as a bitstream - is it going to be the whole algorithm, or just parameters to the algorithm?

    --- Quote End ---

    The idea is that I would have a library of compression or image processing algorithms in the SD card then as I choose an algorithm to implement, it will get loaded to the FPGA so that the FPGA (or at least a portion of it) would perform the desired algorithm. So to answer the question, the whole algorithm would be loaded essentially. In this way, do the FGPA still have to access the SD card over and over again? Or can it be just one time loading?

    I understand why you say that its better to store it in a RAM first, but if it will be a one time loading to the fpga, can this be ommited for the compression algorithm?

    --- Quote Start ---

    I would actually write the algorithm in HDL (means this is part of your SOF), and only load the parameters as a bitstream. However, even with this I would load the bitstream into a RAM (best if internal RAM), so the algorithm doesn't need to access the external SD card all the time at every loop. Imagine, if your algorithm is running, and you remove the SD card, your whole system is going to fail. So, I'd always load the bitstream to (internal or external) RAM.

    --- Quote End ---

    I understand why it should be stored in a RAM (except the parameters part), however, if that's the case then is it not true that the FPGA just have to be changed then it doesn't need to access the algorithm bit stream used to configure it?

    --- Quote Start ---

    You're almost there. This process will start after you have already configured your FPGA using Quartus. The scan chain bitstream scanning will happen in (b), after your FPGA is already configured by Quartus.

    --- Quote End ---

    Yes it will start after the first configuration by quartus, but after that the FPGA must be reconfigured without quartus. That's why I didn't understand why you said the scan chain bitstream (compression algorithm) will happen after the FPGA is already configured. What if I change the current algorithm to a bmp compression without the use of quatrus? That's when the scan chain comes in right? The new algorithm is scanned and the controller reconfigures the FPGA.

    --- Quote Start ---

    (c) is also related to (b), where after scanning in the bitstream, your FPGA automatically already gets configured with the new compression algorithm.

    --- Quote End ---

    This should happen without the use of quartus.

    Then why in the quote below, reconfiguring the FPGA using Quartus? Then the reconfiguration won't be implemented in real time? Furthermore, if the reconfiguration is done by quartus, what is the "another controller to scan in" for?

    --- Quote Start ---

    Reconfigure the FPGA using the normal way, Quartus programmer via USB JTAG. Your design should contain another controller to scan in the bitstream via another interface (maybe another USB port, or others).

    --- Quote End ---

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    The idea is that I would have a library of compression or image processing algorithms in the SD card then as I choose an algorithm to implement, it will get loaded to the FPGA so that the FPGA (or at least a portion of it) would perform the desired algorithm. So to answer the question, the whole algorithm would be loaded essentially. In this way, do the FGPA still have to access the SD card over and over again? Or can it be just one time loading?

    I understand why you say that its better to store it in a RAM first, but if it will be a one time loading to the fpga, can this be ommited for the compression algorithm?

    --- Quote End ---

    Yes, you can do that, provided the FPGA doesn't keep accessing the SD card for any other info after the loading is completed, unless of course it needs to perform another loading.

    --- Quote Start ---

    Yes it will start after the first configuration by quartus, but after that the FPGA must be reconfigured without quartus. That's why I didn't understand why you said the scan chain bitstream (compression algorithm) will happen after the FPGA is already configured. What if I change the current algorithm to a bmp compression without the use of quatrus? That's when the scan chain comes in right? The new algorithm is scanned and the controller reconfigures the FPGA.

    --- Quote End ---

    Absolutely right! If you want to change the current algorithm to bmp for example, you just need to scan in the new algorithm bitstream using that interface, and you don't need quartus. Actually, you can even disconnect Quartus totally from your board (plug out USB-Blaster or disconnect the cable) after you've configured your FPGA the first time.

    --- Quote Start ---

    This should happen without the use of quartus.

    --- Quote End ---

    Absolutely.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Alright! Let me see if I get this correctly:)

    I attached a block diagram I made to represent the system I want to implement.

    The solid lines represent the control signals used for interfacing the devices and the dashed lines are the data paths. The red line would be the data path of the configuration bits (HDL algorithms such as the JPEG compression) used to configure the FPGA portion for the data processing block. The black one are the buses for the image data being manipulated.

    For the red line, the scan chain I imagined is like that, that the configuration bit stream would be scanned and loaded by the controller into the FPGA. Can I do this as direct from the SD Card into the FPGA processing block with the controller just commanding the devices? OR am I missing something in this part? (I didn't include the RAM I can use to store the configuration bits anymore)

    For the controller block, I divided it into two parts, the interface to the other devices and the scan-chain part. Is this logical?

    Furthermore, You mentioned that I have to implement a controller for the reconfiguration when I unplugged the Quartus and the JTAG. Is the controller in the diagram one in the same?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Furthermore, You mentioned that I have to implement a controller for the reconfiguration when I unplugged the Quartus and the JTAG. Is the controller in the diagram one in the same?

    --- Quote End ---

    What I meant was in your design, you already included the controller to do the bitstream scanning (or let's say it JPEG algorithm reconfiguration). Your whole design (which includes this controller), is loaded once into the FPGA by Quartus, after which you can disconnect Quartus from your board. And your JPEG Algorithm Reconfiguration controller should work (with Quartus disconnected) by scanning in a new algorithm from PC to FPGA via some pre-defined interface. So yes, this controller is already included in your block diagram, named as "Controller (HDL or NIOS)". It has always been the same controller we were talking about. :)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    And your JPEG Algorithm Reconfiguration controller should work (with Quartus disconnected) by scanning in a new algorithm from PC to FPGA via some pre-defined interface.

    --- Quote End ---

    And from SD Card to FPGA via the interface shown in the diagram can be done as well right?:)

    So is the diagram I drew good enough? Does it miss something or is anything wrong with it?