Skip to content
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

Suggestions for implementing a background grid #50

Open
fanpeng-kong opened this issue Sep 26, 2019 · 3 comments
Open

Suggestions for implementing a background grid #50

fanpeng-kong opened this issue Sep 26, 2019 · 3 comments

Comments

@fanpeng-kong
Copy link

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
Copy link
Author

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 796ca48), 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 28120ac), 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

background_grid

grid_display

@aMarcireau
Copy link
Member

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
Copy link
Author

fanpeng-kong commented Oct 27, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants