Install Ubuntu and OpenCV on DFI GHF51

Today we will see a new single-board computer DFI GHF51. To better understand what it is, I will compare it with raspberry pi 4 because it is more commonly used to develop projects and prototypes.

dfi ghf51 vs raspberry pi 4

As you can see from the image, it has similar dimensions but has different characteristics. When to choose a board like DFI GHF51 instead of raspberry pi4?

  1. If you need to use a much more reliable device, for example, industrial applications.
  2. If you need more power on CPU because it uses AMD Ryzen ™ CPU and GPU CU integrated instead of an ARM CPU

For more information on the board, I suggest you visit the manufacturer’s website DFI. I also recommend that you visit the page on how to install OpenCV on raspberry pi.

Install Ubuntu and OpenCV on DFI GHF51

When you receive this board it is ready to use. The operating system already installed is Windows 10 and Ubuntu is certainly more suitable for the use of AI or Computer Vision in general. For these reasons, in this tutorial, we will see:

  1. How to install ubuntu 20.0.4
  2. How to install OpenCV

1. How to install ubuntu 20.0.4

Before leaving, make sure you have a usb stick to put Ubuntu in. If you are ready, let’s start!

Download Ubuntu

The board comes with the Windows 10 operating system already installed but for practical reasons, I recommend installing Ubuntu. The first step is to log into https://ubuntu.com/download/desktop and click download.

ubuntu download

Create a bootable USB stick

We need to boot Ubuntu through the USB stick. Let’s go to https://rufus.ie and download the software Rufus.

Select image

We start the Rufus software and set the parameters to insert the .iso file of the operating system on the usb stick.

Device: you need to select your usb stick.
Boot Selection: You need to SELECT your operating system image. In our case Ubuntu 20.4.2 just downloaded

Leave the rest as default and click on START to begin the procedure.

ATTENTION: All data in the usb stick will be lost. So make sure it’s blank or with data that can be lost.

When you see the green bar reading READY you can unplug your usb stick and plug it on the DFI GHF51 board

Enable boot from USB by the bios

Turn on the board by default you should already be able to select the operating system to install. If you can already do it, skip this step. If the USB stick is not set as the first boot, restart the board and press the DEL key.

When you enter the bios go to the BOOT section and select the USB stick as the first item on the Boot Priority option. In my case, there is the Kingston USB stick, Press Enter.

Now go to the Save & Exit tab to confirm the changes and run again.

Continue installing ubuntu on the DFI GHF51 board

If you see this page it means that everything went well. Then select Ubuntu and continue.

Now select the language and click on Install Ubuntu

Follow the instructions and when you get to this point I recommend choosing the Minimal version. For our purpose we do not need many gaming or office software but we can still install what we need later without weighing down our board.

If you are not an expert I recommend doing a clean installation. Check Erase disk and install Ubuntu but Warning: if there are old data on your disk they will be deleted. Press Install Now and follow the new instructions.

After configuring the Time zone, setting your login and password, you will have to wait a few minutes for installation. If everything went well you will see this message:

Click on the button Restart Now

If you followed the instructions and everything went correctly you will finally see the desktop.

2. How to install OpenCV

To install OpenCV we must first open the terminal and type some commands to update the software and install the necessary.

Copy these commands, one after the other:

sudo apt update
sudo apt upgrade

To simplify the installation of Opencv and other repositories we install Pip. If you want to know more I suggest you read on https://pypi.org. Run this command:

sudo apt install python3-pip

Install OpenCV

Let’s now run the command to install Opencv. In my case it installed the latest version Opencv 4.5.1

pip3 install opencv-python

When you finally see this screen, Opencv has been successfully installed.

Test OpenCV

To do the test I connected a webcam to the dfi ghf51 board. Now let’s open a text editor and write the code:

import cv2

cap = cv2.VideoCapture(0)

while True:
    ret, frame = cap.read()
   
    cv2.imshow("Opencv frame", frame)

    key = cv2.waitkey(1)
    if key == 27:
        break

cap.release()
cv2.destroyAllWindows()

The file must be saved with the .py extension and in my case I put it on the Desktop

Open the terminal again, access the folder where the file is contained (in my case desktop): cd Desktop and execute the command to start the file with python.

python3 camera_test.py

This will be the end result