|
@@ -182,7 +182,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
}
|
|
}
|
|
screenshot.setIsHandle(1);
|
|
screenshot.setIsHandle(1);
|
|
if (screenshot.getPicType() == null) {
|
|
if (screenshot.getPicType() == null) {
|
|
- //判断是否是游戏
|
|
|
|
|
|
+ //判断是否是娱乐:看电影, 打游戏
|
|
if (isEntertainment(new File(filePath))) {
|
|
if (isEntertainment(new File(filePath))) {
|
|
screenshot.setPicType(7);
|
|
screenshot.setPicType(7);
|
|
}
|
|
}
|
|
@@ -286,6 +286,8 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
//统计出现最多的一个色值,计算所占比重
|
|
//统计出现最多的一个色值,计算所占比重
|
|
int totalPixl = 0;
|
|
int totalPixl = 0;
|
|
HashMap<Integer, Integer> colorCntMap = new HashMap<Integer, Integer>();
|
|
HashMap<Integer, Integer> colorCntMap = new HashMap<Integer, Integer>();
|
|
|
|
+
|
|
|
|
+
|
|
for (int i = minx; i < width; i++) {
|
|
for (int i = minx; i < width; i++) {
|
|
for (int j = miny; j < height; j++) {
|
|
for (int j = miny; j < height; j++) {
|
|
totalPixl++;
|
|
totalPixl++;
|
|
@@ -298,6 +300,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Map<Integer, Integer> sMap = new TreeMap<Integer, Integer>();
|
|
int maxCnt = 0;
|
|
int maxCnt = 0;
|
|
int key = 0;
|
|
int key = 0;
|
|
Set<Map.Entry<Integer, Integer>> entry2 = colorCntMap.entrySet();
|
|
Set<Map.Entry<Integer, Integer>> entry2 = colorCntMap.entrySet();
|
|
@@ -307,7 +310,15 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
maxCnt = temp.getValue();
|
|
maxCnt = temp.getValue();
|
|
key = temp.getKey();
|
|
key = temp.getKey();
|
|
}
|
|
}
|
|
|
|
+ sMap.put(temp.getValue(), temp.getKey());
|
|
}
|
|
}
|
|
|
|
+ sMap = ((TreeMap)sMap).descendingMap();
|
|
|
|
+ Iterator it = sMap.keySet().iterator();
|
|
|
|
+ Integer k1 = (Integer) it.next();
|
|
|
|
+ Integer k2 = (Integer) it.next();
|
|
|
|
+ Integer color1 = sMap.get(k1);
|
|
|
|
+ Integer color2 = sMap.get(k2);
|
|
|
|
+ System.out.println("kkkk=="+k1+","+color1 + "," + k2 + "," + color2);
|
|
System.out.println("最.." + maxCnt + ", key=" + key);
|
|
System.out.println("最.." + maxCnt + ", key=" + key);
|
|
rgb[0] = (key & 0xff0000) >> 16;
|
|
rgb[0] = (key & 0xff0000) >> 16;
|
|
rgb[1] = (key & 0xff00) >> 8;
|
|
rgb[1] = (key & 0xff00) >> 8;
|
|
@@ -315,7 +326,17 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
System.out.println("色值为: " + rgb[0] + ", " + rgb[1]+", "+rgb[2]);
|
|
System.out.println("色值为: " + rgb[0] + ", " + rgb[1]+", "+rgb[2]);
|
|
//计算比例, 应该不低于50%
|
|
//计算比例, 应该不低于50%
|
|
int colorPercent = maxCnt * 100 / totalPixl;
|
|
int colorPercent = maxCnt * 100 / totalPixl;
|
|
- System.out.println("底色比例=="+colorPercent);
|
|
|
|
|
|
+ if (colorPercent < 50) {
|
|
|
|
+ //可能存在2中底色, 大布局的底色和小模块的底色,都算底色。
|
|
|
|
+ int secPercent = k2 * 100/totalPixl;
|
|
|
|
+ rgb[0] = (color2 & 0xff0000) >> 16;
|
|
|
|
+ rgb[1] = (color2 & 0xff00) >> 8;
|
|
|
|
+ rgb[2] = (color2 & 0xff);
|
|
|
|
+ System.out.println("二级底色色值为: " + rgb[0] + ", " + rgb[1]+", "+rgb[2]);
|
|
|
|
+ System.out.println("二级底色比例=="+secPercent);
|
|
|
|
+ colorPercent = (k1 + k2) * 100/totalPixl;
|
|
|
|
+ }
|
|
|
|
+ System.out.println("总底色比例=="+colorPercent);
|
|
//计算底色是否是连续分布的
|
|
//计算底色是否是连续分布的
|
|
int windowSize=50;
|
|
int windowSize=50;
|
|
int pureColorBlockCnt = 0;
|
|
int pureColorBlockCnt = 0;
|