patrikhuber / eos

A lightweight 3D Morphable Face Model library in modern C++
Apache License 2.0
1.92k stars 598 forks source link

extract_texture(...) (v1) giving weird results on Android #315

Closed yygbruce closed 4 years ago

yygbruce commented 4 years ago

Hi patrikhuber, When I use the lib with android, I have the following problems:

out isomap I have checked the rendering parameters, no problem.So I think It was caused by the function of extract_texture, and the question just append in android system.

patrikhuber commented 4 years ago

Hi,

Good question what could be going on here. It could have to do with the visibility/z-buffer, or perhaps an invalid memory access somewhere. The first thing I'd do is run a debug build, where asserts are enabled. I am thinking that it's likely one of the asserts in the code will fire. Second, you could try the extract_texture(...) from the devel branch (this was previously in the render::v2 namespace) - this method will become the default in the near future.

yygbruce commented 4 years ago

Hi,

Good question what could be going on here. It could have to do with the visibility/z-buffer, or perhaps an invalid memory access somewhere. The first thing I'd do is run a debug build, where asserts are enabled. I am thinking that it's likely one of the asserts in the code will fire. Second, you could try the extract_texture(...) from the devel branch (this was previously in the render::v2 namespace) - this method will become the default in the near future.

Yes, It work.But another question append in PC and android.The backgroud color is not transparent: out isomap

yygbruce commented 4 years ago

Hi, Good question what could be going on here. It could have to do with the visibility/z-buffer, or perhaps an invalid memory access somewhere. The first thing I'd do is run a debug build, where asserts are enabled. I am thinking that it's likely one of the asserts in the code will fire. Second, you could try the extract_texture(...) from the devel branch (this was previously in the render::v2 namespace) - this method will become the default in the near future.

Yes, It work.But another question append in PC and android.The backgroud color is not transparent: out isomap

Thanks! I have solved this problem, after I changed the the file of Rasterizer.hpp(line 52): colorbuffer = eos::core::image::constant(viewport_height, viewport_width, eos::core::Pixel<std::uint8_t, 4>(0, 0, 0, 0)); In addition, I alse changed the file of opencv_interop.hpp(line 113),: inline Image4u from_mat_with_alpha(const cv::Mat& image) { Image4u converted(image.rows, image.cols); if (image.type() == CV_8UC3) { for (int r = 0; r < image.rows; ++r) { for (int c = 0; c < image.cols; ++c) { converted(r, c) = {image.at(r, c)[0], image.at(r, c)[1], image.at(r, c)[2], 255}; } } } else if (image.type() == CV_8UC4) { for (int r = 0; r < image.rows; ++r) { for (int c = 0; c < image.cols; ++c) { converted(r, c) = {image.at(r, c)[0], image.at(r, c)[1], image.at(r, c)[2], image.at(r, c)[3]}; } } } else { throw std::runtime_error("Can only convert a CV_8UC4 cv::Mat to an eos::core::Image4u or eos::core::Image3u."); } return converted; }

patrikhuber commented 4 years ago

Sounds good! I'm not sure whether this is/was really a problem with eos on Android, or something local to your system/setup. So I would close this from my side, if you are happy?

yygbruce commented 4 years ago

Sounds good! I'm not sure whether this is/was really a problem with eos on Android, or something local to your system/setup. So I would close this from my side, if you are happy?

Of course!I look forward to your good news。