想通过不断的截取图片,然后根据图片中的文字或者色块,找到该文字的坐标,有什么好的实现方式吗?或者有更好的实现方法,找出指定位置的坐标!!

解决方案 »

  1.   

    int height = bmp.Height;
                    int width = bmp.Width;
                    Bitmap newBitMap = new Bitmap(width, height);
                    Color pixel;
                    for (int x = 0; x < width; x++)
                    {
                        for (int y = 0; y < height; y++)
                        {
                            pixel = bmp.GetPixel(x, y);
                            int r, g, b, result;
                            result = 0;
                            r = pixel.R;
                            g = pixel.G;
                            b = pixel.B;另,你如果想去模拟点击别人的按扭,可以用勾子,或自己搜windows句柄
      

  2.   

    验证码把,你需要的是YoLo3 /  SSD
      

  3.   

    用视觉库,比如OpenCV,visionPro,halcon等,用其定位工具。
      

  4.   

    有个老库,AForge.Net  http://www.aforgenet.com  可以直接NuGet添加引用
    几行代码就行,一个原图,一个按钮小图,返回的就有坐标AForge.Imaging.ExhaustiveTemplateMatching 类// create template matching algorithm's instance
    // use zero similarity to make sure algorithm will provide anything
    ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching( 0 );
    // compare two images
    TemplateMatch[] matchings = tm.ProcessImage( image1, image2 );
    // check similarity level
    if ( matchings[0].Similarity > 0.95f )
    {
        // do something with quite similar images
    }
      

  5.   


    GetPixel性能极差,这个一定要用unsafe代码,lockbit什么的,性能提高上百倍
      

  6.   

    先转成灰度图,然后用OpenCV的模板匹配函数应该可以实现,1秒钟匹配几次应该没问题。网上搜一下例子,很多。