Skip to content

Commit

Permalink
Change frame size for verilated Sobel
Browse files Browse the repository at this point in the history
new file:   tut05/imgs/sobel_horizontal_640x480.jpg
modified:   tut05/readme.md tut05/rtl/edge_proc.v  tut05/src/main.cpp
  • Loading branch information
felipe-m committed Oct 8, 2023
1 parent a5cbf27 commit e9e3c35
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions sim_fpga/tutorial/tut05/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@ The edge processing has been modified from:

* [../../../phys_fpga/alhambra_ii/apio/ov7670_yuv_80x60_sobel/edge_proc.v](../../../phys_fpga/alhambra_ii/apio/ov7670_yuv_80x60_sobel/edge_proc.v)

---

![Screenshot Sobel Horizontal 160x120](imgs/sobel_horizontal_160x120.jpg)

---

![Screenshot Sobel Vertical 160x120](imgs/sobel_vertical_160x120.jpg)

---

## Change image size

To change the image size, you just have to change both src/main.cpp and rtl/edge_proc.v

In src/main.cpp change the following lines to the desired values, here for example to 640x480

const int IMG_COLS = 640;
const int IMG_ROWS = 480;


In rtl/edge_proc.v change the following lines to the same desired values

c_img_cols = 640, // 10 bits
c_img_rows = 480, // 9 bits

The achieved fps are much lower (less than 1fps):

![Screenshot Sobel Horizontal 640x480](imgs/sobel_horizontal_640x480.jpg)
8 changes: 4 additions & 4 deletions sim_fpga/tutorial/tut05/rtl/edge_proc.v
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
module edge_proc
# (parameter
// VGA
//c_img_cols = 640, // 10 bits
//c_img_rows = 480, // 9 bits
c_img_cols = 640, // 10 bits
c_img_rows = 480, // 9 bits
// QQVGA
c_img_cols = 160, // 8 bits
c_img_rows = 120, // 7 bits
//c_img_cols = 160, // 8 bits
//c_img_rows = 120, // 7 bits
// QQVGA /2
//c_img_cols = 80, // 7 bits
//c_img_rows = 60, // 6 bits
Expand Down
9 changes: 4 additions & 5 deletions sim_fpga/tutorial/tut05/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Authors:
// - Based on original version of David Lobato
// - Modified: Felipe Machado, https://github.com/felipe-m
// Tutorial 3:
// - includes centroid and proximity
// - the image is larger 160x120
// Tutorial 5:
// - Testing verilated Sobel filter with camera

// imgui headers
#include <SDL.h>
Expand Down Expand Up @@ -53,8 +52,8 @@ typedef cv::Vec<uint8_t, 3> BGRPixel;
// the processed image has a 4th channel, which is Alpha: transparency
typedef cv::Vec<uint8_t, 4> BGRAPixel;

const int IMG_COLS = 160;
const int IMG_ROWS = 120;
const int IMG_COLS = 640; // change here frame size
const int IMG_ROWS = 480; // change here frame size
const int IMG_PXLS = IMG_COLS * IMG_ROWS;
const uint8_t ALPHA_SOLID = 255;

Expand Down

0 comments on commit e9e3c35

Please sign in to comment.