Intelligent Scissor
Base on Sigg95 paper .
Source code
UI control
- "Folder" icon to open and operate on an image.
- First "save" icon to save image with contour.
- Second "save" icon to save the mask generated by the selected contour.
- Third "save" icon to save the area of image cut by the selected contour.
- Image can be zoomed in and out and move around.
- Image has two view mode: original and gradient map.
- To start a new path, press "Put A Seed". Left click to create new seeds, "Delete" to undo previous seed.
Press "Enter" to end the contour, or double click to close the contour.
- One can hide or show contours as wish.
- To select a particular contour in order to delete it or save the mask, press "Select A Contour".
Selected contour will show a different color. After selection, press "Delete" to delete it.
- Debug Mode:
Pixel Node: A cost graph with original image pixel colors at the center of each 3by3 window, and black everywhere else.
Cost Graph: A cost graph with both pixel colors and link costs. Low cost (darker) for links along image edges.
Path Tree: See the live expansion of minimum path tree.
Min Path: Show the minimum path between the current seed and the mouse position.
Implementation
- Basic steps:
i. Use 8 kernels to apply on each pixel of the image to get a cost matrix (x*y*8 size)
ii. Do a shortest path search using Dijkstra's algorithm. Insertion and extractMin using priority queue.
- Add a Guassian filter before calculating the image cost matrix.
==> Resulting in better adherence at strong edges, but sometimes ignores small (but not is not noise!) disturbances.
- Tried both cost functions given on course webpage and the paper. In my case, the paper one performs better.
- Seed snapping: seed is automatically moved to the closest edge. (search radius 5)
(Sometimes may cause undesired result but overall performs well.)
Email : sklin@connect.ust.hk.