public final class ImageUtils
extends java.lang.Object
修飾子とタイプ | メソッドと説明 |
---|---|
static double[][] |
calcIntegralImage(java.awt.image.BufferedImage source)
元画像の積分画像を生成します。
|
static ImageComparedResult |
compare(java.awt.image.BufferedImage image1,
java.awt.Rectangle imageArea1,
java.awt.image.BufferedImage image2,
java.awt.Rectangle imageArea2,
CompareOption[] options)
2つの画像を比較し、差分を取得します。
|
static java.util.List<ObjectGroup> |
convertDiffPointsToObjectGroups(DiffPoints DP,
int group_distance)
convert different points to the list of object groups which are completely merged
|
static java.util.List<java.awt.Rectangle> |
convertObjectGroupsToAreas(java.util.List<ObjectGroup> objectGroups)
cpnvert objectGroups to areas
|
static double[] |
countSubpixel(java.awt.image.BufferedImage bimage)
calculate the features of sub-pixel rendered text image
|
static int |
detectBackgroundColor(java.awt.image.BufferedImage b)
get estimated background color
|
static Offset |
findDominantOffset(java.awt.image.BufferedImage expectedImage,
java.awt.image.BufferedImage actualImage,
double diffThreshold)
find dominant offset between two images
|
static java.awt.image.BufferedImage |
getDiffImage(java.awt.image.BufferedImage leftImage,
java.awt.image.BufferedImage rightImage,
DiffPoints diffPoints)
二つの画像と差分情報から差分確認用画像を取得します。
|
static java.awt.image.BufferedImage |
getDominantImage(java.awt.image.BufferedImage expectedImage,
java.awt.image.BufferedImage actualImage,
Offset offset)
using dominant offset, extract subImage from given expectedImage the size of subImage will be the same as the
size of intersection of two images.
|
static java.awt.image.BufferedImage |
getMarkedImage(java.awt.image.BufferedImage image,
DiffPoints diffPoints)
指定のポイントをマークした画像を作成します。
|
static java.awt.image.BufferedImage |
getMaskedImage(java.awt.image.BufferedImage image,
java.util.List<java.awt.Rectangle> maskAreas)
指定エリアをマスクした画像を生成します。
|
static boolean |
getObjectRectangle(java.awt.image.BufferedImage image,
java.awt.Rectangle rectangle)
find object rectangle in given rectangle area if find, replace given rectangle object with object rectangle
|
static int[] |
getRGB(java.awt.image.BufferedImage image,
int width,
int height)
指定した画像のRGBベースのピクセル配列を取得します。
|
static int |
getSizeRelationType(int expectedWidth,
int expectedHeight,
int actualWidth,
int actualHeight)
In order to find dominant offset, we have to consider the relationship between two image sizes.
|
static java.awt.image.BufferedImage |
getSubImage(java.awt.image.BufferedImage image,
java.awt.Rectangle rectangle)
get sub-image from given image and rectangle
|
static java.awt.Rectangle |
getTightDiffArea(java.awt.Rectangle rectangle,
int xLimit,
int yLimit)
get tight differences area
|
static boolean |
imageEquals(java.awt.image.BufferedImage image1,
java.awt.image.BufferedImage image2)
画像を比較し、同一であるかどうかを取得します。
|
static boolean |
isContained(java.awt.image.BufferedImage entireImage,
java.awt.image.BufferedImage partImage)
全体画像の中に指定した部分画像が含まれているかどうかを取得します。
|
static java.awt.image.BufferedImage |
merge(java.util.List<java.util.List<java.awt.image.BufferedImage>> images)
画像を結合し、1枚の画像にします。
|
static double |
norm(int pixel1,
int pixel2)
L2 norm between two RGB pixel values
|
static void |
removeOverlappingRectangles(java.util.List<java.awt.Rectangle> rectangles)
remove overlapping rectangles for better UI
|
static void |
removeRedundantRectangles(java.util.List<java.awt.Rectangle> rectangles,
int xLimit,
int yLimit)
remove redundant rectangles.
|
static void |
reshapeRect(java.awt.Rectangle rectangle,
int xLimit,
int yLimit)
if the given rectangle may occur raster error, reshape it
|
static int[] |
toARGB(int pixel)
integer pixel value to aRGB array
|
static int |
toPixel(int[] argb)
RGB array to integer pixel value
|
static int |
toPixel(int r,
int g,
int b)
RGB to integer pixel value (alpha is set as 255)
|
static int |
toPixel(int a,
int r,
int g,
int b)
aRGB to integer pixel value
|
static java.awt.image.BufferedImage |
trim(java.awt.image.BufferedImage image,
int trimTop,
int trimLeft,
int trimBottom,
int trimRight)
画像を指定の値でトリムします。
|
static java.awt.image.BufferedImage |
verticalMerge(java.util.List<java.awt.image.BufferedImage> images)
画像を縦に結合し、1枚の画像にします。
|
public static ImageComparedResult compare(java.awt.image.BufferedImage image1, java.awt.Rectangle imageArea1, java.awt.image.BufferedImage image2, java.awt.Rectangle imageArea2, CompareOption[] options)
image1
- 画像1imageArea1
- 画像1の比較範囲image2
- 画像2imageArea2
- 画像2の比較範囲options
- 比較オプションpublic static boolean isContained(java.awt.image.BufferedImage entireImage, java.awt.image.BufferedImage partImage)
entireImage
- 全体画像partImage
- 部分画像public static double[][] calcIntegralImage(java.awt.image.BufferedImage source)
source
- 元画像public static boolean imageEquals(java.awt.image.BufferedImage image1, java.awt.image.BufferedImage image2)
image1
- 一つの画像image2
- 二つ目のがぞおうpublic static java.awt.image.BufferedImage getMaskedImage(java.awt.image.BufferedImage image, java.util.List<java.awt.Rectangle> maskAreas)
image
- マスクする画像maskAreas
- マスクするエリアpublic static java.awt.image.BufferedImage getMarkedImage(java.awt.image.BufferedImage image, DiffPoints diffPoints)
image
- 対象の画像diffPoints
- マークするポイントpublic static java.awt.image.BufferedImage getDiffImage(java.awt.image.BufferedImage leftImage, java.awt.image.BufferedImage rightImage, DiffPoints diffPoints)
leftImage
- 左側の画像rightImage
- 右側の画像diffPoints
- 差分データpublic static java.awt.image.BufferedImage trim(java.awt.image.BufferedImage image, int trimTop, int trimLeft, int trimBottom, int trimRight)
image
- 元画像trimTop
- 上方向のトリム値trimLeft
- 左方向のトリム値trimBottom
- 下方向のトリム値trimRight
- 右方向のトリム値public static java.awt.image.BufferedImage verticalMerge(java.util.List<java.awt.image.BufferedImage> images)
images
- 結合前の画像群public static java.awt.image.BufferedImage merge(java.util.List<java.util.List<java.awt.image.BufferedImage>> images)
images
- 結合前の画像群public static int[] getRGB(java.awt.image.BufferedImage image, int width, int height)
image
- 対象の画像width
- 読み込む幅height
- 読み込む高さpublic static int[] toARGB(int pixel)
pixel
- public static int toPixel(int[] argb)
argb
- public static int toPixel(int r, int g, int b)
r
- g
- b
- public static int toPixel(int a, int r, int g, int b)
a
- r
- g
- b
- public static int detectBackgroundColor(java.awt.image.BufferedImage b)
b
- public static boolean getObjectRectangle(java.awt.image.BufferedImage image, java.awt.Rectangle rectangle)
image
- rectangle
- public static double norm(int pixel1, int pixel2)
pixel1
- pixel2
- public static double[] countSubpixel(java.awt.image.BufferedImage bimage)
bimage
- public static void removeRedundantRectangles(java.util.List<java.awt.Rectangle> rectangles, int xLimit, int yLimit)
rectangles
- list of rectanglesxLimit
- limit of x+width of given rectangleyLimit
- limit of y+height of given rectanglepublic static void removeOverlappingRectangles(java.util.List<java.awt.Rectangle> rectangles)
rectangles
- the list of rectangles which will be checker overlappingpublic static void reshapeRect(java.awt.Rectangle rectangle, int xLimit, int yLimit)
rectangle
- Rectangle which will be reshapedxLimit
- limit of x+width of given rectangleyLimit
- limit of y+height of given rectanglepublic static java.awt.Rectangle getTightDiffArea(java.awt.Rectangle rectangle, int xLimit, int yLimit)
rectangle
- xLimit
- yLimit
- public static java.util.List<java.awt.Rectangle> convertObjectGroupsToAreas(java.util.List<ObjectGroup> objectGroups)
objectGroups
- public static java.util.List<ObjectGroup> convertDiffPointsToObjectGroups(DiffPoints DP, int group_distance)
DP
- DiffPointsgroup_distance
- distance for groupingpublic static java.awt.image.BufferedImage getSubImage(java.awt.image.BufferedImage image, java.awt.Rectangle rectangle)
image
- rectangle
- public static Offset findDominantOffset(java.awt.image.BufferedImage expectedImage, java.awt.image.BufferedImage actualImage, double diffThreshold)
expectedImage
- actualImage
- diffThreshold
- threshold to ignore small differencepublic static java.awt.image.BufferedImage getDominantImage(java.awt.image.BufferedImage expectedImage, java.awt.image.BufferedImage actualImage, Offset offset)
expectedImage
- the image which we want to extract sub-image fromactualImage
- the other imageoffset
- dominant offset between two imagespublic static int getSizeRelationType(int expectedWidth, int expectedHeight, int actualWidth, int actualHeight)
expectedWidth
- width of expectedImageexpectedHeight
- height of expectedImageactualWidth
- width of actualImageactualHeight
- height of actualImage