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

Visual artifacts on the sample optimized images #1

Open
victordomingos opened this issue Oct 9, 2018 · 9 comments
Open

Visual artifacts on the sample optimized images #1

victordomingos opened this issue Oct 9, 2018 · 9 comments

Comments

@victordomingos
Copy link

I noticed that two of the sample optimized images shown in the Readme file have noticeable visual artifacts, that in my opinion shouldn't be present. Please take a look at this screenshot of a detail from p1_opti_by_pkikani.jpeg:

captura de ecra 2018-10-09 as 10 53 21

And this one from m2_opti_by_pkikani.jpg:
captura de ecra 2018-10-09 as 10 55 55

Notice that dust-like scattered pixels? I am not sure what is causing them, but unless the optimized images are meant to be used in very low resolution, it may be a problem.

@prashant-kikani
Copy link
Owner

Yes. I also have noticed that. I don't know why that's happening.. Its not like it appears in every image.
I tried to optimize these images in a online optimizer. There its working fine with no change in resolution & size decreased.

They are occuring in full dark / full white parts. May be median smoothing can be done to lower the effect of this noice. As median noice is an effective way to remove S&P noice.

@tuanhm11299
Copy link

I have a question, why when I return self like in the code:
`def init_leaf(self, value, freq):
return self(value, freq, None, None)

    def init_node(self,left_child,right_child):
        freq = left_child.freq + right_child.freq
        return self(None,freq,left_child,right_child)` 

The problem says:
self is not callable
Is it will cause error or nothing ? This is the first time i use Python so i dunno is it make error or not.

@victordomingos
Copy link
Author

victordomingos commented May 18, 2019

@tuanhm11299 in the last line you are returning the result of the call to a callable under the name self. Maybe it does not make sense.

Let’s see. In object oriented Python, it’s a common practice to use self in a method as a reference to the object itself (the class instance). From the code you posted, we are not able to tell what class does self refer to, and what arguments does its __init__() method expect. Can you please provide more details on your code and what you’re trying to to?

@tuanhm11299
Copy link

image
well I'm making node of huffman tree and I want to init leaf and node, so can be another way to return self ?

@victordomingos
Copy link
Author

victordomingos commented May 19, 2019

Not sure if I am understanding correctly.but if you intend to return the object corresponding to the current class instance, you may just use return self.

@tuanhm11299
Copy link

Oh i see, maybe new versions of Python have no return like my code :D

@victordomingos
Copy link
Author

I am not sure that defining a a class inside another class is very “pythonic”. What I would expect is something like defining a new class that inherits from the previous one.

Concerning the return statement, you may do something like return __Node(.....), which will allow you to generate a new instance of that class on return. Is that what you meant?

@tuanhm11299
Copy link

Yeah that's what I meant, sir. :D

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

4 participants
@victordomingos @prashant-kikani @tuanhm11299 and others