Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

37
LINES

< > BotCompany Repo | #1027302 // Vector Single Fold Live Recognition Spike [works in certain cases, see video]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (7772L/41K).

!7

cmodule VectorLiveRecogSpike2 > DynImageSurfaceAndEnabled {
  switchable int w = 64;
  switchable S prototypeImageID = #1102893;

  transient ReliableSingleThread rstRecog = dm_rst(this, r recognize);
  
  start {
    set zoomToWindowOnSetImage;
    rstRecog.trigger();
    dm_vmBus_onMessage haveVectorImage((mod, _img) -> rstRecog.trigger());
  }
  
  afterVisualize { imageSurface_pixelated(imageSurface); }
  
  void recognize {
    if (!enabled) ret;
    BufferedImage inputImage = dm_getLatestVectorImage();
    
    BWImage big = bwResizeSmooth(w, inputImage);
    BWImage pat = bwResizeSmooth(w/3, loadBWImage(prototypeImageID));
    time "Fold Recog" {
      BWImage fold = bwFoldImage(big, pat);
      BWImage fold2 = bwBlackBorder(pat.getWidth()/2.0, pat.getHeight()/2.0, bwLocalMaximaFilter_autoContrast(fold));
      //showPixelatedZoomedImage(8, fold2);
      //L<Pt> l = listOfBrightestPixels(5, fold2);
      //print(l);
      Pt p = brightestPixel(fold2);
    }

    BWImage fold3 = bwBlackBorder(pat.getWidth()/2.0, pat.getHeight()/2.0, bwAutoContrast(fold));
    RGBImage rgb = toRGBImage(mergeBWImagesHorizontally(big, fold3));
    setImage(rgbMarkPoints(rgb, p));
    //setSelection(bestInInputSpace!);
  }
}

Author comment

Began life as a copy of #1027288

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

-
Snippet ID: #1027302
Snippet name: Vector Single Fold Live Recognition Spike [works in certain cases, see video]
Eternal ID of this version: #1027302/9
Text MD5: 52c46db0c376a12ed0e20f24154e63a7
Transpilation MD5: efe954716380cbec62deea50e684e7fa
Author: stefan
Category: javax / maths
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-02 14:16:37
Source code size: 1269 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 281 / 1459
Version history: 8 change(s)
Referenced in: