Fast Image Thresholding-will a mex file improve speed?
Show older comments
I have some image/video processing code where on each frame I have to threshold it about 3 different times. Right now I simply use...
while(1)
im = getsnapshot; %returns a uint8 640X480 array
im1 = im>50&im<100; %example thresholds
im2 = im >100&im<150;
im3 = im>150&im<200;
%lots more image processing
end
______
I have made the remainder of the code so efficient that at this point, most of the time is spent on the thresholding lines. Any tips to make this faster? (FYI im2bw is much slower).
Is this a situation where a Mex File could improve performance? I know a lot has changes in the last few versions of matlab to make it much faster so I am wondering if its worth mex-ing?
Thanks, Joel
Accepted Answer
More Answers (1)
Chirag Gupta
on 15 Aug 2011
0 votes
You can also use manual trigger mode on your videoinput object to reduce the overhead associated with getsnapshot.
Check the "Acquiring a Single Image in a Loop" demo in the documentation
Categories
Find more on Scope Variables and Generate Names in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!