/// <summary> /// Converts an img to a pxStream for processing. Does not binarize. /// </summary> /// <param name="img">Binarized image to use</param> /// <returns>pxStream containing data from img.</returns> public pxStream ImageToPXStream(Image img) { int width = img.Width; pxStream stream = new pxStream(width, img.Height); Bitmap map = new Bitmap(img); for (int y = 0; y < img.Height; y++) { for (int x = 0; x < img.Width; x++) { if (map.GetPixel(x, y).R < 10) { stream.Data.Add(1); } else { stream.Data.Add(0); } } } return(stream); }
/// <summary> /// Sets the data stream to be used. /// </summary> /// <param name="stream">Datastream to set</param> /// <returns>True if success, false if not.</returns> public bool SetDataStream(pxStream stream) { _pxs = stream; return(true); }