6o6o / fft-descreen

An fft-based descreen filter
MIT License
75 stars 8 forks source link

License? #3

Open ssokolow opened 5 years ago

ssokolow commented 5 years ago

Would you mind adding a LICENSE file to the repo so I know if (and, if so under what terms) I can incorporate this into my projects?

(eg. When I have time to get back at it, I've started poking at building a more specialized alternative to The GIMP for certain kinds of tasks using PyQt's GraphicsView and OpenCV for various filters. For example, OpenCV's grabcut requires much less hand-holding and tweaking then GIMP's foreground/background select.)

GitHub provides an ultra-simple guide for choosing a license.

6o6o commented 5 years ago

This is a reimplementation of several plugins, with licenses of Public Domain and GPL, so I guess those should apply to parts of code here as well.

Do you think setting this to MIT would be more reasonable? If so, how come?

Thanks for the feedback. Good luck with the project!

ssokolow commented 5 years ago

Judging by how you phrased that, I should probably give you a quick primer into how copyright licensing works.

(I'm not a lawyer, but I get a strong impression I know more about this than you do.)

This is a reimplementation of several plugins, with licenses of Public Domain and GPL

First, it's important to understand that "Public Domain" isn't a license in the same way that walking isn't a vehicle.

  1. In the beginning, the public domain was all there was. A physical copy of something was your property and laws regarding theft and trespassing applied, but anyone who legally had physical access to your copy was willing to put in the effort to make their own copy was entitled to do so. Aside from any other laws about fraud, plagiarism, etc. and any hit to their reputation if they get caught doing something unethical, they could do anything they wanted with it.
  2. Copyright grants the author a limited-time monopoly, after which, something falls into the public domain. Putting something in the public domain means giving up that monopoly early. (It was originally a "you censor what you print and we'll imprison anyone else who prints" agreement between the British crown and the printing guilds, called the Statute of Anne, but the U.S. founding fathers tried to recast it as a way to incentivize "science and the useful arts" U.S. copyright originally only applied to books and maps/charts.)
  3. A license is a way of saying "Having been given exclusive right to make copies of my creation by the government, I grant permission to person X to do thing Y as long as they obey terms Z."

Think of it as "The default state of everything is public domain. The government then temporarily grants "all rights reserved" protections to a creator to encourage them to create more. They can then grant back some of those permissions to specific people under terms of their choosing."

That's why a license can't forbid things allowed under Fair Use. Fair Use is a list of things that were never granted to the copyright holder in the first place. (ie. Forbidding Fair Use via a license is like lending someone else's car. It was never yours to give away in the first place.)

(The only reason it's legal to put stuff up on GitHub without an explicit license is that, by creating a GitHub account, you had to agree to license anything you post to GitHub for the bare minimum display and download that happen when people browse the site.)

Also, there are still a lot of things which aren't eligible for copyright. (eg. fashion designs incorporate logos because the logos are protected by trademark law, recordings of comedy acts are copyrighted but the jokes themselves are not, and mathematics and facts of nature are not subject to copyright.)

I've also read that single tweets on Twitter are too short to be able to meet some minimum creativity/novelty/originality requirement for copyright protection. (Which is apparently the reason that you can trademark a book title or character name, but not copyright it.)

so I guess those should apply to parts of code here as well.

Whether the original licenses have any hold on a rewrite in whole new language is usually a hazy thing to determine without going to court because it's determined by whether the new thing is a "derived work" of the old thing in the eyes of the law.

When you're rewriting it in a new langage, as you did here, whether it's a derived work depends entirely on whether the original implementation injected enough creativity/novelty/originality to overcome the prohibition on copyrighting math and bare algorithms. (That's why big companies do "clean room rewrites" where they have one person read the code and write a document explaining what it does and then another person writes the new code based on the explanation without ever seeing the original code.)

Again, I'm not a lawyer but, judging by the Python code, I seriously doubt it counts as a derived work of anything. It looks more like a bare-minimum transcription of an algorithm you'd pull out of a textbook or academic paper. (Heck, at that level of simplicity, a company may even be able to go to court and get it declared ineligible for copyright.)

Do you think setting this to MIT would be more reasonable? If so, how come?

When I'm choosing licenses for my own projects, I always think about it in terms of the public good.

Will the chances that you'll force someone to use a GPL-compatible license for their project outweigh the chance of someone either wasting time reinventing this or not writing their tool at all?

Were I licensing this, I'd put it under the MIT license because I just don't see the GPL having any real benefit for something this simple and minimal. Anyone who's not already planning to use a GPL-compatible license will just go look up the algorithm and rewrite more or less the same code and the only difference is that they'll have burned an afternoon on research to satisfy a legal technicality by reinventing the wheel.

EDIT: Actually, now that I think about it, I'll probably have to go read the relevant papers anyway to understand how to properly tune the algorithm's inputs so I can present a satisfyingly idiot-proof GUI. That's some pretty dense math.

6o6o commented 5 years ago

Wow, a remarkably thorough outline. Usually, the long and unreasonably complex writing style of legal documents gets in the way and just scares me off. You manage to provide a nice in-depth coverage of the topic with clear examples. I appreciate you taking the time to do this, it certainly draws a better picture of the problem.

Python has an exceptional property to express powerful ideas in single lines of code. Coming up with those lines and optimizing them may take some time though. This particular algorithm is rather simple. I developed a high-level understanding of the concept without getting into the details of rigorous math.

FFT transforms the data from spacial to frequency domain and back. This alternative representation can reveal certain insights about an image, such as the ability to detect periodic patterns, which tend to produce bright peaks in frequency spectrum (truly random noise will not work due to its chaotic, non-repetitive nature). Typically the transformation assigns more intensity to pixels in the center, so we normalize it by multiplying with a weighing matrix which contains the sum of square roots of distances to the center. This trick evens out pixel intensities and allows using binary threshold to identify peaks. It is the only part taken from Fourier plugin, with the rest of the pipeline using common processing routines, mostly borrowed from Descreen. Threshold identifies the pattern brightness, or how pronounced it is. Radius defines the size of the pattern and last parameter says what portion of the image to use for center preservation.

ssokolow commented 5 years ago

Wow, a remarkably thorough outline. Usually, the long and unreasonably complex writing style of legal documents gets in the way and just scares me off. You manage to provide a nice in-depth coverage of the topic with clear examples. I appreciate you taking the time to do this, it certainly draws a better picture of the problem.

Glad I could help.

Python has an exceptional property to express powerful ideas in single lines of code. Coming up with those lines and optimizing them may take some time though.

True, but the same is also true of mathematics, , which are unarguably not eligible for copyright. (Heck, one of the angles often used to fight against software patents is to try to get people to understand how much closer programs are to math (which isn't patentable) rather than mechanical designs (which are patentable).)

Either way, the important thing is to have some license, even if you take a legally conservative approach and go for GPL to play it safe on the "derivative work" front.

FFT transforms the data from spacial to frequency domain and back. This alternative representation can reveal certain insights about an image, such as the ability to detect periodic patterns, which tend to produce bright peaks in frequency spectrum (truly random noise will not work due to its chaotic, non-repetitive nature). Typically the transformation assigns more intensity to pixels in the center, so we normalize it by multiplying with a weighing matrix which contains the sum of square roots of distances to the center. This trick evens out pixel intensities and allows using binary threshold to identify peaks. It is the only part taken from Fourier plugin, with the rest of the pipeline using common processing routines, mostly borrowed from Descreen. Threshold identifies the pattern brightness, or how pronounced it is. Radius defines the size of the pattern and last parameter says what portion of the image to use for center preservation.

Thanks. You should really include something like this in the README so others who come in blind (or nearly so) can find it.

6o6o commented 5 years ago

Alright, will do, once I sort out some other things. Thanks.