Color tracking and movement tracking software debugging
1 view (last 30 days)
Show older comments
Helloo! I am making code that will track the mouth movement of locusts from videos. The locusts have their faces painted green so I trying to identify all RGB green pixels on the first frame to create a region of interest for the rest of the video where I will try to detect changes in pixels which will hopefully correlate to movement. The videos also have camera shake (from the camera trying to focus) so I tried to account for that by calculating the noise. The current error is that "Arrays have incompatible sizes for this operation." for line 27 but I feel like there might be some other issues as well since I am very new to this side of MATLAB. Please help me out appreciate it!! 


0 Comments
Answers (1)
Jinal
on 13 Mar 2023
Hi Ryan,
I understand that in line 27 you are trying to subtract ‘color_to_track’ from the frame that has been read from the video.
An error is being thrown in line 27 because the sizes of ‘frame’ and ‘color_to_track’ are different. The size of ‘frame’ is 240 x 320 x 3, which is the default size of frame for RGB video, while the size of ‘color_to_track’ is 240 x 320 x 1. The error should be resolved by making the following modification in line 25.
color_to_track = repmat(color_to_track, [size(frame,1) size(frame,2) 3]);
You can find more information about dimensions of video for various video formats on the link given below: https://www.mathworks.com/help/matlab/ref/videoreader.readframe.html#buuzswj-4
Hope this helps.
0 Comments
See Also
Categories
Find more on Image Acquisition Toolbox Supported Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!