Matching superimposed image

We are given two grayscale images, one of which contains a large, mostly contiguous patch from the other one. The patch can be altered with noise, its levels may be stretched, etc.

Here’s an example image with copied patch original image

We would like to determine the region of the image which was copied onto the other image.

My first instinct was to look at the local correlation. I first apply a little bit of blur to eliminate some of the noise. Then, around each point, I can subtract a gaussian average, then look at the covariance weighted by that same Gaussian kernel. I normalize by the variances, measured in the same way, to get a correlation. If $ G$ is the Gaussian blur operator, this is:

$ $ \frac{G(A \times B) – G(A)G(B)}{\sqrt{(G(A^2)-G(A)^2)(G(B^2)-G(B)^2)} $ $

The result is… not too bad, not great:

correlation

Playing with the width of the kernel can help a bit. I’ve also try correlating Laplacians instead of the images themselves, but it seems to hurt more than it helps. I’ve also tried using the watershed algorithm on the correlation, and it just didn’t give very good results.

I’m thinking part of my problem is not having a strong enough prior for what the patch should be like, perhaps a MRF would help here? Besides MRF, are there some other techniques, perhaps more lightweight that would apply? The other part is that correlation doesn’t seem to be all that great at measuring the distance. There are places where the correlation is very high despite the images being very visually distinct. What other metrics could be of use?

Make image boundaries uniform

I have the following image (fig 1) with the extracted points from the geomagic software (Please see the point list in the attached link).

https://pastebin.com/K51N8Kfa

fig 1I would like to know how I can remove the indented boundaries of the shape. This should be done by removing associated points causing indentation from the list (fig 2). I need the edges to be uninformed so that later I can normalize the height of the image.fig 2

What is the percentage of possibly hitting something that has stacked Blur, Blink, Mirror Image, and Armor of Hexes?

This question is mostly for hypothetical fun because setting all of these up isn’t super practical (unless it’s a 1-on-1 campaign perhaps?)

But with all of these stacking, how likely are you to be hit by an enemy? (let’s assume they have Hexblade’s Curse on them for Armor to work)

This probably depends on AC and to-hit from the enemy too, so let’s just take a look at a decent 13 AC, with the enemy having a +7 to-hit. It’s up to you if you add to hit or AC too to really look at how hard it is to hit something with absurd AC + all these defensive buffs, or how much high to-hit really helps.

Filling a hole in an image in O(nlogn)

I have a grayscale image (given by a float matrix with values between [0, 1]) with a hole in it (a cluster of pixels/cells with values of -1).

Definitions:

The boundary of the hole as all the cells that are 4-connected to a hole pixel (a pixel with -1 value) (you can read more about pixel connectivity here: https://en.wikipedia.org/wiki/Pixel_connectivity).

I(v) is the color of the pixel v.

I need the fill the hole using this formula:

Denote the boundary with B. So for each u – hole pixel:

\begin{equation} I(u) = \frac{\Sigma_v{_\in}_B w(u,v) * I(v))}{\Sigma_v{_\in}_B w(u,v)} \end{equation} Where w is some arbitrary weighting function (for example using euclidean distance)

\begin{equation} w(v,u) = \frac{1}{|| u – v||} \end{equation} Denote the number of hole pixels with n, the naive solution will be O(n^2), since for each hole pixel, we sum over all boundary pixels (and the upper bound for the amount of boundary pixels is 4n, of course).

I was told a solution could be achieved in O(nlogn), but I couldn’t think of anything even close to that.

I thought of doing some bitwise operations, but I reached a dead end. I also tried reusing computations, but I couldn’t find any.

Moreover, the way I see it, there’s no avoiding calculating w(u,v) for the n^2 pairs of hole/boundary pixels – which is already more than O(nlogn).

What am I missing? Could you point me at the right direction?

Thanks

Can an Echo Knight move its echo image vertically or though walls?

The Echo Knight archetype of the fighter class has the ability to manifest an echo of the knight. This ability includes the following:

You can use a bonus action to magically manifest an echo of yourself in an unoccupied space you can see within 15 feet of you. This echo is a magical, translucent, gray image of you […]

On your turn, you can mentally command the echo to move up to 30 feet in any direction (no action required).

No limitations seem to be specified so does this mean that the echo can translate vertically (I hesitate to use the word fly or levitate) and/or though walls?

Are the “power word” spells an attack, and how do they interact with mirror image?

Mirror Image (p260 PHB) Says:

Each time a creature targets you with an attack during the spell’s duration, roll a d20 to determine whether the attack instead targets one of your duplicates….

….A duplicate can be destroyed only by an attack that hits it. It ignores all other damage and effects.

Power Word Spells (p266-267 PHB)say:

You utter a word of power that can compel one creature you can see within range…

…Otherwise, the spell has no effect.

I can see this going one of two ways.
Either Mirror image has priority and you roll to see if a reflection is targeted by the Power Word Spell in which case it has no effect.

OR

Power Word has priority and because you see the target even tho there are duplicates, the power word effect takes place and ignores mirror image.

Which is correct?

Image overlaying text.

Hello I am trying to create a 3×3 image box.
Text above and image underneath.
I have 3 boxes in each row. 2 rows but the image is overlaying the text and not moving the row down, why is that?

<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1">  </head> <style> * {   box-sizing: border-box; }  /* Create three equal columns that floats next to each other */ .column {   float: left;   width: 33.33%;   padding: 10px;   height: 300px; /*...
Code (markup):

Image overlaying text.