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

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(big, pat);
25  
      BWImage fold2 = bwBlackBorder(pat.getWidth()/2.0, pat.getHeight()/2.0, bwLocalMaximaFilter_autoContrast(fold));
26  
      //showPixelatedZoomedImage(8, fold2);
27  
      //L<Pt> l = listOfBrightestPixels(5, fold2);
28  
      //print(l);
29  
      Pt p = brightestPixel(fold2);
30  
    }
31  
32  
    BWImage fold3 = bwBlackBorder(pat.getWidth()/2.0, pat.getHeight()/2.0, bwAutoContrast(fold));
33  
    RGBImage rgb = toRGBImage(mergeBWImagesHorizontally(big, fold3));
34  
    setImage(rgbMarkPoints(rgb, p));
35  
    //setSelection(bestInInputSpace!);
36  
  }
37  
}

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: 280 / 1459
Version history: 8 change(s)
Referenced in: [show references]