4K Camera Now Working

A project log for Crop Orientated Agricultural Navigation System

Navigate an agri-robot using the crops themselves as the guide via computer vision.

Tegwyn☠TwmffatTegwyn☠Twmffat 07/22/2019 at 15:480 Comments

It's only taken me 2 months to work out how to get the camera working without buying a 4K monitor, mostly thanks to a reply on the Nvidia community forum, which is pretty fantastic.

#import "cudaResize.h"
CUDA(cudaResizeRGBA((float4*)imgRGBA, camera->GetWidth(), camera->GetHeight(),
          (float4*)imgRGBA, texture->GetWidth(), texture->GetHeight()));   

Place the above before "CUDA(cudaNormalizeRGBA()" in the draw section at the bottom of the main loop. In the section near the top where the code creates the display and texture, either set your texture size to a custom value or divide it by an amount that brings it into the size of your display properly. I divided the camera size by 2 for my needs.

texture = glTexture::Create(camera->GetWidth()/2, camera->GetHeight()/2, GL_RGBA32F_ARB/*GL_RGBA8*/);

The camera frame now needs to be split up into 6 grids for the new resolution and calculations made to take account of the perspective every time the camera is moving to a new position.