Is it possible to change color for the plot function in opticalFlow class?

The plot function in opticalFlow class ( see here ) has three name-value pair arguments. I assumed other regular plot arguments would work too but obviously they don't. I tried to use 'color' unsuccessfully.
I plan to superimpose the plots on images and the current blue color is hardly visible... So my question is: is there any way to change the color of this plot?

 채택된 답변

Unfortunately, this can't be done directly. You need to find a handle to the underlying quiver plot and modify it. Here's some code to help you:
% Compute and plot optic flow
opflow = opticalFlow(randn(100,100),randn(100,100));
plot(opflow,'DecimationFactor',[10 10],'ScaleFactor',10);
% Find quiver handle
q = findobj(gca,'type','Quiver');
% Change color to red
q.Color = 'r';

댓글 수: 1

Thank you Anand. It did work but it slowed things much. Still, this seems to be the only way...

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Oskar Wilhelmsson
Oskar Wilhelmsson 2018년 3월 24일

0 개 추천

I ran into a similar problem. Using "clf" in the beginning of the video loop will make sure the color is always the same, which is what I think you actually want.
Adam Danz
Adam Danz 2026년 3월 24일
The "Color" name-value-pair appeared in the documentation for the plot function in opticalFlow class starting in R2023a.

카테고리

도움말 센터File Exchange에서 Computer Vision Toolbox에 대해 자세히 알아보기

질문:

2016년 5월 31일

답변:

2026년 3월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by