Note that there are some explanatory texts on larger screens.

plurals
  1. POObtaing the ROI in Visual basic errors in code after conversion from C
    primarykey
    data
    text
    <p>I've been working on obtaining the ROI of an image, I'm trying to get a square shaped box that will hoover around the region an be able to click and get the standard deviation. I'm familiar with c so i used the c to VB converter, but im getting errors that the statement is not valid in namespace. Everything seems to compatible to VB code. I will be grateful for any suggestions on this matter. Thanks</p> <pre><code>Private Function DrawRoi(Image As Bitmap, rect As RectangleF) As oid Dim roi As New Rectangle() roi.X = CInt(CSng(Image.Width) * rect.X) roi.Y = CInt(CSng(Image.Height) * rect.Y) roi.Width = CInt(CSng(Image.Width) * rect.Width) roi.Height = CInt(CSng(Image.Height) * rect.Height) Dim timer As New Stopwatch() timer.Start() ' graphics manipulation takes about 240ms on 1080p image Using roiMaskImage As Bitmap = CreateRoiMaskImage(ImageWithRoi.Width, ImageWithRoi.Height, roi) Using g As Graphics = Graphics.FromImage(ImageWithRoi) g.DrawImage(Image, 0, 0) g.DrawImage(roiMaskImage, 0, 0) Dim borderPen As Pen = CreateRoiBorderPen(ImageWithRoi) g.DrawRectangle(borderPen, roi) End Using End Using Debug.WriteLine("roi graphics: {0}ms", timer.ElapsedMilliseconds) Me.imagePictureBox.Image = ImageWithRoi End Function Private Function CreateRoiMaskImage(width As Integer, height As Integer, roi As Rectangle) As Bitmap Dim image As New Bitmap(width, height, PixelFormat.Format32bppArgb) Using g As Graphics = Graphics.FromImage(image) Dim dimBrush As New SolidBrush(Color.FromArgb(64, 0, 0, 0)) g.FillRectangle(dimBrush, 0, 0, width, height) Dim roiBrush As New SolidBrush(Color.Red) g.FillRectangle(roiBrush, roi) image.MakeTransparent(Color.Red) Return image End Using End Function </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload