Image Processing Edge Detection in Java

后端 未结 4 477
故里飘歌
故里飘歌 2021-02-06 09:33

This is my situation. It involves aligning a scanned image which will account for incorrect scanning. I must align the scanned image with my Java program.

These are more

4条回答
  •  你的背包
    2021-02-06 10:24

    A similar such problem I've done in the past basically figured out the orientation of the form, re-aligned it, re-scaled it, and I was all set. You can use the Hough transform to to detect the angular offset of the image (ie: how much it is rotated), but you still need to detect the boundaries of the form. It also had to accommodate for the boundaries of the piece of paper itself.

    This was a lucky break for me, because it basically showed a black and white image in the middle of a big black border.

    1. Apply an aggressive, 5x5 median filter to remove some noise.
    2. Convert from grayscale to black and white (rescale intensity values from [0,255] to [0,1]).
    3. Calculate the Principal Component Analysis (ie: calculate the Eigenvectors of the covariance matrix for your image from the calculated Eigenvalues) (http://en.wikipedia.org/wiki/Principal_component_analysis#Derivation_of_PCA_using_the_covariance_method) 4) This gives you a basis vector. You simply use that to re-orient your image to a standard basis matrix (ie: [1,0],[0,1]).

    Your image is now aligned beautifully. I did this for normalizing the orientation of MRI scans of entire human brains.

    You also know that you have a massive black border around the actual image. You simply keep deleting rows from the top and bottom, and both sides of the image until they are all gone. You can temporarily apply a 7x7 median or mode filter to a copy of the image so far at this point. It helps rule out too much border remaining in the final image from thumbprints, dirt, etc.

提交回复
热议问题