Randomizing of an Oval Color
1 回表示 (過去 30 日間)
古いコメントを表示
How do I randomize the color of a oval?
My code:
[window, rect] = Screen('OpenWindow', screenNum, 1);
[X,Y] = RectCenter(rect);
disc1 = [X-80,Y-80,X+80,Y+80]+250;
Screen('FillOval',window,[200,200,200], disc1');
Screen('Flip',window);
I figure I need to place variable for [200,200,200], but I'm not sure how to do it.
Please help and thank you, Brett
1 件のコメント
Image Analyst
2012 年 11 月 10 日
I can't run your code. What are Screen(), screenNum, and RectCenter? I guess they must be in some toolbox that you have (and didn't list) and I don't have.
回答 (1 件)
Image Analyst
2012 年 11 月 10 日
編集済み: Image Analyst
2012 年 11 月 10 日
Can you adapt the FAQ http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F to create an ellipse?
EDIT: Actually I've just added a section on "How do I create an ellipse" to the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_an_ellipse.3F so that might help you.
2 件のコメント
Image Analyst
2012 年 11 月 10 日
編集済み: Image Analyst
2012 年 11 月 10 日
I don't remember seeing that toolbox here. The 'Color' property is a very common input argument in many, many functions. Try
Screen('FillOval',window, 'Color', rand(1,3), disc1');
参考
カテゴリ
Help Center および File Exchange で Image display and manipulation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!