-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AreaDetector_Display: Draw lines on top of camera image #15
Comments
@zunbeltz I think that should work, though it wasn't clear to me what was being shown (like, is there a line, but it's just in the wrong place?). Perhaps the values to bitmap = wx.BitmapFromImage(wximage)
bitmap_width, bitmap_height = bitmap.GetSize()
dc = wx.AutoBufferedPaintDC(wxpanel)
dc.DrawBitmap(bitmap, 0, 0, useMask=True)
dc.BeginDrawing()
dc.SetPen(wx.Pen('Red', 1.5, wx.SOLID))
dc.DrawLine(0, bitmap_height/2, bitmap_width, bitmap_height/2)
dc.EndDrawing() That is, you're drawing on the bitmap, not the image, and it might be simpler to work in bitmap coordinates. Another option for simple lines is to use the AreaDetector overlay feature. That would add the line to the incoming arraydata. It's not as flexible as drawing on the image with wx, but can draw lines. |
@newville This code snippest work fine. I put it in bitmap = wx.BitmapFromImage(img)
bitmap_width, bitmap_height = bitmap.GetSize()
dc = wx.AutoBufferedPaintDC(self)
dc.DrawBitmap(bitmap, 0, 0, useMask=True)
dc.BeginDrawing()
dc.SetPen(wx.Pen('Red', 1.5, wx.SOLID))
dc.DrawLine(0, bitmap_height/2, bitmap_width, bitmap_height/2)
dc.DrawLine(bitmap_width/2, 0, bitmap_width/2, bitmap_height)
dc.EndDrawing() And the lines apear on the center of the image. Is there any way to put this code outside the |
@zunbeltz I'm not sure I understand the question. What code do you want to put outside ImageView? You mean code about the device context? In general, I think ImageView and AD_Display could be greatly improved. I've been playing recently with an alternative (simpler) implementation, which is currently incomplete in I'm not sure it is possible to attach more than one device context to a wxPanel. What do you have in mind? |
Yes. I was thinking of putting the code that draws the lines outside the og., 2015.eko ekaren 11a 17:36(e)an, Matt Newville igorleak idatzi zuen:
|
@zunbeltz Generally on creates, uses, and completes a But: I also want to be able to specify a few lines, circles, etc to be drawn on the image panel. I'm thinking of adding a "draw_objects" argument that is a list of dicts that specifies (shape, color, linewidth, and size), perhaps
which would use fractional coordinates, and get converted to the right FWIW, I'm also thinking of reorganizing all the epicsapp code into a single module, as it's becoming obvious that we need high-level, reusable GUI components. |
Finally I got working whar I need. I just pass the calculated points to the What I did is just a hack, no very elegant code. I will follow with interest the changes. I maybe can help testing or with
|
My aim is to draw some lines on top of the image. As far as I understood how imageview works,
it should be done directly on the
DrawImage
method using dedc
instance (unless we do it a instance attribute). I plugged the following line in the code:But it doesn't seem to be a line on the center in my 1024x1024 image.
The image it also not shown completely on the frame even if the application is maximaized.
The text was updated successfully, but these errors were encountered: