Comments (2)
Thanks for the report. I can reproduce this. Not sure right now about the best way to handle this because I'm not sure where the actual problem starts.
Does moments_central()[0, 0]
being -1.
make sense from an interpretation stand point?
from scikit-image.
I don't know. I don't use moments myself, and this is rather an outlier case.
This happens only with moments_weighted_normalized
which receives mu
from moments_weighted_central
.
When comparing different labels and intensities,
>>> labels1 = np.array([[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]])
>>> labels2 = np.array([[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]])
>>> intensity_pos = np.full((5, 5), fill_value=1.0)
>>> intensity_0 = np.full((5, 5), fill_value=0.0)
>>> intensity_neg = np.full((5, 5), fill_value=-1.0)
>>> regionprops(labels1, intensity_pos)[0].moments_weighted_normalized
array([[ nan, nan, 0.07407407, 0. ],
[ nan, 0. , 0. , 0. ],
[0.07407407, 0. , 0.00548697, 0. ],
[0. , 0. , 0. , 0. ]])
>>> regionprops(labels1, intensity_neg)[0].moments_weighted_normalized
array([[ nan, nan, -0.07407407, nan],
[ nan, 0. , nan, -0. ],
[-0.07407407, nan, 0.00548697, nan],
[ nan, -0. , nan, 0. ]])
If the normalization term is absolute (… / (np.abs(mu0) ** (sum(powers) / nu.ndim + 1)
), it gives identical values for the positive case, and analog values without NaN for the negative case:
array([[ nan, nan, -0.07407407, 0. ],
[ nan, 0. , 0. , -0. ],
[-0.07407407, 0. , 0.00548697, 0. ],
[ 0. , -0. , 0. , 0. ]])
But this is just a guess. This would need someone to look deeper into the math.
from scikit-image.
Related Issues (20)
- test_unsharp_masking_output_type_and_shape fails on non-x86 architectures HOT 9
- H&E and Residual, rather than HED HOT 5
- Invalid no-name-in-module from pylint on scikit-image>=0.19.0 using filters module HOT 3
- libatlas 3.10.3 related failures on debian
- Discrepancy of skimage.filters.frangi output between 0.19.3 and 0.22.0 HOT 2
- Adding `spacing` to `extra_properties`'s possible arguments in `regionprops` HOT 3
- CI fails on MacOS with "clang cannot compile programs" HOT 2
- ORB test points file should be read in x-y and not r-c
- Typo in `skimage.measure.find_contours` HOT 3
- Vulnerability: code injection HOT 9
- The Skeletonize function output wrong figure. HOT 3
- Docs mention non-existing ASV benchmarks HOT 2
- `morphology.skel` modifies input image HOT 1
- rgb2lab([1,1,1]) returns [0.,0.,0.] HOT 2
- Rolling ball algorithm scales badly with radius HOT 10
- [0.23.2] test_active_contour_model.py fails on mips64el
- Pick and place object detection for nuts and bolts HOT 2
- Unexpected result after excute morphology.skeletonize HOT 3
- Testsuite crashes with 'Bus Error' on sparc64 due to unaligned access HOT 23
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scikit-image.