Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jcbenoit opened this issue Jul 8, 2022 · 1 comment
Open

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

jcbenoit opened this issue Jul 8, 2022 · 1 comment

Comments

@jcbenoit
Copy link

jcbenoit commented Jul 8, 2022

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.atcv::Vec3b(y, x);
by
uchar pixel = merged.at(y, x);

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

@PetteriAimonen
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants