How to load/convert image as float? #4984
Replies: 8 comments
-
|
Try using load_and_convert_image instead of load_image |
Beta Was this translation helpful? Give feedback.
-
|
Thanks. I tested it and it worked faster than OpenCV. That's awesome :) Just two more question: 1- 2- How can I see the Halide-generated C or C++ code? |
Beta Was this translation helpful? Give feedback.
-
|
Also, is there any macro to set the number of threads in Halide? |
Beta Was this translation helpful? Give feedback.
-
|
I used this code to convert OpenCV's Mat to
and used this do vice-versa:
But the Halide-blurred image seems strange! I didn't change the formula here. |
Beta Was this translation helpful? Give feedback.
-
call halide_set_num_threads(1); To my understanding, to boost up the performance, you might want to scheduler it with single-thread in mind.(without using parallel() ) |
Beta Was this translation helpful? Give feedback.
-
check this post |
Beta Was this translation helpful? Give feedback.
-
Please refer to lesson-21 |
Beta Was this translation helpful? Give feedback.
-
|
I updated that stack overflow answer with the current way to do this. The issue is that opencv stores data interleaved by default. This is slow, unfortunately, but Halide::Runtime::Buffer represents this like so:
The catch is that the generated code will expect planar inputs by default. See tutorial lesson 16 for details of how to work with different formats. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. I want to use Halide to accelerate some convolution algorithms such as GaussianBlur and Scharr (compared to OpenCV). I found an example for 7x7 GaussianBlur here. But it uses the old
Image<type>to represent the image. Compiling it with the new version of Halide says:So, I changed it to
Halide::Buffer<float>. But it seems that Halide can't load the image in float type because I get this error in runtime:What should I do? I need the float version of these convolutions
Beta Was this translation helpful? Give feedback.
All reactions