Open fanpeng-kong opened 5 years ago
Hi Alex,
I am attempting to display a grid in chameleon
after reading some basic OpenGL tutorials.
In one solution similar to existing display methods using OpenGL (see my commit 796ca481493f10bca7e2ce3e579c9850bf6ae78b), the grid is drawn correctly and matches the paint_area
when scaling the window. However, the dvs_display and blob_display are blocked by the grid_display.
In the second solution similar to the blob_display
(see my commit 28120ac26236847b435941d0abedd09259264df7), the grid does not block dvs_display and blob_display. But when the window is scaled, the grid is scaled to the canvas instead of the preferred paint_area
From my limited understanding, the second method makes more sense if display various event calculation results but I cant' make the scaling work correctly even I copy the relevant code in the sync
method
Could you please elaborate on the problem?
Thanks, Fanpeng
Hi Fanpeng,
I would use the second approach, as it results in simpler code. I think you can solve your problem by manually updating the position and size of the grid display whenever the paint_area
of the dvs_display
changes in QML. An example can be found here: https://github.com/neuromorphic-paris/tutorials/blob/master/examples/blob_tracker/source/blob_tracker.qml.
In this example, the important part is the onPaintAreaChanged
method of the DvsDisplay
:
DvsDisplay {
...
onPaintAreaChanged: {
blob_display.x = paint_area.x
blob_display.y = paint_area.y
blob_display.width = paint_area.width
blob_display.height = paint_area.height
}
}
Can you let me know if it works?
Cheers, Alex
Thanks for the suggestions, Alex. I have been travelling overseas since last week and did not have much internet access. I found a temporal solution by setting the painter window to the same as the clear area. Will check your versions later when I get back to my office.
Cheer, Fanpeng
Alexandre Marcireau writes:
Hi Fanpeng,
I would use the second approach, as it results in simpler code. I think you can solve your problem by manually updating the position and size of the grid display whenever the paint_area of the dvs_display changes in QML. An example can be found here: https://github.com/neuromorphic-paris/tutorials/blob/master/examples/blob_tracker/source/blob_tracker.qml.
In this example, the important part is the onPaintAreaChanged method of the DvsDisplay:
DvsDisplay { ... onPaintAreaChanged: { blob_display.x = paint_area.x blob_display.y = paint_area.y blob_display.width = paint_area.width blob_display.height = paint_area.height } }
Can you let me know if it works?
Cheers, Alex
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
-- Dr. Fanpeng Kong Postdoctoral Fellow School of Engineering & Information Technology UNSW Canberra Canberra, ACT 2600 Australia Email: f.kong@adfa.edu.au
Hi Alex,
I have been extending the
tarsier
andchameleon
frameworks recently to track multiple spots using average_position and track_blob. One problem I am facing now is that I need to draw a background grid inchameleon
, which will help me to align my optical systems in experiments. The to-be-implementedbackground_grid
requires similar parameters to the background_cleaner plus apitch
parameters to define the size of each grid cell.I had limited experiences with PyQt and know the basics of signal/slot mechanism but have not idea about QML and the OpenGL stuff I saw in
chameleon
. Could you please let me know if I could just copy thebackground_cleaner
class and implement a function to draw the grid inbackground_grid
? Will it be problematic if I invoke bothbackground_cleaner
andbackground_grid
?Thanks in advance!
Cheers, Fanpeng
P.S. Below is a screenshot for tracking multiple spots using average position in each cell for your better understanding: