Package hipi.image.io

Examples of hipi.image.io.ImageEncoder.encodeImage()


    for (int i = 0; i < fileName.length; i++)
    {
      pis = new FileInputStream("data/test/JPEGImageUtilTestCase/truth/" + fileName[i] + ".ppm");
      image = decoder.decodeImage(pis);
      jos = new FileOutputStream("/tmp/" + fileName[i] + ".jpg");
      encoder.encodeImage(image, null, jos);
      Runtime rt = Runtime.getRuntime();
      Process pr = rt.exec("compare -metric PSNR data/test/JPEGImageUtilTestCase/truth/" + fileName[i] + ".ppm /tmp/" + fileName[i] + ".jpg /tmp/psnr.png");
      Scanner scanner = new Scanner(new InputStreamReader(pr.getErrorStream()));
      float psnr = scanner.hasNextFloat() ? scanner.nextFloat() : 0;
      assertTrue(fileName[i] + " PSNR is too low : " + psnr, psnr > 30);
View Full Code Here


    for (int i = 0; i < fileName.length; i++)
    {
      pis = new FileInputStream("data/test/PNGImageUtilTestCase/truth/" + fileName[i] + ".ppm");
      image = decoder.decodeImage(pis);
      pos = new FileOutputStream("/tmp/" + fileName[i] + ".png");
      encoder.encodeImage(image, null, pos);
      Runtime rt = Runtime.getRuntime();
      Process pr = rt.exec("compare -metric MSE data/test/PNGImageUtilTestCase/truth/" + fileName[i] + ".ppm /tmp/" + fileName[i] + ".png /tmp/psnr.png");
      Scanner scanner = new Scanner(new InputStreamReader(pr.getErrorStream()));
      float mse = scanner.hasNextFloat() ? scanner.nextFloat() : -1;
      assertTrue(fileName[i] + " MSE is too high : " + mse, mse == 0);
View Full Code Here

    public void map(ImageHeader key, FloatImage value, Context context)
    throws IOException, InterruptedException {
      if(value != null){
        ImageEncoder encoder = JPEGImageUtil.getInstance();
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        encoder.encodeImage(value, key, os);
        os.close();
        byte[] val = os.toByteArray();
        long sig = 0<<2 | ImageType.JPEG_IMAGE.toValue();
        context.write(new LongWritable(sig), new BytesWritable(val));
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.