Difference between revisions of "Function:FocusStack"

From CUVI Wiki
Line 70: Line 70:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
std::string path = "D:/dataset/fs/imageFolder/";
std::string result = "D:/dataset/fs/focused.png";


CuviImage gimg = cuvi::io::loadImage(path);
CuviImage gimg = cuvi::io::loadImage(path);

Revision as of 06:29, 28 April 2021

Stacks multiple images into a single image. Images need to be aligned.

Function

CuviStatus focusStack(const CuviImage* ImgArr,
                  const int numImages
                  CuviImage& sharpImage,
                  CuviFilter denoiseFilter
                  const CuviStream& stream = CuviStream());

Parameters

Name Type Description
ImgArr const CuviImage* Input images array
numImages const int Number of images
sharpImage CuviImage& Resultant image
denoiseFilter CuviFilter Filter to remove noise
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8uC3 x N 8uC3
16uC3 x N 16uC3

Samples

Error creating thumbnail: Unable to save thumbnail to destination
Input image with foreground focused
Error creating thumbnail: Unable to save thumbnail to destination
Input image with background focused
Error creating thumbnail: Unable to save thumbnail to destination
Focus-Stacked Image

Example

std::string path = "D:/dataset/fs/imageFolder/";
std::string result = "D:/dataset/fs/focused.png";


CuviImage gimg = cuvi::io::loadImage(path);

const Cuvi32f xScale = 0.5f, yScale = 0.7f;

const Cuvi32s newWidth = static_cast<Cuvi32s>(gimg.width() * xScale);
const Cuvi32s newHeight = static_cast<Cuvi32s>(gimg.height() * yScale);

CuviImage gout(newWidth,newHeight,gimg.type());


//Re-sizing input image to fit output container using bicubic interpolation
cuvi::geometryTransforms::resize(gimg,gout, CUVI_INTER_CUBIC);