|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.aerith.misao.image.filter.Filter | +--net.aerith.misao.image.filter.StreakCancelFilter
The StreakCancelFilter
is an image processing filter
to cancel the streaks. The result is stored in the original image.
The streaks must extend horizontally. It operates the edge detection and subtraction in two directions, from top to bottom and from bottom to top. Then it merges the two results.
Inner Class Summary | |
protected class |
StreakCancelFilter.EdgePixel
The EdgePixel is a set of the flag and the
subtracted value. |
Field Summary | |
protected double |
background_deviation
The deviation of background. |
protected MonoImage |
background_flag_image
The background flag image. |
protected int |
filter_size
The length to detect streak edges. |
protected boolean |
keep_background_flag_image
True when to keep the background flag image. |
protected boolean |
keep_streak_flag_image
True when to keep the streak flag image. |
protected MonoImage |
streak_flag_image
The streak flag image. |
Fields inherited from class net.aerith.misao.image.filter.Filter |
monitor_set |
Constructor Summary | |
StreakCancelFilter()
Constructs a filter. |
|
StreakCancelFilter(int initial_filter_size)
Constructs a filter with initial filter size. |
Method Summary | |
private MonoImage |
createBackgroundFlagImage(MonoImage image)
Creates the flag image to judge if the pixel is background or not. |
private MonoImage |
detectStreakTopToBottom(MonoImage image,
MonoImage bg_flag_image)
Detects the streaks from top to bottom. |
MonoImage |
getBackgroundFlagImage()
Gets the background flag image. |
MonoImage |
getStreakFlagImage()
Gets the streak flag image. |
void |
keepBackgroundFlagImage()
Sets the flag to keep the background flag image. |
void |
keepStreakFlagImage()
Sets the flag to keep the streak flag image. |
MonoImage |
operate(MonoImage image)
Operates the image processing filter and stores the result into the original image buffer. |
private StreakCancelFilter.EdgePixel |
operateAt(MonoImage image,
MonoImage bg_flag_image,
int x,
int y)
Judges if the pixel is part of an edge and calculates the subtracted value for the specified pixel. |
void |
setFilterSize(int new_filter_size)
Sets the filter size. |
private void |
subtractTopToBottom(MonoImage image,
MonoImage bg_flag_image,
MonoImage st_flag_image)
Subtracts the streaks and stores the result into the original image buffer, from top to bottom. |
Methods inherited from class net.aerith.misao.image.filter.Filter |
addMonitor,
setMonitor |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected int filter_size
protected double background_deviation
protected boolean keep_background_flag_image
protected MonoImage background_flag_image
protected boolean keep_streak_flag_image
protected MonoImage streak_flag_image
Constructor Detail |
public StreakCancelFilter()
public StreakCancelFilter(int initial_filter_size)
initial_filter_size
- the initial value of filter size.Method Detail |
public void setFilterSize(int new_filter_size)
new_filter_size
- the new value of filter size.public void keepBackgroundFlagImage()
public MonoImage getBackgroundFlagImage()
If 0, the pixel is part of a star, otherwise, the pixel is background. If 1, the background spreads around the pixel. If 2, the background spreads towards left, that is a star exists near to the right. If 3, the background spreads towards right, that is a star exists near to the left.
public void keepStreakFlagImage()
public MonoImage getStreakFlagImage()
This is the merged flag image of two results, from top to bottom and from bottom to top. If 2, the pixels is part of a streak. If 1, the pixel is regarded as part of a streak but restored finally. If 0, the pixel is not streak.
public MonoImage operate(MonoImage image)
The streaks must extend horizontally. It operates the edge detection and subtraction in two directions, from top to bottom and from bottom to top. Then it merges the two results.
image
- the original image to process.private MonoImage createBackgroundFlagImage(MonoImage image)
image
- the original image.private MonoImage detectStreakTopToBottom(MonoImage image, MonoImage bg_flag_image)
First of all, it detects the edges and creates the flag image of edges, for each line from top to bottom, by subtracting the difference between the above line. After that, tiny edges are removed because they are not real streaks. And the remained streakes are spreaded in order to cover the foot.
image
- the original image to process.bg_flag_image
- the flag image to represent the background
pixels.private void subtractTopToBottom(MonoImage image, MonoImage bg_flag_image, MonoImage st_flag_image)
When the flag of a pixel is set in the specified streak flag image, difference between the average around the pixel and the average of the pixels above is subtracted, and the streaks are deleted one line by one from top to bottom.
image
- the original image to process.bg_flag_image
- the flag image to represent the background
pixels.st_flag_image
- the flag image to represent the streaks.private StreakCancelFilter.EdgePixel operateAt(MonoImage image, MonoImage bg_flag_image, int x, int y)
The flag is 2 if the difference from the line above is large, 1 if the difference is not large enough, and 0 if not edges. Judges one line by one from top to bottom. The difference is
image
- the original image to process.bg_flag_image
- the flag image to represent the background
pixels.x
- the x position.y
- the y position.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |