neuromorphic-paris / chameleon

Qt components for event-based vision
GNU General Public License v3.0
5 stars 1 forks source link

Suggestions for implementing a background grid #50

Open fanpeng-kong opened 5 years ago

fanpeng-kong commented 5 years ago

Hi Alex,

I have been extending the tarsier and chameleon 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 in chameleon, which will help me to align my optical systems in experiments. The to-be-implemented background_grid requires similar parameters to the background_cleaner plus a pitch 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 the background_cleaner class and implement a function to draw the grid in background_grid? Will it be problematic if I invoke both background_cleaner and background_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: Screenshot from 2019-09-26 16-11-38

fanpeng-kong commented 5 years ago

Hi Alex,

I am attempting to display a grid in chameleon after reading some basic OpenGL tutorials.

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

background_grid

grid_display

aMarcireau commented 5 years ago

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

fanpeng-kong commented 5 years ago

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