我有一个看起来像这样的图像:

我想找到黑暗部分的边缘就像这样(红线就是我要找的):

我尝试了一些方法,但没有一个工作,所以我希望有一个emgu大师愿意帮助我......
代码(我知道我应该正确处理事情,但我保持代码简短):
var orig = new Image<Bgr, byte>(inFile);
var contours = orig
    .Convert<Gray, byte>()
    .PyrDown()
    .PyrUp()
    .Not()
    .InRange(new Gray(190), new Gray(255))
    .Canny(new Gray(190), new Gray(255))
    .FindContours(CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE,
                  RETR_TYPE.CV_RETR_TREE);
var output = new Image<Gray, byte>(orig.Size);    
for (; contours != null; contours = contours.HNext)
{
    var poly = contours.ApproxPoly(contours.Perimeter*0.05,
                                   contours.Storage);
    output.Draw(poly, new Gray(255), 1);
}
output.Save(outFile);
这是结果:

代码:
var orig = new Image<Bgr, byte>(inFile);
var linesegs = orig
    .Convert<Gray, byte>()
    .PyrDown() …我有一些好奇的东西,我希望.Net专家可以帮助我.
我有一个自定义配置部分,为了掌握它,我这样做:
var s = (TestConfigurationSection)ConfigurationManager
    .GetSection("testSection");
我在我的开发机器上运行它(Windows 764位,Windows完全是最新的),它运行正常.
我把那个代码带到了exe中,然后把它c:\users\public放在Windows Server 2008 R2机器上的一个目录里,以管理员的身份打开命令提示符,运行它然后我得到:
System.Configuration.ConfigurationErrorsException:为testSection创建配置节处理程序时发生错误:请求失败.(C:\ Users\Public\configtest\AppConfigTestConsoleApplication.exe.Config第10行)---> System.Security.SecurityException:请求失败.
现在我更改了代码来执行此操作:
var config = ConfigurationManager.OpenExeConfiguration(
    ConfigurationUserLevel.None);
var s = (TestConfigurationSection) config
    .GetSection("testSection");
它在两台机器上都能正常工作.
所以,我感到有点高兴(就像我的申请工作一样)但是我头脑中的那个小Gremlin很困惑所以我在这里问:
为什么会这样?
在visual studio 2010中创建一个名为AppConfigTestConsoleApplication的新的.net 4控制台应用程序项目Program.cs,并将以下内容替换为:
using System;
using System.Configuration;
namespace AppConfigTestConsoleApplication
{
    public class TestConfigurationSection : ConfigurationSection
    {
        [ConfigurationProperty("someSetting")]
        public int SomeSetting
        {
            get { return (int) this["someSetting"]; }
            set { this["someSetting"] = value; }
        }
    }
    internal class Program
    { …所以我很高兴从Eric Lippert那里读到这篇文章然后,当然,他们的优秀评论和John Payson说:
一个更有趣的例子可能是使用两个静态类,因为这样的程序可能会死锁而没有任何可见的阻塞语句.
我想,是的,这很容易,所以我把它打倒了:
public static class A
{     
    static A()
    {
        Console.WriteLine("A.ctor");
        B.Initialize();
        Console.WriteLine("A.ctor.end");
    }
    public static void Initialize()
    {
        Console.WriteLine("A.Initialize");
    }
}
public static class B
{
    static B()
    {
        Console.WriteLine("B.ctor");
        A.Initialize();
        Console.WriteLine("B.ctor.end");
    }
    public static void Initialize()
    {
        Console.WriteLine("B.Initialize");
    }
    public static void Go()
    {
        Console.WriteLine("Go");
    }
}
其输出(在调用之后B.Go())是:
B.ctor
A.ctor
B.Initialize
A.ctor.end
A.Initialize
B.ctor.end
Go
没有僵局,我显然是一个失败者 - 所以为了使尴尬永久化,这是我的问题:为什么这里没有僵局?
这似乎是我的小的大脑,B.Initialize被称为前的静态构造函数B已完成,我认为这是不允许的.
我正在使用摩托罗拉FX9500 RFID阅读器,它运行带有jamvm版本1.5.0的Linux (我只能部署应用程序 - 我无法更改Java VM或任何其他因此我的选项有限) - 这就是我所看到的我查看版本:
[cliuser@FX9500D96335 ~]$ /usr/bin/jamvm -version
java version "1.5.0"
JamVM version 1.5.4
Copyright (C) 2003-2010 Robert Lougher <rob@jamvm.org.uk>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY …以下代码抛出异常" EntitySqlException:'Group'是保留关键字,除非被转义,否则不能用作别名.在第1行第11列附近 ".
我的问题首先是为什么我在数据上下文中选择的集合的名称和seeminlgy生成的sql查询之间有任何关系?
其次,有什么我可以做的,除了在我的上下文中重命名属性,解决它(我知道名字是愚蠢的,有理由我不能改变名称,就像我想的那样,我赢了'进入这里)?
我可以用modelBuilder做些什么吗?
public class GroupEntity
{
    public int GroupEntityId { get; set; }
    public string Name { get; set; }
}
public class MyContext : DbContext
{
    public MyContext(string nameOrConnectionString)
        : base(nameOrConnectionString)
    {
        Group = Set<GroupEntity>();
    }
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Entity<GroupEntity>().ToTable("GroupEntities");
        base.OnModelCreating(modelBuilder);
    }
    public DbSet<GroupEntity> Group { get; private set; }
}
//...
using (var ctx = new MyContext("valid connection string"))
{
    var e = ctx.Group.Count(a => a.GroupEntityId % 2 == 0);
    // …我试图在一个小的.net 4.0应用程序(使用Visual Studio 2010编写,如果这很重要)中使用任务,需要在Windows 2003上工作并使用带调色板参数的WriteableBitmap.
因此,使用所述类的代码必须作为STA线程运行,以避免它抛出无效的强制转换异常(如果您感兴趣,请参阅此处了解我需要STA线程的原因,但这不是我的问题的主旨).
因此,我检查了堆栈溢出并遇到了如何创建运行STA线程的任务(TPL)?和目前的SynchronizationContext可能不被用作的TaskScheduler -完美的,所以现在我知道该怎么做,只是...
这是一个小控制台应用程序:
using System;
using System.Threading;
using System.Threading.Tasks;
namespace TaskPlayingConsoleApplication
{
    class Program
    {
        [STAThread]
        static void Main()
        {
            Console.WriteLine("Before Anything: " 
                + Thread.CurrentThread.GetApartmentState());
            SynchronizationContext.SetSynchronizationContext(
                new SynchronizationContext());
            var cts = new CancellationTokenSource();
            var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
            var task = Task.Factory.StartNew(
                () => Console.WriteLine(
                    "In task: " + Thread.CurrentThread.GetApartmentState()),
                cts.Token,
                TaskCreationOptions.None,
                scheduler);
            task.ContinueWith(t =>
                 Console.WriteLine(
                   "In continue: " + Thread.CurrentThread.GetApartmentState()),
                   scheduler); …我正在使用ASP .NET MVC 3,我有一个有趣的问题需要解决,我希望得到一些建议.
我有一个页面里面有很多div.每个div的内容随着时间的推移而变化,因此目前我为每个div运行一个计时器,它向服务器发出$ .ajax请求,返回带有div更新内容的PartialViewResult.局部视图非常复杂,并引用其他视图.
这种方法的问题在于它不能很好地扩展.可能是每个用户都有很多这样的计时器在运行,而且很多用户服务器都在不断受到攻击.因此,我宁愿向服务器发出一个请求,该请求可能返回多个div内容,因此它将是:
div1 { some html }
div2 { some html }
...
然后在客户端上,我可以将每个HTML位置放在页面上的正确位置.
我认为我能做的就是从服务器返回JSON但我的问题是 - 如何获取HTML?目前剃刀编译器将运行并将我的部分视图cshtml文件转换为HTML但是如果我返回JSON,是否可以以编程方式调用razor编译器?
我在这里找到了Razor引擎:http://razorengine.codeplex.com/似乎做了我想要的但是可以用vanilla ASP NET MVC做到这一点吗?
或者,考虑到问题,有没有更好的方法可以实现我的目标?
谢谢你的帮助!
我想我可能会遇到这样的情况this is not possible但是如果不是这样的话......
我编写了一个ASP .NET MVC 3应用程序,我正在使用Request.UserHostName属性,然后将返回的值传递给Dns.GetHostEntry,以找出当前连接的客户端的所有可能的IP和主机名,例如:
var clientAddress = Request.UserHostName;
var entry = Dns.GetHostEntry(clientAddress);
通常这很好,除了我有一个案例,我从Dns.GetHostEntry调用得到"主机未找到" SocketException.
真正奇怪的是,从Request.UserHostName属性返回的地址不是公共地址或任何私有地址.为了证明这一点,我在有问题的客户端机器上运行了这段代码......
var host = Dns.GetHostEntry(Dns.GetHostName());
foreach (var a in host.Aliases)
{
    Console.WriteLine("alias '{0}'", a);
}
foreach (var a in host.AddressList)
{
    Console.WriteLine("ip address '{0}'", a);
}
// ...from http://stackoverflow.com/a/2353177/1039947...
String direction = "";
WebRequest request = WebRequest.Create("http://checkip.dyndns.org/");
using (WebResponse response = request.GetResponse())
{
    using (var stream = new StreamReader(response.GetResponseStream())) …我正在为活动(如音乐会)开发一个在线票务系统.基本部分是座位表,向访客提供可供选择的座位/门票.一旦他们做出选择,系统会立即尝试将票证保留10分钟(通过将票证ID输入到票证ID为关键字的表格中).只有在预订成功的情况下,才会出现付款按钮以进行付款.
这一切都很好.机票预订对我来说不是问题.我可以在我的系统中处理它.但是一旦paypal进入游戏,事情变得困难.
问题:如果用户由于某种原因花了很多时间在Paypal(超过10分钟),我网站上的机票预订将到期,允许其他访客购买机票,这可能发生在访客1进入之前付款.访客1看不到任何此类因为他仍处于PayPal ...在某个时间点,他将设法付款(例如15分钟后),这将完美地起作用,因为paypal对过期的预订一无所知.
最后,我可能有两个访客为同一张票/座位付款!
我怎样才能防止这种情况发生?如果涉及两个系统且其中一个系统无法控制,您如何处理竞争条件?
我的想法是:实际上应该在付款之前进行检查,但当然我无法控制PayPal中发生的事情!
我知道我可以使用Paypal的IPN等,但这只发生在付款后为时已晚.
或者,如果paypal通过API要求我确认付款,那将是很好的.然后,如果门票被卖给别人,我可以说"不".但我不认为这是可能的贝宝.
concurrency payment paypal race-condition conditional-statements
我正在运行AT命令AT + KCELL以获取小区信息,并返回PLMN(公共陆地和移动网络) - 文档中的描述如下:
PLMN标识符(3个字节),由MCC(移动国家代码)和MNC(移动网络代码)组成.
好吧,这与维基百科所说的相符 - 有MCC和MNC.现在我不明白的是如何提取上述MCC和MNC值?
这是一个例子.我回来了:
32f210
我被告知(虽然我持怀疑态度),这应该导致:
MNC: 1
MCC: 232
但我不能为我的生活弄清楚如何从PLMN获得结果,那我该如何解析呢?
c# ×7
.net ×6
asp.net-mvc ×2
.net-4.0 ×1
asp.net ×1
at-command ×1
code-first ×1
concurrency ×1
emgucv ×1
gsm ×1
jamvm ×1
java ×1
opencv ×1
payment ×1
paypal ×1
poco ×1
razor ×1
wpf ×1