コード例 #1
0
  private void displayCurrentPatch(
      FImage unwarped,
      float unwarpedx,
      float unwarpedy,
      FImage warped,
      int warpedx,
      int warpedy,
      Matrix transform,
      float scale) {
    DisplayUtilities.createNamedWindow("warpunwarp", "Warped and Unwarped Image", true);
    logger.debug("Displaying patch");
    float resizeScale = 5f;
    float warppedPatchScale = resizeScale;
    ResizeProcessor patchSizer = new ResizeProcessor(resizeScale);
    FImage warppedPatchGrey = warped.process(patchSizer);
    MBFImage warppedPatch =
        new MBFImage(warppedPatchGrey.clone(), warppedPatchGrey.clone(), warppedPatchGrey.clone());
    float x = warpedx * warppedPatchScale;
    float y = warpedy * warppedPatchScale;
    float r = scale * warppedPatchScale;

    warppedPatch.createRenderer().drawShape(new Ellipse(x, y, r, r, 0), RGBColour.RED);
    warppedPatch.createRenderer().drawPoint(new Point2dImpl(x, y), RGBColour.RED, 3);

    FImage unwarppedPatchGrey = unwarped.clone();
    MBFImage unwarppedPatch =
        new MBFImage(
            unwarppedPatchGrey.clone(), unwarppedPatchGrey.clone(), unwarppedPatchGrey.clone());
    unwarppedPatch = unwarppedPatch.process(patchSizer);
    float unwarppedPatchScale = resizeScale;

    x = unwarpedx * unwarppedPatchScale;
    y = unwarpedy * unwarppedPatchScale;
    //		Matrix sm = state.selected.secondMoments;
    //		float scale = state.selected.scale * unwarppedPatchScale;
    //		Ellipse e = EllipseUtilities.ellipseFromSecondMoments(x, y, sm, scale*2);
    Ellipse e =
        EllipseUtilities.fromTransformMatrix2x2(transform, x, y, scale * unwarppedPatchScale);

    unwarppedPatch.createRenderer().drawShape(e, RGBColour.BLUE);
    unwarppedPatch.createRenderer().drawPoint(new Point2dImpl(x, y), RGBColour.RED, 3);
    // give the patch a border (10px, black)
    warppedPatch = warppedPatch.padding(5, 5, RGBColour.BLACK);
    unwarppedPatch = unwarppedPatch.padding(5, 5, RGBColour.BLACK);

    MBFImage displayArea =
        warppedPatch.newInstance(warppedPatch.getWidth() * 2, warppedPatch.getHeight());
    displayArea.createRenderer().drawImage(warppedPatch, 0, 0);
    displayArea.createRenderer().drawImage(unwarppedPatch, warppedPatch.getWidth(), 0);
    DisplayUtilities.displayName(displayArea, "warpunwarp");
    logger.debug("Done");
  }
コード例 #2
0
 private void displayFrame(FImage image) {
   DisplayUtilities.displayName(image, "inputFrame");
 }