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

37
LINES

< > BotCompany Repo | #1027322 // Vector Single Fold Live Recognition Spike v2 [with corners]

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

Uses 911K of libraries. Click here for Pure Java version (7744L/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_withCorners(big, pat);
      BWImage fold2 = bwLocalMaximaFilter_autoContrast(fold);
      //showPixelatedZoomedImage(8, fold2);
      //L<Pt> l = listOfBrightestPixels(5, fold2);
      //print(l);
      Pt pInFoldImage = brightestPixel(fold2);
      Pt p = translatePt(-pat.getWidth(), -pat.getHeight(), pInFoldImage);        
    }

    RGBImage rgbBig = rgbMarkPoints(toRGBImage(big), p);
    setImage(mergeRGBImagesHorizontally(rgbBig, toRGBImage(fold2)));
    //setSelection(bestInInputSpace!);
  }
}

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: #1027322
Snippet name: Vector Single Fold Live Recognition Spike v2 [with corners]
Eternal ID of this version: #1027322/7
Text MD5: 439dca3ba12d4f00bb5c74d023b0fbaf
Transpilation MD5: f6ac993a0866e3c94d54446e48bbd0d5
Author: stefan
Category:
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-04 16:01:11
Source code size: 1237 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 204 / 386
Version history: 6 change(s)
Referenced in: [show references]