Commit fcc459f9 SK

Merge branch 'master' of https://gitee.com/sunky045/FeedCounter

2 个父辈 38889d63 8664e608
......@@ -26,12 +26,31 @@ namespace Acc.Img
{
if (imagePath.ToLower().EndsWith(".raw"))
{
pngB = false;
Bitmap[] images = ReadRaw(imagePath);
if (images != null)
pngB = false;
byte[] src = System.IO.File.ReadAllBytes(imagePath);
int width = 3072;
int height = 3072;
int n = 0;
byte[] buff = new byte[src.Length * 3];
for (int i = 0; i < src.Length; i += 2)
{
image = images[1];
short ss = BitConverter.ToInt16(src, i);
ss *= 10;
byte[] bb = BitConverter.GetBytes(ss);
buff[n++] = bb[0];
buff[n++] = bb[1];
buff[n++] = bb[0];
buff[n++] = bb[1];
buff[n++] = bb[0];
buff[n++] = bb[1];
}
Bitmap bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format48bppRgb);
System.Drawing.Imaging.BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, width, height), System.Drawing.Imaging.ImageLockMode.ReadWrite, bmp.PixelFormat);
System.Runtime.InteropServices.Marshal.Copy(buff, 0, bmpData.Scan0, bmpData.Stride * height);
bmp.UnlockBits(bmpData);
//bmp.Save(@"C:\Users\ASA\Desktop\222.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
image= bmp;
}
else
{
......@@ -548,7 +567,7 @@ namespace Acc.Img
if (pngB)
{
Cv2.Threshold(dst, dst, 70, 255, ThresholdTypes.Binary);
Cv2.Threshold(dst, dst, 70, 150, ThresholdTypes.BinaryInv);
Cv2.Threshold(dst, dst, 0, 150, ThresholdTypes.BinaryInv);
}
else
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!