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).

1  
!7
2  
3  
cmodule VectorLiveRecogSpike2 > DynImageSurfaceAndEnabled {
4  
  switchable int w = 64;
5  
  switchable S prototypeImageID = #1102893;
6  
7  
  transient ReliableSingleThread rstRecog = dm_rst(this, r recognize);
8  
  
9  
  start {
10  
    set zoomToWindowOnSetImage;
11  
    rstRecog.trigger();
12  
    dm_vmBus_onMessage haveVectorImage((mod, _img) -> rstRecog.trigger());
13  
  }
14  
  
15  
  afterVisualize { imageSurface_pixelated(imageSurface); }
16  
  
17  
  void recognize {
18  
    if (!enabled) ret;
19  
    BufferedImage inputImage = dm_getLatestVectorImage();
20  
    
21  
    BWImage big = bwResizeSmooth(w, inputImage);
22  
    BWImage pat = bwResizeSmooth(w/3, loadBWImage(prototypeImageID));
23  
    time "Fold Recog" {
24  
      BWImage fold = bwFoldImage_withCorners(big, pat);
25  
      BWImage fold2 = bwLocalMaximaFilter_autoContrast(fold);
26  
      //showPixelatedZoomedImage(8, fold2);
27  
      //L<Pt> l = listOfBrightestPixels(5, fold2);
28  
      //print(l);
29  
      Pt pInFoldImage = brightestPixel(fold2);
30  
      Pt p = translatePt(-pat.getWidth(), -pat.getHeight(), pInFoldImage);        
31  
    }
32  
33  
    RGBImage rgbBig = rgbMarkPoints(toRGBImage(big), p);
34  
    setImage(mergeRGBImagesHorizontally(rgbBig, toRGBImage(fold2)));
35  
    //setSelection(bestInInputSpace!);
36  
  }
37  
}

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: 206 / 389
Version history: 6 change(s)
Referenced in: [show references]