yuandonghuia 2022-07-22 14:54
浏览 27
已结题

.net C# vs2019 WPF 多幅图像拼接时,中间有白线

问题遇到的现象和发生背景

.net C# vs2019 WPF 多幅图像拼接时,中间有白线

img

问题相关代码,请勿粘贴截图
<Window x:Class="WpfAppframework.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfAppframework"
        mc:Ignorable="d"
        Title="MainWindow" Height="710" Width="640" Loaded="Window_Loaded">
    <Grid x:Name="main" Width="1920">
        <Grid.RowDefinitions>
            <RowDefinition Height="1920"/>
        </Grid.RowDefinitions>
        <TextBlock x:Name="textBlock" Grid.Column="0" HorizontalAlignment="Left" Margin="0,0,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="20" Width="1622" Panel.ZIndex="1" FontSize="15" FontWeight="Bold" Foreground="#FF00F516"/>
        <TextBlock x:Name="textBlock1" Grid.Column="0" HorizontalAlignment="Left" Margin="0,20,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="20" Width="1622" Panel.ZIndex="1" FontSize="15" FontWeight="Bold" Foreground="#FF00F516"/>
        <Grid  x:Name="MainPanel"  Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="1920" 
               MouseLeftButtonDown="MasterImage_MouseLeftButtonDown"
                   MouseLeftButtonUp="MasterImage_MouseLeftButtonUp"
                   MouseMove="MasterImage_MouseMove"
                   MouseWheel="MasterImage_MouseWheel" Margin="-640,-640,0,0">
            <Grid.RenderTransform>
                <TransformGroup >
                    
                    <MatrixTransform x:Name="mtf"></MatrixTransform>
                </TransformGroup>
            </Grid.RenderTransform>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Image Grid.Row="0" Grid.Column="0" x:Name="image00" Margin="0,0,0,0" Source="D:\shuju\image1z\21_10.jpg"/>
            <Image Grid.Row="0" Grid.Column="1" x:Name="image01" Margin="0,0,0,0" Source="D:\shuju\image1z\21_11.jpg"/>
            <Image Grid.Row="0" Grid.Column="2" x:Name="image02" Margin="0,0,0,0" Source="D:\shuju\image1z\21_12.jpg"/>
            <Image Grid.Row="1" Grid.Column="0" x:Name="image10" Margin="0,0,0,0" Source="D:\shuju\image1z\22_10.jpg"/>
            <Image Grid.Row="1" Grid.Column="1" x:Name="image11" Margin="0,0,0,0" Source="D:\shuju\image1z\22_11.jpg" Opacity="1" />
            <Image Grid.Row="1" Grid.Column="2" x:Name="image12" Margin="0,0,0,0" Source="D:\shuju\image1z\22_12.jpg"/>
            <Image Grid.Row="2" Grid.Column="0" x:Name="image20" Margin="0,0,0,0" Source="D:\shuju\image1z\23_10.jpg"/>
            <Image Grid.Row="2" Grid.Column="1" x:Name="image21" Margin="0,0,0,0" Source="D:\shuju\image1z\23_11.jpg"/>
            <Image Grid.Row="2" Grid.Column="2" x:Name="image22" Margin="0,0,0,0" Source="D:\shuju\image1z\23_12.jpg"/>
        </Grid>
    </Grid>
</Window>

运行结果及报错内容

多幅图像拼接时,中间有白线

我的解答思路和尝试过的方法
<Grid Height="640" Width="1280">
    <Image x:Name="image11" HorizontalAlignment="Left" Width="640" Margin="0,0,0,0" Source="D:\shuju\image1\22_11.jpg" />
    <Image x:Name="image12" HorizontalAlignment="Left" Width="640" Margin="640,0,0,0" Source="D:\shuju\image1\22_12.jpg"/>
</Grid>

像上面的方式拼接图像则没有白线,但是写代码会很麻烦

我想要达到的结果

我感觉Grid的拼接方式,应该能去掉白线,但是查了很多资料,没有结果,希望各路大师帮忙看下

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 7月30日
    • 创建了问题 7月22日

    悬赏问题

    • ¥15 使用ESP8266连接阿里云出现问题
    • ¥15 被蓝屏搞吐了,有偿求帮解答,Ai回复直接拉黑
    • ¥15 BP神经网络控制倒立摆
    • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
    • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
    • ¥30 Unity接入微信SDK 无法开启摄像头
    • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
    • ¥20 cad图纸,chx-3六轴码垛机器人
    • ¥15 移动摄像头专网需要解vlan
    • ¥20 access多表提取相同字段数据并合并