左侧是原始图像,正如我从右侧图像中看到的那样,我使用了精巧边缘检测方法来仅获取图像的外部边缘。现在可以用白色填充连接的边缘并裁剪图像了吗?抱歉,我在图像处理领域还很新
答案 0 :(得分:0)
最好提供单独的图像。
这是在Python / OpenCV中执行此操作的一种方法。
输入:
[http-nio-5252-exec-1] [DEBUG] [i.l.core.RedisChannelHandler] dispatching command AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command]
[http-nio-5252-exec-1] [DEBUG] [i.l.c.c.PooledClusterConnectionProvider] getConnection(READ, 11489)
[http-nio-5252-exec-1] [DEBUG] [i.l.c.protocol.DefaultEndpoint] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, epid=0x8] write() writeAndFlush command ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[http-nio-5252-exec-1] [DEBUG] [i.l.c.protocol.DefaultEndpoint] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, epid=0x8] write() done
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] write(ctx, ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], promise)
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandEncoder] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001] writing command ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 9 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: false
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 1460 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: false
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 4096 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: false
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 3204 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: false
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 1460 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: false
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 2238 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
....
....
....
....
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=[B@10072a6f, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: true
阈值图像:
轮廓图填充:
裁剪的图像:
使用填充轮廓的另一种方法是将内部充满。