public void draw() { if (cam.available()) { cam.read(); image(cam, 0, 0); text("Click to upload to Flickr", 10, height - 13); } fill(255, 0, 0); rect(0, 0, 25, 25); }
public static void main(String[] args) { Capture capture = new Capture(); // litleTxnId contains the Litle Transaction Id returned on the authorization capture.setLitleTxnId(100000000000000011L); capture.setAmount(1200L); // Capture $12 dollars of a previous authorization CaptureResponse response = new LitleOnline().capture(capture); // Display Results System.out.println("Response: " + response.getResponse()); System.out.println("Message: " + response.getMessage()); System.out.println("Litle Transaction ID: " + response.getLitleTxnId()); if (!response.getMessage().equals("Approved")) throw new RuntimeException(" The CapturePartialExample does not give the right response"); }
/** * Creates (and processes) a new Capture Transaction added as a related resource. * * @param apiContext {@link APIContext} used for the API call. * @param capture Capture * @return Capture * @throws PayPalRESTException */ public Capture capture(APIContext apiContext, Capture capture) throws PayPalRESTException { if (apiContext == null) { throw new IllegalArgumentException("APIContext cannot be null"); } if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) { throw new IllegalArgumentException("AccessToken cannot be null or empty"); } if (apiContext.getHTTPHeaders() == null) { apiContext.setHTTPHeaders(new HashMap<String, String>()); } apiContext .getHTTPHeaders() .put(Constants.HTTP_CONTENT_TYPE_HEADER, Constants.HTTP_CONTENT_TYPE_JSON); apiContext.setSdkVersion(new SDKVersionImpl()); if (this.getId() == null) { throw new IllegalArgumentException("Id cannot be null"); } if (capture == null) { throw new IllegalArgumentException("capture cannot be null"); } Object[] parameters = new Object[] {this.getId()}; String pattern = "v1/payments/orders/{0}/capture"; String resourcePath = RESTUtil.formatURIPath(pattern, parameters); String payLoad = capture.toJSON(); return configureAndExecute(apiContext, HttpMethod.POST, resourcePath, payLoad, Capture.class); }
public void setup() { size(320, 240); String[] devices = Capture.list(); println(devices); // Set up the camera. // cam = new Capture(this, 320, 240); cam = new Capture(this, width, height, devices[10]); // cam.start(); // Set up Flickr. flickr = new Flickr(apiKey, secretKey, (new Flickr(apiKey)).getTransport()); // Authentication is the hard part. // If you're authenticating for the first time, this will open up // a web browser with Flickr's authentication web page and ask you to // give the app permission. You'll have 15 seconds to do this before the Processing app // gives up waiting fr you. // After the initial authentication, your info will be saved locally in a text file, // so you shouldn't have to go through the authentication song and dance more than once authenticate(); // Create an uploader uploader = flickr.getUploader(); }
public void setup() { webcam = new Capture(this, width, height); cv = new OpenCV(this, width, height); webcam.start(); cv.loadCascade(OpenCV.CASCADE_FRONTALFACE); }
public void draw() { if (cam.available() == true) { cam.read(); pushMatrix(); scale(-1, 1); translate(-cam.width, 0); image(cam, 0, 0); popMatrix(); // image(cam, 0,0); try { // Now test to see if it has a QR code embedded in it LuminanceSource source = new BufferedImageLuminanceSource((BufferedImage) cam.getImage()); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); Result result = reader.decode(bitmap); // Once we get the results, we can do some display if (result.getText() != null) { println(result.getText()); ResultPoint[] points = result.getResultPoints(); // Draw some ellipses on at the control points for (int i = 0; i < points.length; i++) { // fill(#ff8c00); ellipse(points[i].getX(), points[i].getY(), 20, 20); // fill(#ff0000); text(i, points[i].getX(), points[i].getY()); } // Now fetch the book cover, if it is found if (!result.getText().equals(lastISBNAcquired)) { String url = "http://covers.oreilly.com/images/" + result.getText() + "/cat.gif"; try { cover = loadImage(url, "gif"); lastISBNAcquired = result.getText(); } catch (Exception e) { cover = null; } } // Superimpose the cover on the image if (cover != null) { image(cover, points[1].getX(), points[1].getY()); } } } catch (Exception e) { // println(e.toString()); } } }
public void setup() { size(640, 480); PFont metaBold; // The font "Meta-Bold.vlw" must be located in the // current sketch's "data" directory to load successfully metaBold = loadFont("SansSerif-48.vlw"); textFont(metaBold, 36); cam = new Capture(this, WIDTH, HEIGHT); cam.start(); }
/** * Creates (and processes) a new Capture Transaction added as a related resource. * * @param apiContext {@link APIContext} used for the API call. * @param capture Capture * @return Capture * @throws PayPalRESTException */ public Capture capture(APIContext apiContext, Capture capture) throws PayPalRESTException { if (this.getId() == null) { throw new IllegalArgumentException("Id cannot be null"); } if (capture == null) { throw new IllegalArgumentException("capture cannot be null"); } Object[] parameters = new Object[] {this.getId()}; String pattern = "v1/payments/orders/{0}/capture"; String resourcePath = RESTUtil.formatURIPath(pattern, parameters); String payLoad = capture.toJSON(); return configureAndExecute(apiContext, HttpMethod.POST, resourcePath, payLoad, Capture.class); }
public static void main(String[] args) { BufferedImage image = Capture.load(OCRTest.class, "cyclopst1.png"); BufferedImage template = Capture.load(OCRTest.class, "cyclopst3.png"); // rgb image lookup { List<GPoint> pp = NCC.lookupAll(new ImageBinaryRGB(image), new ImageBinaryRGB(template), 0.9f); for (GPoint p : pp) { System.out.println(p); } } // grey image lookup { List<GPoint> pp = NCC.lookupAll(new ImageBinaryGrey(image), new ImageBinaryGrey(template), 0.9f); for (GPoint p : pp) { System.out.println(p); } } }
public void captureEvent(Capture c) { c.read(); }
private Engine(ConfigFile config) throws FileNotFoundException, IncompatibleArgumentException { outBuffer = new ArrayList<>(8); irHardware = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); config .getIrHardware() .stream() .forEach( (GirsHardware hw) -> { irHardware.put(hw.getName(), hw); }); modules = new TreeMap<>(); // Set up the special modules registerModule(Parameters.newParameterModule()); // May override values in the code Parameters.getInstance().addAll(config.getOptions()); Parameters.getInstance() .add( new StringParameter( "hardwareList", Utils.sortedString(irHardware.keySet(), " "), "List of available hardware")); registerModule(Base.newBase()); try { renderer = new Renderer(Parameters.getInstance().getString(Parameters.IRPPROTOCOLSINI)); registerModule(renderer); } catch (NoSuchParameterException ex) { logger.log( Level.WARNING, Parameters.IRPPROTOCOLSINI + " not defined; rendering will not be available"); } if (config.getRemoteCommandsDataBase() != null) registerModule(NamedRemotes.newNamedRemotes(config.getRemoteCommandsDataBase())); irp = new Irp(); registerModule(irp); registerModule(Transmit.newTransmit(renderer, irp)); registerModule(Transmitters.newTransmittersModule()); registerModule(Capture.newCapture()); registerModule(Receive.newReceive()); config .getModuleList() .stream() .forEach( (module) -> { try { registerModule(module.instantiate()); } catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { logger.log(Level.SEVERE, null, ex); } }); irHardware .values() .forEach( (GirsHardware ghw) -> { if (ghw.isImmediateOpen()) { ghw.getHardware().setVerbosity(isVerbosity()); try { ghw.getHardware().open(); } catch (HarcHardwareException | IOException ex) { logger.log(Level.WARNING, null, ex); } } }); }