GimelStudio / GimelStudio

Non-destructive, node based 2D image editor with an API for custom nodes

Home Page:https://gimelstudio.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement Edge Detect node

Correct-Syntax opened this issue · comments

Implement a core node, the Edge Detect node using either glsl or numpy/opencv. It should take in an image and output an image.

It may be a good idea to implement this as a glsl shader node for speed.

Category: FILTER

I think I may be able to help with this one.
Any other relevant details I should know?

I think I may be able to help with this one.

Thank you. This is a big help to @Correct-Syntax and I. 🙂

Any other relevant details I should know?

  • As @Correct-Syntax said, try implementing it in GLSL first
  • Take a look at the existing nodes for some examples of the API (found in the src/nodes/corenodes directory)
  • A good example of a GLSL node is the opacity node
  • To find out the GLSL code, do a search for edge detection glsl in a search engine
  • Another option is to take a look at this article which contains information about the maths and the relevant functions for edge detection in OpenCV. But as pointed out in an earlier point, try GLSL first

Hopefully this is enough to get you started. If you have any other questions feel free to ask them here (or alternatively in the Discord server).

So it's been a while, but I am working on this again. I've already written up some of the code.
I'm having trouble installing wxpython, are you guys aware of any issues there?

I do recall issues with installing wxPython, but it was a while ago since I had to.

To install the dependencies, run pip install -r requirements.txt (python3 -m pip install -r requirements.txt if on Linux) in the root directory of Gimel Studio. Let me know if you've tried that or it still doesn't work.


@Correct-Syntax it looks like this repo uses wxPython 4.2.0 while gswidgetkit and gsnodegraph use 4.1.1. Not sure if that needs to be updated

This is what I tried (pip installing the requirements), but so far no luck. I've run into several different issues, so I haven't been able to pinpoint the underlying problem.

I also noticed the dependency difference.
Fixing it locally (setting both 4.1.1) did not help.

@yonMaor what is your python version and platform?

On Windows, you should be able to install wxpython for up to python 3.10, but python 3.11+ isn't going to work quite yet.

Maybe try just installing wxpython and see what comes of it:
image

On Linux, you will probably have to download and install the wheel yourself from https://extras.wxpython.org/wxPython4/extras/linux/gtk3/

@iwoithe the difference in version shouldn't matter. Though that could definitely be updated.

@Correct-Syntax
On the Windows 10 PC I'm running Python 3.10
On the Linux (Ubuntu 20.04) I'm running Python 3.9

I'll try installing wxpython separately and let you know how it goes

No luck so far,
I have noticed that I get conflicting dependency errors (due to the different wxpython versions)

Edit:
I tried installing the packages manually through the PyCharm GUI (one at a time).
I managed to install wxpython 4.2.0 without a problem.
I ran into issues when installing gswidgetkit, but these seem to be related wxpython (it requires version 4.1.1).

I tried downgrading wxpython to version 4.1.1 manually, but the issue seems to persist.
Maybe upgrading the wxpython version in the rest of the repos will solve this issue.

I'll try later to do it from my Ubuntu computer as well.

@yonMaor ok. I'll see if I can release new versions of gswidgetkit and gsnodegraph with the wxpython dependency updated.

I'll mention that I just tried running the source with python 3.10 and it is pretty broken. Mainly because python/wxpython no longer silently converts floats to integers. I began updating the code to fix this, but I won't probably have the time to finish this week.

With Python 3.9, it does work for me on Windows though.

I tried 3.9 on Ubuntu without success, but the issues were a little different.
I'll try with a Windows 10 machine and Python 3.9.

On a different note, do you have any suggestions for an environment to test GLSL code?

On a different note, do you have any suggestions for an environment to test GLSL code?

Ideally, Gimel Studio can be used to test the GLSL (at least, that is what I did when I last worked on a GLSL node). You'll want to set this line

self.shader_cache_enabled = True
to False so that the glsl file isn't using the cached glsl when you make a change to it, though.

Everything should now be working with Python 3.10. I tested on Windows so that may be your best option.

Installing the requirements.txt directly didn't work for some reason (issues with opencv as far as I can tell).
When I tried installing the libraries manually I managed to get it to work by changing opencv to its most recent version (this could be an issue with my system though).

About testing GLSL code, using Gimel Studios works partially, since it doesn't allow me to actually debug, only to test the output. That's why I was wondering whether we have any alternative.

issues with opencv as far as I can tell

I figured that might be the case. I believe there was a reason for locking to that specific version of opencv. It may have been because of a bug that I had encountered which may be fixed now.

That's why I was wondering whether we have any alternative.

I guess I haven't really looked for one in the past, but https://shadered.org/ may work. That said, that is the motivation behind implementing a developer console to make debugging smoother (#28)