Overlaying text or image onto an already-flipped screen

6 ビュー (過去 30 日間)
Katherine
Katherine 2014 年 2 月 16 日
コメント済み: Image Analyst 2023 年 1 月 31 日
I am using PTB to present static images, and would like to overlay an image with text or a shape after a certain time period. Is it possible to draw onto a texture that has already been flipped? Or can it only be done by creating a new texture with both the old and new stimuli and flipping it again?
Thanks in advance for your help, Katherine
  3 件のコメント
Katherine
Katherine 2014 年 2 月 16 日
sorry, PTB=Psychtoolbox
Image Analyst
Image Analyst 2014 年 2 月 16 日
Not sure what that is - it doesn't seem to be a toolbox from the Mathworks. Did you see my answer below?

サインインしてコメントする。

回答 (2 件)

T
T 2014 年 2 月 18 日
編集済み: T 2014 年 2 月 18 日
I'd recommend asking PTB specific questions on http://tech.groups.yahoo.com/group/psychtoolbox/
You have multiple options.
1. Use Screen('Flip') with the dontClear flag set to 1. The previously drawn stimulus can be overdrawn like that
[fill in the blanks]
Screen('DrawTexture')
Screen('Flip')
Screen('DrawText')
Screen('Flip', [], [], 1)
2. Draw the old texture again, then draw the new thing on top
Screen('DrawTexture')
Screen('Flip')
Screen('DrawTexture')
Screen('DrawText')
Screen('Flip')
Normally for graphics applications you redraw everything in every frame. DontClear is a special case.
If you want to draw multiple textures on top of each other you will likely need to set up alpha blending if your textures are supposed to contain irregular, non-rectangle shapes.
  2 件のコメント
Donna Gift Cabalo
Donna Gift Cabalo 2020 年 6 月 15 日
Hi! I am currently writing a code that present an image and the name(text) of the image at the same time and I used the DrawFormattedText function instead of Screen(DrawText) after DrawTexture. It worked, however, when I tried to replace the text with a predefined array containing the different names of objects (code below), its not working anymore.
DrawFormattedText(mywin, myImagenames, 'center', screenYpixels * 0.25, [1 0 0]);
Do you have any suggestion?
Thanks in advance!
Aiswarya
Aiswarya 2023 年 1 月 31 日
even i have the same issue! please help

サインインしてコメントする。


Image Analyst
Image Analyst 2014 年 2 月 16 日
I'm not exactly sure what you mean but you could use pause() to wait some specified time then use imshow() to display a new image. I don't know what you mean by "draw onto a texture". Perhaps screenshot(s) would help.
  3 件のコメント
Maria Del Carmen Cortes Molina
Maria Del Carmen Cortes Molina 2022 年 8 月 24 日
katherine, I am trying to do the same,
did you solve this problem?
Thank you :D
Image Analyst
Image Analyst 2023 年 1 月 31 日
To insert text into the overlay use text.
To burn text into the image, use insertText in the Computer Vision Toolbox.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by