PetteriAimonen / focus-stack

Fast and easy focus stacking
MIT License
249 stars 37 forks source link

3dView not working with grayscale 8-bit input images #24

Open jcbenoit opened 2 years ago

jcbenoit commented 2 years ago

Task_3DPreview::task() supports only input color RGB images. Would be great to add support for input grayscale 8-bit images. It just need to add a switch instruction, and handle the different images types.

for grayscale 8-bit: case: replace line cv::Vec3b pixel = merged.at(y, x); by
uchar pixel = merged.at(y, x);

and replace lines m_result.at(cam_y_d, cam_x) = cv::Vec4b(pixel[0], pixel[1], pixel[2], 255); m_result.at(cam_y_d, cam_x + 1) = cv::Vec4b(pixel[0], pixel[1], pixel[2], 255); by m_result.at(cam_y_d, cam_x) = cv::Vec4b(pixel, pixel, pixel, 255); m_result.at(cam_y_d, cam_x + 1) = cv::Vec4b(pixel, pixel, pixel, 255);

PetteriAimonen commented 2 years ago

Makes sense. If you can make a pull request I'll merge it, otherwise I'll add this myself once I have time.