Saturday, November 14, 2015

Olsen Noise Implicit Boxiness, or Causing Artifacting With Interpixel Levels

If for whatever reason you need something that does a full range of levels rather than discrete levels, you'll find Olsen Noise to cause artifacting, if you try to achieve that by doing a non-floored division on the blur. The problem is within the scopes it does a few operations:

upsample & adjusts position for scoping.
applies blur,
applies noise.

Well, the upsample are squares and the blur is a box blur, applied for each given level. The blur could well just be a high sigma gaussian of upsampled and speckled landscape (infinite scoped field).

Without blurring the pixels at various level become apparently. It's a bunch of noisy pixels and different levels (and thus sizes) which then gets blurred successively, rather than something like midpoint displacement in diamond squared. This works, but only if the edges are not allowed to propagate. Typically this is because the number of blurs will clip out the error so that the topmost iteration, none of it could persist. Well, if you're doing things where the difference between 0 and 1 matters to you, something other than voxel height maps or images where very tiny but ultimately discrete distances from one pixel to the next matter, then the obvious seeming desire is to have the blur (total / 9) rather than floor(total/9). As this will result in a non-boxy set of levels and give you artifacting as you cannot fully clip the edge of the giant deep-level pixels.

For clipped floored blur between the areas.

Without clipping during the blur process.

The latter method causes artifacting from those boxes being blended but not clipped. So the impact of the difference between one pixel and the next at the iteration=0, will *still* exist in the final image. Rather than be guaranteed to be eaten by the rounding in the blur. Since every pixel transition will always have a non-zero effect on the final image, and pixels are square. It produces square artifacts if you don't clip. If you do, then you get boxes. You could apply a final blur that doesn't clip to the end result.

So get the boxy version, then blur that, and get it looking smooth and artifact free.

Thursday, October 15, 2015

Renderscript Olsen Noise

Converted Olsen Noise to Renderscript for speed purposes. Then cheated and added caching. Made it into a live wallpaper somewhere.

Thursday, September 10, 2015

Android Memory Compact Draw Segments drawLines();

if (count >= 4) {
    if ((count & 2) != 0) {
        canvas.drawLines(pointlist, 0, count-2, linePaint);
        canvas.drawLines(pointlist, 2, count-2, linePaint);
    else {
        canvas.drawLines(pointlist, 0, count, linePaint);
        canvas.drawLines(pointlist, 2, count - 4, linePaint);

If anybody needs to draw a bunch of lines from a float[] of points (not segments). Somebody is going to go OMG that's way better than how I was doing it!

Wednesday, September 2, 2015

Clever, even for me.

If you do deny me life, liberty or property, I do not care if you believe that a space-turtle on a mountain gave you religious permission to do that, you don't have that right. And if you do that to all black people, all gay people, all woman on equally nebulous grounds; you have no right, and you're a bigot.

Wednesday, August 19, 2015

Matthew 20:29, Mark 10:46-47 Why add a blind man?

I think Matthew just changed it to fit better with the two brothers of Zebedees. The parallel in Mark is largely that of the blind seer. The idea is that the apostles are dumb as a sack of hammers and don't see that Jesus is the Messiah. But, the blind man without eyes proclaims him "son of David" and asks to be healed and then follows him. Whereas the Apostles see with their eyes him feeding thousands and do not see at all. In the Odyssey the blind seer warns Odysseus of the suffering to come as he returns home. Here we have Jesus just before the passion.

It was a pretty common theme in many Greek myths that the blind seer would see what the seeing people could not. In Oedipus it's followed by the extra irony of him blinding himself after the seer's prophecy came true. Here Jesus keeps doing miracles extremely giant miracles and the apostles don't understand no matter how many times they are told. But, the blind man instantly knows and completely understands.

The change that Matthew made goes less towards the allusion to the Greek myth and more directly parallels the brothers of the Zebedees who just before are asked to sit at the right and left of Jesus. And Jesus says that that isn't up to him. Then Jesus heals the two blind men who follow him without ambition and see what the apostles cannot. One presumes they follow him on the right and left to Jerusalem, and towards the coming passion.

Rather than just an unassociated blind seer that basically is cribbed from Homer. We get phantom parallel and reversed James and John (Zebedee). The apostles are see but are blind to the truth. They ask for honors that are not earned. The blind men cannot see but already know the truth. And they follow, where the apostles shall scatter.

It really is brilliant mythology.

Saturday, August 15, 2015

Anti-suffragette's argument.

"A stranger from another planet, ... would certainly be led to believe that Christians are, and always have been, unable to tolerate so cruel and inhuman an institution. It is even suggested that it was the Church of Christ which finally abolished this unholy practice. Christianity abolish slavery! Why, slavery was maintained under Christianity for over eighteen hundred years; while in America after all those centuries a Christian people fought a bitter and bloody war, lasting four long years, and suffered the loss of a millions of men and money before they would give it up!" - Mrs. John Martin (1910)

Sunday, July 26, 2015

Anti-suffragettes and progress.

So I decided to study up on the arguments against women's suffrage and the people who argued and rallied for that point of view. I've run into a number of time when my arguments for slavery as given by the people who argued it during antebellum has come in handy.

It turns out, not at all to my surprise, that a lot of them were women. Like basically all the big hitters were woman.

They were often depicted as hating immigrants and thus not wanting them to get the vote and being puppets of their husbands, but they were generally socially conscious. The founder of largest group there was also important with the implementation of the earliest kinds of day care (day nursery). And generally were maligned as backwards and overly clinging to Victorian ideas of gender roles. Women do the housework, child care, and social work. Men do the dirty works of politics. They weren't oddly enough, just prissy rich bitches hating on people. They, like basically everybody, thought they had a genuine point.

I quickly ran into National Association Opposed to Woman Suffrage (NAOWS) and some of their meetings as such: "Feminism and the woman's movement last night received such a drubbing as only a sister woman could give, when some 200 active members and friends of the New York State Association Opposed to Woman Suffrage gathered in the home of Mrs. Henry Seligman at 30 West Fifty-sixth Street to hear Mrs. John Martin, the Charlotte Perkins Gilman of the No-votes-for-women movement, tear to tatters the great new Cause."

30 West 56th is still there and is a five story mansion, though today it's between D&S Market and a Sushi place.

So who was this Mrs. John Martin?
"The most important question in the world." Is mankind advancing? - "Mrs. John Martin"

Apparently she was quite intelligent and quite wrong. She wrote the above book, which basically argued that we are not advancing because despite all our high technology and discovery it paled in comparison to the art and science of the ancient Greeks as measured by the number of notable figures in the past. Clearly she knew far more well-known geniuses in the past than she knew of in the future. And nobody can carve a picture on a gem worth a damn anymore. Clearly we aren't progressing!

Pablo Picasso - Girl-with-Mandolin (1910)

This was written in 1910. So Picasso had just entered his cubism period and Einstein was just made a professor and had five year earlier set forth the basis for relativity, quantum mechanics, explained brownian motion while proving atomic theory, and explained the photoelectric effect which is how solar panels work.

Update: So I don't forget the posters.

Tuesday, June 30, 2015

Social Justice, Gay Marriage, Rightness.

I've supported gay marriage for decades (literally since 1993 when I first heard it was a thing) and thought the constitutional argument was pretty cut and dry. I mean it's the exact argument in Loving applied to gender rather than race. But, nothing happened. All the court cases were against it and every time people voted, they voted against it. Then, a couple years back. Support crept into a majority and like a whirlwind it all came crumbling down.

As much as I would like to believe that a minority with justice on their side can win for the sake of justice itself, I must say that the truth is getting more than half of the citizens in a democracy on your side, seems more effective with regard to social change than being right.

Friday, June 19, 2015

Pareidolia in computers.

This is actually pretty awesome. If you train computers to see things, they dream them out of noise.

Thursday, June 11, 2015

Religion, science, the pursuit of truth and accountability.

Written elsewhere but to brilliant to let stagnate on some dinky youtube comment.

A) I do craft my replies in part for onlookers rather than the person. I did vaguely assume you were Christian. But, if you compare my reply to you with mine to Wayne, you'll see the distinction of vaguely citing "your religion" and my references to early Christian beliefs was to show that the belief in the Flying Spaghetti Monster was on just as strong of theological grounds. Especially with regard to the spiritual reflections of earthly things in the realms of heaven. That in so far as there was an early spiritual belief there would have been divine bodies. As such there could be divine spaghetti which isn't made but for which the spaghetti on Earth is just a fallen flawed reflection of that which is in heaven. My point here wasn't specifically to assign you a religion, but to say that any religion you claim is going to be justifiable as any false religion is justifiable. -- And that's actually a problem.

I will say, however, that there are some forms of pantheism which accept reality as it is, and simply call reality God. Which claims no spiritual nature to reality beyond the numinous, and a personal apotheosis of the universe itself without any claims of personification therein. That religion has a god that exists, and is backed by acceptable evidence; I do not agree that the universe should be a God, but there are those within Scientific Naturalistic Pantheism who don't care they take it only as a personal decision on their part. -- That religion is actually justified well beyond the magical man in the sky kinds of religion or those who think prayers are answered by telepathically interested personal deities. But, for most of the religions whose gods don't actually exist, who have no better evidence for their truth than false religions have for their truth, my argument stands.

What you appear to be describing is awe which the universe actual inspires which doesn't actually seem to require worship of a Judeo-Christian God or Jesus, or actually any sort of magic, just an understanding that we are star stuff and the universe comprehending itself made manifest. Though, I don't see how this doesn't agree that Mormonism and Islam are false religions. Are we really going to be brought before Allah and asked to defend our actions on Earth? Or sent to the lesser of the celestial kingdoms, by God, Jesus and Joseph Smith? These are just things people would make up. And as far as I can tell, even a casual stroll through an insane asylum would prove that faith proves nothing. -- I've never seen faith move mountains, but I have seen what it can do to skyscrapers.

B) Actually they tend to use spirit with things that are clearly false. If Adam and Eve don't die the same day they ate the fruit from the tree of knowledge then they died a spiritual death while they lived on another thousand years or so. Harold Camping's rapture didn't come as May 19th came and went, so it became a Spiritual Rapture. The same reply that some of the Millerites had. The word itself doesn't really reflect anything, so it basically means magically X ~= X. It's X is spiritual therefore X = X AND X ~= X. So yeah, Spaghetti on Earth is made of matter. But, Spiritual Spaghetti is not made of matter it's made of spirit and is *still* spaghetti, because why not? The word itself doesn't actually mean anything.

I know the meaning of the words in the various languages. I said in Hebrew it meant breath, soul, etc. I was referring to nĕshamah. (Strong's H5397 rather than H7307). Namely the bit about God breathing in the nostrils of his golem like critter of Adam and making him a living soul/breath/spirit. Pneuma is Greek but has later theological connotations namely that it was said to be the substance of spiritual stuff, such as the Stoics, and with regard to early Christian theology the Greek and Roman philosophical ideas here matter, dating back to Aristotle who held that the Pnuma within sperm caused them to move. I was trying to invoke this tradition when I said "made out of Pneuma".

Matter is made by the Higgs field and the slowing down of baryonic matter with regard to gravity. The standard model is pretty clear here. As well as relativity which correctly notes that matter is made out of energy. We actually have a complete view of this now, and know that it doesn't require spirit (whatever that means) it requires quarks. Originally it was certainly a search for understanding. You will find no lack of knowledge or understanding on my part of that reality. I could go on endlessly about how even some absurd early ideas were actually really good and amazing searches for knowledge. While it might seem strange to look at Aristotle's view that Pnuma caused sperm is part of a long tradition towards ideas of Preformation and attempting to explain how reproduction work. Rather than scoff at these ideas I happily accept that they were great ideas. That Ptolemy was a genius for his theories. That for most of human history any rational logical thinker would have to look at the argument from design and conclude as Paley did that there was, in fact a designer. That even with the holes in it, that was by far the obvious conclusion that rational people would have to take. Views which I have taken a lot of flack for, I'm more than happy to accept that people are simply biased towards knowing what they know. And take for granted that children know more of medicine than the Father of Medicine, that our understanding of the world is not just better today but many millions of times better. People often mistake the ancients for imbeciles and their wrongness for stupidity, but they were geniuses and drawing the best conclusions they could from incomplete data, and if you properly understand that our understanding of the world is largely a *result* of their search for truth and understanding rather than superior to their flawed reasonings we can see that even them going around shooing demons out of people was simply their best explanations at play. That people like Nicolas Malebranche was brilliant when he proposed that the little people who lived in sperm had within them little people in their sperm and on and on back like Russian nesting dolls all the way back to the Fall of Man as explaining not just how biology worked but why the fall of Adam and Eve also doomed all of mankind (because all of mankind was within them). I can show pretty easily that even a lot of great mistakes where brilliantly made, and that there was no malice in the errors. In fact, we all make errors and the faster we accept that they were not stupid for being wrong, and that being wrong is the fastest way to becoming right, and that being wrong feels exactly like being right, we do ourselves a very great favor.

The problem here isn't being wrong. Or claiming that those who looked up in the skies and saw the works of gods embedding little stars on a dome of heaven that must be as strong as metal to keep out the waters of heaven from drowning them. I actually am very happy to accept that given what they knew, those are entirely reasonable conclusions to make. And that merely being wrong is blameless. That Paley's argument was well written and justified. That Hume was right to object to many of the issues in the watchmaker argument and finally to concede that he could find no better explanation. That Ptolemies planets flowing around on circles in circles, as they revolved about the Earth was entirely less wrong than the theories before them. That wrongness is not an absolute but a scale of sorts and religion was once a honest and noble extension of this search.

I am not apathetic on the topic. You will find that I'm actually quite passionate with regards to history and our search for the truth.

The problem here is that religions are false. If one views them in that light we must accept that their time has gone the way of geocentric models. That Jesus shooing demons out of people would have made sense to those people but that isn't how diseases actually work. That the all powerful creator of the world wouldn't have told people that washing their hands and plates was completely unneeded and then later in the very same chapter went to shoo away a demon from people after they admit they are bitches (Mark 7). It isn't that geocentrism is wrong. But, that if religions were true they might have know the way the stars go. And while theology has made a goodly number of attempts to forgive themselves. To say that the Bible teaches how one should go to heaven, and not how the heavens go. It's simply not the case that many of the thoughts and truths are the best that exist today. Most are not really worth our time because we have a much better understanding of reality. We can go ahead and insist that souls exists because ancient people understood that when people stop breathing they lost their lives, they "gave up the ghost" they "exhaled the pneuma". But, we know that bodies are well evolved machines that do and should stop working eventually. That genes combine and operate in such a way to actually build bodies from scratch each time and don't have a little homunculi living within them, that there was no global flood four thousand years ago, but that local cultures invent flood stories because they live near waters and the one in the Bible dates back to the Assyrian story of a man who traveled the world as the gods tried to drown it to save his friend. That there was no vast Israeli empire. That the universe is billions and not thousands of years old. That there is no cosmic ocean in the sky or hard firmament dome which a tower tall enough could reach. -- One should not blame a person for coming to the most reasonable conclusion they had given then information they had at the time. As such, I will defend to no end that Galen was right to think that perhaps sperm was made in the kidneys. But, that when Muhammad copied Galen's work and had Allah the all-powerful all-knowing God explain that sperm comes from the kidneys. It's clear that Muhammad didn't know any better, but also that he was just making it up. That's how gods are formed, they are made up by people within those cultural context. So Vikings make viking gods who reward them for being good vikings, people on volcanic islands invent angry fire gods and providing ocean gods, and the Jews go from an eye for an eye to maybe we should symbolically spill this blood and just pay you in meat for the transgressions against your family, to maybe we should appease the king who lives in the sky with blood sacrifice. And then they run into the Roman pagans who had endless stories about the sons and daughters of the gods. And they invent the blood sacrifice of the son of God. This is exactly what that culture would invent. In actual reality, the blood sacrifice of the creator of the the universe's human body to himself to appease himself doesn't make any sense. What the heck would the creator of the entire universe with more stars in the sky than grains of sand on all the beaches of earth need with the oxygen carrying cells of some well evolved primate on this one dinky planet? -- There would be no need. But, we can easily show that this *is* what people would invent.

My objection isn't the religion was once man's efforts seeking the truth. It's that it's shown itself to be as filled with truth as astrology or alchemy. It makes sense why people might think such things, but our knowledge is so much greater than this now, that accepting such things is not mere wrongness, it requires accepting things that a two minute search on google would easily refute, because our knowledge has come so much further than the nomatic goat farmers who thought every animal in the world would be within walking distance of Noah's boat.

Wednesday, May 27, 2015

Tat's Trivia Bot V.3.7

Tat's Trivia Bot v. 3.7

Added WPM questions.

WPM*The quick brown fox jumps over the lazy dog
WPM*What a todo to die today at a minute or two to two
WPM*The world beyond the stars is full of stumps.
WPM*The night is long and full of terrors
WPM*Winter is coming
What is the chemical symbol for gold=*Au

Fixed /ask command. It was wonky and I never realized till I tried to use it to test /ask WPM: This is a test of the trivia bot.

The added = formatting indicates that it should use exact mode. Which uses neither fix nor case insensitivity. This is also used for WPM questions Where failing to capitalize the letters results in a fail.

Added /openquestions as a secret command that opens the question file.

Monday, May 25, 2015

Coining a new word: Spirograph = Cyclocycloid.

I needed a generic name for the curve of a cycloid traveling on a circle whether epi- or hypo- and there isn't really one. So I'm just going, circle, circle, -like. Cyclocycloids will be part of my android app in the future.

Friday, May 1, 2015

Butt of the joke.

If you made a quick joke about a butt, is that a butt crack? Is that (<----) a butt crack? Or a butt crack crack?

Saturday, April 18, 2015


"I don't find it hypocritical to say things and then not do those things I've said. I find other people hypocritical when they do that. But, I'm a different sort."

Monday, March 30, 2015

My boilerplate is pretty great. Like fantastic.

The argument is spelled out pretty specifically in Hebrews 9. If a lamb can rid sins for a year, how much better must the son of God free us from sins. What do I need with demigod blood? I'm sure it sounds good to you in your bubble, but if you really think about it, none of that stuff makes any sense. God needed blood so that we could have a relationship with God or we needed blood so we could have a relationship with God. Or sin is like a cancer because once you pick up sticks on a Sunday you might as well have murdered your father on a Tuesday because according to the Bible they are equal sins.

I mean, you can talk about things like how we rejected the plan of the all powerful creator of the universe by having our ancestors eat magical fruit from a magical tree. And that we need to freely chose to follow God and thereby be given infinite reward and avoid infinite torture arranged by an all loving magical man in the sky.

And sure, even the slightest sin needs to be put right by God donning a baby suit, living a perfect life and dying as a sacrifice of himself to himself, so that we can choose to worship this or that.

If there were a God, why would there be any ambiguity as to what this God wants. Hate gays, love gays, deny them marriage rights, stone them with stones until they are dead, etc. At the very minimum any actual real God should make explicitly clear to everybody, in their own language, exactly what God wants for them, or wants them to do in whatever situation. Even if we choose to do something else.

I fully grasp that this seems wonderful to you, that God created a universe with 72,000,000,000,000,000,000,000,000 stars just so that the intelligent monkeys on this one dinky world could be saved from a system that he himself set the rules for. The idea that the universe was made for you, that the all powerful creator of the universe loves you, that you don't have to die but can live forever, and those who disagree they are tormented for all eternity. This is all stuff people would make up. It doesn't really make sense if you think about it.

It isn't too hard to go from an eye to an eye, to maybe we could not kill my uncle and instead kill some cows for your cousin and you guys could have all the meat. And then the unseen kings in the sky, equally get appeased by giving them meat. How blood propitiation arises is really straight forward. But, then to found a religion about a demigod savior who dies as a blood sacrifice of God to God (as the earlier Christian view got moved into Trinitarianism) and so you just have God dying as a sacrifice of himself. Or at the best, God saying here have my son, torture and kill him so that I can forgive you.

You say,  "It seems very unlikely that these pagans and Jews would come up with religion that contradicts their instincts so radically. " But this is wrong, it doesn't it very likely that they would have come up with a religion that so profoundly conforms to their cultures. The sons and daughters of the gods and their wacky adventures, the sacrifice of a demigod as a blood sacrifice, this is exactly the religion they would have invented. Nothing about it would strike a sour chord. It's exactly what the Jews would need after the fall of the Temple. If we can no longer pay cult to God by sacrificing at the Temple, what can we do? -- And the answer is accept the once and for all sacrifice of the Messiah, who came and give victory not over the Romans but over death itself (people would have noticed if somebody killed all the Romans).?

While I do admire that you properly approach the subject with at least honesty. And I'll happily be the first to condemn folks like , not for being wrong, but for a woeful lack of tact. I cannot tell atheists enough, that they are not geniuses because they have found the right answer to the easiest question in history. "Are there magical men in the sky?" - "No!" -- And from there they suppose that if seemingly reasonable and smart people firmly and amusingly believe there are that they must be stupid. This kind of thinking is wrong. Generally because cogitative biases are a problem for all people, that's why science exists, because we are very good at fooling ourselves.

A goodly number of Christians believe in God because they say they have a personal relationship with God and talk to God. And they do, or think they do. It's a pretty interesting mental trick where you confabulate what a person would say and because gods are allowed to be telepathic they accept that the god really is talking to them. People sometimes do it with aliens and with ancestors too. More commonly parents and coaches and people who boost you up or tear you down, save that those people aren't suppose to be telepathic so they must just be a fiction. But, people don't notice that the god in their heads loves and hates the same things as they do, and agrees with them at every turn, and the gods in the heads of two different people never agree with each other.

People can easily be fooled. You might even buy into that stuff you wrote about how blood sacrifice is needed by us rather than by God. But, really if you dig down in it, it really doesn't make any real sense. But, it's admittedly hard to see this if you currently believe it. So, can you at the very least see why I think it doesn't make any sense. Why I think that this is what cultures would have invented. After all, we all agree that of the thousands upon thousands of religions out there the vast majority of them are false. But, I cannot actually see any difference between those religions and your religion. What criteria could I use to determine that Islam or Juju up the Mountain is false but your religion is true? The vikings invented a religion where you go to heaven basically if you die being a really good viking. How very predictably convenient!? If I'm right then a bunch of demi-god loving pagans and a bunch of blood sacrificing messiah worshiping Jews would have invented a demigod messiah who dies as a blood sacrifice so that all the people who believe this story go to heaven and all of those who don't burn forever in hell. Isn't this how a chain letter works, the important bit is passing it along, not being a good person. Gandhi could have lived longer and done more than he did in his life, and he still would have died a Hindi, and not taken the only path to the Father which is through the Son.

s kind of a dick. He's right, which likely makes it worse. I personally hate admitting when people who are dicks are also right. Which, generally as far as tact goes means hurting the cause, so to speak. Giving people a reason to deny what you say, because you are cruel or because you are rude, is generally just bad form. I'm generally very polite, specifically so that it's harder to object to the context to avoid the subject.

The idea of "rubbing somebody's nose" in their wrongness is repugnant to me. It's taken me years to cultivate a love of being wrong. To find those times I am wrong, quickly accept them and admit them publicly because really that's the only way we grow. When we think about being wrong, we think about the pain and the shame and the embarrassment, but that's how we feel when we realize we were wrong. And attacking people there or making that harder is absolutely repugnant. Being wrong, feels exactly like being right, so long as we don't realize the error of our ways. So any hurdle or attempt to compound that is the pinnacle of assholedom.

Thursday, March 19, 2015

Dumb Luck and Religious Violence

It's easy to see why people can say, that yeah, religion is at fault for this stuff that such and such people say and do and cite religion as their motivation and point out chapter and verse that says they should. But, really, you can do the same with the same religion to do the opposite in just about every case. It largely depends on the culture, and the culture is fed by and feeds religion and the culture.

It's basically chaotic. Run the world over again and you might have suicide bombers accepting principles of Crusade (citing chapter and verse) from the intellectual backwater of Europe locked never ending dark age.

Religion isn't very helpful, but it's hardly the root of all evil. They are all equally based on flawed epistemology, arguing that one is worse than another just because a lot of those who accept that religion do horrible things and there's horrible cultural trends within that cultural tradition, that are largely absent in our own, doesn't really work that way. It just happens that most of the Muslim world is now an intellectual backwater with completely unmodern and violent cultural outcroppings.

And yeah, we likely need to keep such people away from jet airplanes and nuclear weapons. But, it's really not intrinsically worse than the western traditional cultures, it just that western culture went towards science and progress and modernity and dragged Christianity along for the ride. It's not superiority, it's basically dumb luck. The religions are all just as false as one another. And claiming that Christianity is better than Islam because Christians don't blow themselves up or Christians invented telescopes, is really just saying X is better than Y because of things that are basically dumb luck. Paganism isn't true because they invented science and math and philosophy, it's again just dumb luck.

Thursday, February 19, 2015

Combining Convolution Kernels

So not only can you, if you get rid of the idea of the center of a convolution kernel and always write the results into the corner. Allowing you to perform the operation in the same memory space, you current reside in. But, you can also COMBINE the convolution kernels before hand.

For example:

private static final int[][] twoboxblurs = new int[][]{
        { 1,2,3,2,1 },
        { 2,4,6,4,2 },
        { 3,6,9,6,3 },
        { 2,4,6,4,2 },
        { 1,2,3,2,1 }
Applies the same thing as two box blurs (assuming there was no dividing error for the first time). It's the number of times each of those pixels down and to the right plays a role in the result. So that's the combination of:




Since each pixel would add a pixel each time to all the pixels down and to the right. You can get the sum of the them combined and properly expand out the kernel. Since you're not looking for data you won't already have you can do such a thing.

You can use the source code here:

For a convolution that applies without memory foot print. It also means you can just link the results together. The pixel 2 over and 1 down, needs 1 copy of the pixel 2 over and 1 down from it. Recursive call all those pixels and you're good.

This is why doing a blur and then an emboss is different than emboss then blur. Because image convolution kernels are not associative. The problem here is that the way convolution is done is wrong. I was busy trying to figure out clever ways to do a convolution of an image in the same space as the image memory and came across a solution. That you can always do a convolution in the same memory footprint if and only if, the "center pixel" is located in the upper left corner. And then you iterate right to left, top to bottom. So long as you're not requiring non-overwritten data from the area above or to your left, this is fine.

Now, how this gets to your problem. Removing the dependency on the previous pixels means that you can not only do it in the same memory but merge kernels. If you use convolution with the results pixel located in the upper left, then it is the case that pixel X doesn't need the location of that pixel, any pixels that are going to be used for the convolution are located down and to the right, so it is the case that you can create the correct answer by performing both kernels at the same time and putting them into that results pixel. Which can be done by way of a kernel.

The kernel you would use is simply these operations combined. So blur:


combined with blur:


It is assume all points not used has a zero. And in each of those 9 spaces you do another copy of the kernel. And add up the different parts needed by a multiple in that section.

As there is no longer dependency on previous pixels.

The problem isn't with the kernels but with how it's always implemented where you place the results in the middle of the field. I'm not sure why this is historically but really it would be easier to just shift the pixels over and down by one if it was extremely required, after the fact.

You will however lose the rounding bias and fail to compound it. value / 81 rather than (value / 9) / 9 could make your resulting matrix slightly more correct than it would have otherwise been.

Update: Eh, not really that cool. You can totally get the same answer faster doing it with the smallest kernels you have. 9 + 9 < 25. So it's still faster to blur than sharpen.

Olsen Noise 2D Java Code Updated. //commented to hell and back.

I went about rewriting the code, I was always annoyed by how much memory the sucker would grab up when it didn't really need to do that. I fixed all those issues. Figured out a better way to do matrix convolutions (for basically all images, all convolutions). But should hopefully have that sped up. And able to work without tossing around giant memory blocks. It sits in it's own foot print, even when it does operations like blur with a convolution kernel.

To use the class I did:
        on = new OlsenNoise2D(); //really all the functions can be static.
        int rh = on.getRequiredDim(height);
        stride = on.getRequiredDim(width);
        pixels = new int[stride * rh];
        on.olsennoise(pixels, stride, x, y, width, height);
        BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        bi.setRGB(0, 0, width, height, pixels, 0, stride);

Update: Use to have source here just use the pastebin.

Wednesday, February 18, 2015

Fast Biased Convolution Algorithm

Ever try to speed up convolution algorithms but then realize they either need to be given to a GPU and most of your lost time is all that giant second copy of all that memory allocation and deallocation? Do you not mind if your values shift up and to the left by half the matrix width and height? Then I have an algorithm for you!

I'm hoping to tweak it to add a field called bias, which will allow you to choose the direction  of the bias. So long as the algorithm iterates the field diagonally it is always the case that it can safely perform the convolution of the data and stick the answer to that in the corner that is never going to be used again.

So the entire thing seems to be pointless. If you put your matrix result point at the corner of the kernel, you can do the convolution with just a scanline. Literally a J/K loop, and never allocate another big block of memory.

Why didn't anybody point this out before. All the convolutions kicking around are mostly pointless. They are obsessed enough with keeping the pixel location consistent that they insist on odd ranged kernels and leave garbage at the edges (or more typically just don't apply it there). When really you could get the result in the same memory.

Sunday, February 1, 2015

On consumers creating jobs

It doesn't matter how risky the risk the guy who raises the capital makes, the risk is whether or not what he's selling the consumer will buy.

This is like insisting that that captain is the one most important person because he's steering the ship, because after all he's the one who would go down with the ship if it sinks. --- But, the consumers in this, aren't other members of the crew. They are the motherfucking ocean.