selective_search_py icon indicating copy to clipboard operation
selective_search_py copied to clipboard

image cannot display correctly

Open auroua opened this issue 9 years ago • 8 comments

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 avatar Apr 22 '16 07:04 auroua

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

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

auroua avatar Apr 22 '16 13:04 auroua

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 avatar Apr 22 '16 13:04 auroua

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 avatar Apr 22 '16 13:04 auroua

can you fix it?

auroua avatar Apr 22 '16 13:04 auroua

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, ...).

belltailjp avatar May 10 '16 07:05 belltailjp

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

askerlee avatar Jul 28 '17 15:07 askerlee

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

sehyun03 avatar Sep 07 '17 11:09 sehyun03

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

panovr avatar Nov 21 '17 21:11 panovr