Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

trouble with backends and opengl

Hello.
I am really enjoing opensesame thus far, ist seems to be very well suited for my purposes and i was able to get a lot done with the inline script modules. However, I have run into a few problems with my experiment. right now i am using the xpyriment backend with opengl enabeled.

The experiment is supposed to do the following things:
1 present video stimulus and record respondent's input from a gamepad. I got that working pretty well with the media_player_mpy. It checks the joystick device every frame and writes the state to a csv file. The performance is good and accuracy is sufficient.
2 output realtime 2d graphics to which respondents have to react and that change depending on the input. In this case an analog axis of the joystick controls the length of a box. I got that working with a constantly updating canvas on which a rect gets drawn. From what i understand the canvas object was not indendet to output in realtime, therefore performace and accuracy is ok with one rect being drawn, but mutliple objects and especially running at hd resolution push the update rate down to 15hz on a pretty beefy machine. Accuracy and performace are therfore not sufficient.
In a perfect world these two things (video and interactive 2d) would work simultaneously; 2d shapes overlayed onto the video but for now it is sufficient to habe both in sequence.

Solutions i tried to achieve video playback and good realtime 2d:
1 switch to legacy backend: this seems to work in principle but in practice the video playback is stuttery, not unusable but unpleasant to look at. Also a lot of my scripting does not work anymore, for example the realtime canvas does not update as it should. The scripts can surely be fixed but i would really prefer the video playback to be nice so investing time adapting the scripts does probaply not pay off.
2 switching to psychpy backend: This seems to be able to perform well but i think major adaptations to my code would be needed. That alone would be ok, however the psychopy documentation is an absolute mess for an outsider like me. I tried setting up a video file as stimulus and after long hours of searching through unmaintained documentation gave up becaus ffmpeg was not found. With enough time this might be fixable but when a basic task is allready such a hassle i anticipate the rest of the way to be hell.
3 expyriment backend with no opengl: This increases the performace of the realtime canvas update drastically, however video playback seems to be broken when opengl is disabeled. The experiment simply closes instantly when a videoplayer block is added. so i tried...
4 switching to opencv2 for video presentation: i was not able to install opencv sucessfully, neither by pip nor manually, the documentation is not clear to me.

Solutions i would like to try but don't know how to:
switch opengl on and off as needed. This would currently be the ideal scenario. my current code would stay intact and i could use the smooth video playback with opengl and the fast canvas updating without opengl.
Chain experiments. If the on-the-fly manipulation of opengl is not possible chaining experiment files might be a workaround, so at the end of the first experiment, the second would automatically be started.
Some other way to draw 2d shapes with better performance: maybe with pygame? But from what i understand pygame can not draw onto canvas objects. Maybe there is another way?

I know my problem is a little abstract, i am not a programmer and at the same time i try to do things that go outside the normal applications of opensesame, but maybe someone has an idea of how i can present smooth video with simlutaneus response recording and realtime 2d shapes, all in one go. i would be very happy.
Thanks
Johann

Comments

  • Hey there ;)
    I managed to find some solutions to my problems. Psychopy seems to be the way to go for me and it is working out relatively fine. The most important step for improvement was to optimize the code. I previously made it so that responses were constantly logged to a csv file, that meant my script was heavily bottlenecked by diskspeed. I was able to fix that and now i have sufficient performance.

    However, i encountered the following Problem:
    using Psychopy backend
    using an inlinescript with the code:
    my_canvas = canvas()
    #do stuff
    my_canvas.show()

    causes the media_player_mpy item following the inline script to not work properly. The Video does not get displayed correctly. The window flashes in solid colors as if one pixel of the video got upscaled to fill the whole screen. changing the order of the two items causes the video to be displayed correctly.
    something in my_canvas.show() upstets the video player.
    Is there a way to reset the screen or window after the inline script?
    I allready tried:
    my_canvas = canvas(exp)
    psychopy.visual.Window.clearBuffer(win)
    win.flip(clearBuffer=True)
    win.flip()
    but it didn't help

    Can anyone help me with this?

  • Hi Johann,

    That's sounds weird and like a bug. Would you mind reporting an issue on github about that? Ideally including a small example script.

    As a fix, you could try to present a sketchpad between inline_script and media player. I don't have the media player installed, so I cannot try myself unfortunately.

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games