Closed JM0000123 closed 1 year ago
The latest commit in the experimental branch adds a command 'autothresholdvalue' that retrieves the threshold value the autothreshold command would use. The command can be used from Python using a short-hand like this:
img = pi.read('some file')
val = pi.autothresholdvalue(img, 'Otsu')
print(val)
Let me know if this works for you.
Thanks for the quick reply and implementation. Now I just have to figure out how to make the experimental version works (I used the release 4.3 before to do the "installation"), but after I am sure it will be perfectly fine.
The new functionality is now included in release v4.4-experimental1.
Thanks you so much for the pre-release, it saved so much of my time 👍 I completed some tests on the autothresholdvalue function and it worked well, treshold value is returned. I just have one more question, what is the exact meaning of :
Calculates threshold value for the input image, according to a selected thresholding method, and places it into the output image.
because I am not sure to get this last bit... as if I only use autothresholdvalue, image itself is not thresholded so I need to add a autothreshold operation to threshold the image. This is only for my understanding, I could obtain what I desired with this new release. Thank you again for your reactivity and work
what is the exact meaning of :
Calculates threshold value for the input image, according to a selected thresholding method, and places it into the output image.
This is a "bug" in the documentation. The docs are auto-generated and describe the internal commands that the pi2 backend provides for Python, C# etc. front-ends. The internal commands are 95 % the same than what you access from Python, but there are a few differences. These include commands newimage, read, etc. and now autothresholdvalue. So, internally the command looks like
autothresholdvalue(input, output)
but the Python interface converts it to form
val = pi.autothresholdvalue(input)
by stripping the output image away. This is done to make working in Python easier, but is not reflected in the documentation.
I will probably try to fix the docs in some point.
Hello Arttu, thank you for this realy good package. I have been wondering if it would be possible to extract the threshold value in the case of the the autothreshold function? As this could be a very interesting information to retrieve from the function. Do you have any idea how to do that? Thanks. Best regards
Julien