DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

add texture filter/interpolation options for nearest neighbor

Open west-rynes opened this issue 4 years ago • 20 comments

Describe the solution you'd like Currently textures appear to use linear interpolation by default. It would be great if we had the option to specify nearest neighbor interpolation as an option. At times. for certain applications this is more appropriate. I think most of the graphics backends allow specifying a texture filter option. This would be valuable for both the draw_image and image_series plots.

west-rynes avatar Apr 01 '21 11:04 west-rynes

Interesting. I was waiting on someone to request this!

hoffstadt avatar Apr 01 '21 12:04 hoffstadt

Hello, I too require texture filtering options since I want to draw some images scaled up, but with nearest filtering.

CaiusTSM avatar Aug 29 '21 01:08 CaiusTSM

We are expecting this is 1.3. It will be a bit easier than we thought originally (learned some more advanced imgui features that will help)!

hoffstadt avatar Dec 30 '21 21:12 hoffstadt

That will be great. Glad it’s not too much work. Thank you.

west-rynes avatar Dec 31 '21 00:12 west-rynes

That's really good to hear! Keep us posted on the progress on this please =)

Moonspire avatar Dec 31 '21 03:12 Moonspire

Any update on this feature yet?

JonathanZhuMD avatar Apr 26 '22 16:04 JonathanZhuMD

I’m definitely looking forward to being able to have the option for nearest interpolation.

west-rynes avatar Apr 26 '22 17:04 west-rynes

Actually, I'm just looking for a way to disable all any kind of interpolation at once, not sure if that'll be easier or not.

For nearest neighbor, why don't you create a simple 3x3 kernel with open CV and do the upscaling yourself?

JonathanZhuMD avatar Apr 26 '22 18:04 JonathanZhuMD

@JonathanZhuMD I have an image viewer that the user zooms into. So I really don’t want to pre scale sub windows and then send it to textures. I just want the user to see to be able to zoom and see pixel boundaries. Nearest neighbor is really the equivalent of turning off interpolation.

west-rynes avatar Apr 26 '22 23:04 west-rynes

i've reposted a similar question https://github.com/hoffstadt/DearPyGui/issues/1915 , has there been any news? we are at v 1.7, but i don't think this has been implemented

wlwatkins avatar Oct 21 '22 07:10 wlwatkins

It has not been implemented yet. We do still plan on doing so for the 1.x version. It's one of the last bigger features for 1.0.

hoffstadt avatar Oct 22 '22 03:10 hoffstadt

I know it's an annoying question, but any clue of the timeline? asking to know whether i should keep with the low performance heatmap or in i can start implementing the image expecting the feature

wlwatkins avatar Oct 22 '22 17:10 wlwatkins

Just piping in to say we'd love to see this! Thanks!

keck-in-space avatar Mar 30 '23 20:03 keck-in-space

I agree, would be wonderful to have for scientific applications

west-rynes avatar Mar 30 '23 22:03 west-rynes

any news about this? is there a way i coud help?

wlwatkins avatar Mar 31 '23 21:03 wlwatkins

I don't think there any official update on this matter yet. I manage to circumvent the issue by manually upscale the image by a pre-determined factor; however it does uses much more memory since I'm sharing frames across processes with sharedmem. Sent from my iPhoneOn Mar 31, 2023, at 16:23, Will @.***> wrote: any news about this? is there a way i coud help?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

JonathanZhuMD avatar Mar 31 '23 21:03 JonathanZhuMD

I don't think there any official update on this matter yet. I manage to circumvent the issue by manually upscale the image by a pre-determined factor; however it does uses much more memory since I'm sharing frames across processes with sharedmem. Sent from my iPhoneOn Mar 31, 2023, at 16:23, Will @.> wrote: any news about this? is there a way i coud help? —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.>

That is definitely a good option if your images are not too big. For the data I’m working with the images are huge so it just isn’t feasible unless I do a bunch of sub windowing with zooming and then upscale g which seems a bit overboard.

west-rynes avatar Mar 31 '23 21:03 west-rynes

Same here actually. We have 4 camera streams we need to display together.

We ended up purchased a few of the macStudio with 128GB RAM; it will be nice if there is a low-cost option to solve the problem though lol.

On Mar 31, 2023, at 4:37 PM, Anthony Tanbakuchi @.***> wrote:

I don't think there any official update on this matter yet. I manage to circumvent the issue by manually upscale the image by a pre-determined factor; however it does uses much more memory since I'm sharing frames across processes with sharedmem. Sent from my iPhoneOn Mar 31, 2023, at 16:23, Will @.> wrote: any news about this? is there a way i coud help? —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.>

That is definitely a good option if your images are not too big. For the data I’m working with the images are huge so it just isn’t feasible unless I do a bunch of sun windowing with zooming and then upscale g which seems a bit overboard.

— Reply to this email directly, view it on GitHub https://github.com/hoffstadt/DearPyGui/issues/773#issuecomment-1492639702, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB5NYI6BYSBYMVLHUH6C4TW65FDDANCNFSM42G6TOMA. You are receiving this because you were mentioned.

JonathanZhuMD avatar Mar 31 '23 21:03 JonathanZhuMD

A workaround is to modify the source code of DearPyGui and build it by yourself.

NOTICE: this changes the behavior of DearPyGui, so I recommend using venv so that the scope of influence is limited to your project.

I explain the procedure for Windows.

  1. Install Visual Studio.

    You need to install Desktop development with C++.

  2. Clone the DearPyGui repository.

  3. Modify the source code as follows.

    File: <repo_root>/thirdparty/imgui/backends/imgui_impl_dx11.cpp

    Change: replace D3D11_FILTER_MIN_MAG_MIP_LINEAR with D3D11_FILTER_MIN_MAG_MIP_POINT

    This changes the default behavior of Dear ImGui which DearPyGui uses.

  4. Modify the build script setup.py if you use a version of Visual Studio other than Visual Studio 2019.

    Modify the CMake path and cmake option. For a case of Visual Studio 2022, replace Visual Studio 16 2019 in the cmake option with Visual Studio 17 2022.

  5. Run the build script with build option.

    python setup.py build

  6. Copy the built _dearpygui.pyd file to the site-package directory.

    If you use venv, the destination path would be:

    <venv_dir>/Lib/site-packages/dearpygui/_dearpygui.pyd

I built with Visual Studio 2022 successfully, but not sure if it can be built with compilers older than Visual Studio 2019.

Yosh31207 avatar Jul 07 '23 14:07 Yosh31207