Friday, January 10, 2014

An annoying bug I can't find

I have been trying to create a script that will fetch an image file, store it in a 2d grayscale non-alpha byte array based on the x and y axis so I can perform math operations then save that array back to a new image file. I have come close to doing so but something is not doing its job in the process. The resulting image has a lot of dark horizontal static and I upon the many pages I have searched and searched. Still no answer. Could somebody please explain what I am doing wrong here? Below is the basics of what I am doing and between the two big comment boxes is where I will be modifing "byte data[x][y]".

package org.test.proc; import java.awt.image.BufferedImage; import; import; import; import java.awt.image.DataBufferByte; import javax.imageio.ImageIO; public class Main { public static void main(String[] args) { System.out.println(args[0]); BufferedImage img = null; try { img = File(args[0])); } catch (IOException e) { e.printStackTrace(); } int w=img.getWidth(); int h=img.getHeight(); byte[][] dataa = Main.getByteArray(img); ////////////////////////////////// /// ALGORITHM PHASE START /// ////////////////////////////////// ///////////////////////////////// /// ALGORITHM PHASE END /// ///////////////////////////////// byte[] datal = new byte[w*h*3]; int i=0; for (int x=0;x

Full Post

No comments:

Post a Comment