Difference between revisions of "Function:FocusStack"
From CUVI Wiki
m (→Function) |
m (→Example) |
||
Line 63: | Line 63: | ||
===Example=== | ===Example=== | ||
{| | {| | ||
<pre style="background-color:#f7f7f7; color:#2f3337;"> | |||
std::string path = "D:/dataset/fs/imageFolder/"; | std::string path = "D:/dataset/fs/imageFolder/"; | ||
Line 95: | Line 94: | ||
cuvi::io::saveImage(focusImage, result); | cuvi::io::saveImage(focusImage, result); | ||
</ | </pre> | ||
|} | |} |
Revision as of 21:11, 3 January 2022
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 |
Error creating thumbnail: Unable to save thumbnail to destination |
Error creating thumbnail: Unable to save thumbnail to destination |
Example
std::string path = "D:/dataset/fs/imageFolder/"; std::string result = "D:/dataset/fs/focused.png"; for (const auto& entry : fs::directory_iterator(path)) { if (entry.path().has_extension() && isSupportedExtension(entry.path().extension().string())) vec.push_back(entry.path().string()); } int numImages = vec.size(); vector<CuviImage> ImgArr(numImages); //Sort filesnames to read in order. THIS IS VERY IMPORTANT FOR FOCUS STACKING sort(vec.begin(), vec.end(), lessFirst); for (int i = 0; i < numImages; i++) { ImgArr[i].create(vec[i], CUVI_LOAD_IMAGE_COLOR_KEEP_DEPTH); cout << vec[i]<< std::endl; } CuviImage focusImage; CuviFilter denoiseFilter = CuviSpecialFilters::gaussian(CuviSize(11, 11), 15.0f); cuvi::computerVision::focusStack(ImgArr.data(), numImages, focusImage, denoiseFilter); printf("\nSaving to disk.."); cuvi::io::saveImage(focusImage, result);