OpenCV seems to streamline their calculated histogram data through their designed Windows Handle. I have produced the images I need, and calculated the data for raw images that I have taken, but I can seem to for the life of me get this output to a picture box.
I have tried numerous things, and I have been going at its since 8am (11:40 now) and while I can use the the Windows handle to take a screenshot of the given rectangle, it ultimately defeats the purpose of using a picture box.
DllImport("user32.dll")]
public static extern Boolean GetWindowRect(IntPtr hWnd, ref Rectangle bounds);
public Bitmap DrawWindow()
{
Cv2.NamedWindow("Blue", WindowFlags.Normal);
Cv2.ResizeWindow("Blue", new SizeCv(256, 128));
Cv2.ImShow("Blue", _ResultB);
Bitmap ResultB = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(_ResultB);
return ResultB;
}
Everything is commented. OpenCV offers a GetWindowHandle and also a GetWindowImageRectangle. I have tried both, and yes it does work, but the Window still shows and the Image is produces seems sluggish not to load the correct image.
[DllImport("user32.dll")]
public static extern Boolean GetWindowRect(IntPtr hWnd, ref Rectangle bounds);
public Bitmap DrawWindow()
{
Cv2.ImShow("img", _Color);
Cv2.NamedWindow("Blue", WindowFlags.Normal);
Cv2.ResizeWindow("Blue", new SizeCv(256, 128));
Rect rect = Cv2.GetWindowImageRect("Blue");
Bitmap window = new Bitmap(rect.Width, rect.Height);
Graphics g = Graphics.FromImage(window);
Cv2.ImShow("Blue", _ResultB);
g.CopyFromScreen(rect.X, rect.Y, 0, 0, new System.Drawing.Size(rect.Size.Width,
rect.Size.Height), CopyPixelOperation.SourceCopy);
return window;
}
https://i.stack.imgur.com/lwYkb.png