简体   繁体   中英

threshold values in a matrix matlab

I need a fast way to perform threshold on image (matrix) regions. The input is a matrix (image), threshold value and radius, for each pixel I need to check if all values within the given radius are less than the threshold,if so, I need to save this value's (pixel's) coordinates. I don't want to make it with double loops, because I need to perform this task many times with several radii. I don't care about minimas or maximas, just that all values around a pixel will be lower than some threshold. Any idea will be very appreciated !

I do not know any fast algorithm for a circular neighborhood. However, if you have have rectangular neighborhood, you can implement the the check very fast look at here for more details: http://leetcode.com/2011/01/sliding-window-maximum.html

Also, you can imporve you speed when you when you have multiple values for the radius. Simply start with the smallest value and calculate the result. For future radius values, if a point did not pass from one of the previous steps, do not process it, there exist a point in a smaller radius (so in the current radius) which is larger than the threshold.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM