Difference between revisions of "Function:FocusStack"
From CUVI Wiki
| Line 40: | Line 40: | ||
|} | |} | ||
===Image Type Support=== | ====Image Type Support==== | ||
{| | |||
|style="font-size:75%;"| | |||
{|class="wikitable" | |||
|- | |- | ||
! Input | ! Input | ||
| Line 52: | Line 53: | ||
| 16uC3 x N | | 16uC3 x N | ||
| 16uC3 | | 16uC3 | ||
|} | |||
|} | |} | ||
Revision as of 14:21, 18 October 2022
Stacks multiple images into a single image. Images need to be aligned.
Function
|
Parameters
|
Image Type Support
|
Samples
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);


