Smart Scissors Algorithm Learning notes

Source: Internet
Author: User
Tags square root

Written in front of the words: If later I see what do not understand, I will say:"God, this is more difficult than computer vision!" "

While looking at the paper, while finishing the idea, decided that the whole process of thinking is like Journal to write down.

High energy: Due to the first arrangement of ideas, and then write code, so, the previous content may be wrong, only as a personal course design, please keep individual thinking and distinguish right and wrong habits ———— >+_+.

Smart Scissors Overview

"Smart Scissors" (Intelligent Scissors) is an image segmentation interactive tool proposed by Morten-son and Barrett in 1995, which can be used for 2D image segmentation, which allows users to easily and accurately outline areas of interest in the image. ROI (Region of Interest). [3]

Overview of computational theory image Area Cost value

The image area consumption value (image Local cost) is the basis of image boundary extraction.
[2] Morten-son and Barrett published papers [1] and 1998 papers in 1995. In two papers, the value of ILC is somewhat different.
Now generally, the value of ILC is weighted by six image eigenvalues and [2], respectively:

    • Laplace 0 Point value (Laplacian zero-crossing)
    • Gradient measure (Gradient magnitude)
    • Gradient direction value (Gradient direction)
    • Boundary pixel grayscale value (edge pixel value)
    • Internal pixel grayscale value (Inside pixel value)
    • External pixel grayscale value (Outside pixel value)

In the paper [1], only the previous three decisions.

Set l(p,q) the value that represents ILC, p for pixels, and Q for the neighboring pixels of P. (P, Q is a one-dimensional vector that represents the coordinates of a pixel in an image)
The calculations in the paper [1] are as follows:

The values of each variable are as follows:

name Description
FZ (q) Laplace Cross 0 points
FD (p, Q) Gradient Value Direction
FG (q) Gradient value
Wz Weighted value, 0.43
Wd Weighted value, 0.43
WG Weighted value, 0.14

In the paper [2], the formula is calculated as follows:

name Description
FZ (q) Laplace Cross 0 points
FD (p, Q) Gradient Value Direction
FG (q) Gradient value
FP (q) Boundary pixel value
FI (q) Internal pixel value
FO (q) External pixel value
Wz Weighted value, 0.3
Wd Weighted value, 0.3
WG Weighted value, 0.1
Wp Weighted value, 0.1
WI Weighted value, 0.1
WO Weighted value, 0.1
FZ-Laplace cross 0 points

FZ is calculated as follows:

Where IL represents the Laplace transform value of an image.
IL is calculated by using the following template to make an image convolution:

0 1 0
1-4 1
0 1 0

(second-order derivative of the image)

FG-Gradient value

To make IX and IY represent the gradient of pixels in the X and y directions, the gradient G is calculated as follows:

To produce low energy for high gradients, the calculation of FG is defined as follows:

If q is the diagonal adjacent point of P, then FG remains unchanged. If q is the horizontal or vertical adjacent point of P, then FG is divided by the square root 2

Where IX and IY are calculated as follows:

IX (i, j) = IX (i+1, J)-ix (I, j)
IY (i, j) = IX (i, j+1)-IX (i, J)

I, J is the coordinate of the pixel

FD-Gradient direction value

Assuming that D (p) represents the gradient direction of the pixel p, and d ' (p) represents a vector perpendicular to the gradient direction (by 90° clockwise rotation), then D (p) and d ' (p) are calculated as follows:

D (p) = [IX (p), IY (p)]
D ' (p) = [IY (p),-ix (p)]

FD This is not the same way of calculating in two papers.
In the paper [1] are as follows:

*cos[]-1 represents the inverse cosine function.

Where DP and DQ are calculated as follows:

In the paper [2] This formula becomes:

The calculation of L also becomes:

*|| P-q | | This is the sum of the squares of two vectors, and then the root of the spread.
* In the original paper there is an example of FD calculation, I check the check for a long time, only to find, as if the axis is

^
–| –>

It's such a thing to put on ...... But we are dealing with images ... Fall ~

FP-Boundary pixel value


*i (p) indicates the pixel value of the coordinate

FI and FO

The internal pixel values and the outer pixel values are the offset pixel values in the gradient direction and the inverse direction of the pixel points, respectively.

K is a constant distance value (defined by the user). The offset pixel can also be the nearest pixel value (default) or it is worthwhile to interpolate by the surrounding four-pixel bilinear interpolation.

Shortest path generation algorithm

After calculating the ILC value, we can calculate the shortest path generation algorithm.
This algorithm is explained in detail in the paper.

* Algorithm to read carefully

Implementation Overview

Start from here to tidy up the realization of the idea, notice that the core of the whole algorithm is to calculate the ILC value and path calculation. Careful analysis of ILC is worth calculating, it is found that some image eigenvalue calculation is not dependent on p, q two points of the relationship, then for this eigenvalue, it is necessary to preprocess.

Calculate FZ

First, the entire image is pre-processed to calculate IL, which is then used to calculate the value of FZ. Since it is not necessary to reuse the IL in subsequent computations, the IL and FZ calculations can be done directly on the same memory space.

calculate FG and d ' (p)

Both FG and d ' (p) need to calculate IX and IY first, so these two values can be computed at the same time.
But FG is not entirely dependent on Q points, so in the calculation of ILC value also to determine the P, Q point position relationship.

calculate FP, FI, and FO

The FP is equal to the pixel value of the P-point, and it is good to take the value directly.
The calculation of FI and FO is very simple, in the calculation of ILC, real-time calculation on the line. The implementation version is as follows, using nearest neighbor pixels:

Calculate FD

In the previous calculation, D ' (p) has been preprocessed, so it is good to calculate the value of FD directly here.

Calculate ILC

The above calculation has already obtained each image the characteristic value, here directly carries on the weighted summation to be possible.
However, when weighting FG, it is important to note that the relationship between P and Q depends on the need to divide the square root 2.

Calculate Path

Now we can cycle the path.

"References"
[1] Mortensen E N, Barrett W A. Intelligent Scissors for Image composition[c]//proceedings of the 22nd annual Conference O n Computer graphics and interactive techniques. ACM, 1995:191-198.
[2] Mortensen E N, Barrett W A. Interactive segmentation with Intelligent scissors[j]. Graphical models and image processing, 1998, 60 (5): 349-384.
[3] Li Zhipeng. Application of smart Scissors in entry-type roaming [J]. Computer and Digital Engineering, 2010, 38 (3): 143-145.

Smart Scissors Algorithm Learning notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.