Open laverne01 opened 2 months ago
Good question. Please refer to this commit https://github.com/ArchieMeng/ncnn-android-waifu2x-demo/commit/440d3b4e5ad85b38bba17a925626c50a60c58133 . The ncnn::Mat share the raw image buffer with the Android Bitmaps, and then there is no need to copy back.
Thank you for your explanation. I tried copying data from ncnn::Mat out to an Android bitmap using the function out.to_android_bitmap(env, out_bitmap, ncnn::Mat::PIXEL_RGB2RGBA) to make the code cleaner to read. However, it seems there's some error with this function that I can't identify. Could you help me with this?
It is because the difference in pixel storage format. In ncnn::Mat, it may use floating numbers while Android bitmap uses int. However, don't you think the current process function is enough readable? Is there any parts that you still cannot understand and need comments?
Thank you. After some time struggling, I now understand your code, and it executes and runs wonderfully. Thank you for these great explanations.
I am having trouble understanding your code, specifically at line 137 in the file waifu2x_jni.cpp (waifu2x->process(in, out);). It seems that after the model processes, the ncnn::Mat out is not being written to out_bitmap. Is that the case? I hope you can explain this to me. Thank you.