Message Boards Message Boards

1
|
14083 Views
|
15 Replies
|
13 Total Likes
View groups...
Share
Share this post:

Orthogonalize and scale image

Posted 9 years ago
Attachments:
POSTED BY: Cole Pierson
15 Replies
Posted 9 years ago

Update:

I linear model fit to subtract out was used to remove the tilt. From there I used as subset of the data to isolate only one of the square pillars and then used that as the Kernel for correlation with the original image. The results is a correlation contour map. I then use max detect and position to find the peaks.

kernel = correcteddata[[340 ;; 500, 60 ;; 100]];
correlation = ImageCorrelate[filterdataimage, kernelimage] // ImageAdjust
correlationdata = Transpose[ImageData[correlation]];
bin = MaxDetect[correlationdata]; pos = Position[bin, 1]

It seems to give me what I need. Some pretty pictures too!

POSTED BY: Cole Pierson
Posted 9 years ago
Attachments:
POSTED BY: Cole Pierson
Posted 9 years ago
POSTED BY: Cole Pierson

I guess my last post is at least an outline of an answer to you question. What did you try? Where is you code?

Regards -- Henrik

POSTED BY: Henrik Schachner
POSTED BY: Henrik Schachner
POSTED BY: Marco Thiel

Dear Marco, thanks a lot for your nice compliment! Best wishes -- Henrik

POSTED BY: Henrik Schachner

Really nice.

The only thing I can suggest is, for purposes of working with hardware that does not have Mathematica, possibly a singular values decomposition can be useful. This is implemented in Lapack and so is available on many platforms. What I cannot say, unfortunately, is how best to apply it to the problem at hand (a bit too far from my expertise). But I'm pretty sure some form of SVD, on normalized pixel values or perhaps on a matrix given by the "corner" positions, should be applicable for finding the appropriate sheer.

POSTED BY: Daniel Lichtblau
Posted 9 years ago
POSTED BY: Cole Pierson
Posted 9 years ago

Wow. Thanks Henrik! That looks really good. I will not be able to run this in mathematica so it is important that I determine a general algorithm for unskewing the image.

Thanks again

mrphud

POSTED BY: Cole Pierson

I will not be able to run this in mathematica ...

Well, I am assuming that you have at least some access to Mathematica, because you are posting on the Wolfram community platform!

enter image description here

This way you can get the information for your specific image correction, which can be used by some other program you are doing the actual correction with.

Regards -- Henrik

POSTED BY: Henrik Schachner
Posted 9 years ago

Henrik,

Thank you for showing how to extract the parts of TransformationFunction which correspond to translation and linear transformation. Could you please also explain how to deal with the bottom line of the TransformationFunction's matrix?

POSTED BY: Alexey Popkov
POSTED BY: Henrik Schachner

Hi Cole,

the function FindGeometricTransform seems to be perfect for this task; with ImagePerspectiveTransformation the resulting transformation can then be applied:

imgskd = Import["skewed.png"];
imgcor = Import["corrected.png"];
gtf = Last@FindGeometricTransform[imgcor, imgskd];
ImagePerspectiveTransformation[imgskd, gtf, DataRange -> Full]

The outcome looks like this:

enter image description here

This is just a quick "proof of concept"; for better results you should crop you images properly.

Regards -- Henrik

POSTED BY: Henrik Schachner
Posted 9 years ago

UPDATE: So I found something called shear mapping. This seems to be exactly what I need to apply, but because I am starting with a sheared image in both x and y there is coupling between the axes. I have tried a while loop that iterates the shearing operation in both x and y until its "gone" but it feels like this has to be a known problem.

POSTED BY: Cole Pierson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract