• 大小: 486KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-13
  • 语言: C#
  • 标签: C#  winform  Json  

资源简介

C#窗口实现百度云人脸识别;百度云返回Json格式内某些属性值的获取;C#调用摄像头拍照,保存图片到本地。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net.Http;
using System.IO;
using System.Net;
using Newtonsoft.Json.Linq;
using AForge.Video.DirectShow;
using System.Drawing.Imaging;
using Newtonsoft.Json;


namespace WindowsFormsApp1
{

    public partial class Form1 : Form
    {

        FilterInfoCollection videoDevices;
        VideoCaptureDevice videoSource;
        public int selectedDeviceIndex = 0;
        public Form1()
        {
            InitializeComponent();

        }
        private void Form1_Load(object sender EventArgs e)
        {

        }

        private void button1_Click(object sender EventArgs e)
        {
            videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            selectedDeviceIndex = 0;
            videoSource = new VideoCaptureDevice(videoDevices[selectedDeviceIndex].MonikerString);//连接摄像头。
            videoSource.VideoResolution = videoSource.VideoCapabilities[selectedDeviceIndex];
            videoSourcePlayer1.VideoSource = videoSource;
            // set Newframe event handler
            videoSourcePlayer1.Start();
        }

        private void textBox1_TextChanged(object sender EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender EventArgs e)
        {

        }

        private void button3_Click(object sender EventArgs e)
        {
            if (videoSource == null)
                return;
            Bitmap bitmap = videoSourcePlayer1.GetCurrentVideoframe();
            string fileName = DateTime.Now.ToString(“yyyy-MM-dd-HH-mm-ss-ff“) + “.jpg“;
            string name = textBox4.Text;
            bitmap.Save(@“E:\ppp“ + fileName ImageFormat.Jpeg);
            bitmap.Dispose();
            textBox1.Text = FaceDetect.detect(fileName);
            textBox2.Text=FaceSearch.search(fileName);
            textBox3.Text = FaceAdd.add(fileName name);

        }

        private void button2_Click(object sender EventArgs e)
        {

        }

        private void button2_Click_1(object sender EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender EventArgs e)
        {

        }

        private void textBox3_TextChanged(object sender EventArgs e)
        {

        }

        private void textBox1_TextChanged_1(object sender EventArgs e)
        {

        }

        private void textBox4_TextChanged(object sender EventArgs e)
        {

        }

        private void videoSourcePlayer1_Click(object sender EventArgs e)
        {

        }
    }

    public static class AccessToken
    {
        // 调用getAccessToken()获取的 access_token建议根据expires_in 时间 设置缓存
        // 返回token示例
        public static String TOKEN = “24.adda70c11b9786206253ddb70affdc46.2592000.1493524354.282335-1234567“;


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        189  2018-12-14 21:16  WindowsFormsApp1\App.config

     文件      44544  2018-12-14 21:36  WindowsFormsApp1\bin\Debug\AForge.Controls.dll

     文件      17920  2018-12-14 21:37  WindowsFormsApp1\bin\Debug\AForge.dll

     文件     262656  2018-12-14 21:36  WindowsFormsApp1\bin\Debug\AForge.Imaging.dll

     文件      68096  2018-12-14 21:36  WindowsFormsApp1\bin\Debug\AForge.Math.dll

     文件      61440  2018-12-14 21:37  WindowsFormsApp1\bin\Debug\AForge.Video.DirectShow.dll

     文件      20992  2018-12-14 21:37  WindowsFormsApp1\bin\Debug\AForge.Video.dll

     文件     526336  2016-06-13 23:06  WindowsFormsApp1\bin\Debug\Newtonsoft.Json.dll

     文件     523221  2016-06-13 23:06  WindowsFormsApp1\bin\Debug\Newtonsoft.Json.xml

     文件      24576  2018-12-23 09:05  WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe

     文件        189  2018-12-14 21:16  WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe.config

     文件      44544  2018-12-23 09:05  WindowsFormsApp1\bin\Debug\WindowsFormsApp1.pdb

     文件      41002  2018-12-16 17:49  WindowsFormsApp1\bin\Debug2018-12-16-17-49-44-70.jpg

     文件       9524  2018-12-22 17:16  WindowsFormsApp1\Form1.cs

     文件      18048  2018-12-18 09:10  WindowsFormsApp1\Form1.Designer.cs

     文件      10836  2018-12-22 17:16  WindowsFormsApp1\Form1.resx

     文件      19861  2018-12-16 16:08  WindowsFormsApp1\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       8166  2018-12-19 14:28  WindowsFormsApp1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2018-12-14 21:16  WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2018-12-14 21:16  WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2018-12-14 21:16  WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件          0  2018-12-19 00:22  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CopyComplete

     文件         42  2018-12-19 14:18  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache

     文件       1910  2018-12-18 20:54  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.FileListAbsolute.txt

     文件       1012  2018-12-18 09:10  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.GenerateResource.cache

     文件     114268  2018-12-15 12:52  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csprojAssemblyReference.cache

     文件      24576  2018-12-23 09:05  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe

     文件       3954  2018-12-23 09:05  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Form1.resources

     文件      44544  2018-12-23 09:05  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.pdb

     文件        180  2018-12-19 15:09  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Properties.Resources.resources

............此处省略25个文件信息

评论

共有 条评论