所以总的来说,我对计算机视觉还很陌生。我目前正在尝试通过分析 2 个图像来计算单应性。我想使用单应性来校正 1 个图像的视角以匹配另一个。但我得到的比赛既糟糕又错误。所以我所做的单应扭曲完全关闭。
我正在使用 EmguCV 在 C# 中包装 opencv。我知道我的代码似乎“正常”工作。
我加载我的两个图像并声明一些变量来存储计算工件。
(Image<Bgr, byte> Image, VectorOfKeyPoint Keypoints, Mat Descriptors) imgModel = (new Image<Bgr, byte>(imageFolder + "image0.jpg").Resize(0.2, Emgu.CV.CvEnum.Inter.Area), new VectorOfKeyPoint(), new Mat());
(Image<Bgr, byte> Image, VectorOfKeyPoint Keypoints, Mat Descriptors) imgTest = (new Image<Bgr, byte>(imageFolder + "image1.jpg").Resize(0.2, Emgu.CV.CvEnum.Inter.Area), new VectorOfKeyPoint(), new Mat());
Mat imgKeypointsModel = new Mat();
Mat imgKeypointsTest = new Mat();
Mat imgMatches = new Mat();
Mat imgWarped = new Mat();
VectorOfVectorOfDMatch matches = new VectorOfVectorOfDMatch();
VectorOfVectorOfDMatch filteredMatches = …Run Code Online (Sandbox Code Playgroud) 所以我偶然发现了以下情况:
Console.WriteLine(currentRow["Projekt"]);
Console.WriteLine($"{currentRow["Projekt"]}");
Console.WriteLine($"{(string)currentRow["Projekt"]}");
Run Code Online (Sandbox Code Playgroud)
随着输出:
> Data that i want
> Namespace.ExcelDataField
> Data that i want
Run Code Online (Sandbox Code Playgroud)
ExcelDataField我显然是一个类,我写的是帮助我从excel表中读取数据.我尝试将其实现为与MoveFirst/Next类似的VBA DAO访问,并始终暴露1行数据(currentRow).
我使用ExcelDataField类来封装来自excel表格的数据,因为数据来自excel表格中的dynmic.
public class ExcelDataField<T>
{
private Excel.Range m_XlRange;
private int m_Row;
private int m_Col;
public T Data
{
get
{
return (T)(this.m_XlRange.Cells[this.m_Row, this.m_Col] as Excel.Range)?.Value2;
}
set
{
this.m_XlRange.Cells[this.m_Row, this.m_Col] = value;
}
}
public ExcelDataField(Excel.Range range, int row, int col)
{
this.m_XlRange = range;
this.m_Row = row;
this.m_Col = col;
}
public static implicit operator T(ExcelDataField<T> dataField)
{
return dataField.Data; …Run Code Online (Sandbox Code Playgroud) 我目前正在探索神经网络和机器学习,我在c#中实现了一个基本的神经网络.现在我想用MNIST数据库测试我的反向传播训练算法.虽然我在正确阅读文件时遇到了严重问题.
Spoiler代码目前针对性能进行了非常优化.我的目标是掌握主题,并在开始抛弃我的数据结构以获得更快的数据结构之前获得结构化的视图.
为了训练网络,我想为它提供一个自定义的TrainingSet数据结构:
[Serializable]
public class TrainingSet
{
public Dictionary<List<double>, List<double>> data = new Dictionary<List<double>, List<double>>();
}
Run Code Online (Sandbox Code Playgroud)
键将是我的输入数据(每个条目784像素(图像),它将表示0到1范围内的灰度值).值将是我的输出数据(10个条目表示0-9的数字,所有条目都在0,除了1中的exspected一个)
现在我想根据这份合同阅读MNIST数据库.我现在正在进行第二次尝试,受到这篇博文的启发:https://jamesmccaffrey.wordpress.com/2013/11/23/reading-the-mnist-data-set-with-c/ .可悲的是,它仍然产生与我第一次尝试以奇怪的模式散射像素相同的废话:

我目前的阅读算法:
public static TrainingSet GenerateTrainingSet(FileInfo imagesFile, FileInfo labelsFile)
{
MnistImageView imageView = new MnistImageView();
imageView.Show();
TrainingSet trainingSet = new TrainingSet();
List<List<double>> labels = new List<List<double>>();
List<List<double>> images = new List<List<double>>();
using (BinaryReader brLabels = new BinaryReader(new FileStream(labelsFile.FullName, FileMode.Open)))
{
using (BinaryReader brImages = new BinaryReader(new FileStream(imagesFile.FullName, FileMode.Open)))
{
int magic1 = brImages.ReadBigInt32(); //Reading as BigEndian
int numImages = …Run Code Online (Sandbox Code Playgroud) 我目前正致力于实现惰性定位自托管WCF服务.这些服务在与客户端和主机的公共接口中定义合同,这些接口必须从中继承IWCFServiceBase.
在WCFHost主机之后由类型参数指定的接口约束IWCFServiceBase:public class WCFHost<T> where T : WCFServiceBase, IWCFServiceBase客户端可以通过指定接口和服务标识符来订阅此主机:public class WCFClient<T> : IDisposable where T : IWCFServiceBase.到目前为止,这个功能完美无瑕.
现在,我想尝试排序"Lazy-Discover"服务,并为每个已发现的服务保持可用的通道.此功能由定位器提供,该定位器保存此结构中的所有已发现服务:public Dictionary<string, Dictionary<IWCFServiceBase, WCFClient<IWCFServiceBase>>> Services;
现在假设之前已经使用过服务,因此它已经被发现并保存在字典中,我使用以下代码来检索它:
public WCFClient<T> GetMicroService<T>(string servicename, T contract) where T : IWCFServiceBase
{
if (this.Services.ContainsKey(servicename) && this.Services[servicename].ContainsKey(contract))
{
return this.Services[servicename][contract];
}
}
Run Code Online (Sandbox Code Playgroud)
该类型Client.WCFClient<WCFCommunication.IWCFServiceBase>无法隐式转换为Client.WCFClient<T>.
显然,T != IWCFServiceBase除非您考虑类型约束,否则就是这种情况where T : IWCFServiceBase.
所以,为什么C#不这样做,我出错了什么?我觉得在尝试使用泛型时一定有一个很大的错误.
这将一个值传递给一个 blazor 组件
[Parameter]
public string Id { get; set; }
Run Code Online (Sandbox Code Playgroud)
但是从 URL 输入参数传递一个值呢?
我目前正在尝试获取 gRPC 工作的示例。我使用 C# Asp.NET Core WebApi 作为服务器,并尝试通过 Python 客户端连接到它。
我的原型文件:
syntax = "proto3";
service Example {
rpc Insert (InsertRequest) returns (Empty);
rpc Update (UpdateRequest) returns (Empty);
rpc Delete (DeleteRequest) returns (Empty);
}
message InsertRequest {
int32 Value = 1;
}
message UpdateRequest {
string Id = 1;
int32 Value = 2;
}
message DeleteRequest {
string Id = 1;
}
message Empty { }
Run Code Online (Sandbox Code Playgroud)
Python 客户端:
import grpc
import example_pb2
import example_pb2_grpc
with grpc.insecure_channel('localhost:5001') as channel:
stub = …Run Code Online (Sandbox Code Playgroud) c# ×6
asp.net ×1
asp.net-core ×1
blazor ×1
constraints ×1
excel ×1
file-format ×1
generics ×1
grpc ×1
mnist ×1
opencv ×1
python ×1
string ×1