网站蜘蛛爬行记录,asp开发网站,大连网页制作培训学校,爱战网关键词挖掘查询工具版权声明#xff1a;本文为博主原创文章#xff0c;转载请在显著位置标明本文出处以及作者网名#xff0c;未经作者允许不得用于商业目的。 斯坦福大学李飞飞团队的风格迁移模型是一种基于深度学习的图像处理技术#xff0c;可以将一张图像的风格转移到另一张图像上。该模型…版权声明本文为博主原创文章转载请在显著位置标明本文出处以及作者网名未经作者允许不得用于商业目的。 斯坦福大学李飞飞团队的风格迁移模型是一种基于深度学习的图像处理技术可以将一张图像的风格转移到另一张图像上。该模型最初由Gatys等人提出后来被李飞飞团队进一步优化和改进。该模型在图像处理领域具有广泛的应用例如艺术风格转换、视频风格迁移等。
原图
10种模型可以在这里下载深度神经网络下的风格迁移模型资源-CSDN文库 处理代码http://blog.csdn.net/uruseibest 风格序号Dim styleindex As Integer 0风格迁移Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click需要测试的图像文件Dim m As New Mat(C:\learnEmgucv\tower.jpg, ImreadModes.Color)Dim hm As Single m.HeightDim wm As Single m.Width10种风格迁移Dim styles(9) As Stringstyles(0) C:\learnEmgucv\styletransfer\eccv16\starry_night.t7styles(1) C:\learnEmgucv\styletransfer\eccv16\composition_vii.t7styles(2) C:\learnEmgucv\styletransfer\eccv16\la_muse.t7styles(3) C:\learnEmgucv\styletransfer\eccv16\the_wave.t7styles(4) C:\learnEmgucv\styletransfer\instance_norm\candy.t7styles(5) C:\learnEmgucv\styletransfer\instance_norm\feathers.t7styles(6) C:\learnEmgucv\styletransfer\instance_norm\la_muse.t7styles(7) C:\learnEmgucv\styletransfer\instance_norm\mosaic.t7styles(8) C:\learnEmgucv\styletransfer\instance_norm\the_scream.t7styles(9) C:\learnEmgucv\styletransfer\instance_norm\udnie.t7https://blog.csdn.net/uruseibestDim net As Dnn.Netnet DnnInvoke.ReadNet(styles(styleindex))Dim blob As Matblob DnnInvoke.BlobFromImage(m, 1.0, New Drawing.Size(wm, hm), New MCvScalar(0, 0, 0), False, False)net.SetInput(blob)Dim mout As New Matmout net.Forward()返回一个四维数组Dim fout(,,,) As Singlefout mout.GetData()返回维度第1维图像数量这里是1 https://blog.csdn.net/uruseibest第2维通道数量 3第3维高度 第4维宽度 在实际中需要将第2维、第3维、第4维提取出来组成一个图像Dim channels As Integer fout.GetLength(1)Dim height As Integer fout.GetLength(2)Dim width As Integer fout.GetLength(3)Dim vm As New VectorOfMatFor i As Integer 0 To channels - 1取出每个通道Dim matr As New Matrix(Of Integer)(New Size(width, height))For j As Integer 0 To height - 1For k As Integer 0 To width - 1matr(j, k) CInt(fout(0, i, j, k))NextNext将每个通道图像加入到VectorOfMat总共3个通道vm.Push(matr.Mat)Nexthttps://blog.csdn.net/uruseibestDim outputmat As New Mat合并通道CvInvoke.Merge(vm, outputmat)ImageBox1.Image outputmatIf styleindex 9 Then styleindex 0 Else styleindex 1
End Sub处理后的图片http://blog.csdn.net/uruseibest 由于.net平台下C#和vb.NET很相似本文也可以为C#爱好者提供参考。
学习更多vb.net知识请参看vb.net 教程 目录