Difference between revisions of "CUVI by Example"
(5 intermediate revisions by the same user not shown) | |||
Line 145: | Line 145: | ||
==Demosaic Example== | ==Demosaic Example== | ||
CUVI demosaic, especially DFPD version is one of the most used and sought after feature of library. The sheer speed of debayering with CUVI linear debayer approach and the perfection in the resultant image in DFPD approach makes it the most demanded function of the library by camera manufacturers and video houses alike. In this example, we'll demonstrate how easy to use CUVI's own demosacing with just few lines of code. | CUVI demosaic, especially DFPD version is one of the most used and sought after feature of library. The sheer speed of debayering with CUVI linear debayer approach and the perfection in the resultant image in DFPD approach makes it the most demanded function of the library by camera manufacturers and video houses alike. In this example, we'll demonstrate how easy to use CUVI's own demosacing with just few lines of code. | ||
{| | |||
|style="font-size:130%;"| | |||
<syntaxhighlight lang="cpp"> | |||
#include <cuvi.h> | |||
CuviBayerSeq sensorAlignment = CuviBayerSeq::CUVI_BAYER_RGGB; | |||
// 8 bits data in an 8 bit container. Setting this is very important | |||
Cuvi32s containerBits = 8; | |||
Cuvi32s dataBits = 8; | |||
//Load and Upload image to GPU | |||
CuviImage input("D:/lighthouse_8bit_RGGB.tif", CUVI_LOAD_IMAGE_GRAYSCALE_KEEP_DEPTH); | |||
input.setDataBits(dataBits); | |||
//Create container for 3-channel output image | |||
CuviImage output(input.size(), containerBits, 3); | |||
//Perform Demosaic DFPD | |||
cuvi::colorOperations::DFPD(input, output, sensorAlignment); | |||
//Save resultant image to file | |||
cuvi::io::saveImage(output, "D:/lighthouse.tif"); | |||
</syntaxhighlight> | |||
|} | |||
[[File:Lighthouse.jpg|700px]] |
Revision as of 16:44, 27 March 2018
Motion Detection
CUVI library comes with all the image processing essentials that can be used to build countless applications. For example the Computer Vision module of CUVI can be used for motion and intrusion detection in a live video stream and tracking an object of interest throughout series of cameras installed in a premises. The processing pipeline for motion detection goes as follows:
- Read a frame from the camera stream
- Select Strong Features in that Frame using CUVI
- Read next frame
- Track features of first frame in the second frame using CUVI
- Set alarm if motion is detected
The CUVI functions used in this example are goodFeaturesToTrack() and trackFeatures(). For simplicity we have removed the I/O part on host side from the code
|
Here's an exact same example applied on a video feed of a webcam
Demosaic Example
CUVI demosaic, especially DFPD version is one of the most used and sought after feature of library. The sheer speed of debayering with CUVI linear debayer approach and the perfection in the resultant image in DFPD approach makes it the most demanded function of the library by camera manufacturers and video houses alike. In this example, we'll demonstrate how easy to use CUVI's own demosacing with just few lines of code.
|