本文介绍了我不能让它适用于vb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我尝试使用vb.net进行面部检测。



我这样做: 


 Const APIKEY As String =" my api密钥QUOT; 

Dim faceservice As New FaceServiceClient(APIKEY)

[...]


然后我得到了我的文件路径进入'filelist'var。


然后我调用:

私有异步函数run()As Task 

For i = 1 to filelist.Count - 1

使用imageFileStream As System.IO.FileStream = IO.File.OpenRead(filelist(i - 1))

Dim faces1 = Await faceservice.DetectAsync(imageFileStream)
Dim faceid1 = faces1(0).FaceId

结束使用

使用imageFileStream2 As System.IO.FileStream = IO.File.OpenRead(filelist(i))

Dim faces2 = Await faceservice.DetectAsync(imageFileStream2)
Dim faceid2 = faces2(0).FaceId

结束使用


下一个


结束功能

但是调用不返回任何面(faces1和face2什么都不是)并且没有错误发生。



任何人都可以帮助我吗? :)



(抱歉,英语不是我的母语)



编辑:我添加了对ClientLibrary的引用,而不是我在c#sdk中找到的,我添加了这个: 

 Imports Microsoft.ProjectOxford .Face 

Imports Microsoft.ProjectOxford.Face.Contract








解决方案

Hi,

I try to make face detection works with vb.net.

I make it like this : 

Const APIKEY As String = "my api key"

Dim faceservice As New FaceServiceClient(APIKEY)

[...]

Then i get my file paths into 'filelist' var.

then i call :

 Private Async Function run() As Task

        For i = 1 To filelist.Count - 1

            Using imageFileStream As System.IO.FileStream = IO.File.OpenRead(filelist(i - 1))

                Dim faces1 = Await faceservice.DetectAsync(imageFileStream)
                Dim faceid1 = faces1(0).FaceId

            End Using

            Using imageFileStream2 As System.IO.FileStream = IO.File.OpenRead(filelist(i))

                Dim faces2 = Await faceservice.DetectAsync(imageFileStream2)
                Dim faceid2 = faces2(0).FaceId

            End Using


        Next


    End Function

But the call doesn't return any faces (faces1 and face2 are nothing) and no errors occurs.

Can anyone please help me ? :)

(sorry, english is not my mother language)

edit : i added a reference to ClientLibrary than i found into c# sdk and i added this : 

Imports Microsoft.ProjectOxford.Face

Imports Microsoft.ProjectOxford.Face.Contract
解决方案


这篇关于我不能让它适用于vb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 04:05