33 changed files with 761 additions and 25 deletions
@ -1,6 +1,6 @@ |
|||||
spring: |
spring: |
||||
profiles: |
profiles: |
||||
active: test |
active: prod |
||||
include: common, util-test |
include: common, util-prod |
||||
|
|
||||
|
|
||||
|
@ -1,4 +1,4 @@ |
|||||
spring: |
spring: |
||||
profiles: |
profiles: |
||||
active: prodapi |
active: prod |
||||
include: common, util-prod |
include: common, util-prod |
@ -1,6 +1,6 @@ |
|||||
spring: |
spring: |
||||
profiles: |
profiles: |
||||
active: dev |
active: prod |
||||
include: common, util-dev |
include: common, util-prod |
||||
|
|
||||
|
|
||||
|
@ -0,0 +1,35 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>ccsenscloud</artifactId> |
||||
|
<groupId>com.ccsens</groupId> |
||||
|
<version>1.0-SNAPSHOT</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>ocr</artifactId> |
||||
|
|
||||
|
<dependencies> |
||||
|
<!--cloud 工具类--> |
||||
|
<dependency> |
||||
|
<artifactId>cloudutil</artifactId> |
||||
|
<groupId>com.ccsens</groupId> |
||||
|
<version>1.0-SNAPSHOT</version> |
||||
|
</dependency> |
||||
|
<!--util 工具类--> |
||||
|
<dependency> |
||||
|
<artifactId>util</artifactId> |
||||
|
<groupId>com.ccsens</groupId> |
||||
|
<version>1.0-SNAPSHOT</version> |
||||
|
</dependency> |
||||
|
<!--ocr--> |
||||
|
<dependency> |
||||
|
<groupId>org.bytedeco.javacpp-presets</groupId> |
||||
|
<artifactId>opencv</artifactId> |
||||
|
<version>4.0.1-1.4.4</version> |
||||
|
</dependency> |
||||
|
|
||||
|
</dependencies> |
||||
|
</project> |
@ -0,0 +1,24 @@ |
|||||
|
package com.ccsens.orc; |
||||
|
|
||||
|
import org.mybatis.spring.annotation.MapperScan; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
import org.springframework.boot.web.servlet.ServletComponentScan; |
||||
|
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
||||
|
import org.springframework.cloud.openfeign.EnableFeignClients; |
||||
|
import org.springframework.scheduling.annotation.EnableAsync; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: whj |
||||
|
* @time: 2021/3/17 15:41 |
||||
|
*/ |
||||
|
|
||||
|
@MapperScan(basePackages = {"com.ccsens.ocr.persist.*"}) |
||||
|
@ServletComponentScan |
||||
|
@EnableAsync |
||||
|
//开启断路器功能
|
||||
|
@EnableCircuitBreaker |
||||
|
@EnableFeignClients(basePackages = "com.ccsens.cloudutil.feign") |
||||
|
@SpringBootApplication(scanBasePackages = "com.ccsens") |
||||
|
public class OcrApplication { |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
logging: |
||||
|
level: |
||||
|
com: |
||||
|
favorites: DEBUG |
||||
|
org: |
||||
|
hibernate: ERROR |
||||
|
springframework: |
||||
|
web: DEBUG |
||||
|
mybatis: |
||||
|
config-location: classpath:mybatis/mybatis-config.xml |
||||
|
mapper-locations: classpath*:mapper_*/*.xml |
||||
|
type-aliases-package: com.ccsens.ht.bean |
||||
|
server: |
||||
|
tomcat: |
||||
|
uri-encoding: UTF-8 |
||||
|
spring: |
||||
|
http: |
||||
|
encoding: |
||||
|
charset: UTF-8 |
||||
|
enabled: true |
||||
|
force: true |
||||
|
log-request-details: true |
||||
|
servlet: |
||||
|
multipart: |
||||
|
max-file-size: 10MB |
||||
|
max-request-size: 100MB |
||||
|
|
||||
|
|
@ -0,0 +1,41 @@ |
|||||
|
server: |
||||
|
port: 7030 |
||||
|
servlet: |
||||
|
context-path: /v1.0 |
||||
|
spring: |
||||
|
snowflake: |
||||
|
datacenterId: 1 |
||||
|
workerId: 1 |
||||
|
application: |
||||
|
name: tall |
||||
|
datasource: |
||||
|
type: com.alibaba.druid.pool.DruidDataSource |
||||
|
rabbitmq: |
||||
|
host: 192.168.0.99 |
||||
|
password: guest |
||||
|
port: 5672 |
||||
|
username: guest |
||||
|
redis: |
||||
|
database: 0 |
||||
|
host: 127.0.0.1 |
||||
|
jedis: |
||||
|
pool: |
||||
|
max-active: 200 |
||||
|
max-idle: 10 |
||||
|
max-wait: -1ms |
||||
|
min-idle: 0 |
||||
|
password: '' |
||||
|
port: 6379 |
||||
|
timeout: 1000ms |
||||
|
swagger: |
||||
|
enable: true |
||||
|
|
||||
|
gatewayUrl: https://test.tall.wiki/gateway/ |
||||
|
notGatewayUrl: /home/staticrec/logo.png |
||||
|
smsCode: 0 |
||||
|
wx: |
||||
|
prefixUrl: https://test.tall.wiki/wxconfigurer-api/ |
||||
|
file: |
||||
|
path: /home/cloud/tall/uploads/ |
||||
|
domain: http://localhost:7030/v1.0/ |
||||
|
imgDomain: http://localhost:7030/v1.0/uploads |
@ -0,0 +1,39 @@ |
|||||
|
server: |
||||
|
port: 7030 |
||||
|
servlet: |
||||
|
context-path: /v1.0 |
||||
|
spring: |
||||
|
snowflake: |
||||
|
datacenterId: 1 |
||||
|
workerId: 1 |
||||
|
application: |
||||
|
name: tall |
||||
|
datasource: |
||||
|
type: com.alibaba.druid.pool.DruidDataSource |
||||
|
rabbitmq: |
||||
|
host: 127.0.0.1 |
||||
|
password: admin |
||||
|
port: 5672 |
||||
|
username: 111111 |
||||
|
redis: |
||||
|
database: 0 |
||||
|
host: 127.0.0.1 |
||||
|
jedis: |
||||
|
pool: |
||||
|
max-active: 200 |
||||
|
max-idle: 10 |
||||
|
max-wait: -1ms |
||||
|
min-idle: 0 |
||||
|
password: '' |
||||
|
port: 6379 |
||||
|
timeout: 1000ms |
||||
|
swagger: |
||||
|
enable: true |
||||
|
eureka: |
||||
|
instance: |
||||
|
ip-address: 82.156.116.247 |
||||
|
gatewayUrl: http://82.156.116.247 /gateway/ |
||||
|
notGatewayUrl: http://82.156.116.247 / |
||||
|
file: |
||||
|
domain: http://82.156.116.247 /gateway/tall/v1.0/ |
||||
|
imgDomain: http://82.156.116.247 /gateway/tall/v1.0/uploads |
@ -0,0 +1,48 @@ |
|||||
|
server: |
||||
|
port: 7030 |
||||
|
servlet: |
||||
|
context-path: /v1.0 |
||||
|
spring: |
||||
|
snowflake: |
||||
|
datacenterId: 1 |
||||
|
workerId: 1 |
||||
|
application: |
||||
|
name: tall |
||||
|
datasource: |
||||
|
type: com.alibaba.druid.pool.DruidDataSource |
||||
|
rabbitmq: |
||||
|
host: 127.0.0.1 |
||||
|
password: 111111 |
||||
|
port: 5672 |
||||
|
username: admin |
||||
|
redis: |
||||
|
database: 0 |
||||
|
host: 127.0.0.1 |
||||
|
jedis: |
||||
|
pool: |
||||
|
max-active: 200 |
||||
|
max-idle: 10 |
||||
|
max-wait: -1ms |
||||
|
min-idle: 0 |
||||
|
# password: '' |
||||
|
password: 'areowqr!@43ef' |
||||
|
port: 6379 |
||||
|
timeout: 1000ms |
||||
|
swagger: |
||||
|
enable: false |
||||
|
eureka: |
||||
|
instance: |
||||
|
# www.tall.wiki |
||||
|
# ip-address: 140.143.228.3 |
||||
|
# ip-address: 81.70.54.64 |
||||
|
ip-address: 192.144.182.42 |
||||
|
|
||||
|
gatewayUrl: https://www.tall.wiki/gateway/ |
||||
|
notGatewayUrl: https://www.tall.wiki/ |
||||
|
smsCode: 1 |
||||
|
wx: |
||||
|
prefixUrl: https://www.tall.wiki/wxconfigurer-api/ |
||||
|
file: |
||||
|
path: /home/cloud/tall/uploads/ |
||||
|
domain: https://www.tall.wiki/gateway/tall/v1.0/ |
||||
|
imgDomain: https://www.tall.wiki/gateway/tall/v1.0/uploads |
@ -0,0 +1,44 @@ |
|||||
|
server: |
||||
|
port: 7031 |
||||
|
servlet: |
||||
|
context-path: /v1.0 |
||||
|
spring: |
||||
|
snowflake: |
||||
|
datacenterId: 3 |
||||
|
workerId: 3 |
||||
|
application: |
||||
|
name: tall |
||||
|
datasource: |
||||
|
type: com.alibaba.druid.pool.DruidDataSource |
||||
|
rabbitmq: |
||||
|
host: www.tall.wiki |
||||
|
password: 111111 |
||||
|
port: 5672 |
||||
|
username: admin |
||||
|
redis: |
||||
|
database: 0 |
||||
|
host: www.tall.wiki |
||||
|
jedis: |
||||
|
pool: |
||||
|
max-active: 200 |
||||
|
max-idle: 10 |
||||
|
max-wait: -1ms |
||||
|
min-idle: 0 |
||||
|
password: 'areowqr!@43ef' |
||||
|
port: 6379 |
||||
|
timeout: 1000ms |
||||
|
swagger: |
||||
|
enable: false |
||||
|
eureka: |
||||
|
instance: |
||||
|
ip-address: 129.28.149.79 |
||||
|
|
||||
|
gatewayUrl: https://www.tall.wiki/gateway/ |
||||
|
notGatewayUrl: https://www.tall.wiki/ |
||||
|
smsCode: 1 |
||||
|
wx: |
||||
|
prefixUrl: https://www.tall.wiki/wxconfigurer-api/ |
||||
|
file: |
||||
|
path: /home/cloud/tall/uploads/ |
||||
|
domain: https://www.tall.wiki/gateway/tall/v1.0/ |
||||
|
imgDomain: https://www.tall.wiki/gateway/tall/v1.0/uploads |
@ -0,0 +1,44 @@ |
|||||
|
server: |
||||
|
port: 7031 |
||||
|
servlet: |
||||
|
context-path: /v1.0 |
||||
|
spring: |
||||
|
snowflake: |
||||
|
datacenterId: 2 |
||||
|
workerId: 2 |
||||
|
application: |
||||
|
name: tall |
||||
|
datasource: |
||||
|
type: com.alibaba.druid.pool.DruidDataSource |
||||
|
rabbitmq: |
||||
|
host: www.tall.wiki |
||||
|
password: 111111 |
||||
|
port: 5672 |
||||
|
username: admin |
||||
|
redis: |
||||
|
database: 0 |
||||
|
host: www.tall.wiki |
||||
|
jedis: |
||||
|
pool: |
||||
|
max-active: 200 |
||||
|
max-idle: 10 |
||||
|
max-wait: -1ms |
||||
|
min-idle: 0 |
||||
|
password: 'areowqr!@43ef' |
||||
|
port: 6379 |
||||
|
timeout: 1000ms |
||||
|
swagger: |
||||
|
enable: false |
||||
|
eureka: |
||||
|
instance: |
||||
|
ip-address: 121.36.3.207 |
||||
|
|
||||
|
gatewayUrl: https://www.tall.wiki/gateway/ |
||||
|
notGatewayUrl: https://www.tall.wiki/ |
||||
|
smsCode: 1 |
||||
|
wx: |
||||
|
prefixUrl: https://www.tall.wiki/wxconfigurer-api/ |
||||
|
file: |
||||
|
path: /home/cloud/tall/uploads/ |
||||
|
domain: https://www.tall.wiki/gateway/tall/v1.0/ |
||||
|
imgDomain: https://www.tall.wiki/gateway/tall/v1.0/uploads |
@ -0,0 +1,51 @@ |
|||||
|
server: |
||||
|
port: 7030 |
||||
|
servlet: |
||||
|
context-path: /v1.0 |
||||
|
spring: |
||||
|
snowflake: |
||||
|
datacenterId: 1 |
||||
|
workerId: 1 |
||||
|
application: |
||||
|
name: tall |
||||
|
datasource: |
||||
|
type: com.alibaba.druid.pool.DruidDataSource |
||||
|
rabbitmq: |
||||
|
host: 127.0.0.1 |
||||
|
# host: api.ccsens.com |
||||
|
password: 111111 |
||||
|
port: 5672 |
||||
|
username: admin |
||||
|
redis: |
||||
|
database: 0 |
||||
|
host: 127.0.0.1 |
||||
|
jedis: |
||||
|
pool: |
||||
|
max-active: 200 |
||||
|
max-idle: 10 |
||||
|
max-wait: -1ms |
||||
|
min-idle: 0 |
||||
|
password: '' |
||||
|
port: 6379 |
||||
|
timeout: 1000ms |
||||
|
swagger: |
||||
|
enable: true |
||||
|
eureka: |
||||
|
instance: |
||||
|
ip-address: 192.168.0.99 |
||||
|
# ip-address: 49.233.89.188 |
||||
|
#gatewayUrl: http://192.168.0.99/gateway/ |
||||
|
#notGatewayUrl: http://192.168.0.99/ |
||||
|
gatewayUrl: https://test.tall.wiki/gateway/ |
||||
|
notGatewayUrl: https://test.tall.wiki/ |
||||
|
smsCode: 0 |
||||
|
wx: |
||||
|
prefixUrl: https://www.tall.wiki/wxconfigurer-api/ |
||||
|
file: |
||||
|
path: /home/cloud/tall/uploads/ |
||||
|
domain: https://test.tall.wiki/gateway/tall/v1.0/ |
||||
|
imgDomain: https://test.tall.wiki/gateway/tall/v1.0/uploads |
||||
|
|
||||
|
#file: |
||||
|
# domain: http://192.168.0.99/gateway/tall/v1.0/ |
||||
|
# imgDomain: http://192.168.0.99/gateway/tall/v1.0/uploads |
@ -0,0 +1,5 @@ |
|||||
|
spring: |
||||
|
profiles: |
||||
|
active: dev |
||||
|
include: util-dev,common |
||||
|
|
@ -0,0 +1,21 @@ |
|||||
|
// _ooOoo_ |
||||
|
// o8888888o |
||||
|
// 88" . "88 |
||||
|
// (| -_- |) |
||||
|
// O\ = /O |
||||
|
// ____/`---'\____ |
||||
|
// . ' \\| |// `. |
||||
|
// / \\||| : |||// \ |
||||
|
// / _||||| -:- |||||- \ |
||||
|
// | | \\\ - /// | | |
||||
|
// | \_| ''\---/'' | | |
||||
|
// \ .-\__ `-` ___/-. / |
||||
|
// ___`. .' /--.--\ `. . __ |
||||
|
// ."" '< `.___\_<|>_/___.' >'"". |
||||
|
// | | : `- \`.;`\ _ /`;.`/ - ` : | | |
||||
|
// \ \ `-. \_ __\ /__ _/ .-` / / |
||||
|
// ======`-.____`-.___\_____/___.-`____.-'====== |
||||
|
// `=---=' |
||||
|
// |
||||
|
// ............................................. |
||||
|
// 佛祖保佑 永无BUG |
@ -0,0 +1,196 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 --> |
||||
|
<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true --> |
||||
|
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> |
||||
|
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> |
||||
|
<configuration scan="true" scanPeriod="10 seconds"> |
||||
|
|
||||
|
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />--> |
||||
|
|
||||
|
<contextName>logback</contextName> |
||||
|
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 --> |
||||
|
<property name="log.path" value="/home/cloud/ocr/game/log/" /> |
||||
|
|
||||
|
<!-- 彩色日志 --> |
||||
|
<!-- 彩色日志依赖的渲染类 --> |
||||
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> |
||||
|
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> |
||||
|
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> |
||||
|
<!-- 彩色日志格式 --> |
||||
|
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
||||
|
|
||||
|
|
||||
|
<!--输出到控制台--> |
||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
||||
|
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
|
<level>info</level> |
||||
|
</filter> |
||||
|
<encoder> |
||||
|
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
||||
|
<!-- 设置字符集 --> |
||||
|
<charset>UTF-8</charset> |
||||
|
</encoder> |
||||
|
</appender> |
||||
|
|
||||
|
|
||||
|
<!--输出到文件--> |
||||
|
|
||||
|
<!-- 时间滚动输出 level为 DEBUG 日志 --> |
||||
|
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文件的路径及文件名 --> |
||||
|
<file>${log.path}/log_debug.log</file> |
||||
|
<!--日志文件输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<!-- 日志归档 --> |
||||
|
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文件保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文件只记录debug级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>debug</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 时间滚动输出 level为 INFO 日志 --> |
||||
|
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文件的路径及文件名 --> |
||||
|
<file>${log.path}/log_info.log</file> |
||||
|
<!--日志文件输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<!-- 每天日志归档路径以及格式 --> |
||||
|
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文件保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文件只记录info级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>info</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 时间滚动输出 level为 WARN 日志 --> |
||||
|
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文件的路径及文件名 --> |
||||
|
<file>${log.path}/log_warn.log</file> |
||||
|
<!--日志文件输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文件保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文件只记录warn级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>warn</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
|
||||
|
<!-- 时间滚动输出 level为 ERROR 日志 --> |
||||
|
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文件的路径及文件名 --> |
||||
|
<file>${log.path}/log_error.log</file> |
||||
|
<!--日志文件输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文件保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文件只记录ERROR级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>ERROR</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- |
||||
|
<logger>用来设置某一个包或者具体的某一个类的日志打印级别、 |
||||
|
以及指定<appender>。<logger>仅有一个name属性, |
||||
|
一个可选的level和一个可选的addtivity属性。 |
||||
|
name:用来指定受此logger约束的某一个包或者具体的某一个类。 |
||||
|
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
||||
|
还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。 |
||||
|
如果未设置此属性,那么当前logger将会继承上级的级别。 |
||||
|
addtivity:是否向上级logger传递打印信息。默认是true。 |
||||
|
--> |
||||
|
<!--<logger name="org.springframework.web" level="info"/>--> |
||||
|
<!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>--> |
||||
|
<!-- |
||||
|
使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作: |
||||
|
第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息 |
||||
|
第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别: |
||||
|
--> |
||||
|
|
||||
|
|
||||
|
<!-- |
||||
|
root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 |
||||
|
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
||||
|
不能设置为INHERITED或者同义词NULL。默认是DEBUG |
||||
|
可以包含零个或多个元素,标识这个appender将会添加到这个logger。 |
||||
|
--> |
||||
|
|
||||
|
<!--开发环境:打印控制台--> |
||||
|
<springProfile name="dev"> |
||||
|
<logger name="com.ccsens.ptpro.persist.*" level="debug"/> |
||||
|
</springProfile> |
||||
|
|
||||
|
<root level="info"> |
||||
|
<appender-ref ref="CONSOLE" /> |
||||
|
<appender-ref ref="DEBUG_FILE" /> |
||||
|
<appender-ref ref="INFO_FILE" /> |
||||
|
<appender-ref ref="WARN_FILE" /> |
||||
|
<appender-ref ref="ERROR_FILE" /> |
||||
|
</root> |
||||
|
|
||||
|
<!--生产环境:输出到文件--> |
||||
|
<!--<springProfile name="pro">--> |
||||
|
<!--<root level="info">--> |
||||
|
<!--<appender-ref ref="CONSOLE" />--> |
||||
|
<!--<appender-ref ref="DEBUG_FILE" />--> |
||||
|
<!--<appender-ref ref="INFO_FILE" />--> |
||||
|
<!--<appender-ref ref="ERROR_FILE" />--> |
||||
|
<!--<appender-ref ref="WARN_FILE" />--> |
||||
|
<!--</root>--> |
||||
|
<!--</springProfile>--> |
||||
|
|
||||
|
</configuration> |
@ -0,0 +1,61 @@ |
|||||
|
package com.ccsens.orc.test; |
||||
|
|
||||
|
import org.junit.Test; |
||||
|
import org.opencv.core.Core; |
||||
|
import org.opencv.core.CvType; |
||||
|
import org.opencv.core.Mat; |
||||
|
import org.opencv.core.Size; |
||||
|
import org.opencv.imgcodecs.Imgcodecs; |
||||
|
import org.opencv.imgproc.Imgproc; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: whj |
||||
|
* @time: 2021/3/17 17:45 |
||||
|
*/ |
||||
|
public class OrcTest { |
||||
|
|
||||
|
@Test |
||||
|
public void test01(){ |
||||
|
// 加载资源
|
||||
|
System.loadLibrary(Core.NATIVE_LIBRARY_NAME); |
||||
|
|
||||
|
//创建3px*3px的8UC1(8个位的无符号(8U)单通道(C1)整数)
|
||||
|
// Mat hello = Mat.eye(3,3, CvType.CV_8UC1);
|
||||
|
// System.out.println(hello.dump());
|
||||
|
//加载图片
|
||||
|
Mat mat = Imgcodecs.imread("D:\\img\\0df7f58ea9d3a61019596094eb35003.png"); |
||||
|
// 加载图片并灰度图像
|
||||
|
// Mat mat = Imgcodecs.imread("D:\\img\\0df7f58ea9d3a61019596094eb35003.png", Imgcodecs.IMREAD_GRAYSCALE);
|
||||
|
// System.out.println(mat.width() + "*" + mat.height() + "," + mat.type());
|
||||
|
// System.out.println(mat);
|
||||
|
// 输出图片
|
||||
|
// Imgcodecs.imwrite("D:\\img\\1.png", mat);
|
||||
|
// 截取图像
|
||||
|
// Mat submat = mat.submat(50, 300, 60, 250);
|
||||
|
// Imgcodecs.imwrite("D:\\img\\1.png", submat);
|
||||
|
// 模糊图片 模糊子图片后,父模块也跟着模糊了
|
||||
|
// Imgproc.blur(submat, submat, new Size(25.0,25.0));
|
||||
|
// System.out.println(submat);
|
||||
|
// Imgcodecs.imwrite("D:\\img\\blur.png", mat);
|
||||
|
// 黑白化
|
||||
|
Imgproc.cvtColor(mat, mat, Imgproc.COLOR_RGB2GRAY); |
||||
|
/* |
||||
|
高亮显示轮廓 |
||||
|
■源矩阵 |
||||
|
■目标矩阵 |
||||
|
■低阈值,使用150.0 |
||||
|
■高阈值,通常是低阈值的2倍或3倍 |
||||
|
■光圈,3~7之间的一个奇数,我们使用3。光圈值越大,被检测到的轮廓越多 |
||||
|
■L2梯度,暂时设置为true |
||||
|
*/ |
||||
|
Imgproc.Canny(mat, mat, 150,300,5, true); |
||||
|
// 反色操作
|
||||
|
Core.bitwise_not(mat, mat); |
||||
|
// 将反色结果作为掩膜
|
||||
|
Mat bg = Imgcodecs.imread("D:\\img\\e2669de7219943b8ac37f79dd8fef2f8.png"); |
||||
|
Imgproc.resize(bg, bg, mat.size()); |
||||
|
bg.copyTo(mat,mat); |
||||
|
Imgcodecs.imwrite("D:\\img\\1.png", mat); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue