Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image cannot display correctly #16

Open
auroua opened this issue Apr 22, 2016 · 8 comments
Open

image cannot display correctly #16

auroua opened this issue Apr 22, 2016 · 8 comments

Comments

@auroua
Copy link

auroua commented Apr 22, 2016

I have installed with no errors, but when I run the demo_showcandidates.py, the image can not display correctly, the image looks like this:
screenshot - 2016 04 22 - 15 35 33
the image can display when I use the following code

from skimage.viewer import ImageViewer
    viewer = ImageViewer(img)
    viewer.show()

screenshot - 2016 04 22 - 15 39 10

@auroua
Copy link
Author

auroua commented Apr 22, 2016

I have solved this problem
the code
demo_showcandidates.py line35 should be

        self.qimg = QImage(ndimg.data, w,  h, QImage.Format_RGB888)

@auroua
Copy link
Author

auroua commented Apr 22, 2016

there two test can not pass

class TestMergeSimilaritySet:

error message:

feature_extractor = <class 'test_selective_search.Feature'>
Ak = {0: set([1, 4]), 1: set([0, 4]), 4: set([0, 1])}, S = [(1, (0, 1))], i = 2
j = 3, t = 4

    def _merge_similarity_set(feature_extractor, Ak, S, i, j, t):
        # remove entries which have i or j
        S = list(filter(lambda x: not(i in x[1] or j in x[1]), S))

        # calculate similarity between region t and its adjacencies
        St = [(feature_extractor.similarity(t, x), (t, x)) for x in Ak[t] if t < x] +\
>            [(feature_extractor.similarity(x, t), (x, t)) for x in Ak[t] if x < t]
E       TypeError: unbound method <lambda>() must be called with Feature instance as first argument (got int instance instead)

hdd/workspace/PycharmProjects/selective_search_py/selective_search.py:60: TypeError
============== 11 tests deselected by '-k TestMergeSimilaritySet' ==============
=================== 1 failed, 11 deselected in 0.40 seconds ====================

@auroua
Copy link
Author

auroua commented Apr 22, 2016

the second one is :

class TestFeaturesColorHistogram:

error message:

hdd/workspace/PycharmProjects/selective_search_py/test_features.py .F
self = <test_features.TestFeaturesColorHistogram instance at 0x7f93250bca70>

    def test_1region_255color(self):
        self.setup_method(self, w = 1, h = 256)
        for y in range(self.h):
            self.f.image[y, :, :] = y

        hist = self.f._Features__init_color(1)
        assert len(hist) == 1
        assert hist[0].shape == (75,)
        r_expected = [11] * 23 + [3, 0] # because bin width equals 11
        g_expected = [11] * 23 + [3, 0]
        b_expected = [11] * 23 + [3, 0]
        expected = numpy.array(r_expected + g_expected + b_expected)
>       numpy.testing.assert_array_almost_equal(hist[0].ravel(), expected / numpy.sum(expected))
E       AssertionError: 
E       Arrays are not almost equal to 6 decimals
E       
E       (mismatch 96.0%)
E        x: array([ 0.014323,  0.014323,  0.014323,  0.014323,  0.014323,  0.014323,
E               0.014323,  0.014323,  0.014323,  0.014323,  0.014323,  0.014323,
E               0.014323,  0.014323,  0.014323,  0.014323,  0.014323,  0.014323,...
E        y: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
E              0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
E              0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
E              0, 0, 0, 0, 0, 0])

hdd/workspace/PycharmProjects/selective_search_py/test_features.py:35: AssertionError

@auroua
Copy link
Author

auroua commented Apr 22, 2016

can you fix it?

@belltailjp
Copy link
Owner

belltailjp commented May 10, 2016

Can you share the original image file that you specified to the code if you still have?
Since I cannot reproduce the situation, guessing the image file is something special format that I hadn't supposed (like endian, alpha channel, ...).

@askerlee
Copy link

I met the same problem as @auroua . His fix works for me. The image used is:
https://www.dropbox.com/s/esdu4vevnnk0yev/breadmix.png?dl=0

@sehyun03
Copy link

sehyun03 commented Sep 7, 2017

Same issue for me. @auroua 's fix works.

@panovr
Copy link

panovr commented Nov 21, 2017

Same issue for me. @auroua 's fix works. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants