Home Questions Can you generate target images on the fly?

Can you generate target images on the fly?

DWQA QuestionsCategory: Custom Task DevelopmentCan you generate target images on the fly?
Aaron Wong asked 5 years ago
Hi, I was wondering if it is possible to create a target image or texture while the experiment is running and have that displayed to the screen, rather than having to specify it in advance as a separate target? For example, if I wanted a target to have a certain percentage of (randomly selected) pixels that were a different color, could I generate that in the code somehow and have it be displayed? Alternatively, is there a way to choose a particular pre-generated image file in the code by modifying the VCODE directly rather than having to load all the images in as separate targets and switching between targets? Thanks, Aaron
1 Answers
Koloman Varady Staff answered 5 years ago
Hi Aaron, Hmm, good question. You can change a VCODE to display a different image by overwriting its fill colour (VCODE(5)). How images work is if your fill colour is -1, then the image that's displayed is the 1st (in alphabetical order) jpg/png/bmp that is in the folder. If it is -2, then it will be the 2nd jpg/png/bmp, -3 will be the 3rd, etc. That can be an inconvenience if you have a lot of images in a folder (say 100+ images).. for example, I know of one task that uses about ~200 images and that takes maybe 2 minutes to load in Dexterit-E (which is a real bummer). For overwriting pixels.. best I can think of is using the repeat targets to write lots of small rectangles over the image. If they're small enough (maybe like 1 or 2 mm in length), you could do over 500 squares without losing any frame rate. I don't know if that's good enough but I can't think of much else. Duncan is out today but he might have other ideas. I'll check with him on Tuesday. Hope that helped even a little bit! Cheers, Koloman